json-crud-api 0.0.5 → 0.0.7

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.
@@ -1,4 +1,4 @@
1
- require "helper"
1
+ require "spec_helper"
2
2
 
3
3
  describe JsonCrudApi::Presenter do
4
4
  before(:each) do
@@ -13,9 +13,9 @@ describe JsonCrudApi::Presenter do
13
13
 
14
14
  describe '#initialize' do
15
15
  it 'should inject dependencies correctly' do
16
- @presenter.model.should be @mock_model
17
- @presenter.include.should eq({ :no_operation => 10 })
18
- @presenter.exclude.should eq({ :no_operation => 11 })
16
+ expect(@presenter.model).to be @mock_model
17
+ expect(@presenter.include).to eq({ :no_operation => 10 })
18
+ expect(@presenter.exclude).to eq({ :no_operation => 11 })
19
19
  end
20
20
 
21
21
  it 'should throw an exception if model is not set' do
@@ -24,195 +24,216 @@ describe JsonCrudApi::Presenter do
24
24
 
25
25
  describe '#render' do
26
26
  it 'should output a single property in data based on model properties' do
27
- @mock_model.should_receive(:properties)
27
+ expect(@mock_model).to receive(:properties)
28
28
  .and_return([OpenStruct.new(:name => :one)])
29
29
  data = OpenStruct.new(:one => "Test")
30
30
 
31
- @presenter.render(data).should eq({ :one => "Test" })
31
+ expect(@presenter.render(data)).to eq({ :one => "Test" })
32
32
  end
33
33
 
34
34
  it 'should not return data properties that do not have model properties' do
35
- @mock_model.should_receive(:properties)
35
+ expect(@mock_model).to receive(:properties)
36
36
  .and_return([OpenStruct.new(:name => :one)])
37
37
  data = OpenStruct.new(:one => "YES", :two => "OK")
38
38
 
39
- @presenter.render(data).should eq({ :one => "YES" })
39
+ expect(@presenter.render(data)).to eq({ :one => "YES" })
40
40
  end
41
41
 
42
42
  it 'should return nil for model properties that do not have data' do
43
- @mock_model.should_receive(:properties)
43
+ expect(@mock_model).to receive(:properties)
44
44
  .and_return([
45
45
  OpenStruct.new(:name => :one),
46
46
  OpenStruct.new(:name => :two),
47
47
  ])
48
48
  data = OpenStruct.new(:two => "OK")
49
49
 
50
- @presenter.render(data).should eq({ :one => nil, :two => 'OK' })
50
+ expect(@presenter.render(data)).to eq({ :one => nil, :two => 'OK' })
51
51
  end
52
52
 
53
53
  it 'should call itself when supplied with an array and return an array of the results' do
54
- @mock_model.stub :properties do
54
+ expect(@mock_model).to receive(:properties).and_return(
55
55
  [OpenStruct.new(:name => :one)]
56
- end
56
+ )
57
+
57
58
  data = [OpenStruct.new(:one => "Test"), OpenStruct.new(:one => "TEST2")]
58
59
 
59
- @presenter.render(data).should eq([{ :one => "Test" }, { :one => "TEST2" }])
60
+ expect(@presenter.render(data)).to eq([{ :one => "Test" }, { :one => "TEST2" }])
60
61
  end
61
62
 
62
63
  it 'should include render:all properties' do
63
64
  @presenter.include = { :render => { :all => [:five] } }
64
- @mock_model.stub :properties do
65
+ expect(@mock_model).to receive(:properties).and_return(
65
66
  [OpenStruct.new(:name => :two)]
66
- end
67
+ )
68
+
67
69
  data = OpenStruct.new(:two => "Two",:five=>"Five")
68
70
 
69
- @presenter.render(data).should eq({ :two => "Two", :five=>"Five" })
71
+ expect(@presenter.render(data)).to eq({ :two => "Two", :five=>"Five" })
70
72
  end
71
73
 
72
74
  it 'should include global:all properties' do
73
75
  @presenter.include = { :all => [:five] }
74
- @mock_model.stub :properties do
75
- [ OpenStruct.new(:name => :two)]
76
- end
76
+ expect(@mock_model).to receive(:properties).and_return(
77
+ [OpenStruct.new(:name => :two)]
78
+ )
79
+
77
80
  data = OpenStruct.new(:two => "Two",:five=>"Five")
78
81
 
