Hi!
I have a view:
<% restrict_to ‘admin’ do %>
What’s the best way to spec view in this case - I just want to yield
block in restrict_to call.
Thanks in advance,
Yury
Hi!
I have a view:
<% restrict_to ‘admin’ do %>
What’s the best way to spec view in this case - I just want to yield
block in restrict_to call.
Thanks in advance,
Yury
On Mon, Aug 11, 2008 at 2:05 AM, Yury K. [email protected]
wrote:
What’s the best way to spec view in this case - I just want to yield block
in restrict_to call.
Here’s one way:
it “should render detail for admin” do
template.should_receive(:restrict_to).with(‘admin’).and_yield
template.expect_render(:partial => ‘detail’)
render ‘path/to/view’
end
it “should not render detail for non-admin” do
template.should_receive(:restrict_to).with(‘admin’)
template.expect_render(:partial => ‘detail’).never
render ‘path/to/view’
end
Cheers,
David
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs