Class: LearnTest::Strategies::Jasmine

Inherits:
LearnTest::Strategy show all
Defined in:
lib/learn_test/strategies/jasmine.rb

Instance Attribute Summary

Attributes inherited from LearnTest::Strategy

#options, #runner

Instance Method Summary collapse

Methods inherited from LearnTest::Strategy

#argv, #configure, #die, #initialize, #output, #run_install

Constructor Details

This class inherits a constructor from LearnTest::Strategy

Instance Method Details

#check_dependenciesObject



14
15
16
# File 'lib/learn_test/strategies/jasmine.rb', line 14

def check_dependencies
  Dependencies::PhantomJS.new.execute unless options[:skip]
end

#cleanupObject



56
57
58
59
60
61
62
# File 'lib/learn_test/strategies/jasmine.rb', line 56

def cleanup
  test_xml_files.each do |file|
    FileUtils.rm(file)
  end

  FileUtils.rm_rf("#{Dir.pwd}/tmpTestSupport") if !browser?
end

#detectObject



10
11
12
# File 'lib/learn_test/strategies/jasmine.rb', line 10

def detect
  runner.files.include?('requires.yml')
end

#learn_oauth_tokenObject



72
73
74
# File 'lib/learn_test/strategies/jasmine.rb', line 72

def learn_oauth_token
  options[:skip] ? nil : super
end

#push_results?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/learn_test/strategies/jasmine.rb', line 52

def push_results?
  !local? && !browser?
end

#resultsObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/learn_test/strategies/jasmine.rb', line 33

def results
  @results ||= {
    username: username,
    github_user_id: user_id,
    learn_oauth_token: learn_oauth_token,
    repo_name: runner.repo,
    build: {
      test_suite: [{
        framework: 'jasmine',
        formatted_output: [],
        duration: 0.0
      }]
    },
    tests: 0,
    errors: 0,
    failures: 0
  }
end

#runObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/learn_test/strategies/jasmine.rb', line 18

def run
  require 'crack'
  require 'erb'
  require 'yaml'
  require 'json'

  if options[:init]
    LearnTest::Jasmine::Initializer.run
  else
    set_up_runner
    run_jasmine
    make_json
  end
end

#service_endpointObject



6
7
8
# File 'lib/learn_test/strategies/jasmine.rb', line 6

def service_endpoint
  '/e/flatiron_jasmine'
end

#user_idObject



68
69
70
# File 'lib/learn_test/strategies/jasmine.rb', line 68

def user_id
  options[:skip] ? "none" : super
end

#usernameObject



64
65
66
# File 'lib/learn_test/strategies/jasmine.rb', line 64

def username
  options[:skip] ? "jasmine-flatiron" : super
end