aboutsummaryrefslogtreecommitdiffstats
path: root/spec/views/lines/index.html.erb_spec.rb
blob: 83b981a5ad9b34cce46b22004ca67191ad0f4c72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
require 'spec_helper'

describe "/lines/index", :type => :view do

  assign_referential
  let!(:network) { create :network }
  let!(:company) { create :company }
  let!(:lines) { assign :lines, Array.new(2) { create(:line, :network => network, :company => company) }.paginate }  
  let!(:q) { assign :q, Ransack::Search.new(Chouette::Line) }

  before :each do
    allow(view).to receive(:link_with_search).and_return("#")
  end

  it "should render a show link for each group" do        
    render  
    lines.each do |line|      
      expect(rendered).to have_selector(".line a[href='#{view.referential_line_path(referential, line)}']", :text => line.name)
    end
  end

  it "should render a link to create a new group" do
    render
    expect(view.content_for(:sidebar)).to have_selector(".actions a[href='#{new_referential_line_path(referential)}']")
  end

end