Skip to content

Instantly share code, notes, and snippets.

@tcshao
Created June 11, 2013 15:12
Show Gist options
  • Save tcshao/5757685 to your computer and use it in GitHub Desktop.
Save tcshao/5757685 to your computer and use it in GitHub Desktop.
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