79
- @presenter.render(data).should eq({ :two => "Two", :five=>"Five" })
82
+ expect(@presenter.render(data)).to eq({ :two => "Two", :five=>"Five" })
80
83
  end
81
84
 
82
85
  it 'should include global:operation properties' do
83
86
  @presenter.include = { :test => [:five] }
84
- @mock_model.stub :properties do
85
- [ OpenStruct.new(:name => :two)]
86
- end
87
+ expect(@mock_model).to receive(:properties).and_return(
88
+ [OpenStruct.new(:name => :two)]
89
+ )
90
+
87
91
  data = OpenStruct.new(:two => "Two",:five=>"Five")
88
92
 
89
- @presenter.render(data, :test).should eq({ :two => "Two", :five=>"Five" })
93
+ expect(@presenter.render(data, :test)).to eq({ :two => "Two", :five=>"Five" })
90
94
  end
91
95
 
92
96
  it 'should include render:operation properties' do
93
97
  @presenter.include = { :render => { :test => [:five] } }
94
- @mock_model.stub :properties do
95
- [ OpenStruct.new(:name => :two)]
96
- end
98
+ expect(@mock_model).to receive(:properties).and_return(
99
+ [OpenStruct.new(:name => :two)]
100
+ )
101
+
97
102
  data = OpenStruct.new(:two => "Two",:five=>"Five")
98
103
 
99
- @presenter.render(data, :test).should eq({ :two => "Two", :five=>"Five" })
104
+ expect(@presenter.render(data, :test)).to eq({ :two => "Two", :five=>"Five" })
100
105
  end
101
106
 
102
107
  it 'should exclude render:all properties' do
103
108
  @presenter.exclude = { :render => { :all => [:one] } }
104
- @mock_model.stub :properties do
105
- [OpenStruct.new(:name => :one), OpenStruct.new(:name => :two)]
106
- end
109
+ expect(@mock_model).to receive(:properties).and_return(
110
+ [OpenStruct.new(:name => :two)]
111
+ )
112
+
107
113
  data = OpenStruct.new(:one => "Test",:two => "Two")
108
114
 
109
- @presenter.render(data).should eq({ :two => "Two" })
115
+ expect(@presenter.render(data)).to eq({ :two => "Two" })
110
116
  end
111
117
 
112
118
  it 'should exclude global:all properties' do
113
119
  @presenter.exclude = { :all => [:one] }
114
- @mock_model.stub :properties do
120
+ expect(@mock_model).to receive(:properties).and_return(
115
121
  [OpenStruct.new(:name => :one), OpenStruct.new(:name => :two)]
116
- end
122
+ )
123
+
117
124
  data = OpenStruct.new(:one => "Test",:two => "Two")
118
125
 
119
- @presenter.render(data).should eq({ :two => "Two" })
126
+ expect(@presenter.render(data)).to eq({ :two => "Two" })
120
127
  end
121
128
 
122
129
  it 'should exclude render:operation properties' do
123
130
  @presenter.exclude = { :render => { :test => [:one] } }
124
- @mock_model.stub :properties do
131
+ expect(@mock_model).to receive(:properties).and_return(
125
132
  [OpenStruct.new(:name => :one), OpenStruct.new(:name => :two)]
126
- end
133
+ )
134
+
127
135
  data = OpenStruct.new(:one => "Test",:two => "Two")
128
136
 
129
- @presenter.render(data, :test).should eq({ :two => "Two" })
137
+ expect(@presenter.render(data, :test)).to eq({ :two => "Two" })
130
138
  end
131
139
 
132
140
  it 'should exclude global:operation properties' do
133
141
  @presenter.exclude = { :test => [:one] }
134
- @mock_model.stub :properties do
142
+ expect(@mock_model).to receive(:properties).and_return(
135
143
  [OpenStruct.new(:name => :one), OpenStruct.new(:name => :two)]
136
- end
144
+ )
145
+
137
146
  data = OpenStruct.new(:one => "Test",:two => "Two")
138
147
 
139
- @presenter.render(data, :test).should eq({ :two => "Two" })
148
+ expect(@presenter.render(data, :test)).to eq({ :two => "Two" })
140
149
  end
141
150
 
142
151
  it 'should exclude combinations of render:all and render:operation properties' do
143
152
  @presenter.exclude = { :render => { :all => [:two] , :test => [:one] } }
144
- @mock_model.stub :properties do
153
+ expect(@mock_model).to receive(:properties).and_return(
145
154
  [OpenStruct.new(:name => :one), OpenStruct.new(:name => :two), OpenStruct.new(:name => :three)]
146
- end
155
+ )
147
156
  data = OpenStruct.new(:one => "Test",:two => "Two",:three => "Three")
148
157
 
149
- @presenter.render(data, :test).should eq({ :three => "Three" })
158
+ expect(@presenter.render(data, :test)).to eq({ :three => "Three" })
150
159
  end
151
160
  end
152
161
 
153
162
  describe '#parse' do
154
163
  it 'should output a single property in data based on model properties' do
155
- @mock_model.stub :properties do
164
+ expect(@mock_model).to receive(:properties).and_return(
156
165
  [OpenStruct.new(:name => :one)]
157
- end
166
+ )
158
167
  data = { :one => 1 }
159
- @presenter.parse(data).should eq({:one => 1})
168
+ expect(@presenter.parse(data)).to eq({:one => 1})
160
169
  end
161
170
 
162
171
  it 'should not output properties of data that are not in model properties' do
163
- @mock_model.stub :properties do
172
+ expect(@mock_model).to receive(:properties).and_return(
164
173
  [OpenStruct.new(:name => :one)]
165
- end
174
+ )
166
175
  data = { :one => 1, :two => 2 }
167
- @presenter.parse(data).should eq({:one => 1})
176
+ expect(@presenter.parse(data)).to eq({:one => 1})
168
177
  end
169
178
 
170
179
  it 'should not output model properties with no data property' do
171
- @mock_model.stub :properties do
172
- [OpenStruct.new(:name => :one)]
173
- [OpenStruct.new(:name => :two)]
174
- end
180
+ expect(@mock_model).to receive(:properties).and_return(
181
+ [OpenStruct.new(:name => :one),OpenStruct.new(:name => :two)]
182
+ )
175
183
  data = { :two => 2 }
176
- @presenter.parse(data).should eq({:two => 2})
184
+ expect(@presenter.parse(data)).to eq({:two => 2})
177
185
  end
178
186
 
179
187
  it 'should call itself when supplied with an array and return an array of the results' do
180
- @mock_model.stub :properties do
188
+ expect(@mock_model).to receive(:properties).and_return(
181
189
  [OpenStruct.new(:name => :one)]
182
- end
190
+ )
191
+
183
192
  data = [{ :one => 1 }]
184
193
 
185
- @presenter.parse(data).should eq([{ :one => 1 }])
194
+ expect(@presenter.parse(data)).to eq([{ :one => 1 }])
186
195
  end
187
196
 
188
197
  it 'should exclude parse:all properties' do
189
198
  @presenter.exclude = { :parse => { :all => [:one] } }
190
- @mock_model.stub :properties do
199
+ expect(@mock_model).to receive(:properties).and_return(
191
200
  [OpenStruct.new(:name => :one), OpenStruct.new(:name => :two)]
192
- end
201
+ )
202
+
193
203
  data = OpenStruct.new(:one => "Test",:two => "Two")
194
204
 
195
- @presenter.parse(data).should eq({ :two => "Two" })
205
+ expect(@presenter.parse(data)).to eq({ :two => "Two" })
196
206
  end
197
207
 
198
208
  it 'should exclude parse:operation properties' do
199
209
  @presenter.exclude = { :parse => { :test => [:one] } }
200
- @mock_model.stub :properties do
210
+ expect(@mock_model).to receive(:properties).and_return(
201
211
  [OpenStruct.new(:name => :one), OpenStruct.new(:name => :two)]
202
- end
212
+ )
213
+
203
214
  data = OpenStruct.new(:one => "Test",:two => "Two")
204
215
 
205
- @presenter.parse(data, :test).should eq({ :two => "Two" })
216
+ expect(@presenter.parse(data, :test)).to eq({ :two => "Two" })
206
217
  end
207
218
 
208
219
  it 'should exclude combinations of parse:all and parse:operation properties' do
209
220
  @presenter.exclude = { :parse => { :all => [:two] , :test => [:one] } }
210
- @mock_model.stub :properties do
221
+ expect(@mock_model).to receive(:properties).and_return(
211
222
  [OpenStruct.new(:name => :one), OpenStruct.new(:name => :two), OpenStruct.new(:name => :three)]
212
- end
223
+ )
213
224
  data = OpenStruct.new(:one => "Test",:two => "Two",:three => "Three")
