ensure correct environment
This commit is contained in:
parent
a31ffc3bed
commit
35929838f7
@ -17,13 +17,22 @@ class Guard::Hydra < Guard::Guard
|
|||||||
:show_runner_log => true,
|
:show_runner_log => true,
|
||||||
:hydra_config => 'config/hydra.yml',
|
:hydra_config => 'config/hydra.yml',
|
||||||
:test_matchers => [ :rspec ],
|
:test_matchers => [ :rspec ],
|
||||||
:all_on_start => false
|
:all_on_start => false,
|
||||||
|
:env => 'test'
|
||||||
}.merge(@options)
|
}.merge(@options)
|
||||||
end
|
end
|
||||||
|
|
||||||
def start
|
def start
|
||||||
super
|
super
|
||||||
Guard::UI.info "Guard::Hydra is waiting to run tests..."
|
Guard::UI.info "Guard::Hydra is waiting to run tests..."
|
||||||
|
|
||||||
|
begin
|
||||||
|
ENV['RAILS_ENV'] = @options[:env]
|
||||||
|
require rails_application
|
||||||
|
rescue LoadError
|
||||||
|
Guard::UI.info "Not a Rails app, using default environment settings"
|
||||||
|
end
|
||||||
|
|
||||||
run_all if @options[:all_on_start]
|
run_all if @options[:all_on_start]
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -47,7 +56,7 @@ class Guard::Hydra < Guard::Guard
|
|||||||
hydra = Hydra::Master.new(
|
hydra = Hydra::Master.new(
|
||||||
:listeners => [ Hydra::Listener::ProgressBar.new ],
|
:listeners => [ Hydra::Listener::ProgressBar.new ],
|
||||||
:files => files.uniq,
|
:files => files.uniq,
|
||||||
:environment => 'test',
|
:environment => @options[:env],
|
||||||
:config => @options[:hydra_config]
|
:config => @options[:hydra_config]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user