hashie 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,35 +9,35 @@ describe Hashie::Trash do
9
9
 
10
10
  describe 'translating properties' do
11
11
  it 'adds the property to the list' do
12
- TrashTest.properties.should include(:first_name)
12
+ expect(TrashTest.properties).to include(:first_name)
13
13
  end
14
14
 
15
15
  it 'creates a method for reading the property' do
16
- trash.should respond_to(:first_name)
16
+ expect(trash).to respond_to(:first_name)
17
17
  end
18
18
 
19
19
  it 'creates a method for writing the property' do
20
- trash.should respond_to(:first_name=)
20
+ expect(trash).to respond_to(:first_name=)
21
21
  end
22
22
 
23
23
  it 'creates a method for writing the translated property' do
24
- trash.should respond_to(:firstName=)
24
+ expect(trash).to respond_to(:firstName=)
25
25
  end
26
26
 
27
27
  it 'does not create a method for reading the translated property' do
28
- trash.should_not respond_to(:firstName)
28
+ expect(trash).not_to respond_to(:firstName)
29
29
  end
30
30
 
31
31
  it 'maintains translations hash mapping from the original to the translated name' do
32
- TrashTest.translations[:firstName].should eq :first_name
32
+ expect(TrashTest.translations[:firstName]).to eq :first_name
33
33
  end
34
34
 
35
35
  it 'maintains inverse translations hash mapping from the translated to the original name' do
36
- TrashTest.inverse_translations[:first_name].should eq :firstName
36
+ expect(TrashTest.inverse_translations[:first_name]).to eq :firstName
37
37
  end
38
38
 
39
39
  it '#permitted_input_keys contain the :from key of properties with translations' do
40
- TrashTest.permitted_input_keys.should include :firstName
40
+ expect(TrashTest.permitted_input_keys).to include :firstName
41
41
  end
42
42
  end
43
43
 
@@ -47,61 +47,61 @@ describe Hashie::Trash do
47
47
  end
48
48
 
49
49
  it '#permitted_input_keys contain names of properties without translations' do
50
- TrashTestPermitted.permitted_input_keys.should include :id
50
+ expect(TrashTestPermitted.permitted_input_keys).to include :id
51
51
  end
52
52
  end
53
53
 
54
54
  describe 'writing to properties' do
55
55
  it 'does not write to a non-existent property using []=' do
56
- lambda { trash['abc'] = 123 }.should raise_error(NoMethodError)
56
+ expect { trash['abc'] = 123 }.to raise_error(NoMethodError)
57
57
  end
58
58
 
59
59
  it 'writes to an existing property using []=' do
60
- lambda { trash['first_name'] = 'Bob' }.should_not raise_error
60
+ expect { trash['first_name'] = 'Bob' }.not_to raise_error
61
61
  end
62
62
 
63
63
  it 'writes to a translated property using []=' do
64
- lambda { trash['firstName'] = 'Bob' }.should_not raise_error
64
+ expect { trash['firstName'] = 'Bob' }.not_to raise_error
65
65
  end
66
66
 
67
67
  it 'reads/writes to an existing property using a method call' do
68
68
  trash.first_name = 'Franklin'
69
- trash.first_name.should eq 'Franklin'
69
+ expect(trash.first_name).to eq 'Franklin'
70
70
  end
71
71
 
72
72
  it 'writes to an translated property using a method call' do
73
73
  trash.firstName = 'Franklin'
74
- trash.first_name.should eq 'Franklin'
74
+ expect(trash.first_name).to eq 'Franklin'
75
75
  end
76
76
 
77
77
  it 'writes to a translated property using #replace' do
78
78
  trash.replace(firstName: 'Franklin')
79
- trash.first_name.should eq 'Franklin'
79
+ expect(trash.first_name).to eq 'Franklin'
80
80
  end
81
81
 
82
82
  it 'writes to a non-translated property using #replace' do
83
83
  trash.replace(first_name: 'Franklin')
84
- trash.first_name.should eq 'Franklin'
84
+ expect(trash.first_name).to eq 'Franklin'
85
85
  end
86
86
  end
87
87
 
88
88
  describe ' initializing with a Hash' do
89
89
  it 'does not initialize non-existent properties' do
90
- lambda { TrashTest.new(bork: 'abc') }.should raise_error(NoMethodError)
90
+ expect { TrashTest.new(bork: 'abc') }.to raise_error(NoMethodError)
91
91
  end
92
92
 
93
93
  it 'sets the desired properties' do
94
- TrashTest.new(first_name: 'Michael').first_name.should eq 'Michael'
94
+ expect(TrashTest.new(first_name: 'Michael').first_name).to eq 'Michael'
95
95
  end
