Forum: RSpec [RSpec] Cannot save or be_valid when using xss_terminate

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Fernando P. (Guest)
on 2009-02-02 18:30
Hi,

I have a Rails app that uses xss_terminate to sanitize the user input
before it gets saved to the DB. In my specs when I call @product.should
be_valid or @product.save, I get the following error message:
--
NoMethodError in 'Creating a product with all necessary attributes
should be valid'
undefined method `empty?' for Mon Feb 02 16:59:00 +0100 2009:Time
--

The other error messages are related to xss_terminate source code. Has
anyone had any trouble in specing models that are sanitized by
xss_terminate?


Best regards,
Jonathan L. (Guest)
on 2009-02-02 18:47
(Received via mailing list)
On Feb 2, 2009, at 11:30 AM, Fernando P. wrote:

> --
> rspec-users mailing list
> removed_email_address@domain.invalid
> http://rubyforge.org/mailman/listinfo/rspec-users

I rspec models that use xss_terminate with no problem. I have not see
the error you're getting.

linoj
Fernando P. (Guest)
on 2009-02-02 19:07
> I rspec models that use xss_terminate with no problem. I have not see
> the error you're getting.
>
> linoj

Thanks. Knowing that it is possible to spec models that use
xss_terminate I was able to figure out that in one of my attributes I
was passing a Time object, so simply converting it to a string with to_s
fixed the issue.
This topic is locked and can not be replied to.