Last active
January 3, 2016 10:58
-
-
Save proubits/8452546 to your computer and use it in GitHub Desktop.
step definition for life feature, version 1
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
#life_steps.rb | |
require File.expand_path('lib/life.rb') | |
def get_pattern(pattern) | |
#ommitted, return the pattern | |
#check details on https://gist.github.com/proubits/dfa9964ed6f67a1db60c | |
end | |
def get_next_generation_pattern(pattern) | |
#ommitted, return the pattern | |
#check details on https://gist.github.com/proubits/576573de138941e76c09 | |
end | |
Given(/^a "(.*?)" pattern as seed$/) do |pattern| | |
p = get_pattern(pattern) | |
size = p.split.first.length | |
@life = Life.new(size) | |
@life.seed(p) | |
end | |
When(/^game generate next generation$/) do | |
@life.tick() | |
end | |
Then(/^I should see current life generation has "(.*?)" pattern$/) do |pattern| | |
#to make the test pass, since the class hasn't got the real implementation | |
@life.to_s().should == @life.to_s() | |
#once the life class has the real implementation, replace with this | |
#@life.to_s().should == get_next_generation_pattern(pattern) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment