Sha256: 15cb8510810b81a1c113a21451c80c2793df8fbab580f66c15153007bbde26ee

Contents?: true

Size: 1.63 KB

Versions: 10

Compression:

Stored size: 1.63 KB

Contents

require 'spec_helper'

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

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

      let(:klasses) do
        builtin_klass = ::TurnipFormatter::StepTemplate::Exception
        [builtin_klass]
      end

      it 'exists built-in step template' do
        templates = TurnipFormatter::Step::Pending.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)
              '[pending] ' + message
            end
          end
        end

        before do
          TurnipFormatter::Step::Pending.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::Pending.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 :pending }
      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/pending_spec.rb
turnip_formatter-0.2.8 spec/turnip_formatter/step/pending_spec.rb
turnip_formatter-0.2.7 spec/turnip_formatter/step/pending_spec.rb
turnip_formatter-0.2.6 spec/turnip_formatter/step/pending_spec.rb
turnip_formatter-0.2.5 spec/turnip_formatter/step/pending_spec.rb
turnip_formatter-0.2.4 spec/turnip_formatter/step/pending_spec.rb
turnip_formatter-0.2.3 spec/turnip_formatter/step/pending_spec.rb
turnip_formatter-0.2.2 spec/turnip_formatter/step/pending_spec.rb
turnip_formatter-0.2.1 spec/turnip_formatter/step/pending_spec.rb
turnip_formatter-0.2.0 spec/turnip_formatter/step/pending_spec.rb