Skip to content

Instantly share code, notes, and snippets.

@reactormonk
Created May 30, 2010 16:12
Show Gist options
  • Select an option

  • Save reactormonk/419133 to your computer and use it in GitHub Desktop.

Select an option

Save reactormonk/419133 to your computer and use it in GitHub Desktop.
suite "Plain Ruby", :use => :basic_verifications do
setup do
@a = 1
@b = 2
@result = 3
@type = Integer
end
exercise "Adding 1 and 2" do
@a + @b
end
verify "returns an Integer" do
kind_of(@type)
end
verify "returns 3" do
returns(@result)
end
end
suite "Plain Ruby" do
setup do
@a = 1
@b = 2
@expected_result = 3
@expected_type = Integer
end
exercise "Adding 1 and 2" do
@actual_result = @a + @b
end
verify "returns an Integer" do
@actual_result.kind_of?(@expected_type)
end
then_verify "returns 3" do
@actual_result == @expected_result
end
end
suite "Plain Ruby", :use => [:basic_verifications, :tabular_data] do
setup.tabular_data %{
@a | @b | @result | @type
1 | 1 | 1 | Integer
6 | 2.0f | 3.0f | Float
6 | 3 | 2.0f | Float
6 | 4 | 1 | Integer
}
exercise ":a / :b" do
@a / @b
end
verify "returns an :type" do
kind_of(@type)
end
then_verify "returns :result" do
returns(@result)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment