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

Clean up linting and fix environment nesting #698

Merged
merged 3 commits into from
Jan 4, 2020
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
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ Aruba's Rakefile provides the following linting tasks
bundle exec rake lint # Run all linters
bundle exec rake lint:coding_guidelines # Lint our code with "rubocop"
bundle exec rake lint:licenses # Check for relevant licenses in project
bundle exec rake lint:travis # Lint our .travis.yml
```

### Building and installing your local Aruba version
Expand Down
10 changes: 2 additions & 8 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Bundler.setup
task default: %w(spec cucumber cucumber:wip lint)

desc 'Run all linters.'
task lint: %w(lint:travis lint:coding_guidelines lint:licenses)
task lint: %w(lint:coding_guidelines lint:licenses)

desc 'Run the whole test suite.'
task test: %w(spec cucumber cucumber:wip)
Expand All @@ -31,15 +31,9 @@ end
RSpec::Core::RakeTask.new

namespace :lint do
desc 'Lint our .travis.yml'
task :travis do
puts 'Linting .travis.yml ...'
sh 'travis lint'
end

desc 'Lint our code with "rubocop"'
task :coding_guidelines do
sh 'bundle exec rubocop --fail-level E'
sh 'bundle exec rubocop'
end

desc 'Check for relevant licenses in project'
Expand Down
1 change: 0 additions & 1 deletion aruba.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ to make testing commandline applications meaningful, easy and fun.'
spec.add_development_dependency 'rubocop', '~> 0.78.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.5'
spec.add_development_dependency 'simplecov', '~> 0.17.1'
spec.add_development_dependency 'travis', '~> 1.8'
spec.add_development_dependency 'yard-junk', '~> 0.0.7'

spec.rubygems_version = '>= 1.6.1'
Expand Down
8 changes: 4 additions & 4 deletions lib/aruba/platforms/unix_environment_variables.rb
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,11 @@ def clear
value
end

def nest(&block)
old_actions = actions
block.call(self)
def nest
old_actions = @actions.dup
yield(self)
ensure
actions = old_actions
@actions = old_actions
end

def self.hash_from_env
Expand Down
11 changes: 11 additions & 0 deletions spec/aruba/api/core_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,17 @@
expect(ENV[variable]).to eq '2'
end

it 'forgets passed argument when called again' do
variable = 'THIS_IS_A_ENV_VAR'

@aruba.with_environment variable => 2 do
end

@aruba.with_environment do
expect(ENV[variable]).to be_nil
end
end

it 'keeps values not set in argument' do
variable = 'THIS_IS_A_ENV_VAR'
ENV[variable] = '2'
Expand Down