File tree 5 files changed +64
-11
lines changed
features/03_testing_frameworks/cucumber
5 files changed +64
-11
lines changed Original file line number Diff line number Diff line change 1
1
Feature : Disable Bundler environment
2
2
Use the @disable-bundler tag to escape from your project's Gemfile.
3
3
4
- Background :
5
- Given I use the fixture "cli-app"
6
-
4
+ @disable-bundler
7
5
Scenario : Clear the Bundler environment
8
-
6
+ Given I use the fixture "cli-app"
9
7
Given a file named "features/run.feature" with:
10
8
"""
11
9
Feature: My Feature
12
10
@disable-bundler
13
11
Scenario: Check environment
14
12
When I run `env`
15
13
Then the output should not match /^BUNDLE_GEMFILE=/
14
+
15
+ @disable-bundler
16
+ Scenario: Run bundle in a fresh bundler environment
17
+ Given a file named "Gemfile" with:
18
+ \"\"\"
19
+ source 'https://rubygems.org'
20
+ \"\"\"
21
+ When I run `bundle`
22
+ Then the output should not contain "aruba"
23
+
24
+ @disable-bundler
25
+ Scenario: Run programs that are not in the outer bundle
26
+ Given a file named "Gemfile" with:
27
+ \"\"\"
28
+ source 'https://rubygems.org'
29
+
30
+ gem 'rubocop'
31
+ \"\"\"
32
+ When I run `bundle`
33
+ When I run `bundle exec rubocop --help`
34
+ Then the output should contain "Usage: rubocop"
16
35
"""
17
- When I run `cucumber`
36
+ When I run `bundle`
37
+ When I run `bundle exec cucumber`
18
38
Then the features should all pass
39
+
40
+ @disable-bundler
41
+ Scenario : Direct test
42
+ Given I use the fixture "cli-app"
43
+ Given a file named "Gemfile" with:
44
+ """
45
+ source 'https://rubygems.org'
46
+
47
+ gem 'parallel_tests'
48
+ """
49
+ When I successfully run `bundle`
50
+ When I successfully run `bundle exec parallel_rspec --help`
51
+ Then the output should contain "Run all tests in parallel"
Original file line number Diff line number Diff line change
1
+ source 'https://rubygems.org'
2
+
3
+ # Use dependencies from gemspec
4
+ gemspec
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
21
21
spec . executables = spec . files . grep ( %r{^exe/} ) { |f | File . basename ( f ) }
22
22
spec . require_paths = [ 'lib' ]
23
23
24
- spec . add_development_dependency 'bundler' , '~> 1.9'
25
- spec . add_development_dependency 'rake' , '~> 10.0'
24
+ spec . add_development_dependency 'bundler'
25
+ spec . add_development_dependency 'rake'
26
+ spec . add_development_dependency 'aruba'
26
27
end
Original file line number Diff line number Diff line change @@ -21,6 +21,6 @@ Gem::Specification.new do |spec|
21
21
spec . executables = spec . files . grep ( %r{^exe/} ) { |f | File . basename ( f ) }
22
22
spec . require_paths = [ 'lib' ]
23
23
24
- spec . add_development_dependency 'bundler' , '~> 1.9'
25
- spec . add_development_dependency 'rake' , '~> 10.0'
24
+ spec . add_development_dependency 'bundler'
25
+ spec . add_development_dependency 'rake'
26
26
end
Original file line number Diff line number Diff line change @@ -7,8 +7,23 @@ module Bundler
7
7
8
8
# Unset variables used by bundler
9
9
def unset_bundler_env_vars
10
- %w[ RUBYOPT BUNDLE_PATH BUNDLE_BIN_PATH BUNDLE_GEMFILE ] . each do |key |
11
- delete_environment_variable ( key )
10
+ empty_env = with_environment { with_unbundled_env { ENV . to_h } }
11
+ aruba_env = aruba . environment . to_h
12
+ ( aruba_env . keys - empty_env . keys ) . each do |key |
13
+ delete_environment_variable key
14
+ end
15
+ empty_env . each do |k , v |
16
+ set_environment_variable k , v
17
+ end
18
+ end
19
+
20
+ private
21
+
22
+ def with_unbundled_env
23
+ if ::Bundler . respond_to? ( :with_unbundled_env )
24
+ ::Bundler . with_unbundled_env { yield }
25
+ else
26
+ ::Bundler . with_clean_env { yield }
12
27
end
13
28
end
14
29
end
You can’t perform that action at this time.
0 commit comments