blogit 0.8.0 → 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +3 -1
- data/Rakefile +8 -24
- data/app/controllers/blogit/application_controller.rb +5 -16
- data/app/controllers/blogit/comments_controller.rb +7 -5
- data/app/controllers/blogit/posts_controller.rb +30 -17
- data/app/helpers/blogit/posts_helper.rb +1 -1
- data/app/models/blogit/comment.rb +23 -27
- data/app/models/blogit/post.rb +24 -23
- data/app/views/blogit/comments/_admin_links.html.erb +2 -2
- data/app/views/blogit/comments/create.js.erb +2 -2
- data/app/views/blogit/posts/_empty.html.erb +0 -3
- data/app/views/blogit/posts/_form.html.erb +9 -3
- data/app/views/blogit/posts/_post_links.html.erb +3 -2
- data/app/views/blogit/posts/_related.html.erb +1 -1
- data/config/locales/de.yml +50 -0
- data/config/locales/en.yml +2 -5
- data/config/locales/fr.yml +0 -4
- data/config/routes.rb +3 -3
- data/db/migrate/20110814091434_create_blogit_posts.rb +15 -0
- data/db/migrate/{20110814093229_create_blog_comments.rb → 20110814093229_create_blogit_comments.rb} +3 -3
- data/lib/blogit/configuration.rb +26 -1
- data/lib/blogit/version.rb +1 -1
- data/lib/blogit.rb +1 -2
- data/lib/generators/blogit/table_name_migration_generator.rb +15 -0
- data/lib/generators/templates/blogit.rb +12 -6
- data/lib/generators/templates/rename_blogit_tables.rb +21 -0
- data/spec/controllers/blogit/comments_controller_spec.rb +1 -1
- data/spec/controllers/blogit/posts_controller_spec.rb +57 -13
- data/spec/dummy/app/views/layouts/custom.html.erb +34 -0
- data/spec/dummy/config/application.rb +12 -7
- data/spec/dummy/config/database.yml +28 -24
- data/spec/dummy/config/environments/development.rb +23 -14
- data/spec/dummy/config/environments/production.rb +55 -22
- data/spec/dummy/config/environments/test.rb +17 -16
- data/spec/dummy/config/initializers/blogit.rb +5 -8
- data/spec/dummy/config/initializers/secret_token.rb +11 -2
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/{db/migrate/20110814103306_acts_as_taggable_on_migration.rb → spec/dummy/db/migrate/20140511174024_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb} +6 -3
- data/spec/dummy/db/migrate/20140511174025_add_missing_unique_indices.acts_as_taggable_on_engine.rb +20 -0
- data/spec/dummy/db/migrate/20140511174026_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +15 -0
- data/spec/dummy/db/migrate/20140511174028_create_blogit_posts.blogit.rb +16 -0
- data/spec/dummy/db/migrate/20140511174029_create_blogit_comments.blogit.rb +16 -0
- data/spec/dummy/db/schema.rb +32 -29
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +1444 -2970
- data/spec/dummy/log/test.log +9631 -29732
- data/spec/dummy/tmp/cache/assets/CB5/DD0/sprockets%2F346324d2a51df58457807bee661c449c +0 -0
- data/spec/dummy/tmp/cache/assets/CB6/ED0/sprockets%2F4390d06699f3ad4262e342be530f9f91 +0 -0
- data/spec/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy/tmp/cache/assets/CE7/230/sprockets%2F6f493a817d97133a8dbf674bcd322670 +0 -0
- data/spec/dummy/tmp/cache/assets/{D35/E90/sprockets%2F9542f66fea1d10b7924f3b6b31e1e2e0 → CEA/490/sprockets%2F9697d4fb1ed26d80f3c715611c8d4373} +0 -0
- data/spec/dummy/tmp/cache/assets/CEE/310/sprockets%2F89642af8492e579dcd7162a0e2b7f155 +0 -0
- data/spec/dummy/tmp/cache/assets/D01/8C0/sprockets%2F332d5a9ce3e800c6c4a7a99058023ba2 +0 -0
- data/spec/dummy/tmp/cache/assets/D11/CC0/sprockets%2F3a12dfa6665b5318fa99d097203ac7e7 +0 -0
- data/spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/{D67/C10/sprockets%2Fa58c567f1eae28b401a6e9a0b3b71d93 → D3D/1E0/sprockets%2Ffbaabd57fa2c9d426f0c318156705667} +0 -0
- data/spec/dummy/tmp/cache/assets/D3E/920/sprockets%2F3efa8d0fc958c223647cb704183b65ca +0 -0
- data/spec/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy/tmp/cache/assets/D61/6F0/sprockets%2F02da53eeca228bcef0c49278517111fe +0 -0
- data/spec/dummy/tmp/cache/assets/DCA/9B0/sprockets%2Fdf0e8f8a85e5d4056b3fe1cec3b7131a +0 -0
- data/spec/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/dummy/tmp/cache/assets/E02/A60/sprockets%2Fb32faeede196f7a933c3a2794e7ed0bd +0 -0
- data/spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/02da53eeca228bcef0c49278517111fe +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2ff93f9f5ed9970021c7704ff93237c8 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/332d5a9ce3e800c6c4a7a99058023ba2 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/346324d2a51df58457807bee661c449c +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/3a12dfa6665b5318fa99d097203ac7e7 +0 -0
- data/spec/dummy/tmp/cache/assets/{D74/A60/sprockets%2F2add607cdb6c0b17fd866aac28895485 → development/sprockets/3ed52366904e135bd833590814b6ac6d} +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/4390d06699f3ad4262e342be530f9f91 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/6f493a817d97133a8dbf674bcd322670 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/89642af8492e579dcd7162a0e2b7f155 +0 -0
- data/spec/dummy/tmp/cache/assets/{D09/740/sprockets%2F7a82d51e72434ef73fabb4a26131d945 → development/sprockets/89dc196c51ae83634b664c0c33052008} +0 -0
- data/spec/dummy/tmp/cache/assets/{DD2/6F0/sprockets%2Ffbe80717facec3dd9ea7ac008719c843 → development/sprockets/8dd8236b00c868ba248fe30cd9c14c2a} +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/9239a04d094a872c1cf77ac391072ea8 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/b3ffb6bd243399012806331ce393ae4f +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/dummy/tmp/cache/assets/{D78/4E0/sprockets%2F3d4e761a135f6b6e50b24defce90f798 → development/sprockets/d53accc3e58037ee4005e41221b8846b} +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/df0e8f8a85e5d4056b3fe1cec3b7131a +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/factories.rb +5 -1
- data/spec/helpers/blogit/posts_helper_spec.rb +5 -5
- data/spec/lib/blogs_spec.rb +0 -6
- data/spec/lib/configuration_spec.rb +17 -1
- data/spec/models/blogit/post_spec.rb +29 -9
- data/spec/spec_helper.rb +6 -5
- metadata +177 -174
- data/app/sweepers/blogit/blogit_sweeper.rb +0 -33
- data/db/migrate/20110814091434_create_blog_posts.rb +0 -12
- data/spec/dummy/test/fixtures/people.yml +0 -7
- data/spec/dummy/test/fixtures/users.yml +0 -9
- data/spec/dummy/test/functional/people_controller_test.rb +0 -49
- data/spec/dummy/test/functional/sessions_controller_test.rb +0 -9
- data/spec/dummy/test/functional/users_controller_test.rb +0 -49
- data/spec/dummy/test/unit/helpers/people_helper_test.rb +0 -4
- data/spec/dummy/test/unit/helpers/sessions_helper_test.rb +0 -4
- data/spec/dummy/test/unit/helpers/users_helper_test.rb +0 -4
- data/spec/dummy/test/unit/person_test.rb +0 -7
- data/spec/dummy/test/unit/user_test.rb +0 -7
- data/spec/dummy/tmp/cache/assets/CAA/340/sprockets%2Fa9991211287db8645603e5ba17008bbe +0 -0
- data/spec/dummy/tmp/cache/assets/D3D/D30/sprockets%2Ff1ebd04d570b12945debea975941815b +0 -0
- data/spec/dummy/tmp/cache/assets/D66/900/sprockets%2F52de1b25e110e8a937b9e30b0a9e8da7 +0 -0
- data/spec/dummy/tmp/cache/assets/DA7/D70/sprockets%2Fc627f052aaee94e9b24815d5aee4ff38 +0 -0
- data/spec/dummy/tmp/pids/server.pid +0 -1
- data/spec/lib/action_dispatch/http/url_spec.rb +0 -21
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/spec/factories.rb
CHANGED
@@ -6,9 +6,13 @@ FactoryGirl.define do
|
|
6
6
|
factory :post, class: Blogit::Post do
|
7
7
|
title "Tis is a blog post title"
|
8
8
|
body "This is the body of the blog post - you'll see it's a lot bigger than the title"
|
9
|
+
state "draft"
|
9
10
|
association :blogger, :factory => :user
|
11
|
+
factory :published_post do
|
12
|
+
state "published"
|
13
|
+
end
|
10
14
|
end
|
11
|
-
|
15
|
+
|
12
16
|
factory :comment, class: Blogit::Comment do
|
13
17
|
name "Gavin"
|
14
18
|
email "gavin@gavinmorrice.com"
|
@@ -56,7 +56,7 @@ describe Blogit::PostsHelper do
|
|
56
56
|
Post.delete_all
|
57
57
|
end
|
58
58
|
|
59
|
-
|
59
|
+
# TODO: Clean up this horrible spec
|
60
60
|
it "should create an ul tag tree with years, monthes and articles" do
|
61
61
|
july_2012_1 = FactoryGirl.create(:post, title: "Great Post 2", created_at: Time.new(2012,7,14))
|
62
62
|
july_2012_2 = FactoryGirl.create(:post, title: "Great Post 3", created_at: Time.new(2012,7,28))
|
@@ -74,13 +74,13 @@ describe Blogit::PostsHelper do
|
|
74
74
|
"<ul class=\"#{month_css}\">",
|
75
75
|
"<li><a data-blogit-click-to-toggle-children>September</a>",
|
76
76
|
"<ul class=\"#{post_css}\">",
|
77
|
-
"<li>#{sept_2012.title}</li>",
|
77
|
+
"<li>#{link_to(sept_2012.title, blogit.post_path(sept_2012))}</li>",
|
78
78
|
"</ul>",
|
79
79
|
"</li>",
|
80
80
|
"<li><a data-blogit-click-to-toggle-children>July</a>",
|
81
81
|
"<ul class=\"#{post_css}\">",
|
82
|
-
"<li>#{july_2012_2.title}</li>",
|
83
|
-
"<li>#{july_2012_1.title}</li>",
|
82
|
+
"<li>#{link_to(july_2012_2.title, blogit.post_path(july_2012_2))}</li>",
|
83
|
+
"<li>#{link_to(july_2012_1.title, blogit.post_path(july_2012_1))}</li>",
|
84
84
|
"</ul>",
|
85
85
|
"</li>",
|
86
86
|
"</ul>",
|
@@ -89,7 +89,7 @@ describe Blogit::PostsHelper do
|
|
89
89
|
"<ul class=\"#{month_css}\">",
|
90
90
|
"<li><a data-blogit-click-to-toggle-children>December</a>",
|
91
91
|
"<ul class=\"#{post_css}\">",
|
92
|
-
"<li>#{dec_2011.title}</li>",
|
92
|
+
"<li>#{link_to(dec_2011.title, blogit.post_path(dec_2011))}</li>",
|
93
93
|
"</ul>",
|
94
94
|
"</li>",
|
95
95
|
"</ul>",
|
data/spec/lib/blogs_spec.rb
CHANGED
@@ -10,12 +10,6 @@ describe Blogit::Blogs do
|
|
10
10
|
it "should be a class macro to AR Base" do
|
11
11
|
ActiveRecord::Base.methods.should include(:blogs)
|
12
12
|
end
|
13
|
-
|
14
|
-
|
15
|
-
it "should build a hm assosciation on the model it's called in" do
|
16
|
-
lambda { User.new.blog_posts }.should_not raise_exception(NoMethodError)
|
17
|
-
User.new.blog_posts.should be_an(Array)
|
18
|
-
end
|
19
13
|
|
20
14
|
end
|
21
15
|
|
@@ -92,7 +92,7 @@ describe Blogit::Configuration do
|
|
92
92
|
gh_blockcode: true
|
93
93
|
}
|
94
94
|
end
|
95
|
-
|
95
|
+
|
96
96
|
it "should set the Pingr mode to :test unless Rails env is production" do
|
97
97
|
Pingr.mode.should eql(:test)
|
98
98
|
end
|
@@ -109,4 +109,20 @@ describe Blogit::Configuration do
|
|
109
109
|
blog_configuration.rss_feed_description.should eql "#{Rails.application.engine_name.titleize} Blog Posts"
|
110
110
|
end
|
111
111
|
|
112
|
+
it "should set layout to nil by default" do
|
113
|
+
blog_configuration.layout.should be_nil
|
114
|
+
end
|
115
|
+
|
116
|
+
it "should allow layout to be set to a string" do
|
117
|
+
lambda { blog_configuration.layout = "custom" }.should_not raise_error
|
118
|
+
end
|
119
|
+
|
120
|
+
it 'should set active_states default options' do
|
121
|
+
blog_configuration.active_states.should eql([:published])
|
122
|
+
end
|
123
|
+
|
124
|
+
it 'should set hidden_states default options' do
|
125
|
+
blog_configuration.hidden_states.should eql([:draft, :archive])
|
126
|
+
end
|
127
|
+
|
112
128
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require "spec_helper"
|
2
|
-
|
2
|
+
|
3
3
|
describe Blogit::Post do
|
4
4
|
|
5
5
|
context "should not be valid" do
|
@@ -24,10 +24,6 @@ describe Blogit::Post do
|
|
24
24
|
@blog_post.errors[:title].should_not be_blank
|
25
25
|
end
|
26
26
|
|
27
|
-
it "is blank" do
|
28
|
-
# before and after block cover this
|
29
|
-
end
|
30
|
-
|
31
27
|
it "is less than 10 characters" do
|
32
28
|
@blog_post.title = "a" * 9
|
33
29
|
end
|
@@ -58,6 +54,21 @@ describe Blogit::Post do
|
|
58
54
|
|
59
55
|
end
|
60
56
|
|
57
|
+
context "if state" do
|
58
|
+
|
59
|
+
before(:each) { @blog_post = Blogit::Post.new(state: nil) }
|
60
|
+
|
61
|
+
it "is nil" do
|
62
|
+
@blog_post.should_not be_valid
|
63
|
+
@blog_post.should have(1).error_on(:state)
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
it "sets the first value of Blogit::configuration.hidden_states as default" do
|
71
|
+
Blogit::Post.new.state.should eql(Blogit::configuration.hidden_states[0].to_s)
|
61
72
|
end
|
62
73
|
|
63
74
|
context "with Blogit.configuration.comments == active_record" do
|
@@ -68,7 +79,7 @@ describe Blogit::Post do
|
|
68
79
|
end
|
69
80
|
User.blogs
|
70
81
|
@blog_post = Blogit::Post.new
|
71
|
-
lambda { @blog_post.comments }.should_not raise_exception
|
82
|
+
lambda { @blog_post.comments }.should_not raise_exception
|
72
83
|
end
|
73
84
|
|
74
85
|
end
|
@@ -128,13 +139,16 @@ describe Blogit::Post do
|
|
128
139
|
Blogit::Post.for_index.count.should eql(3)
|
129
140
|
end
|
130
141
|
|
131
|
-
|
132
142
|
end
|
133
143
|
|
134
|
-
|
144
|
+
describe :active do
|
145
|
+
it 'should include only posts in active states blogit.config.active_states' do
|
146
|
+
published_post = create(:published_post)
|
147
|
+
Blogit::Post.active.should include (published_post)
|
148
|
+
end
|
149
|
+
end
|
135
150
|
end
|
136
151
|
|
137
|
-
|
138
152
|
describe "with Blogit.configuration.comments != active_record" do
|
139
153
|
|
140
154
|
it "should not allow comments" do
|
@@ -169,4 +183,10 @@ describe Blogit::Post do
|
|
169
183
|
end
|
170
184
|
end
|
171
185
|
|
186
|
+
describe 'AVAILABLE_STATUS' do
|
187
|
+
it "returns all the statues in Blogit::configuration" do
|
188
|
+
Blogit::Post::AVAILABLE_STATUS.should == (Blogit.configuration.hidden_states + Blogit.configuration.active_states)
|
189
|
+
end
|
190
|
+
|
191
|
+
end
|
172
192
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
-
ENV[
|
2
|
+
ENV['RAILS_ENV'] ||= 'test'
|
3
3
|
|
4
|
-
require File.expand_path(
|
4
|
+
require File.expand_path('../dummy/config/environment', __FILE__)
|
5
5
|
require 'rspec/rails'
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
6
|
+
require 'factory_girl'
|
7
|
+
require 'factories'
|
8
|
+
require 'support/authentication'
|
9
|
+
require 'pry'
|
9
10
|
|
10
11
|
include Blogit
|
11
12
|
|