diff options
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/factories/chouette_lines.rb | 9 | ||||
| -rw-r--r-- | spec/spec_helper.rb | 1 | ||||
| -rw-r--r-- | spec/views/lines/edit.html.erb_spec.rb | 16 | ||||
| -rw-r--r-- | spec/views/lines/index.html.erb_spec.rb | 12 | ||||
| -rw-r--r-- | spec/views/lines/new.html.erb_spec.rb | 6 | ||||
| -rw-r--r-- | spec/views/lines/show.html.erb_spec.rb | 17 |
6 files changed, 34 insertions, 27 deletions
diff --git a/spec/factories/chouette_lines.rb b/spec/factories/chouette_lines.rb index 913b88538..b43583330 100644 --- a/spec/factories/chouette_lines.rb +++ b/spec/factories/chouette_lines.rb @@ -1,4 +1,5 @@ -Factory.define :chouette_line, :class => "Chouette::Line" do |f| - f.sequence(:name) { |n| "Line #{n}" } - f.objectid -end
\ No newline at end of file +Factory.define :line, :class => "Chouette::Line" do |line| + line.sequence(:name) { |n| "Line #{n}" } + line.association :network, :factory => :network + line.association :company, :factory => :company +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index e66d9802c..41ce1fde6 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -29,4 +29,5 @@ RSpec.configure do |config| # automatically. This will be the default behavior in future versions of # rspec-rails. config.infer_base_class_for_anonymous_controllers = false + end diff --git a/spec/views/lines/edit.html.erb_spec.rb b/spec/views/lines/edit.html.erb_spec.rb index f889410ee..98216eb52 100644 --- a/spec/views/lines/edit.html.erb_spec.rb +++ b/spec/views/lines/edit.html.erb_spec.rb @@ -1,15 +1,17 @@ require 'spec_helper' describe "/lines/edit" do - let!(:network) { assign(:network, Factory(:network)) } - let!(:line) { assign(:line, Factory(:line, :network => network)) } - let!(:lines) { Array.new(2) { Factory(:line, :network => network) } } + let!(:referential) { assign(:referential, Factory(:referential)) } + let!(:network) { Factory(:network) } + let!(:company) { Factory(:company) } + let!(:line) { assign(:line, Factory(:line, :network => network, :company => company)) } + let!(:lines) { Array.new(2) { Factory(:line, :network => network, :company => company) } } describe "test" do - it "should render h2 with the group name" do - render - rendered.should have_selector("h2", :text => Regexp.new(line.name)) - end + it "should render h2 with the group name" do + render + rendered.should have_selector("h2", :text => Regexp.new(line.name)) + end end describe "form" do diff --git a/spec/views/lines/index.html.erb_spec.rb b/spec/views/lines/index.html.erb_spec.rb index dee3565f4..a290080eb 100644 --- a/spec/views/lines/index.html.erb_spec.rb +++ b/spec/views/lines/index.html.erb_spec.rb @@ -2,24 +2,26 @@ require 'spec_helper' describe "/lines/index" do - let!(:network) { assign( :network, Factory(:network) ) } - let!(:lines) { assign( :lines, Array.new(2) { Factory(:line, :network => network) } ) } + let!(:referential) { assign( :referential, Factory(:referential) ) } + let!(:network) { Factory(:network) } + let!(:company) { Factory(:company) } + let!(:lines) { assign( :lines, Array.new(2) { Factory(:line, :network => network, :company => company) } ) } before :each do - rendered.stub(:collection).and_return( lines.order_by [[:code, :asc]] ) + rendered.stub(:collection).and_return( lines.order_by [[:number, :asc]] ) view.stub(:link_to_order).and_return( "#" ) end it "should render a show link for each group" do render lines.each do |line| - rendered.should have_selector(".line a[href='#{view.line_path(line)}']", :text => line.name) + rendered.should 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 - view.content_for(:sidebar).should have_selector(".actions a[href='#{new_network_line_path(network)}']") + view.content_for(:sidebar).should have_selector(".actions a[href='#{new_referential_line_path(referential)}']") end end diff --git a/spec/views/lines/new.html.erb_spec.rb b/spec/views/lines/new.html.erb_spec.rb index b50f73356..48f36a036 100644 --- a/spec/views/lines/new.html.erb_spec.rb +++ b/spec/views/lines/new.html.erb_spec.rb @@ -1,8 +1,10 @@ require 'spec_helper' describe "/lines/new" do - let!(:network) { assign(:network, Factory(:network)) } - let!(:line) { assign(:line, Factory.build(:line, :network => network)) } + let!(:referential) { assign(:referential, Factory(:referential)) } + let!(:network) { Factory(:network) } + let!(:company) { Factory(:company) } + let!(:line) { assign(:line, Factory.build(:line, :network => network, :company => company )) } describe "form" do diff --git a/spec/views/lines/show.html.erb_spec.rb b/spec/views/lines/show.html.erb_spec.rb index 14f315333..9d5b53cd3 100644 --- a/spec/views/lines/show.html.erb_spec.rb +++ b/spec/views/lines/show.html.erb_spec.rb @@ -2,28 +2,27 @@ require 'spec_helper' describe "/lines/show" do - let!(:network) { assign(:network, Factory(:network)) } - let!(:line) { assign(:line, Factory(:line, :network => network)) } - let!(:map) { assign(:map, LineMap.new(line) ) } + let!(:referential) { assign(:referential, Factory(:referential)) } + let!(:line) { assign(:line, Factory(:line)) } it "should render h2 with the line name" do render rendered.should have_selector("h2", :text => Regexp.new(line.name)) end - it "should display a map with class 'line'" do - render - rendered.should have_selector("#map", :class => 'line') - end + # it "should display a map with class 'line'" do + # render + # rendered.should have_selector("#map", :class => 'line') + # end it "should render a link to edit the line" do render - view.content_for(:sidebar).should have_selector(".actions a[href='#{view.edit_line_path(line)}']") + view.content_for(:sidebar).should have_selector(".actions a[href='#{view.edit_referential_line_path(referential, line)}']") end it "should render a link to remove the line" do render - view.content_for(:sidebar).should have_selector(".actions a[href='#{view.line_path(line)}'][class='remove']") + view.content_for(:sidebar).should have_selector(".actions a[href='#{view.referential_line_path(referential, line)}'][class='remove']") end end |
