The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

@1337807 (7) [Avatar] Offline
#1
When I take out 10
String can't be coerced into Fixnum (TypeError)
./features/step_definitions/account_steps.rb:10:in `-'

Should be:

When I take out 10
undefined method `-' for "100":String (NoMethodError)
./features/step_definitions/account_steps.rb:10:in `/^I take out (d+)$/'

At this stage in the tutorial they should be getting an NoMethodError, the TypeError comes a bit later.

Here is the complete output for me at this step:

https://gist.github.com/2a700ec18e09926d8c7f

accounts•ruby-1.9.3-p125@rails3_in_action•rails3_in_action»» cucumber
Feature: My account
In order to manage my account
As a money minder
I want to ensure my money doesn't get lost

Scenario: Taking out money # features/account.feature:6
Given I have an account # features/step_definitions/account_steps.rb:1
And it has a balance of 100 # features/step_definitions/account_steps.rb:5
When I take out 10 # features/step_definitions/account_steps.rb:9
undefined method `-' for "100":String (NoMethodError)
./features/step_definitions/account_steps.rb:10:in `/^I take out (d+)$/'
features/account.feature:9:in `When I take out 10'
Then my balance should be 90 # features/step_definitions/account_steps.rb:14

Failing Scenarios:
cucumber features/account.feature:6 # Scenario: Taking out money

1 scenario (1 failed)
4 steps (1 failed, 1 skipped, 2 passed)
0m0.002s
ryanbigg (423) [Avatar] Offline
#2
Re: Chapter 2, Listing 2.30
You're missing the `to_i` call on the amount that's coming from that step.
@1337807 (7) [Avatar] Offline
#3
Re: Chapter 2, Listing 2.30
We aren't instructed to add the 'to_i' until Figure 2.31.