# ActiveRecord validation erros with cucumber/webrat

**URL:** <https://www.ruby-forum.com/t/activerecord-validation-erros-with-cucumber-webrat/184358>\
**Category:** Rails\
**Created:** [March 1, 2010, 12:43pm UTC](https://www.ruby-forum.com/t/activerecord-validation-erros-with-cucumber-webrat/184358 "2010-03-01T12:43:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zloy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/b4bc9f/32.png) [@zloy](https://www.ruby-forum.com/u/zloy)\
**Post date:** [March 1, 2010, 12:43pm UTC](https://www.ruby-forum.com/t/activerecord-validation-erros-with-cucumber-webrat/184358/1 "2010-03-01T12:43:08Z")

</div>

Hi,  
I’m implementing user registration Cucumber scenario. Intentionally  
leaving CAPTCHA solution field empty I expect to pass my custom

THEN I should see “Captcha solution could not be blank”  
(not exactly that message because of i18n, doesn’t matter)

but the scenario fails with the message: "expected the following  
element’s content to include “Captcha solution could not be blank”.

Inspecting response content which was flushed below the error message I  
could not find any validation error message indeed. That is why I doubt  
validation was done at all.

Filling registration form with right the same data and posting it from  
browser (in same env) results in expected validation errors appear  
whithin the form.

So, my questions are:

1. should Rails behavior in cucumber and development environments be  
equal if /config/environments/cucumber.rb equals  
/config/environments/cucumber.rb in case they operate same data?

2. should ActiveRecord validation messages appear when cucumber scenario  
fills a form with wrong values?

thanks in advance!

---

<div class="post-metadata">

**Author:** ![zloy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/b4bc9f/32.png) [@zloy](https://www.ruby-forum.com/u/zloy)\
**Post date:** [March 1, 2010, 2:45pm UTC](https://www.ruby-forum.com/t/activerecord-validation-erros-with-cucumber-webrat/184358/2 "2010-03-01T14:45:28Z")

</div>

Zhoran T. wrote:

> Hi,  
> I’m implementing user registration Cucumber scenario. Intentionally  
> leaving CAPTCHA solution field empty I expect to pass my custom
> 
> THEN I should see “Captcha solution could not be blank”  
> (not exactly that message because of i18n, doesn’t matter)
> 
> but the scenario fails with the message: "expected the following  
> element’s content to include “Captcha solution could not be blank”.
> 
> Inspecting response content which was flushed below the error message I  
> could not find any validation error message indeed. That is why I doubt  
> validation was done at all.

just checked out that the error message appears at the page opended by  
save\_and\_open\_page right before failing THEN statement. Validation was  
done, that’s good.

Any ideas why it absents in the page dump which cucumber produces after  
THEN failing?
