Class: Kender::Jasmine

Inherits:
Command show all
Defined in:
lib/kender/commands/jasmine.rb

Overview

Jasmine is a unit testing framework for javascript similar to rspec.

Instance Attribute Summary

Attributes inherited from Command

#success

Instance Method Summary collapse

Methods inherited from Command

all, all_names, all_success?, commands, #execute, inherited, #name, #run

Instance Method Details

#available?Boolean

check whether to actually run this command

Returns:

  • (Boolean)


6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/kender/commands/jasmine.rb', line 6

def available?
  # do not run if running shamus
  return false if ENV['VALIDATE_PROJECT']

  # make sure those gems were added
  return false unless in_gemfile?("jasmine")

  # verify jasmine and phantomjs are both present
  `phantomjs --version 2>&1 > /dev/null`
  return false unless $?.success?
  `bundle exec jasmine license`
  $?.success?
end

#commandObject



20
21
22
23
24
25
26
27
# File 'lib/kender/commands/jasmine.rb', line 20

def command
  if in_gemfile?("jasmine-phantom")
    #This is nicer as will install phantomJS for us.
    'bundle exec rake jasmine:phantom:ci'
  else
    'bundle exec rake jasmine:ci'
  end
end