Skip to content

Commit

Permalink
Reset content_path and layout after running specs
Browse files Browse the repository at this point in the history
  • Loading branch information
mhoran committed Feb 23, 2012
1 parent e4b1ce9 commit d4ba056
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions spec/controllers/pages_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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" }

Expand All @@ -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' }

Expand Down
6 changes: 6 additions & 0 deletions spec/routing/routes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d4ba056

Please sign in to comment.