scoped_from 0.8.2 → 0.8.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 33415592b83c182b2e07977e66d43ec741a0f6fa
4
- data.tar.gz: f2b6dd6536d3f05bd9fc715a73ce9414dc288921
3
+ metadata.gz: 8f8d177b79333e65d08384a5216d6a47110e0e4b
4
+ data.tar.gz: e4cfc49de6bd6b2425cc25c44e238e5ee986e051
5
5
  SHA512:
6
- metadata.gz: 8004f60872868ee9ea77324aad627cd4c756b911736fe5556d2d17ce1e53b36052898149676bb136e9782efafd2a94a830810791c76dad9008ea38e2ecbcfbe2
7
- data.tar.gz: f57c020a4f82d71bef14d4eee6b38e864774e54b074eddfad99c5cba316947dc34bf66c08c6a48c4777c7e7d5dbcadd9d4a450b30273e42e8a352a073304c18f
6
+ metadata.gz: 1359f3930d74b67aae177ce46d174f3fa8c85dca7a1f8f8a2df2eb270c3e706b4832d37695187b6a16d25967c308476e954fce3eb644ecdcced7d2456c3d31da
7
+ data.tar.gz: 1ee6831b86ea5533c9acbf6369a276b9acd917aa2a65edaa6376c94b91dd0954cbfa2638d7b85856603bb5b4f7b09a32b11a486d5cebc8a83ba241bbc3bcfbd5
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- scoped_from (0.8.2)
4
+ scoped_from (0.8.3)
5
5
  activerecord (~> 4.1.0)
6
6
  activesupport (~> 4.1.0)
7
7
 
@@ -31,21 +31,25 @@ GEM
31
31
  diff-lcs (1.2.5)
32
32
  i18n (0.6.9)
33
33
  json (1.8.1)
34
- minitest (5.3.3)
35
- rake (10.3.1)
36
- rspec (2.14.1)
37
- rspec-core (~> 2.14.0)
38
- rspec-expectations (~> 2.14.0)
39
- rspec-mocks (~> 2.14.0)
40
- rspec-core (2.14.8)
41
- rspec-expectations (2.14.5)
42
- diff-lcs (>= 1.1.3, < 2.0)
43
- rspec-mocks (2.14.6)
34
+ minitest (5.3.4)
35
+ rake (10.3.2)
36
+ rspec (3.0.0)
37
+ rspec-core (~> 3.0.0)
38
+ rspec-expectations (~> 3.0.0)
39
+ rspec-mocks (~> 3.0.0)
40
+ rspec-core (3.0.1)
41
+ rspec-support (~> 3.0.0)
42
+ rspec-expectations (3.0.1)
43
+ diff-lcs (>= 1.2.0, < 2.0)
44
+ rspec-support (~> 3.0.0)
45
+ rspec-mocks (3.0.1)
46
+ rspec-support (~> 3.0.0)
47
+ rspec-support (3.0.0)
44
48
  sqlite3 (1.3.9)
45
49
  sqlite3-ruby (1.3.3)
46
50
  sqlite3 (>= 1.3.3)
47
- thread_safe (0.3.3)
48
- tzinfo (1.1.0)
51
+ thread_safe (0.3.4)
52
+ tzinfo (1.2.1)
49
53
  thread_safe (~> 0.1)
50
54
 
51
55
  PLATFORMS
@@ -54,6 +58,6 @@ PLATFORMS
54
58
  DEPENDENCIES
55
59
  byebug (~> 3.1.2)
56
60
  rake (~> 10.3.0)
57
- rspec (~> 2.14.0)
61
+ rspec (~> 3.0.0)
58
62
  scoped_from!
59
63
  sqlite3-ruby (~> 1.3.0)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.2
1
+ 0.8.3
data/scoped_from.gemspec CHANGED
@@ -21,6 +21,6 @@ Gem::Specification.new do |s|
21
21
 
22
22
  s.add_development_dependency 'byebug', '~> 3.1.2'
23
23
  s.add_development_dependency 'rake', '~> 10.3.0'
24
- s.add_development_dependency 'rspec', '~> 2.14.0'
24
+ s.add_development_dependency 'rspec', '~> 3.0.0'
25
25
  s.add_development_dependency 'sqlite3-ruby', '~> 1.3.0'
26
26
  end
@@ -5,28 +5,28 @@ describe ScopedFrom::ActiveRecord do
5
5
  describe '#scope_with_one_argument?' do
6
6
 
7
7
  it 'is true if scope has one argument' do
8
- User.should be_scope_with_one_argument(:search)
9
- User.should be_scope_with_one_argument('search')
8
+ expect(User.scope_with_one_argument?(:search)).to be(true)
9
+ expect(User.scope_with_one_argument?('search')).to be(true)
10
10
  end
11
11
 
12
12
  it 'is false if scope has no argument' do
13
- User.should_not be_scope_with_one_argument(:latest)
14
- User.should_not be_scope_with_one_argument('latest')
13
+ expect(User.scope_with_one_argument?(:latest)).to be(false)
14
+ expect(User.scope_with_one_argument?('latest')).to be(false)
15
15
  end
16
16
 
17
17
  it 'is false if scope has more than one argument' do
18
- User.should_not be_scope_with_one_argument(:created_between)
19
- User.should_not be_scope_with_one_argument('created_between')
18
+ expect(User.scope_with_one_argument?(:created_between)).to be(false)
19
+ expect(User.scope_with_one_argument?('created_between')).to be(false)
20
20
  end
21
21
 
22
22
  it 'is false if scope is not a proc' do
23
- User.should_not be_scope_with_one_argument(:enabled)
24
- User.should_not be_scope_with_one_argument('enabled')
23
+ expect(User.scope_with_one_argument?(:enabled)).to be(false)
24
+ expect(User.scope_with_one_argument?('enabled')).to be(false)
25
25
  end
26
26
 
27
27
  it 'is false if scope does not exist' do
28
- User.should_not be_scope_with_one_argument(:foo)
29
- User.should_not be_scope_with_one_argument('foo')
28
+ expect(User.scope_with_one_argument?(:foo)).to be(false)
29
+ expect(User.scope_with_one_argument?('foo')).to be(false)
30
30
  end
31
31
 
32
32
  end
@@ -34,28 +34,28 @@ describe ScopedFrom::ActiveRecord do
34
34
  describe 'scope_without_argument?' do
35
35
 
36
36
  it 'is true if scope has no argument' do
