Module RSpec::Rails::HelperExampleGroup
In: lib/rspec/rails/example/helper_example_group.rb

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

Included Modules

RSpec::Rails::RailsExampleGroup ActionView::TestCase::Behavior RSpec::Rails::ViewAssigns

Classes and Modules

Module RSpec::Rails::HelperExampleGroup::ClassMethods
Module RSpec::Rails::HelperExampleGroup::InstanceMethods

[Validate]