Sha256: ff29ac1d29f79ec9455173c55ef0478ed6c5cc28ab82a810516512a7c1750b4a

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

require 'spec_helper'
require 'gnawrnip/rspec'

module Gnawrnip
  describe 'Rspec' do
    let(:example) do
      example = group.example('example', {}) { expect(true).to be false }
      group.run(
        Class.new do
          def self.method_missing(name, *args, &block)
            # nooooooop
          end
        end
      )
      example
    end

    before do
      Gnawrnip.photographer.stub(:take_shot)
      Gnawrnip.photographer.stub(:frames) { ['aiueo', nil, 'lllll'] }
    end

    context '"turnip" spec group' do
      let(:group) do
        ::RSpec::Core::ExampleGroup.describe('Feature', turnip: true)
      end

      it 'should save screen shot at error' do
        expect(example.metadata[:gnawrnip][:screenshot]).to eq ['aiueo', 'lllll']
      end
    end

    context 'Not "turnip" spec group' do
      let(:group) do
        ::RSpec::Core::ExampleGroup.describe('Feature')
      end

      it 'should not save screen shot' do
        expect(example.metadata).not_to include(:gnawrnip)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gnawrnip-0.2.5 spec/gnawrnip/rspec_spec.rb
gnawrnip-0.2.4 spec/gnawrnip/rspec_spec.rb