Skip to content
Browse files

Reset content_path and layout after running specs

  • Loading branch information...
1 parent e4b1ce9 commit d4ba056415bb57f34d1ee8596e8cdd25b6508c33 @mhoran mhoran committed Feb 23, 2012
Showing with 16 additions and 0 deletions.
  1. +10 −0 spec/controllers/pages_controller_spec.rb
  2. +6 −0 spec/routing/routes_spec.rb
View
10 spec/controllers/pages_controller_spec.rb
@@ -43,9 +43,14 @@
context "using custom layout" do
before(:all) do
+ @original_layout = HighVoltage::layout
HighVoltage::layout = "alternate"
end
+ after(:all) do
+ HighVoltage::layout = @original_layout
+ end
+
describe "on GET to /pages/exists" do
before { get :show, :id => "exists" }
@@ -58,9 +63,14 @@
context "using custom content path" do
before(:all) do
+ @original_content_path = HighVoltage::content_path
HighVoltage::content_path = "other_pages/"
end
+ after(:all) do
+ HighVoltage::content_path = @original_content_path
+ end
+
describe "on GET to /other_pages/also_exists" do
before { get :show, :id => 'also_exists' }
View
6 spec/routing/routes_spec.rb
@@ -30,10 +30,16 @@
context "using a custom content_path" do
before(:all) do
+ @original_content_path = HighVoltage::content_path
HighVoltage::content_path = "other_pages/"
Rails.application.reload_routes!
end
+ after(:all) do
+ HighVoltage::content_path = @original_content_path
+ Rails.application.reload_routes!
+ end
+
it "should generate normal resource route with id" do
page_path(:id => "one").should == "/other_pages/one"
end

0 comments on commit d4ba056

Please sign in to comment.
Something went wrong with that request. Please try again.