[rspec-users] Rspec book issue (mastermind example)

David Chelimsky dchelimsky at gmail.com
Mon Jul 6 15:43:00 EDT 2009


On Mon, Jul 6, 2009 at 2:31 PM,
internetchris<chris at silhouettesolutions.net> wrote:
> Beautiful, that worked great. I sent an e-mail to the pragmatic
> support people to get the latest version of the book. For some reason
> it's not showing up in my Bookshelf.

Great. Thanks for reading it and going through the examples!

Cheers,
David

>
> Thanks David
>
> On Jul 6, 12:01 pm, David Chelimsky <dchelim... at gmail.com> wrote:
>> On Mon, Jul 6, 2009 at 12:51 PM, Chris
>>
>>
>>
>> Sund<ch... at silhouettesolutions.net> wrote:
>> > Hey Everyone,
>>
>> > Just a simple question. I have read and re-read the examples and I'm
>> > not getting the proper output.  I'm on page 73/74 of the Rspec book
>> > and it says I should have "4 steps passed". I think the problem is
>> > within my /step_definition/mastermind.rb" file. It's definitely not
>> > beyond me to make a mistake, but I have checked and double checked my
>> > code and it all looks fine via the book examples. Here's the output
>> > I'm getting...
>>
>> > ______________________________________________________
>>
>> > cucumber features
>> > Feature: code-breaker starts game
>>
>> > As a code-breaker
>> > I want to start a game
>> > So that I can break the code
>>
>> >  Scenario: start game                                # features/
>> > codebreaker_starts_game.feature:7
>> >    Given I am not yet playing                        # features/
>> > step_definitions/mastermind.rb:3
>> >    When I start a new game                           # features/
>> > step_definitions/mastermind.rb:7
>> >    Then the game should say "Welcome to Mastermind!" # features/
>> > codebreaker_starts_game.feature:10
>> >    And the game should say "Enter guess:"            # features/
>> > codebreaker_starts_game.feature:11
>>
>> > 1 scenario (1 undefined)
>> > 4 steps (2 undefined, 2 passed)
>> > 0m0.003s
>>
>> > You can implement step definitions for undefined steps with these
>> > snippets:
>>
>> > Then /^the game should say "([^\"]*)"$/ do |arg1|
>> >  pending
>> > end
>>
>> > _______________________________________________
>>
>> > It seems it doesn't think my "Then" statement is defined, but it is.
>> > My /step_definitions/mastermind.rb file looks like this...
>>
>> > Given /^I am not yet playing$/ do
>> > end
>>
>> > When /^I start a new game$/ do
>> > @messenger = StringIO.new
>> > game = Mastermind::Game.new(@messenger)
>> > game.start
>> > end
>>
>> > Then /^the game should say "(.*)" $/ do |message|
>>
>> There is an extra space here between "(.*)" and $. This should work:
>>
>>   Then /^the game should say "(.*)"$/ do |message|
>>
>> Also, we changed the name of the game in the most recent version of
>> the beta, so you may want to update.
>>
>> Cheers,
>> David
>>
>>
>>
>> > @messenger.string.split("\n" ).should include(message)
>> > end
>>
>> > __________________________________________
>>
>> > It's either a problem with the syntax in the "Then" statement, or my
>> > "message" variable isn't getting defined right. Any help would be
>> > appreciated, and I can provide my other files, but I'm a newbie and
>> > I'm not sure what files would be worth looking at. Let me know and
>> > I'll post them.
>>
>> > Thanks!
>>
>> > Chris
>> > _______________________________________________
>> > rspec-users mailing list
>> > rspec-us... at rubyforge.org
>> >http://rubyforge.org/mailman/listinfo/rspec-users
>>
>> _______________________________________________
>> rspec-users mailing list
>> rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list