Sha256: 7f3ecc56e15946eec91485e3950da7b0db560173e929a088ff16af804af179eb

Contents?: true

Size: 1.45 KB

Versions: 53

Compression:

Stored size: 1.45 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]
      expect(expectation.message).to eq "a failure message"
      expect(expectation.stack).to eq "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
      expect(expectation).to match(/1/)
      expect(expectation).to match(/7/)
      expect(expectation).to_not match(/8/)
      expect(expectation).to_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
      expect(expectation).to eq 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
      expect(expectation).to match(/No stack/)
    end

  end
end

Version data entries

53 entries across 40 versions & 2 rubygems

Version Path
tdiary-5.2.4 vendor/bundle/ruby/3.1.0/gems/jasmine-2.99.0/spec/result_spec.rb
tdiary-5.2.3 vendor/bundle/ruby/3.1.0/gems/jasmine-2.99.0/spec/result_spec.rb
tdiary-5.2.2 vendor/bundle/ruby/3.1.0/gems/jasmine-2.99.0/spec/result_spec.rb
tdiary-5.2.1 vendor/bundle/ruby/3.1.0/gems/jasmine-2.99.0/spec/result_spec.rb
jasmine-3.99.0 spec/result_spec.rb
tdiary-5.2.0 vendor/bundle/ruby/2.7.0/gems/jasmine-2.99.0/spec/result_spec.rb
tdiary-5.2.0 vendor/bundle/ruby/3.0.0/gems/jasmine-2.99.0/spec/result_spec.rb
jasmine-3.10.0 spec/result_spec.rb
tdiary-5.1.7 vendor/bundle/ruby/3.0.0/gems/jasmine-2.99.0/spec/result_spec.rb
tdiary-5.1.7 vendor/bundle/ruby/2.7.0/gems/jasmine-2.99.0/spec/result_spec.rb
jasmine-3.9.2 spec/result_spec.rb
jasmine-3.9.1 spec/result_spec.rb
jasmine-3.9.0 spec/result_spec.rb
jasmine-3.8.1 spec/result_spec.rb
jasmine-3.8.0 spec/result_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/3.0.0/gems/jasmine-2.99.0/spec/result_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/jasmine-2.99.0/spec/result_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/jasmine-2.99.0/spec/result_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/2.7.0/gems/jasmine-2.99.0/spec/result_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/jasmine-2.99.0/spec/result_spec.rb