Skip to content

Adds global spec_mode? method#102

Open
colinta wants to merge 1 commit into
HipByte:masterfrom
colinta:spec_mode
Open

Adds global spec_mode? method#102
colinta wants to merge 1 commit into
HipByte:masterfrom
colinta:spec_mode

Conversation

@colinta

@colinta colinta commented Jun 26, 2013

Copy link
Copy Markdown
Member

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
Copy Markdown

+1 to this

@kristianfreeman

Copy link
Copy Markdown
Contributor

👍

@lrz

lrz commented Aug 7, 2013

Copy link
Copy Markdown
Member

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
Copy Markdown
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

colinta commented Dec 30, 2013

Copy link
Copy Markdown
Member Author

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
Copy Markdown
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

Development

Successfully merging this pull request may close these issues.

5 participants