Skip to content
Create a gist now

Instantly share code, notes, and snippets.

# it "has the following type signature" do
#, :foo).
# returns_nil.and.
# has_argument(String, "Hello").and.
# has_argument(Fixnum, 123).and
# accepts_block
# end
# I like the following better. Description can be modified,
# I just like the describe to explain the spec
it "receives a String or a Fixnum and an optional block. Returns nil" do
@widget.method(:foo).should take.
#or means that the first arg can take string or fixnum
#optional means that the following clause is optional
it "receives a String and a Fixnum and returns a Fixnum" do
@widget.method(:bar).should take.
#arg should have a second optional
#arg that allows something that responds to to_a
#which lets you specify valid inputs (or invalid for should_not)
#probably need a .throws clause to specify that certain inputs
#will cause an exception
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.