Sha256: 748225cc21ffac5583e75f04849c64e169c1ea46e24981e743e5a01ff338b9f1

Contents?: true

Size: 1.72 KB

Versions: 10

Compression:

Stored size: 1.72 KB

Contents

require 'spec_helper'

module TurnipFormatter
  class Step
    describe Failure do
      include_context 'turnip_formatter standard step parameters'
      include_context 'turnip_formatter failure scenario setup'
      include_context 'turnip_formatter standard scenario metadata'

      let(:step) do
        step = ::TurnipFormatter::Step.new(example, description)
        step.extend TurnipFormatter::Step::Failure
        step
      end

      let(:klasses) do
        builtin_klass1 = ::TurnipFormatter::StepTemplate::Source
        builtin_klass2 = ::TurnipFormatter::StepTemplate::Exception
        [builtin_klass1, builtin_klass2]
      end

      it 'exists built-in step template' do
        templates = TurnipFormatter::Step::Failure.templates
        expect(templates.keys).to include(*klasses)
      end

      context 'add custom step template' do
        let :custom_template do
          Module.new do
            def self.build(message)
              '[error] ' + message
            end
          end
        end

        before do
          TurnipFormatter::Step::Failure.add_template(custom_template) do
            example.example_group.description
          end
        end

        after do
          TurnipFormatter::Step::Failure.remove_template(custom_template)
        end

        it 'should get custom step template' do
          templates = TurnipFormatter::Step::Failure.templates
          klasses << custom_template
          expect(templates.keys).to include(*klasses)
        end
      end

      describe '#attention?' do
        subject { step.attention? }
        it { should be_true }
      end

      describe '#status' do
        subject { step.status }
        it { should eq :failure }
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
turnip_formatter-0.2.9 spec/turnip_formatter/step/failure_spec.rb
turnip_formatter-0.2.8 spec/turnip_formatter/step/failure_spec.rb
turnip_formatter-0.2.7 spec/turnip_formatter/step/failure_spec.rb
turnip_formatter-0.2.6 spec/turnip_formatter/step/failure_spec.rb
turnip_formatter-0.2.5 spec/turnip_formatter/step/failure_spec.rb
turnip_formatter-0.2.4 spec/turnip_formatter/step/failure_spec.rb
turnip_formatter-0.2.3 spec/turnip_formatter/step/failure_spec.rb
turnip_formatter-0.2.2 spec/turnip_formatter/step/failure_spec.rb
turnip_formatter-0.2.1 spec/turnip_formatter/step/failure_spec.rb
turnip_formatter-0.2.0 spec/turnip_formatter/step/failure_spec.rb