spec/helpers/ruby_exe_spec.rb in mspec-1.7.0 vs spec/helpers/ruby_exe_spec.rb in mspec-1.8.0
- old
+ new
@@ -104,29 +104,29 @@
after :all do
$VERBOSE = @verbose
end
it "returns the value returned by #ruby_exe_options if it exists and is executable" do
- PlatformGuard.stub!(:windows?).and_return(false)
+ PlatformGuard.stub(:windows?).and_return(false)
@script.should_receive(:ruby_exe_options).and_return(@name)
File.should_receive(:exist?).with(@name).and_return(true)
File.should_receive(:executable?).with(@name).and_return(true)
File.should_receive(:expand_path).with(@name).and_return(@name)
@script.resolve_ruby_exe.should == @name
end
it "returns the value returned by #ruby_exe_options if it exists on Windows platforms" do
- PlatformGuard.stub!(:windows?).and_return(true)
+ PlatformGuard.stub(:windows?).and_return(true)
@script.should_receive(:ruby_exe_options).and_return(@name)
File.should_receive(:exist?).with(@name).and_return(true)
File.should_not_receive(:executable?)
File.should_receive(:expand_path).with(@name).and_return(@name)
@script.resolve_ruby_exe.should == @name
end
it "expands the path portion of the result of #ruby_exe_options" do
- PlatformGuard.stub!(:windows?).and_return(false)
+ PlatformGuard.stub(:windows?).and_return(false)
@script.should_receive(:ruby_exe_options).and_return("#{@name} -Xfoo")
File.should_receive(:exist?).with(@name).and_return(true)
File.should_receive(:executable?).with(@name).and_return(true)
File.should_receive(:expand_path).with(@name).and_return("/usr/bin/#{@name}")
@script.resolve_ruby_exe.should == "/usr/bin/#{@name} -Xfoo"
@@ -170,15 +170,10 @@
File.should_receive(:exist?).with(@file).and_return(true)
@script.ruby_cmd(@file, :options => "-w -Cdir", :args => "< file.txt").should ==
"ruby_spec_exe -w -Q -w -Cdir some/ruby/file.rb < file.txt"
end
- it "returns a command that runs code using -e" do
- File.should_receive(:exist?).with(@code).and_return(false)
- @script.ruby_cmd(@code).should == %(ruby_spec_exe -w -Q -e "some \\"real\\" 'ruby' code")
- end
-
it "includes the given options and arguments with -e" do
File.should_receive(:exist?).with(@code).and_return(false)
@script.ruby_cmd(@code, :options => "-W0 -Cdir", :args => "< file.txt").should ==
%(ruby_spec_exe -w -Q -W0 -Cdir -e "some \\"real\\" 'ruby' code" < file.txt)
end
@@ -193,11 +188,11 @@
before :all do
@script = RubyExeSpecs.new
end
before :each do
- @script.stub!(:`)
+ @script.stub(:`)
end
it "executes (using `) the result of calling #ruby_cmd with the given arguments" do
code = "code"
options = {}
@@ -214,9 +209,10 @@
end
describe "with :env option" do
it "preserves the values of existing ENV keys" do
ENV["ABC"] = "123"
+ ENV.stub(:[])
ENV.should_receive(:[]).with("RUBY_FLAGS")
ENV.should_receive(:[]).with("ABC")
@script.ruby_exe nil, :env => { :ABC => "xyz" }
end