214
225
 
215
- @presenter.parse(data, :test).should eq({ :three => "Three" })
226
+ expect(@presenter.parse(data, :test)).to eq({ :three => "Three" })
227
+ end
228
+
229
+ it 'should not supply keys that are not in the supplied data' do
230
+ expect(@mock_model).to receive(:properties).and_return(
231
+ [OpenStruct.new(:name => :one), OpenStruct.new(:name => :two), OpenStruct.new(:name => :three)]
232
+ )
233
+
234
+ data = OpenStruct.new(:one => "Test",:two => "Two")
235
+
236
+ expect(@presenter.parse(data, :test).keys).to_not include :three
216
237
  end
217
238
  end
218
239
  end
@@ -1,4 +1,4 @@
1
- require "helper"
1
+ require "spec_helper"
2
2
 
3
3
  describe JsonCrudApi::Service do
4
4
  before(:each) do
@@ -15,215 +15,215 @@ describe JsonCrudApi::Service do
15
15
 
16
16
  describe '#initialize' do
17
17
  it 'should inject dependencies correctly' do
18
- @service.log_service.should be @mock_log
19
- @service.model.should be @mock_model
20
- @service.scope_map.should be @mock_map
18
+ expect(@service.log_service).to be @mock_log
19
+ expect(@service.model).to be @mock_model
20
+ expect(@service.scope_map).to be @mock_map
21
21
  end
22
22
 
23
23
  it 'should initialize user and scopes to nil' do
24
- @service.user.should be nil
25
- @service.user_scopes.should be nil
24
+ expect(@service.user).to be nil
25
+ expect(@service.user_scopes).to be nil
26
26
  end
27
27
  end
28
28
 
29
29
  describe '#create' do
30
30
  it 'should call create on model with params' do
31
31
  params = { :one => 'one', :two => 'two' }
32
- @mock_model.should_receive(:create).with(params).and_return(2)
33
- @service.create(params).should eq 2
32
+ expect(@mock_model).to receive(:create).with(params).and_return(2)
33
+ expect(@service.create(params)).to eq 2
34
34
  end
35
35
  end
36
36
 
37
37
  describe '#exists?' do
38
38
  it 'should call all on model with correct id' do
39
39
  query_object = OpenStruct.new :count => 1
40
- @mock_model.should_receive(:key)
40
+ expect(@mock_model).to receive(:key)
41
41
  .and_return(OpenStruct.new(:first => OpenStruct.new(:name => :id)))
42
- @mock_model.should_receive(:all).with(:id => 3)
42
+ expect(@mock_model).to receive(:all).with(:id => 3)
43
43
  .and_return(query_object)
44
- @service.exists?(3).should eq true
44
+ expect(@service.exists?(3)).to eq true
45
45
  end
46
46
 
47
47
  it 'should return false when count is zero' do
48
48
  query_object = OpenStruct.new :count => 0
49
- @mock_model.should_receive(:key)
49
+ expect(@mock_model).to receive(:key)
50
50
  .and_return(OpenStruct.new(:first => OpenStruct.new(:name => :id)))
51
- @mock_model.should_receive(:all).with(:id => 3)
51
+ expect(@mock_model).to receive(:all).with(:id => 3)
52
52
  .and_return(query_object)
53
- @service.exists?(3).should eq false
53
+ expect(@service.exists?(3)).to eq false
54
54
  end
55
55
 
56
56
  it 'should return true when count is one' do
57
57
  query_object = OpenStruct.new :count => 1
58
- @mock_model.should_receive(:key)
58
+ expect(@mock_model).to receive(:key)
59
59
  .and_return(OpenStruct.new(:first => OpenStruct.new(:name => :id)))
60
- @mock_model.should_receive(:all).with(:id => 3)
60
+ expect(@mock_model).to receive(:all).with(:id => 3)
61
61
  .and_return(query_object)
62
- @service.exists?(3).should eq true
62
+ expect(@service.exists?(3)).to eq true
63
63
  end
64
64
 
65
65
  it 'should return true when count is more than one' do
66
66
  query_object = OpenStruct.new :count => 2
67
- @mock_model.should_receive(:key)
67
+ expect(@mock_model).to receive(:key)
68
68
  .and_return(OpenStruct.new(:first => OpenStruct.new(:name => :id)))
