diff options
author | Philip Arndt <git@p.arndt.io> | 2015-05-14 10:24:35 +1200 |
---|---|---|
committer | Philip Arndt <git@p.arndt.io> | 2015-05-14 10:24:35 +1200 |
commit | 4efb627e5b140c4e1dee252b12c1fea31b9a42aa (patch) | |
tree | 5eddb76c74573d93de0ae920b5a5dceb58137c21 | |
parent | c84fc93f9fc36b324fc6b5dc8af26d6942b45478 (diff) | |
download | refinerycms-blog-4efb627e5b140c4e1dee252b12c1fea31b9a42aa.tar.gz refinerycms-blog-4efb627e5b140c4e1dee252b12c1fea31b9a42aa.tar.bz2 refinerycms-blog-4efb627e5b140c4e1dee252b12c1fea31b9a42aa.zip |
Tidied up implementation of delete_translation and specs
-rw-r--r-- | app/controllers/refinery/blog/admin/posts_controller.rb | 2 | ||||
-rw-r--r-- | spec/controllers/refinery/blog/admin/posts_controller_spec.rb | 10 | ||||
-rw-r--r-- | spec/features/refinery/blog/admin/posts_spec.rb | 6 |
3 files changed, 9 insertions, 9 deletions
diff --git a/app/controllers/refinery/blog/admin/posts_controller.rb b/app/controllers/refinery/blog/admin/posts_controller.rb index 04690fe..61ac433 100644 --- a/app/controllers/refinery/blog/admin/posts_controller.rb +++ b/app/controllers/refinery/blog/admin/posts_controller.rb @@ -93,7 +93,7 @@ module Refinery protected def find_post - @post = Refinery::Blog::Post.find(params[:id]) + @post = Refinery::Blog::Post.friendly.find(params[:id]) end def find_all_categories diff --git a/spec/controllers/refinery/blog/admin/posts_controller_spec.rb b/spec/controllers/refinery/blog/admin/posts_controller_spec.rb index 03ae7ec..3ff04b4 100644 --- a/spec/controllers/refinery/blog/admin/posts_controller_spec.rb +++ b/spec/controllers/refinery/blog/admin/posts_controller_spec.rb @@ -3,8 +3,8 @@ require "spec_helper" module Refinery module Blog module Admin - describe PostsController do - refinery_login_with :refinery_user + describe PostsController, type: :controller do + refinery_login_with [:refinery, :superuser] describe "#delete_translation" do let!(:blog_post) { FactoryGirl.create(:blog_post) } @@ -16,17 +16,17 @@ module Refinery it "destroys the translation" do post :delete_translation, :id => blog_post.id, :locale_to_delete => :fr - blog_post.translations.exists?(:locale => :fr).should be_false + expect(blog_post.translations.exists?(:locale => :fr)).to be_falsey end it "does not destroy other translations" do post :delete_translation, :id => blog_post.id, :locale_to_delete => :fr - blog_post.translations.exists?(:locale => :es).should be_true + expect(blog_post.translations.exists?(:locale => :es)).to be_truthy end it "redirects on success" do post :delete_translation, :id => blog_post.id, :locale_to_delete => :fr - response.should be_redirect + expect(response).to be_redirect end end end diff --git a/spec/features/refinery/blog/admin/posts_spec.rb b/spec/features/refinery/blog/admin/posts_spec.rb index ba03cb5..2c7b82c 100644 --- a/spec/features/refinery/blog/admin/posts_spec.rb +++ b/spec/features/refinery/blog/admin/posts_spec.rb @@ -333,13 +333,13 @@ module Refinery describe "delete the post translation in secondary locale" do it "succeeds" do within "#post_#{blog_post.id}" do - click_link("Ru") + click_link("RU") end click_link "Remove this translation" - page.should_not have_content(blog_post.title) - page.should have_content("The translation was successfully removed.") + expect(page).not_to have_content(blog_post.title) + expect(page).to have_content("The translation was successfully removed.") end end end |