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.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +9 -23
  3. data/Gemfile +15 -7
  4. data/Rakefile +0 -1
  5. data/app/assets/javascripts/refinery/blog/backend.js +18 -59
  6. data/app/assets/stylesheets/refinery/blog/backend.css.scss +4 -55
  7. data/app/assets/stylesheets/refinery/blog/frontend.css.scss +2 -2
  8. data/app/controllers/refinery/blog/admin/categories_controller.rb +6 -0
  9. data/app/controllers/refinery/blog/admin/posts_controller.rb +25 -3
  10. data/app/controllers/refinery/blog/blog_controller.rb +31 -5
  11. data/app/controllers/refinery/blog/categories_controller.rb +10 -3
  12. data/app/controllers/refinery/blog/posts_controller.rb +16 -6
  13. data/app/helpers/refinery/blog/controller_helper.rb +1 -22
  14. data/app/models/refinery/blog/categorization.rb +0 -1
  15. data/app/models/refinery/blog/category.rb +3 -6
  16. data/app/models/refinery/blog/comment.rb +15 -17
  17. data/app/models/refinery/blog/post.rb +44 -43
  18. data/app/views/refinery/blog/admin/_submenu.html.erb +1 -3
  19. data/app/views/refinery/blog/admin/categories/_category.html.erb +14 -5
  20. data/app/views/refinery/blog/admin/posts/_form.html.erb +13 -6
  21. data/app/views/refinery/blog/admin/posts/_form_part.html.erb +1 -1
  22. data/app/views/refinery/blog/admin/posts/_post.html.erb +12 -5
  23. data/app/views/refinery/blog/admin/posts/_teaser_part.html.erb +1 -1
  24. data/app/views/refinery/blog/posts/index.html.erb +2 -2
  25. data/app/views/refinery/blog/shared/_categories.html.erb +3 -3
  26. data/app/views/refinery/shared/admin/_autocomplete.html.erb +45 -0
  27. data/bin/rails +5 -0
  28. data/bin/refinerycms +62 -0
  29. data/changelog.md +4 -1
  30. data/config/locales/cs.yml +2 -2
  31. data/config/locales/en.yml +3 -0
  32. data/config/locales/fr.yml +6 -4
  33. data/config/locales/nb.yml +154 -14
  34. data/config/locales/nl.yml +21 -0
  35. data/config/locales/pl.yml +2 -2
  36. data/config/locales/ru.yml +25 -14
  37. data/config/locales/zh-CN.yml +32 -1
  38. data/config/locales/zh-TW.yml +160 -0
  39. data/config/routes.rb +6 -3
  40. data/db/migrate/20110803223522_create_blog_structure.rb +4 -4
  41. data/db/migrate/20120531113632_delete_cached_slugs.rb +2 -2
  42. data/db/migrate/20140622132537_add_missing_unique_indices.acts_as_taggable_on_engine.rb +20 -0
  43. data/db/migrate/20140622132538_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +15 -0
  44. data/db/seeds.rb +4 -4
  45. data/lib/refinery/blog.rb +1 -1
  46. data/lib/refinery/blog/configuration.rb +1 -1
  47. data/lib/refinery/blog/engine.rb +8 -3
  48. data/readme.md +21 -6
  49. data/refinerycms-blog.gemspec +9 -7
  50. data/script/rails +1 -3
  51. data/spec/controllers/refinery/blog/admin/comments_controller_spec.rb +23 -19
  52. data/spec/controllers/refinery/blog/admin/posts_controller_spec.rb +35 -0
  53. data/spec/controllers/refinery/blog/posts_controller_spec.rb +3 -3
  54. data/spec/factories/blog_posts.rb +1 -1
  55. data/spec/factories/user.rb +27 -0
  56. data/spec/features/refinery/blog/admin/categories_spec.rb +106 -104
  57. data/spec/features/refinery/blog/admin/comments_spec.rb +18 -18
  58. data/spec/features/refinery/blog/admin/menu_spec.rb +14 -8
  59. data/spec/features/refinery/blog/admin/posts_spec.rb +99 -86
  60. data/spec/features/refinery/blog/categories_spec.rb +20 -18
  61. data/spec/features/refinery/blog/posts_spec.rb +128 -124
  62. data/spec/helpers/refinery/blog/posts_helper_spec.rb +13 -13
  63. data/spec/lib/refinery/blog/engine_spec.rb +1 -11
  64. data/spec/models/refinery/blog/category_spec.rb +10 -10
  65. data/spec/models/refinery/blog/comment_spec.rb +3 -3
  66. data/spec/models/refinery/blog/post_spec.rb +59 -33
  67. data/spec/spec_helper.rb +2 -3
  68. metadata +75 -50
  69. data/app/assets/images/refinery/blog/icons/add.png +0 -0
  70. data/app/assets/images/refinery/blog/icons/cog.png +0 -0
  71. data/app/assets/images/refinery/blog/icons/comment.png +0 -0
  72. data/app/assets/images/refinery/blog/icons/comment_cross.png +0 -0
  73. data/app/assets/images/refinery/blog/icons/comment_tick.png +0 -0
  74. data/app/assets/images/refinery/blog/icons/comments.png +0 -0
  75. data/app/assets/images/refinery/blog/icons/down.gif +0 -0
  76. data/app/assets/images/refinery/blog/icons/folder.png +0 -0
  77. data/app/assets/images/refinery/blog/icons/folder_add.png +0 -0
  78. data/app/assets/images/refinery/blog/icons/folder_edit.png +0 -0
  79. data/app/assets/images/refinery/blog/icons/page.png +0 -0
  80. data/app/assets/images/refinery/blog/icons/page_add.png +0 -0
  81. data/app/assets/images/refinery/blog/icons/page_copy.png +0 -0
  82. data/app/assets/images/refinery/blog/icons/up.gif +0 -0
  83. data/spec/helpers/refinery/blog/controller_helper_spec.rb +0 -27
  84. 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
