yaoc 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -0
  3. data/.travis.yml +4 -0
  4. data/Gemfile +5 -1
  5. data/Guardfile +5 -0
  6. data/Rakefile +3 -0
  7. data/examples/01_hash_enabled_constructors.rb +8 -8
  8. data/examples/02_procs_as_constructors.rb +11 -13
  9. data/examples/03_positional_constructors.rb +7 -13
  10. data/examples/04_compositions.rb +3 -8
  11. data/examples/05_fill_existing_objects.rb +2 -8
  12. data/examples/06_lazy_loading.rb +0 -7
  13. data/examples/all_examples.rb +2 -2
  14. data/lib/yaoc.rb +2 -3
  15. data/lib/yaoc/converter_builder.rb +14 -21
  16. data/lib/yaoc/helper/struct_hash_constructor.rb +3 -4
  17. data/lib/yaoc/helper/to_proc_delegator.rb +4 -6
  18. data/lib/yaoc/many_to_one_mapper_chain.rb +11 -13
  19. data/lib/yaoc/mapper_registry.rb +3 -4
  20. data/lib/yaoc/mapping_base.rb +11 -12
  21. data/lib/yaoc/mapping_to_class.rb +7 -9
  22. data/lib/yaoc/object_mapper.rb +10 -13
  23. data/lib/yaoc/one_to_many_mapper_chain.rb +4 -6
  24. data/lib/yaoc/strategies/to_array_mapping.rb +1 -3
  25. data/lib/yaoc/strategies/to_hash_mapping.rb +1 -3
  26. data/lib/yaoc/transformation_command.rb +27 -8
  27. data/lib/yaoc/transformation_deferred_command.rb +3 -5
  28. data/lib/yaoc/version.rb +1 -1
  29. data/rubocop-todo.yml +96 -0
  30. data/spec/acceptance/fill_existing_objects_spec.rb +30 -30
  31. data/spec/acceptance/map_multiple_objects_to_one_in_a_chain_spec.rb +15 -15
  32. data/spec/acceptance/map_objects_spec.rb +22 -22
  33. data/spec/acceptance/map_one_object_to_many_in_a_chain_spec.rb +15 -15
  34. data/spec/acceptance/map_to_objects_using_other_converters_spec.rb +53 -55
  35. data/spec/acceptance/map_to_objects_with_lazy_loading_spec.rb +17 -17
  36. data/spec/acceptance/map_to_objects_with_positional_constructors_spec.rb +19 -19
  37. data/spec/integration/lib/yaoc/converter_builder_spec.rb +21 -21
  38. data/spec/spec_helper.rb +7 -7
  39. data/spec/support/feature.rb +1 -2
  40. data/spec/unit/lib/yaoc/converter_builder_spec.rb +42 -44
  41. data/spec/unit/lib/yaoc/helper/struct_hash_constructor_spec.rb +15 -15
  42. data/spec/unit/lib/yaoc/helper/to_proc_delegator_spec.rb +11 -11
  43. data/spec/unit/lib/yaoc/many_to_one_mapper_chain_spec.rb +19 -20
  44. data/spec/unit/lib/yaoc/mapper_registry_spec.rb +6 -6
  45. data/spec/unit/lib/yaoc/mapping_base_spec.rb +36 -36
  46. data/spec/unit/lib/yaoc/mapping_to_class_spec.rb +19 -21
  47. data/spec/unit/lib/yaoc/object_mapper_spec.rb +45 -49
  48. data/spec/unit/lib/yaoc/one_to_many_mapper_chain_spec.rb +17 -18
  49. data/spec/unit/lib/yaoc/strategies/to_array_mapping_spec.rb +23 -24
  50. data/spec/unit/lib/yaoc/strategies/to_hash_mapping_spec.rb +25 -25
  51. data/spec/unit/lib/yaoc/transformation_command_spec.rb +13 -13
  52. data/spec/unit/lib/yaoc/transformation_deferred_command_spec.rb +9 -9
  53. data/yaoc.gemspec +1 -0
  54. metadata +18 -2
@@ -1,33 +1,32 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe Yaoc::ConverterBuilder do
4
- subject{
5
- Yaoc::ConverterBuilder.new().tap{|converter|
4
+ subject do
5
+ Yaoc::ConverterBuilder.new.tap do|converter|
6
6
  converter.stub(:converter_class).and_return(converter_class)
7
- }
8
- }
9
-
7
+ end
8
+ end
10
9
 
