Sha256: ac71af9193f80af0a5b29d6a092d083854982f484f856df69ab785452415a108

Contents?: true

Size: 1.23 KB

Versions: 19

Compression:

Stored size: 1.23 KB

Contents

require 'cucumber/wire/exception'
require 'cucumber/wire/configuration'

module Cucumber
  module Wire
    describe Exception do
      before(:each) do
        @config = Configuration.new('host' => 'localhost', 'port' => 54321)
      end

      def exception
        Wire::Exception.new(@data, @config)
      end

      describe "with just a message" do
        before(:each) do
          @data = {'message' => 'foo'}
        end

        it "#to_s as expecteds" do
          expect(exception.to_s).to eq "foo"
        end
      end

      describe "with a message and an exception" do
        before(:each) do
          @data = {'message' => 'foo', 'exception' => 'Bar'}
        end

        it "#to_s as expecteds" do
          expect(exception.to_s).to eq "foo"
        end

        it "#class.to_s returns the name of the exception" do
          expect(exception.class.to_s).to eq 'Bar from localhost:54321'
        end
      end

      describe "with a custom backtrace" do
        before(:each) do
          @data = {'message' => 'foo', 'backtrace' => ['foo', 'bar', 'baz']}
        end

        it "#backrace returns the custom backtrace" do
          expect(exception.backtrace).to eq ['foo', 'bar', 'baz']
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 3 rubygems

Version Path
cucumber-wire-6.2.1 spec/cucumber/wire/exception_spec.rb
phillipug-foodie-0.1.0 .vendor/ruby/3.0.0/gems/cucumber-wire-6.2.0/spec/cucumber/wire/exception_spec.rb
cucumber-wire-6.2.0 spec/cucumber/wire/exception_spec.rb
cucumber-wire-6.1.1 spec/cucumber/wire/exception_spec.rb
cucumber-wire-6.1.0 spec/cucumber/wire/exception_spec.rb
cucumber-wire-6.0.1 spec/cucumber/wire/exception_spec.rb
cucumber-wire-6.0.0 spec/cucumber/wire/exception_spec.rb
cucumber-wire-5.0.1 spec/cucumber/wire/exception_spec.rb
cucumber-wire-5.0.0 spec/cucumber/wire/exception_spec.rb
cucumber-wire-4.0.1 spec/cucumber/wire/exception_spec.rb
cucumber-wire-3.1.0 spec/cucumber/wire/exception_spec.rb
cucumber-wire-3.0.0 spec/cucumber/wire/exception_spec.rb
cucumber-wire-2.0.1 spec/cucumber/wire/exception_spec.rb
cucumber-wire-2.0.0 spec/cucumber/wire/exception_spec.rb
cucumber-wire-1.2.0 spec/cucumber/wire/exception_spec.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/cucumber-wire-0.0.1/spec/cucumber/wire/exception_spec.rb
cucumber-wire-1.1.0 spec/cucumber/wire/exception_spec.rb
cucumber-wire-1.0.0 spec/cucumber/wire/exception_spec.rb
cucumber-wire-0.0.1 spec/cucumber/wire/exception_spec.rb