37
- User.should be_scope_without_argument(:latest)
38
- User.should be_scope_without_argument('latest')
37
+ expect(User.scope_without_argument?(:latest)).to be(true)
38
+ expect(User.scope_without_argument?('latest')).to be(true)
39
39
  end
40
40
 
41
41
  it 'is true if scope is not a proc' do
42
- User.should be_scope_without_argument(:enabled)
43
- User.should be_scope_without_argument('enabled')
42
+ expect(User.scope_without_argument?(:enabled)).to be(true)
43
+ expect(User.scope_without_argument?('enabled')).to be(true)
44
44
  end
45
45
 
46
46
  it 'is false if scope has one argument' do
47
- User.should_not be_scope_without_argument(:search)
48
- User.should_not be_scope_without_argument('search')
47
+ expect(User.scope_without_argument?(:search)).to be(false)
48
+ expect(User.scope_without_argument?('search')).to be(false)
49
49
  end
50
50
 
51
51
  it 'is false if scope has more than one argument' do
52
- User.should_not be_scope_without_argument(:created_between)
53
- User.should_not be_scope_without_argument('created_between')
52
+ expect(User.scope_without_argument?(:created_between)).to be(false)
53
+ expect(User.scope_without_argument?('created_between')).to be(false)
54
54
  end
55
55
 
56
56
  it 'is false if scope does not exist' do
57
- User.should_not be_scope_without_argument(:foo)
58
- User.should_not be_scope_without_argument('foo')
57
+ expect(User.scope_without_argument?(:foo)).to be(false)
58
+ expect(User.scope_without_argument?('foo')).to be(false)
59
59
  end
60
60
 
61
61
  end
@@ -64,56 +64,56 @@ describe ScopedFrom::ActiveRecord do
64
64
 
65
65
  it 'just build a new query and return its scope' do
66
66
  query = double(:query)
67
- query.should_receive(:relation).and_return(42)
68
- ScopedFrom::Query.should_receive(:new).with(User, 'foo', except: 'bam').and_return(query)
69
- User.scoped_from('foo', except: 'bam').should == 42
67
+ expect(query).to receive(:relation).and_return(42)
68
+ expect(ScopedFrom::Query).to receive(:new).with(User, 'foo', except: 'bam').and_return(query)
69
+ expect(User.scoped_from('foo', except: 'bam')).to eq(42)
70
70
  end
71
71
 
72
72
  it 'build scopes' do
73
- User.scoped_from(search: 'jane').should == [users(:jane)]
74
- User.scoped_from(search: 'john').should == [users(:john)]
73
+ expect(User.scoped_from(search: 'jane')).to eq([users(:jane)])
74
+ expect(User.scoped_from(search: 'john')).to eq([users(:john)])
75
75
  end
76
76
 
77
77
  it 'can be chained with other scopes' do
78
- User.scoped_from(search: 'jane').should == [users(:jane)]
79
- User.enabled.scoped_from(search: 'jane').should == []
78
+ expect(User.scoped_from(search: 'jane')).to eq([users(:jane)])
79
+ expect(User.enabled.scoped_from(search: 'jane')).to eq([])
80
80
  end
81
81
 
82
82
  it 'can be used with order as parameter' do
83
- User.scoped_from(order: 'firstname').first.should == users(:jane)
84
- User.scoped_from(order: 'firstname.desc').first.should == users(:john)
83
+ expect(User.scoped_from(order: 'firstname').first).to eq(users(:jane))
84
+ expect(User.scoped_from(order: 'firstname.desc').first).to eq(users(:john))
85
85
  end
86
86
 
87
87
  it 'builds a ScopedFrom::Query' do
88
- User.scoped_from({}).query.class.should be(ScopedFrom::Query)
88
+ expect(User.scoped_from({}).query.class).to be(ScopedFrom::Query)
89
89
  end
90
90
 
91
91
  it 'builds a ScopedFrom::Query if #{RecordClassName}Query is not defined' do
92
- Post.scoped_from({}).query.class.should be(ScopedFrom::Query)
93
- Object.const_defined?('PostQuery').should be_false
92
+ expect(Post.scoped_from({}).query.class).to be(ScopedFrom::Query)
93
+ expect(Object.const_defined?('PostQuery')).to be(false)
94
94
  expect {
95
95
  PostQuery
96
96
  }.to raise_error(NameError, 'uninitialized constant PostQuery')
97
97
  end
98
98
 
99
99
  it 'builds a #{Class}Query if #{RecordClassName}Query is defined and is a ScopedFrom::Query' do
100
- Comment.scoped_from({}).query.class.should be(CommentQuery)
101
- Comment.where(foo: 'bar').scoped_from({}).query.class.should be(CommentQuery)
102
- CommentQuery.should be_a(Class)
103
- CommentQuery.ancestors.should include(ScopedFrom::Query)
100
+ expect(Comment.scoped_from({}).query.class).to be(CommentQuery)
101
+ expect(Comment.where(foo: 'bar').scoped_from({}).query.class).to be(CommentQuery)
102
+ expect(CommentQuery).to be_a(Class)
103
+ expect(CommentQuery.ancestors).to include(ScopedFrom::Query)
104
104
  end
105
105
 
106
106
  it 'builds a ScopedFrom::Query if #{RecordClassName}Query is defined but not a subclass of ScopedFrom::Query' do
107
- User.scoped_from({}).query.class.should be(ScopedFrom::Query)
108
- Object.const_defined?('UserQuery').should be_true
109
- UserQuery.should be_a(Class)
110
- UserQuery.ancestors.should_not include(ScopedFrom::Query)
107
+ expect(User.scoped_from({}).query.class).to be(ScopedFrom::Query)
108
+ expect(Object.const_defined?('UserQuery')).to be(true)
109
+ expect(UserQuery).to be_a(Class)
110
+ expect(UserQuery.ancestors).not_to include(ScopedFrom::Query)
111
111
  end
112
112
 
113
113
  it 'builds a ScopedFrom::Query if #{RecordClassName}Query is defined but is a module' do
114
- Vote.scoped_from({}).query.class.should be(ScopedFrom::Query)
115
- Object.const_defined?('VoteQuery').should be_true
116
- VoteQuery.should be_a(Module)
114
+ expect(Vote.scoped_from({}).query.class).to be(ScopedFrom::Query)
115
+ expect(Object.const_defined?('VoteQuery')).to be(true)
116
+ expect(VoteQuery).to be_a(Module)
117
117
  end
118
118
 
119
119
  end
@@ -9,54 +9,54 @@ describe ScopedFrom::Query do
9
9
  describe '#false?' do
10
10
 
11
11
  it 'is true if false is given' do
12
- query.send(:false?, false).should be_true
12
+ expect(query.send(:false?, false)).to be(true)
13
13
  end
14
14
 
15
15
  it 'is true if "false" is given' do
16
- query.send(:false?, 'false').should be_true
17
- query.send(:false?, 'False').should be_true
16
+ expect(query.send(:false?, 'false')).to be(true)
17
+ expect(query.send(:false?, 'False')).to be(true)
18
18
  end
19
19
 
20
20
  it 'is true if "0" is given' do
21
- query.send(:false?, '0').should be_true
21
+ expect(query.send(:false?, '0')).to be(true)
22
22
  end
23
23
 
24
24
  it 'is true if "off" is given' do
25
- query.send(:false?, 'off').should be_true
26
- query.send(:false?, 'OFF ').should be_true
25
+ expect(query.send(:false?, 'off')).to be(true)
26
+ expect(query.send(:false?, 'OFF ')).to be(true)
27
27
  end
28
28
 
29
29
  it 'is true if "no" is given' do
30
- query.send(:false?, 'no').should be_true
31
- query.send(:false?, ' No ').should be_true
30
+ expect(query.send(:false?, 'no')).to be(true)
31
+ expect(query.send(:false?, ' No ')).to be(true)
32
32
  end
33
33
 
34
34
  it 'is true if "n" is given' do
35
- query.send(:false?, 'n').should be_true
36
- query.send(:false?, 'N ').should be_true
35
+ expect(query.send(:false?, 'n')).to be(true)
36
+ expect(query.send(:false?, 'N ')).to be(true)
37
37
  end
38
38
 
39
39
  it 'is false if true is given' do
40
- query.send(:false?, true).should be_false
40
+ expect(query.send(:false?, true)).to be(false)
41
41
  end
42
42
 
43
43
  it 'is false if "true" is given' do
44
- query.send(:false?, 'true').should be_false
45
- query.send(:false?, 'TrUe').should be_false
44
+ expect(query.send(:false?, 'true')).to be(false)
45
+ expect(query.send(:false?, 'TrUe')).to be(false)
46
46
  end
47
47
 
48
48
  it 'is false if "1" is given' do
49
- query.send(:false?, '1').should be_false
49
+ expect(query.send(:false?, '1')).to be(false)
50
50
  end
51
51
 
52
52
  it 'is false if "on" is given' do
53
- query.send(:false?, "on").should be_false
54
- query.send(:false?, "On").should be_false
53
+ expect(query.send(:false?, "on")).to be(false)
54
+ expect(query.send(:false?, "On")).to be(false)
55
55
  end
56
56
 
57
57
  it 'is false otherwise' do
58
- query.send(:false?, 42).should be_false
59
- query.send(:false?, 'bam').should be_false
58
+ expect(query.send(:false?, 42)).to be(false)
59
+ expect(query.send(:false?, 'bam')).to be(false)
60
60
  end
61
61
 
62
62
  end
@@ -64,13 +64,13 @@ describe ScopedFrom::Query do
64
64
  describe '#initialize' do
65
65
 
66
66
  it 'invokes .all method on given class' do
67
- User.should_receive(:all)
67
+ expect(User).to receive(:all)
68
68
  ScopedFrom::Query.new(User, {})
69
69
  end
70
70
 
71
71
  it 'does not invokes .all method on given relation' do
72
72
  relation = User.all
73
- relation.should_not_receive(:all)
73
+ expect(relation).not_to receive(:all)
74
74
  ScopedFrom::Query.new(relation, {})
75
75
  end
76
76
 
@@ -79,32 +79,32 @@ describe ScopedFrom::Query do
79
79
  describe '#invoke_param' do
80
80
 
81
81
  it 'returns given scope if it has no scope with specified name' do
82
- query.send(:invoke_param, User, :foo, true).should == User
82
+ expect(query.send(:invoke_param, User, :foo, true)).to eq(User)
83
83
  end
84
84
 
85
85
  it 'returns given scope if scope takes more than 1 argument' do
86
- query.send(:invoke_param, User, :created_between, true).should == User
86
+ expect(query.send(:invoke_param, User, :created_between, true)).to eq(User)
87
87
  end
88
88
 
89
89
  it 'invokes scope without arguments if scope takes no arguments' do
90
- query.send(:invoke_param, User.all, :enabled, true).should == [users(:john)]
91
- query.send(:invoke_param, User.all, :enabled, ' 1 ').should == [users(:john)]
92
- query.send(:invoke_param, User.all, :enabled, 'off').should == [users(:john)]
90
+ expect(query.send(:invoke_param, User.all, :enabled, true)).to eq([users(:john)])
91
+ expect(query.send(:invoke_param, User.all, :enabled, ' 1 ')).to eq([users(:john)])
92
+ expect(query.send(:invoke_param, User.all, :enabled, 'off')).to eq([users(:john)])
93
93
  end
94
94
 
95
95
  it 'invokes scope with value has argument if scope takes one argument' do
96
- query.send(:invoke_param, User.all, :search, 'doe').should == [users(:john), users(:jane)]
97
- query.send(:invoke_param, User.all, :search, 'john').should == [users(:john)]
98
- query.send(:invoke_param, User.all, :search, 'jane').should == [users(:jane)]
96
+ expect(query.send(:invoke_param, User.all, :search, 'doe')).to eq([users(:john), users(:jane)])
97
+ expect(query.send(:invoke_param, User.all, :search, 'john')).to eq([users(:john)])
98
+ expect(query.send(:invoke_param, User.all, :search, 'jane')).to eq([users(:jane)])
99
99
  end
100
100
 
101
101
  it 'scope on column conditions' do
102
- query.send(:invoke_param, User.all, :firstname, 'Jane').should == [users(:jane)]
102
+ expect(query.send(:invoke_param, User.all, :firstname, 'Jane')).to eq([users(:jane)])
103
103
  end
104
104
 
105
105
  it 'invokes "order"' do
106
- query.send(:invoke_param, User.all, :order, 'firstname.asc').should == [users(:jane), users(:john)]
107
- query.send(:invoke_param, User.all, :order, 'firstname.desc').should == [users(:john), users(:jane)]
106
+ expect(query.send(:invoke_param, User.all, :order, 'firstname.asc')).to eq([users(:jane), users(:john)])
107
+ expect(query.send(:invoke_param, User.all, :order, 'firstname.desc')).to eq([users(:john), users(:jane)])
108
108
  end
109
109
 
110
110
  end