11
- let(:converter_class){
12
- double("converter_class", map: nil, new: converter)
13
- }
10
+ let(:converter_class)do
11
+ double('converter_class', map: nil, new: converter)
12
+ end
14
13
 
15
- let(:converter){
16
- double("converter", call: nil)
17
- }
14
+ let(:converter)do
15
+ double('converter', call: nil)
16
+ end
18
17
 
19
- let(:default_map_args){
18
+ let(:default_map_args)do
20
19
  {
21
20
  to: :id,
22
21
  from: :id,
23
22
  converter: nil,
24
23
  lazy_loading: false
25
24
  }
26
- }
25
+ end
27
26
 
28
- describe "#command_order" do
27
+ describe '#command_order' do
29
28
 
30
- it "applies command in recorded order as default" do
29
+ it 'applies command in recorded order as default' do
31
30
  subject.command_order = :recorded_order
32
31
 
33
32
  expected_args_first = default_map_args.clone
@@ -45,10 +44,10 @@ describe Yaoc::ConverterBuilder do
45
44
 
46
45
  end
47
46
 
48
- it "applies command in reverse recorded order when wanted" do
47
+ it 'applies command in reverse recorded order when wanted' do
49
48
  subject.command_order = :reverse_order
50
49
 
51
- expected_args_first = default_map_args.clone.merge({to: :name, from: :name})
50
+ expected_args_first = default_map_args.clone.merge(to: :name, from: :name)
52
51
  expected_args_second = default_map_args.clone
53
52
 
54
53
  expect(converter_class).to receive(:map).ordered.with(expected_args_first)
@@ -62,9 +61,9 @@ describe Yaoc::ConverterBuilder do
62
61
  end
63
62
  end
64
63
 
65
- describe "#add_mapping" do
64
+ describe '#add_mapping' do
66
65
 
67
- it "delegates to internal methods" do
66
+ it 'delegates to internal methods' do
68
67
  expect(subject).to receive(:rule).with(to: :id, from: :from, converter: :converter)
69
68
 
70
69
  subject.add_mapping do
@@ -79,8 +78,8 @@ describe Yaoc::ConverterBuilder do
79
78
 
80
79
  end
81
80
 
82
- describe "#rule" do
83
- it "creates a converter" do
81
+ describe '#rule' do
82
+ it 'creates a converter' do
84
83
  expect(converter_class).to receive(:map).with(to: :id, from: :id2, converter: :some_proc, lazy_loading: false)
85
84
 
86
85
  subject.add_mapping do
@@ -91,7 +90,7 @@ describe Yaoc::ConverterBuilder do
91
90
 
92
91
  end
93
92
 
94
- it "uses defaults" do
93
+ it 'uses defaults' do
95
94
  expect(converter_class).to receive(:map).with(default_map_args)
96
95
 
97
96
  subject.add_mapping do
@@ -100,9 +99,9 @@ describe Yaoc::ConverterBuilder do
100
99
 
101
100
  end
102
101
 
103
- it "allows to use array of attributes" do
102
+ it 'allows to use array of attributes' do
104
103
  expected_args_first = default_map_args.clone
105
- expected_args_second = default_map_args.clone.merge({to: :name, from: :name})
104
+ expected_args_second = default_map_args.clone.merge(to: :name, from: :name)
106
105
 
107
106
  expect(converter_class).to receive(:map).ordered.with(expected_args_first)
108
107
  expect(converter_class).to receive(:map).ordered.with(expected_args_second)
@@ -113,9 +112,8 @@ describe Yaoc::ConverterBuilder do
113
112
  end
114
113
 
115
114
  it "use the right 'to' when 'from' in arrays is missing" do
116
- expected_args_first = default_map_args.clone.merge({from: :r_id})
117
- expected_args_second = default_map_args.clone.merge({to: :name, from: :name})
118
-
115
+ expected_args_first = default_map_args.clone.merge(from: :r_id)
116
+ expected_args_second = default_map_args.clone.merge(to: :name, from: :name)
119
117
 
120
118
  expect(converter_class).to receive(:map).ordered.with(expected_args_first)
121
119
  expect(converter_class).to receive(:map).ordered.with(expected_args_second)
@@ -126,7 +124,7 @@ describe Yaoc::ConverterBuilder do
126
124
  end
127
125
  end
128
126
 
