blog_logic 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/app/models/post.rb +2 -2
- data/blog_logic.gemspec +1 -1
- data/spec/models/post_spec.rb +2 -5
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.2
|
data/app/models/post.rb
CHANGED
@@ -93,7 +93,7 @@ class Post
|
|
93
93
|
end
|
94
94
|
|
95
95
|
def publish!
|
96
|
-
self.update_attributes
|
96
|
+
self.update_attributes :state => 'published', :published_at => Time.zone.now
|
97
97
|
end
|
98
98
|
|
99
99
|
def published?
|
@@ -109,7 +109,7 @@ class Post
|
|
109
109
|
end
|
110
110
|
|
111
111
|
def unpublish!
|
112
|
-
self.update_attributes :state => 'draft'
|
112
|
+
self.update_attributes :state => 'draft'
|
113
113
|
end
|
114
114
|
|
115
115
|
def state=(arg)
|
data/blog_logic.gemspec
CHANGED
data/spec/models/post_spec.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../spec_helper'
|
2
2
|
|
3
3
|
describe Post do
|
4
|
-
|
5
4
|
before :all do
|
6
5
|
@blog = Blog.make
|
7
6
|
end
|
@@ -11,11 +10,11 @@ describe Post do
|
|
11
10
|
end
|
12
11
|
|
13
12
|
it 'returns its relative URL' do
|
14
|
-
@blog.posts.new(:slug => 'foo').full_path.should ==
|
13
|
+
@blog.posts.new(:slug => 'foo').full_path.should == '/my-blog/foo/'
|
15
14
|
end
|
16
15
|
|
17
16
|
it 'returns its formatted slug' do
|
18
|
-
@blog.posts.new(:slug => 'foo').humanize_path.should ==
|
17
|
+
@blog.posts.new(:slug => 'foo').humanize_path.should == '/foo/'
|
19
18
|
end
|
20
19
|
|
21
20
|
it 'publishes, setting its publication date' do
|
@@ -30,7 +29,6 @@ describe Post do
|
|
30
29
|
post.publish!
|
31
30
|
post.unpublish!
|
32
31
|
post.status.should == 'Draft'
|
33
|
-
post.publication_date.nil?.should be_true
|
34
32
|
end
|
35
33
|
|
36
34
|
it 'defaults its desired slug to its title' do
|
@@ -42,5 +40,4 @@ describe Post do
|
|
42
40
|
post.save.should be_true
|
43
41
|
post.slug.should == 'test-post'
|
44
42
|
end
|
45
|
-
|
46
43
|
end
|
metadata
CHANGED