Created
November 7, 2011 16:22
-
-
Save cavalle/1345423 to your computer and use it in GitHub Desktop.
Meatloaf (Just another scam)
This file contains 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
require 'meatloaf' | |
require 'steps' | |
Feature "Eat candies" do | |
Scenario "Eat a candy from a jar full of them" do | |
Given "I have a jar with candies", candies: 10 | |
When "I eat one candy" | |
Then "the jar won't be empty" | |
end | |
Scenario "Eat the last candy" do | |
Given "I have a jar with candies", candies: 1 | |
When "I eat one candy" | |
Then "the jar will be empty" | |
end | |
end |
This file contains 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
# | |
# | \/ | | | | | / _| | |
# | \ / | ___ __ _| |_| | ___ __ _| |_ | |
# | |\/| |/ _ \/ _` | __| |/ _ \ / _` | _| | |
# | | | | __/ (_| | |_| | (_) | (_| | | | |
# |_| |_|\___|\__,_|\__|_|\___/ \__,_|_| | |
# | |
# ~ JUST ANOTHER SCAM ~ | |
# | |
# Get the 95% of Cucumber with just 6 aliases | |
# | |
require 'minitest/spec' | |
alias Feature describe | |
alias Given send | |
alias When send | |
alias Then send | |
class << MiniTest::Spec | |
alias Scenario it | |
end | |
class Module | |
alias Step define_method | |
end |
This file contains 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
module Steps | |
Step "I have a jar with candies" do |attrs| | |
@jar = Jar.new(attrs[:candies]) | |
end | |
Step "I eat one candy" do | |
@jar.eat_candy | |
end | |
Step "the jar will be empty" do | |
@jar.empty?.must_equal true | |
end | |
Step "the jar won't be empty" do | |
@jar.empty?.wont_equal true | |
end | |
end | |
MiniTest::Unit::TestCase.send :include, Steps |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment