Sha256: e57f65c0a436e4f14af9f329498524303f88343b725bc9352b3bfc1551cd3b54

Contents?: true

Size: 845 Bytes

Versions: 1

Compression:

Stored size: 845 Bytes

Contents

require "spec_helper"
require "fixtures/example_controller"

describe BetterHelpers::Railties::Filter do

  let :include_module do
    ExampleController.send :include, BetterHelpers::Railties::Filter
  end

  it "configures 'prepend_before_filter' with 'better_helpers_store_request'" do
    expect(ExampleController).to receive(:prepend_before_filter).with(:better_helpers_store_request)
    include_module
  end

  describe "#better_helpers_store_request" do
    let :instance do
      include_module
      ExampleController.new
    end

    let :namespace do
      BetterHelpers::Railties::RequestContext::NAME
    end

    before do
      instance.better_helpers_store_request
    end

    it "stores 'self' into 'Thread.current' under request context namespace" do
      expect(Thread.current[namespace]).to eql instance
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
better_helpers-0.1.3 spec/better_helpers/railties/filter_spec.rb