Skip to content

Instantly share code, notes, and snippets.

@Nitrodist
Created December 6, 2013 18:13
Show Gist options
  • Save Nitrodist/7829537 to your computer and use it in GitHub Desktop.
Save Nitrodist/7829537 to your computer and use it in GitHub Desktop.
require 'rspec/core'
class TestA
def foo
true
end
def bar
true
end
end
class TestB
def foo
false
end
def bar
false
end
end
shared_examples_for 'a special behaviour' do
let(:expected_foo) { true }
let(:expected_bar) { true }
its(:foo) { should eql(expected_foo) }
its(:bar) { should eql(expected_bar) }
end
describe TestA do
it_should_behave_like 'a special behaviour'
end
describe TestB do
it_should_behave_like 'a special behaviour' do
let(:expected_foo) { false }
let(:expected_bar) { false }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment