Sha256: f4c3e0367c996996f9ee9f5768b840e2a9df7a393ffb76d8ac4c9caacef8eb9d

Contents?: true

Size: 1.6 KB

Versions: 2

Compression:

Stored size: 1.6 KB

Contents

require "spec_helper"

module RSpec::Rails
  describe HelperExampleGroup::InstanceMethods do
    module ::FoosHelper; end
    subject { HelperExampleGroup }

    it { should be_included_in_files_in('./spec/helpers/') }
    it { should be_included_in_files_in('.\\spec\\helpers\\') }

    it "provides a controller_path based on the helper module's name" do
      helper_spec = Object.new.extend HelperExampleGroup::InstanceMethods
      helper_spec.stub_chain(:example, :example_group, :describes).and_return(FoosHelper)
      helper_spec.__send__(:_controller_path).should == "foos"
    end

    it "adds :type => :helper to the metadata" do
      group = RSpec::Core::ExampleGroup.describe do
        include HelperExampleGroup
      end
      group.metadata[:type].should eq(:helper)
    end

    describe "#helper" do
      it "returns the instance of AV::Base provided by AV::TC::Behavior" do
        helper_spec = Object.new.extend HelperExampleGroup::InstanceMethods
        helper_spec.should_receive(:_assigns)
        av_tc_b_view = double('_view')
        av_tc_b_view.should_receive(:assign)
        helper_spec.stub(:_view) { av_tc_b_view }
        helper_spec.helper.should eq(av_tc_b_view)
      end
    end
  end

  describe HelperExampleGroup::ClassMethods do
    describe "determine_default_helper_class" do
      it "returns the helper module passed to describe" do
        helper_spec = Object.new.extend HelperExampleGroup::ClassMethods
        helper_spec.stub(:describes) { FoosHelper }
        helper_spec.determine_default_helper_class("ignore this").
          should eq(FoosHelper)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rspec-rails-2.0.0.beta.22 spec/rspec/rails/example/helper_example_group_spec.rb
rspec-rails-2.0.0.beta.20 spec/rspec/rails/example/helper_example_group_spec.rb