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

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.
Pradeep G. (Guest)
on 2008-11-26 17:04
(Received via mailing list)
Hi,

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?
method.
It should not have been a problem because the render_detach is true only
for
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
mode),
the mounted? method is called on entity despite render_detach being
false!!!

How is this possible?

Pradeep
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.