Skip to content

Commit

Permalink
remove -O option from generated test command in autotest/rspec2
Browse files Browse the repository at this point in the history
  • Loading branch information
dchelimsky committed Mar 18, 2010
1 parent 80bd5ea commit bb574fe
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 24 deletions.
5 changes: 1 addition & 4 deletions lib/autotest/rspec2.rb
Expand Up @@ -38,7 +38,7 @@ def consolidate_failures(failed)


def make_test_cmd(files_to_test) def make_test_cmd(files_to_test)
files_to_test.empty? ? '' : files_to_test.empty? ? '' :
"#{ruby} #{SPEC_PROGRAM} #{normalize(files_to_test).keys.flatten.join(' ')} #{add_options_if_present}" "#{ruby} #{SPEC_PROGRAM} #{normalize(files_to_test).keys.flatten.join(' ')}"
end end


def normalize(files_to_test) def normalize(files_to_test)
Expand All @@ -48,7 +48,4 @@ def normalize(files_to_test)
end end
end end


def add_options_if_present # :nodoc:
File.exist?("spec/spec.opts") ? "-O #{File.join('spec','spec.opts')} " : ""
end
end end
2 changes: 1 addition & 1 deletion rspec-core.gemspec
Expand Up @@ -9,7 +9,7 @@ Gem::Specification.new do |s|


s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version= s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
s.authors = ["Chad Humphries", "David Chelimsky"] s.authors = ["Chad Humphries", "David Chelimsky"]
s.date = %q{2010-03-15} s.date = %q{2010-03-17}
s.description = %q{Rspec runner and example group classes} s.description = %q{Rspec runner and example group classes}
s.email = %q{dchelimsky@gmail.com;chad.humphries@gmail.com} s.email = %q{dchelimsky@gmail.com;chad.humphries@gmail.com}
s.executables = ["rspec", "spec"] s.executables = ["rspec", "spec"]
Expand Down
20 changes: 1 addition & 19 deletions spec/autotest/rspec_spec.rb
@@ -1,31 +1,13 @@
require "spec_helper" require "spec_helper"


describe Autotest::Rspec2 do describe Autotest::Rspec2 do
describe "adding spec.opts --options" do
before(:each) do
@rspec_autotest = Autotest::Rspec2.new
end

it "should return the command line option to add spec.opts if the options file exists" do
File.stub!(:exist?).and_return true
@rspec_autotest.add_options_if_present.should == "-O spec/spec.opts "
end

it "should return an empty string if no spec.opts exists" do
File.stub!(:exist?).and_return false
Autotest::Rspec2.new.add_options_if_present.should == ""
end
end

describe "commands" do describe "commands" do
before(:each) do before(:each) do
@rspec_autotest = Autotest::Rspec2.new @rspec_autotest = Autotest::Rspec2.new
@rspec_autotest.stub!(:ruby).and_return "ruby" @rspec_autotest.stub!(:ruby).and_return "ruby"
@rspec_autotest.stub!(:add_options_if_present).and_return "-O spec/spec.opts"


@ruby = @rspec_autotest.ruby @ruby = @rspec_autotest.ruby
@spec_cmd = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'bin', 'rspec')) @spec_cmd = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'bin', 'rspec'))
@options = @rspec_autotest.add_options_if_present
files = %w[file_one file_two] files = %w[file_one file_two]
@files_to_test = { @files_to_test = {
files[0] => [], files[0] => [],
Expand All @@ -38,7 +20,7 @@


it "should make the appropriate test command" do it "should make the appropriate test command" do
actual = @rspec_autotest.make_test_cmd(@files_to_test) actual = @rspec_autotest.make_test_cmd(@files_to_test)
expected = /#{@ruby} #{@spec_cmd} (.*) #{@options}/ expected = /#{@ruby} #{@spec_cmd} (.*)/


actual.should match(expected) actual.should match(expected)


Expand Down

0 comments on commit bb574fe

Please sign in to comment.