diff options
| author | Alban Peignier | 2016-05-13 11:56:54 +0200 | 
|---|---|---|
| committer | Alban Peignier | 2016-05-13 11:56:54 +0200 | 
| commit | 6e28e49262ede9c57a6c5726570a4921f4b63d04 (patch) | |
| tree | 31a26a03e2c1dd3af796c9854918d112ad6e97c8 /spec/views | |
| parent | 781142afdb90bb0ca62783435f582725794f4f57 (diff) | |
| download | chouette-core-6e28e49262ede9c57a6c5726570a4921f4b63d04.tar.bz2 | |
Refactor models and controllers to manage Lines in LineReferential. Refs #825
Diffstat (limited to 'spec/views')
| -rw-r--r-- | spec/views/lines/edit.html.erb_spec.rb | 5 | ||||
| -rw-r--r-- | spec/views/lines/index.html.erb_spec.rb | 14 | ||||
| -rw-r--r-- | spec/views/lines/new.html.erb_spec.rb | 5 | ||||
| -rw-r--r-- | spec/views/lines/show.html.erb_spec.rb | 9 | 
4 files changed, 17 insertions, 16 deletions
diff --git a/spec/views/lines/edit.html.erb_spec.rb b/spec/views/lines/edit.html.erb_spec.rb index 08f7a547b..6cd2940f5 100644 --- a/spec/views/lines/edit.html.erb_spec.rb +++ b/spec/views/lines/edit.html.erb_spec.rb @@ -1,15 +1,16 @@  require 'spec_helper'  describe "/lines/edit", :type => :view do -  assign_referential +    let!(:network) { create(:network) }    let!(:company) { create(:company) }    let!(:line) { assign(:line, create(:line, :network => network, :company => company)) }    let!(:lines) { Array.new(2) { create(:line, :network => network, :company => company) } } +  let!(:line_referential) { assign :line_referential, line.line_referential }    describe "test" do      it "should render h2 with the group name" do -      render     +      render        expect(rendered).to have_selector("h2", :text => Regexp.new(line.name))      end    end diff --git a/spec/views/lines/index.html.erb_spec.rb b/spec/views/lines/index.html.erb_spec.rb index 83b981a5a..494f58040 100644 --- a/spec/views/lines/index.html.erb_spec.rb +++ b/spec/views/lines/index.html.erb_spec.rb @@ -2,26 +2,26 @@ require 'spec_helper'  describe "/lines/index", :type => :view do -  assign_referential +  let!(:line_referential) { assign :line_referential, create(:line_referential) }    let!(:network) { create :network }    let!(:company) { create :company } -  let!(:lines) { assign :lines, Array.new(2) { create(:line, :network => network, :company => company) }.paginate }   +  let!(:lines) { assign :lines, Array.new(2) { create(:line, line_referential: line_referential, 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) +  it "should render a show link for each group" do +    render +    lines.each do |line| +      expect(rendered).to have_selector(".line a[href='#{view.line_referential_line_path(line_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)}']") +    expect(view.content_for(:sidebar)).to have_selector(".actions a[href='#{new_line_referential_line_path(line_referential)}']")    end  end diff --git a/spec/views/lines/new.html.erb_spec.rb b/spec/views/lines/new.html.erb_spec.rb index f0321fd64..8b09f9ce9 100644 --- a/spec/views/lines/new.html.erb_spec.rb +++ b/spec/views/lines/new.html.erb_spec.rb @@ -1,13 +1,14 @@  require 'spec_helper'  describe "/lines/new", :type => :view do -  assign_referential +    let!(:network) { create(:network) }    let!(:company) { create(:company) }    let!(:line) { assign(:line, build(:line, :network => network, :company => company )) } +  let!(:line_referential) { assign :line_referential, line.line_referential }    describe "form" do -     +      it "should render input for name" do        render        expect(rendered).to have_selector("form") do diff --git a/spec/views/lines/show.html.erb_spec.rb b/spec/views/lines/show.html.erb_spec.rb index 8ff4357ac..4b809c268 100644 --- a/spec/views/lines/show.html.erb_spec.rb +++ b/spec/views/lines/show.html.erb_spec.rb @@ -1,9 +1,9 @@  require 'spec_helper'  describe "/lines/show", :type => :view do -   -  assign_referential +    let!(:line) { assign :line, create(:line) } +  let!(:line_referential) { assign :line_referential, line.line_referential }    let!(:routes) { assign :routes, Array.new(2) { create(:route, :line => line) }.paginate }    let!(:map) { assign(:map, double(:to_html => '<div id="map"/>'.html_safe)) } @@ -19,13 +19,12 @@ describe "/lines/show", :type => :view do    it "should render a link to edit the line" do      render -    expect(view.content_for(:sidebar)).to have_selector(".actions a[href='#{view.edit_referential_line_path(referential, line)}']") +    expect(view.content_for(:sidebar)).to have_selector(".actions a[href='#{view.edit_line_referential_line_path(line_referential, line)}']")    end    it "should render a link to remove the line" do      render -    expect(view.content_for(:sidebar)).to have_selector(".actions a[href='#{view.referential_line_path(referential, line)}'][class='remove']") +    expect(view.content_for(:sidebar)).to have_selector(".actions a[href='#{view.line_referential_line_path(line_referential, line)}'][class='remove']")    end  end -  | 