69
- @mock_model.should_receive(:all).with(:id => 3)
69
+ expect(@mock_model).to receive(:all).with(:id => 3)
70
70
  .and_return(query_object)
71
- @service.exists?(3).should eq true
71
+ expect(@service.exists?(3)).to eq true
72
72
  end
73
73
  end
74
74
 
75
75
  describe '#get_all' do
76
76
  it 'should call all on model and return output' do
77
- @mock_model.should_receive(:all).with().and_return(67)
78
- @service.get_all.should eq 67
77
+ expect(@mock_model).to receive(:all).and_return(67)
78
+ expect(@service.get_all).to eq 67
79
79
  end
80
80
  end
81
81
 
82
82
  describe '#get' do
83
83
  it 'should call first on model with correct id and return result' do
84
- @mock_model.should_receive(:key)
84
+ expect(@mock_model).to receive(:key)
85
85
  .and_return(OpenStruct.new(:first => OpenStruct.new(:name => :id)))
86
- @mock_model.should_receive(:first).with({:id=>8}).and_return(123)
87
- @service.get(8).should eq 123
86
+ expect(@mock_model).to receive(:first).with({:id=>8}).and_return(123)
87
+ expect(@service.get(8)).to eq 123
88
88
  end
89
89
  end
90
90
 
91
91
  describe '#update' do
92
92
  it 'should call get on service with correct id' do
93
- @service.should_receive(:get).with(5).and_return(nil)
93
+ expect(@service).to receive(:get).with(5).and_return(nil)
94
94
  @service.update(5,nil)
95
95
  end
96
96
 
97
97
  it 'should return false if get returns nil' do
98
- @service.should_receive(:get).with(5).and_return(nil)
99
- @service.update(5,nil).should eq false
98
+ expect(@service).to receive(:get).with(5).and_return(nil)
99
+ expect(@service.update(5,nil)).to eq false
100
100
  end
101
101
 
102
102
  it 'should call update on record with correct params' do
103
103
  params = { :one => 'one', :two => 'two' }
104
104
  record = double('entity')
105
- @service.should_receive(:get).with(5)
105
+ expect(@service).to receive(:get).with(5)
106
106
  .and_return(record)
107
- record.should_receive(:update).with(params)
107
+ expect(record).to receive(:update).with(params)
108
108
  .and_return(789)
109
- @service.update(5,params).should eq 789
109
+ expect(@service.update(5,params)).to eq 789
110
110
  end
111
111
  end
112
112
 
113
113
  describe '#delete' do
114
114
  it 'should call get on service with correct id' do
115
- @service.should_receive(:get).with(5).and_return(nil)
115
+ expect(@service).to receive(:get).with(5).and_return(nil)
116
116
  @service.delete(5)
117
117
  end
118
118
 
119
119
  it 'should return false if get returns nil' do
120
- @service.should_receive(:get).with(5).and_return(nil)
121
- @service.delete(5).should eq false
120
+ expect(@service).to receive(:get).with(5).and_return(nil)
121
+ expect(@service.delete(5)).to eq false
122
122
  end
123
123
 
124
124
  it 'should call delete on record' do
125
125
  record = double('entity')
126
- @service.should_receive(:get).with(5)
126
+ expect(@service).to receive(:get).with(5)
127
127
  .and_return(record)
128
- record.should_receive(:destroy).and_return(109)
129
- @service.delete(5).should eq 109
128
+ expect(record).to receive(:destroy).and_return(109)
129
+ expect(@service.delete(5)).to eq 109
130
130
  end
131
131
  end
132
132
 
133
133
  describe '#set_user' do
134
134
  it 'should set user in service to param' do
135
135
  @service.set_user(nil)
136
- @service.user.should eq nil
136
+ expect(@service.user).to eq nil
137
137
  end
138
138
 
139
139
  it 'should not call set_user_scopes if user is nil' do
140
- @service.should_not_receive(:set_user_scopes)
140
+ expect(@service).not_to receive(:set_user_scopes)
141
141
  @service.set_user(nil)
142
- @service.user.should eq nil
142
+ expect(@service.user).to eq nil
143
143
  end
144
144
 
145
145
  it 'should call set_user_scopes if user is not' do
146
146
  user = { :scopes => [1,2] }
147
- @service.should_receive(:set_user_scopes).with([1,2])
147
+ expect(@service).to receive(:set_user_scopes).with([1,2])
148
148
  @service.set_user(user)
