On Mon, 2008-09-29 at 09:57 +0200, aslak hellesoy wrote: > <snip> > > Try to replace <b>Subject</b> with <label > for="invitation_subject">Subject</label> > Now both vision impaired people and Webrat know that the text > "Subject" is linked to the input field. This is much better semantic > HTML.
Ah, thanks. I'll do that. I had seen the labels in one of my other rails projects. This also makes the Feature a lot more readable. > > Rails generates this as of > http://github.com/rails/rails/commit/3dd6027f708a472064e73a50f4afb433f338bf09 > Sounds like you're using an older Rails... yes.... 2.0.2. Normally I keep my rails apps up to date, but for this one I've use ActiveScaffold quite a bit, and it was broken with 2.1... ActiveScaffold looks pretty inactive, so I'm going to add specs for everything, do the UI manually and then I can let ActiveScaffold go after a while... (It also turned out that the work it saved me in the beginning - spec/test and code Models, declare controllers and views, so it can go without speccing, bit me later... because of the 'clever bastard code' in active scaffold with lots of reflection, stacktraces are pretty incomprehensible - e.g. when I forget to spec something in the model and there is a nullpointer somewhere the same stacktrace appears for every model). Thanks again, Willem > > Aslak > > > <p> > > <b>Cc</b><br /> > > <input id="invitation_cc" name="invitation[cc]" size="30" > > type="text" /> > > </p> > > > > <p> > > <b>Text</b><br /> > > <textarea cols="40" id="invitation_text" name="invitation[text]" > > rows="20"></textarea> > > </p> > > > > <p> > > <input id="invitation_submit" name="commit" type="submit" > > value="Create" /> > > </p> > > </form> > > > > <a href="/invitations">Back</a> > > When I fill in "Subject" with "My invitation subject" > > Could not find [Webrat::TextField, Webrat::TextareaField, > > Webrat::PasswordField]: "Subject" (RuntimeError) > > > > /home/willem/courses/experienceagile/ebay/trunk/excrm/vendor/plugins/webrat/lib/webrat/core/flunk.rb:4:in > > `flunk' > > > > /home/willem/courses/experienceagile/ebay/trunk/excrm/vendor/plugins/webrat/lib/webrat/core/scope.rb:222:in > > `find_field' > > > > /home/willem/courses/experienceagile/ebay/trunk/excrm/vendor/plugins/webrat/lib/webrat/core/scope.rb:25:in > > `fills_in' > > > > /home/willem/courses/experienceagile/ebay/trunk/excrm/vendor/plugins/webrat/lib/webrat/rails/session.rb:24:in > > `send' > > > > /home/willem/courses/experienceagile/ebay/trunk/excrm/vendor/plugins/webrat/lib/webrat/rails/session.rb:24:in > > `method_missing' > > > > /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/integration.rb:448:in > > `send!' > > > > /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/integration.rb:448:in > > `method_missing' > > ./features/steps/common_webrat.rb:14:in `When /^I fill in "(.*)" > > with "(.*)"$/' > > features/manage_invitations.feature:8:in `When I fill in "Subject" > > with "My invitation subject"' > > <h1>New invitation</h1> > > > > > > > > <form action="/invitations" class="new_invitation" id="new_invitation" > > method="post"> > > <p> > > <b>Subject</b><br /> > > <input id="invitation_subject" name="invitation[subject]" size="30" > > type="text" /> > > </p> > > > > <p> > > <b>Cc</b><br /> > > <input id="invitation_cc" name="invitation[cc]" size="30" > > type="text" /> > > </p> > > > > <p> > > <b>Text</b><br /> > > <textarea cols="40" id="invitation_text" name="invitation[text]" > > rows="20"></textarea> > > </p> > > > > <p> > > <input id="invitation_submit" name="commit" type="submit" > > value="Create" /> > > </p> > > </form> > > > > <a href="/invitations">Back</a> > > And I fill in "CC" with "My invitation cc" > > <h1>New invitation</h1> > > > > > > > > <form action="/invitations" class="new_invitation" id="new_invitation" > > method="post"> > > <p> > > <b>Subject</b><br /> > > <input id="invitation_subject" name="invitation[subject]" size="30" > > type="text" /> > > </p> > > > > <p> > > <b>Cc</b><br /> > > <input id="invitation_cc" name="invitation[cc]" size="30" > > type="text" /> > > </p> > > > > <p> > > <b>Text</b><br /> > > <rake aborted! > > Command failed with status (1): [/usr/bin/ruby1.8 -I > > "/home/willem/courses/...] > > /usr/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:974:in `sh' > > /usr/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:987:in `call' > > /usr/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:987:in `sh' > > /usr/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:1084:in `sh' > > /usr/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:1019:in `ruby' > > /usr/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:1084:in `ruby' > > /home/willem/courses/experienceagile/ebay/trunk/excrm/vendor/plugins/cucumber/lib/cucumber/rake/task.rb:47:in > > `define_tasks' > > /usr/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:621:in `call' > > /usr/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:621:in `execute' > > /usr/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:616:in `each' > > /usr/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:616:in `execute' > > /usr/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:582:in > > `invoke_with_call_chain' > > /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize' > > /usr/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:575:in > > `invoke_with_call_chain' > > /usr/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:568:in `invoke' > > /usr/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2031:in `invoke_task' > > /usr/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2009:in `top_level' > > /usr/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2009:in `each' > > /usr/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2009:in `top_level' > > /usr/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2048:in > > `standard_exception_handling' > > /usr/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2003:in `top_level' > > /usr/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:1982:in `run' > > /usr/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2048:in > > `standard_exception_handling' > > /usr/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:1979:in `run' > > /usr/lib/ruby/gems/1.8/gems/rake-0.8.2/bin/rake:31 > > /usr/bin/rake:19:in `load' > > /usr/bin/rake:19 > > textarea cols="40" id="invitation_text" name="invitation[text]" > > rows="20"></textarea> > > </p> > > > > <p> > > <input id="invitation_submit" name="commit" type="submit" > > value="Create" /> > > </p> > > </form> > > > > <a href="/invitations">Back</a> > > And I fill in "Text" with "My invitation text" > > And I press "Create" > > Then I should see "My invitation subject" > > And I should see "My invitation cc" > > And I should see "My invitation text" > > > > Scenario: Delete invitation > > Given there are 4 invitations > > When I delete the first invitation > > Then there should be 3 invitations left > > > > |initial|after| > > |100|99| > > |1|0| > > > > 10 steps passed > > 1 steps failed > > 6 steps skipped > > > >> Also check log/test.log. > > (apologies for the ESC characters, less doesn't seem to recognize the > > colours....) > > > > Processing InvitationsController#new (for 127.0.0.1 at 2008-09-29 > > 08:55:04) [GET] > > Session ID: 56bcf61f1eb75b3e8c973a21bca504d0 > > Parameters: {"action"=>"new", "controller"=>"invitations"} > > ESC[4;35;1mSQL (0.004048)ESC[0m ESC[0m SELECT a.attname, > > format_type(a.atttypid, a.atttypmod), d. > > adsrc, a.attnotnull > > FROM pg_attribute a LEFT JOIN pg_attrdef d > > ON a.attrelid = d.adrelid AND a.attnum = d.adnum > > WHERE a.attrelid = 'invitations'::regclass > > AND a.attnum > 0 AND NOT a.attisdropped > > ORDER BY a.attnum > > ESC[0m > > Rendering invitations/new > > Completed in 0.01889 (52 reqs/sec) | Rendering: 0.00598 (31%) | DB: > > 0.00550 (29%) | 200 OK [http://ww > > w.example.com/invitations/new] > > REQUESTING PAGE: POST /invitations with {"commit"=>"Create", > > "invitation"=>{"cc"=>"", "text"=>"", "su > > bject"=>""}} > > > > > > Processing InvitationsController#create (for 127.0.0.1 at 2008-09-29 > > 08:55:04) [POST] > > Session ID: > > BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo% > > 0ASGFzaHsABjoKQHVzZWR7AA%3 > > D%3D--4a442a5c5f1558d51188e7e418677dedf9dd2717 > > Parameters: {"commit"=>"Create", "action"=>"create", > > "controller"=>"invitations", "invitation"=>{"c > > c"=>"", "text"=>"", "subject"=>""}} > > ESC[4;36;1mPK and serial sequence (0.005058)ESC[0m ESC[0;1m SELECT > > attr.attname, seq.relname > > FROM pg_class seq, > > pg_attribute attr, > > pg_depend dep, > > pg_namespace name, > > pg_constraint cons > > WHERE seq.oid = dep.objid > > AND seq.relkind = 'S' > > AND attr.attrelid = dep.refobjid > > AND attr.attnum = dep.refobjsubid > > AND attr.attrelid = cons.conrelid > > AND attr.attnum = cons.conkey[1] > > AND cons.contype = 'p' > > AND dep.refobjid = 'invitations'::regclass > > ESC[0m > > ESC[4;35;1mInvitation Create (0.001065)ESC[0m ESC[0mINSERT INTO > > invitations ("cc", "updated_at", > > "text", "subject", "created_at") VALUES(E'', '2008-09-29 > > 08:55:04.858034', E'', E'', '2008-09-29 08:55:04.858034')ESC[0m > > ESC[4;36;1mSQL (0.000500)ESC[0m ESC[0;1mSELECT > > currval('invitations_id_seq')ESC[0m > > Redirected to http://www.example.com/invitations/1 > > Completed in 0.01049 (95 reqs/sec) | DB: 0.00662 (63%) | 302 Found > > [http://www.example.com/invitations] > > > > > > Willem > >> > >> Aslak > >> > >> > It might indicate, as Aslak says in the readme, it is recommended to > >> > create your features by hand. On the other hand, it would also be > >> > convenient if the combination of generate feature and generate > >> > rspec_scaffold works out of the box. :) > >> > > >> > I'm going to play a bit more with it - too early to send in my own fix > >> > for the feature generator I guess. I am willing to make it if you want > >> > it though. > >> > > >> > Willem > >> > > >> > _______________________________________________ > >> > rspec-users mailing list > >> > rspec-users@rubyforge.org > >> > http://rubyforge.org/mailman/listinfo/rspec-users > >> > > > > > _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users