| Module | RSpec::Rails::HelperExampleGroup |
| In: |
lib/rspec/rails/example/helper_example_group.rb
|
Extends ActionView::TestCase::Behavior
describe RoleBasedDisplayHelper do
describe "display_for" do
context "given the role of the current user" do
it "yields to the block" do
helper.stub(:current_user) { double(:roles => ['admin'] }
text = helper.display_for('admin') { "this text" }
text.should eq("this text")
end
end
context "given a different role that that of the current user" do
it "renders an empty String" do
helper.stub(:current_user) { double(:roles => ['manager'] }
text = helper.display_for('admin') { "this text" }
text.should eq("")
end
end
end
end