@@ -112,11 +112,11 @@ describe ScopedFrom::Query do
112
112
  describe '#options' do
113
113
 
114
114
  it 'is set at initialization' do
115
- ScopedFrom::Query.new(User, {}, bar: 'foo').instance_variable_get(:@options).should == { bar: 'foo' }
115
+ expect(ScopedFrom::Query.new(User, {}, bar: 'foo').instance_variable_get(:@options)).to eq(bar: 'foo')
116
116
  end
117
117
 
118
118
  it 'keys are symbolized' do
119
- ScopedFrom::Query.new(User, {}, 'bar' => 'foo').instance_variable_get(:@options).should == { bar: 'foo' }
119
+ expect(ScopedFrom::Query.new(User, {}, 'bar' => 'foo').instance_variable_get(:@options)).to eq(bar: 'foo')
120
120
  end
121
121
 
122
122
  end
@@ -124,16 +124,16 @@ describe ScopedFrom::Query do
124
124
  describe '#order_column' do
125
125
 
126
126
  it 'is column specified into "order" parameter' do
127
- query(User, order: 'firstname').order_column.should == 'firstname'
128
- query(User, order: 'lastname.desc').order_column.should == 'lastname'
127
+ expect(query(User, order: 'firstname').order_column).to eq('firstname')
128
+ expect(query(User, order: 'lastname.desc').order_column).to eq('lastname')
129
129
  end
130
130
 
131
131
  it 'is nil if column does not exist' do
132
- query(User, order: 'foo').order_column.should be_nil
132
+ expect(query(User, order: 'foo').order_column).to be_nil
133
133
  end
134
134
 
135
135
  it 'is nil if "order" param is not specified' do
136
- query(User, search: 'foo').order_column.should be_nil
136
+ expect(query(User, search: 'foo').order_column).to be_nil
137
137
  end
138
138
 
139
139
  end
@@ -141,29 +141,29 @@ describe ScopedFrom::Query do
141
141
  describe '#order_direction' do
142
142
 
143
143
  it 'is direction specified into "order" parameter' do
144
- query(User, order: 'firstname.asc').order_direction.should == 'asc'
145
- query(User, order: 'firstname.desc').order_direction.should == 'desc'
144
+ expect(query(User, order: 'firstname.asc').order_direction).to eq('asc')
145
+ expect(query(User, order: 'firstname.desc').order_direction).to eq('desc')
146
146
  end
147
147
 
148
148
  it 'is "asc" if direction is not specified' do
149
- query(User, order: 'firstname').order_direction.should == 'asc'
149
+ expect(query(User, order: 'firstname').order_direction).to eq('asc')
150
150
  end
151
151
 
152
152
  it 'is "asc" if direction is invalid' do
153
- query(User, order: 'firstname.foo').order_direction.should == 'asc'
153
+ expect(query(User, order: 'firstname.foo').order_direction).to eq('asc')
154
154
  end
155
155
 
156
156
  it 'is direction even specified in another case' do
157
- query(User, order: 'firstname.ASc').order_direction.should == 'asc'
158
- query(User, order: 'firstname.DeSC').order_direction.should == 'desc'
157
+ expect(query(User, order: 'firstname.ASc').order_direction).to eq('asc')
158
+ expect(query(User, order: 'firstname.DeSC').order_direction).to eq('desc')
159
159
  end
160
160
 
161
161
  it 'is nil if column does not exist' do
162
- query(User, order: 'foo.desc').order_direction.should be_nil
162
+ expect(query(User, order: 'foo.desc').order_direction).to be_nil
163
163
  end
164
164
 
165
165
  it 'is nil if "order" param is not specified' do
166
- query(User, search: 'foo').order_direction.should be_nil
166
+ expect(query(User, search: 'foo').order_direction).to be_nil
167
167
  end
168
168
 
169
169
  end
@@ -171,17 +171,17 @@ describe ScopedFrom::Query do
171
171
  describe '#params' do
172
172
 
173
173
  it 'returns params specified at initialization' do
174
- query(User, search: 'foo', 'enabled' => true).params.should == { 'search' => 'foo', 'enabled' => true }
174
+ expect(query(User, search: 'foo', 'enabled' => true).params).to eq({ 'search' => 'foo', 'enabled' => true })
175
175
  end
176
176
 
177
177
  it 'returns an hash with indifferent access' do
178
- query(User, 'search' => 'bar').params.should be_a(ActiveSupport::HashWithIndifferentAccess)
179
- query(User, 'search' => 'bar').params[:search].should == 'bar'
180
- query(User, search: 'bar').params['search'].should == 'bar'
178
+ expect(query(User, 'search' => 'bar').params).to be_a(ActiveSupport::HashWithIndifferentAccess)
179
+ expect(query(User, 'search' => 'bar').params[:search]).to eq('bar')
180
+ expect(query(User, search: 'bar').params['search']).to eq('bar')
181
181
  end
182
182
 
183
183
  it 'can be converted to query string' do
184
- query(User, search: ['foo', 'bar'], 'enabled' => '1').params.to_query.should == 'enabled=true&search%5B%5D=foo&search%5B%5D=bar'
184
+ expect(query(User, search: ['foo', 'bar'], 'enabled' => '1').params.to_query).to eq('enabled=true&search%5B%5D=foo&search%5B%5D=bar')
185
185
  end
186
186
 
187
187
  end
@@ -189,177 +189,177 @@ describe ScopedFrom::Query do
189
189
  describe '#params=' do
190
190
 
191
191
  it 'does not fails if nil is given' do
192
- query(User, nil).params.should == {}
192
+ expect(query(User, nil).params).to eq({})
193
193
  end
194
194
 
195
195
  it 'removes values that are not scopes' do
196
- query(User, foo: 'bar', 'search' => 'foo', enabled: true).params.should == { 'search' => 'foo', 'enabled' => true }
196
+ expect(query(User, foo: 'bar', 'search' => 'foo', enabled: true).params).to eq({ 'search' => 'foo', 'enabled' => true })
197
197
  end
198
198
 
199
199
  it 'is case sensitive' do
200
- query(User, 'Enabled' => true, "SEARCH" => 'bar').params.should be_empty
200
+ expect(query(User, 'Enabled' => true, "SEARCH" => 'bar').params).to be_empty
201
201
  end
202
202
 
203
203
  it 'parse query string' do
204
- query(User, 'search=foo%26baz&latest=true').params.should == { 'search' => 'foo&baz', 'latest' => true }
204
+ expect(query(User, 'search=foo%26baz&latest=true').params).to eq({ 'search' => 'foo&baz', 'latest' => true })
205
205
  end
