Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use locally built dummy gems so we don't need to download gems during…

… tests
  • Loading branch information...
commit f5da0baa301dabb525d9f38bd99f6e5ac053c71c 1 parent 96ac443
@jferris jferris authored
View
9 features/appraisals.feature
@@ -7,14 +7,17 @@ Feature: run a rake task through several appraisals
| name | version |
| dummy_girl | 1.3.0 |
| dummy_girl | 1.3.2 |
+ | dummy_rake | 0.8.7 |
+ | dummy_rake | 0.9.0 |
+ | dummy_sass | 3.1.0 |
When I cd to "projecto"
And I write to "Gemfile" with:
"""
source "http://rubygems.org"
- gem "rake"
+ gem "dummy_rake", "0.8.7"
gem "dummy_girl"
group :assets do
- gem 'sass-rails', " ~> 3.1.0"
+ gem 'dummy_sass', " ~> 3.1.0"
end
"""
When I add "appraisal" from this project as a dependency
@@ -25,7 +28,7 @@ Feature: run a rake task through several appraisals
end
appraise "1.3.0" do
gem "dummy_girl", "1.3.0"
- gem "rake", "0.9.0"
+ gem "dummy_rake", "0.9.0"
end
"""
When I write to "Rakefile" with:
View
27 features/step_definitions/dependency_steps.rb
@@ -2,3 +2,30 @@
append_to_file('Gemfile', %{\ngem "#{gem_name}", :path => "#{PROJECT_ROOT}"})
end
+Given /^the following installed dummy gems:$/ do |table|
+ table.hashes.each do |hash|
+ name = hash["name"]
+ version = hash["version"]
+ create_dir(name)
+ cd(name)
+ create_dir("lib")
+ gem_path = "#{name}.gemspec"
+ version_path = "lib/#{name}.rb"
+ spec = <<-SPEC
+ Gem::Specification.new do |s|
+ s.name = '#{name}'
+ s.version = '#{version}'
+ s.authors = 'Mr. Smith'
+ s.summary = 'summary'
+ s.files = '#{version_path}'
+ end
+ SPEC
+ write_file(gem_path, spec)
+ write_file(version_path, "$#{name}_version = '#{version}'")
+ run_simple("gem build #{gem_path}")
+ set_env("GEM_HOME", TMP_GEM_ROOT)
+ run_simple("gem install #{name}-#{version}.gem")
+ FileUtils.rm_rf(File.join(current_dir, name))
+ dirs.pop
+ end
+end
View
7 features/support/env.rb
@@ -1,4 +1,11 @@
require 'aruba/cucumber'
PROJECT_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..')).freeze
+TMP_GEM_ROOT = File.join(PROJECT_ROOT, "tmp", "gems")
+Before do
+ FileUtils.rm_rf(TMP_GEM_ROOT)
+ FileUtils.mkdir_p(TMP_GEM_ROOT)
+end
+
+ENV["GEM_PATH"] = [TMP_GEM_ROOT, ENV["GEM_PATH"]].join(":")
Please sign in to comment.
Something went wrong with that request. Please try again.