File tree 4 files changed +43
-0
lines changed
4 files changed +43
-0
lines changed Original file line number Diff line number Diff line change 1
1
require 'bundler'
2
2
Bundler ::GemHelper . install_tasks
3
+
4
+ require 'rake/testtask'
5
+ Rake ::TestTask . new ( :test ) do |test |
6
+ test . libs << 'lib' << 'test'
7
+ test . pattern = 'test/**/*_test.rb'
8
+ test . verbose = true
9
+ end
10
+
11
+ task :default => :test
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version =" 1.0" >
4
+ <dict >
5
+ <key >URL</key >
6
+ <string >https://github.com/peterc/webloc</string >
7
+ </dict >
8
+ </plist >
Original file line number Diff line number Diff line change
1
+ require 'test/unit'
2
+ require 'webloc'
3
+
4
+ class WeblocTest < Test ::Unit ::TestCase
5
+ def test_webloc_object_requires_url
6
+ assert_raise ( ArgumentError ) { Webloc . new }
7
+ end
8
+
9
+ def test_webloc_object_created_with_url
10
+ assert_equal 'http://example.com' , Webloc . new ( 'http://example.com' ) . url
11
+ end
12
+
13
+ def test_webloc_object_loaded_from_old_style_file
14
+ assert_equal 'https://github.com/peterc/webloc' , Webloc . load ( File . dirname ( __FILE__ ) + '/oldstyle.webloc' ) . url
15
+ end
16
+
17
+ def test_webloc_object_loaded_from_plist_file
18
+ assert_equal 'https://github.com/peterc/webloc' , Webloc . load ( File . dirname ( __FILE__ ) + '/pliststyle.webloc' ) . url
19
+ end
20
+
21
+ def test_webloc_generates_valid_data
22
+ data = File . read ( File . dirname ( __FILE__ ) + '/oldstyle.webloc' )
23
+ data = data . force_encoding ( 'binary' ) rescue data
24
+ assert_equal data , Webloc . new ( 'https://github.com/peterc/webloc' ) . data
25
+ end
26
+ end
You can’t perform that action at this time.
0 commit comments