- refinery_login_with :refinery_user
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.should have_content('There are no new comments')
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.should have_content(blog_comment.body)
28
- page.should have_content(blog_comment.name)
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.should have_content("has been approved")
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.should have_content("has been rejected")
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.should have_content('There are no approved comments')
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.should have_content(blog_comment.body)
64
- page.should have_content(blog_comment.name)
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.should have_content("has been rejected")
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.should have_content('There are no rejected comments')
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.should have_content(blog_comment.body)
94
- page.should have_content(blog_comment.name)
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.should have_content("has been approved")
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.should have_content(blog_comment.body)
110
- page.should have_content(blog_comment.name)
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.should have_content("has been approved")
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
- describe "Blog menu entry" do
4
- refinery_login_with :refinery_user
5
-
6
- it "is highlighted when managing the blog" do
7
- visit refinery.admin_root_path
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
- within("#menu") { click_link "Blog" }
9
+ it "is highlighted when managing the blog" do
10
+ visit refinery.admin_root_path
10
11
 
11
- page.should have_css("a.active", :text => "Blog")
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
- refinery_login_with :refinery_user
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.should have_content("There are no Blog Posts yet. Click \"Create new post\" to add your first blog post.")
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.should have_content("Tags")
32
+ expect(page).to have_content("Tags")
33
33
  end
34
34
 
