Class: Guard::JasmineTask

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/guard/jasmine/task.rb

Overview

Provides a method to define a Rake task that runs the Jasmine specs.

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (JasmineTask) initialize(name = :jasmine, options = '') {|JasmineTask| ... }

Initialize the Rake task

Yields:



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/guard/jasmine/task.rb', line 27

def initialize(name = :jasmine, options = '')
  @name    = name
  @options = options

  yield self if block_given?

  namespace :guard do
    desc 'Run all Jasmine specs'
    task(name) do
      begin
        ::Guard::Jasmine::CLI.start(self.options.split)

      rescue SystemExit => e
        case e.status
        when 1
          fail 'Some specs have failed'
        when 2
          fail "The spec couldn't be run: #{ e.message }'"
        end
      end
    end
  end
end

Instance Attribute Details

- (Object) name

Name of the main, top level task



16
17
18
# File 'lib/guard/jasmine/task.rb', line 16

def name
  @name
end

- (Object) options

CLI options



19
20
21
# File 'lib/guard/jasmine/task.rb', line 19

def options
  @options
end