129
- it "supports the use of a object converter" do
127
+ it 'supports the use of a object converter' do
130
128
  expect(converter_class).to receive(:map).ordered.with(to: :id, from: :id, converter: kind_of(Proc), lazy_loading: false)
131
129
  other_converter = :some_converter
132
130
 
@@ -137,8 +135,8 @@ describe Yaoc::ConverterBuilder do
137
135
 
138
136
  end
139
137
 
140
- it "supports the collection flag for object converters" do
141
- expected_args = default_map_args.clone.merge({converter: kind_of(Proc)})
138
+ it 'supports the collection flag for object converters' do
139
+ expected_args = default_map_args.clone.merge(converter: kind_of(Proc))
142
140
 
143
141
  expect(converter_class).to receive(:map).ordered.with(expected_args)
144
142
  other_converter = :some_converter
@@ -151,8 +149,8 @@ describe Yaoc::ConverterBuilder do
151
149
 
152
150
  end
153
151
 
154
- it "supports lazy loading" do
155
- expected_args = default_map_args.clone.merge({lazy_loading: true})
152
+ it 'supports lazy loading' do
153
+ expected_args = default_map_args.clone.merge(lazy_loading: true)
156
154
 
157
155
  expect(converter_class).to receive(:map).ordered.with(expected_args)
158
156
 
@@ -162,8 +160,8 @@ describe Yaoc::ConverterBuilder do
162
160
  end
163
161
  end
164
162
 
165
- it "supports a do nothing" do
166
- expected_args = default_map_args.clone.merge({converter: kind_of(Proc)})
163
+ it 'supports a do nothing' do
164
+ expected_args = default_map_args.clone.merge(converter: kind_of(Proc))
167
165
 
168
166
  expect(converter_class).to receive(:map).ordered.with(expected_args)
169
167
 
@@ -174,9 +172,9 @@ describe Yaoc::ConverterBuilder do
174
172
  end
175
173
  end
176
174
 
177
- describe "#converter" do
178
- it "creates a new converter class with the wanted strategy" do
179
- subject = Yaoc::ConverterBuilder.new()
175
+ describe '#converter' do
176
+ it 'creates a new converter class with the wanted strategy' do
177
+ subject = Yaoc::ConverterBuilder.new
180
178
  subject.add_mapping do
181
179
  with_strategy :to_array_mapping
182
180
  end
@@ -184,18 +182,18 @@ describe Yaoc::ConverterBuilder do
184
182
  expect(subject.send(:converter_class).mapping_strategy).to eq(Yaoc::Strategies::ToArrayMapping)
185
183
  end
186
184
 
187
- it "raises an exception when not all commands are applied" do
188
- subject = Yaoc::ConverterBuilder.new()
185
+ it 'raises an exception when not all commands are applied' do
186
+ subject = Yaoc::ConverterBuilder.new
189
187
  subject.strategy = :to_array_mapping
190
188
 
191
- expect{subject.converter({})}.to raise_exception
189
+ expect { subject.converter({}) }.to raise_exception
192
190
  end
193
191
  end
194
192
 
195
- describe "#noop" do
196
- it "returns the input" do
193
+ describe '#noop' do
194
+ it 'returns the input' do
197
195
  expect(subject.noop.call(:some_thing, :expected_value)).to eq :expected_value
198
196
  end
199
197
  end
200
198
 
201
- end
199
+ end
@@ -1,33 +1,33 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Yaoc::Helper::StructHashConstructor do
4
- subject{
5
- Yaoc::Helper::StructH(:id, :name).new(id: 1, name: "no name")
6
- }
4
+ subject do
5
+ Yaoc::Helper::StructH(:id, :name).new(id: 1, name: 'no name')
6
+ end
7
7
 
8
- it "creates a struct with a hash enabled constructor" do
8
+ it 'creates a struct with a hash enabled constructor' do
9
9
  expect(subject.id).to eq 1
10
- expect(subject.name).to eq "no name"
10
+ expect(subject.name).to eq 'no name'
11
11
  end
12
12
 
13
- context "with equal support" do
14
- subject{
13
+ context 'with equal support' do
14
+ subject do
15
15
  Yaoc::Helper::StructHE(:id, :name)
16
- }
16
+ end
17
17
 
18
- it "returns true when all attributes are equal" do
19
- first = subject.new(id: 1, name: "no name")
20
- second = subject.new(id: 1, name: "no name")
18
+ it 'returns true when all attributes are equal' do
19
+ first = subject.new(id: 1, name: 'no name')
20
+ second = subject.new(id: 1, name: 'no name')
21
21
 
