Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixes for command line specs.

  • Loading branch information...
commit dda5d7fe88cc70c92c32f06cfeb8b82a4d3672a4 1 parent 8dbfb3b
@brixen brixen authored
View
6 command_line/dash_d_spec.rb
@@ -1,7 +1,11 @@
require File.expand_path('../../spec_helper', __FILE__)
describe "The -d command line option" do
+ before :each do
+ @script = fixture __FILE__, "debug.rb"
+ end
+
it "sets $DEBUG to true" do
- ruby_exe("fixtures/debug.rb", :options => "-d", :dir => File.dirname(__FILE__)).chomp.should == "true"
+ ruby_exe(@script, :options => "-d").chomp.should == "true"
end
end
View
8 command_line/dash_r_spec.rb
@@ -1,7 +1,13 @@
require File.expand_path('../../spec_helper', __FILE__)
describe "The -r command line option" do
+ before :each do
+ @script = fixture __FILE__, "require.rb"
+ @test_file = fixture __FILE__, "test_file"
+ end
+
it "requires the specified file" do
- ruby_exe("fixtures/require.rb", :options => "-r ./fixtures/test_file", :dir => File.dirname(__FILE__)).chomp.should include("fixtures/test_file.rb")
+ result = ruby_exe(@script, :options => "-r #{@test_file}")
+ result.should include(@test_file + ".rb")
end
end
View
6 command_line/dash_upper_i_spec.rb
@@ -1,7 +1,11 @@
require File.expand_path('../../spec_helper', __FILE__)
describe "The -I command line option" do
+ before :each do
+ @script = fixture __FILE__, "loadpath.rb"
+ end
+
it "adds the path to the load path ($:)" do
- ruby_exe("fixtures/loadpath.rb", :options => "-I fixtures", :dir => File.dirname(__FILE__)).chomp.should include("fixtures")
+ ruby_exe(@script, :options => "-I fixtures").should include("fixtures")
end
end
View
10 command_line/dash_upper_w_spec.rb
@@ -2,15 +2,19 @@
require File.expand_path('../shared/verbose', __FILE__)
describe "The -W command line option" do
+ before :each do
+ @script = fixture __FILE__, "verbose.rb"
+ end
+
it "with 0 sets $VERBOSE to nil" do
- ruby_exe("fixtures/verbose.rb", :options => "-W0", :dir => File.dirname(__FILE__)).chomp.should == "nil"
+ ruby_exe(@script, :options => "-W0").chomp.should == "nil"
end
it "with 1 sets $VERBOSE to false" do
- ruby_exe("fixtures/verbose.rb", :options => "-W1", :dir => File.dirname(__FILE__)).chomp.should == "false"
+ ruby_exe(@script, :options => "-W1").chomp.should == "false"
end
end
describe "The -W command line option with 2" do
- it_behaves_like "sets $VERBOSE to true", "-W2"
+ it_behaves_like :command_line_verbose, "-W2"
end
View
2  command_line/dash_v_spec.rb
@@ -2,5 +2,5 @@
require File.expand_path('../shared/verbose', __FILE__)
describe "The -v command line option" do
- it_behaves_like "sets $VERBOSE to true", "-v"
+ it_behaves_like :command_line_verbose, "-v"
end
View
2  command_line/dash_w_spec.rb
@@ -2,5 +2,5 @@
require File.expand_path('../shared/verbose', __FILE__)
describe "The -w command line option" do
- it_behaves_like "sets $VERBOSE to true", "-w"
+ it_behaves_like :command_line_verbose, "-w"
end
View
8 command_line/shared/verbose.rb
@@ -1,5 +1,9 @@
-describe "sets $VERBOSE to true", :shared => true do
+describe :command_line_verbose, :shared => true do
+ before :each do
+ @script = fixture __FILE__, "verbose.rb"
+ end
+
it "sets $VERBOSE to true" do
- ruby_exe("fixtures/verbose.rb", :options => @method, :dir => "#{File.dirname(__FILE__)}/..").chomp.match(/true$/).should_not == nil
+ ruby_exe(@script, :options => @method).chomp.split.last.should == "true"
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.