96
96
 
97
97
  context 'with both the translated property and the property' do
98
98
  it 'sets the desired properties' do
99
- TrashTest.new(first_name: 'Michael', firstName: 'Maeve').first_name.should eq 'Michael'
99
+ expect(TrashTest.new(first_name: 'Michael', firstName: 'Maeve').first_name).to eq 'Michael'
100
100
  end
101
101
  end
102
102
 
103
103
  it 'sets the translated properties' do
104
- TrashTest.new(firstName: 'Michael').first_name.should eq 'Michael'
104
+ expect(TrashTest.new(firstName: 'Michael').first_name).to eq 'Michael'
105
105
  end
106
106
  end
107
107
 
@@ -113,21 +113,21 @@ describe Hashie::Trash do
113
113
  let(:lambda_trash) { TrashLambdaTest.new }
114
114
 
115
115
  it 'translates the value given on initialization with the given lambda' do
116
- TrashLambdaTest.new(firstName: 'Michael').first_name.should eq 'Michael'.reverse
116
+ expect(TrashLambdaTest.new(firstName: 'Michael').first_name).to eq 'Michael'.reverse
117
117
  end
118
118
 
119
119
  it 'does not translate the value if given with the right property' do
120
- TrashTest.new(first_name: 'Michael').first_name.should eq 'Michael'
120
+ expect(TrashTest.new(first_name: 'Michael').first_name).to eq 'Michael'
121
121
  end
122
122
 
123
123
  it 'translates the value given as property with the given lambda' do
124
124
  lambda_trash.firstName = 'Michael'
125
- lambda_trash.first_name.should eq 'Michael'.reverse
125
+ expect(lambda_trash.first_name).to eq 'Michael'.reverse
126
126
  end
127
127
 
128
128
  it 'does not translate the value given as right property' do
129
129
  lambda_trash.first_name = 'Michael'
130
- lambda_trash.first_name.should eq 'Michael'
130
+ expect(lambda_trash.first_name).to eq 'Michael'
131
131
  end
132
132
  end
133
133
 
@@ -140,12 +140,12 @@ describe Hashie::Trash do
140
140
 
141
141
  it 'translates the value given as property with the given lambda' do
142
142
  lambda_trash.firstName = 'Michael'
143
- lambda_trash.first_name.should eq 'Michael'.reverse
143
+ expect(lambda_trash.first_name).to eq 'Michael'.reverse
144
144
  end
145
145
 
146
146
  it 'does not translate the value given as right property' do
147
147
  lambda_trash.first_name = 'Michael'
148
- lambda_trash.first_name.should eq 'Michael'
148
+ expect(lambda_trash.first_name).to eq 'Michael'
149
149
  end
150
150
  end
151
151
 
@@ -158,11 +158,11 @@ describe Hashie::Trash do
158
158
 
159
159
  it 'translates the value given as property with the given lambda' do
160
160
  lambda_trash.first_name = 'Michael'
161
- lambda_trash.first_name.should eq 'Michael'.reverse
161
+ expect(lambda_trash.first_name).to eq 'Michael'.reverse
162
162
  end
163
163
 
164
164
  it 'transforms the value when given in constructor' do
165
- TrashLambdaTestWithProperties.new(first_name: 'Michael').first_name.should eq 'Michael'.reverse
165
+ expect(TrashLambdaTestWithProperties.new(first_name: 'Michael').first_name).to eq 'Michael'.reverse
166
166
  end
167
167
 
168
168
  context 'when :from option is given' do
@@ -171,13 +171,13 @@ describe Hashie::Trash do
171
171
  end
172
172
 
173
173
  it 'does not override the :from option in the constructor' do
174
- TrashLambdaTest3.new(first_name: 'Michael').first_name.should eq 'Michael'
174
+ expect(TrashLambdaTest3.new(first_name: 'Michael').first_name).to eq 'Michael'
175
175
  end
176
176
 
177
177
  it 'does not override the :from option when given as property' do
178
178
  t = TrashLambdaTest3.new
179
179
  t.first_name = 'Michael'
180
- t.first_name.should eq 'Michael'
180
+ expect(t.first_name).to eq 'Michael'
181
181
  end
182
182
 
183
183
  end
@@ -2,6 +2,6 @@ require 'spec_helper'
2
2
 
3
3
  describe Hashie do
4
4
  it 'has a version' do
5
- Hashie::VERSION.should_not be_nil
5
+ expect(Hashie::VERSION).not_to be_nil
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hashie
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bleigh
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-06 00:00:00.000000000 Z
12
+ date: 2014-04-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake