Module: RSpec::Rails::HelperExampleGroup

Extended by:
ActiveSupport::Concern, ModuleInclusion
Includes:
ActionView::TestCase::Behavior, BrowserSimulators, RailsExampleGroup, ViewAssigns
Defined in:
lib/rspec/rails/example/helper_example_group.rb

Overview

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

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Method Summary

Methods included from ModuleInclusion

include_self_when_dir_matches

Methods included from BrowserSimulators

included