Browse files

Drop support for Ruby 1.8.7

  • Loading branch information...
1 parent ec1b1d9 commit a641404106a7775b51cdd53024912d3061ba5354 @netzpirat netzpirat committed Apr 5, 2013
View
5 .travis.yml
@@ -1,15 +1,12 @@
language: ruby
bundler_args: --without development
rvm:
- - 1.8.7
- 1.9.2
- 1.9.3
+ - 2.0.0
- ruby-head
- - ree
- - jruby-18mode
- jruby-19mode
- jruby-head
- - rbx-18mode
- rbx-19mode
matrix:
allow_failures:
View
1 CHANGELOG.md
@@ -2,6 +2,7 @@
## Master
+- Drop support for Ruby 1.8.7
- [#120](https://github.com/netzpirat/guard-jasmine/issues/120): Proper spec dir detection when using the Jasmine gem.
- [#120](https://github.com/netzpirat/guard-jasmine/issues/120): Proper Jasmine URL generation when server is `:auto` and using the Jasmine gem.
View
70 README.md
@@ -2,7 +2,7 @@
Guard::Jasmine automatically tests your Jasmine specs when files are modified.
-Tested on MRI Ruby 1.8.7, 1.9.2, 1.9.3, REE and the latest versions of JRuby and Rubinius.
+Tested on MRI Ruby 1.9.2, 1.9.3, REE and the latest versions of JRuby and Rubinius.
If you have any questions please join us on our [Google group](http://groups.google.com/group/guard-dev) or on `#guard`
(irc.freenode.net).
@@ -170,7 +170,7 @@ Now you can access `/jasmine-stories` when you start your Rails server normally.
accordingly:
```ruby
-guard :jasmine, :port => 8888, :jasmine_url => 'http://127.0.0.1:8888/jasmine-stories' do
+guard :jasmine, port: 8888, jasmine_url: 'http://127.0.0.1:8888/jasmine-stories' do
...
end
```
@@ -234,8 +234,8 @@ It is also possible to use CoffeeScript in this setup, by using [Guard::CoffeeSc
specs. Just add something like this *before* Guard::Jasmine:
```ruby
-guard 'coffeescript', :input => 'app/coffeescripts', :output => 'public/javascripts'
-guard 'coffeescript', :input => 'spec/coffeescripts', :output => 'spec/javascripts'
+guard 'coffeescript', input: 'app/coffeescripts', output: 'public/javascripts'
+guard 'coffeescript', input: 'spec/coffeescripts', output: 'spec/javascripts'
```
## Ruby projects
@@ -279,7 +279,7 @@ require 'jquery-rails'
class JasmineTest < Rails::Application
routes.append do
- mount Jasminerice::Engine => '/jasmine'
+ mount Jasminerice::Engine: '/jasmine'
end
config.cache_classes = true
@@ -329,7 +329,7 @@ There are many options that can customize Guard::Jasmine to your needs. Options
defining the Guard in your `Guardfile`:
```ruby
-guard 'jasmine', :all_on_start => false, :specdoc => :always do
+guard 'jasmine', all_on_start: false, specdoc: :always do
...
end
```
@@ -339,27 +339,27 @@ end
The server options configures the server environment that is needed to run Guard::Jasmine:
```ruby
-:server => :jasmine_gem # Jasmine server to use, either :auto, :none,
+server: :jasmine_gem # Jasmine server to use, either :auto, :none,
# :webrick, :mongrel, :thin, :unicorn, :jasmine_gem, :puma
# default: :auto
-:server_env => :test # Jasmine server Rails environment to set,
+server_env: :test # Jasmine server Rails environment to set,
# e.g. :development or :test
# default: RAILS_ENV is exists, otherwise :development
-:server_timeout => 30 # The number of seconds to wait for the Jasmine spec server
+server_timeout: 30 # The number of seconds to wait for the Jasmine spec server
# default: 15
-:port => 8888 # Jasmine server port to use.
+port: 8888 # Jasmine server port to use.
# default: a random, free server port
-:phantomjs_bin => '~/bin/phantomjs' # Path to phantomjs.
+phantomjs_bin: '~/bin/phantomjs' # Path to phantomjs.
# default: auto-detect 'phantomjs'
-:timeout => 20 # The time in seconds to wait for the spec runner to finish.
+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, puma).
+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
@@ -369,7 +369,7 @@ If you're setting the `:server` option to `:none` or need to access your specs o
supply the Jasmine runner url manually:
```ruby
-:jasmine_url => 'http://192.168.1.5:1234/jasmine' # URL where Jasmine is served.
+jasmine_url: 'http://192.168.1.5:1234/jasmine' # URL where Jasmine is served.
# default: nil
```
You may want to have also a fixed port instead of the random generated one.
@@ -382,7 +382,7 @@ instead of a ridiculous high line number in a single, very large JavaScript.
If you supply an unknown server name as the `:server` option, then Guard::Jasmine will execute
a `rake` task with the given server name as task in a child process. For example, if you configure
-`:server => 'start_my_server'`, then the command `rake start_my_server` will be executed and
+`server: 'start_my_server'`, then the command `rake start_my_server` will be executed and
you have to make sure the server starts on the port that you can get from the `JASMINE_PORT`
environment variable.
@@ -391,19 +391,19 @@ environment variable.
The spec runner options configures the behavior driven development (or BDD) cycle:
```ruby
-:spec_dir => 'app/spec' # Directory with the Jasmine specs.
+spec_dir: 'app/spec' # Directory with the Jasmine specs.
# default: 'spec/javascripts'
-:clean => false # Clean the spec list by only keep Jasmine specs within the project.
+clean: false # Clean the spec list by only keep Jasmine specs within the project.
# default: true
-:all_on_start => false # Run all suites on start.
+all_on_start: false # Run all suites on start.
# default: true
-:keep_failed => false # Keep failed suites and add them to the next run again.
+keep_failed: false # Keep failed suites and add them to the next run again.
# default: true
-:all_after_pass => false # Run all suites after a suite has passed again
+all_after_pass: false # Run all suites after a suite has passed again
# after failing.
# default: true
```
@@ -422,19 +422,19 @@ Guard::Jasmine can generate an RSpec like specdoc in the console after running t
be shown in the console:
```ruby
-:specdoc => :always # Specdoc output options,
+specdoc: :always # Specdoc output options,
# either :always, :never or :failure
# default: :failure
-:focus => false # Specdoc focus to hide successful specs when
+focus: false # Specdoc focus to hide successful specs when
# at least one spec fails.
# default: true
-:console => :always # Console.log output options,
+console: :always # Console.log output options,
# either :always, :never or :failure
# default: :failure
-:errors => :always # Error output options,
+errors: :always # Error output options,
# either :always, :never or :failure
# default: :failure
```
@@ -455,7 +455,7 @@ You may want to have different options when the spec runner runs all specs. You
as a Hash that contains any valid runner option and will overwrite the general options.
```ruby
-:run_all => { :specdoc => :never } # Run all options,
+run_all: { specdoc: :never } # Run all options,
# Takes any valid option
# default: {}
```
@@ -499,7 +499,7 @@ $ npm install -g istanbul
You also need to explicit enable the coverage support in the options:
```ruby
-:coverage => true # Enable/disable JavaScript coverage support
+coverage: true # Enable/disable JavaScript coverage support
# default: false
```
@@ -524,16 +524,16 @@ By default Guard::Jasmine just outputs the coverage when enable without any effe
make Guard::Jasmine fail the spec run when a given threshold is not met. You can set the following thresholds:
```ruby
-:statements_threshold => 95 # Statements coverage threshold
+statements_threshold: 95 # Statements coverage threshold
# default: 0
-:functions_threshold => 85 # Functions coverage threshold
+functions_threshold: 85 # Functions coverage threshold
# default: 0
-:branches_threshold => -10 # Branches coverage threshold
+branches_threshold: -10 # Branches coverage threshold
# default: 0
-:lines_threshold => -15 # Lines coverage threshold
+lines_threshold: -15 # Lines coverage threshold
# default: 0
```
@@ -546,10 +546,10 @@ Guard::Jasmine always shows the Istanbul text report after a spec run that conta
can also enable two more reports:
```ruby
-:coverage_html => true # Enable Istanbul HTML coverage report
+coverage_html: true # Enable Istanbul HTML coverage report
# default: false
-:coverage_summary => true # Enable Istanbul summary coverage report
+coverage_summary: true # Enable Istanbul summary coverage report
# default: false
```
@@ -568,13 +568,13 @@ name in opposite to Jasmine).
These options affects what system notifications are shown after a spec run:
```ruby
-:notifications => false # Show success and error notifications.
+notifications: false # Show success and error notifications.
# default: true
-:hide_success => true # Disable successful spec run notification.
+hide_success: true # Disable successful spec run notification.
# default: false
-:max_error_notify => 5 # Maximum error notifications to show.
+max_error_notify: 5 # Maximum error notifications to show.
# default: 3
```
View
52 lib/guard/jasmine.rb
@@ -22,32 +22,32 @@ class Jasmine < Guard
attr_accessor :last_run_failed, :last_failed_paths, :run_all_options
DEFAULT_OPTIONS = {
- :server => :auto,
- :server_env => ENV['RAILS_ENV'] || 'development',
- :server_timeout => 60,
- :port => nil,
- :rackup_config => nil,
- :jasmine_url => nil,
- :timeout => 60,
- :spec_dir => nil,
- :notification => true,
- :hide_success => false,
- :all_on_start => true,
- :keep_failed => true,
- :clean => true,
- :all_after_pass => true,
- :max_error_notify => 3,
- :specdoc => :failure,
- :console => :failure,
- :errors => :failure,
- :focus => true,
- :coverage => false,
- :coverage_html => false,
- :coverage_summary => false,
- :statements_threshold => 0,
- :functions_threshold => 0,
- :branches_threshold => 0,
- :lines_threshold => 0
+ server: :auto,
+ server_env: ENV['RAILS_ENV'] || 'development',
+ server_timeout: 60,
+ port: nil,
+ rackup_config: nil,
+ jasmine_url: nil,
+ timeout: 60,
+ spec_dir: nil,
+ notification: true,
+ hide_success: false,
+ all_on_start: true,
+ keep_failed: true,
+ clean: true,
+ all_after_pass: true,
+ max_error_notify: 3,
+ specdoc: :failure,
+ console: :failure,
+ errors: :failure,
+ focus: true,
+ coverage: false,
+ coverage_html: false,
+ coverage_summary: false,
+ statements_threshold: 0,
+ functions_threshold: 0,
+ branches_threshold: 0,
+ lines_threshold: 0
}
# Initialize Guard::Jasmine.
View
134 lib/guard/jasmine/cli.rb
@@ -24,113 +24,113 @@ class CLI < Thor
desc 'spec', 'Run the Jasmine spec runner_options'
method_option :server,
- :type => :string,
- :aliases => '-s',
- :default => 'auto',
- :desc => 'Server to start, either `auto`, `webrick`, `mongrel`, `thin`, `unicorn`, `jasmine_gem` or `none`'
+ type: :string,
+ aliases: '-s',
+ default: 'auto',
+ desc: 'Server to start, either `auto`, `webrick`, `mongrel`, `thin`, `unicorn`, `jasmine_gem` or `none`'
method_option :port,
- :type => :numeric,
- :aliases => '-p',
- :desc => 'Server port to use'
+ type: :numeric,
+ aliases: '-p',
+ desc: 'Server port to use'
method_option :server_env,
- :type => :string,
- :aliases => '-e',
- :default => ENV['RAILS_ENV'] || 'test',
- :desc => 'The server environment to use, for example `development`, `test` etc.'
+ type: :string,
+ aliases: '-e',
+ default: ENV['RAILS_ENV'] || 'test',
+ desc: 'The server environment to use, for example `development`, `test` etc.'
method_option :server_timeout,
- :type => :numeric,
- :default => 60,
- :desc => 'The number of seconds to wait for the Jasmine spec server'
+ type: :numeric,
+ default: 60,
+ desc: 'The number of seconds to wait for the Jasmine spec server'
method_option :verbose,
- :type => :boolean,
- :default => false,
- :desc => 'Show the server output in the console'
+ type: :boolean,
+ default: false,
+ desc: 'Show the server output in the console'
method_option :rackup_config,
- :type => :string,
- :aliases => '-c',
- :desc => 'The rackup config to use (jasminerice only)'
+ type: :string,
+ aliases: '-c',
+ desc: 'The rackup config to use (jasminerice only)'
method_option :bin,
- :type => :string,
- :aliases => '-b',
- :desc => 'The location of the PhantomJS binary'
+ type: :string,
+ aliases: '-b',
+ desc: 'The location of the PhantomJS binary'
method_option :spec_dir,
- :type => :string,
- :aliases => '-d',
- :desc => 'The directory with the Jasmine specs'
+ type: :string,
+ aliases: '-d',
+ desc: 'The directory with the Jasmine specs'
method_option :url,
- :type => :string,
- :aliases => '-u',
- :desc => 'The url of the Jasmine test runner'
+ type: :string,
+ aliases: '-u',
+ desc: 'The url of the Jasmine test runner'
method_option :timeout,
- :type => :numeric,
- :aliases => '-t',
- :default => 60,
- :desc => 'The maximum time in seconds to wait for the spec runner to finish'
+ type: :numeric,
+ aliases: '-t',
+ default: 60,
+ desc: 'The maximum time in seconds to wait for the spec runner to finish'
method_option :console,
- :type => :string,
- :default => 'failure',
- :desc => 'Whether to show console.log statements in the spec runner, either `always`, `never` or `failure`'
+ type: :string,
+ default: 'failure',
+ desc: 'Whether to show console.log statements in the spec runner, either `always`, `never` or `failure`'
method_option :errors,
- :type => :string,
- :default => 'failure',
- :desc => 'Whether to show errors in the spec runner, either `always`, `never` or `failure`'
+ type: :string,
+ default: 'failure',
+ desc: 'Whether to show errors in the spec runner, either `always`, `never` or `failure`'
method_option :focus,
- :type => :boolean,
- :aliases => '-f',
- :default => true,
- :desc => 'Specdoc focus to hide successful tests when at least one test fails'
+ type: :boolean,
+ aliases: '-f',
+ default: true,
+ desc: 'Specdoc focus to hide successful tests when at least one test fails'
method_option :specdoc,
- :type => :string,
- :default => :always,
- :desc => 'Whether to show successes in the spec runner, either `always`, `never` or `failure`'
+ type: :string,
+ default: :always,
+ desc: 'Whether to show successes in the spec runner, either `always`, `never` or `failure`'
method_option :coverage,
- :type => :boolean,
- :default => false,
- :desc => 'Whether to enable the coverage support or not'
+ type: :boolean,
+ default: false,
+ desc: 'Whether to enable the coverage support or not'
method_option :coverage_html,
- :type => :boolean,
- :default => false,
- :desc => 'Whether to generate html coverage report. Implies --coverage'
+ type: :boolean,
+ default: false,
+ desc: 'Whether to generate html coverage report. Implies --coverage'
method_option :coverage_summary,
- :type => :boolean,
- :default => false,
- :desc => 'Whether to generate html coverage summary. Implies --coverage'
+ type: :boolean,
+ default: false,
+ desc: 'Whether to generate html coverage summary. Implies --coverage'
method_option :statements_threshold,
- :type => :numeric,
- :default => 0,
- :desc => 'Statements coverage threshold'
+ type: :numeric,
+ default: 0,
+ desc: 'Statements coverage threshold'
method_option :functions_threshold,
- :type => :numeric,
- :default => 0,
- :desc => 'Functions coverage threshold'
+ type: :numeric,
+ default: 0,
+ desc: 'Functions coverage threshold'
method_option :branches_threshold,
- :type => :numeric,
- :default => 0,
- :desc => 'Branches coverage threshold'
+ type: :numeric,
+ default: 0,
+ desc: 'Branches coverage threshold'
method_option :lines_threshold,
- :type => :numeric,
- :default => 0,
- :desc => 'Lines coverage threshold'
+ type: :numeric,
+ default: 0,
+ desc: 'Lines coverage threshold'
# Run the Guard::Jasmine::Runner with options from
# the command line.
View
26 lib/guard/jasmine/runner.rb
@@ -64,7 +64,7 @@ def notify_start_message(paths, options)
"Run Jasmine suite#{ paths.size == 1 ? '' : 's' } #{ paths.join(' ') }"
end
- Formatter.info(message, :reset => true)
+ Formatter.info(message, reset: true)
end
# Returns the failed spec file names.
@@ -167,7 +167,7 @@ def evaluate_response(output, file, options)
json = json.encode('UTF-8') if json.respond_to?(:encode)
begin
- result = MultiJson.decode(json, { :max_nesting => false })
+ result = MultiJson.decode(json, { max_nesting: false })
if result['error']
notify_runtime_error(result, options)
@@ -204,7 +204,7 @@ def evaluate_response(output, file, options)
def notify_runtime_error(result, options)
message = "An error occurred: #{ result['error'] }"
Formatter.error(message)
- Formatter.notify(message, :title => 'Jasmine error', :image => :failed, :priority => 2) if options[:notification]
+ Formatter.notify(message, title: 'Jasmine error', image: :failed, priority: 2) if options[:notification]
end
# Notification about a spec run, success or failure,
@@ -231,12 +231,12 @@ def notify_spec_result(result, options)
if passed
report_specdoc(result, passed, options)
Formatter.success(message)
- Formatter.notify(full_message, :title => 'Jasmine suite passed') if options[:notification] && !options[:hide_success]
+ Formatter.notify(full_message, title: 'Jasmine suite passed') if options[:notification] && !options[:hide_success]
else
report_specdoc(result, passed, options)
Formatter.error(message)
notify_errors(result, options)
- Formatter.notify(full_message, :title => 'Jasmine suite failed', :image => :failed, :priority => 2) if options[:notification]
+ Formatter.notify(full_message, title: 'Jasmine suite failed', image: :failed, priority: 2) if options[:notification]
end
Formatter.info("Done.\n")
@@ -307,10 +307,10 @@ def check_coverage(options)
if failed
Formatter.error coverage
- Formatter.notify(coverage, :title => 'Code coverage failed', :image => :failed, :priority => 2) if options[:notification]
+ Formatter.notify(coverage, title: 'Code coverage failed', image: :failed, priority: 2) if options[:notification]
else
Formatter.success 'Code coverage succeed'
- Formatter.notify('All code is adequately covered with specs', :title => 'Code coverage succeed') if options[:notification] && !options[:hide_success]
+ Formatter.notify('All code is adequately covered with specs', title: 'Code coverage succeed') if options[:notification] && !options[:hide_success]
end
end
end
@@ -523,9 +523,9 @@ def notify_errors(result, options)
if !spec['passed'] && options[:max_error_notify] > index
msg = spec['messages'].map { |message| format_message(message, true) }.join(', ')
Formatter.notify("#{ spec['description'] }: #{ msg }",
- :title => 'Jasmine spec failed',
- :image => :failed,
- :priority => 2) if options[:notification]
+ title: 'Jasmine spec failed',
+ image: :failed,
+ priority: 2) if options[:notification]
end
end
end
@@ -575,17 +575,17 @@ def format_message(message, short)
#
def update_coverage(coverage, file, options)
if file == options[:spec_dir]
- File.write(coverage_file, MultiJson.encode(coverage, { :max_nesting => false }))
+ File.write(coverage_file, MultiJson.encode(coverage, { max_nesting: false }))
else
if File.exist?(coverage_file)
impl = file.sub('_spec', '').sub(options[:spec_dir], '')
- coverage = MultiJson.decode(File.read(coverage_file), { :max_nesting => false })
+ coverage = MultiJson.decode(File.read(coverage_file), { max_nesting: false })
coverage.each do |coverage_file, data|
coverage[coverage_file] = data if coverage_file == impl
end
- File.write(coverage_file, MultiJson.encode(coverage, { :max_nesting => false }))
+ File.write(coverage_file, MultiJson.encode(coverage, { max_nesting: false }))
else
File.write(coverage_file, MultiJson.encode({ }))
end
View
88 spec/guard/jasmine/cli_spec.rb
@@ -29,7 +29,7 @@
context 'without the server set to :none' do
it 'starts the server' do
- server.should_receive(:start).with(hash_including(:server => :thin))
+ server.should_receive(:start).with(hash_including(server: :thin))
cli.start(['spec', '--server', 'thin'])
end
end
@@ -41,7 +41,7 @@
end
it 'sets the spec dir' do
- runner.should_receive(:run).with(anything(), hash_including(:spec_dir => 'specs')).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(spec_dir: 'specs')).and_return [true, []]
cli.start(['spec', '--spec-dir', 'specs'])
end
@@ -51,87 +51,87 @@
end
it 'enables focus mode' do
- runner.should_receive(:run).with(anything(), hash_including(:focus => true)).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(focus: true)).and_return [true, []]
cli.start(['spec'])
end
it 'sets the jasmine url' do
- runner.should_receive(:run).with(anything(), hash_including(:jasmine_url => 'http://smackaho.st:3000/jasmine')).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(jasmine_url: 'http://smackaho.st:3000/jasmine')).and_return [true, []]
cli.start(['spec', '--url', 'http://smackaho.st:3000/jasmine'])
end
it 'sets the PhantomJS binary' do
- runner.should_receive(:run).with(anything(), hash_including(:phantomjs_bin => '/bin/phantomjs')).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(phantomjs_bin: '/bin/phantomjs')).and_return [true, []]
cli.start(['spec', '--bin', '/bin/phantomjs'])
end
it 'sets the timeout' do
- runner.should_receive(:run).with(anything(), hash_including(:timeout => 20000)).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(timeout: 20000)).and_return [true, []]
cli.start(['spec', '--timeout', '20000'])
end
it 'sets the verbose mode' do
- runner.should_receive(:run).with(anything(), hash_including(:verbose => true)).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(verbose: true)).and_return [true, []]
cli.start(['spec', '--verbose'])
end
it 'sets the server environment' do
- runner.should_receive(:run).with(anything(), hash_including(:server_env => 'development')).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(server_env: 'development')).and_return [true, []]
cli.start(['spec', '--server-env', 'development'])
end
it 'sets the coverage support' do
- runner.should_receive(:run).with(anything(), hash_including(:coverage => true)).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(coverage: true)).and_return [true, []]
cli.start(['spec', '--coverage', 'true'])
end
it 'sets the coverage and coverage html support' do
- runner.should_receive(:run).with(anything(), hash_including(:coverage => true, :coverage_html => true)).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(coverage: true, coverage_html: true)).and_return [true, []]
cli.start(['spec', '--coverage-html', 'true'])
end
it 'sets the coverage and coverage summary support' do
- runner.should_receive(:run).with(anything(), hash_including(:coverage => true, :coverage_summary => true)).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(coverage: true, coverage_summary: true)).and_return [true, []]
cli.start(['spec', '--coverage-summary', 'true'])
end
it 'sets the coverage statements threshold' do
- runner.should_receive(:run).with(anything(), hash_including(:statements_threshold => 90)).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(statements_threshold: 90)).and_return [true, []]
cli.start(['spec', '--statements-threshold', '90'])
end
it 'sets the coverage functions threshold' do
- runner.should_receive(:run).with(anything(), hash_including(:functions_threshold => 80)).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(functions_threshold: 80)).and_return [true, []]
cli.start(['spec', '--functions-threshold', '80'])
end
it 'sets the coverage branches threshold' do
- runner.should_receive(:run).with(anything(), hash_including(:branches_threshold => 85)).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(branches_threshold: 85)).and_return [true, []]
cli.start(['spec', '--branches-threshold', '85'])
end
it 'sets the coverage lines threshold' do
- runner.should_receive(:run).with(anything(), hash_including(:lines_threshold => 95)).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(lines_threshold: 95)).and_return [true, []]
cli.start(['spec', '--lines-threshold', '95'])
end
context 'for an invalid console option' do
it 'sets the console option to failure' do
- runner.should_receive(:run).with(anything(), hash_including(:console => :failure)).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(console: :failure)).and_return [true, []]
cli.start(['spec', '--console', 'wrong'])
end
end
context 'for a valid errors option' do
it 'sets the errors option' do
- runner.should_receive(:run).with(anything(), hash_including(:errors => :always)).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(errors: :always)).and_return [true, []]
cli.start(['spec', '--errors', 'always'])
end
end
context 'for an invalid errors option' do
it 'sets the errors option to failure' do
- runner.should_receive(:run).with(anything(), hash_including(:errors => :failure)).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(errors: :failure)).and_return [true, []]
cli.start(['spec', '--errors', 'wrong'])
end
end
@@ -146,42 +146,42 @@
end
it 'sets the verbose mode' do
- runner.should_receive(:run).with(anything(), hash_including(:verbose => false)).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(verbose: false)).and_return [true, []]
cli.start(['spec'])
end
it 'sets the coverage support' do
- runner.should_receive(:run).with(anything(), hash_including(:coverage => false)).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(coverage: false)).and_return [true, []]
cli.start(['spec'])
end
it 'sets the coverage html support' do
- runner.should_receive(:run).with(anything(), hash_including(:coverage_html => false)).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(coverage_html: false)).and_return [true, []]
cli.start(['spec'])
end
it 'sets the coverage summary support' do
- runner.should_receive(:run).with(anything(), hash_including(:coverage_summary => false)).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(coverage_summary: false)).and_return [true, []]
cli.start(['spec'])
end
it 'sets the coverage statements threshold' do
- runner.should_receive(:run).with(anything(), hash_including(:statements_threshold => 0)).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(statements_threshold: 0)).and_return [true, []]
cli.start(['spec'])
end
it 'sets the coverage functions threshold' do
- runner.should_receive(:run).with(anything(), hash_including(:functions_threshold => 0)).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(functions_threshold: 0)).and_return [true, []]
cli.start(['spec'])
end
it 'sets the coverage branches threshold' do
- runner.should_receive(:run).with(anything(), hash_including(:branches_threshold => 0)).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(branches_threshold: 0)).and_return [true, []]
cli.start(['spec'])
end
it 'sets the coverage lines threshold' do
- runner.should_receive(:run).with(anything(), hash_including(:lines_threshold => 0)).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(lines_threshold: 0)).and_return [true, []]
cli.start(['spec'])
end
@@ -220,106 +220,106 @@
end
it 'sets the spec dir' do
- runner.should_receive(:run).with(anything(), hash_including(:spec_dir => 'spec')).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(spec_dir: 'spec')).and_return [true, []]
cli.start(['spec'])
end
it 'disables the focus mode' do
- runner.should_receive(:run).with(anything(), hash_including(:focus => false)).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(focus: false)).and_return [true, []]
cli.start(['spec', '-f', 'false'])
end
it 'auto detects the phantomjs binary' do
cli.should_receive(:which).with('phantomjs').and_return '/tmp/phantomjs'
- runner.should_receive(:run).with(anything(), hash_including(:phantomjs_bin => '/tmp/phantomjs')).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(phantomjs_bin: '/tmp/phantomjs')).and_return [true, []]
cli.start(['spec'])
end
it 'sets the timeout' do
- runner.should_receive(:run).with(anything(), hash_including(:timeout => 60)).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(timeout: 60)).and_return [true, []]
cli.start(['spec'])
end
it 'sets the console' do
- runner.should_receive(:run).with(anything(), hash_including(:console => :failure)).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(console: :failure)).and_return [true, []]
cli.start(['spec'])
end
it 'sets the server environment' do
- runner.should_receive(:run).with(anything(), hash_including(:server_env => 'test')).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(server_env: 'test')).and_return [true, []]
cli.start(['spec'])
end
it 'sets the rackup config' do
- runner.should_receive(:run).with(anything(), hash_including(:rackup_config => 'custom.ru')).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(rackup_config: 'custom.ru')).and_return [true, []]
cli.start(['spec', '--rackup-config', 'custom.ru'])
end
it 'sets the specdoc to always by default' do
- runner.should_receive(:run).with(anything(), hash_including(:specdoc => :always)).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(specdoc: :always)).and_return [true, []]
cli.start(['spec'])
end
it 'sets the specdoc to failure' do
- runner.should_receive(:run).with(anything(), hash_including(:specdoc => :failure)).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(specdoc: :failure)).and_return [true, []]
cli.start(['spec', '--specdoc', 'failure'])
end
context 'with a defined port' do
it 'uses the given port' do
- runner.should_receive(:run).with(anything(), hash_including(:port => 3333)).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(port: 3333)).and_return [true, []]
cli.start(['spec', '--port', '3333'])
end
it 'generates the default jasmine url with the given port' do
- runner.should_receive(:run).with(anything(), hash_including(:jasmine_url => 'http://localhost:9876/jasmine')).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(jasmine_url: 'http://localhost:9876/jasmine')).and_return [true, []]
cli.start(['spec', '--port', '9876'])
end
end
context 'without a defined port' do
it 'uses a free port' do
cli.should_receive(:find_free_server_port).and_return 4321
- runner.should_receive(:run).with(anything(), hash_including(:port => 4321)).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(port: 4321)).and_return [true, []]
cli.start(['spec'])
end
it 'generates the default jasmine url with a free port' do
cli.should_receive(:find_free_server_port).and_return 1234
- runner.should_receive(:run).with(anything(), hash_including(:jasmine_url => 'http://localhost:1234/jasmine')).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(jasmine_url: 'http://localhost:1234/jasmine')).and_return [true, []]
cli.start(['spec'])
end
end
end
context 'when using the jasmine gem' do
it 'generates the default jasmine url' do
- runner.should_receive(:run).with(anything(), hash_including(:jasmine_url => 'http://localhost:9876/')).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(jasmine_url: 'http://localhost:9876/')).and_return [true, []]
cli.start(['spec', '--port', '9876', '--server', 'jasmine_gem'])
end
end
context 'when using the jasminerice gem' do
it 'generates the default jasmine url' do
- runner.should_receive(:run).with(anything(), hash_including(:jasmine_url => 'http://localhost:9876/jasmine')).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(jasmine_url: 'http://localhost:9876/jasmine')).and_return [true, []]
cli.start(['spec', '--port', '9876', '--server', 'thin'])
end
end
end
context 'for non changeable options' do
it 'disables notifications' do
- runner.should_receive(:run).with(anything(), hash_including(:notification => false)).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(notification: false)).and_return [true, []]
cli.start(['spec'])
end
it 'hides success notifications' do
- runner.should_receive(:run).with(anything(), hash_including(:hide_success => true)).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(hide_success: true)).and_return [true, []]
cli.start(['spec'])
end
it 'sets the maximum error notifications to none' do
- runner.should_receive(:run).with(anything(), hash_including(:max_error_notify => 0)).and_return [true, []]
+ runner.should_receive(:run).with(anything(), hash_including(max_error_notify: 0)).and_return [true, []]
cli.start(['spec'])
end
end
View
24 spec/guard/jasmine/formatter_spec.rb
@@ -8,43 +8,43 @@
describe '.info' do
it 'shows an info message' do
- ui.should_receive(:info).with('Info message', { :reset => true })
- formatter.info('Info message', { :reset => true })
+ ui.should_receive(:info).with('Info message', { reset: true })
+ formatter.info('Info message', { reset: true })
end
end
describe '.debug' do
it 'shows a debug message' do
- ui.should_receive(:debug).with('Debug message', { :reset => true })
- formatter.debug('Debug message', { :reset => true })
+ ui.should_receive(:debug).with('Debug message', { reset: true })
+ formatter.debug('Debug message', { reset: true })
end
end
describe '.error' do
it 'shows a colorized error message' do
- ui.should_receive(:error).with("\e[0;31mError message\e[0m", { :reset => true })
- formatter.error('Error message', { :reset => true })
+ ui.should_receive(:error).with("\e[0;31mError message\e[0m", { reset: true })
+ formatter.error('Error message', { reset: true })
end
end
describe '.spec_failed' do
it 'shows a colorized spec failed message' do
- ui.should_receive(:info).with("\e[0;31mSpec failed message\e[0m", { :reset => true })
- formatter.spec_failed('Spec failed message', { :reset => true })
+ ui.should_receive(:info).with("\e[0;31mSpec failed message\e[0m", { reset: true })
+ formatter.spec_failed('Spec failed message', { reset: true })
end
end
describe '.success' do
it 'shows a colorized success message' do
- ui.should_receive(:info).with("\e[0;32mSuccess message\e[0m", { :reset => true })
- formatter.success('Success message', { :reset => true })
+ ui.should_receive(:info).with("\e[0;32mSuccess message\e[0m", { reset: true })
+ formatter.success('Success message', { reset: true })
end
end
describe '.notify' do
it 'shows an info message' do
- notifier.should_receive(:notify).with('Notify message', { :image => :failed })
- formatter.notify('Notify message', { :image => :failed })
+ notifier.should_receive(:notify).with('Notify message', { image: :failed })
+ formatter.notify('Notify message', { image: :failed })
end
end
end
View
2 spec/guard/jasmine/inspector_spec.rb
@@ -9,7 +9,7 @@
subject { Guard::Jasmine::Inspector }
- let(:options) { { :spec_dir => 'spec/javascripts' } }
+ let(:options) { { spec_dir: 'spec/javascripts' } }
describe 'clean' do
it 'allows the Jasmine spec dir' do
View
140 spec/guard/jasmine/runner_spec.rb
@@ -8,9 +8,9 @@
let(:formatter) { Guard::Jasmine::Formatter }
let(:defaults) { Guard::Jasmine::DEFAULT_OPTIONS.merge({
- :jasmine_url => 'http://localhost:8888/jasmine',
- :phantomjs_bin => '/usr/local/bin/phantomjs',
- :spec_dir => 'spec/javascripts' })
+ jasmine_url: 'http://localhost:8888/jasmine',
+ phantomjs_bin: '/usr/local/bin/phantomjs',
+ spec_dir: 'spec/javascripts' })
}
let(:phantomjs_error_response) do
@@ -203,11 +203,11 @@
context 'when passed the spec directory' do
it 'requests all jasmine specs from the server' do
IO.should_receive(:popen).with("#{ phantomjs_command } \"http://localhost:8888/jasmine\" 60000 failure true failure failure", "r:UTF-8")
- runner.run(['spec/javascripts'], defaults.merge({ :notification => false }))
+ runner.run(['spec/javascripts'], defaults.merge({ notification: false }))
end
it 'shows a start information in the console' do
- formatter.should_receive(:info).with('Run all Jasmine suites', { :reset => true })
+ formatter.should_receive(:info).with('Run all Jasmine suites', { reset: true })
formatter.should_receive(:info).with('Run Jasmine suite at http://localhost:8888/jasmine')
runner.run(['spec/javascripts'], defaults)
end
@@ -241,9 +241,9 @@
it 'shows an error notification' do
formatter.should_receive(:notify).with(
'An error occurred: Cannot request Jasmine specs',
- :title => 'Jasmine error',
- :image => :failed,
- :priority => 2
+ title: 'Jasmine error',
+ image: :failed,
+ priority: 2
)
runner.run(['spec/javascripts/a.js.coffee'], defaults)
end
@@ -252,7 +252,7 @@
context 'without notifications' do
it 'does not shows an error notification' do
formatter.should_not_receive(:notify)
- runner.run(['spec/javascripts/a.js.coffee'], defaults.merge({ :notification => false }))
+ runner.run(['spec/javascripts/a.js.coffee'], defaults.merge({ notification: false }))
end
end
end
@@ -285,7 +285,7 @@
context 'and console and errors set to :never' do
it 'shows the summary in the console' do
formatter.should_receive(:info).with(
- 'Run Jasmine suite spec/javascripts/x/b.js.coffee', { :reset => true }
+ 'Run Jasmine suite spec/javascripts/x/b.js.coffee', { reset: true }
)
formatter.should_receive(:info).with(
'Run Jasmine suite at http://localhost:8888/jasmine?spec=FailureTest'
@@ -295,7 +295,7 @@
formatter.should_receive(:error).with(
'3 specs, 2 failures'
)
- runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ :specdoc => :never, :console => :never, :errors => :never }))
+ runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ specdoc: :never, console: :never, errors: :never }))
end
end
@@ -331,7 +331,7 @@
formatter.should_not_receive(:info).with(
' • And even more console.log messages'
)
- runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ :specdoc => :never }))
+ runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ specdoc: :never }))
end
end
@@ -367,7 +367,7 @@
formatter.should_receive(:info).with(
' • And even more console.log messages'
)
- runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ :specdoc => :never, :console => :always }))
+ runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ specdoc: :never, console: :always }))
end
end
end
@@ -392,7 +392,7 @@
formatter.should_receive(:spec_failed).with(
' ➤ ReferenceError: Can\'t find variable: b in backbone/models/model_spec.js on line 27'
)
- runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ :console => :always }))
+ runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ console: :always }))
end
context 'with focus enabled' do
@@ -410,7 +410,7 @@
formatter.should_not_receive(:info).with(
' • And even more console.log messages'
)
- runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ :console => :never, :errors => :never, :focus => true }))
+ runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ console: :never, errors: :never, focus: true }))
end
end
@@ -431,7 +431,7 @@
formatter.should_not_receive(:info).with(
' • And even more console.log messages'
)
- runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ :console => :failure, :errors => :failure, :focus => true }))
+ runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ console: :failure, errors: :failure, focus: true }))
end
end
@@ -452,7 +452,7 @@
formatter.should_receive(:info).with(
' • And even more console.log messages'
)
- runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ :console => :always, :errors => :always, :focus => true }))
+ runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ console: :always, errors: :always, focus: true }))
end
end
end
@@ -468,7 +468,7 @@
formatter.should_receive(:info).with(
' • And even more console.log messages'
)
- runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ :console => :always, :focus => false }))
+ runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ console: :always, focus: false }))
end
end
@@ -477,7 +477,7 @@
formatter.should_receive(:info).with(
' • console.log message'
)
- runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ :console => :always }))
+ runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ console: :always }))
end
end
@@ -486,7 +486,7 @@
formatter.should_receive(:spec_failed).with(
' ➜ Exception: Error message in /path/to/file.js on line 255'
)
- runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ :errors => :always }))
+ runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ errors: :always }))
end
end
@@ -501,7 +501,7 @@
formatter.should_not_receive(:info).with(
' • And even more console.log messages'
)
- runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ :console => :never }))
+ runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ console: :never }))
end
end
@@ -513,7 +513,7 @@
formatter.should_not_receive(:spec_failed).with(
' ➜ Exception: Another error message in /path/to/file.js on line 255'
)
- runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ :errors => :never }))
+ runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ errors: :never }))
end
end
@@ -528,7 +528,7 @@
formatter.should_not_receive(:info).with(
' • And even more console.log messages'
)
- runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ :console => :failure }))
+ runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ console: :failure }))
end
end
@@ -540,7 +540,7 @@
formatter.should_not_receive(:spec_failed).with(
' ➜ Exception: Another error message in /path/to/file.js on line 255'
)
- runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ :errors => :failure }))
+ runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ errors: :failure }))
end
end
end
@@ -549,21 +549,21 @@
it 'shows the failing spec notification' do
formatter.should_receive(:notify).with(
'Failure spec tests something: ReferenceError: Can\'t find variable: a',
- :title => 'Jasmine spec failed',
- :image => :failed,
- :priority => 2
+ title: 'Jasmine spec failed',
+ image: :failed,
+ priority: 2
)
formatter.should_receive(:notify).with(
'Failure spec 2 tests something: ReferenceError: Can\'t find variable: b',
- :title => 'Jasmine spec failed',
- :image => :failed,
- :priority => 2
+ title: 'Jasmine spec failed',
+ image: :failed,
+ priority: 2
)
formatter.should_receive(:notify).with(
"3 specs, 2 failures\nin 0.007 seconds",
- :title => 'Jasmine suite failed',
- :image => :failed,
- :priority => 2
+ title: 'Jasmine suite failed',
+ image: :failed,
+ priority: 2
)
runner.run(['spec/javascripts/x/b.js.coffee'], defaults)
end
@@ -572,30 +572,30 @@
it 'shows the failing spec notification' do
formatter.should_receive(:notify).with(
'Failure spec tests something: ReferenceError: Can\'t find variable: a',
- :title => 'Jasmine spec failed',
- :image => :failed,
- :priority => 2
+ title: 'Jasmine spec failed',
+ image: :failed,
+ priority: 2
)
formatter.should_not_receive(:notify).with(
'Failure spec 2 tests something: ReferenceError: Can\'t find variable: b',
- :title => 'Jasmine spec failed',
- :image => :failed,
- :priority => 2
+ title: 'Jasmine spec failed',
+ image: :failed,
+ priority: 2
)
formatter.should_receive(:notify).with(
"3 specs, 2 failures\nin 0.007 seconds",
- :title => 'Jasmine suite failed',
- :image => :failed,
- :priority => 2
+ title: 'Jasmine suite failed',
+ image: :failed,
+ priority: 2
)
- runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ :max_error_notify => 1 }))
+ runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ max_error_notify: 1 }))
end
end
context 'without notifications' do
it 'does not show a failure notification' do
formatter.should_not_receive(:notify)
- runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ :notification => false }))
+ runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ notification: false }))
end
end
end
@@ -631,7 +631,7 @@
it 'notifies coverage when present' do
runner.should_receive(:notify_coverage_result)
- runner.run(['spec/javascripts/t.js.coffee'], defaults.merge({ :coverage => true }))
+ runner.run(['spec/javascripts/t.js.coffee'], defaults.merge({ coverage: true }))
end
context 'checking the coverage' do
@@ -641,22 +641,22 @@
it 'can check for statements coverage' do
runner.should_receive(:`).with('/bin/istanbul check-coverage --statements 12 tmp/coverage.json 2>&1').and_return ''
- runner.run(['spec/javascripts/t.js.coffee'], defaults.merge({ :coverage => true, :statements_threshold => 12 }))
+ runner.run(['spec/javascripts/t.js.coffee'], defaults.merge({ coverage: true, statements_threshold: 12 }))
end
it 'can check for functions coverage' do
runner.should_receive(:`).with('/bin/istanbul check-coverage --functions 12 tmp/coverage.json 2>&1').and_return ''
- runner.run(['spec/javascripts/t.js.coffee'], defaults.merge({ :coverage => true, :functions_threshold => 12 }))
+ runner.run(['spec/javascripts/t.js.coffee'], defaults.merge({ coverage: true, functions_threshold: 12 }))
end
it 'can check for branches coverage' do
runner.should_receive(:`).with('/bin/istanbul check-coverage --branches 12 tmp/coverage.json 2>&1').and_return ''
- runner.run(['spec/javascripts/t.js.coffee'], defaults.merge({ :coverage => true, :branches_threshold => 12 }))
+ runner.run(['spec/javascripts/t.js.coffee'], defaults.merge({ coverage: true, branches_threshold: 12 }))
end
it 'can check for lines coverage' do
runner.should_receive(:`).with('/bin/istanbul check-coverage --lines 12 tmp/coverage.json 2>&1').and_return ''
- runner.run(['spec/javascripts/t.js.coffee'], defaults.merge({ :coverage => true, :lines_threshold => 12 }))
+ runner.run(['spec/javascripts/t.js.coffee'], defaults.merge({ coverage: true, lines_threshold: 12 }))
end
context 'when enough is covered' do
@@ -666,12 +666,12 @@
it 'shows the success message' do
formatter.should_receive(:success).with('Code coverage succeed')
- runner.run(['spec/javascripts/t.js.coffee'], defaults.merge({ :coverage => true, :lines_threshold => 12 }))
+ runner.run(['spec/javascripts/t.js.coffee'], defaults.merge({ coverage: true, lines_threshold: 12 }))
end
it 'notifies the coverage success when not turned off' do
- formatter.should_receive(:notify).with('All code is adequately covered with specs', :title => 'Code coverage succeed')
- runner.run(['spec/javascripts/t.js.coffee'], defaults.merge({ :coverage => true, :lines_threshold => 12 }))
+ formatter.should_receive(:notify).with('All code is adequately covered with specs', title: 'Code coverage succeed')
+ runner.run(['spec/javascripts/t.js.coffee'], defaults.merge({ coverage: true, lines_threshold: 12 }))
end
end
end
@@ -702,7 +702,7 @@
it 'shows the summary text info' do
formatter.should_receive(:info).with('Spec coverage details:')
- runner.run(['app/test1.js.coffee'], defaults.merge({ :coverage => true }))
+ runner.run(['app/test1.js.coffee'], defaults.merge({ coverage: true }))
end
@@ -719,7 +719,7 @@
runner.should_receive(:puts).with 'All files | 98.04 | 75.86 | 86.67 | 98.04 |'
runner.should_receive(:puts).with '-------------------------------+-----------+-----------+-----------+-----------+'
runner.should_receive(:puts).with ''
- runner.run(['spec/javascripts'], defaults.merge({ :coverage => true }))
+ runner.run(['spec/javascripts'], defaults.merge({ coverage: true }))
end
end
@@ -735,7 +735,7 @@
runner.should_receive(:puts).with 'All files | 98.04 | 75.86 | 86.67 | 98.04 |'
runner.should_receive(:puts).with '-------------------------------+-----------+-----------+-----------+-----------+'
runner.should_receive(:puts).with ''
- runner.run(['app/test1.js.coffee'], defaults.merge({ :coverage => true }))
+ runner.run(['app/test1.js.coffee'], defaults.merge({ coverage: true }))
end
end
end
@@ -761,7 +761,7 @@
it 'shows the summary text info' do
formatter.should_receive(:info).with('Spec coverage summary:')
- runner.run(['app/test1.js.coffee'], defaults.merge({ :coverage => true, :coverage_summary => true }))
+ runner.run(['app/test1.js.coffee'], defaults.merge({ coverage: true, coverage_summary: true }))
end
it 'shows the summary text report' do
@@ -771,7 +771,7 @@
runner.should_receive(:puts).with 'Functions : 86.67% ( 13/15 )'
runner.should_receive(:puts).with 'Lines : 98.04% ( 50/51 )'
runner.should_receive(:puts).with ''
- runner.run(['app/test1.js.coffee'], defaults.merge({ :coverage => true, :coverage_summary => true }))
+ runner.run(['app/test1.js.coffee'], defaults.merge({ coverage: true, coverage_summary: true }))
end
end
@@ -784,12 +784,12 @@
it 'generates the html report' do
runner.should_receive(:`).with('/bin/istanbul report --root /projects/secret html tmp/coverage.json')
- runner.run(['app/test1.js.coffee'], defaults.merge({ :coverage => true, :coverage_html => true }))
+ runner.run(['app/test1.js.coffee'], defaults.merge({ coverage: true, coverage_html: true }))
end
it 'outputs the html report index page' do
formatter.should_receive(:info).with('Updated HTML report available at: coverage/index.html')
- runner.run(['app/test1.js.coffee'], defaults.merge({ :coverage => true, :coverage_html => true }))
+ runner.run(['app/test1.js.coffee'], defaults.merge({ coverage: true, coverage_html: true }))
end
end
end
@@ -798,7 +798,7 @@
context 'with the specdoc set to :always' do
it 'shows the specdoc in the console' do
formatter.should_receive(:info).with(
- 'Run Jasmine suite spec/javascripts/x/t.js', { :reset => true }
+ 'Run Jasmine suite spec/javascripts/x/t.js', { reset: true }
)
formatter.should_receive(:info).with(
'Run Jasmine suite at http://localhost:8888/jasmine?spec=SuccessTest'
@@ -821,21 +821,21 @@
formatter.should_receive(:success).with(
'3 specs, 0 failures'
)
- runner.run(['spec/javascripts/x/t.js'], defaults.merge({ :specdoc => :always }))
+ runner.run(['spec/javascripts/x/t.js'], defaults.merge({ specdoc: :always }))
end
context 'with console logs set to :always' do
it 'shows the console logs' do
formatter.should_receive(:info).with(
- 'Run Jasmine suite spec/javascripts/x/b.js.coffee', { :reset => true }
+ 'Run Jasmine suite spec/javascripts/x/b.js.coffee', { reset: true }
)
formatter.should_receive(:info).with(
'Run Jasmine suite at http://localhost:8888/jasmine?spec=SuccessTest'
)
formatter.should_receive(:info).with(
' • I can haz console.logs'
)
- runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ :specdoc => :always, :console => :always }))
+ runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ specdoc: :always, console: :always }))
end
end
@@ -844,15 +844,15 @@
formatter.should_not_receive(:info).with(
' • I can haz console.logs'
)
- runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ :specdoc => :always, :console => :never }))
+ runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ specdoc: :always, console: :never }))
end
end
end
context 'with the specdoc set to :never or :failure' do
it 'shows the summary in the console' do
formatter.should_receive(:info).with(
- 'Run Jasmine suite spec/javascripts/x/t.js', { :reset => true }
+ 'Run Jasmine suite spec/javascripts/x/t.js', { reset: true }
)
formatter.should_receive(:info).with(
'Run Jasmine suite at http://localhost:8888/jasmine?spec=SuccessTest'
@@ -861,15 +861,15 @@
formatter.should_receive(:success).with(
'3 specs, 0 failures'
)
- runner.run(['spec/javascripts/x/t.js'], defaults.merge({ :specdoc => :never }))
+ runner.run(['spec/javascripts/x/t.js'], defaults.merge({ specdoc: :never }))
end
context 'with console logs set to :always' do
it 'shows the console logs' do
formatter.should_receive(:info).with(
' • I can haz console.logs'
)
- runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ :console => :always }))
+ runner.run(['spec/javascripts/x/b.js.coffee'], defaults.merge({ console: :always }))
end
end
end
@@ -878,23 +878,23 @@
it 'shows a success notification' do
formatter.should_receive(:notify).with(
"3 specs, 0 failures\nin 0.009 seconds",
- :title => 'Jasmine suite passed'
+ title: 'Jasmine suite passed'
)
runner.run(['spec/javascripts/t.js'], defaults)
end
context 'with hide success notifications' do
it 'does not shows a success notification' do
formatter.should_not_receive(:notify)
- runner.run(['spec/javascripts/t.js'], defaults.merge({ :notification => true, :hide_success => true }))
+ runner.run(['spec/javascripts/t.js'], defaults.merge({ notification: true, hide_success: true }))
end
end
end
context 'without notifications' do
it 'does not shows a success notification' do
formatter.should_not_receive(:notify)
- runner.run(['spec/javascripts/t.js'], defaults.merge({ :notification => false }))
+ runner.run(['spec/javascripts/t.js'], defaults.merge({ notification: false }))
end
end
end
View
26 spec/guard/jasmine/server_spec.rb
@@ -8,10 +8,10 @@
let(:defaults) do
{
- :server => :auto,
- :port => 8888,
- :server_env => 'test',
- :spec_dir => 'spec/javascripts'
+ server: :auto,
+ port: 8888,
+ server_env: 'test',
+ spec_dir: 'spec/javascripts'
}
end
@@ -24,7 +24,7 @@
describe '.start' do
context 'with the :thin strategy' do
let(:options) do
- defaults.merge({ :server => :thin })
+ defaults.merge({ server: :thin })
end
it 'does not auto detect a server' do
@@ -45,7 +45,7 @@
context 'with the :puma strategy' do
let(:options) do
- defaults.merge({ :server => :puma })
+ defaults.merge({ server: :puma })
end
it 'does not auto detect a server' do
@@ -66,7 +66,7 @@
context 'with the :mongrel strategy' do
let(:options) do
- defaults.merge({ :server => :mongrel })
+ defaults.merge({ server: :mongrel })
end
it 'does not auto detect a server' do
@@ -87,7 +87,7 @@
context 'with the :webrick strategy' do
let(:options) do
- defaults.merge({ :server => :webrick })
+ defaults.merge({ server: :webrick })
end
it 'does not auto detect a server' do
@@ -108,7 +108,7 @@
context 'with the :unicorn strategy' do
let(:options) do
- defaults.merge({ :server => :unicorn })
+ defaults.merge({ server: :unicorn })
end
it 'does not auto detect a server' do
@@ -129,7 +129,7 @@
context 'with the :webrick strategy and a custom config.ru' do
let(:options) do
- defaults.merge({ :server => :webrick, :rackup_config => 'my/cool.ru' })
+ defaults.merge({ server: :webrick, rackup_config: 'my/cool.ru' })
end
it 'starts a :webrick rack server' do
@@ -140,7 +140,7 @@
context 'with the :jasmine_gem strategy' do
let(:options) do
- defaults.merge({ :server => :jasmine_gem })
+ defaults.merge({ server: :jasmine_gem })
end
it 'does not auto detect a server' do
@@ -161,7 +161,7 @@
context 'with a custom rake strategy' do
let(:options) do
- defaults.merge({ :server => :custom_server_strategy })
+ defaults.merge({ server: :custom_server_strategy })
end
it 'does not auto detect a server' do
@@ -182,7 +182,7 @@
context 'with the :none strategy' do
let(:options) do
- defaults.merge({ :server => :none })
+ defaults.merge({ server: :none })
end
it 'does not auto detect a server' do
View
10 spec/guard/jasmine/util_spec.rb
@@ -22,7 +22,7 @@
it 'does show that the runner is available' do
Guard::Jasmine::Formatter.should_receive(:info).with 'Waiting for Jasmine test runner at http://localhost:8888/jasmine'
- util.runner_available?({ :jasmine_url => 'http://localhost:8888/jasmine', :server_timeout => 15 })
+ util.runner_available?({ jasmine_url: 'http://localhost:8888/jasmine', server_timeout: 15 })
end
end
@@ -34,7 +34,7 @@
it 'does show that the runner is not available' do
Guard::Jasmine::Formatter.should_receive(:error).with 'Jasmine test runner isn\'t available: Connection refused'
- util.runner_available?({ :jasmine_url => 'http://localhost:8888/jasmine', :server_timeout => 15 })
+ util.runner_available?({ jasmine_url: 'http://localhost:8888/jasmine', server_timeout: 15 })
end
end
@@ -46,7 +46,7 @@
it 'does show that the runner is not available' do
Guard::Jasmine::Formatter.should_receive(:error).with 'Jasmine test runner failed with status 404'
- util.runner_available?({ :jasmine_url => 'http://localhost:8888/jasmine', :server_timeout => 15 })
+ util.runner_available?({ jasmine_url: 'http://localhost:8888/jasmine', server_timeout: 15 })
end
context 'with a response body returned' do
@@ -57,7 +57,7 @@
it 'outputs the body for further analysis' do
Guard::Jasmine::Formatter.should_receive(:error).with 'Jasmine test runner failed with status 404'
Guard::Jasmine::Formatter.should_receive(:error).with 'Please open the Jasmine runner in your browser for more information.'
- util.runner_available?({ :jasmine_url => 'http://localhost:8888/jasmine', :server_timeout => 15 })
+ util.runner_available?({ jasmine_url: 'http://localhost:8888/jasmine', server_timeout: 15 })
end
end
end
@@ -69,7 +69,7 @@
it 'does show that the runner is not available' do
Guard::Jasmine::Formatter.should_receive(:error).with 'Timeout waiting for the Jasmine test runner.'
- util.runner_available?({ :jasmine_url => 'http://localhost:8888/jasmine', :server_timeout => 15 })
+ util.runner_available?({ jasmine_url: 'http://localhost:8888/jasmine', server_timeout: 15 })
end
end
end
View
106 spec/guard/jasmine_spec.rb
@@ -163,33 +163,33 @@
context 'with other options than the default ones' do
let(:guard) { Guard::Jasmine.new(nil, {
- :server => :jasmine_gem,
- :server_env => 'test',
- :server_timeout => 20,
- :port => 4321,
- :rackup_config => 'spec/dummy/config.ru',
- :jasmine_url => 'http://192.168.1.5/jasmine',
- :phantomjs_bin => '~/bin/phantomjs',
- :timeout => 20000,
- :spec_dir => 'spec',
- :all_on_start => false,
- :notification => false,
- :max_error_notify => 5,
- :hide_success => true,
- :keep_failed => false,
- :all_after_pass => false,
- :specdoc => :always,
- :focus => false,
- :clean => false,
- :errors => :always,
- :console => :always,
- :coverage => true,
- :coverage_html => true,
- :coverage_summary => true,
- :statements_threshold => 95,
- :functions_threshold => 90,
- :branches_threshold => 85,
- :lines_threshold => 80
+ server: :jasmine_gem,
+ server_env: 'test',
+ server_timeout: 20,
+ port: 4321,
+ rackup_config: 'spec/dummy/config.ru',
+ jasmine_url: 'http://192.168.1.5/jasmine',
+ phantomjs_bin: '~/bin/phantomjs',
+ timeout: 20000,
+ spec_dir: 'spec',
+ all_on_start: false,
+ notification: false,
+ max_error_notify: 5,
+ hide_success: true,
+ keep_failed: false,
+ all_after_pass: false,
+ specdoc: :always,
+ focus: false,
+ clean: false,
+ errors: :always,
+ console: :always,
+ coverage: true,
+ coverage_html: true,
+ coverage_summary: true,
+ statements_threshold: 95,
+ functions_threshold: 90,
+ branches_threshold: 85,
+ lines_threshold: 80
}) }
it 'sets the :server option' do
@@ -299,31 +299,31 @@
context 'without the jasmine url' do
it 'sets the jasmine gem url' do
- guard = Guard::Jasmine.new(nil, { :server => :jasmine_gem, :port => 4321 })
+ guard = Guard::Jasmine.new(nil, { server: :jasmine_gem, port: 4321 })
guard.options[:jasmine_url].should eql 'http://localhost:4321/'
end
it 'sets the jasminerice url' do
- guard = Guard::Jasmine.new(nil, { :server => :thin, :port => 4321 })
+ guard = Guard::Jasmine.new(nil, { server: :thin, port: 4321 })
guard.options[:jasmine_url].should eql 'http://localhost:4321/jasmine'
end
end
context 'with run all options' do
- let(:guard) { Guard::Jasmine.new(nil, { :run_all => { :test => true } }) }
+ let(:guard) { Guard::Jasmine.new(nil, { run_all: { test: true } }) }
it 'removes them from the default options' do
guard.options[:run_all].should be_nil
end
it 'saves the run_all options' do
- guard.run_all_options.should eql({ :test => true })
+ guard.run_all_options.should eql({ test: true })
end
end
context 'with a port but no jasmine_url option set' do
- let(:guard) { Guard::Jasmine.new(nil, { :port => 4321 }) }
+ let(:guard) { Guard::Jasmine.new(nil, { port: 4321 }) }
it 'sets the port on the jasmine_url' do
guard.options[:jasmine_url].should eql 'http://localhost:4321/jasmine'
@@ -339,7 +339,7 @@
end
context 'with illegal options' do
- let(:guard) { Guard::Jasmine.new(nil, defaults.merge({ :specdoc => :wrong, :server => :unknown })) }
+ let(:guard) { Guard::Jasmine.new(nil, defaults.merge({ specdoc: :wrong, server: :unknown })) }
it 'sets default :specdoc option' do
guard.options[:specdoc].should eql :failure
@@ -360,7 +360,7 @@
end
context 'with a valid PhantomJS executable' do
- let(:guard) { Guard::Jasmine.new(nil, { :phantomjs_bin => '/bin/phantomjs' }) }
+ let(:guard) { Guard::Jasmine.new(nil, { phantomjs_bin: '/bin/phantomjs' }) }
before do
::Guard::Jasmine.stub(:phantomjs_bin_valid?).and_return true
@@ -383,17 +383,17 @@
end
it 'does start a server' do
- server.should_receive(:start).with(hash_including(:server => :jasmine_gem,
- :port => 3333,
- :server_env => 'test',
- :spec_dir => 'spec',
- :rackup_config => nil))
+ server.should_receive(:start).with(hash_including(server: :jasmine_gem,
+ port: 3333,
+ server_env: 'test',
+ spec_dir: 'spec',
+ rackup_config: nil))
guard.start
end
end
context 'with :all_on_start set to true' do
- let(:guard) { Guard::Jasmine.new(nil, { :all_on_start => true }) }
+ let(:guard) { Guard::Jasmine.new(nil, { all_on_start: true }) }
context 'with the Jasmine runner available' do
before do
@@ -419,7 +419,7 @@
end
context 'with :all_on_start set to false' do
- let(:guard) { Guard::Jasmine.new(nil, { :all_on_start => false }) }
+ let(:guard) { Guard::Jasmine.new(nil, { all_on_start: false }) }
before do
::Guard::Jasmine.stub(:runner_available?).and_return true
@@ -435,7 +435,7 @@
describe '.stop' do
context 'with a configured server' do
- let(:guard) { Guard::Jasmine.new(nil, { :server => :thin }) }
+ let(:guard) { Guard::Jasmine.new(nil, { server: :thin }) }
it 'stops the server' do
server.should_receive(:stop)
@@ -444,7 +444,7 @@
end
context 'without a configured server' do
- let(:guard) { Guard::Jasmine.new(nil, { :server => :none }) }
+ let(:guard) { Guard::Jasmine.new(nil, { server: :none }) }
it 'does not stop the server' do
server.should_not_receive(:stop)
@@ -471,7 +471,7 @@
end
describe '.run_all' do
- let(:options) { defaults.merge({ :phantomjs_bin => '/bin/phantomjs' }) }
+ let(:options) { defaults.merge({ phantomjs_bin: '/bin/phantomjs' }) }
let(:guard) { Guard::Jasmine.new(nil, options) }
context 'without a specified spec dir' do
@@ -483,7 +483,7 @@
end
context 'with a specified spec dir' do
- let(:options) { defaults.merge({ :phantomjs_bin => '/bin/phantomjs', :spec_dir => 'specs' }) }
+ let(:options) { defaults.merge({ phantomjs_bin: '/bin/phantomjs', spec_dir: 'specs' }) }
let(:guard) { Guard::Jasmine.new(nil, options) }
it 'starts the Runner with the default spec dir' do
@@ -494,10 +494,10 @@
end
context 'with run all options' do
- let(:guard) { Guard::Jasmine.new(nil, { :run_all => { :specdoc => :overwritten } }) }
+ let(:guard) { Guard::Jasmine.new(nil, { run_all: { specdoc: :overwritten } }) }
it 'starts the Runner with the merged run all options' do
- runner.should_receive(:run).with(['spec'], hash_including({ :specdoc => :overwritten })).and_return [['spec/javascripts/a.js.coffee'], true]
+ runner.should_receive(:run).with(['spec'], hash_including({ specdoc: :overwritten })).and_return [['spec/javascripts/a.js.coffee'], true]