comfy_blog 0.1.8 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +16 -0
- data/.travis.yml +11 -0
- data/Gemfile +8 -6
- data/LICENSE +2 -2
- data/README.md +22 -56
- data/Rakefile +19 -16
- data/app/controllers/admin/blog/base_controller.rb +11 -2
- data/app/controllers/admin/blog/blogs_controller.rb +51 -0
- data/app/controllers/admin/blog/comments_controller.rb +16 -17
- data/app/controllers/admin/blog/posts_controller.rb +26 -26
- data/app/controllers/blog/base_controller.rb +31 -0
- data/app/controllers/blog/comments_controller.rb +25 -27
- data/app/controllers/blog/posts_controller.rb +36 -29
- data/app/models/blog/blog.rb +29 -0
- data/app/models/blog/comment.rb +7 -9
- data/app/models/blog/post.rb +17 -55
- data/app/views/admin/blog/blogs/_form.html.haml +11 -0
- data/app/views/admin/blog/blogs/edit.html.haml +5 -0
- data/app/views/admin/blog/blogs/index.html.haml +26 -0
- data/app/views/admin/blog/blogs/new.html.haml +5 -0
- data/app/views/admin/blog/comments/_comment.html.haml +17 -0
- data/app/views/admin/blog/comments/index.html.haml +17 -0
- data/app/views/admin/blog/comments/toggle_publish.js.erb +1 -0
- data/app/views/admin/blog/partials/_navigation.html.haml +6 -0
- data/app/views/admin/blog/posts/_form.html.haml +13 -0
- data/app/views/admin/blog/posts/edit.html.haml +5 -0
- data/app/views/admin/blog/posts/index.html.haml +32 -0
- data/app/views/admin/blog/posts/new.html.haml +5 -0
- data/app/views/blog/comments/_form.html.haml +10 -0
- data/app/views/blog/posts/index.html.haml +13 -0
- data/app/views/blog/posts/index.rss.builder +7 -5
- data/app/views/blog/posts/show.html.haml +18 -0
- data/app/views/layouts/blog/application.html.haml +7 -0
- data/comfy_blog.gemspec +16 -128
- data/config.ru +1 -1
- data/config/application.rb +6 -26
- data/config/blog_routes.rb +6 -0
- data/config/boot.rb +1 -2
- data/config/database.yml +2 -16
- data/config/environments/development.rb +10 -16
- data/config/environments/test.rb +14 -20
- data/config/initializers/comfy_blog.rb +1 -16
- data/config/initializers/secret_token.rb +14 -2
- data/db/migrate/00_create_cms.rb +137 -0
- data/db/migrate/01_create_blog.rb +52 -0
- data/lib/comfy_blog.rb +14 -17
- data/lib/comfy_blog/configuration.rb +1 -35
- data/lib/comfy_blog/engine.rb +17 -11
- data/lib/comfy_blog/routing.rb +38 -0
- data/lib/comfy_blog/version.rb +3 -0
- data/lib/generators/comfy/blog/README +7 -7
- data/lib/generators/comfy/blog/blog_generator.rb +24 -10
- data/script/rails +1 -1
- data/test/controllers/admin/blog/blogs_controller_test.rb +94 -0
- data/test/controllers/admin/blog/comments_controller_test.rb +57 -0
- data/test/{functional → controllers}/admin/blog/posts_controller_test.rb +31 -31
- data/test/controllers/blog/comments_controller_test.rb +36 -0
- data/test/controllers/blog/posts_controller_test.rb +80 -0
- data/test/fixtures/blog/blogs.yml +7 -0
- data/test/fixtures/blog/posts.yml +1 -0
- data/test/fixtures/cms/sites.yml +4 -0
- data/test/fixtures/generators/blog/routes.rb +6 -0
- data/test/generators/blog_generator_test.rb +19 -0
- data/test/lib/configuration_test.rb +16 -0
- data/test/models/blog/blog_test.rb +59 -0
- data/test/{unit/comment_test.rb → models/blog/comments_test.rb} +4 -5
- data/test/models/blog/posts_test.rb +88 -0
- data/test/test_helper.rb +80 -27
- metadata +53 -111
- data/VERSION +0 -1
- data/app/assets/images/rails.png +0 -0
- data/app/assets/javascripts/application.js +0 -8
- data/app/controllers/admin/blog/tags_controller.rb +0 -56
- data/app/controllers/application_controller.rb +0 -5
- data/app/helpers/blog/application_helper.rb +0 -23
- data/app/models/.gitkeep +0 -0
- data/app/models/blog/tag.rb +0 -25
- data/app/models/blog/tagging.rb +0 -22
- data/app/views/admin/blog/_navigation.html.erb +0 -1
- data/app/views/admin/blog/comments/_comment.html.erb +0 -22
- data/app/views/admin/blog/comments/destroy.js.erb +0 -3
- data/app/views/admin/blog/comments/index.html.erb +0 -12
- data/app/views/admin/blog/comments/publish.js.erb +0 -1
- data/app/views/admin/blog/posts/_form.html.erb +0 -37
- data/app/views/admin/blog/posts/_post.html.erb +0 -29
- data/app/views/admin/blog/posts/edit.html.erb +0 -5
- data/app/views/admin/blog/posts/index.html.erb +0 -15
- data/app/views/admin/blog/posts/new.html.erb +0 -5
- data/app/views/admin/blog/tags/_form.html.erb +0 -20
- data/app/views/admin/blog/tags/_tag.html.erb +0 -16
- data/app/views/admin/blog/tags/edit.html.erb +0 -5
- data/app/views/admin/blog/tags/index.html.erb +0 -9
- data/app/views/admin/blog/tags/new.html.erb +0 -5
- data/app/views/blog/comments/_comment.html.erb +0 -4
- data/app/views/blog/comments/_disqus.html.erb +0 -14
- data/app/views/blog/comments/_form.html.erb +0 -6
- data/app/views/blog/comments/create.js.erb +0 -6
- data/app/views/blog/posts/_post.html.erb +0 -8
- data/app/views/blog/posts/index.html.erb +0 -9
- data/app/views/blog/posts/show.html.erb +0 -13
- data/app/views/layouts/application.html.erb +0 -17
- data/config/locales/en.yml +0 -5
- data/config/routes.rb +0 -37
- data/db/migrate/01_create_comfy_blog.rb +0 -55
- data/db/schema.rb +0 -63
- data/db/seeds.rb +0 -7
- data/lib/comfy_blog/core_ext/string.rb +0 -8
- data/lib/comfy_blog/form_builder.rb +0 -50
- data/lib/tasks/comfy_blog.rake +0 -4
- data/test/fixtures/.gitkeep +0 -0
- data/test/fixtures/blog/taggings.yml +0 -7
- data/test/fixtures/blog/tags.yml +0 -14
- data/test/functional/.gitkeep +0 -0
- data/test/functional/admin/blog/comments_controller_test.rb +0 -38
- data/test/functional/admin/blog/tags_controller_test.rb +0 -88
- data/test/functional/blog/comments_controller_test.rb +0 -78
- data/test/functional/blog/posts_controller_test.rb +0 -110
- data/test/integration/routing_test.rb +0 -26
- data/test/unit/.gitkeep +0 -0
- data/test/unit/configuration_test.rb +0 -29
- data/test/unit/helpers/blog/application_helper_test.rb +0 -10
- data/test/unit/post_test.rb +0 -147
- data/test/unit/tag_test.rb +0 -45
- data/test/unit/tagging_test.rb +0 -30
@@ -1,110 +0,0 @@
|
|
1
|
-
require File.expand_path('../../test_helper', File.dirname(__FILE__))
|
2
|
-
|
3
|
-
class Blog::PostsControllerTest < ActionController::TestCase
|
4
|
-
|
5
|
-
def test_get_index
|
6
|
-
get :index
|
7
|
-
assert_response :success
|
8
|
-
assert_template :index
|
9
|
-
assert assigns(:posts)
|
10
|
-
assert_equal 1, assigns(:posts).size
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_get_index_as_rss
|
14
|
-
get :index, :format => :rss
|
15
|
-
assert_response :success
|
16
|
-
assert_template :index
|
17
|
-
assert assigns(:posts)
|
18
|
-
assert_equal 1, assigns(:posts).size
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_get_index_with_unpublished
|
22
|
-
blog_posts(:default).update_attribute(:is_published, false)
|
23
|
-
get :index
|
24
|
-
assert_response :success
|
25
|
-
assert_equal 0, assigns(:posts).size
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_get_index_with_pagination
|
29
|
-
if defined?(WillPaginate) || defined?(Kaminari)
|
30
|
-
get :index, :page => 99
|
31
|
-
assert_response :success
|
32
|
-
assert_equal 0, assigns(:posts).size
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_get_index_for_tagged
|
37
|
-
get :index, :tag => blog_tags(:tag).name
|
38
|
-
assert_response :success
|
39
|
-
assert_equal 1, assigns(:posts).size
|
40
|
-
|
41
|
-
get :index, :tag => 'invalid'
|
42
|
-
assert_response :success
|
43
|
-
assert_equal 0, assigns(:posts).size
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_get_index_for_categorized
|
47
|
-
get :index, :category => blog_tags(:category).name
|
48
|
-
assert_response :success
|
49
|
-
assert_equal 1, assigns(:posts).size
|
50
|
-
|
51
|
-
get :index, :category => 'invalid'
|
52
|
-
assert_response :success
|
53
|
-
assert_equal 0, assigns(:posts).size
|
54
|
-
end
|
55
|
-
|
56
|
-
def test_get_index_for_year_archive
|
57
|
-
get :index, :year => 2012
|
58
|
-
assert_response :success
|
59
|
-
assert_equal 1, assigns(:posts).size
|
60
|
-
|
61
|
-
get :index, :year => 1999
|
62
|
-
assert_response :success
|
63
|
-
assert_equal 0, assigns(:posts).size
|
64
|
-
end
|
65
|
-
|
66
|
-
def test_get_index_for_month_archive
|
67
|
-
get :index, :year => 2012, :month => 1
|
68
|
-
assert_response :success
|
69
|
-
assert_equal 1, assigns(:posts).size
|
70
|
-
|
71
|
-
get :index, :year => 2012, :month => 12
|
72
|
-
assert_response :success
|
73
|
-
assert_equal 0, assigns(:posts).size
|
74
|
-
end
|
75
|
-
|
76
|
-
def test_get_show
|
77
|
-
get :show, :id => blog_posts(:default)
|
78
|
-
assert_response :success
|
79
|
-
assert_template :show
|
80
|
-
assert assigns(:post)
|
81
|
-
end
|
82
|
-
|
83
|
-
def test_get_show_unpublished
|
84
|
-
post = blog_posts(:default)
|
85
|
-
post.update_attribute(:is_published, false)
|
86
|
-
get :show, :id => post
|
87
|
-
assert_response 404
|
88
|
-
end
|
89
|
-
|
90
|
-
def test_get_show_with_date
|
91
|
-
post = blog_posts(:default)
|
92
|
-
get :show, :year => post.year, :month => post.month, :slug => blog_posts(:default).slug
|
93
|
-
assert_response :success
|
94
|
-
assert_template :show
|
95
|
-
assert assigns(:post)
|
96
|
-
end
|
97
|
-
|
98
|
-
def test_get_show_with_date_invalid
|
99
|
-
get :show, :year => '1999', :month => '99', :slug => 'invalid'
|
100
|
-
assert_response 404
|
101
|
-
end
|
102
|
-
|
103
|
-
def test_get_show_with_disqus
|
104
|
-
ComfyBlog.config.disqus_shortname = 'test'
|
105
|
-
post = blog_posts(:default)
|
106
|
-
get :show, :year => post.year, :month => post.month, :slug => blog_posts(:default).slug
|
107
|
-
assert_response :success
|
108
|
-
end
|
109
|
-
|
110
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require File.expand_path('../test_helper', File.dirname(__FILE__))
|
2
|
-
|
3
|
-
class RoutingTest < ActionDispatch::IntegrationTest
|
4
|
-
|
5
|
-
def setup
|
6
|
-
reset_config
|
7
|
-
Rails.application.reload_routes!
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_admin_route_prefix
|
11
|
-
ComfyBlog.config.admin_route_prefix = 'custom-admin'
|
12
|
-
Rails.application.reload_routes!
|
13
|
-
|
14
|
-
get '/custom-admin/blog/posts'
|
15
|
-
assert_response :success
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_public_route_prefix
|
19
|
-
ComfyBlog.config.public_route_prefix = 'blog'
|
20
|
-
Rails.application.reload_routes!
|
21
|
-
|
22
|
-
get '/blog'
|
23
|
-
assert_response :success
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
data/test/unit/.gitkeep
DELETED
File without changes
|
@@ -1,29 +0,0 @@
|
|
1
|
-
require File.expand_path('../test_helper', File.dirname(__FILE__))
|
2
|
-
|
3
|
-
class ConfigurationTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
def test_configuration
|
6
|
-
assert config = ComfyBlog.configuration
|
7
|
-
assert_equal 'ComfyBlog', config.title
|
8
|
-
assert_equal 'A Simple Blog', config.description
|
9
|
-
assert_equal 'admin', config.admin_route_prefix
|
10
|
-
assert_equal '', config.public_route_prefix
|
11
|
-
assert_equal 'ApplicationController', config.admin_controller
|
12
|
-
assert_equal 'ComfyBlog::FormBuilder', config.form_builder
|
13
|
-
assert_equal 10, config.posts_per_page
|
14
|
-
assert_equal false, config.auto_publish_comments
|
15
|
-
assert_equal nil, config.disqus_shortname
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_initialization_overrides
|
19
|
-
ComfyBlog.config.admin_route_prefix = 'new-admin'
|
20
|
-
assert_equal 'new-admin', ComfyBlog.config.admin_route_prefix
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_disqus_enabled?
|
24
|
-
assert !ComfyBlog.disqus_enabled?
|
25
|
-
ComfyBlog.config.disqus_shortname = 'test'
|
26
|
-
assert ComfyBlog.disqus_enabled?
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
require File.expand_path('../../../test_helper', File.dirname(__FILE__))
|
2
|
-
|
3
|
-
class Blog::ApplicationHelperTest < ActionView::TestCase
|
4
|
-
|
5
|
-
def test_blog_post_path
|
6
|
-
assert_equal '/2012/01/default-title', blog_post_path(blog_posts(:default))
|
7
|
-
assert_equal 'http://test.host/2012/01/default-title', blog_post_url(blog_posts(:default))
|
8
|
-
end
|
9
|
-
|
10
|
-
end
|
data/test/unit/post_test.rb
DELETED
@@ -1,147 +0,0 @@
|
|
1
|
-
require File.expand_path('../test_helper', File.dirname(__FILE__))
|
2
|
-
|
3
|
-
class PostTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
def test_fixtures_validity
|
6
|
-
Blog::Post.all.each do |post|
|
7
|
-
assert post.valid?, post.errors.full_messages.to_s
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_validation
|
12
|
-
post = Blog::Post.new
|
13
|
-
assert post.invalid?
|
14
|
-
assert_has_errors_on post, [:title, :slug, :content]
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_validation_of_slug_uniqueness
|
18
|
-
old_post = blog_posts(:default)
|
19
|
-
old_post.update_attributes!(:published_at => Time.now)
|
20
|
-
post = Blog::Post.new(:title => old_post.title, :content => 'Test Content')
|
21
|
-
assert post.invalid?
|
22
|
-
assert_has_errors_on post, [:slug]
|
23
|
-
|
24
|
-
old_post.update_attributes!(:published_at => 1.year.ago)
|
25
|
-
assert post.valid?
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_creation
|
29
|
-
assert_difference 'Blog::Post.count' do
|
30
|
-
post = Blog::Post.create!(
|
31
|
-
:title => 'Test Post',
|
32
|
-
:content => 'Test Content'
|
33
|
-
)
|
34
|
-
assert_equal 'test-post', post.slug
|
35
|
-
assert_equal Time.now.year, post.year
|
36
|
-
assert_equal Time.now.month, post.month
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_set_slug
|
41
|
-
post = Blog::Post.new(:title => 'Test Title')
|
42
|
-
post.send(:set_slug)
|
43
|
-
assert_equal 'test-title', post.slug
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_set_date
|
47
|
-
post = Blog::Post.new
|
48
|
-
post.send(:set_published_at)
|
49
|
-
post.send(:set_date)
|
50
|
-
assert_equal post.published_at.year, post.year
|
51
|
-
assert_equal post.published_at.month, post.month
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_set_published_at
|
55
|
-
post = Blog::Post.new
|
56
|
-
post.send(:set_published_at)
|
57
|
-
assert post.published_at.present?
|
58
|
-
end
|
59
|
-
|
60
|
-
def test_sync_tags
|
61
|
-
post = blog_posts(:default)
|
62
|
-
assert_equal 'tag', post.tag_names
|
63
|
-
|
64
|
-
post.tag_names = 'one, two, three'
|
65
|
-
assert_equal 'one, two, three', post.tag_names
|
66
|
-
|
67
|
-
assert_difference ['Blog::Tag.count', 'Blog::Tagging.count'], 2 do
|
68
|
-
post.save!
|
69
|
-
post.reload
|
70
|
-
assert_equal 'one, two, three', post.tag_names
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
def test_sync_tags_duplicate
|
75
|
-
post = blog_posts(:default)
|
76
|
-
|
77
|
-
post.tag_names = 'tag, category'
|
78
|
-
assert_no_difference ['Blog::Tagging.count'] do
|
79
|
-
post.save!
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
def test_sync_categories
|
84
|
-
post = blog_posts(:default)
|
85
|
-
assert_equal 1, post.tags.categories.count
|
86
|
-
|
87
|
-
assert_difference 'Blog::Tagging.count', -1 do
|
88
|
-
post.update_attribute(:category_ids, blog_tags(:category).id => 0)
|
89
|
-
post.reload
|
90
|
-
assert_equal 0, post.tags.categories.count
|
91
|
-
end
|
92
|
-
|
93
|
-
assert_difference 'Blog::Tagging.count' do
|
94
|
-
post.update_attribute(:category_ids, blog_tags(:category).id => 1)
|
95
|
-
post.reload
|
96
|
-
assert_equal 1, post.tags.categories.count
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
def test_destroy
|
101
|
-
assert_difference ['Blog::Post.count', 'Blog::Comment.count'], -1 do
|
102
|
-
blog_posts(:default).destroy
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
def test_scope_published
|
107
|
-
post = blog_posts(:default)
|
108
|
-
assert post.is_published?
|
109
|
-
assert_equal 1, Blog::Post.published.count
|
110
|
-
|
111
|
-
post.update_attribute(:is_published, false)
|
112
|
-
assert_equal 0, Blog::Post.published.count
|
113
|
-
end
|
114
|
-
|
115
|
-
def test_scope_for_year
|
116
|
-
assert_equal 1, Blog::Post.for_year(2012).count
|
117
|
-
assert_equal 0, Blog::Post.for_year(2013).count
|
118
|
-
end
|
119
|
-
|
120
|
-
def test_scope_for_month
|
121
|
-
assert_equal 1, Blog::Post.for_month(1).count
|
122
|
-
assert_equal 0, Blog::Post.for_month(2).count
|
123
|
-
end
|
124
|
-
|
125
|
-
def test_scope_tagged_with
|
126
|
-
assert_equal 1, Blog::Post.tagged_with('tag').count
|
127
|
-
assert_equal 0, Blog::Post.tagged_with('category').count
|
128
|
-
assert_equal 0, Blog::Post.tagged_with('invalid').count
|
129
|
-
end
|
130
|
-
|
131
|
-
def test_scope_categorized_as
|
132
|
-
assert_equal 1, Blog::Post.categorized_as('category').count
|
133
|
-
assert_equal 0, Blog::Post.categorized_as('tag').count
|
134
|
-
assert_equal 0, Blog::Post.categorized_as('invalid').count
|
135
|
-
end
|
136
|
-
|
137
|
-
def test_tag_names
|
138
|
-
assert_equal 'tag', blog_posts(:default).tag_names
|
139
|
-
end
|
140
|
-
|
141
|
-
def test_category_ids
|
142
|
-
assert_equal ({
|
143
|
-
blog_tags(:category).id.to_s => '1'
|
144
|
-
}), blog_posts(:default).category_ids
|
145
|
-
end
|
146
|
-
|
147
|
-
end
|
data/test/unit/tag_test.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
require File.expand_path('../test_helper', File.dirname(__FILE__))
|
2
|
-
|
3
|
-
class TagTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
def test_fixtures_validity
|
6
|
-
Blog::Tag.all.each do |tag|
|
7
|
-
assert tag.valid?, tag.errors.to_s
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_validation
|
12
|
-
old_tag = blog_tags(:tag)
|
13
|
-
tag = Blog::Tag.new(:name => old_tag.name)
|
14
|
-
assert tag.invalid?
|
15
|
-
assert_has_errors_on tag, [:name]
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_strip_name
|
19
|
-
tag = Blog::Tag.new(:name => ' Test Tag ')
|
20
|
-
assert tag.valid?
|
21
|
-
assert_equal 'Test Tag', tag.name
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_creation
|
25
|
-
assert_difference 'Blog::Tag.count' do
|
26
|
-
tag = Blog::Tag.create(:name => 'Test Tag')
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_destroy
|
31
|
-
assert_difference ['Blog::Tag.count', 'Blog::Tagging.count'], -1 do
|
32
|
-
blog_tags(:tag).destroy
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_scopes
|
37
|
-
assert_equal 2, Blog::Tag.tags.count
|
38
|
-
assert_equal blog_tags(:tag), Blog::Tag.tags.first
|
39
|
-
assert_equal blog_tags(:duplicate), Blog::Tag.tags.last
|
40
|
-
|
41
|
-
assert_equal 1, Blog::Tag.categories.count
|
42
|
-
assert_equal blog_tags(:category), Blog::Tag.categories.first
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
data/test/unit/tagging_test.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
require File.expand_path('../test_helper', File.dirname(__FILE__))
|
2
|
-
|
3
|
-
class TaggingTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
def test_fixtures_validity
|
6
|
-
Blog::Tagging.all.each do |tagging|
|
7
|
-
assert tagging.valid?, tagging.errors.to_s
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_destroy_for_tag
|
12
|
-
assert_difference ['Blog::Tagging.count', 'Blog::Tag.count'], -1 do
|
13
|
-
blog_taggings(:tag).destroy
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_destroy_for_category
|
18
|
-
assert_difference 'Blog::Tagging.count', -1 do
|
19
|
-
assert_no_difference 'Blog::Tag.count' do
|
20
|
-
blog_taggings(:category).destroy
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_scopes
|
26
|
-
assert_equal 1, Blog::Tagging.for_tags.count
|
27
|
-
assert_equal 1, Blog::Tagging.for_categories.count
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|