I am trying to do some Cucumber testing like the following:
Given I am logged in as admin
When I go to the article page
Then I should see "Edit Article"
And I should see "Article Title"
where the path to the article page is "articles/1" or some known id.The problem is that when I insert my data using my step definition
Article.create(:name => "Article Title")
I can't know ahead of time what the id will be when the record is inserted.
Essentially, I either need
a) to be able to insert predictable ids. I've tried the method mentioned in the answer of this question but it doesn't seem to work for me - it always inserts a different id.
or
b) write my cucumber steps in such a way that I can pass in a parameter for my Article id
All Cucumber tutorials I've seen sort of gloss over this type of scenario - it's always going to the list of all Articles or whatever, never a specific detail page.
Any help would be appreciated. Thanks!