Skip to content

Commit

Permalink
Revert use of context blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
jc00ke committed Jan 10, 2012
1 parent 68895f3 commit ec1ac91
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions spec/helpers/ruby_exe_spec.rb
Expand Up @@ -194,22 +194,20 @@ class RubyExeSpecs
@script.ruby_exe nil, :env => { :ABC => "xyz" }
end

context "when an exception is raised" do
it "deletes the :env entries in ENV" do
ENV.should_receive(:delete).with("XYZ")
@script.ruby_exe nil, :env => { :XYZ => "xyz" }
end

it "resets the values of existing ENV keys" do
ENV["ABC"] = "123"
ENV.should_receive(:[]=).with("ABC", "xyz")
ENV.should_receive(:[]=).with("ABC", "123")

@script.should_receive(:`).and_raise(Exception)
lambda do
@script.ruby_exe nil, :env => { :ABC => "xyz" }
end.should raise_error(Exception)
end
it "deletes the :env entries in ENV when an exception is raised" do
ENV.should_receive(:delete).with("XYZ")
@script.ruby_exe nil, :env => { :XYZ => "xyz" }
end

it "resets the values of existing ENV keys when an exception is raised" do
ENV["ABC"] = "123"
ENV.should_receive(:[]=).with("ABC", "xyz")
ENV.should_receive(:[]=).with("ABC", "123")

@script.should_receive(:`).and_raise(Exception)
lambda do
@script.ruby_exe nil, :env => { :ABC => "xyz" }
end.should raise_error(Exception)
end

end
Expand Down

0 comments on commit ec1ac91

Please sign in to comment.