206
206
 
207
207
  it 'removes blank values from query string' do
208
- query(User, 'search=baz&toto=&bar=%20').params.should == { 'search' => 'baz' }
208
+ expect(query(User, 'search=baz&toto=&bar=%20').params).to eq({ 'search' => 'baz' })
209
209
  end
210
210
 
211
211
  it 'unescapes UTF-8 chars' do
212
- query(User, 'search=%C3%A9').params.should == { 'search' => 'é' }
212
+ expect(query(User, 'search=%C3%A9').params).to eq({ 'search' => 'é' })
213
213
  end
214
214
 
215
215
  it 'can have multiple values (from hash)' do
216
- query(User, search: ['bar', 'baz']).params.should == { 'search' => ['bar', 'baz'] }
216
+ expect(query(User, search: ['bar', 'baz']).params).to eq({ 'search' => ['bar', 'baz'] })
217
217
  end
218
218
 
219
219
  it 'can have multiple values (from query string)' do
220
- query(User, 'search=bar&search=baz').params.should == { 'search' => ['bar', 'baz'] }
220
+ expect(query(User, 'search=bar&search=baz').params).to eq({ 'search' => ['bar', 'baz'] })
221
221
  end
222
222
 
223
223
  it 'converts value to true (or remove it) if scope takes no argument' do
224
- query(User, latest: 'y').params.should == { 'latest' => true }
225
- query(User, latest: 'no').params.should == {}
224
+ expect(query(User, latest: 'y').params).to eq({ 'latest' => true })
225
+ expect(query(User, latest: 'no').params).to eq({})
226
226
  end
227
227
 
228
228
  it 'converts value to true (or false) if column is a boolean one' do
229
- query(User, admin: 'y').params.should == { 'admin' => true }
230
- query(User, admin: 'False').params.should == { 'admin' => false }
231
- query(User, admin: 'bar').params.should == {}
232
- query(User, admin: ['y', false]).params.should == {}
229
+ expect(query(User, admin: 'y').params).to eq({ 'admin' => true })
230
+ expect(query(User, admin: 'False').params).to eq({ 'admin' => false })
231
+ expect(query(User, admin: 'bar').params).to eq({})
232
+ expect(query(User, admin: ['y', false]).params).to eq({})
233
233
  end
234
234
 
235
235
  it 'converts array value to true (or remove it) if scope takes no argument' do
236
- query(User, latest: true).params.should == { 'latest' => true }
237
- query(User, latest: ['Yes']).params.should == { 'latest' => true }
238
- query(User, latest: ['no', 'yes']).params.should == {}
239
- query(User, latest: ['no', nil]).params.should == {}
240
- query(User, latest: ['fo']).params.should == {}
236
+ expect(query(User, latest: true).params).to eq({ 'latest' => true })
237
+ expect(query(User, latest: ['Yes']).params).to eq({ 'latest' => true })
238
+ expect(query(User, latest: ['no', 'yes']).params).to eq({})
239
+ expect(query(User, latest: ['no', nil]).params).to eq({})
240
+ expect(query(User, latest: ['fo']).params).to eq({})
241
241
  end
242
242
 
243
243
  it 'flats array' do
244
- query(User, search: [nil, ['bar', '', 'foo', ["\n ", 'baz']]]).params.should == { 'search' => [nil, 'bar', '', 'foo', "\n ", 'baz'] }
244
+ expect(query(User, search: [nil, ['bar', '', 'foo', ["\n ", 'baz']]]).params).to eq({ 'search' => [nil, 'bar', '', 'foo', "\n ", 'baz'] })
245
245
  end
246
246
 
247
247
  it 'change array with a single value in one value' do
248
- query(User, search: ['bar']).params.should == { 'search' => 'bar' }
248
+ expect(query(User, search: ['bar']).params).to eq({ 'search' => 'bar' })
249
249
  end
250
250
 
251
251
  it 'does not modify given hash' do
252
252
  hash = { search: 'foo', enabled: '1', bar: 'foo' }
253
253
  query(User, hash)
254
- hash.should == { search: 'foo', enabled: '1', bar: 'foo' }
254
+ expect(hash).to eq({ search: 'foo', enabled: '1', bar: 'foo' })
255
255
  end
256
256
 
257
257
  it 'does not modify given array' do
258
258
  items = ['bar', 'foo', nil]
259
259
  query(User, search: items)
260
- items.should == ['bar', 'foo', nil]
260
+ expect(items).to eq(['bar', 'foo', nil])
261
261
  end
262
262
 
263
263
  it 'accepts :only option' do
264
- query(User, { search: 'bar', enabled: 'true' }, only: [:search]).params.should == { 'search' => 'bar' }
265
- query(User, { search: 'bar', enabled: 'true' }, only: 'search').params.should == { 'search' => 'bar' }
266
- query(User, { search: 'bar', firstname: 'Jane', enabled: 'true' }, only: 'search').params.should == { 'search' => 'bar' }
267
- query(User, { search: 'bar', firstname: 'Jane', enabled: 'true' }, only: ['search', :firstname]).params.should == { 'search' => 'bar', 'firstname' => 'Jane' }
264
+ expect(query(User, { search: 'bar', enabled: 'true' }, only: [:search]).params).to eq({ 'search' => 'bar' })
265
+ expect(query(User, { search: 'bar', enabled: 'true' }, only: 'search').params).to eq({ 'search' => 'bar' })
266
+ expect(query(User, { search: 'bar', firstname: 'Jane', enabled: 'true' }, only: 'search').params).to eq({ 'search' => 'bar' })
267
+ expect(query(User, { search: 'bar', firstname: 'Jane', enabled: 'true' }, only: ['search', :firstname]).params).to eq({ 'search' => 'bar', 'firstname' => 'Jane' })
268
268
  end
269
269
 
270
270
  it 'accepts :except option' do
271
- query(User, { search: 'bar', enabled: true }, except: [:search]).params.should == { 'enabled' => true }
272
- query(User, { search: 'bar', enabled: true }, except: 'search').params.should == { 'enabled' => true }
273
- query(User, { search: 'bar', firstname: 'Jane', enabled: true }, except: 'search').params.should == { 'enabled' => true, 'firstname' => 'Jane' }
274
- query(User, { search: 'bar', firstname: 'Jane', enabled: true }, except: ['search', :firstname]).params.should == { 'enabled' => true }
271
+ expect(query(User, { search: 'bar', enabled: true }, except: [:search]).params).to eq({ 'enabled' => true })
272
+ expect(query(User, { search: 'bar', enabled: true }, except: 'search').params).to eq({ 'enabled' => true })
273
+ expect(query(User, { search: 'bar', firstname: 'Jane', enabled: true }, except: 'search').params).to eq({ 'enabled' => true, 'firstname' => 'Jane' })
274
+ expect(query(User, { search: 'bar', firstname: 'Jane', enabled: true }, except: ['search', :firstname]).params).to eq({ 'enabled' => true })
275
275
  end
276
276
 
277
277
  it 'accepts a query instance' do
278
- query(User, query(User, search: 'toto')).params.should == { 'search' => 'toto' }
278
+ expect(query(User, query(User, search: 'toto')).params).to eq({ 'search' => 'toto' })
279
279
  end
280
280
 
281
281
  it 'preserve blank values' do
282
- query(User, { search: "\n ", 'enabled' => true }).params.should == { 'search' => "\n ", 'enabled' => true }
282
+ expect(query(User, { search: "\n ", 'enabled' => true }).params).to eq({ 'search' => "\n ", 'enabled' => true })
283
283
  end
284
284
 
285
285
  it 'preserve blank values from array' do
286
- query(User, { 'search' => ["\n ", 'toto', 'titi'] }).params.should == { 'search' => ["\n ", 'toto', 'titi'] }
287
- query(User, { 'search' => [] }).params.should == {}
286
+ expect(query(User, { 'search' => ["\n ", 'toto', 'titi'] }).params).to eq({ 'search' => ["\n ", 'toto', 'titi'] })
287
+ expect(query(User, { 'search' => [] }).params).to eq({})
288
288
  end
289
289
 
290
290
  it 'also preserve blank on query string' do
291
- query(User, 'search=%20&enabled=true&search=foo').params.should == { 'search' => [' ', 'foo'], 'enabled' => true }
291
+ expect(query(User, 'search=%20&enabled=true&search=foo').params).to eq({ 'search' => [' ', 'foo'], 'enabled' => true })
292
292
  end
293
293
 
294
294
  it 'includes column values' do
295
- query(User, 'firstname' => 'Jane', 'foo' => 'bar').params.should == { 'firstname' => 'Jane' }
296
- query(User, firstname: 'Jane', 'foo' => 'bar').params.should == { 'firstname' => 'Jane' }
295
+ expect(query(User, 'firstname' => 'Jane', 'foo' => 'bar').params).to eq({ 'firstname' => 'Jane' })
296
+ expect(query(User, firstname: 'Jane', 'foo' => 'bar').params).to eq({ 'firstname' => 'Jane' })
297
297
  end
298
298
 
299
299
  it 'exclude column values if :exclude_columns option is specified' do
300
- query(User, { enabled: true, 'firstname' => 'Jane', 'foo' => 'bar' }, exclude_columns: true).params.should == { 'enabled' => true }
301
- query(User, { enabled: true, firstname: 'Jane', foo: 'bar' }, exclude_columns: true).params.should == { 'enabled' => true }
300
+ expect(query(User, { enabled: true, 'firstname' => 'Jane', 'foo' => 'bar' }, exclude_columns: true).params).to eq({ 'enabled' => true })
301
+ expect(query(User, { enabled: true, firstname: 'Jane', foo: 'bar' }, exclude_columns: true).params).to eq({ 'enabled' => true })
302
302
  end
303
303
 
304
304
  it 'scopes have priority on columns' do
305
- query(User, enabled: false).params.should == {}
305
+ expect(query(User, enabled: false).params).to eq({})
306
306
  end
307
307
 
308
308
  it 'maps an "order"' do
309
- query(User, { 'order' => 'firstname.asc' }).params.should == { 'order' => 'firstname.asc' }
309
+ expect(query(User, { 'order' => 'firstname.asc' }).params).to eq({ 'order' => 'firstname.asc' })
310
310
  end
311
311
 
312
312
  it 'does not map "order" if column is invalid' do
313
- query(User, { 'order' => 'foo.asc' }).params.should == {}
313
+ expect(query(User, { 'order' => 'foo.asc' }).params).to eq({})
314
314
  end
315
315
 
316
316
  it 'use "asc" order direction by default' do
317
- query(User, { 'order' => 'firstname' }).params.should == { 'order' => 'firstname.asc' }
317
+ expect(query(User, { 'order' => 'firstname' }).params).to eq({ 'order' => 'firstname.asc' })
318
318
  end
319
319
 
320
320
  it 'use "asc" order direction if invalid' do
321
- query(User, { 'order' => 'firstname.bar' }).params.should == { 'order' => 'firstname.asc' }
321
+ expect(query(User, { 'order' => 'firstname.bar' }).params).to eq({ 'order' => 'firstname.asc' })
322
322
  end
323
323
 
324
324
  it 'use "desc" order direction if specified' do
325
- query(User, { 'order' => 'firstname.desc' }).params.should == { 'order' => 'firstname.desc' }
325
+ expect(query(User, { 'order' => 'firstname.desc' }).params).to eq({ 'order' => 'firstname.desc' })
326
326
  end
327
327
 
328
328
  it 'order direction is case insensitive' do
329
- query(User, { 'order' => 'firstname.Asc' }).params.should == { 'order' => 'firstname.asc' }
330
- query(User, { 'order' => 'firstname.DESC' }).params.should == { 'order' => 'firstname.desc' }
329
+ expect(query(User, { 'order' => 'firstname.Asc' }).params).to eq({ 'order' => 'firstname.asc' })
330
+ expect(query(User, { 'order' => 'firstname.DESC' }).params).to eq({ 'order' => 'firstname.desc' })
331
331
  end
332
332
 
333
333
  it 'order can be specified as symbol' do
334
- query(User, { order: 'firstname.desc' }).params.should == { 'order' => 'firstname.desc' }
334
+ expect(query(User, { order: 'firstname.desc' }).params).to eq({ 'order' => 'firstname.desc' })
335
335
  end
336
336
 
337
337
  it "order is case sensitive" do
338
- query(User, { 'Order' => 'firstname.desc' }).params.should == {}
338
+ expect(query(User, { 'Order' => 'firstname.desc' }).params).to eq({})
339
339
  end
340
340
 
341
341
  it 'many order can be specified' do
