From b45dd1fd6d92a69728f9ee127e54157d13e2beb5 Mon Sep 17 00:00:00 2001 From: Andy Shipman Date: Mon, 17 Dec 2012 10:36:23 +0000 Subject: [PATCH] Add Puma to the list of rack-compatible servers --- CHANGELOG.md | 2 ++ README.md | 6 +++--- lib/guard/jasmine/server.rb | 2 +- spec/guard/jasmine/server_spec.rb | 21 +++++++++++++++++++++ 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee8a586..cb2dc95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog +- Add Puma as a rack-compatible server + ## 1.10.1 - November 19, 2012 - [Issue #90](https://github.com/netzpirat/guard-jasmine/issues/90): Fix wrong port in the default Jasmine url. diff --git a/README.md b/README.md index 51d5e52..80c5f3b 100644 --- a/README.md +++ b/README.md @@ -342,7 +342,7 @@ The server options configures the server environment that is needed to run Guard ```ruby :server => :jasmine_gem # Jasmine server to use, either :auto, :none, - # :webrick, :mongrel, :thin, :unicorn, :jasmine_gem + # :webrick, :mongrel, :thin, :unicorn, :jasmine_gem, :puma # default: :auto :server_env => :test # Jasmine server Rails environment to set, @@ -361,7 +361,7 @@ The server options configures the server environment that is needed to run Guard :timeout => 20 # The time in seconds to wait for the spec runner to finish. # default: 10 -:rackup_config => 'spec/dummy/config.ru' # Path to rackup config file (i.e. for webrick, mongrel, thin, unicorn). +:rackup_config => 'spec/dummy/config.ru' # Path to rackup config file (i.e. for webrick, mongrel, thin, unicorn, puma). # default: ./config.ru # This option is useful when using guard-jasmine in a mountable engine # and the config.ru is within the dummy app @@ -537,7 +537,7 @@ Usage: guard-jasmine spec Options: - -s, [--server=SERVER] # Server to start, either `auto`, `webrick`, `mongrel`, `thin`, + -s, [--server=SERVER] # Server to start, either `auto`, `webrick`, `mongrel`, `thin`, `puma` # `unicorn`, `jasmine_gem` or `none` # Default: auto -p, [--port=N] # Server port to use diff --git a/lib/guard/jasmine/server.rb b/lib/guard/jasmine/server.rb index 8414809..c6697b0 100644 --- a/lib/guard/jasmine/server.rb +++ b/lib/guard/jasmine/server.rb @@ -32,7 +32,7 @@ def start(options) timeout = options[:server_timeout] case server - when :webrick, :mongrel, :thin + when :webrick, :mongrel, :thin, :puma start_rack_server(server, port, options) when :unicorn start_unicorn_server(port, options) diff --git a/spec/guard/jasmine/server_spec.rb b/spec/guard/jasmine/server_spec.rb index aee5cbb..b5dddef 100644 --- a/spec/guard/jasmine/server_spec.rb +++ b/spec/guard/jasmine/server_spec.rb @@ -163,6 +163,27 @@ end end + context 'with the :puma strategy' do + let(:options) do + defaults.merge({ :server => :puma }) + end + + it 'does not auto detect a server' do + server.should_not_receive(:detect_server) + server.start(options) + end + + it 'does wait for the server' do + server.should_receive(:wait_for_server) + server.start(options) + end + + it 'starts a :puma rack server' do + server.should_receive(:start_rack_server).with(:puma, 8888, options) + server.start(options) + end + end + context 'with the :mongrel strategy' do let(:options) do defaults.merge({ :server => :mongrel })