Skip to content

Instantly share code, notes, and snippets.

@squarism
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save squarism/0bbdd2731fbf72605a9f to your computer and use it in GitHub Desktop.
Save squarism/0bbdd2731fbf72605a9f to your computer and use it in GitHub Desktop.
Hi spec
# I know what you are saying about the composition.
# I know that this simple example doesn't represent the
# composability that you probably trying to do.
# But this is how I would do what you want.
# You already know all this so I'm wasting your time actually.
# =>
# hi!
# hi!
# hello!
# hi!
describe "something" do
def hi
puts "hi!"
end
context "hi upfront" do
before do
hi
end
it "works" do
expect(10).to eq(helper)
end
it "really works" do
expect(11).to eq(helper)
end
end
context "hello before hi" do
before do
puts "hello!"
hi
end
it "really really works" do
expect(11).to eq(helper)
end
end
def helper
11
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment