jasmine 2.0.0.rc2 → 2.0.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +9 -11
- data/Gemfile +4 -2
- data/HOW_TO_TEST.markdown +1 -1
- data/README.markdown +23 -14
- data/RELEASE.markdown +6 -13
- data/Rakefile +21 -23
- data/jasmine.gemspec +9 -16
- data/{generators/jasmine/templates/jasmine-example/spec → lib/generators/jasmine/examples/templates/spec/javascripts/helpers/jasmine_examples}/SpecHelper.js +0 -0
- data/lib/generators/jasmine/examples/templates/spec/javascripts/jasmine_examples/PlayerSpec.js +1 -1
- data/lib/generators/jasmine/install/templates/spec/javascripts/support/jasmine.yml +15 -2
- data/lib/generators/jasmine/install/templates/spec/javascripts/support/jasmine_helper.rb +2 -2
- data/lib/jasmine.rb +5 -7
- data/lib/jasmine/asset_bundle.rb +9 -10
- data/lib/jasmine/command_line_install.txt +13 -0
- data/lib/jasmine/command_line_tool.rb +100 -58
- data/lib/jasmine/config.rb +25 -13
- data/lib/jasmine/configuration.rb +21 -16
- data/lib/jasmine/dependencies.rb +1 -1
- data/lib/jasmine/formatters/console.rb +21 -13
- data/lib/jasmine/formatters/exit_code.rb +21 -0
- data/lib/jasmine/formatters/multi.rb +25 -0
- data/lib/jasmine/result.rb +46 -0
- data/lib/jasmine/run.html.erb +3 -1
- data/lib/jasmine/runners/phantom_jasmine_run.js +54 -0
- data/lib/jasmine/runners/phantom_js.rb +29 -0
- data/lib/jasmine/tasks/jasmine.rake +42 -21
- data/lib/jasmine/version.rb +1 -1
- data/spec/configuration_spec.rb +34 -72
- data/spec/fixture/coffee_spec.coffee +3 -0
- data/spec/fixture/failing_runner.rb +9 -0
- data/spec/fixture/failing_test.js +5 -0
- data/spec/fixture/large_test_suite_spec.js +20 -0
- data/spec/jasmine_command_line_tool_spec.rb +94 -52
- data/spec/jasmine_pojs_spec.rb +37 -21
- data/spec/jasmine_rails_spec.rb +89 -49
- data/spec/lib/jasmine/formatters/console_spec.rb +50 -35
- data/spec/lib/jasmine/formatters/multi_spec.rb +17 -0
- data/spec/performance/phantom_js_runner_performance_spec.rb +23 -0
- data/spec/result_spec.rb +34 -0
- data/spec/spec_helper.rb +40 -16
- metadata +34 -84
- data/generators/jasmine/jasmine_generator.rb +0 -25
- data/generators/jasmine/templates/INSTALL +0 -9
- data/generators/jasmine/templates/jasmine-example/spec/PlayerSpec.js +0 -58
- data/generators/jasmine/templates/jasmine-example/src/Player.js +0 -22
- data/generators/jasmine/templates/jasmine-example/src/Song.js +0 -7
- data/generators/jasmine/templates/lib/tasks/jasmine.rake +0 -8
- data/generators/jasmine/templates/spec/javascripts/support/jasmine-rails.yml +0 -81
- data/generators/jasmine/templates/spec/javascripts/support/jasmine.yml +0 -88
- data/generators/jasmine/templates/spec/javascripts/support/jasmine_helper.rb +0 -12
- data/lib/generators/jasmine/examples/templates/spec/javascripts/helpers/SpecHelper.js +0 -15
- data/lib/jasmine/firebug/firebug-1.6.2.xpi +0 -0
- data/lib/jasmine/firebug/firebug-1.7.0.xpi +0 -0
- data/lib/jasmine/firebug/firebug-license.txt +0 -30
- data/lib/jasmine/firebug/firebug.rb +0 -30
- data/lib/jasmine/formatters/base.rb +0 -9
- data/lib/jasmine/formatters/junit_xml.rb +0 -47
- data/lib/jasmine/reporters/api_reporter.rb +0 -38
- data/lib/jasmine/results.rb +0 -38
- data/lib/jasmine/results_processor.rb +0 -38
- data/lib/jasmine/run_specs.rb +0 -33
- data/lib/jasmine/runners/http.rb +0 -33
- data/lib/jasmine/selenium_driver.rb +0 -45
- data/spec/asset_expander_spec.rb +0 -13
- data/spec/asset_pipeline_mapper_spec.rb +0 -19
- data/spec/jasmine_command_line_tool_rakeless_spec.rb +0 -20
- data/spec/lib/jasmine/formatters/base_spec.rb +0 -9
- data/spec/lib/jasmine/formatters/junit_xml_spec.rb +0 -55
- data/spec/lib/jasmine/reporters/api_reporter_spec.rb +0 -53
- data/spec/lib/jasmine/runners/http_spec.rb +0 -21
- data/spec/results_processor_spec.rb +0 -3
- data/spec/results_spec.rb +0 -69
- data/spec/support/fake_selenium_driver.rb +0 -35
@@ -1,38 +0,0 @@
|
|
1
|
-
module Jasmine
|
2
|
-
module Reporters
|
3
|
-
#TODO: where does this live?
|
4
|
-
class ApiReporter < Struct.new(:driver, :batch_size)
|
5
|
-
STARTED_JS = "return jsApiReporter && jsApiReporter.started"
|
6
|
-
FINISHED_JS = "return jsApiReporter && jsApiReporter.finished"
|
7
|
-
|
8
|
-
def started?
|
9
|
-
driver.eval_js STARTED_JS
|
10
|
-
end
|
11
|
-
|
12
|
-
def finished?
|
13
|
-
driver.eval_js FINISHED_JS
|
14
|
-
end
|
15
|
-
|
16
|
-
def results
|
17
|
-
index = 0
|
18
|
-
spec_results = []
|
19
|
-
|
20
|
-
loop do
|
21
|
-
slice = get_results_slice(index)
|
22
|
-
spec_results << slice
|
23
|
-
index += batch_size
|
24
|
-
|
25
|
-
break if slice.size < batch_size
|
26
|
-
end
|
27
|
-
|
28
|
-
spec_results.flatten
|
29
|
-
end
|
30
|
-
|
31
|
-
private
|
32
|
-
|
33
|
-
def get_results_slice(index)
|
34
|
-
driver.eval_js("return jsApiReporter.specResults(#{index}, #{batch_size})")
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
data/lib/jasmine/results.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
module Jasmine
|
2
|
-
class Results
|
3
|
-
attr_reader :results
|
4
|
-
|
5
|
-
def initialize(raw_results)
|
6
|
-
@results = raw_results.map {|raw| Result.new(raw) }
|
7
|
-
end
|
8
|
-
|
9
|
-
def failures
|
10
|
-
@results.select { |result|
|
11
|
-
result.status == "failed"
|
12
|
-
}
|
13
|
-
end
|
14
|
-
|
15
|
-
def pending_specs
|
16
|
-
@results.select { |result|
|
17
|
-
result.status == "pending"
|
18
|
-
}
|
19
|
-
end
|
20
|
-
|
21
|
-
def size
|
22
|
-
@results.size
|
23
|
-
end
|
24
|
-
|
25
|
-
class Result < OpenStruct
|
26
|
-
def full_name
|
27
|
-
fullName
|
28
|
-
end
|
29
|
-
|
30
|
-
def failed_expectations
|
31
|
-
failedExpectations.map { |e|
|
32
|
-
short_stack = e["stack"].split("\n").slice(0, 7).join("\n")
|
33
|
-
OpenStruct.new(:message => e["message"], :stack => short_stack)
|
34
|
-
}
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
module Jasmine
|
2
|
-
class ResultsProcessor
|
3
|
-
|
4
|
-
def initialize(config)
|
5
|
-
@config = config
|
6
|
-
end
|
7
|
-
|
8
|
-
def process(results_hash, suites_hash)
|
9
|
-
Jasmine::Results.new(results_hash, suites_hash, example_locations)
|
10
|
-
end
|
11
|
-
|
12
|
-
def example_locations
|
13
|
-
# example_locations = {}
|
14
|
-
# example_name_parts = []
|
15
|
-
# previous_indent_level = 0
|
16
|
-
# @config.spec_files_full_paths.each do |filename|
|
17
|
-
# line_number = 1
|
18
|
-
# File.open(filename, "r") do |file|
|
19
|
-
# file.readlines.each do |line|
|
20
|
-
# match = /^(\s*)(describe|it)\s*\(\s*["'](.*)["']\s*,\s*function/.match(line)
|
21
|
-
# if (match)
|
22
|
-
# indent_level = match[1].length / 2
|
23
|
-
# example_name = match[3]
|
24
|
-
# example_name_parts[indent_level] = example_name
|
25
|
-
|
26
|
-
# full_example_name = example_name_parts.slice(0, indent_level + 1).join(" ")
|
27
|
-
# example_locations[full_example_name] = "#{filename}:#{line_number}: in `it'"
|
28
|
-
# end
|
29
|
-
# line_number += 1
|
30
|
-
# end
|
31
|
-
# end
|
32
|
-
# end
|
33
|
-
# example_locations
|
34
|
-
{}
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
end
|
data/lib/jasmine/run_specs.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
$:.unshift(ENV['JASMINE_GEM_PATH']) if ENV['JASMINE_GEM_PATH'] # for gem testing purposes
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'jasmine'
|
5
|
-
require 'rspec'
|
6
|
-
|
7
|
-
Jasmine.load_configuration_from_yaml
|
8
|
-
|
9
|
-
config = Jasmine.config
|
10
|
-
|
11
|
-
server = Jasmine::Server.new(config.port, Jasmine::Application.app(config))
|
12
|
-
driver = Jasmine::SeleniumDriver.new(config.browser, "#{config.host}:#{config.port}/")
|
13
|
-
t = Thread.new do
|
14
|
-
begin
|
15
|
-
server.start
|
16
|
-
rescue ChildProcess::TimeoutError
|
17
|
-
end
|
18
|
-
# # ignore bad exits
|
19
|
-
end
|
20
|
-
t.abort_on_exception = true
|
21
|
-
Jasmine::wait_for_listener(config.port, 'jasmine server')
|
22
|
-
puts 'jasmine server started.'
|
23
|
-
|
24
|
-
reporter = Jasmine::Reporters::ApiReporter.new(driver, config.result_batch_size)
|
25
|
-
raw_results = Jasmine::Runners::HTTP.new(driver, reporter).run
|
26
|
-
results = Jasmine::Results.new(raw_results)
|
27
|
-
|
28
|
-
config.formatters.each do |formatter_class|
|
29
|
-
formatter = formatter_class.new(results)
|
30
|
-
formatter.format()
|
31
|
-
end
|
32
|
-
|
33
|
-
exit results.failures.size
|
data/lib/jasmine/runners/http.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
module Jasmine
|
2
|
-
module Runners
|
3
|
-
class HTTP < Struct.new(:driver, :reporter)
|
4
|
-
def run
|
5
|
-
driver.connect
|
6
|
-
ensure_connection_established
|
7
|
-
wait_for_suites_to_finish_running
|
8
|
-
|
9
|
-
results = reporter.results
|
10
|
-
|
11
|
-
driver.disconnect
|
12
|
-
results
|
13
|
-
end
|
14
|
-
|
15
|
-
private
|
16
|
-
|
17
|
-
def ensure_connection_established
|
18
|
-
started = Time.now
|
19
|
-
until reporter.started? do
|
20
|
-
raise "couldn't connect to Jasmine after 60 seconds" if (started + 60 < Time.now)
|
21
|
-
sleep 0.1
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def wait_for_suites_to_finish_running
|
26
|
-
puts "Waiting for suite to finish in browser ..."
|
27
|
-
until reporter.finished? do
|
28
|
-
sleep 0.1
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
module Jasmine
|
2
|
-
require 'json'
|
3
|
-
class SeleniumDriver
|
4
|
-
def initialize(browser, http_address)
|
5
|
-
require 'selenium-webdriver'
|
6
|
-
|
7
|
-
selenium_server = if Jasmine.config.selenium_server
|
8
|
-
Jasmine.config.selenium_server
|
9
|
-
elsif Jasmine.config.selenium_server_port
|
10
|
-
"http://localhost:#{Jasmine.config.selenium_server_port}/wd/hub"
|
11
|
-
end
|
12
|
-
options = if browser == 'firefox-firebug'
|
13
|
-
require File.join(File.dirname(__FILE__), 'firebug/firebug')
|
14
|
-
(profile = Selenium::WebDriver::Firefox::Profile.new)
|
15
|
-
profile.enable_firebug
|
16
|
-
{:profile => profile}
|
17
|
-
end || {}
|
18
|
-
@driver = if Jasmine.config.webdriver
|
19
|
-
Jasmine.config.webdriver
|
20
|
-
elsif selenium_server
|
21
|
-
Selenium::WebDriver.for :remote, :url => selenium_server, :desired_capabilities => browser.to_sym
|
22
|
-
else
|
23
|
-
Selenium::WebDriver.for browser.to_sym, options
|
24
|
-
end
|
25
|
-
@http_address = http_address
|
26
|
-
end
|
27
|
-
|
28
|
-
def connect
|
29
|
-
@driver.navigate.to @http_address
|
30
|
-
end
|
31
|
-
|
32
|
-
def disconnect
|
33
|
-
@driver.quit
|
34
|
-
end
|
35
|
-
|
36
|
-
def eval_js(script)
|
37
|
-
result = @driver.execute_script(script)
|
38
|
-
JSON.parse("{\"result\":#{result.to_json}}", :max_nesting => false)['result']
|
39
|
-
end
|
40
|
-
|
41
|
-
def json_generate(obj)
|
42
|
-
JSON.generate(obj)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
data/spec/asset_expander_spec.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Jasmine::AssetExpander do
|
4
|
-
it "expands asset files" do
|
5
|
-
bundled_asset = double(:bundled_asset, :assets => ['asset1_path', 'asset2_path'])
|
6
|
-
bundled_asset_factory = double(:bundled_asset_factory)
|
7
|
-
bundled_asset_factory.should_receive(:new).with('asset_file').and_return(bundled_asset)
|
8
|
-
expander = Jasmine::AssetExpander.new(bundled_asset_factory)
|
9
|
-
expanded_assets = expander.expand('/some_src_dir', 'asset_file')
|
10
|
-
expanded_assets.should == ['/asset1_path?body=true',
|
11
|
-
'/asset2_path?body=true']
|
12
|
-
end
|
13
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Jasmine::AssetPipelineMapper do
|
4
|
-
it "expands asset paths if available" do
|
5
|
-
expander = lambda do |dir, path|
|
6
|
-
if dir == "/some_location/" && path == 'asset1'
|
7
|
-
['asset1', 'asset2']
|
8
|
-
elsif dir == "/some_location/" && path == 'asset2'
|
9
|
-
['asset1', 'asset3']
|
10
|
-
end
|
11
|
-
|
12
|
-
end
|
13
|
-
config = double(:config, :src_dir => "/some_location/")
|
14
|
-
|
15
|
-
mapper = Jasmine::AssetPipelineMapper.new(config, expander)
|
16
|
-
|
17
|
-
mapper.map_src_paths(['asset1', 'asset2', 'asset4']).should == ['asset1', 'asset2', 'asset3', 'asset4']
|
18
|
-
end
|
19
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Jasmine command line tool" do
|
4
|
-
context "when rake has not been required yet" do
|
5
|
-
before :each do
|
6
|
-
temp_dir_before
|
7
|
-
Dir::chdir @tmp
|
8
|
-
end
|
9
|
-
|
10
|
-
after :each do
|
11
|
-
temp_dir_after
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should append to an existing Rakefile" do
|
15
|
-
FileUtils.cp("#{@old_dir}/spec/fixture/Rakefile", @tmp)
|
16
|
-
output = capture_stdout { Jasmine::CommandLineTool.new.process ["init"] }
|
17
|
-
output.should =~ /Jasmine has been installed with example specs./
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'nokogiri'
|
3
|
-
|
4
|
-
describe Jasmine::Formatters::JUnitXml do
|
5
|
-
describe '#summary' do
|
6
|
-
describe 'when the full suite passes' do
|
7
|
-
it 'shows the spec counts' do
|
8
|
-
results = OpenStruct.new(:size => 1, :failures => [], :pending_specs => [],
|
9
|
-
:results => [passing_result(fullName: 'Passing test', description: 'test')])
|
10
|
-
subject = Jasmine::Formatters::JUnitXml.new(results)
|
11
|
-
|
12
|
-
xml = Nokogiri::XML(subject.summary)
|
13
|
-
|
14
|
-
testsuite = xml.xpath('/testsuites/testsuite').first
|
15
|
-
testsuite['tests'].should == '1'
|
16
|
-
testsuite['failures'].should == '0'
|
17
|
-
testsuite['name'].should == 'Passing'
|
18
|
-
|
19
|
-
xml.xpath('//testcase').size.should == 1
|
20
|
-
xml.xpath('//testcase').first['name'].should == 'test'
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe 'when there are failures' do
|
25
|
-
it 'shows the spec counts' do
|
26
|
-
results = OpenStruct.new(:size => 2, :failures => [failing_result], :pending_specs=> [],
|
27
|
-
:results => [passing_result, failing_result])
|
28
|
-
subject = Jasmine::Formatters::JUnitXml.new(results)
|
29
|
-
|
30
|
-
xml = Nokogiri::XML(subject.summary)
|
31
|
-
|
32
|
-
testsuite = xml.xpath('/testsuites/testsuite').first
|
33
|
-
testsuite['tests'].should == '1'
|
34
|
-
testsuite['failures'].should == '0'
|
35
|
-
|
36
|
-
testsuite = xml.xpath('/testsuites/testsuite')[1]
|
37
|
-
testsuite['tests'].should == '1'
|
38
|
-
testsuite['failures'].should == '1'
|
39
|
-
|
40
|
-
xml.xpath('//testcase').size.should == 2
|
41
|
-
xml.xpath('//testcase/failure').size.should == 1
|
42
|
-
xml.xpath('//testcase/failure').first['message'].should == 'a failure message'
|
43
|
-
xml.xpath('//testcase/failure').first.content.should == 'a stack trace'
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def failing_result(options = {})
|
49
|
-
Jasmine::Results::Result.new(failing_raw_result.merge(options))
|
50
|
-
end
|
51
|
-
|
52
|
-
def passing_result(options = {})
|
53
|
-
Jasmine::Results::Result.new(passing_raw_result.merge(options))
|
54
|
-
end
|
55
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Jasmine::Reporters::ApiReporter do
|
4
|
-
let(:driver) { FakeSeleniumDriver.new }
|
5
|
-
let(:batch_size) { 3 }
|
6
|
-
subject { Jasmine::Reporters::ApiReporter.new(driver, batch_size) }
|
7
|
-
|
8
|
-
describe '#started?' do
|
9
|
-
it "reflects that Jasmine has started" do
|
10
|
-
driver.should_receive(:eval_js).with(Jasmine::Reporters::ApiReporter::STARTED_JS).and_return(false)
|
11
|
-
|
12
|
-
driver.start
|
13
|
-
|
14
|
-
subject.should_not be_started
|
15
|
-
|
16
|
-
driver.should_receive(:eval_js).with(Jasmine::Reporters::ApiReporter::STARTED_JS).and_return(true)
|
17
|
-
|
18
|
-
driver.start
|
19
|
-
|
20
|
-
subject.should be_started
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe '#finished?' do
|
25
|
-
it "reflects that Jasmine has finished" do
|
26
|
-
driver.should_receive(:eval_js).with(Jasmine::Reporters::ApiReporter::FINISHED_JS).and_return(false)
|
27
|
-
|
28
|
-
subject.should_not be_finished
|
29
|
-
|
30
|
-
driver.should_receive(:eval_js).with(Jasmine::Reporters::ApiReporter::FINISHED_JS).and_return(true)
|
31
|
-
|
32
|
-
driver.finish
|
33
|
-
|
34
|
-
subject.should be_finished
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
describe "#results" do
|
39
|
-
it "gets all of the results" do
|
40
|
-
driver.should_receive(:eval_js).with("return jsApiReporter.specResults(0, 3)").and_return(driver.results.slice(0, 3))
|
41
|
-
driver.should_receive(:eval_js).with("return jsApiReporter.specResults(3, 3)").and_return(driver.results.slice(3, 4))
|
42
|
-
|
43
|
-
results = subject.results
|
44
|
-
|
45
|
-
results.size.should == 4
|
46
|
-
results[0]['id'].should == 1
|
47
|
-
results[1]['id'].should == 2
|
48
|
-
results[2]['id'].should == 3
|
49
|
-
results[3]['id'].should == 4
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Jasmine::Runners::HTTP do
|
4
|
-
let(:driver) { FakeSeleniumDriver.new }
|
5
|
-
let(:batch_size) { 3 }
|
6
|
-
let(:reporter) { Jasmine::Reporters::ApiReporter.new(driver, batch_size) }
|
7
|
-
subject { Jasmine::Runners::HTTP.new(driver, reporter) }
|
8
|
-
|
9
|
-
describe '#run' do
|
10
|
-
it "gets the results from the Jasmine HTML page" do
|
11
|
-
driver.should_receive(:connect)
|
12
|
-
driver.should_receive(:disconnect)
|
13
|
-
reporter.should_receive(:results).and_return(driver.results)
|
14
|
-
reporter.stub(:started?).and_return(true)
|
15
|
-
reporter.stub(:finished?).and_return(true)
|
16
|
-
|
17
|
-
results = subject.run
|
18
|
-
results.size.should == 4
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
data/spec/results_spec.rb
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Jasmine::Results do
|
4
|
-
describe "#failures" do
|
5
|
-
it "should report all the failing spec" do
|
6
|
-
subject = Jasmine::Results.new([failing_raw_result, failing_raw_result])
|
7
|
-
subject.failures.size.should == 2
|
8
|
-
|
9
|
-
subject = Jasmine::Results.new([failing_raw_result, passing_raw_result])
|
10
|
-
subject.failures.size.should == 1
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
describe "#pending_specs" do
|
15
|
-
it "should report all the pending specs" do
|
16
|
-
subject = Jasmine::Results.new([pending_raw_result, pending_raw_result])
|
17
|
-
subject.pending_specs.size.should == 2
|
18
|
-
|
19
|
-
subject = Jasmine::Results.new([pending_raw_result, passing_raw_result])
|
20
|
-
subject.pending_specs.size.should == 1
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe "#size" do
|
25
|
-
it "should report the spec count" do
|
26
|
-
subject = Jasmine::Results.new([failing_raw_result, failing_raw_result])
|
27
|
-
subject.size.should == 2
|
28
|
-
|
29
|
-
subject = Jasmine::Results.new([failing_raw_result])
|
30
|
-
subject.size.should == 1
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
35
|
-
|
36
|
-
describe Jasmine::Results::Result do
|
37
|
-
describe "data accessors" do
|
38
|
-
it "delegates to raw results" do
|
39
|
-
result = Jasmine::Results::Result.new("status" => "failed")
|
40
|
-
result.status.should == "failed"
|
41
|
-
end
|
42
|
-
|
43
|
-
it "remaps important camelCase names to snake_case" do
|
44
|
-
result = Jasmine::Results::Result.new(failing_raw_result)
|
45
|
-
result.full_name.should == "a suite with a failing spec"
|
46
|
-
end
|
47
|
-
|
48
|
-
it "exposes failed expectations" do
|
49
|
-
result = Jasmine::Results::Result.new(failing_raw_result)
|
50
|
-
|
51
|
-
expectation = result.failed_expectations[0]
|
52
|
-
expectation.message.should == "a failure message"
|
53
|
-
expectation.stack.should == "a stack trace"
|
54
|
-
end
|
55
|
-
|
56
|
-
it "exposes only the last 7 lines of the stack trace" do
|
57
|
-
raw_result = failing_raw_result
|
58
|
-
raw_result["failedExpectations"][0]["stack"] = "1\n2\n3\n4\n5\n6\n7\n8\n9"
|
59
|
-
|
60
|
-
result = Jasmine::Results::Result.new(raw_result)
|
61
|
-
expectation = result.failed_expectations[0].stack
|
62
|
-
expectation.should match(/1/)
|
63
|
-
expectation.should match(/7/)
|
64
|
-
expectation.should_not match(/8/)
|
65
|
-
expectation.should_not match(/9/)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|