Skip to content

Commit

Permalink
Allow specs to run when the code is not checked out through git.
Browse files Browse the repository at this point in the history
The presence of `git` commands in my gemspec prevents bundler from being usable for `gem test vcr`.  This fixes the issue.
  • Loading branch information
myronmarston committed Feb 28, 2011
1 parent 26294b9 commit beb9ea0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
13 changes: 9 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
require 'bundler'
require 'bundler/setup'
Bundler::GemHelper.install_tasks
using_git = File.exist?(File.expand_path('../.git/', __FILE__))

if using_git
require 'bundler'
require 'bundler/setup'
Bundler::GemHelper.install_tasks
end

require 'rake'
require "rspec/core/rake_task"

RSpec::Core::RakeTask.new(:spec) do |t|
t.verbose = false
t.rspec_opts = %w[--format progress] if ENV['FULL_BUILD']
t.skip_bundler = true unless using_git
t.rspec_opts = %w[--format progress] if (ENV['FULL_BUILD'] || !using_git)
end

desc "Run all examples using rcov"
Expand Down
8 changes: 6 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
require 'rubygems'
require 'bundler'
Bundler.setup

using_git = File.exist?(File.expand_path('../../.git/', __FILE__))
if using_git
require 'bundler'
Bundler.setup
end

require 'rspec'

Expand Down

0 comments on commit beb9ea0

Please sign in to comment.