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



19
20
21
# File 'lib/learn_test/strategies/jasmine.rb', line 19

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

#cleanupObject



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

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

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

#detectObject



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

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

#push_results?Boolean

Returns:

  • (Boolean)


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

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

#resultsObject



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

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

#runObject



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

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

#service_endpointObject



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

def service_endpoint
  '/e/flatiron_jasmine'
end

#user_idObject



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

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

#usernameObject



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

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