aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers
diff options
context:
space:
mode:
authorJérémy FRERE <frere.jeremy@gmail.com>2013-10-24 12:41:20 +0200
committerPhilip Arndt <git@p.arndt.io>2015-05-14 09:52:29 +1200
commita9288cc3bd998d7c179b080f56eccd6a56f59133 (patch)
treeb4658ea330aab2f713151058b40cbbd1f2ac127a /spec/controllers
parentbb0d3b0da633053c0236bdbe5a9452ae9655fda7 (diff)
downloadrefinerycms-blog-a9288cc3bd998d7c179b080f56eccd6a56f59133.tar.gz
refinerycms-blog-a9288cc3bd998d7c179b080f56eccd6a56f59133.tar.bz2
refinerycms-blog-a9288cc3bd998d7c179b080f56eccd6a56f59133.zip
Adds a button to delete the displayed translation of a blog post
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/refinery/blog/admin/posts_controller_spec.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/controllers/refinery/blog/admin/posts_controller_spec.rb b/spec/controllers/refinery/blog/admin/posts_controller_spec.rb
new file mode 100644
index 0000000..d2f1074
--- /dev/null
+++ b/spec/controllers/refinery/blog/admin/posts_controller_spec.rb
@@ -0,0 +1,29 @@
+require "spec_helper"
+
+module Refinery
+ module Blog
+ module Admin
+ describe PostsController, :focus do
+ refinery_login_with :refinery_user
+
+ describe "#delete_translation" do
+ let!(:blog_post) { FactoryGirl.create(:blog_post) }
+
+ before do
+ blog_post.translations.create(:locale => :fr, :title => 'Un titre francais', :body => "La baguette, c'est bon. Mangez-en.")
+ end
+
+ 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
+ end
+
+ it "redirects on success" do
+ post :delete_translation, :id => blog_post.id, :locale_to_delete => :fr
+ response.should be_redirect
+ end
+ end
+ end
+ end
+ end
+end