File tree 4 files changed +15
-4
lines changed
4 files changed +15
-4
lines changed Original file line number Diff line number Diff line change 1
- source "http ://rubygems.org"
1
+ source "https ://rubygems.org"
2
2
3
3
# Specify your gem's dependencies in webloc.gemspec
4
4
gemspec
Original file line number Diff line number Diff line change @@ -33,6 +33,6 @@ def data
33
33
end
34
34
35
35
def save ( filename )
36
- File . open ( filename , 'w:binary ' ) { |f | f . print data }
36
+ File . open ( filename , 'wb ' ) { |f | f . write data }
37
37
end
38
38
end
Original file line number Diff line number Diff line change 1
1
class Webloc
2
- VERSION = "0.0.1 "
2
+ VERSION = "0.1.0 "
3
3
end
Original file line number Diff line number Diff line change 1
1
require 'test/unit'
2
2
require 'webloc'
3
+ require 'tempfile'
3
4
4
5
class WeblocTest < Test ::Unit ::TestCase
5
6
def test_webloc_object_requires_url
@@ -20,7 +21,17 @@ def test_webloc_object_loaded_from_plist_file
20
21
21
22
def test_webloc_generates_valid_data
22
23
data = File . read ( File . dirname ( __FILE__ ) + '/oldstyle.webloc' )
23
- data = data . force_encoding ( 'binary' ) rescue data
24
24
assert_equal data , Webloc . new ( 'https://github.com/peterc/webloc' ) . data
25
25
end
26
+
27
+ def test_webloc_can_write_file
28
+ file = Tempfile . new ( 'test-webloc' )
29
+ begin
30
+ Webloc . new ( 'https://github.com/peterc/webloc' ) . save ( file . path )
31
+ assert_equal Webloc . new ( 'https://github.com/peterc/webloc' ) . data , File . read ( file . path )
32
+ ensure
33
+ file . close
34
+ file . unlink
35
+ end
36
+ end
26
37
end
You can’t perform that action at this time.
0 commit comments