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

Adds global spec_mode? method #102

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

colinta
Copy link
Member

@colinta colinta commented Jun 26, 2013

To make it easy to add spec-only bundles.

if spec_mode?
  Bundler.require :spec
end

Motion::Project::App.setup do |app|
  # ...

@mattgreen
Copy link

+1 to this

@kristianfreeman
Copy link
Contributor

👍

@lrz
Copy link
Member

lrz commented Aug 7, 2013

I'm not super comfortable with adding a new method to the main object.

Shouldn't the following work already?

Motion::Project::App.setup do |app|
  if app.spec_mode
    Bundler.require :spec
  end
end

@MarkVillacampa
Copy link
Member

Any alternative way to require test-only gems? I'm doing this hacky thing:

if ARGV.join(' ') =~ /spec/
  Bundler.require :default, :spec
else
  Bundler.require
end

@colinta
Copy link
Member Author

colinta commented Dec 30, 2013

The app.spec_mode code works, my only qualm is that it doesn't feel like the right place to put Bundle.require; I would expect to see/put the require code at the top of the Rakefile.

@MarkVillacampa
Copy link
Member

I'm using app.spec_mode for config stuff like adding some fixtures to resources_dirs only when running tests:

  if app.spec_mode
    app.resources_dirs += ['spec/fixtures']
  end

But I'm not sure how some gems that tinker with the RM toolchain would behave if require is called within the config block :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants