diff options
| author | Michel Etienne | 2012-04-27 15:00:18 +0200 |
|---|---|---|
| committer | Michel Etienne | 2012-04-27 15:00:18 +0200 |
| commit | 98ab3dc97be4d71606a985a3a587b253e0b6c685 (patch) | |
| tree | 2fa77987d83a7fcd0c755f31854199d561b2f3d3 /spec | |
| parent | ba2527b56c76ca173a8769f1f3cbe949842c96b1 (diff) | |
| download | chouette-core-98ab3dc97be4d71606a985a3a587b253e0b6c685.tar.bz2 | |
create pages for connection links and spec for timetables
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/requests/connection_links_spec.rb | 60 | ||||
| -rw-r--r-- | spec/requests/time_tables_spec.rb | 50 | ||||
| -rw-r--r-- | spec/views/connection_links/edit.html.erb_spec.rb | 24 | ||||
| -rw-r--r-- | spec/views/connection_links/index.html.erb_spec.rb | 21 | ||||
| -rw-r--r-- | spec/views/connection_links/new.html.erb_spec.rb | 17 | ||||
| -rw-r--r-- | spec/views/connection_links/show.html.erb_spec.rb | 30 | ||||
| -rw-r--r-- | spec/views/time_tables/edit.html.erb_spec.rb | 23 | ||||
| -rw-r--r-- | spec/views/time_tables/index.html.erb_spec.rb | 21 | ||||
| -rw-r--r-- | spec/views/time_tables/new.html.erb_spec.rb | 17 | ||||
| -rw-r--r-- | spec/views/time_tables/show.html.erb_spec.rb | 24 |
10 files changed, 287 insertions, 0 deletions
diff --git a/spec/requests/connection_links_spec.rb b/spec/requests/connection_links_spec.rb new file mode 100644 index 000000000..c40e81970 --- /dev/null +++ b/spec/requests/connection_links_spec.rb @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +require 'spec_helper' + +describe "ConnectionLinks" do + login_user + + let!(:referential) { create(:referential).switch } + let!(:connection_links) { referential; Array.new(2) { create(:connection_link) } } + subject { connection_links.first } + + describe "list" do + it "display connection_links" do + visit referential_connection_links_path(referential) + page.should have_content(connection_links.first.name) + page.should have_content(connection_links.last.name) + end + + end + + describe "show" do + it "display connection_link" do + visit referential_connection_links_path(referential) + click_link "#{connection_links.first.name}" + page.should have_content(connection_links.first.name) + end + + it "display map" do + pending ": map not yet implemented" +# subject.stub(:stop_areas).and_return(Array.new(2) { Factory(:stop_area) }) +# visit referential_connection_links_path(referential) +# click_link "#{connection_links.first.name}" +# page.should have_selector("#map", :class => 'connection_link') + end + + end + + describe "new" do + pending ": TODO see how to affect departure and arrival" +# it "creates connection_link and return to show" do +# visit referential_connection_links_path(referential) +# click_link "Ajouter une correspondance" +# fill_in "Nom", :with => "ConnectionLink 1" +# fill_in "Identifiant Neptune", :with => "test:Timetable:1" +# click_button("Créer Correspondance") +# page.should have_content("ConnectionLink 1") +# end + end + + describe "edit and return to show" do + pending ": TODO see how to affect departure and arrival" +# it "edit connection_link" do +# visit referential_connection_link_path(referential, subject) +# click_link "Modifier cette correspondance" +# fill_in "Nom", :with => "ConnectionLink Modified" +# click_button("Modifier Correspondance") +# page.should have_content("ConnectionLink Modified") +# end + end + +end diff --git a/spec/requests/time_tables_spec.rb b/spec/requests/time_tables_spec.rb new file mode 100644 index 000000000..720370ead --- /dev/null +++ b/spec/requests/time_tables_spec.rb @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +require 'spec_helper' + +describe "TimeTables" do + login_user + + let!(:referential) { create(:referential).switch } + let!(:time_tables) { referential; Array.new(2) { create(:time_table) } } + subject { time_tables.first } + + describe "list" do + it "display time_tables" do + visit referential_time_tables_path(referential) + page.should have_content(time_tables.first.comment) + page.should have_content(time_tables.last.comment) + end + + end + + describe "show" do + it "display time_table" do + visit referential_time_tables_path(referential) + click_link "#{time_tables.first.comment}" + page.should have_content(time_tables.first.comment) + end + + end + + describe "new" do + it "creates time_table and return to show" do + visit referential_time_tables_path(referential) + click_link "Ajouter un calendrier" + fill_in "Description", :with => "TimeTable 1" + fill_in "Identifiant Neptune", :with => "test:Timetable:1" + click_button("Créer Calendrier") + page.should have_content("TimeTable 1") + end + end + + describe "edit and return to show" do + it "edit time_table" do + visit referential_time_table_path(referential, subject) + click_link "Modifier ce calendrier" + fill_in "Description", :with => "TimeTable Modified" + click_button("Modifier Calendrier") + page.should have_content("TimeTable Modified") + end + end + +end diff --git a/spec/views/connection_links/edit.html.erb_spec.rb b/spec/views/connection_links/edit.html.erb_spec.rb new file mode 100644 index 000000000..331529ff8 --- /dev/null +++ b/spec/views/connection_links/edit.html.erb_spec.rb @@ -0,0 +1,24 @@ +require 'spec_helper' + +describe "/connection_links/edit" do + let!(:referential) { assign(:referential, create(:referential)) } + let!(:connection_link) { assign(:connection_link, create(:connection_link)) } + let!(:connection_links) { Array.new(2) { create(:connection_link) } } + + describe "test" do + it "should render h2 with the connection_link name" do + render + rendered.should have_selector("h2", :text => Regexp.new(connection_link.name)) + end + end + + describe "form" do + it "should render input for name" do + render + rendered.should have_selector("form") do + with_tag "input[type=text][name='connection_link[name]'][value=?]", connection_link.name + end + end + end + +end diff --git a/spec/views/connection_links/index.html.erb_spec.rb b/spec/views/connection_links/index.html.erb_spec.rb new file mode 100644 index 000000000..9732c16c5 --- /dev/null +++ b/spec/views/connection_links/index.html.erb_spec.rb @@ -0,0 +1,21 @@ +require 'spec_helper' + +describe "/connection_links/index" do + + let!(:referential) { assign( :referential, create(:referential) ) } + let!(:connection_links) { assign :connection_links, Array.new(2) { create(:connection_link) }.paginate } + let!(:search) { assign :q, Ransack::Search.new(Chouette::ConnectionLink) } + + it "should render a show link for each group" do + render + connection_links.each do |connection_link| + rendered.should have_selector(".connection_link a[href='#{view.referential_connection_link_path(referential, connection_link)}']", :text => connection_link.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_referential_connection_link_path(referential)}']") + end + +end diff --git a/spec/views/connection_links/new.html.erb_spec.rb b/spec/views/connection_links/new.html.erb_spec.rb new file mode 100644 index 000000000..1e9ee570d --- /dev/null +++ b/spec/views/connection_links/new.html.erb_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe "/connection_links/new" do + let!(:referential) { assign(:referential, create(:referential)) } + let!(:connection_link) { assign(:connection_link, build(:connection_link)) } + + describe "form" do + + it "should render input for name" do + render + rendered.should have_selector("form") do + with_selector "input[type=text][name=?]", connection_link.name + end + end + + end +end diff --git a/spec/views/connection_links/show.html.erb_spec.rb b/spec/views/connection_links/show.html.erb_spec.rb new file mode 100644 index 000000000..bc8d075cf --- /dev/null +++ b/spec/views/connection_links/show.html.erb_spec.rb @@ -0,0 +1,30 @@ +require 'spec_helper' + +describe "/connection_links/show" do + + let!(:referential) { assign(:referential, create(:referential)) } + let!(:connection_link) { assign(:connection_link, create(:connection_link)) } + + it "should render h2 with the connection_link name" do + render + rendered.should have_selector("h2", :text => Regexp.new(connection_link.name)) + end + + it "should display a map with class 'connection_link'" do + pending ": map not yet implemented" + # render + # rendered.should have_selector("#map", :class => 'connection_link') + end + + it "should render a link to edit the connection_link" do + render + view.content_for(:sidebar).should have_selector(".actions a[href='#{view.edit_referential_connection_link_path(referential, connection_link)}']") + end + + it "should render a link to remove the connection_link" do + render + view.content_for(:sidebar).should have_selector(".actions a[href='#{view.referential_connection_link_path(referential, connection_link)}'][class='remove']") + end + +end + diff --git a/spec/views/time_tables/edit.html.erb_spec.rb b/spec/views/time_tables/edit.html.erb_spec.rb new file mode 100644 index 000000000..6baf741fc --- /dev/null +++ b/spec/views/time_tables/edit.html.erb_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +describe "/time_tables/edit" do + let!(:referential) { assign(:referential, create(:referential)) } + let!(:time_table) { assign(:time_table, create(:time_table) ) } + + describe "test" do + it "should render h2 with the group comment" do + render + rendered.should have_selector("h2", :text => Regexp.new(time_table.comment)) + end + end + + describe "form" do + it "should render input for comment" do + render + rendered.should have_selector("form") do + with_tag "input[type=text][comment='time_table[comment]'][value=?]", time_table.comment + end + end + + end +end diff --git a/spec/views/time_tables/index.html.erb_spec.rb b/spec/views/time_tables/index.html.erb_spec.rb new file mode 100644 index 000000000..7d56ad982 --- /dev/null +++ b/spec/views/time_tables/index.html.erb_spec.rb @@ -0,0 +1,21 @@ +require 'spec_helper' + +describe "/time_tables/index" do + + let!(:referential) { assign :referential, create(:referential) } + let!(:time_tables) { assign :time_tables, Array.new(2){ create(:time_table) }.paginate } + let!(:search) { assign :q, Ransack::Search.new(Chouette::TimeTable) } + + it "should render a show link for each group" do + render + time_tables.each do |time_table| + rendered.should have_selector(".time_table a[href='#{view.referential_time_table_path(referential, time_table)}']", :text => time_table.comment) + 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_referential_time_table_path(referential)}']") + end + +end diff --git a/spec/views/time_tables/new.html.erb_spec.rb b/spec/views/time_tables/new.html.erb_spec.rb new file mode 100644 index 000000000..dd7a35b3b --- /dev/null +++ b/spec/views/time_tables/new.html.erb_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe "/time_tables/new" do + let!(:referential) { assign(:referential, create(:referential)) } + let!(:time_table) { assign(:time_table, build(:time_table)) } + + describe "form" do + + it "should render input for comment" do + render + rendered.should have_selector("form") do + with_selector "input[type=text][comment=?]", time_table.comment + end + end + + end +end diff --git a/spec/views/time_tables/show.html.erb_spec.rb b/spec/views/time_tables/show.html.erb_spec.rb new file mode 100644 index 000000000..056919b2b --- /dev/null +++ b/spec/views/time_tables/show.html.erb_spec.rb @@ -0,0 +1,24 @@ +require 'spec_helper' + +describe "/time_tables/show" do + + let!(:referential) { assign(:referential, create(:referential)) } + let!(:time_table) { assign(:time_table, create(:time_table)) } + + it "should render h2 with the time_table comment" do + render + rendered.should have_selector("h2", :text => Regexp.new(time_table.comment)) + end + + it "should render a link to edit the time_table" do + render + view.content_for(:sidebar).should have_selector(".actions a[href='#{view.edit_referential_time_table_path(referential, time_table)}']") + end + + it "should render a link to remove the time_table" do + render + view.content_for(:sidebar).should have_selector(".actions a[href='#{view.referential_time_table_path(referential, time_table)}'][class='remove']") + end + +end + |
