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 CounterTestHelpers | |
def counter | |
@counter = @counter || Counter.new | |
#or @counter ||= Counter.new | |
end | |
end | |
World(CounterTestHelpers) |
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
World(Test::Unit::Assertions) |
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 'test/unit/assertions' | |
require File.join(File.dirname(__FILE__), "..", "..", "lib", "counter.rb") |
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
Then /^the count should be (\d+)$/ do |result| | |
unless @counter.count == result.to_i | |
raise "Expected count #{result} but was #{@counter.count}" | |
end | |
end | |
Then /^the count is (\d+)$/ do |result| | |
@counter.count == result.to_i | |
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
When /^I add (\d+)$/ do |count| | |
@calculator.add(count.to_i) | |
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
Given /^a new counter$/ do | |
@counter = Counter.new | |
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
Feature: Addition | |
Scenario: Basic Addition | |
Given a new counter | |
When I add 3 | |
Then the count should be 3 | |
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
backdoor "enterThroughHere:", {:option => "value", :arg =>[]} | |
=> "Output" |
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
user_pref "username" | |
=> nil | |
set_user_pref "username", "krukow" | |
=> ["krukow"] | |
user_pref "username" | |
=> "krukow" | |
set_user_pref "username", "karl" |
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
def set_location(options) | |
#options[:latitude], options[:longitude] or #options[:place] | |
end | |
def location_for_place(place) | |
end | |
set_location :place => "Tower of London" | |
set_location :place => "eBay Classified Aarhus" |