Sha256: ed69737243209cc126b5bf9bf5a9eb56d5e8ee900ca1b39c4dcca31f9d55a9b1

Contents?: true

Size: 1.2 KB

Versions: 12

Compression:

Stored size: 1.2 KB

Contents

shared_examples_for "view helpers" do |subject|
  describe "#helpers" do
    it "returns the current view context" do
      Draper::ViewContext.stub current: :current_view_context
      expect(subject.helpers).to be :current_view_context
    end

    it "is aliased to #h" do
      Draper::ViewContext.stub current: :current_view_context
      expect(subject.h).to be :current_view_context
    end
  end

  describe "#localize" do
    it "delegates to #helpers" do
      subject.stub helpers: double
      subject.helpers.should_receive(:localize).with(:an_object, some: "parameter")
      subject.localize(:an_object, some: "parameter")
    end

    it "is aliased to #l" do
      subject.stub helpers: double
      subject.helpers.should_receive(:localize).with(:an_object, some: "parameter")
      subject.l(:an_object, some: "parameter")
    end
  end

  describe ".helpers" do
    it "returns the current view context" do
      Draper::ViewContext.stub current: :current_view_context
      expect(subject.class.helpers).to be :current_view_context
    end

    it "is aliased to .h" do
      Draper::ViewContext.stub current: :current_view_context
      expect(subject.class.h).to be :current_view_context
    end
  end
end

Version data entries

12 entries across 12 versions & 4 rubygems

Version Path
draper-3.0.0.pre1 spec/support/shared_examples/view_helpers.rb
draper_new-3.0.0 spec/support/shared_examples/view_helpers.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/draper-2.1.0/spec/support/shared_examples/view_helpers.rb
draper-2.1.0 spec/support/shared_examples/view_helpers.rb
draper-2.0.0 spec/support/shared_examples/view_helpers.rb
draper-1.4.0 spec/support/shared_examples/view_helpers.rb
draper-1.3.1 spec/support/shared_examples/view_helpers.rb
draper-1.3.0 spec/support/shared_examples/view_helpers.rb
draper-1.2.1 spec/support/shared_examples/view_helpers.rb
draper-1.2.0 spec/support/shared_examples/view_helpers.rb
jamesgolick-draper-1.1.1a spec/support/shared_examples/view_helpers.rb
draper-1.1.0 spec/support/shared_examples/view_helpers.rb