342
- query(User, { 'order' => ['firstname.Asc', 'lastname.DESC'] }).params.should == { 'order' => ['firstname.asc', 'lastname.desc'] }
343
- query(User, { 'order' => ['firstname.Asc', 'firstname.desc'] }).params.should == { 'order' => 'firstname.asc' }
344
- query(User, { 'order' => ['firstname.Asc', 'lastname.DESC', 'firstname.desc'] }).params.should == { 'order' => ['firstname.asc', 'lastname.desc'] }
345
- query(User, { 'order' => ['firstname.Asc', 'foo', 'lastname.DESC', 'firstname.desc'] }).params.should == { 'order' => ['firstname.asc', 'lastname.desc'] }
342
+ expect(query(User, { 'order' => ['firstname.Asc', 'lastname.DESC'] }).params).to eq({ 'order' => ['firstname.asc', 'lastname.desc'] })
343
+ expect(query(User, { 'order' => ['firstname.Asc', 'firstname.desc'] }).params).to eq({ 'order' => 'firstname.asc' })
344
+ expect(query(User, { 'order' => ['firstname.Asc', 'lastname.DESC', 'firstname.desc'] }).params).to eq({ 'order' => ['firstname.asc', 'lastname.desc'] })
345
+ expect(query(User, { 'order' => ['firstname.Asc', 'foo', 'lastname.DESC', 'firstname.desc'] }).params).to eq({ 'order' => ['firstname.asc', 'lastname.desc'] })
346
346
  end
347
347
 
348
348
  it 'order can be delimited by a space' do
349
- query(User, { 'order' => 'firstname ASC' }).params.should == { 'order' => 'firstname.asc' }
349
+ expect(query(User, { 'order' => 'firstname ASC' }).params).to eq({ 'order' => 'firstname.asc' })
350
350
  end
351
351
 
352
352
  it 'order can be delimited by any white space' do
353
- query(User, { 'order' => "firstname\nASC" }).params.should == { 'order' => 'firstname.asc' }
354
- query(User, { 'order' => "firstname\t ASC" }).params.should == { 'order' => 'firstname.asc' }
353
+ expect(query(User, { 'order' => "firstname\nASC" }).params).to eq({ 'order' => 'firstname.asc' })
354
+ expect(query(User, { 'order' => "firstname\t ASC" }).params).to eq({ 'order' => 'firstname.asc' })
355
355
  end
356
356
 
357
357
  it 'order can be delimited by a ":"' do
358
- query(User, { 'order' => "firstname:ASC" }).params.should == { 'order' => 'firstname.asc' }
358
+ expect(query(User, { 'order' => "firstname:ASC" }).params).to eq({ 'order' => 'firstname.asc' })
359
359
  end
360
360
 
361
361
  it 'order can be delimited by more than one delimiter' do
362
- query(User, { 'order' => "firstname :. ASC" }).params.should == { 'order' => 'firstname.asc' }
362
+ expect(query(User, { 'order' => "firstname :. ASC" }).params).to eq({ 'order' => 'firstname.asc' })
363
363
  end
364
364
 
365
365
  end
@@ -367,14 +367,14 @@ describe ScopedFrom::Query do
367
367
  describe '#relation' do
368
368
 
369
369
  it 'does not execute any query' do
370
- User.should_not_receive(:connection)
370
+ expect(User).not_to receive(:connection)
371
371
  query(User, enabled: true).relation
372
372
  end
373
373
 
374
374
  it 'works with scopes with a lambda without arguments' do
375
375
  users(:jane).update_attribute(:created_at, 10.days.ago)
376
- query(User, latest: true).relation.should == [users(:john)]
377
- query(User, latest: false).relation.should == [users(:john), users(:jane)]
376
+ expect(query(User, latest: true).relation).to eq([users(:john)])
377
+ expect(query(User, latest: false).relation).to eq([users(:john), users(:jane)])
378
378
  end
379
379
 
380
380
  it 'does not modify relation specified at initialization' do
@@ -383,55 +383,51 @@ describe ScopedFrom::Query do
383
383
  expect {
384
384
  expect {
385
385
  q.relation
386
- }.to_not change { q.instance_variable_get('@relation') }
387
- }.to_not change { relation }
386
+ }.not_to change { q.instance_variable_get('@relation') }
387
+ }.not_to change { relation }
388
388
  end
389
389
 
390
390
  it 'returns relation specified at construction if params are empty' do
391
- query.relation.should_not == User
392
- query.relation.should == User.all
391
+ expect(query.relation).not_to eq(User)
392
+ expect(query.relation).to eq(User.all)
393
393
  end
394
394
 
395
395
  it 'invokes many times relation if an array is given' do
396
- query(User, search: ['John', 'Doe']).relation.should == [users(:john)]
397
- query(User, search: ['John', 'Done']).relation.should == []
398
- query(User, search: ['John', 'Doe']).params.should == { 'search' => ['John', 'Doe'] }
396
+ expect(query(User, search: ['John', 'Doe']).relation).to eq([users(:john)])
397
+ expect(query(User, search: ['John', 'Done']).relation).to eq([])
398
+ expect(query(User, search: ['John', 'Doe']).params).to eq({ 'search' => ['John', 'Doe'] })
399
399
  end
400
400
 
401
401
  it 'invokes many times relation if given twice (as string & symbol)' do
402
- query(User, search: 'John', 'search' => 'Done').params['search'].size.should be(2)
403
- query(User, search: 'John', 'search' => 'Done').params['search'].should include('John', 'Done')
404
-
405
-
406
- query(User, search: 'John', 'search' => ['Did', 'Done']).params['search'].size.should be(3)
407
- query(User, search: 'John', 'search' => ['Did', 'Done']).params['search'].should include('John', 'Did', 'Done')
402
+ expect(query(User, search: 'John', 'search' => 'Done').params['search']).to contain_exactly('John', 'Done')
403
+ expect(query(User, search: 'John', 'search' => ['Did', 'Done']).params['search']).to contain_exactly('John', 'Did', 'Done')
408
404
  end
409
405
 
410
406
  it 'invokes last order if an array is given' do
411
407
  create_user(:jane2, firstname: 'Jane', lastname: 'Zoe')
412
408
 
