Skip to content

Commit

Permalink
JASMINE_PORT env var is removed; set server_port on Jasmine config
Browse files Browse the repository at this point in the history
fixes #200
  • Loading branch information
nathanstitt committed Jun 19, 2018
1 parent e2cfb22 commit ad67836
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/guard/jasmine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ def initialize(options = {})

self.last_run_failed = false
self.last_failed_paths = []
::Jasmine.configure do |config|
config.server_port = options[:port] if options[:port]
end
@runner = Runner.new(options.merge(run_all_options))
end

Expand Down
2 changes: 1 addition & 1 deletion lib/guard/jasmine/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def start_unicorn_server(port, options)
#
def start_rake_server(port, task, options)
Compat::UI.info "Guard::Jasmine starts Jasmine Gem test server on port #{port}."
execute(options, ['rake', task, "JASMINE_PORT=#{port}"])
execute(options, ['rake', task])
end

# Builds a child process with the given command and arguments
Expand Down
8 changes: 8 additions & 0 deletions spec/guard/jasmine_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@
expect(guard.options[:port]).to eql 9999
end

it 'port can be set' do
mock_config = OpenStruct.new
expect(::Jasmine).to receive(:configure).and_yield mock_config
guard = Guard::Jasmine.new(port: 12345)
expect(guard.options[:port]).to eql 12345
expect(mock_config.server_port).to eql 12345
end

it 'sets a default :rackup_config option' do
expect(guard.options[:rackup_config]).to eql nil
end
Expand Down

0 comments on commit ad67836

Please sign in to comment.