Different boolean expression evaluation between rspec(view) and rails environments

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

Ooops. Perils of coding late in the day. render_detach boolean was indeed 'true' :slight_smile: