publish 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/Gemfile.lock +30 -30
- data/lib/mongoid/publish/version.rb +1 -1
- data/lib/mongoid/publish.rb +2 -1
- data/test/publish/mongoid/post_test.rb +8 -0
- metadata +5 -5
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
publish (0.0.
|
4
|
+
publish (0.0.4)
|
5
5
|
mongoid (>= 2.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: http://rubygems.org/
|
9
9
|
specs:
|
10
10
|
abstract (1.0.0)
|
11
|
-
actionmailer (3.0.
|
12
|
-
actionpack (= 3.0.
|
11
|
+
actionmailer (3.0.11)
|
12
|
+
actionpack (= 3.0.11)
|
13
13
|
mail (~> 2.2.19)
|
14
|
-
actionpack (3.0.
|
15
|
-
activemodel (= 3.0.
|
16
|
-
activesupport (= 3.0.
|
14
|
+
actionpack (3.0.11)
|
15
|
+
activemodel (= 3.0.11)
|
16
|
+
activesupport (= 3.0.11)
|
17
17
|
builder (~> 2.1.2)
|
18
18
|
erubis (~> 2.6.6)
|
19
19
|
i18n (~> 0.5.0)
|
@@ -21,21 +21,21 @@ GEM
|
|
21
21
|
rack-mount (~> 0.6.14)
|
22
22
|
rack-test (~> 0.5.7)
|
23
23
|
tzinfo (~> 0.3.23)
|
24
|
-
activemodel (3.0.
|
25
|
-
activesupport (= 3.0.
|
24
|
+
activemodel (3.0.11)
|
25
|
+
activesupport (= 3.0.11)
|
26
26
|
builder (~> 2.1.2)
|
27
27
|
i18n (~> 0.5.0)
|
28
|
-
activerecord (3.0.
|
29
|
-
activemodel (= 3.0.
|
30
|
-
activesupport (= 3.0.
|
28
|
+
activerecord (3.0.11)
|
29
|
+
activemodel (= 3.0.11)
|
30
|
+
activesupport (= 3.0.11)
|
31
31
|
arel (~> 2.0.10)
|
32
32
|
tzinfo (~> 0.3.23)
|
33
|
-
activeresource (3.0.
|
34
|
-
activemodel (= 3.0.
|
35
|
-
activesupport (= 3.0.
|
36
|
-
activesupport (3.0.
|
33
|
+
activeresource (3.0.11)
|
34
|
+
activemodel (= 3.0.11)
|
35
|
+
activesupport (= 3.0.11)
|
36
|
+
activesupport (3.0.11)
|
37
37
|
arel (2.0.10)
|
38
|
-
bson (1.
|
38
|
+
bson (1.5.1)
|
39
39
|
bson_ext (1.4.0)
|
40
40
|
builder (2.1.2)
|
41
41
|
capybara (1.1.1)
|
@@ -60,7 +60,7 @@ GEM
|
|
60
60
|
ffaker (1.9.1)
|
61
61
|
ffi (1.0.9)
|
62
62
|
i18n (0.5.0)
|
63
|
-
json (1.6.
|
63
|
+
json (1.6.3)
|
64
64
|
json_pure (1.6.1)
|
65
65
|
mail (2.2.19)
|
66
66
|
activesupport (>= 2.3.6)
|
@@ -69,8 +69,8 @@ GEM
|
|
69
69
|
treetop (~> 1.4.8)
|
70
70
|
mime-types (1.17.2)
|
71
71
|
minitest (2.6.2)
|
72
|
-
mongo (1.
|
73
|
-
bson (= 1.
|
72
|
+
mongo (1.5.1)
|
73
|
+
bson (= 1.5.1)
|
74
74
|
mongoid (2.2.4)
|
75
75
|
activemodel (~> 3.0)
|
76
76
|
mongo (~> 1.3)
|
@@ -83,17 +83,17 @@ GEM
|
|
83
83
|
rack (>= 1.0.0)
|
84
84
|
rack-test (0.5.7)
|
85
85
|
rack (>= 1.0)
|
86
|
-
rails (3.0.
|
87
|
-
actionmailer (= 3.0.
|
88
|
-
actionpack (= 3.0.
|
89
|
-
activerecord (= 3.0.
|
90
|
-
activeresource (= 3.0.
|
91
|
-
activesupport (= 3.0.
|
86
|
+
rails (3.0.11)
|
87
|
+
actionmailer (= 3.0.11)
|
88
|
+
actionpack (= 3.0.11)
|
89
|
+
activerecord (= 3.0.11)
|
90
|
+
activeresource (= 3.0.11)
|
91
|
+
activesupport (= 3.0.11)
|
92
92
|
bundler (~> 1.0)
|
93
|
-
railties (= 3.0.
|
94
|
-
railties (3.0.
|
95
|
-
actionpack (= 3.0.
|
96
|
-
activesupport (= 3.0.
|
93
|
+
railties (= 3.0.11)
|
94
|
+
railties (3.0.11)
|
95
|
+
actionpack (= 3.0.11)
|
96
|
+
activesupport (= 3.0.11)
|
97
97
|
rake (>= 0.8.7)
|
98
98
|
rdoc (~> 3.4)
|
99
99
|
thor (~> 0.14.4)
|
@@ -129,5 +129,5 @@ DEPENDENCIES
|
|
129
129
|
factory_girl_rails
|
130
130
|
ffaker
|
131
131
|
publish!
|
132
|
-
rails (= 3.0.
|
132
|
+
rails (= 3.0.11)
|
133
133
|
simplecov
|
data/lib/mongoid/publish.rb
CHANGED
@@ -6,7 +6,8 @@ module Mongoid
|
|
6
6
|
field :published_at, :type => Date
|
7
7
|
field :published, :type => Boolean, :default => false
|
8
8
|
|
9
|
-
scope :published, where(:published => true, :published_at.lte => Date.today)
|
9
|
+
scope :published, where(:published => true, :published_at.lte => Date.today)
|
10
|
+
scope :published_and_orderly, where(:published => true, :published_at.lte => Date.today).desc(:published_at, :created_at)
|
10
11
|
|
11
12
|
before_save :set_published_at
|
12
13
|
end
|
@@ -38,6 +38,14 @@ class PostTest < ActiveSupport::TestCase
|
|
38
38
|
assert_equal Post.published.size, 2
|
39
39
|
end
|
40
40
|
|
41
|
+
test "should return orderly published posts" do
|
42
|
+
Factory.create(:post, :title => "2", :published => true, :published_at => 1.month.ago)
|
43
|
+
Factory.create(:post, :title => "3", :published => true, :published_at => 1.year.ago)
|
44
|
+
Factory.create(:post, :title => "1", :published => true, :published_at => 1.day.ago)
|
45
|
+
|
46
|
+
assert_equal Post.published_and_orderly.map(&:title), ["1", "2", "3"]
|
47
|
+
end
|
48
|
+
|
41
49
|
test "should publish a post" do
|
42
50
|
post = Factory.build(:post)
|
43
51
|
post.publish!
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: publish
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-12-06 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: mongoid
|
17
|
-
requirement: &
|
17
|
+
requirement: &2153290400 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
version: '2.0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *2153290400
|
26
26
|
description: Adds the functionality to publish/unpublish
|
27
27
|
email:
|
28
28
|
- contato@lucasrenan.com
|
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
106
|
version: '0'
|
107
107
|
requirements: []
|
108
108
|
rubyforge_project: publish
|
109
|
-
rubygems_version: 1.8.
|
109
|
+
rubygems_version: 1.8.12
|
110
110
|
signing_key:
|
111
111
|
specification_version: 3
|
112
112
|
summary: Adds the functionality to publish/unpublish
|