rubysl-iconv 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
1
+ require File.expand_path('../shared/new', __FILE__)
2
+ require File.expand_path('../fixtures/classes.rb', __FILE__)
3
+
4
+ ruby_version_is ''...'2.0' do
5
+ describe "Iconv.new" do
6
+ it_behaves_like :iconv_new, :new
7
+ end
8
+ end
@@ -0,0 +1,29 @@
1
+ require File.expand_path('../shared/new', __FILE__)
2
+ require File.expand_path('../fixtures/classes.rb', __FILE__)
3
+
4
+ ruby_version_is ''...'2.0' do
5
+ describe "Iconv.open" do
6
+ it_behaves_like :iconv_new, :open
7
+
8
+ it "with a block invokes the block exactly once" do
9
+ count = 0
10
+ Iconv.open "us-ascii", "us-ascii" do
11
+ count += 1
12
+ end
13
+ count.should == 1
14
+ end
15
+
16
+ it "with a block yields the converter" do
17
+ Iconv.open "us-ascii", "us-ascii" do |conv|
18
+ conv.should be_kind_of(Iconv)
19
+ end
20
+ end
21
+
22
+ it "with a block returns the result of the block" do
23
+ Iconv.open("us-ascii", "us-ascii") { "block return value" }.should == "block return value"
24
+ end
25
+
26
+ # not testable with the current API:
27
+ # it "with a block always closes the converter when exiting the block"
28
+ end
29
+ end
@@ -0,0 +1,13 @@
1
+ require File.expand_path('../../fixtures/classes.rb', __FILE__)
2
+ describe :iconv_initialize_exceptions, :shared => true do
3
+ it "raises a TypeError when encoding names are not Strings or string-compatible" do
4
+ lambda { Iconv.send @method, Object.new, "us-ascii", @object }.should raise_error(TypeError)
5
+ lambda { Iconv.send @method, "us-ascii", Object.new, @object }.should raise_error(TypeError)
6
+ end
7
+
8
+ it "raises an Iconv::InvalidEncoding exception when an encoding cannot be found" do
9
+ lambda {
10
+ Iconv.send @method, "x-nonexistent-encoding", "us-ascii", @object
11
+ }.should raise_error(Iconv::InvalidEncoding)
12
+ end
13
+ end
@@ -0,0 +1,33 @@
1
+ require File.expand_path('../initialize_exceptions.rb', __FILE__)
2
+ require File.expand_path('../../fixtures/classes.rb', __FILE__)
3
+
4
+ describe :iconv_new, :shared => true do
5
+ it "creates a new encoding converter" do
6
+ obj = Iconv.send(@method, "us-ascii", "us-ascii")
7
+ begin
8
+ obj.should be_kind_of(Iconv)
9
+ ensure
10
+ obj.close
11
+ end
12
+ end
13
+
14
+ it "when called from a subclass of Iconv instantiates an object of that class" do
15
+ obj = IconvSpecs::IconvSubclass.send(@method, "us-ascii", "us-ascii")
16
+ begin
17
+ obj.should be_kind_of(IconvSpecs::IconvSubclass)
18
+ ensure
19
+ obj.close
20
+ end
21
+ end
22
+
23
+ it "raises a TypeError when encoding names are not Strings or string-compatible" do
24
+ lambda { Iconv.send @method, Object.new, "us-ascii" }.should raise_error(TypeError)
25
+ lambda { Iconv.send @method, "us-ascii", Object.new }.should raise_error(TypeError)
26
+ end
27
+
28
+ it "raises an Iconv::InvalidEncoding exception when an encoding cannot be found" do
29
+ lambda {
30
+ Iconv.send @method, "x-nonexistent-encoding", "us-ascii"
31
+ }.should raise_error(Iconv::InvalidEncoding)
32
+ end
33
+ end
metadata ADDED
@@ -0,0 +1,125 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rubysl-iconv
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Brian Shirai
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-08-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: mspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.5'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.5'
55
+ description: Ruby standard library iconv.
56
+ email:
57
+ - brixen@gmail.com
58
+ executables: []
59
+ extensions:
60
+ - ext/rubysl/iconv/extconf.rb
61
+ extra_rdoc_files: []
62
+ files:
63
+ - .gitignore
64
+ - .travis.yml
65
+ - Gemfile
66
+ - LICENSE
67
+ - README.md
68
+ - Rakefile
69
+ - ext/rubysl/iconv/extconf.rb
70
+ - ext/rubysl/iconv/iconv.c
71
+ - lib/iconv.rb
72
+ - lib/rubysl/iconv.rb
73
+ - lib/rubysl/iconv/version.rb
74
+ - rubysl-iconv.gemspec
75
+ - spec/charset_map_spec.rb
76
+ - spec/close_spec.rb
77
+ - spec/conv_spec.rb
78
+ - spec/failure/failed_spec.rb
79
+ - spec/failure/inspect_spec.rb
80
+ - spec/failure/success_spec.rb
81
+ - spec/failure_spec.rb
82
+ - spec/fixtures/classes.rb
83
+ - spec/iconv_spec.rb
84
+ - spec/new_spec.rb
85
+ - spec/open_spec.rb
86
+ - spec/shared/initialize_exceptions.rb
87
+ - spec/shared/new.rb
88
+ homepage: https://github.com/rubysl/rubysl-iconv
89
+ licenses:
90
+ - BSD
91
+ metadata: {}
92
+ post_install_message:
93
+ rdoc_options: []
94
+ require_paths:
95
+ - lib
96
+ required_ruby_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - '>='
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - '>='
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ requirements: []
107
+ rubyforge_project:
108
+ rubygems_version: 2.0.7
109
+ signing_key:
110
+ specification_version: 4
111
+ summary: Ruby standard library iconv.
112
+ test_files:
113
+ - spec/charset_map_spec.rb
114
+ - spec/close_spec.rb
115
+ - spec/conv_spec.rb
116
+ - spec/failure/failed_spec.rb
117
+ - spec/failure/inspect_spec.rb
118
+ - spec/failure/success_spec.rb
119
+ - spec/failure_spec.rb
120
+ - spec/fixtures/classes.rb
121
+ - spec/iconv_spec.rb
122
+ - spec/new_spec.rb
123
+ - spec/open_spec.rb
124
+ - spec/shared/initialize_exceptions.rb
125
+ - spec/shared/new.rb