Included Modules

Files

Class/Module Index [+]

Quicksearch

RSpec::Rails::HelperExampleGroup

Extends ActionView::TestCase::Behavior

Examples

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

[Validate]

Generated with the Darkfish Rdoc Generator 2.