spec/gnawrnip/rspec_spec.rb in gnawrnip-0.0.1 vs spec/gnawrnip/rspec_spec.rb in gnawrnip-0.0.2

- old
+ new

@@ -2,11 +2,10 @@ require 'gnawrnip/rspec' module Gnawrnip describe 'Rspec' do let(:example) do - group = ::RSpec::Core::ExampleGroup.describe('Feature') example = group.example('example', {}) { expect(true).to be_false } group.run( Class.new do def self.method_missing(name, *args, &block) # nooooooop @@ -14,10 +13,26 @@ end ) example end - it 'should save screen shot at error' do - expect(example.metadata[:turnip][:screenshot]).to eq "c2NyZWVuc2hvdA==\n" + 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 "c2NyZWVuc2hvdA==\n" + 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