refinerycms-blog 2.0.4 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.gitignore +6 -1
- data/.travis.yml +10 -14
- data/Gemfile +30 -50
- data/Rakefile +2 -1
- data/app/assets/javascripts/refinery/blog/backend.js +18 -59
- data/app/assets/stylesheets/refinery/blog/backend.css.scss +10 -61
- data/app/assets/stylesheets/refinery/blog/frontend.css.scss +87 -76
- data/app/controllers/refinery/blog/admin/categories_controller.rb +7 -1
- data/app/controllers/refinery/blog/admin/comments_controller.rb +19 -21
- data/app/controllers/refinery/blog/admin/posts_controller.rb +43 -15
- data/app/controllers/refinery/blog/blog_controller.rb +31 -5
- data/app/controllers/refinery/blog/categories_controller.rb +10 -3
- data/app/controllers/refinery/blog/posts_controller.rb +40 -26
- data/app/helpers/refinery/blog/controller_helper.rb +1 -22
- data/app/helpers/refinery/blog/posts_helper.rb +9 -4
- data/app/models/refinery/blog/categorization.rb +11 -0
- data/app/models/refinery/blog/category.rb +15 -5
- data/app/models/refinery/blog/comment.rb +17 -28
- data/app/models/refinery/blog/post.rb +100 -30
- data/app/views/refinery/blog/admin/_submenu.html.erb +1 -6
- data/app/views/refinery/blog/admin/categories/_category.html.erb +23 -10
- data/app/views/refinery/blog/admin/categories/_form.html.erb +10 -11
- data/app/views/refinery/blog/admin/categories/_sortable_list.html.erb +2 -4
- data/app/views/refinery/blog/admin/categories/edit.html.erb +1 -1
- data/app/views/refinery/blog/admin/categories/index.html.erb +9 -15
- data/app/views/refinery/blog/admin/categories/new.html.erb +1 -1
- data/app/views/refinery/blog/admin/comments/_comment.html.erb +4 -12
- data/app/views/refinery/blog/admin/comments/_sortable_list.html.erb +2 -4
- data/app/views/refinery/blog/admin/comments/index.html.erb +14 -23
- data/app/views/refinery/blog/admin/comments/show.html.erb +6 -4
- data/app/views/refinery/blog/admin/posts/_form.html.erb +31 -28
- data/app/views/refinery/blog/admin/posts/_form_part.html.erb +1 -1
- data/app/views/refinery/blog/admin/posts/_post.html.erb +28 -11
- data/app/views/refinery/blog/admin/posts/_sortable_list.html.erb +2 -4
- data/app/views/refinery/blog/admin/posts/_teaser_part.html.erb +1 -1
- data/app/views/refinery/blog/admin/posts/edit.html.erb +1 -1
- data/app/views/refinery/blog/admin/posts/index.html.erb +9 -15
- data/app/views/refinery/blog/admin/posts/new.html.erb +1 -1
- data/app/views/refinery/blog/admin/posts/uncategorized.html.erb +2 -2
- data/app/views/refinery/blog/admin/settings/notification_recipients.html.erb +5 -7
- data/app/views/refinery/blog/categories/show.html.erb +4 -4
- data/app/views/refinery/blog/comment_mailer/notification.html.erb +5 -0
- data/app/views/refinery/blog/posts/_comment.html.erb +4 -4
- data/app/views/refinery/blog/posts/_comments.html.erb +28 -31
- data/app/views/refinery/blog/posts/_nav.html.erb +6 -6
- data/app/views/refinery/blog/posts/_post.html.erb +9 -9
- data/app/views/refinery/blog/posts/archive.html.erb +7 -6
- data/app/views/refinery/blog/posts/index.html.erb +6 -6
- data/app/views/refinery/blog/posts/index.rss.builder +8 -2
- data/app/views/refinery/blog/posts/show.html.erb +5 -7
- data/app/views/refinery/blog/posts/tagged.html.erb +5 -5
- data/app/views/refinery/blog/shared/_body_content_right.html.erb +7 -7
- data/app/views/refinery/blog/shared/_categories.html.erb +4 -4
- data/app/views/refinery/blog/shared/_post.html.erb +18 -18
- data/app/views/refinery/blog/shared/_posts.html.erb +1 -1
- data/app/views/refinery/blog/shared/_rss_feed.html.erb +2 -0
- data/app/views/refinery/blog/shared/_tags.html.erb +1 -1
- data/app/views/refinery/shared/admin/_autocomplete.html.erb +44 -3
- data/bin/rails +11 -0
- data/bin/refinerycms +62 -0
- data/certs/parndt.pem +25 -0
- data/changelog.md +4 -1
- data/config/initializers/url_validator.rb +15 -11
- data/config/locales/bg.yml +8 -10
- data/config/locales/cs.yml +7 -9
- data/config/locales/de.yml +27 -8
- data/config/locales/en.yml +18 -12
- data/config/locales/es.yml +2 -4
- data/config/locales/fr.yml +34 -16
- data/config/locales/it.yml +8 -10
- data/config/locales/ja.yml +22 -11
- data/config/locales/nb.yml +154 -16
- data/config/locales/nl.yml +42 -7
- data/config/locales/pl.yml +6 -8
- data/config/locales/pt-BR.yml +39 -8
- data/config/locales/ru.yml +49 -5
- data/config/locales/sk.yml +59 -20
- data/config/locales/sv.yml +165 -0
- data/config/locales/uk.yml +172 -0
- data/config/locales/zh-CN.yml +34 -5
- data/config/locales/zh-TW.yml +160 -0
- data/config/routes.rb +11 -8
- data/db/migrate/20110803223522_create_blog_structure.rb +16 -15
- data/db/migrate/20110803223523_add_user_id_to_blog_posts.rb +3 -3
- data/db/migrate/20110803223524_acts_as_taggable_on_migration.rb +1 -1
- data/db/migrate/20110803223526_add_cached_slugs.rb +3 -3
- data/db/migrate/20110803223527_add_custom_url_field_to_blog_posts.rb +2 -2
- data/db/migrate/20110803223528_add_custom_teaser_field_to_blog_posts.rb +2 -2
- data/db/migrate/20110803223529_add_primary_key_to_categorizations.rb +5 -5
- data/db/migrate/20120103055909_add_source_url_to_blog_posts.rb +2 -2
- data/db/migrate/20120223022021_add_access_count_to_posts.rb +4 -4
- data/db/migrate/20120227022021_add_slug_to_posts_and_categories.rb +2 -2
- data/db/migrate/20120530102901_create_blog_translations.rb +17 -0
- data/db/migrate/20120531113632_delete_cached_slugs.rb +6 -0
- data/db/migrate/20120601151114_create_category_translations.rb +14 -0
- data/db/migrate/20140622132537_add_missing_unique_indices.acts_as_taggable_on_engine.rb +20 -0
- data/db/migrate/20140622132538_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +15 -0
- data/db/migrate/20160602042848_add_username_to_blog_posts.rb +5 -0
- data/db/migrate/20161223024527_create_multi_user_model.rb +13 -0
- data/db/migrate/20180420132008_remove_translated_columns_to_refinery_blog_categories.rb +5 -0
- data/db/seeds.rb +5 -5
- data/lib/generators/refinery/blog/templates/config/initializers/refinery/blog.rb.erb +6 -0
- data/lib/refinery/blog.rb +4 -1
- data/lib/refinery/blog/configuration.rb +25 -1
- data/lib/refinery/blog/engine.rb +9 -3
- data/readme.md +31 -5
- data/refinerycms-blog.gemspec +19 -15
- data/script/rails +1 -3
- data/spec/controllers/refinery/blog/admin/comments_controller_spec.rb +84 -0
- data/spec/controllers/refinery/blog/admin/posts_controller_spec.rb +35 -0
- data/spec/controllers/refinery/blog/posts_controller_spec.rb +24 -0
- data/spec/factories/blog_categories.rb +1 -1
- data/spec/factories/blog_comments.rb +1 -1
- data/spec/factories/blog_posts.rb +7 -3
- data/spec/factories/blog_test_users.rb +6 -0
- data/spec/features/refinery/blog/admin/categories_spec.rb +121 -0
- data/spec/{requests → features}/refinery/blog/admin/comments_spec.rb +30 -30
- data/spec/features/refinery/blog/admin/menu_spec.rb +19 -0
- data/spec/features/refinery/blog/admin/posts_spec.rb +365 -0
- data/spec/features/refinery/blog/categories_spec.rb +29 -0
- data/spec/features/refinery/blog/posts_spec.rb +171 -0
- data/spec/helpers/refinery/blog/posts_helper_spec.rb +23 -11
- data/spec/lib/refinery/blog/engine_spec.rb +1 -11
- data/spec/models/refinery/blog/category_spec.rb +18 -11
- data/spec/models/refinery/blog/comment_spec.rb +4 -4
- data/spec/models/refinery/blog/post_spec.rb +97 -60
- data/spec/spec_helper.rb +20 -46
- data/spec/support/refinery_blog_test_user.rb +2 -0
- metadata +168 -95
- metadata.gz.sig +0 -0
- data/Guardfile +0 -20
- data/app/assets/images/refinery/blog/icons/cog.png +0 -0
- data/app/assets/images/refinery/blog/icons/comment.png +0 -0
- data/app/assets/images/refinery/blog/icons/comment_cross.png +0 -0
- data/app/assets/images/refinery/blog/icons/comment_tick.png +0 -0
- data/app/assets/images/refinery/blog/icons/comments.png +0 -0
- data/app/assets/images/refinery/blog/icons/down.gif +0 -0
- data/app/assets/images/refinery/blog/icons/folder.png +0 -0
- data/app/assets/images/refinery/blog/icons/folder_add.png +0 -0
- data/app/assets/images/refinery/blog/icons/folder_edit.png +0 -0
- data/app/assets/images/refinery/blog/icons/page.png +0 -0
- data/app/assets/images/refinery/blog/icons/page_add.png +0 -0
- data/app/assets/images/refinery/blog/icons/page_copy.png +0 -0
- data/app/assets/images/refinery/blog/icons/up.gif +0 -0
- data/app/assets/images/refinerycms-blog/.gitkeep +0 -0
- data/app/assets/javascripts/refinerycms-blog/.gitkeep +0 -0
- data/app/assets/stylesheets/refinerycms-blog/.gitkeep +0 -0
- data/app/models/refinery/blog/comment_mailer.rb +0 -1
- data/app/models/refinery/categorization.rb +0 -10
- data/app/sweepers/refinery/blog_sweeper.rb +0 -26
- data/lib/refinery/blog/version.rb +0 -17
- data/spec/requests/refinery/blog/admin/categories_spec.rb +0 -20
- data/spec/requests/refinery/blog/admin/menu_spec.rb +0 -13
- data/spec/requests/refinery/blog/admin/posts_spec.rb +0 -175
- data/spec/requests/refinery/blog/categories_spec.rb +0 -24
- data/spec/requests/refinery/blog/posts_spec.rb +0 -160
- data/todo.md +0 -5
data/refinerycms-blog.gemspec
CHANGED
@@ -1,30 +1,34 @@
|
|
1
|
-
# Encoding:
|
2
|
-
$:.push File.expand_path('../lib', __FILE__)
|
3
|
-
require 'refinery/blog/version'
|
4
|
-
|
5
|
-
version = Refinery::Blog::Version.to_s
|
1
|
+
# Encoding: utf-8
|
6
2
|
|
7
3
|
Gem::Specification.new do |s|
|
8
4
|
s.name = %q{refinerycms-blog}
|
9
|
-
s.version =
|
5
|
+
s.version = %q{4.0.0}
|
10
6
|
s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with Refinery CMS.}
|
11
7
|
s.summary = %q{Ruby on Rails blogging engine for Refinery CMS.}
|
12
8
|
s.email = %q{info@refinerycms.com}
|
13
9
|
s.homepage = %q{http://refinerycms.com/blog}
|
14
|
-
s.authors = ['
|
10
|
+
s.authors = ['Philip Arndt', 'Uģis Ozols', 'Joe Sak']
|
15
11
|
s.require_paths = %w(lib)
|
12
|
+
s.license = %q{MIT}
|
16
13
|
|
17
14
|
s.files = `git ls-files`.split("\n")
|
18
15
|
s.test_files = `git ls-files -- spec/*`.split("\n")
|
19
16
|
|
20
17
|
# Runtime dependencies
|
21
|
-
s.add_dependency 'refinerycms-core',
|
22
|
-
s.add_dependency 'refinerycms-settings',
|
23
|
-
s.add_dependency 'filters_spam',
|
18
|
+
s.add_dependency 'refinerycms-core', '~> 4.0'
|
19
|
+
s.add_dependency 'refinerycms-settings', '~> 4.0'
|
20
|
+
s.add_dependency 'filters_spam', '~> 0.2'
|
24
21
|
s.add_dependency 'acts-as-taggable-on'
|
25
|
-
s.add_dependency 'seo_meta',
|
26
|
-
s.add_dependency 'rails_autolink'
|
22
|
+
s.add_dependency 'seo_meta', ['>=3.0.0', '~>3.0']
|
23
|
+
s.add_dependency 'rails_autolink', '~> 1.1.3'
|
24
|
+
s.add_dependency 'friendly_id', ['< 5.3', '>= 5.1.0']
|
25
|
+
s.add_dependency 'globalize', '~> 5.1.0'
|
26
|
+
s.add_dependency 'activemodel-serializers-xml', '~> 1.0', '>= 1.0.1'
|
27
|
+
s.add_dependency 'responders', '~> 2.0'
|
28
|
+
|
27
29
|
|
28
|
-
|
29
|
-
|
30
|
-
|
30
|
+
s.cert_chain = [File.expand_path('certs/parndt.pem', __dir__)]
|
31
|
+
if $PROGRAM_NAME =~ /gem\z/ && ARGV.include?('build') && ARGV.include?(__FILE__)
|
32
|
+
s.signing_key = File.expand_path('~/.ssh/gem-private_key.pem')
|
33
|
+
end
|
34
|
+
end
|
data/script/rails
CHANGED
@@ -1,6 +1,4 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
#!/usr/bin/env ruby
|
3
|
-
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
4
2
|
|
5
3
|
ENGINE_PATH = File.expand_path('../..', __FILE__)
|
6
|
-
load File.expand_path('../../spec/dummy/
|
4
|
+
load File.expand_path('../../spec/dummy/bin/rails', __FILE__)
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
module Refinery
|
4
|
+
module Blog
|
5
|
+
module Admin
|
6
|
+
describe CommentsController, type: :controller do
|
7
|
+
refinery_login
|
8
|
+
|
9
|
+
describe "#index" do
|
10
|
+
let!(:comment) { FactoryBot.create(:blog_comment) }
|
11
|
+
|
12
|
+
it "succeeds" do
|
13
|
+
get :index
|
14
|
+
expect(response).to be_success
|
15
|
+
expect(response).to render_template(:index)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "assigns unmoderated comments" do
|
19
|
+
get :index
|
20
|
+
expect(assigns(:comments).first).to eq(comment)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "#approved" do
|
25
|
+
let!(:comment) { FactoryBot.create(:approved_comment) }
|
26
|
+
|
27
|
+
it "succeeds" do
|
28
|
+
get :approved
|
29
|
+
expect(response).to be_success
|
30
|
+
expect(response).to render_template(:index)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "assigns approved comments" do
|
34
|
+
get :approved
|
35
|
+
expect(assigns(:comments).first).to eq(comment)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "#approve" do
|
40
|
+
let!(:comment) { FactoryBot.create(:blog_comment) }
|
41
|
+
|
42
|
+
it "redirects on success" do
|
43
|
+
post :approve, params: { id: comment.id }
|
44
|
+
expect(response).to be_redirect
|
45
|
+
end
|
46
|
+
|
47
|
+
it "approves the comment" do
|
48
|
+
post :approve, params: { :id => comment.id }
|
49
|
+
expect(Refinery::Blog::Comment.approved.count).to eq(1)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe "#rejected" do
|
54
|
+
let!(:comment) { FactoryBot.create(:rejected_comment) }
|
55
|
+
|
56
|
+
it "succeeds" do
|
57
|
+
get :rejected
|
58
|
+
expect(response).to be_success
|
59
|
+
expect(response).to render_template(:index)
|
60
|
+
end
|
61
|
+
|
62
|
+
it "assigns rejected comments" do
|
63
|
+
get :rejected
|
64
|
+
expect(assigns(:comments).first).to eq(comment)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe "#reject" do
|
69
|
+
let!(:comment) { FactoryBot.create(:blog_comment) }
|
70
|
+
|
71
|
+
it "redirects on success" do
|
72
|
+
post :reject, params: { :id => comment.id }
|
73
|
+
expect(response).to be_redirect
|
74
|
+
end
|
75
|
+
|
76
|
+
it "rejects the comment" do
|
77
|
+
post :reject, params:{ :id => comment.id }
|
78
|
+
expect(Refinery::Blog::Comment.rejected.count).to eq(1)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
module Refinery
|
4
|
+
module Blog
|
5
|
+
module Admin
|
6
|
+
describe PostsController, type: :controller do
|
7
|
+
refinery_login
|
8
|
+
|
9
|
+
describe "#delete_translation" do
|
10
|
+
let!(:blog_post) { FactoryBot.create(:blog_post) }
|
11
|
+
|
12
|
+
before do
|
13
|
+
blog_post.translations.create(:locale => :fr, :title => 'Un titre francais', :body => "La baguette, c'est bon. Mangez-en.")
|
14
|
+
blog_post.translations.create(:locale => :es, :title => 'Un titulo espanol', :body => "Mi casa e su casa.")
|
15
|
+
end
|
16
|
+
|
17
|
+
it "destroys the translation" do
|
18
|
+
post :delete_translation, params: { :id => blog_post.id, :locale_to_delete => :fr }
|
19
|
+
expect(blog_post.translations.exists?(:locale => :fr)).to be_falsey
|
20
|
+
end
|
21
|
+
|
22
|
+
it "does not destroy other translations" do
|
23
|
+
post :delete_translation, params: { :id => blog_post.id, :locale_to_delete => :fr }
|
24
|
+
expect(blog_post.translations.exists?(:locale => :es)).to be_truthy
|
25
|
+
end
|
26
|
+
|
27
|
+
it "redirects on success" do
|
28
|
+
post :delete_translation, params: { :id => blog_post.id, :locale_to_delete => :fr }
|
29
|
+
expect(response).to be_redirect
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
module Refinery
|
4
|
+
module Blog
|
5
|
+
describe PostsController, type: :controller do
|
6
|
+
before do
|
7
|
+
FactoryBot.create(:blog_post, :title => "blogpost_one")
|
8
|
+
FactoryBot.create(:blog_post, :title => "blogpost_two")
|
9
|
+
FactoryBot.create(:blog_post, :title => "blogpost_three")
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should not limit rss feed" do
|
13
|
+
get :index, :format => :rss
|
14
|
+
expect(assigns[:posts].size).to eq(3)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should limit rss feed" do
|
18
|
+
get :index, :format => :rss, params: { :max_results => 2 }
|
19
|
+
expect(assigns[:posts].count).to eq(2)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
@@ -1,13 +1,17 @@
|
|
1
|
-
|
1
|
+
FactoryBot.define do
|
2
2
|
factory :blog_post, :class => Refinery::Blog::Post do
|
3
3
|
sequence(:title) { |n| "Top #{n} Shopping Centers in Chicago" }
|
4
4
|
body "These are the top ten shopping centers in Chicago. You're going to read a long blog post about them. Come to peace with it."
|
5
5
|
draft false
|
6
|
-
tag_list "chicago, shopping, fun times"
|
7
6
|
published_at Time.now
|
8
|
-
|
7
|
+
username "John Doe"
|
8
|
+
|
9
9
|
factory :blog_post_draft do
|
10
10
|
draft true
|
11
11
|
end
|
12
|
+
|
13
|
+
factory :blog_post_authentication_devise_refinery_user_author do
|
14
|
+
author { FactoryBot.create(:blog_test_user) }
|
15
|
+
end
|
12
16
|
end
|
13
17
|
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
module Refinery
|
5
|
+
module Blog
|
6
|
+
module Admin
|
7
|
+
describe Category, type: :feature do
|
8
|
+
refinery_login
|
9
|
+
|
10
|
+
let(:title) { "lol" }
|
11
|
+
|
12
|
+
it "can create categories" do
|
13
|
+
visit refinery.admin_root_path
|
14
|
+
|
15
|
+
within("nav#menu") { click_link "Blog" }
|
16
|
+
within("nav.multilist") { click_link "Create new category" }
|
17
|
+
|
18
|
+
fill_in "Title", :with => title
|
19
|
+
click_button "Save"
|
20
|
+
|
21
|
+
category = Refinery::Blog::Category.first
|
22
|
+
expect(category.title).to eq(title)
|
23
|
+
end
|
24
|
+
|
25
|
+
context "with translations" do
|
26
|
+
before do
|
27
|
+
allow(Refinery::I18n).to receive(:frontend_locales).and_return([:en, :ru])
|
28
|
+
blog_page = Globalize.with_locale(:en) { FactoryBot.create(:page, :link_url => "/blog", :title => "Blog") }
|
29
|
+
Globalize.with_locale(:ru) do
|
30
|
+
blog_page.title = 'блог'
|
31
|
+
blog_page.save
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "add a category with title for default locale" do
|
36
|
+
before do
|
37
|
+
Globalize.locale = :en
|
38
|
+
visit refinery.blog_admin_posts_path
|
39
|
+
click_link "Create new category"
|
40
|
+
fill_in "Title", :with => "Testing Category"
|
41
|
+
expect { click_button "Save" }.to change(Refinery::Blog::Category, :count).by(1)
|
42
|
+
@c = Refinery::Blog::Category.by_title("Testing Category")
|
43
|
+
end
|
44
|
+
|
45
|
+
it "suceeds" do
|
46
|
+
expect(page).to have_content("'#{@c.title}' was successfully added.")
|
47
|
+
expect(Refinery::Blog::Category.count).to eq(1)
|
48
|
+
end
|
49
|
+
|
50
|
+
it "shows locale for category" do
|
51
|
+
click_link "Manage"
|
52
|
+
within "#category_#{@c.id}" do
|
53
|
+
expect(page).to have_css(".locale .en")
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
it "shows up in blog page for default locale" do
|
58
|
+
visit refinery.blog_root_path
|
59
|
+
within "#categories" do
|
60
|
+
expect(page).to have_selector('li')
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
it "does not show up in blog page for secondary locale" do
|
65
|
+
visit refinery.blog_root_path(:locale => :ru)
|
66
|
+
expect(page).not_to have_selector('#categories')
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
describe "add a category with title for secondary locale" do
|
72
|
+
|
73
|
+
let(:ru_category_title) { 'категория' }
|
74
|
+
|
75
|
+
before do
|
76
|
+
visit refinery.blog_admin_posts_path
|
77
|
+
click_link "Create new category"
|
78
|
+
within "#switch_locale_picker" do
|
79
|
+
click_link "RU"
|
80
|
+
end
|
81
|
+
fill_in "Title", :with => ru_category_title
|
82
|
+
expect { click_button "Save" }.to change(Refinery::Blog::Category, :count).by(1)
|
83
|
+
@c = Refinery::Blog::Category.by_title(ru_category_title)
|
84
|
+
end
|
85
|
+
|
86
|
+
it "suceeds" do
|
87
|
+
expect(page).to have_content("'#{@c.title_translations['ru']}' was successfully added.")
|
88
|
+
expect(Refinery::Blog::Category.count).to eq(1)
|
89
|
+
end
|
90
|
+
|
91
|
+
it "shows locale for category" do
|
92
|
+
click_link "Manage"
|
93
|
+
within "#category_#{@c.id}" do
|
94
|
+
expect(page).to have_css(".locale .ru")
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
it "does not show locale for primary locale" do
|
99
|
+
click_link "Manage"
|
100
|
+
within "#category_#{@c.id}" do
|
101
|
+
expect(page).not_to have_css(".locale .en")
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
it "does not shows up in blog page for default locale" do
|
106
|
+
visit refinery.blog_root_path
|
107
|
+
expect(page).not_to have_selector('#categories')
|
108
|
+
end
|
109
|
+
|
110
|
+
it "shows up in blog page for secondary locale" do
|
111
|
+
visit refinery.blog_root_path(:locale => :ru)
|
112
|
+
within "#categories" do
|
113
|
+
expect(page).to have_selector('li')
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
@@ -3,12 +3,12 @@ require "spec_helper"
|
|
3
3
|
module Refinery
|
4
4
|
module Blog
|
5
5
|
module Admin
|
6
|
-
describe Comment do
|
7
|
-
|
6
|
+
describe Comment, type: :feature do
|
7
|
+
refinery_login
|
8
8
|
|
9
9
|
describe "#index" do
|
10
10
|
context "when has no new unapproved comments" do
|
11
|
-
before
|
11
|
+
before do
|
12
12
|
subject.class.delete_all
|
13
13
|
visit refinery.blog_admin_comments_path
|
14
14
|
end
|
@@ -16,106 +16,106 @@ module Refinery
|
|
16
16
|
it "should list no comments" do
|
17
17
|
visit refinery.blog_admin_comments_path
|
18
18
|
|
19
|
-
page.
|
19
|
+
expect(page).to have_content('There are no new comments')
|
20
20
|
end
|
21
21
|
end
|
22
22
|
context "when has new unapproved comments" do
|
23
|
-
let!(:blog_comment) {
|
24
|
-
before
|
23
|
+
let!(:blog_comment) { FactoryBot.create(:blog_comment) }
|
24
|
+
before { visit refinery.blog_admin_comments_path }
|
25
25
|
|
26
26
|
it "should list comments" do
|
27
|
-
page.
|
28
|
-
page.
|
27
|
+
expect(page).to have_content(blog_comment.body)
|
28
|
+
expect(page).to have_content(blog_comment.name)
|
29
29
|
end
|
30
30
|
|
31
31
|
it "should allow me to approve a comment" do
|
32
32
|
click_link "Approve this comment"
|
33
33
|
|
34
|
-
page.
|
34
|
+
expect(page).to have_content("has been approved")
|
35
35
|
end
|
36
36
|
|
37
37
|
it "should allow me to reject a comment" do
|
38
38
|
click_link "Reject this comment"
|
39
39
|
|
40
|
-
page.
|
40
|
+
expect(page).to have_content("has been rejected")
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
45
|
describe "#approved" do
|
46
46
|
context "when has no approved comments" do
|
47
|
-
before
|
47
|
+
before do
|
48
48
|
subject.class.delete_all
|
49
49
|
visit refinery.approved_blog_admin_comments_path
|
50
50
|
end
|
51
51
|
|
52
52
|
it "should list no comments" do
|
53
|
-
page.
|
53
|
+
expect(page).to have_content('There are no approved comments')
|
54
54
|
end
|
55
55
|
end
|
56
56
|
context "when has approved comments" do
|
57
57
|
let!(:blog_comment) do
|
58
|
-
|
58
|
+
FactoryBot.create(:blog_comment, :state => 'approved')
|
59
59
|
end
|
60
|
-
before
|
60
|
+
before { visit refinery.approved_blog_admin_comments_path }
|
61
61
|
|
62
62
|
it "should list comments" do
|
63
|
-
page.
|
64
|
-
page.
|
63
|
+
expect(page).to have_content(blog_comment.body)
|
64
|
+
expect(page).to have_content(blog_comment.name)
|
65
65
|
end
|
66
66
|
|
67
67
|
it "should allow me to reject a comment" do
|
68
68
|
click_link "Reject this comment"
|
69
69
|
|
70
|
-
page.
|
70
|
+
expect(page).to have_content("has been rejected")
|
71
71
|
end
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
75
|
describe "#rejected" do
|
76
76
|
context "when has no rejected comments" do
|
77
|
-
before
|
77
|
+
before do
|
78
78
|
subject.class.delete_all
|
79
79
|
visit refinery.rejected_blog_admin_comments_path
|
80
80
|
end
|
81
81
|
|
82
82
|
it "should list no comments" do
|
83
|
-
page.
|
83
|
+
expect(page).to have_content('There are no rejected comments')
|
84
84
|
end
|
85
85
|
end
|
86
86
|
context "when has rejected comments" do
|
87
87
|
let!(:blog_comment) do
|
88
|
-
|
88
|
+
FactoryBot.create(:blog_comment, :state => 'rejected')
|
89
89
|
end
|
90
|
-
before
|
90
|
+
before { visit refinery.rejected_blog_admin_comments_path }
|
91
91
|
|
92
92
|
it "should list comments" do
|
93
|
-
page.
|
94
|
-
page.
|
93
|
+
expect(page).to have_content(blog_comment.body)
|
94
|
+
expect(page).to have_content(blog_comment.name)
|
95
95
|
end
|
96
96
|
|
97
97
|
it "should allow me to approve a comment" do
|
98
98
|
click_link "Approve this comment"
|
99
99
|
|
100
|
-
page.
|
100
|
+
expect(page).to have_content("has been approved")
|
101
101
|
end
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
105
105
|
describe "#show" do
|
106
|
-
let!(:blog_comment) {
|
107
|
-
before
|
106
|
+
let!(:blog_comment) { FactoryBot.create(:blog_comment) }
|
107
|
+
before { visit refinery.blog_admin_comment_path(blog_comment) }
|
108
108
|
it "should display the comment" do
|
109
|
-
page.
|
110
|
-
page.
|
109
|
+
expect(page).to have_content(blog_comment.body)
|
110
|
+
expect(page).to have_content(blog_comment.name)
|
111
111
|
end
|
112
112
|
it "should allow me to approve the comment" do
|
113
113
|
click_link "Approve this comment"
|
114
114
|
|
115
|
-
page.
|
115
|
+
expect(page).to have_content("has been approved")
|
116
116
|
end
|
117
117
|
end
|
118
118
|
end
|
119
119
|
end
|
120
120
|
end
|
121
|
-
end
|
121
|
+
end
|