Sha256: 996165278c7764ec14f3c171094375d3f3470e4b303d91b2379ae0f79502c438

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

require 'spec_helper'

describe NavLinks::ViewHelpers do
  describe '#nav_link_to' do
    let(:link_generator) do
      lg = double("LinkGenerator")
      lg.stub(:to_html => true)
      lg
    end

    before { helper.stub(:request => :request) }

    it 'accepts only a title and a path' do
      NavLinks::LinkGenerator.should_receive(:new).with(:request, "My Title", "/path", {}, {})
        .and_return(link_generator)

      helper.nav_link_to("My Title", "/path")
    end

    it 'accepts a block that returns the title' do
      NavLinks::LinkGenerator.should_receive(:new).with(:request, "My Title", "/path", {}, {})
        .and_return(link_generator)

      helper.nav_link_to("/path") do
        "My Title"
      end
    end

    it "accepts options and html_options parameters" do
      NavLinks::LinkGenerator.should_receive(:new).with(:request, "My Title", "/path", :html_options, :options)
        .and_return(link_generator)

      helper.nav_link_to("My Title", "/path", :html_options, :options)
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nav_links-1.1.1 spec/helpers/nav_link_to_spec.rb
nav_links-1.1.0 spec/helpers/nav_link_to_spec.rb
nav_links-1.0.0 spec/helpers/nav_link_to_spec.rb