Created
June 11, 2013 15:12
-
-
Save tcshao/5757685 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Workflow | |
def process | |
you_should_do_this_first | |
then_you_should_do_this | |
this_will_be_done_last | |
end | |
end | |
class Headhunter < Workflow | |
def you_should_do_this_first | |
puts("Lock the target") | |
end | |
def then_you_should_do_this | |
puts("Bait the line") | |
end | |
def this_will_be_done_last | |
puts("Spread the net") | |
end | |
end | |
template = Headhunter.new() | |
template.process | |
# begin tests | |
describe Headhunter do | |
subject { Headhunter.new() } | |
it { should respond_to(:you_should_do_this_first) } | |
it { should respond_to(:then_you_should_do_this) } | |
it { should respond_to(:this_will_be_done_last) } | |
it "should call methods in order" do | |
hh = Headhunter.new() | |
hh.should_receive(:process) | |
hh.should_receive(:you_should_do_this_first) | |
hh.process | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment