Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document and fix @disable-bundler hook #561

Merged
merged 1 commit into from
May 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions features/steps/environment/disable_bunder.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Feature: Disable Bundler environment
Use the @disable-bundler tag to escape from your project's Gemfile.

Background:
Given I use the fixture "cli-app"

Scenario: Clear the Bundler environment

Given a file named "features/run.feature" with:
"""
Feature: My Feature
@disable-bundler
Scenario: Check environment
When I run `env`
Then the output should not match /^BUNDLE_GEMFILE=/
"""
When I run `cucumber`
Then the features should all pass
2 changes: 2 additions & 0 deletions lib/aruba/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
require 'aruba/api/environment'
require 'aruba/api/filesystem'
require 'aruba/api/text'
require 'aruba/api/bundler'
require 'aruba/api/rvm'

Aruba.platform.require_matching_files('../matchers/**/*.rb', __FILE__)
Expand All @@ -27,6 +28,7 @@ module Api
include Aruba::Api::Commands
include Aruba::Api::Environment
include Aruba::Api::Filesystem
include Aruba::Api::Bundler
include Aruba::Api::Rvm
include Aruba::Api::Deprecated
include Aruba::Api::Text
Expand Down
16 changes: 16 additions & 0 deletions lib/aruba/api/bundler.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
require 'aruba/api/environment'

module Aruba
module Api
module Bundler
include Environment

# Unset variables used by bundler
def unset_bundler_env_vars
%w[RUBYOPT BUNDLE_PATH BUNDLE_BIN_PATH BUNDLE_GEMFILE].each do |key|
delete_environment_variable(key)
end
end
end
end
end
7 changes: 0 additions & 7 deletions lib/aruba/api/rvm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,6 @@ def use_clean_gemset(gemset)
raise "I didn't understand rvm's output: #{all_stdout}"
end
end

# Unset variables used by bundler
def unset_bundler_env_vars
%w[RUBYOPT BUNDLE_PATH BUNDLE_BIN_PATH BUNDLE_GEMFILE].each do |key|
set_environment_variable(key, nil)
end
end
end
end
end
15 changes: 15 additions & 0 deletions spec/aruba/api/bundler_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require 'spec_helper'
require 'aruba/api'

RSpec.describe Aruba::Api::Bundler do
include_context 'uses aruba API'

describe '#unset_bundler_env_vars' do
it "sets up Aruba's environment to clear Bundler's variables" do
@aruba.unset_bundler_env_vars

expect(@aruba.aruba.environment['BUNDLE_PATH']).to be_nil
expect(@aruba.aruba.environment['BUNDLE_GEMFILE']).to be_nil
end
end
end