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

Rails env support #68

Merged
merged 2 commits into from
Jun 8, 2012
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
2 changes: 1 addition & 1 deletion lib/guard/jasmine/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def spec(*paths)
runner[:phantomjs_bin] = options.bin || CLI.which('phantomjs')
runner[:timeout] = options.timeout
runner[:port] = options.port
runner[:server_env] = options.server_env
runner[:server_env] = ENV['RAILS_ENV'] || options.server_env
runner[:spec_dir] = options.spec_dir
runner[:console] = [:always, :never, :failure].include?(options.console.to_sym) ? options.console.to_sym : :failure
runner[:errors] = [:always, :never, :failure].include?(options.errors.to_sym) ? options.errors.to_sym : :failure
Expand Down
7 changes: 4 additions & 3 deletions spec/guard/jasmine/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,11 @@
end

it 'respects the RAILS_ENV environment variable' do
ENV['RAILS_ENV'] = "test"
runner.should_receive(:run).with(anything(), hash_including(:server_env => 'test')).and_return [true, []]
old_env = ENV['RAILS_ENV']
ENV['RAILS_ENV'] = "some_arbitrary_environment"
runner.should_receive(:run).with(anything(), hash_including(:server_env => 'some_arbitrary_environment')).and_return [true, []]
cli.start(['spec'])
ENV['RAILS_ENV'] = nil
ENV['RAILS_ENV'] = old_env
end

context 'for a valid console option' do
Expand Down