simple_date_scopes 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -48,17 +48,17 @@ There are also utility scopes:
|
|
48
48
|
This means the following will work:
|
49
49
|
|
50
50
|
```ruby
|
51
|
-
|
52
|
-
|
53
|
-
|
51
|
+
Widget.this_month.each do |w|
|
52
|
+
puts w.to_s
|
53
|
+
end
|
54
54
|
|
55
|
-
|
56
|
-
|
57
|
-
|
55
|
+
Widget.last_month.limit(4).each do |w|
|
56
|
+
puts w.to_s
|
57
|
+
end
|
58
58
|
|
59
|
-
|
60
|
-
|
61
|
-
|
59
|
+
Widget.in_month_of(Date.new(2012, 2, 7)).each do |w|
|
60
|
+
puts w.to_s
|
61
|
+
end
|
62
62
|
```
|
63
63
|
|
64
64
|
If you want to test that your models are using it properly, you can do:
|
@@ -78,6 +78,9 @@ end
|
|
78
78
|
|
79
79
|
# Changes
|
80
80
|
|
81
|
+
## 0.3.0
|
82
|
+
* Changed the API again for specs, so we do not have to specify the field. Just skip 0.2.0.
|
83
|
+
|
81
84
|
## 0.2.0
|
82
85
|
* Use class methods instead so we can just specify the data field once
|
83
86
|
|
@@ -1,10 +1,11 @@
|
|
1
|
-
shared_examples_for 'simple date scopes' do
|
1
|
+
shared_examples_for 'simple date scopes' do |kind,field|
|
2
2
|
|
3
3
|
before :each do
|
4
4
|
@count = 4
|
5
5
|
@count.times { FactoryGirl.create kind.name.underscore.to_sym }
|
6
6
|
@old_item = kind.first
|
7
7
|
@new_item = kind.last
|
8
|
+
field ||= ActiveRecord::Acts::SimpleDateScopes::DEFAULT_FIELD
|
8
9
|
end
|
9
10
|
|
10
11
|
it 'should have 4 items' do
|
@@ -10,14 +10,8 @@ end
|
|
10
10
|
|
11
11
|
describe 'Simple Date Scopes' do
|
12
12
|
|
13
|
-
it_should_behave_like 'simple date scopes'
|
14
|
-
let(:kind) { Widget }
|
15
|
-
let(:field) { :updated_at }
|
16
|
-
end
|
13
|
+
it_should_behave_like 'simple date scopes', Widget, :updated_at
|
17
14
|
|
18
|
-
it_should_behave_like 'simple date scopes'
|
19
|
-
let(:kind) { DefaultWidget }
|
20
|
-
let(:field) { :created_at }
|
21
|
-
end
|
15
|
+
it_should_behave_like 'simple date scopes', DefaultWidget
|
22
16
|
|
23
17
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_date_scopes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -160,7 +160,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
160
160
|
version: '0'
|
161
161
|
segments:
|
162
162
|
- 0
|
163
|
-
hash:
|
163
|
+
hash: 3240330332425222887
|
164
164
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
165
|
none: false
|
166
166
|
requirements:
|
@@ -169,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
169
|
version: '0'
|
170
170
|
segments:
|
171
171
|
- 0
|
172
|
-
hash:
|
172
|
+
hash: 3240330332425222887
|
173
173
|
requirements: []
|
174
174
|
rubyforge_project:
|
175
175
|
rubygems_version: 1.8.23
|