35
- it "should have category title", :js => true do
36
- click_link "toggle_advanced_options"
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", :js => true do
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
- # this is a dirty hack but textarea that needs to be filled is
44
- # hidden and capybara refuses to fill in elements it can't see
45
- page.evaluate_script("WYMeditor.INSTANCES[0].html('<p>And I love it</p>')")
46
- click_link "toggle_advanced_options"
47
- check blog_category.title
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
- it "should succeed" do
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.should eq(1)
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.should eq(::Refinery::User.last)
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.should eq(1)
65
- subject.class.last.categories.first.title.should eq(blog_category.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", :js => true do
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
- # this is a dirty hack but textarea that needs to be filled is
74
- # hidden and capybara refuses to fill in elements it can't see
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.should have_content("was successfully added.")
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.should eq(1)
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.should eq(@tag_list.split(', ').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.should have_content(blog_post.title)
104
+ expect(page).to have_content(blog_post.title)
106
105
 
107
106
  click_link("Edit this blog post")
108
- current_path.should == refinery.edit_blog_admin_post_path(blog_post)
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.should_not have_content(blog_post.title)
114
- page.should have_content("'hax0r' was successfully updated.")
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.should have_content(blog_post.title)
119
+ expect(page).to have_content(blog_post.title)
121
120
 
122
121
  click_link "Remove this blog post forever"
123
122
 
124
- page.should have_content("'#{blog_post.title}' was successfully removed.")
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.should == refinery.blog_post_path(blog_post)
133
- page.should have_content(blog_post.title)
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.should have_content(blog_post.title)
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.should_not have_content(blog_post.title)
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(:refinery_user, :username => "Other Guy") }
156
+ let!(:other_guy) { FactoryGirl.create(:authentication_devise_refinery_user, :username => "Other Guy") }
158
157
 
159
- describe "create blog post with alternate author", :js => true do
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
- # this is a dpage_titleirty hack but textarea that needs to be filled is
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
- end
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.should eq(other_guy)
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.stub(:frontend_locales).and_return([:en, :ru])
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.find_by_title("Post")
197
+ @p = Refinery::Blog::Post.by_title("Post")
205
198
  end
206
199
 
207
200
  it "succeeds" do
208
- page.should have_content("'Post' was successfully added.")
209
- Refinery::Blog::Post.count.should eq(1)
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 flag for post" do
205
+ it "shows locale for post" do
213
206
 
214
207
  within "#post_#{@p.id}" do
215
- page.should have_css("img[src='/assets/refinery/icons/flags/en.png']")
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.blog_root_path
221
- page.should have_selector("#post_#{@p.id}")
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 up in blog page for secondary locale" do
225
- visit refinery.blog_root_path(:locale => :ru)
226
- page.should_not have_selector("#post_#{@p.id}")
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 "Ru"
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.find_by_title("Новости")
243
+ @p = Refinery::Blog::Post.by_title(ru_page_title)
244
244
  end
245
245
 
246
246
  it "succeeds" do
247
- page.should have_content("was successfully added.")
248
- Refinery::Blog::Post.count.should eq(1)
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.should have_content(ru_page_title)
253
+ expect(page).to have_content(ru_page_title)
254
254
  end
255
255
  end
256
256
 
257
- it "shows locale flag for post" do
257
+ it "shows locale for post" do
258
258
  within "#post_#{@p.id}" do
259
- page.should have_css("img[src='/assets/refinery/icons/flags/ru.png']")
259
+ expect(page).to have_css(".locale .ru")
260
260
  end
261
261
  end
262
262
 
263
- it "does not show locale flag for primary locale" do
263
+ it "does not show locale for primary locale" do
264
264
  within "#post_#{@p.id}" do
265
- page.should_not have_css("img[src='/assets/refinery/icons/flags/en.png']")
265
+ expect(page).not_to have_css(".locale .en")
266
266
  end
267
267
  end
268
268
 
269
- it "does not show up in blog page for default locale" do
270
- visit refinery.blog_root_path
271
- page.should_not have_selector("#post_#{@p.id}")
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.blog_root_path(:locale => :ru)
276
- page.should have_selector("#post_#{@p.id}")
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 locale flags for post" do
297
+ it "shows both locales for post" do
297
298
  within "#post_#{blog_post.id}" do
298
- page.should have_css("img[src='/assets/refinery/icons/flags/en.png']")
299
- page.should have_css("img[src='/assets/refinery/icons/flags/ru.png']")
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("En")
308
+ click_link("EN")
308
309
  end
309
- current_path.should == refinery.edit_blog_admin_post_path(blog_post)
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.should_not have_content(blog_post.title)
314
- page.should have_content("'New Post Title' was successfully updated.")
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("Ru")
322
+ click_link("RU")
322
323
  end
323
324
 
324
325
  fill_in "Title", :with => "Нов"
325
326
  click_button "Save"
326
327
 
327
- page.should_not have_content(blog_post.title)
328
- page.should have_content("'Нов' was successfully updated.")
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