Skip to content

Commit

Permalink
Don't do anything with bundler at all - bundler does it for us!
Browse files Browse the repository at this point in the history
See #454 for more info.

- #454
  • Loading branch information
dchelimsky committed Oct 9, 2011
1 parent 708a4f1 commit c3c572a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 53 deletions.
8 changes: 1 addition & 7 deletions lib/rspec/core/rake_task.rb
Expand Up @@ -30,7 +30,7 @@ class RakeTask < ::Rake::TaskLib
# default: # default:
# false # false
def skip_bundler=(*) def skip_bundler=(*)
RSpec.deprecate("RSpec::Core::RakeTask#skip_bundler=", 'ENV["BUNDLE_GEMFILE"]') RSpec.deprecate("RSpec::Core::RakeTask#skip_bundler=")
end end


# Deprecated and has no effect. The rake task now checks # Deprecated and has no effect. The rake task now checks
Expand Down Expand Up @@ -165,7 +165,6 @@ def files_to_run # :nodoc:
def spec_command def spec_command
@spec_command ||= begin @spec_command ||= begin
cmd_parts = [] cmd_parts = []
cmd_parts << "bundle exec" if bundler?
cmd_parts << RUBY cmd_parts << RUBY
cmd_parts << ruby_opts cmd_parts << ruby_opts
cmd_parts << "-w" if warning? cmd_parts << "-w" if warning?
Expand Down Expand Up @@ -197,11 +196,6 @@ def warning?
def blank def blank
lambda {|s| s == ""} lambda {|s| s == ""}
end end

def bundler?
ENV["BUNDLE_GEMFILE"] if ENV["BUNDLE_GEMFILE"] unless ENV["BUNDLE_GEMFILE"] == ""
end

end end
end end
end end
48 changes: 2 additions & 46 deletions spec/rspec/core/rake_task_spec.rb
Expand Up @@ -10,22 +10,6 @@ def ruby
FileUtils::RUBY FileUtils::RUBY
end end


def with_bundle_gemfile(val)
begin
orig = ENV['BUNDLE_GEMFILE']
ENV['BUNDLE_GEMFILE'] = val
yield
ensure
ENV['BUNDLE_GEMFILE'] = orig
end
end

def without_bundler
with_bundle_gemfile nil do
yield
end
end

def with_rcov def with_rcov
task.rcov = true task.rcov = true
yield yield
Expand All @@ -35,52 +19,24 @@ def spec_command
task.__send__(:spec_command) task.__send__(:spec_command)
end end


context "default (BUNDLE_GEMFILE nil)" do context "default" do
it "renders rspec" do
with_bundle_gemfile nil do
spec_command.should =~ /^#{ruby} -S rspec/
end
end
end

context "default (BUNDLE_GEMFILE '')" do
it "renders rspec" do it "renders rspec" do
with_bundle_gemfile '' do spec_command.should =~ /^#{ruby} -S rspec/
spec_command.should =~ /^#{ruby} -S rspec/
end
end
end

context "with bundler (BUNDLE_GEMFILE non-blank)" do
it "renders bundle exec rspec" do
spec_command.should match(/bundle exec/)
end end
end end


context "with rcov" do context "with rcov" do
it "renders rcov" do it "renders rcov" do
without_bundler do
with_rcov do with_rcov do
spec_command.should =~ /^#{ruby} -S rcov/ spec_command.should =~ /^#{ruby} -S rcov/
end end
end end
end

context "with bundler" do
it "renders bundle exec rcov" do
with_rcov do
spec_command.should =~ /^bundle exec #{ruby} -S rcov/
end
end
end
end end


context "with ruby options" do context "with ruby options" do
it "renders them before -S" do it "renders them before -S" do
without_bundler do
task.ruby_opts = "-w" task.ruby_opts = "-w"
spec_command.should =~ /^#{ruby} -w -S rspec/ spec_command.should =~ /^#{ruby} -w -S rspec/
end
end end
end end


Expand Down

0 comments on commit c3c572a

Please sign in to comment.