webrat (0.3.4)
I have this in the view:
I have this in my test:
my_entity = Entity.find_by_entity_name(
“my entity number #{row.hll_words_to_i}”)
within(“div#” + dom_id(my_entity, :list)) do
puts “within method executed for div”
end
within(“div#” + dom_id(my_entity, :list)) do
click_link “Destroy Entity”
end
The first within method prints the trace message
The second within method call blows up with:
within method executed for div
When I delete the “first” entity #
features/app/models/entities/step_definitions/entity_steps.rb:128
You have a nil object when you didn’t expect it!
The error occurred while evaluating nil.to_html (NoMethodError)
/usr/lib64/ruby/gems/1.8/gems/webrat-0.3.4/lib/webrat/core/scope.rb:176:in
scoped_dom' /usr/lib64/ruby/gems/1.8/gems/webrat-0.3.4/lib/webrat/core/scope.rb:158:in
dom’
/usr/lib64/ruby/gems/1.8/gems/webrat-0.3.4/lib/webrat/core/scope.rb:194:in
links' /usr/lib64/ruby/gems/1.8/gems/webrat-0.3.4/lib/webrat/core/locators.rb:80:in
find_link’
/usr/lib64/ruby/gems/1.8/gems/webrat-0.3.4/lib/webrat/core/scope.rb:134:in
click_link' /usr/lib64/ruby/gems/1.8/gems/webrat-0.3.4/lib/webrat/rails.rb:88:in
send’
/usr/lib64/ruby/gems/1.8/gems/webrat-0.3.4/lib/webrat/rails.rb:88:in
`method_missing’
Now, I am reasonably sure that the div selector is working as expected.
It is the click_link method that is failing for some reason. Is this
failure caused by something I have done or is it some problem with
webrat?