Skip to content

Instantly share code, notes, and snippets.

@noam87
Created August 3, 2015 23:19
Show Gist options
  • Save noam87/faa5edcd0abbbc750af8 to your computer and use it in GitHub Desktop.
Save noam87/faa5edcd0abbbc750af8 to your computer and use it in GitHub Desktop.
Passing variables
shared_examples 'BlueprintBase' do
subject { described_class.new('') }
describe '#alert_type' do
it "is defined" do
expect(subject.alert_type).to eq(alert_type)
end
end
end
# batting_now_spec.rb
require 'spec_helper'
describe Pulse::Payload::Baseball::BattingNow do
include_examples 'BlueprintBase'
it_behaves_like 'BlueprintBase' do
let(:alert_type) { 'batting_now'}
end'
end
# Failure/Error: expect(subject.alert_type).to eq(alert_type)
# NameError:
# undefined local variable or method `alert_type' for #<RSpec::ExampleGroups::PulsePayloadBaseballBattingNow::AlertType:0x0000000a6ef370>
# Shared Example Group: "BlueprintBase" called from ./spec/new_pulse/pulse/payload/baseball/batting_now_spec.rb:4
# # ./spec/new_pulse/pulse/shared/blueprint_base.rb:18:in `block (3 levels) in <top (required)>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment