Skip to content

Commit f285f84

Browse files
committed
Make it possible to run all tests again locally
1 parent 147494e commit f285f84

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

Rakefile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
require "rspec/core/rake_task"
22
require "bundler/gem_tasks"
33

4+
require_relative "support/current_bundle"
5+
46
RSpec::Core::RakeTask.new(:spec)
57

6-
task default: :spec
8+
task :default do
9+
if SuperDiff::CurrentBundle.instance.appraisal_in_use?
10+
sh "rake spec"
11+
elsif ENV["CI"]
12+
exec "appraisal install && appraisal rake --trace"
13+
else
14+
appraisal = SuperDiff::CurrentBundle.instance.latest_appraisal
15+
exec "appraisal install && appraisal #{appraisal.name} rake --trace"
16+
end
17+
end

support/current_bundle.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ def assert_appraisal!
2727
end
2828
end
2929

30+
def appraisal_in_use?
31+
!current_appraisal.nil?
32+
end
33+
3034
def current_appraisal
3135
if path
3236
available_appraisals.find do |appraisal|
@@ -43,10 +47,6 @@ def latest_appraisal
4347

4448
private
4549

46-
def appraisal_in_use?
47-
!current_appraisal.nil?
48-
end
49-
5050
def path
5151
Bundler.default_gemfile
5252
end

0 commit comments

Comments
 (0)