scope_composer 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/scope_composer/scope.rb +1 -0
- data/lib/scope_composer/version.rb +1 -1
- data/spec/scope_composer/model_spec.rb +14 -3
- data/spec/spec_helper.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ODZmYzRjMTc3ZTg2ZGJiMjA0NWY4NjhhNzBiN2Q2MmNlOWNhNDBmOQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NjZmZjFmZjFlNzNiNmVkYjFhZDJjYmVkNTY0ZDMxNTg5ZGMxNTIwOA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OGRlYWZhYjNlMDhjN2RhNDJjMWFlNWYzNTlkM2JmZDg2YTYxOWU4YjdjMmRl
|
10
|
+
NzA5MTIyYjY3OWY1ODc4ZDE0ZTZlM2NhOTM0MTY3Yjc2MmU1ZDE0Y2U4ZDU1
|
11
|
+
NmViNmViMWFlYjY5OTMyNGNiOTk0NDcyOGFjZjFmNjc2YTNkOGI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZDQ3MWRkZTdlMGJiYmMyYzVjOGUzZmJhMWE5M2MyY2ZhNGNmYzkzYzUzZmFk
|
14
|
+
YzUwNWQzYTcwNjYxM2Q5YTYzZmE4OGIzYzViODUzMzgyZmM1NTg3ZDVmNzlj
|
15
|
+
OWJhNmNkYTljZTRkNDQyN2Y3MjBhZTllYTZkMDVlYzFhZjc4ZTg=
|
data/lib/scope_composer/scope.rb
CHANGED
@@ -8,12 +8,14 @@ describe ScopeComposer::Model do
|
|
8
8
|
|
9
9
|
has_scope_composer
|
10
10
|
scope :say_hi, ->(t){ scope_attributes[:say_hi] = t }
|
11
|
+
|
11
12
|
scope_helper :helper_method, ->(t){ 'hi' }
|
12
13
|
|
13
14
|
scope_composer_for :search
|
14
15
|
search_scope :select
|
15
16
|
search_scope :limit
|
16
17
|
search_scope :offset, prefix: true
|
18
|
+
search_scope :value_to_i, ->(value){ scope_attributes[:value_to_i] = value.to_i }
|
17
19
|
search_helper :tester, ->(t){ t.to_i }
|
18
20
|
|
19
21
|
end
|
@@ -65,9 +67,9 @@ describe ScopeComposer::Model do
|
|
65
67
|
its(:attributes){ should eq({ id: 20 }) }
|
66
68
|
end
|
67
69
|
|
68
|
-
describe "#
|
70
|
+
describe "#clone" do
|
69
71
|
before(:each){ scope.where( id: 20 ) }
|
70
|
-
subject{ scope.
|
72
|
+
subject{ scope.clone }
|
71
73
|
|
72
74
|
its(:attributes){ should eq({ id: 20 }) }
|
73
75
|
|
@@ -78,7 +80,16 @@ describe ScopeComposer::Model do
|
|
78
80
|
subject.attributes.should eq({id: 40})
|
79
81
|
end
|
80
82
|
|
81
|
-
|
83
|
+
end
|
84
|
+
|
85
|
+
describe "#limit=" do
|
86
|
+
before(:each){ subject.limit = 10 }
|
87
|
+
its(:limit){ should eq 10 }
|
88
|
+
end
|
89
|
+
|
90
|
+
describe "#value_to_i=" do
|
91
|
+
before(:each){ subject.value_to_i = '10' }
|
92
|
+
its(:value_to_i){ should eq 10 }
|
82
93
|
end
|
83
94
|
|
84
95
|
end
|
data/spec/spec_helper.rb
CHANGED