Sha256: 3bbd3446e772fe75164da79e9d0590b0038721b4ae19abcd7899c385890258a3

Contents?: true

Size: 1.42 KB

Versions: 14

Compression:

Stored size: 1.42 KB

Contents

require 'spec_helper'

describe Jasmine::Result do
  describe "data accessors" do
    it "exposes failed expectations" do
      result = Jasmine::Result.new(failing_raw_result)
      expectation = result.failed_expectations[0]
      expectation.message.should == "a failure message"
      expectation.stack.should == "a stack trace"
    end

    it "exposes only the last 7 lines of the stack trace" do
      raw_result = failing_raw_result
      raw_result["failedExpectations"][0]["stack"] = "1\n2\n3\n4\n5\n6\n7\n8\n9"

      result = Jasmine::Result.new(raw_result)
      expectation = result.failed_expectations[0].stack
      expectation.should match(/1/)
      expectation.should match(/7/)
      expectation.should_not match(/8/)
      expectation.should_not match(/9/)
    end

    it "exposes the full stack trace when configured" do
      stack_trace = "1\n2\n3\n4\n5\n6\n7\n8\n9"
      raw_result = failing_raw_result
      raw_result["failedExpectations"][0]["stack"] = stack_trace

      result = Jasmine::Result.new(raw_result.merge!("show_full_stack_trace" => true))
      expectation = result.failed_expectations[0].stack
      expectation.should == stack_trace
    end

    it "handles failed specs with no stack trace" do
      raw_result = failing_result_no_stack_trace

      result = Jasmine::Result.new(raw_result)
      expectation = result.failed_expectations[0].stack
      expectation.should match(/No stack/)
    end

  end
end

Version data entries

14 entries across 12 versions & 2 rubygems

Version Path
tdiary-5.0.5 vendor/bundle/gems/jasmine-2.5.2/spec/result_spec.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/jasmine-2.5.2/spec/result_spec.rb
tdiary-5.0.5 vendor/bundle/gems/jasmine-2.6.0/spec/result_spec.rb
jasmine-2.6.0 spec/result_spec.rb
tdiary-5.0.4 vendor/bundle/gems/jasmine-2.5.2/spec/result_spec.rb
jasmine-2.5.2 spec/result_spec.rb
tdiary-5.0.2 vendor/bundle/gems/jasmine-2.4.0/spec/result_spec.rb
jasmine-2.5.1 spec/result_spec.rb
jasmine-2.5.0 spec/result_spec.rb
tdiary-5.0.1 vendor/bundle/gems/jasmine-2.4.0/spec/result_spec.rb
jasmine-2.4.0 spec/result_spec.rb
jasmine-2.3.1 spec/result_spec.rb
jasmine-2.3.0 spec/result_spec.rb
jasmine-2.2.0 spec/result_spec.rb