Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix rspec dependency #451

Merged
merged 3 commits into from

4 participants

@justincampbell

We require 'rspec/mocks/standalone' in Berkshelf::Mocks, but Berkshelf does not have a dependency on RSpec.

@justincampbell

Alternatively we could just rescue LoadError

@sethvargo
Owner

Can we use something prefixed with BERKSHELF to avoid conflicts and be more explicit?

@justincampbell

I think it's pretty conventional to set RUBY_ENV to test when testing. We could do BERKSHELF_ENV but I don't see the difference, unless someone was testing Berkshelf from another project (in which case I still think RUBY_ENV is fine).

But like I said, maybe rescuing from a LoadError is simpler.

@reset
Owner

@justincampbell RUBY_ENV is pretty standard. I like this more than the LoadError.

:+1:

@sethvargo
Owner

Can we add a note to the spec_helper saying something like:

# We set this flag to load additional test materials during cucumber runs since aruba runs in a subprocess
@ivey
Owner

Can we merge this?

@reset reset merged commit b616f5f into master
@reset reset deleted the fix-rspec-dependency branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
2  features/support/env.rb
@@ -1,3 +1,5 @@
+ENV['RUBY_ENV'] == 'test'
+
require 'rubygems'
require 'bundler'
require 'spork'
View
2  lib/berkshelf.rb
@@ -15,7 +15,7 @@
require 'berkshelf/core_ext'
require 'berkshelf/errors'
-require 'berkshelf/test'
+require 'berkshelf/test' if ENV['RUBY_ENV'] == 'test'
require 'berkshelf/version'
require 'thor/monkies'
View
4 spec/spec_helper.rb
@@ -1,3 +1,7 @@
+# We set this variable to load additional test materials during cucumber
+# runs, since aruba runs in a subprocess. See lib/berkshelf/test.rb
+ENV['RUBY_ENV'] ||= 'test'
+
require 'rubygems'
require 'bundler'
require 'spork'
Something went wrong with that request. Please try again.