forked from thoughtbot/appraisal
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fixes thoughtbot#154
- Loading branch information
Showing
4 changed files
with
173 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# frozen_string_literal: true | ||
|
||
require "spec_helper" | ||
|
||
RSpec.describe "eval_gemfile" do | ||
before do | ||
build_appraisal_file | ||
build_modular_gemfile | ||
build_rakefile | ||
build_gemspec | ||
end | ||
|
||
it "supports eval_gemfile syntax" do | ||
write_file "Gemfile", <<-GEMFILE | ||
source "https://rubygems.org" | ||
gem 'appraisal', :path => #{PROJECT_ROOT.inspect} | ||
gemspec | ||
GEMFILE | ||
|
||
run "bundle install --local" | ||
run "appraisal install" | ||
output = run "appraisal rake version" | ||
|
||
expect(output).to include "Loaded 1.1.0" | ||
end | ||
|
||
def build_modular_gemfile | ||
Dir.mkdir("tmp/stage/gemfiles") rescue nil | ||
|
||
write_file File.join("gemfiles", "im_with_dummy"), <<-GEMFILE | ||
# No source needed because this is a modular gemfile intended to be loaded into another gemfile, | ||
# which will define source. | ||
gem 'dummy' | ||
GEMFILE | ||
end | ||
|
||
def build_appraisal_file | ||
super <<-APPRAISALS | ||
appraise 'stock' do | ||
gem 'rake' | ||
eval_gemfile "im_with_dummy" | ||
end | ||
APPRAISALS | ||
end | ||
|
||
def build_rakefile | ||
write_file "Rakefile", <<-RAKEFILE | ||
require 'rubygems' | ||
require 'bundler/setup' | ||
require 'appraisal' | ||
task :version do | ||
require 'dummy' | ||
puts "Loaded \#{$dummy_version}" | ||
end | ||
RAKEFILE | ||
end | ||
|
||
def build_gemspec(path = ".") | ||
Dir.mkdir("tmp/stage/#{path}") rescue nil | ||
|
||
write_file File.join(path, "gemspec_project.gemspec"), <<-GEMSPEC | ||
Gem::Specification.new do |s| | ||
s.name = 'gemspec_project' | ||
s.version = '0.1' | ||
s.summary = 'Awesome Gem!' | ||
s.authors = "Appraisal" | ||
end | ||
GEMSPEC | ||
end | ||
end |