[rspec-users] Where to start after writing feature
Pat Maddox
pergesu at gmail.com
Mon Dec 8 15:32:22 EST 2008
In the future, if you're going to +1 his advice could you please include
it in your email? I have to go searching for it now.
Pat
"Andrew Premdas" <apremdas at gmail.com> writes:
> +1 to Davids advice
>
> But first I would analyse the feature I've written. Some of the things I'd think about include
>
> 1) The use of the word task - its not very precise
> 2) The assumptions made in my story and whether I'm ready to make these yet
>
> a) That a task will have a name
> b) That only English users will be using this page
> c) That people will now what a CAS link is
> ...
>
> 3) The brittleness of what I've written - what will change and how will I have to modify what I've done
>
> So my initial scenario might be
>
> When I create a new improvement
> I should see a confirmation
>
> and my second scenario might be
>
> Given there are some improvements
> I should be able to view improvements
>
> Finally have a think about whether this feature is actually important enough to be doing first.
>
> HTH
>
> 2008/12/5 Stephen Veit <srveit at gmail.com>
>
> I am trying to develop code from the feature on down.
>
> So I created a brand new rails app. It has no models yet. I wrote a feature:
>
> Feature: Add tasks
> In order to track website improvements
> a user
> wants to add tasks
>
> Scenario: User adds task
> Given task "Display Group Rules" does not exist
> When I visit "/tasks/new"
> And I fill in "Name" with "Display Group Rules"
> And I fill in "Description" with "Displays links to edit each group rule"
> And I fill in "CAS Link" with "GroupRulesManager/"
> And I press "Submit"
> Then I should end up on the Tasks page
> And I should see "Task successfully added"
> And the task "Display Group Rules" should exist
>
> I then run:
>
> rake db:migrate (this creates my development SQLite3 database)
> rake db:test:prepare (this creates my development SQLite3 database)
> rake features (outputs the following:)
>
> Feature: Add tasks # features/manage_task.feature
> In order to track website improvements
> a user
> wants to add tasks
> Scenario: User adds task
> Given task "Display Group Rules" does not exist
> When I visit "/tasks/new"
> And I fill in "Name" with "Display Group Rules"
> And I fill in "Description" with "Displays links to edit each group rule"
> And I fill in "CAS Link" with "GroupRulesManager/"
> And I press "Submit"
> Then I should end up on the Tasks page
> And I should see "Task successfully added"
> And the task "Display Group Rules" should exist
>
> 5 steps skipped
> 4 steps pending
>
> You can use these snippets to implement pending steps:
>
> Given /^task "Display Group Rules" does not exist$/ do
> end
>
> When /^I visit "\/tasks\/new"$/ do
> end
>
> Then /^I should end up on the Tasks page$/ do
> end
>
> Then /^the task "Display Group Rules" should exist$/ do
> end
>
> My question is where to go from here. Do I implement the four pending steps, e.g:
>
> Given /^task "(.+)" does not exist$/ do |name|
> task = Task.find_by_name(name)
> task.destroy if task
> end
>
> Or do I run:
>
> ./script/generate scaffold_resource task name:string description:text cas_link:string
>
> and the rake rspec and fix whatever errors show up there?
>
> What are your thoughts? TIA
>
> --
> Stephen Veit
> 314-616-9688
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://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