Sha256: 9ade8ec6019ece6a8dff9287e0e933ea70756a04b04b050fd575d26156e92e7f

Contents?: true

Size: 991 Bytes

Versions: 3

Compression:

Stored size: 991 Bytes

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::Animation.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

3 entries across 3 versions & 1 rubygems

Version Path
gnawrnip-0.1.2 spec/gnawrnip/rspec_spec.rb
gnawrnip-0.1.1 spec/gnawrnip/rspec_spec.rb
gnawrnip-0.1.0 spec/gnawrnip/rspec_spec.rb