149
- @service.user.should eq user
149
+ expect(@service.user).to eq user
150
150
  end
151
151
  end
152
152
 
153
153
  describe '#set_user_scopes' do
154
154
  it 'should set user_scopes in service to param' do
155
155
  @service.set_user_scopes(nil)
156
- @service.user_scopes.should eq nil
156
+ expect(@service.user_scopes).to eq nil
157
157
 
158
158
  @service.set_user_scopes(234234)
159
- @service.user_scopes.should eq 234234
159
+ expect(@service.user_scopes).to eq 234234
160
160
  end
161
161
  end
162
162
 
163
163
  describe '#user_authorized_for?' do
164
164
  it 'should return true if scope_map is nil' do
165
165
  @service.scope_map = nil
166
- @service.user_authorized_for?(:one).should be true
166
+ expect(@service.user_authorized_for?(:one)).to be true
167
167
  end
168
168
 
169
169
  it 'should return true if scope_map is not nil but no map for operation' do
170
170
  @service.scope_map = { :two => 'TWO' }
171
- @service.user_authorized_for?(:one).should be true
171
+ expect(@service.user_authorized_for?(:one)).to be true
172
172
  end
173
173
 
174
174
  it 'should return false if user is nil' do
175
175
  @service.scope_map = { :two => 'TWO' }
176
176
  @service.user = nil
177
- @service.user_authorized_for?(:two).should be false
177
+ expect(@service.user_authorized_for?(:two)).to be false
178
178
  end
179
179
 
180
180
  it 'should return false if user has nil scopes' do
181
181
  @service.scope_map = { :two => 'TWO' }
182
182
  @service.user = { :name => "Tom" }
183
183
  @service.user_scopes = nil
184
- @service.user_authorized_for?(:two).should be false
184
+ expect(@service.user_authorized_for?(:two)).to be false
185
185
  end
186
186
 
187
187
  it 'should return false if user has empty scopes' do
188
188
  @service.scope_map = { :two => 'TWO' }
189
189
  @service.user = { :name => "Tom" }
190
190
  @service.user_scopes = []
191
- @service.user_authorized_for?(:two).should be false
191
+ expect(@service.user_authorized_for?(:two)).to be false
192
192
  end
193
193
 
194
194
  it 'should return true if scope map exists in user scopes' do
195
195
  @service.scope_map = { :two => 'FIVE'}
196
196
  @service.user = { :name => "Tom" }
197
197
  @service.user_scopes = [ 'ONE', 'TWO', 'FIVE']
198
- @service.user_authorized_for?(:two).should be true
198
+ expect(@service.user_authorized_for?(:two)).to be true
199
199
  end
200
200
 
201
201
  it 'should return false if scope map does not exist in user scopes' do
202
202
  @service.scope_map = { :two => 'SEVEN'}
203
203
  @service.user = { :name => "Tom" }
204
204
  @service.user_scopes = [ 'ONE', 'TWO', 'FIVE']
205
- @service.user_authorized_for?(:two).should be false
205
+ expect(@service.user_authorized_for?(:two)).to be false
206
206
  end
207
207
 
208
208
  it 'should return true if scope map is array and shares one scope with user' do
209
209
  @service.scope_map = { :two => ['TWO'] }
210
210
  @service.user = { :name => "Tom" }
211
211
  @service.user_scopes = [ 'ONE', 'TWO', 'THREE']
212
- @service.user_authorized_for?(:two).should be true
212
+ expect(@service.user_authorized_for?(:two)).to be true
213
213
  end
214
214
 
215
215
  it 'should return true if scope map is array and shares more than one scope with user' do
216
216
  @service.scope_map = { :two => ['TWO','THREE'] }
217
217
  @service.user = { :name => "Tom" }
218
218
  @service.user_scopes = [ 'ONE', 'TWO', 'THREE']
219
- @service.user_authorized_for?(:two).should be true
219
+ expect(@service.user_authorized_for?(:two)).to be true
220
220
  end
221
221
 
222
222
  it 'should return false if scope map is array and does not share scopes with user' do
223
223
  @service.scope_map = { :two => ['FOUR'] }
224
224
  @service.user = { :name => "Tom" }
225
225
  @service.user_scopes = [ 'ONE', 'TWO', 'THREE']
226
- @service.user_authorized_for?(:two).should be false
226
+ expect(@service.user_authorized_for?(:two)).to be false
227
227
  end
228
228
  end
229
229
  end