22
22
  expect(first).to eq second
23
23
  end
24
24
 
25
- it "returns false when not all atributes are equal" do
26
- first = subject.new(id: 1, name: "no name")
27
- second = subject.new(id: 1, name: "no name2")
25
+ it 'returns false when not all atributes are equal' do
26
+ first = subject.new(id: 1, name: 'no name')
27
+ second = subject.new(id: 1, name: 'no name2')
28
28
 
29
29
  expect(first).not_to eq second
30
30
  end
31
31
  end
32
32
 
33
- end
33
+ end
@@ -1,15 +1,15 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Yaoc::Helper::ToProcDelegator do
4
- subject{
4
+ subject do
5
5
  Yaoc::Helper::ToProcDelegator.new(lazy_proc)
6
- }
6
+ end
7
7
 
8
- let(:lazy_proc){
9
- ->{
8
+ let(:lazy_proc)do
9
+ ->do
10
10
  [:some_value]
11
- }
12
- }
11
+ end
12
+ end
13
13
 
14
14
  it 'evaluates a proc not with initialisation' do
15
15
  expect(lazy_proc).not_to receive :call
@@ -48,18 +48,18 @@ describe Yaoc::Helper::ToProcDelegator do
48
48
  end
49
49
 
50
50
  describe '#nil?' do
51
- it "returns true when delegate value is nil" do
52
- subject = Yaoc::Helper::ToProcDelegator.new(->{nil})
51
+ it 'returns true when delegate value is nil' do
52
+ subject = Yaoc::Helper::ToProcDelegator.new(-> { nil })
53
53
  expect(subject).to be_nil
54
54
  end
55
55
 
56
- it "returns false when delegate value is not nil" do
56
+ it 'returns false when delegate value is not nil' do
57
57
  expect(subject).not_to be_nil
58
58
  end
59
59
  end
60
60
 
61
61
  describe '#_initialisation_proc_loaded?' do
62
- it "returns true, when __getobj__ was accessed" do
62
+ it 'returns true, when __getobj__ was accessed' do
63
63
  expect(subject._initialisation_proc_loaded?).to be_falsy
64
64
  subject.__getobj__
65
65
  expect(subject._initialisation_proc_loaded?).to be_truthy
@@ -83,4 +83,4 @@ describe Yaoc::Helper::ToProcDelegator do
83
83
  end
84
84
  end
85
85
 
86
- end
86
+ end
@@ -2,11 +2,11 @@ require 'spec_helper'
2
2
 
3
3
  describe Yaoc::ManyToOneMapperChain do
4
4
 
5
- subject{
5
+ subject do
6
6
  Yaoc::ManyToOneMapperChain.new(first_mapper, second_mapper)
7
- }
7
+ end
8
8
 
9
- let(:first_mapper){
9
+ let(:first_mapper)do
10
10
  Yaoc::ObjectMapper.new(new_user_class, old_user_class).tap do |mapper|
11
11
  mapper.add_mapping do
12
12
  fetcher :public_send
@@ -14,9 +14,9 @@ describe Yaoc::ManyToOneMapperChain do
14
14
  from: :o_id
15
15
  end
16
16
  end
17
- }
17
+ end
18
18
 
19
- let(:second_mapper){
19
+ let(:second_mapper)do
20
20
  Yaoc::ObjectMapper.new(new_user_class, old_user_class).tap do |mapper|
21
21
  mapper.add_mapping do
22
22
  fetcher :public_send
@@ -24,34 +24,34 @@ describe Yaoc::ManyToOneMapperChain do
24
24
  from: :o_names
25
25
  end
26
26
  end
27
- }
27
+ end
28
28
 
29
- let(:new_user_class){
29
+ let(:new_user_class)do
30
30
  Yaoc::Helper::StructHE(:id, :names)
31
- }
31
+ end
32
32
 
33
- let(:old_user_class){
33
+ let(:old_user_class)do
34
34
  Yaoc::Helper::StructHE(:o_id, :o_names)
35
- }
35
+ end
36
36
 
37
- let(:existing_old_user){
37
+ let(:existing_old_user)do
38
38
  old_user_class.new(
39
39
  o_id: 'existing_user_2',
40
40
  o_names: ['first_name', 'second_name']
41
41
  )
42
- }
42
+ end
43
43
 
44
- let(:existing_user){
44
+ let(:existing_user)do
45
45
  new_user_class.new(
46
46
  id: 'existing_user_2',
47
47
  names: ['first_name', 'second_name']
48
48
  )
49
- }
49
+ end
50
50
 
51
51
  describe '.new' do
52
- subject{
52
+ subject do
53
53
  Yaoc::ManyToOneMapperChain
54
- }
54
+ end
55
55
 
56
56
  it 'converts symbols into converter' do
57
57
  registry = double('registry')
@@ -101,14 +101,14 @@ describe Yaoc::ManyToOneMapperChain do
101
101
  converted_user = subject.load_next(existing_old_user)
102
102
 
103
103
  expect(converted_user.id).to eq 'existing_user_2'
104
- expect(converted_user.names).to eq ["first_name", "second_name"]
104
+ expect(converted_user.names).to eq ['first_name', 'second_name']
105
105
  end
106
106
 
107
107
  it 'raises an exception when too many values are passed' do
108
108
  subject.load_first(existing_old_user)
109
109
  subject.load_next(existing_old_user)
110
110
 
111
- expect{subject.load_next(existing_old_user)}.to raise_error "ToManyInputObjects"
111
+ expect { subject.load_next(existing_old_user) }.to raise_error 'ToManyInputObjects'
112
112
  end
113
113
 
114
114
  end
@@ -132,7 +132,6 @@ describe Yaoc::ManyToOneMapperChain do
132
132
  end
133
133
  end
134
134
 
135
-
136
135
  describe '#dump_first' do
137
136
  it 'dumps the first object into the result object' do
138
137
  converted_user = subject.dump_first(existing_user)
@@ -151,4 +150,4 @@ describe Yaoc::ManyToOneMapperChain do
151
150
  expect(converted_user.o_names).to eq ['first_name', 'second_name']
152
151
  end
153
152
  end
154
- end
153
+ end
@@ -1,19 +1,19 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Yaoc::MapperRegistry do
4
- subject{
4
+ subject do
5
5
  Yaoc::MapperRegistry
6
- }
6
+ end
7
7
 
8
8
  describe '.add' do
9
- it "registers an object" do
9
+ it 'registers an object' do
10
10
  subject.add(:my_key, Object)
11
11
  expect(subject.for(:my_key)).to eq Object
12
12
  end
13
13
  end
14
14
 
15
15
  describe '.for' do
16
- it "returns the registered object" do
16
+ it 'returns the registered object' do
17
17
  subject.add(:my_key, Object)
18
18
  expect(subject.for(:my_key)).to eq Object
19
19
  end
@@ -21,9 +21,9 @@ describe Yaoc::MapperRegistry do
21
21
 
22
22
  describe '.scope_storage' do
23
23
  it 'supports the change of scope storage' do
24
- expect {subject.scope_storage(ScopedStorage::ThreadLocalStorage)}.not_to raise_error
24
+ expect { subject.scope_storage(ScopedStorage::ThreadLocalStorage) }.not_to raise_error
25
25
  end
26
26
 
27
27
  end
28
28
 
29
- end
29
+ end
@@ -1,7 +1,7 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe Yaoc::MappingBase do
4
- subject{
4
+ subject do
5
5
  Struct.new(:to_convert) do
6
6
  include Yaoc::MappingBase
7
7
 
@@ -13,84 +13,84 @@ describe Yaoc::MappingBase do
13
13
  }
14
14
 
15
15
  end
16
- }
16
+ end
17
17
 
18
- describe "created module" do
19
- it "can be inspected" do
18
+ describe 'created module' do
19
+ it 'can be inspected' do
20
20
  subject.map(to: :foo, from: :bar)
21
- expect(subject.class_private_module.inspect).to include("map_0000_bar_to_foo")
21
+ expect(subject.class_private_module.inspect).to include('map_0000_bar_to_foo')
22
22
  end
23
23
  end
24
24
 
25
- describe ".map" do
25
+ describe '.map' do
26
26
 
27
- it "creates a bunch of mapping methods" do
27
+ it 'creates a bunch of mapping methods' do
28
28
  subject.map(to: :foo, from: :bar)
29
29
  subject.map(to: :bar, from: :foo)
30
30
 
31
- expect(subject.new({bar: :my_to_convert, foo: :my_result}).call()).to eq [{:foo=>:my_to_convert, :bar=>:my_result},
32
- {:foo=>:my_to_convert, :bar=>:my_result}]
31
+ expect(subject.new(bar: :my_to_convert, foo: :my_result).call).to eq [{ foo: :my_to_convert, bar: :my_result },
32
+ { foo: :my_to_convert, bar: :my_result }]
33
33
  end
34
34
 
35
- it "delegates to TransformationCommand.create" do
36
- expect(Yaoc::TransformationCommand).to receive(:create).with(to: :bar, from: :foo, deferred: false, conversion_proc: kind_of(Proc)).and_return(->(*){})
37
- subject.map(to: :bar, from: :foo, converter: ->(*){})
35
+ it 'delegates to TransformationCommand.create' do
36
+ expect(Yaoc::TransformationCommand).to receive(:create).with(to: :bar, from: :foo, deferred: false, conversion_proc: kind_of(Proc)).and_return(->(*) {})
37
+ subject.map(to: :bar, from: :foo, converter: ->(*) {})
38
38
  end
39
39
 
40
40
  end
41
41
 
42
- describe "#converter_methods" do
43
- it "preserves method order" do
44
- subject.map(to: 0, from: 1, converter: ->(*){})
45
- subject.map(to: 1, from: :a, converter: ->(*){})
42
+ describe '#converter_methods' do
43
+ it 'preserves method order' do
44
+ subject.map(to: 0, from: 1, converter: ->(*) {})
45
+ subject.map(to: 1, from: :a, converter: ->(*) {})
46
46
 
47
47
  expect(subject.converter_methods).to eq [:map_0000_1_to_0, :map_0001_a_to_1]
48
48
  end
49
49
  end
50
50
 
51
- describe "#fetcher" do
52
- let(:subject_with_fetcher){
51
+ describe '#fetcher' do
52
+ let(:subject_with_fetcher)do
53
53
  Struct.new(:to_convert) do
54
54
  include Yaoc::MappingBase
55
55
 
56
56
  def fetcher
57
- "my_fetcher"
57
+ 'my_fetcher'
58
58
  end
59
59
 
60
60
  end
61
- }
61
+ end
62
62
 
63
- it "uses in class declared fetcher" do
64
- expect(subject_with_fetcher.new().fetcher).to eq "my_fetcher"
63
+ it 'uses in class declared fetcher' do
64
+ expect(subject_with_fetcher.new.fetcher).to eq 'my_fetcher'
65
65
  end
66
66
 
67
- it "uses build in fetcher without a fetcher definition" do
68
- expect(subject.new().fetcher).to eq :fetch
67
+ it 'uses build in fetcher without a fetcher definition' do
68
+ expect(subject.new.fetcher).to eq :fetch
69
69
  end
70
70
 
71
71
  end
72
72
 
73
- describe "#call" do
74
- let(:mapper){
73
+ describe '#call' do
74
+ let(:mapper)do
75
75
  subject.new(:some_thing)
76
- }
76
+ end
77
77
 
78
- it "delegates execution to strategy" do
78
+ it 'delegates execution to strategy' do
79
79
  expect(subject.mapping_strategy).to receive(:call).with mapper
80
80
 
81
81
  mapper.call
82
82
  end
83
83
 
84
- it "return nil when to_convert is nil" do
84
+ it 'return nil when to_convert is nil' do
85
85
  mapper.to_convert = nil
86
86
  expect(mapper.call).to be_nil
87
87
  end
88
88
 
89
89
  end
90
90
 
91
- describe "#to_proc" do
92
- it "creates a wrapper around call" do
93
- mapper = subject.new()
91
+ describe '#to_proc' do
92
+ it 'creates a wrapper around call' do
93
+ mapper = subject.new
94
94
  mapper_as_proc = mapper.to_proc
95
95
  expect(mapper).to receive :call
96
96
 
@@ -112,14 +112,14 @@ describe Yaoc::MappingBase do
112
112
  mapper_as_proc = mapper.to_proc
113
113
 
114
114
  mapper.stub(:call) do
115
- raise "MyException"
115
+ fail 'MyException'
116
116
  end
117
117
 
118
118
  expect(mapper).to receive(:to_convert=).ordered.with(:some_thing)
119
119
  expect(mapper).to receive(:to_convert=).ordered.with(:old_some_thing)
120
120
 
121
- expect{mapper_as_proc.call(:some_thing)}.to raise_error "MyException"
121
+ expect { mapper_as_proc.call(:some_thing) }.to raise_error 'MyException'
122
122
  end
123
123
  end
124
124
 
125
- end
125
+ end