Sha256: df7fae84f96a5dbc0452b0ec5ffea68ac30756d5898dab77a0f229edb71c6b3a

Contents?: true

Size: 1.94 KB

Versions: 1

Compression:

Stored size: 1.94 KB

Contents

require 'spec_helper'

module TurnipFormatter::Scenario
  describe Pass do
    let(:scenario) { ::TurnipFormatter::Scenario::Pass.new(example) }

    include_context 'turnip_formatter scenario setup', proc {
      expect(true).to be_true
    }

    context 'Turnip example' do
      let(:metadata) do
        {
          steps: { descriptions: ['Step 1'], docstrings: [[]], keywords: ['When'], tags: [] },
          file_path: '/path/to/hoge.feature'
        }
      end

      describe '#validation' do
        it 'should not raise exception' do
          expect { scenario.validation }.not_to raise_error
        end
      end

    end

    context 'Not Turnip example' do
      context 'Not passed example' do
        let(:metadata) do
          {
            steps: { descriptions: ['Step 1'], docstrings: [[]], keywords: ['When'], tags: [] },
            file_path: '/path/to/hoge.feature'
          }
        end

        include_context 'turnip_formatter scenario setup', proc {
          expect(true).to be_false
        }

        describe '#validation' do
          it 'should raise exception' do
            expect { scenario.validation }.to raise_error NotPassedScenarioError
          end
        end        
      end

      context 'not exist feature file' do
        let(:metadata) do
          {
            steps: { descriptions: ['Step 1'], docstrings: [[]], keywords: ['When'], tags: [] },
            file_path: '/path/to/hoge.rb'
          }
        end

        describe '#validation' do
          it 'should raise exception' do
            expect { scenario.validation }.to raise_error NoFeatureFileError
          end
        end
      end

      context 'not exist step information' do
        let(:metadata) { { file_path: '/path/to/hoge.rb' } }

        describe '#validation' do
          it 'should raise exception' do
            expect { scenario.validation }.to raise_error NotExistStepsInformationError
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
turnip_formatter-0.0.1 spec/turnip_formatter/scenario/pass_spec.rb