aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/refinery/blog/admin/posts_controller_spec.rb29
-rw-r--r--spec/features/refinery/blog/admin/posts_spec.rb12
2 files changed, 41 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
diff --git a/spec/features/refinery/blog/admin/posts_spec.rb b/spec/features/refinery/blog/admin/posts_spec.rb
index c139b0d..8507f63 100644
--- a/spec/features/refinery/blog/admin/posts_spec.rb
+++ b/spec/features/refinery/blog/admin/posts_spec.rb
@@ -330,6 +330,18 @@ module Refinery
end
end
+ describe "delete the post translation in secondary locale", :focus do
+ it "succeeds" do
+ within "#post_#{blog_post.id}" do
+ 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.")
+ end
+ end
end
end