413
- query(User, order: ['lastname', 'firstname']).relation.should == [users(:jane), users(:john), users(:jane2)]
414
- query(User, order: ['lastname', 'firstname.desc']).relation.should == [users(:john), users(:jane), users(:jane2)]
415
- query(User, order: ['firstname', 'lastname.desc']).relation.should == [users(:jane2), users(:jane), users(:john)]
416
- query(User, order: ['firstname.desc', 'lastname']).relation.order_values.map(&:class).should == [Arel::Nodes::Descending, Arel::Nodes::Ascending]
417
- query(User, order: ['firstname.desc', 'lastname']).relation.order_values.map(&:expr).map(&:name).should == ['firstname', 'lastname']
409
+ expect(query(User, order: ['lastname', 'firstname']).relation).to eq([users(:jane), users(:john), users(:jane2)])
410
+ expect(query(User, order: ['lastname', 'firstname.desc']).relation).to eq([users(:john), users(:jane), users(:jane2)])
411
+ expect(query(User, order: ['firstname', 'lastname.desc']).relation).to eq([users(:jane2), users(:jane), users(:john)])
412
+ expect(query(User, order: ['firstname.desc', 'lastname']).relation.order_values.map(&:class)).to eq([Arel::Nodes::Descending, Arel::Nodes::Ascending])
413
+ expect(query(User, order: ['firstname.desc', 'lastname']).relation.order_values.map(&:expr).map(&:name)).to eq(['firstname', 'lastname'])
418
414
  end
419
415
 
420
416
  it 'defines #query method on returned relation' do
421
- query(User).relation.should respond_to(:query)
417
+ expect(query(User).relation).to respond_to(:query)
422
418
  end
423
419
 
424
420
  it 'does not define #query method for future relations' do
425
- query(User).relation.query.should be_present
426
- User.should_not respond_to(:query)
427
- User.all.should_not respond_to(:query)
428
- User.enabled.should_not respond_to(:query)
421
+ expect(query(User).relation.query).to be_present
422
+ expect(User).not_to respond_to(:query)
423
+ expect(User.all).not_to respond_to(:query)
424
+ expect(User.enabled).not_to respond_to(:query)
429
425
  end
430
426
 
431
427
  it 'defined #query method returns query' do
432
428
  q = query(User)
433
- q.relation.query.should be_a(ScopedFrom::Query)
434
- q.relation.query.should be(q)
429
+ expect(q.relation.query).to be_a(ScopedFrom::Query)
430
+ expect(q.relation.query).to be(q)
435
431
  end
436
432
 
437
433
  end
@@ -439,54 +435,54 @@ describe ScopedFrom::Query do
439
435
  describe '#true?' do
440
436
 
441
437
  it 'is true if true is given' do
442
- query.send(:true?, true).should be_true
438
+ expect(query.send(:true?, true)).to be(true)
443
439
  end
444
440
 
445
441
  it 'is true if "true" is given' do
446
- query.send(:true?, 'true').should be_true
447
- query.send(:true?, 'True').should be_true
442
+ expect(query.send(:true?, 'true')).to be(true)
443
+ expect(query.send(:true?, 'True')).to be(true)
448
444
  end
449
445
 
450
446
  it 'is true if "1" is given' do
451
- query.send(:true?, '1').should be_true
447
+ expect(query.send(:true?, '1')).to be(true)
452
448
  end
453
449
 
454
450
  it 'is true if "on" is given' do
455
- query.send(:true?, 'on').should be_true
456
- query.send(:true?, 'ON ').should be_true
451
+ expect(query.send(:true?, 'on')).to be(true)
452
+ expect(query.send(:true?, 'ON ')).to be(true)
457
453
  end
458
454
 
459
455
  it 'is true if "yes" is given' do
460
- query.send(:true?, 'yes').should be_true
461
- query.send(:true?, ' Yes ').should be_true
456
+ expect(query.send(:true?, 'yes')).to be(true)
457
+ expect(query.send(:true?, ' Yes ')).to be(true)
462
458
  end
463
459
 
464
460
  it 'is true if "y" is given' do
465
- query.send(:true?, 'y').should be_true
466
- query.send(:true?, 'Y ').should be_true
461
+ expect(query.send(:true?, 'y')).to be(true)
462
+ expect(query.send(:true?, 'Y ')).to be(true)
467
463
  end
468
464
 
469
465
  it 'is false if false is given' do
470
- query.send(:true?, false).should be_false
466
+ expect(query.send(:true?, false)).to be(false)
471
467
  end
472
468
 
473
469
  it 'is false if "false" is given' do
474
- query.send(:true?, 'false').should be_false
475
- query.send(:true?, 'FsALSE').should be_false
470
+ expect(query.send(:true?, 'false')).to be(false)
471
+ expect(query.send(:true?, 'FsALSE')).to be(false)
476
472
  end
477
473
 
478
474
  it 'is false if "0" is given' do
479
- query.send(:true?, '0').should be_false
475
+ expect(query.send(:true?, '0')).to be(false)
480
476
  end
481
477
 
482
478
  it 'is false if "off" is given' do
483
- query.send(:true?, "off").should be_false
484
- query.send(:true?, "Off").should be_false
479
+ expect(query.send(:true?, "off")).to be(false)
480
+ expect(query.send(:true?, "Off")).to be(false)
485
481
  end
486
482
 
487
483
  it 'is false otherwise' do
488
- query.send(:true?, 42).should be_false
489
- query.send(:true?, 'bam').should be_false
484
+ expect(query.send(:true?, 42)).to be(false)
485
+ expect(query.send(:true?, 'bam')).to be(false)
490
486
  end
491
487
 
492
488
  end
@@ -4,13 +4,10 @@ describe ScopedFrom do
4
4
 
5
5
  describe '.version' do
6
6
 
7
- it 'is a string' do
8
- ScopedFrom.version.should be_a(String)
9
- end
7
+ subject { ScopedFrom.version }
10
8
 
11
- it 'is with correct format' do
12
- ScopedFrom.version.should match(/^\d+\.\d+(\.\d+)?/)
13
- end
9
+ it { should be_a(String) }
10
+ it { should match(/^\d+\.\d+(\.\d+)?/) }
14
11
 
15
12
  it 'is freezed' do
16
13
  expect {
data/spec/spec_helper.rb CHANGED
@@ -10,6 +10,8 @@ Dir["#{__dir__}/support/**/*.rb"].each { |f| require File.expand_path(f) }
10
10
  ActiveSupport::Dependencies.autoload_paths << "#{__dir__}/mocks"
11
11
 
12
12
  RSpec.configure do |config|
13
+ config.raise_errors_for_deprecations!
14
+
13
15
  config.include(UserMacro)
14
16
 
15
17
  config.before(:each) do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scoped_from
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexis Toulotte
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-07 00:00:00.000000000 Z
11
+ date: 2014-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 2.14.0
75
+ version: 3.0.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 2.14.0
82
+ version: 3.0.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: sqlite3-ruby
85
85
  requirement: !ruby/object:Gem::Requirement