Forum: Ruby on Rails Different boolean expression evaluation between rspec(view) and rails environments

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Pradeep G. (Guest)
on 2008-11-26 17:04
(Received via mailing list)

Maybe its just too late in the day and I should stop :). But I am stuck
at a
very weird issue. Here is an excerpt from my erb file

<% display_invisible_content =  !icon.nil? or (render_detach and
entity.mounted?) %>

(I have certain, non mountable, entities which do not have mounted?
It should not have been a problem because the render_detach is true only
mountable entities)

I have tested this writing a view spec and exercising the case where
icon is
nil and render_detach is false. The spec passed w/o calling the mounted?
method on entity.

When I come across the same scenario on the Rails UI (running in dev
the mounted? method is called on entity despite render_detach being

How is this possible?

Pradeep G. (Guest)
on 2008-11-27 06:59
(Received via mailing list)
Ooops. Perils of coding late in the day. render_detach boolean was
indeed 'true' :)
This topic is locked and can not be replied to.