Hi Aslak,
thanks for responding (more below).
On Mon, 2008-09-29 at 08:48 +0200, aslak hellesoy wrote:
manage_invitations.feature):
In the definition of “When I fill in…” you can add this debug
statement on the first line:
puts response.body
Ok.
That should help you find the reason. Please post the HTML you see for
the failing step.
Done, see below. It seems WebRat goes looking for the id
(invitation_subject) and can’t find it if you write
When I fill in “Subject” with “My invitation subject”,
but does find
When I fill in “invitation_subject” with “My invitation subject”,
The way it is generated communicates much better with the customer of
course… (it is the fields label, maybe the label in the html
generated by rspec_scaffold should not be Subject but something
else? ).
trace with HTML:
Feature: Manage invitations
In order to keep track of invitations
A invitation mechanic
Should be able to manage several invitations
Scenario: Register new invitation
Given I am on the new invitation page
New invitation
Subject
Cc
Text
Back
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”’
New invitation
Subject
Cc
Text
Back
And I fill in “CC” with “My invitation cc”
New invitation
Subject
Cc
Text
Back
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