refinerycms-blog 2.1.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +9 -23
- data/Gemfile +15 -7
- data/Rakefile +0 -1
- data/app/assets/javascripts/refinery/blog/backend.js +18 -59
- data/app/assets/stylesheets/refinery/blog/backend.css.scss +4 -55
- data/app/assets/stylesheets/refinery/blog/frontend.css.scss +2 -2
- data/app/controllers/refinery/blog/admin/categories_controller.rb +6 -0
- data/app/controllers/refinery/blog/admin/posts_controller.rb +25 -3
- 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 +16 -6
- data/app/helpers/refinery/blog/controller_helper.rb +1 -22
- data/app/models/refinery/blog/categorization.rb +0 -1
- data/app/models/refinery/blog/category.rb +3 -6
- data/app/models/refinery/blog/comment.rb +15 -17
- data/app/models/refinery/blog/post.rb +44 -43
- data/app/views/refinery/blog/admin/_submenu.html.erb +1 -3
- data/app/views/refinery/blog/admin/categories/_category.html.erb +14 -5
- data/app/views/refinery/blog/admin/posts/_form.html.erb +13 -6
- data/app/views/refinery/blog/admin/posts/_form_part.html.erb +1 -1
- data/app/views/refinery/blog/admin/posts/_post.html.erb +12 -5
- data/app/views/refinery/blog/admin/posts/_teaser_part.html.erb +1 -1
- data/app/views/refinery/blog/posts/index.html.erb +2 -2
- data/app/views/refinery/blog/shared/_categories.html.erb +3 -3
- data/app/views/refinery/shared/admin/_autocomplete.html.erb +45 -0
- data/bin/rails +5 -0
- data/bin/refinerycms +62 -0
- data/changelog.md +4 -1
- data/config/locales/cs.yml +2 -2
- data/config/locales/en.yml +3 -0
- data/config/locales/fr.yml +6 -4
- data/config/locales/nb.yml +154 -14
- data/config/locales/nl.yml +21 -0
- data/config/locales/pl.yml +2 -2
- data/config/locales/ru.yml +25 -14
- data/config/locales/zh-CN.yml +32 -1
- data/config/locales/zh-TW.yml +160 -0
- data/config/routes.rb +6 -3
- data/db/migrate/20110803223522_create_blog_structure.rb +4 -4
- data/db/migrate/20120531113632_delete_cached_slugs.rb +2 -2
- 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/seeds.rb +4 -4
- data/lib/refinery/blog.rb +1 -1
- data/lib/refinery/blog/configuration.rb +1 -1
- data/lib/refinery/blog/engine.rb +8 -3
- data/readme.md +21 -6
- data/refinerycms-blog.gemspec +9 -7
- data/script/rails +1 -3
- data/spec/controllers/refinery/blog/admin/comments_controller_spec.rb +23 -19
- data/spec/controllers/refinery/blog/admin/posts_controller_spec.rb +35 -0
- data/spec/controllers/refinery/blog/posts_controller_spec.rb +3 -3
- data/spec/factories/blog_posts.rb +1 -1
- data/spec/factories/user.rb +27 -0
- data/spec/features/refinery/blog/admin/categories_spec.rb +106 -104
- data/spec/features/refinery/blog/admin/comments_spec.rb +18 -18
- data/spec/features/refinery/blog/admin/menu_spec.rb +14 -8
- data/spec/features/refinery/blog/admin/posts_spec.rb +99 -86
- data/spec/features/refinery/blog/categories_spec.rb +20 -18
- data/spec/features/refinery/blog/posts_spec.rb +128 -124
- data/spec/helpers/refinery/blog/posts_helper_spec.rb +13 -13
- data/spec/lib/refinery/blog/engine_spec.rb +1 -11
- data/spec/models/refinery/blog/category_spec.rb +10 -10
- data/spec/models/refinery/blog/comment_spec.rb +3 -3
- data/spec/models/refinery/blog/post_spec.rb +59 -33
- data/spec/spec_helper.rb +2 -3
- metadata +75 -50
- data/app/assets/images/refinery/blog/icons/add.png +0 -0
- 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/spec/helpers/refinery/blog/controller_helper_spec.rb +0 -27
- data/todo.md +0 -5
@@ -3,8 +3,8 @@ 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_with_devise :authentication_devise_refinery_superuser
|
8
8
|
|
9
9
|
describe "#index" do
|
10
10
|
context "when has no new unapproved comments" do
|
@@ -16,7 +16,7 @@ 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
|
@@ -24,20 +24,20 @@ module Refinery
|
|
24
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
|
@@ -50,7 +50,7 @@ module Refinery
|
|
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
|
@@ -60,14 +60,14 @@ module Refinery
|
|
60
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
|
@@ -80,7 +80,7 @@ module Refinery
|
|
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
|
@@ -90,14 +90,14 @@ module Refinery
|
|
90
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
|
@@ -106,13 +106,13 @@ module Refinery
|
|
106
106
|
let!(:blog_comment) { FactoryGirl.create(:blog_comment) }
|
107
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
|
@@ -1,13 +1,19 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
module Refinery
|
4
|
+
module Blog
|
5
|
+
module Admin
|
6
|
+
describe Menu, type: :feature do
|
7
|
+
refinery_login_with_devise :authentication_devise_refinery_superuser
|
8
8
|
|
9
|
-
|
9
|
+
it "is highlighted when managing the blog" do
|
10
|
+
visit refinery.admin_root_path
|
10
11
|
|
11
|
-
|
12
|
+
within("#menu") { click_link "Blog" }
|
13
|
+
|
14
|
+
expect(page).to have_css("a.active", :text => "Blog")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
12
18
|
end
|
13
|
-
end
|
19
|
+
end
|
@@ -4,8 +4,8 @@ require "spec_helper"
|
|
4
4
|
module Refinery
|
5
5
|
module Blog
|
6
6
|
module Admin
|
7
|
-
describe Post do
|
8
|
-
|
7
|
+
describe Post, type: :feature do
|
8
|
+
refinery_login_with_devise :authentication_devise_refinery_superuser
|
9
9
|
|
10
10
|
let!(:blog_category) do
|
11
11
|
Globalize.with_locale(:en) { FactoryGirl.create(:blog_category) }
|
@@ -18,7 +18,7 @@ module Refinery
|
|
18
18
|
before { visit refinery.blog_admin_posts_path }
|
19
19
|
|
20
20
|
it "invites to create new post" do
|
21
|
-
page.
|
21
|
+
expect(page).to have_content("There are no Blog Posts yet. Click \"Create new post\" to add your first blog post.")
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -29,64 +29,63 @@ module Refinery
|
|
29
29
|
end
|
30
30
|
|
31
31
|
it "should have Tags" do
|
32
|
-
page.
|
32
|
+
expect(page).to have_content("Tags")
|
33
33
|
end
|
34
34
|
|
35
|
-
it "should have category title"
|
36
|
-
|
37
|
-
page.should have_content(blog_category.title)
|
35
|
+
it "should have category title" do
|
36
|
+
expect(page).to have_content(blog_category.title)
|
38
37
|
end
|
39
38
|
|
40
|
-
describe "create blog post"
|
39
|
+
describe "create blog post" do
|
41
40
|
before do
|
41
|
+
expect(subject.class.count).to eq(0)
|
42
42
|
fill_in "post_title", :with => "This is my blog post"
|
43
|
-
|
44
|
-
|
45
|
-
page.
|
46
|
-
|
47
|
-
check
|
43
|
+
fill_in "post_body", with: "<p>And I love it</p>"
|
44
|
+
|
45
|
+
expect(page).to have_css '.blog_categories'
|
46
|
+
expect(page).to have_css "#post_category_ids_#{blog_category.id}"
|
47
|
+
expect { check(blog_category.title) }.to change {
|
48
|
+
!!page.find("#post_category_ids_#{blog_category.id}").checked?
|
49
|
+
}.from(false).to(true)
|
50
|
+
|
48
51
|
click_button "Save"
|
49
|
-
end
|
50
52
|
|
51
|
-
|
52
|
-
page.should have_content("was successfully added.")
|
53
|
+
expect(page).to have_content("was successfully added.")
|
53
54
|
end
|
54
55
|
|
55
56
|
it "should be the only blog post" do
|
56
|
-
subject.class.count.
|
57
|
+
expect(subject.class.count).to eq(1)
|
57
58
|
end
|
58
59
|
|
59
60
|
it "should belong to me" do
|
60
|
-
subject.class.first.author.
|
61
|
+
expect(subject.class.first.author).to eq(::Refinery::Blog.user_class.last)
|
61
62
|
end
|
62
63
|
|
63
64
|
it "should save categories" do
|
64
|
-
subject.class.last.categories.count.
|
65
|
-
subject.class.last.categories.first.title.
|
65
|
+
expect(subject.class.last.categories.count).to eq(1)
|
66
|
+
expect(subject.class.last.categories.first.title).to eq(blog_category.title)
|
66
67
|
end
|
67
68
|
end
|
68
69
|
|
69
|
-
describe "create blog post with tags"
|
70
|
+
describe "create blog post with tags" do
|
71
|
+
let(:tag_list) { "chicago, bikes, beers, babes" }
|
70
72
|
before do
|
71
|
-
@tag_list = "chicago, bikes, beers, babes"
|
72
73
|
fill_in "Title", :with => "This is a tagged blog post"
|
73
|
-
|
74
|
-
|
75
|
-
page.evaluate_script("WYMeditor.INSTANCES[0].html('<p>And I also love it</p>')")
|
76
|
-
fill_in "Tags", :with => @tag_list
|
74
|
+
fill_in "post_body", with: "<p>And I also love it</p>"
|
75
|
+
fill_in "Tags", :with => tag_list
|
77
76
|
click_button "Save"
|
78
77
|
end
|
79
78
|
|
80
79
|
it "should succeed" do
|
81
|
-
page.
|
80
|
+
expect(page).to have_content("was successfully added.")
|
82
81
|
end
|
83
82
|
|
84
83
|
it "should be the only blog post" do
|
85
|
-
subject.class.count.
|
84
|
+
expect(subject.class.count).to eq(1)
|
86
85
|
end
|
87
86
|
|
88
87
|
it "should have the specified tags" do
|
89
|
-
subject.class.last.tag_list.sort.
|
88
|
+
expect(subject.class.last.tag_list.sort).to eq(tag_list.split(', ').sort)
|
90
89
|
end
|
91
90
|
end
|
92
91
|
end
|
@@ -102,26 +101,26 @@ module Refinery
|
|
102
101
|
|
103
102
|
describe "edit blog post" do
|
104
103
|
it "should succeed" do
|
105
|
-
page.
|
104
|
+
expect(page).to have_content(blog_post.title)
|
106
105
|
|
107
106
|
click_link("Edit this blog post")
|
108
|
-
current_path.
|
107
|
+
expect(current_path).to eq(refinery.edit_blog_admin_post_path(blog_post))
|
109
108
|
|
110
109
|
fill_in "post_title", :with => "hax0r"
|
111
110
|
click_button "Save"
|
112
111
|
|
113
|
-
page.
|
114
|
-
page.
|
112
|
+
expect(page).not_to have_content(blog_post.title)
|
113
|
+
expect(page).to have_content("'hax0r' was successfully updated.")
|
115
114
|
end
|
116
115
|
end
|
117
116
|
|
118
117
|
describe "deleting blog post" do
|
119
118
|
it "should succeed" do
|
120
|
-
page.
|
119
|
+
expect(page).to have_content(blog_post.title)
|
121
120
|
|
122
121
|
click_link "Remove this blog post forever"
|
123
122
|
|
124
|
-
page.
|
123
|
+
expect(page).to have_content("'#{blog_post.title}' was successfully removed.")
|
125
124
|
end
|
126
125
|
end
|
127
126
|
|
@@ -129,8 +128,8 @@ module Refinery
|
|
129
128
|
it "redirects to blog post in the frontend" do
|
130
129
|
click_link "View this blog post live"
|
131
130
|
|
132
|
-
current_path.
|
133
|
-
page.
|
131
|
+
expect(current_path).to eq(refinery.blog_post_path(blog_post))
|
132
|
+
expect(page).to have_content(blog_post.title)
|
134
133
|
end
|
135
134
|
end
|
136
135
|
end
|
@@ -138,7 +137,7 @@ module Refinery
|
|
138
137
|
context "when uncategorized post" do
|
139
138
|
it "shows up in the list" do
|
140
139
|
visit refinery.uncategorized_blog_admin_posts_path
|
141
|
-
page.
|
140
|
+
expect(page).to have_content(blog_post.title)
|
142
141
|
end
|
143
142
|
end
|
144
143
|
|
@@ -148,37 +147,31 @@ module Refinery
|
|
148
147
|
blog_post.save!
|
149
148
|
|
150
149
|
visit refinery.uncategorized_blog_admin_posts_path
|
151
|
-
page.
|
150
|
+
expect(page).not_to have_content(blog_post.title)
|
152
151
|
end
|
153
152
|
end
|
154
153
|
end
|
155
154
|
|
156
155
|
context "with multiple users" do
|
157
|
-
let!(:other_guy) { FactoryGirl.create(:
|
156
|
+
let!(:other_guy) { FactoryGirl.create(:authentication_devise_refinery_user, :username => "Other Guy") }
|
158
157
|
|
159
|
-
describe "create blog post with alternate author"
|
158
|
+
describe "create blog post with alternate author" do
|
160
159
|
before do
|
161
160
|
visit refinery.blog_admin_posts_path
|
162
161
|
click_link "Create new post"
|
163
162
|
|
164
163
|
fill_in "post_title", :with => "This is some other guy's blog post"
|
165
|
-
|
166
|
-
# hidden and capybara refuses to fill in elements it can't see
|
167
|
-
page.evaluate_script("WYMeditor.INSTANCES[0].html('<p>I totally did not write it.</p>')")
|
168
|
-
|
169
|
-
click_link "toggle_advanced_options"
|
164
|
+
fill_in "post_body", with: "<p>I totally did not write it.</p>"
|
170
165
|
|
166
|
+
expect(page).to have_content("Author")
|
171
167
|
select other_guy.username, :from => "Author"
|
172
168
|
|
173
169
|
click_button "Save"
|
174
|
-
|
175
|
-
|
176
|
-
it "should succeed" do
|
177
|
-
page.should have_content("was successfully added.")
|
170
|
+
expect(page).to have_content("was successfully added.")
|
178
171
|
end
|
179
172
|
|
180
173
|
it "belongs to another user" do
|
181
|
-
subject.class.last.author.
|
174
|
+
expect(subject.class.last.author).to eq(other_guy)
|
182
175
|
end
|
183
176
|
end
|
184
177
|
end
|
@@ -186,7 +179,7 @@ module Refinery
|
|
186
179
|
context "with translations" do
|
187
180
|
before do
|
188
181
|
Globalize.locale = :en
|
189
|
-
Refinery::I18n.
|
182
|
+
allow(Refinery::I18n).to receive(:frontend_locales).and_return([:en, :ru])
|
190
183
|
blog_page = FactoryGirl.create(:page, :link_url => "/blog", :title => "Blog")
|
191
184
|
Globalize.with_locale(:ru) do
|
192
185
|
blog_page.title = 'блог'
|
@@ -201,29 +194,36 @@ module Refinery
|
|
201
194
|
fill_in "Title", :with => "Post"
|
202
195
|
fill_in "post_body", :with => "One post in my blog"
|
203
196
|
click_button "Save"
|
204
|
-
@p = Refinery::Blog::Post.
|
197
|
+
@p = Refinery::Blog::Post.by_title("Post")
|
205
198
|
end
|
206
199
|
|
207
200
|
it "succeeds" do
|
208
|
-
page.
|
209
|
-
Refinery::Blog::Post.count.
|
201
|
+
expect(page).to have_content("'Post' was successfully added.")
|
202
|
+
expect(Refinery::Blog::Post.count).to eq(1)
|
210
203
|
end
|
211
204
|
|
212
|
-
it "shows locale
|
205
|
+
it "shows locale for post" do
|
213
206
|
|
214
207
|
within "#post_#{@p.id}" do
|
215
|
-
page.
|
208
|
+
expect(page).to have_css(".locale .en")
|
216
209
|
end
|
217
210
|
end
|
218
211
|
|
219
212
|
it "shows up in blog page for default locale" do
|
220
|
-
visit refinery.
|
221
|
-
page.
|
213
|
+
visit refinery.blog_admin_root_path
|
214
|
+
expect(page).to have_selector("#post_#{@p.id}")
|
215
|
+
end
|
216
|
+
|
217
|
+
it "does show locale for default locale" do
|
218
|
+
within "#post_#{@p.id}" do
|
219
|
+
expect(page).to have_css(".locale .en")
|
220
|
+
end
|
222
221
|
end
|
223
222
|
|
224
|
-
it "does not show
|
225
|
-
|
226
|
-
|
223
|
+
it "does not show locale for secondary locale" do
|
224
|
+
within "#post_#{@p.id}" do
|
225
|
+
expect(page).not_to have_css(".locale .ru")
|
226
|
+
end
|
227
227
|
end
|
228
228
|
|
229
229
|
end
|
@@ -235,45 +235,46 @@ module Refinery
|
|
235
235
|
before do
|
236
236
|
click_link "Create new post"
|
237
237
|
within "#switch_locale_picker" do
|
238
|
-
click_link "
|
238
|
+
click_link "RU"
|
239
239
|
end
|
240
240
|
fill_in "Title", :with => ru_page_title
|
241
241
|
fill_in "post_body", :with => "One post in my blog"
|
242
242
|
click_button "Save"
|
243
|
-
@p = Refinery::Blog::Post.
|
243
|
+
@p = Refinery::Blog::Post.by_title(ru_page_title)
|
244
244
|
end
|
245
245
|
|
246
246
|
it "succeeds" do
|
247
|
-
page.
|
248
|
-
Refinery::Blog::Post.count.
|
247
|
+
expect(page).to have_content("was successfully added.")
|
248
|
+
expect(Refinery::Blog::Post.count).to eq(1)
|
249
249
|
end
|
250
250
|
|
251
251
|
it "shows title in secondary locale" do
|
252
252
|
within "#post_#{@p.id}" do
|
253
|
-
page.
|
253
|
+
expect(page).to have_content(ru_page_title)
|
254
254
|
end
|
255
255
|
end
|
256
256
|
|
257
|
-
it "shows locale
|
257
|
+
it "shows locale for post" do
|
258
258
|
within "#post_#{@p.id}" do
|
259
|
-
page.
|
259
|
+
expect(page).to have_css(".locale .ru")
|
260
260
|
end
|
261
261
|
end
|
262
262
|
|
263
|
-
it "does not show locale
|
263
|
+
it "does not show locale for primary locale" do
|
264
264
|
within "#post_#{@p.id}" do
|
265
|
-
page.
|
265
|
+
expect(page).not_to have_css(".locale .en")
|
266
266
|
end
|
267
267
|
end
|
268
268
|
|
269
|
-
it "does
|
270
|
-
|
271
|
-
|
269
|
+
it "does show locale for secondary locale" do
|
270
|
+
within "#post_#{@p.id}" do
|
271
|
+
expect(page).to have_css(".locale .ru")
|
272
|
+
end
|
272
273
|
end
|
273
274
|
|
274
275
|
it "shows up in blog page for secondary locale" do
|
275
|
-
visit refinery.
|
276
|
-
page.
|
276
|
+
visit refinery.blog_admin_root_path(:locale => :ru)
|
277
|
+
expect(page).to have_selector("#post_#{@p.id}")
|
277
278
|
end
|
278
279
|
|
279
280
|
end
|
@@ -293,10 +294,10 @@ module Refinery
|
|
293
294
|
visit refinery.blog_admin_posts_path
|
294
295
|
end
|
295
296
|
|
296
|
-
it "shows both
|
297
|
+
it "shows both locales for post" do
|
297
298
|
within "#post_#{blog_post.id}" do
|
298
|
-
page.
|
299
|
-
page.
|
299
|
+
expect(page).to have_css(".locale .en")
|
300
|
+
expect(page).to have_css(".locale .ru")
|
300
301
|
end
|
301
302
|
end
|
302
303
|
|
@@ -304,31 +305,43 @@ module Refinery
|
|
304
305
|
it "succeeds" do
|
305
306
|
|
306
307
|
within "#post_#{blog_post.id}" do
|
307
|
-
click_link("
|
308
|
+
click_link("EN")
|
308
309
|
end
|
309
|
-
current_path.
|
310
|
+
expect(current_path).to eq(refinery.edit_blog_admin_post_path(blog_post))
|
310
311
|
fill_in "Title", :with => "New Post Title"
|
311
312
|
click_button "Save"
|
312
313
|
|
313
|
-
page.
|
314
|
-
page.
|
314
|
+
expect(page).not_to have_content(blog_post.title)
|
315
|
+
expect(page).to have_content("'New Post Title' was successfully updated.")
|
315
316
|
end
|
316
317
|
end
|
317
318
|
|
318
319
|
describe "edit the post in secondary locale" do
|
319
320
|
it "succeeds" do
|
320
321
|
within "#post_#{blog_post.id}" do
|
321
|
-
click_link("
|
322
|
+
click_link("RU")
|
322
323
|
end
|
323
324
|
|
324
325
|
fill_in "Title", :with => "Нов"
|
325
326
|
click_button "Save"
|
326
327
|
|
327
|
-
page.
|
328
|
-
page.
|
328
|
+
expect(page).not_to have_content(blog_post.title)
|
329
|
+
expect(page).to have_content("'Нов' was successfully updated.")
|
329
330
|
end
|
330
331
|
end
|
331
332
|
|
333
|
+
describe "delete the post translation in secondary locale" do
|
334
|
+
it "succeeds" do
|
335
|
+
within "#post_#{blog_post.id}" do
|
336
|
+
click_link("RU")
|
337
|
+
end
|
338
|
+
|
339
|
+
click_link "Remove this translation"
|
340
|
+
|
341
|
+
expect(page).not_to have_content(blog_post.title)
|
342
|
+
expect(page).to have_content("The translation was successfully removed.")
|
343
|
+
end
|
344
|
+
end
|
332
345
|
end
|
333
346
|
end
|
334
347
|
|