davedub (12) [Avatar] Offline
#1
I'm in Chapter 8, but I'm seeing a failure after making changes called for there back on the viewing_projects.feature. It seems as though after signing in as ticketee.com, and going to the page you get to after you have signed in as a user (not as an admin), there is no listing of projects that I can view as a user. I am getting this error:

Scenario: Listing all projects # features/viewing_projects.feature:15
And I am on the homepage # features/step_definitions/project_steps.rb:1
Then I should not see "Internet Explorer" # features/step_definitions/project_steps.rb:33
When I follow "TextMate 2" # features/step_definitions/project_steps.rb:9
no link with title, id or text 'TextMate 2' found (Capybara::ElementNotFound)
(eval):2:in `click_link'
./features/step_definitions/project_steps.rb:10:in `/^I follow "([^"]*)"$/'
features/viewing_projects.feature:18:in `When I follow "TextMate 2"'
Then I should be on the project page for "TextMate 2" # features/step_definitions/project_steps.rb:29

I can see why, because there is nothing in the page that I am redirected to (and I am not sure how that is happening!) that lists projects. Here is the text it shows when I use save_and_open_page command (from Capybara) as part of my test:

Signed in successfully.
Ticketee <which is a link>
Signed in as user@ticketee.com
Sign in <which is a link>
Projects <which is not a link>

I mean, it says Projects, but it doesn't list any of them so there is no way to "follow 'TextMate 2'" ...

Must be missing something but can't seem to find anything that generates projects that are readable by the user anywhere in a view. Any ideas??

Thanks.
davedub (12) [Avatar] Offline
#2
Re: Viewing_Projects.feature error on "When I follow TextMate 2"
I have investigated this further, although I still don't have a solution.

A similar test for hidden_links.feature passes. Using "save_and_open_page," I see that with that test, the link to "TextMate 2" appears on the signed-in page for "user@ticketee.com," but it does not appear when I hit the signed-in page for "user@ticketee.com" running the viewing_projects.feature. What's weird is that both feature files use the same *_step.rb files - don't they?

Does this mean I have a problem with the wording of the viewing_projects.feature file, but not the actual code in the app?

I really can't seem to figure out the disparity in results between running these two feature tests!
davedub (12) [Avatar] Offline
#3
Re: Viewing_Projects.feature error on "When I follow TextMate 2"
Now, even odder, I have been able to use the Launchy gem to check the output of the page, and I can see that the page has the link once I modify the "Listing Projects" scenario a tad (see below) but I STILL fail the test on "When I follow "TextMate 2" - for "no link with title, id or text 'TextMate 2' found (Capybara::ElementNotFound)"

Scenario: Listing projects
Given I am signed in as "user@ticketee.com"
And I am on the homepage
Then I should not see "Internet Explorer"
When I follow "TextMate 2"
Then I should be on the project page for "TextMate 2"

And when I run Rails Server, and I sign up as user@ticketee.com, and I sign in with password, the link does not appear ... completely stumped!

Message was edited by:
drollwit
davedub (12) [Avatar] Offline
#4
Re: Viewing_Projects.feature error on "When I follow TextMate 2"
Closing out this little thread ...

I wanted to *not* use web_steps.rb in doing the exercises in this book because I agree with the philosophy of "taking the training wheels off." Up until Ch.8, I had managed to write my own steps that passed the tests. But in Ch. 8, what was being described in the book became totally out of whack with what was happening in my own tests.

So I see now that this book really requires web_steps.rb. Once I modified my steps files to go back to using that file, all the odd, inexplicable test results went away. Seems like a pity that the book relies on the presence of web_steps.rb when the creator of Cucumber urges people not to use it, but such is life.

Moderator, if you'd like to delete this entire thread, feel free.

Message was edited by:
drollwit
ryanbigg (423) [Avatar] Offline
#5
Re: Viewing_Projects.feature error on "When I follow TextMate 2"
Sorry for not replying sooner, been busy touring...

The book was written to rely on web_steps.rb because that's what the current version of Cucumber supported. There was *no* deprecation warning for this, only murmurings that web_steps.rb would be going away "soon". In the software development world, "soon" could mean anything from tomorrow until 10 years from now (see Duke Nukem Forever).

So we wrote the book with web_steps.rb in mind. That version of cucumber-rails is 1.0.6.

I personally would love to update the book to remove the reliance on the web_steps.rb file, but I don't know how Manning would feel about that given that it would DEFINITELY break their page layout. Such is the life of a book that is both printed and electronically delivered...