diff options
| author | Zog | 2018-05-29 10:18:16 +0200 |
|---|---|---|
| committer | Johan Van Ryseghem | 2018-05-30 16:29:33 +0200 |
| commit | 3e8d95ac8168205ac9526fb8663459d691d09c30 (patch) | |
| tree | fd2bc220473f4defe30a35668d6b9eead76f00fa /spec | |
| parent | 971b267958c3bf78abea332e0af4c46a23679b61 (diff) | |
| download | chouette-core-3e8d95ac8168205ac9526fb8663459d691d09c30.tar.bz2 | |
Refs #6433; Fix specs
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/factories/chouette_journey_frequency.rb | 38 | ||||
| -rw-r--r-- | spec/factories/chouette_timeband.rb | 17 | ||||
| -rw-r--r-- | spec/features/timebands_spec.rb | 62 | ||||
| -rw-r--r-- | spec/models/chouette/journey_frequency_spec.rb | 47 | ||||
| -rw-r--r-- | spec/models/chouette/timeband_spec.rb | 19 | ||||
| -rw-r--r-- | spec/models/gtfs_import_spec.rb | 9 | ||||
| -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 | 27 | ||||
| -rw-r--r-- | spec/views/connection_links/new.html.erb_spec.rb | 17 | ||||
| -rw-r--r-- | spec/views/connection_links/show.html.slim_spec.rb | 32 | ||||
| -rw-r--r-- | spec/views/timebands/edit.html.erb_spec.rb | 24 | ||||
| -rw-r--r-- | spec/views/timebands/index.html.erb_spec.rb | 20 | ||||
| -rw-r--r-- | spec/views/timebands/new.html.erb_spec.rb | 18 | ||||
| -rw-r--r-- | spec/views/timebands/show.html.erb_spec.rb | 24 |
14 files changed, 0 insertions, 378 deletions
diff --git a/spec/factories/chouette_journey_frequency.rb b/spec/factories/chouette_journey_frequency.rb deleted file mode 100644 index aa28bdefe..000000000 --- a/spec/factories/chouette_journey_frequency.rb +++ /dev/null @@ -1,38 +0,0 @@ -FactoryGirl.define do - - factory :journey_frequency, class: Chouette::JourneyFrequency do - timeband - scheduled_headway_interval { Time.current } - first_departure_time { timeband.start_time } - last_departure_time { timeband.end_time } - end - - factory :journey_frequency_first_departure_time_invalid, class: Chouette::JourneyFrequency do - timeband - scheduled_headway_interval { Time.current } - first_departure_time { timeband.start_time - 1.minute } - last_departure_time { timeband.end_time } - end - - factory :journey_frequency_last_departure_time_invalid, class: Chouette::JourneyFrequency do - timeband - scheduled_headway_interval { Time.current } - first_departure_time { timeband.start_time } - last_departure_time { timeband.end_time + 1.minute } - end - - factory :journey_frequency_departure_time_invalid, class: Chouette::JourneyFrequency do - timeband - scheduled_headway_interval { Time.current } - first_departure_time { '00:00' } - last_departure_time { '00:00' } - end - - factory :journey_frequency_scheduled_headway_interval_invalid, class: Chouette::JourneyFrequency do - timeband - scheduled_headway_interval { '00:00' } - first_departure_time { timeband.start_time } - last_departure_time { timeband.end_time } - end - -end diff --git a/spec/factories/chouette_timeband.rb b/spec/factories/chouette_timeband.rb deleted file mode 100644 index 010461479..000000000 --- a/spec/factories/chouette_timeband.rb +++ /dev/null @@ -1,17 +0,0 @@ -FactoryGirl.define do - - factory :timeband, class: Chouette::Timeband do - sequence(:name) { |n| "Name: #{n}" } - start_time { Time.now } - end_time { Time.now + 1.hour } - sequence(:objectid) { |n| "test:Timeband:#{n}:loc" } - end - - factory :timeband_invalid, class: Chouette::Timeband do - sequence(:name) { |n| "Name: #{n}" } - start_time { Time.now + 1.hour } - end_time { Time.now } - sequence(:objectid) { |n| "test:Timeband:#{n}:loc" } - end - -end diff --git a/spec/features/timebands_spec.rb b/spec/features/timebands_spec.rb deleted file mode 100644 index fcd14641a..000000000 --- a/spec/features/timebands_spec.rb +++ /dev/null @@ -1,62 +0,0 @@ -# -*- coding: utf-8 -*- -require 'spec_helper' - -describe "Timebands", :type => :feature do - login_user - - let!(:timebands) { Array.new(2) { create(:timeband) } } - subject { timebands.first } - - describe "list" do - it "display timebands" do - visit referential_timebands_path(referential) - expect(page).to have_content(timebands.first.name) - expect(page).to have_content(timebands.last.name) - end - - end - - describe "show" do - it "display timeband" do - visit referential_timebands_path(referential) - click_link "#{timebands.first.name}" - expect(page).to have_content(timebands.first.name) - end - - end - - describe "new" do - it "creates timeband and return to show" do - visit referential_timebands_path(referential) - click_link "Ajouter un créneau horaire" - fill_in "Titre", :with => "Timeband 1" - - select '10', from: 'timeband_start_time_4i' - select '00', from: 'timeband_start_time_5i' - select '11', from: 'timeband_end_time_4i' - select '00', from: 'timeband_end_time_5i' - - click_button("Créer créneau horaire") - expect(page).to have_content("Timeband 1") - end - end - - describe "edit and return to show" do - it "edit timeband" do - visit referential_timeband_path(referential, subject) - click_link "Editer ce créneau horaire" - fill_in "Titre", :with => "Timeband Modified" - click_button("Editer créneau horaire") - expect(page).to have_content("Timeband Modified") - end - end - - describe "delete and return to list" do - it "delete timeband" do - visit referential_timebands_path(referential) - page.all('.remove')[0].click - expect(page).to_not have_content("Timeband Modified") - end - end - -end diff --git a/spec/models/chouette/journey_frequency_spec.rb b/spec/models/chouette/journey_frequency_spec.rb deleted file mode 100644 index 549439d90..000000000 --- a/spec/models/chouette/journey_frequency_spec.rb +++ /dev/null @@ -1,47 +0,0 @@ -require 'spec_helper' - -describe Chouette::JourneyFrequency, type: :model do - let!(:vehicle_journey) { create(:vehicle_journey_even)} - - describe '#create' do - context 'when valid' do - xit 'should be created', '#5209 probably to be removed with Dead Code Elimination' do - journey_frequency = build(:journey_frequency) - journey_frequency.vehicle_journey_id = vehicle_journey.id - expect(journey_frequency.save!).to be - end - end - - context 'when first_departure_time not valid' do - it 'fails validation with first_departure_time before timeband start_time' do - journey_frequency = build(:journey_frequency_first_departure_time_invalid) - journey_frequency.vehicle_journey_id = vehicle_journey.id - expect(journey_frequency).to be_invalid - end - end - - context 'when last_departure_time not valid' do - it 'fails validation with last_departure_time after timeband end_time' do - journey_frequency = build(:journey_frequency_last_departure_time_invalid) - journey_frequency.vehicle_journey_id = vehicle_journey.id - expect(journey_frequency).to be_invalid - end - end - - context 'when first and last departure_time not valid' do - it 'fails validation with first_departure_time equal last_departure_time' do - journey_frequency = build(:journey_frequency_departure_time_invalid) - journey_frequency.vehicle_journey_id = vehicle_journey.id - expect(journey_frequency).to be_invalid - end - end - - context 'when scheduled_headway_interval not valid' do - it 'fails validation with scheduled_headway_interval is not set' do - journey_frequency = build(:journey_frequency_scheduled_headway_interval_invalid) - journey_frequency.vehicle_journey_id = vehicle_journey.id - expect(journey_frequency).to be_invalid - end - end - end -end diff --git a/spec/models/chouette/timeband_spec.rb b/spec/models/chouette/timeband_spec.rb deleted file mode 100644 index fa7c8f06e..000000000 --- a/spec/models/chouette/timeband_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -require 'spec_helper' - -describe Chouette::Timeband, :type => :model do - - - describe '#create' do - context 'when valid' do - it { create(:timeband) } - end - - context 'when not valid' do - it 'fails validation with end_time before start_time' do - timeband = build(:timeband_invalid) - expect(timeband).to be_invalid - end - end - end - -end diff --git a/spec/models/gtfs_import_spec.rb b/spec/models/gtfs_import_spec.rb index 5cb69332c..bf9a353eb 100644 --- a/spec/models/gtfs_import_spec.rb +++ b/spec/models/gtfs_import_spec.rb @@ -20,15 +20,6 @@ describe Import::Gtfs, :type => :model do # end - # describe "#max_distance_for_connection_link" do - - # it "should be included in import_options" do - # subject.max_distance_for_connection_link = 300 - # expect(subject.parameter_set["max_distance_for_connection_link"]).to eq(300) - # end - - # end - # describe "#ignore_last_word" do # it "should be included in import_options" do diff --git a/spec/views/connection_links/edit.html.erb_spec.rb b/spec/views/connection_links/edit.html.erb_spec.rb deleted file mode 100644 index 963375454..000000000 --- a/spec/views/connection_links/edit.html.erb_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -require 'spec_helper' - -describe "/connection_links/edit", :type => :view do - assign_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 - expect(rendered).to have_selector("h2", :text => Regexp.new(connection_link.name)) - end - end - - describe "form" do - it "should render input for name" do - render - expect(rendered).to 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 deleted file mode 100644 index 1f133e31e..000000000 --- a/spec/views/connection_links/index.html.erb_spec.rb +++ /dev/null @@ -1,27 +0,0 @@ -require 'spec_helper' - -describe "/connection_links/index", :type => :view do - - assign_referential - let!(:connection_links) { assign :connection_links, Array.new(2) { create(:connection_link) }.paginate } - let!(:search) { assign :q, Ransack::Search.new(Chouette::ConnectionLink) } - - before do - allow(view).to receive_messages(current_organisation: referential.organisation) - end - - it "should render a show link for each group" do - render - connection_links.each do |connection_link| - expect(rendered).to have_selector(".connection_link a[href='#{view.referential_connection_link_path(referential, connection_link)}']", :text => connection_link.name) - end - end - - with_permission "connection_links.create" do - 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_connection_link_path(referential)}']") - end - end - -end diff --git a/spec/views/connection_links/new.html.erb_spec.rb b/spec/views/connection_links/new.html.erb_spec.rb deleted file mode 100644 index 8d17bbe8b..000000000 --- a/spec/views/connection_links/new.html.erb_spec.rb +++ /dev/null @@ -1,17 +0,0 @@ -require 'spec_helper' - -describe "/connection_links/new", :type => :view do - assign_referential - let!(:connection_link) { assign(:connection_link, build(:connection_link)) } - - describe "form" do - - it "should render input for name" do - render - expect(rendered).to 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.slim_spec.rb b/spec/views/connection_links/show.html.slim_spec.rb deleted file mode 100644 index afe94fc6c..000000000 --- a/spec/views/connection_links/show.html.slim_spec.rb +++ /dev/null @@ -1,32 +0,0 @@ -require 'spec_helper' - -describe "/connection_links/show", :type => :view do - - assign_referential - let!(:connection_link) { assign(:connection_link, create(:connection_link)) } - let!(:map) { assign(:map, double(:to_html => '<div id="map"/>'.html_safe)) } - - before do - allow(view).to receive_messages(current_organisation: referential.organisation) - end - - it "should render h2 with the connection_link name" do - render - expect(rendered).to have_selector("h2", :text => Regexp.new(connection_link.name)) - end - - with_permission "connection_links.update" do - it "should render a link to edit the connection_link" do - render - expect(view.content_for(:sidebar)).to have_selector(".actions a[href='#{view.edit_referential_connection_link_path(referential, connection_link)}']") - end - end - - with_permission "connection_links.destroy" do - it "should render a link to remove the connection_link" do - render - expect(view.content_for(:sidebar)).to have_selector(".actions a[href='#{view.referential_connection_link_path(referential, connection_link)}'][class='remove']") - end - end - -end diff --git a/spec/views/timebands/edit.html.erb_spec.rb b/spec/views/timebands/edit.html.erb_spec.rb deleted file mode 100644 index 5f6051884..000000000 --- a/spec/views/timebands/edit.html.erb_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -require 'spec_helper' - -describe "/timebands/edit", :type => :view do - assign_referential - let!(:timeband) { assign(:timeband, create(:timeband) ) } - - describe "test" do - it "should render h2 with the group name" do - render - expect(rendered).to have_selector("h2", text: Regexp.new(timeband.name)) - end - end - - describe "form" do - it "should render input for timeband" do - render - expect(rendered).to have_field('timeband[name]') - expect(rendered).to have_field('timeband[start_time(4i)]') - expect(rendered).to have_field('timeband[start_time(5i)]') - expect(rendered).to have_selector('button[type=submit]') - end - - end -end diff --git a/spec/views/timebands/index.html.erb_spec.rb b/spec/views/timebands/index.html.erb_spec.rb deleted file mode 100644 index 0ce0c419c..000000000 --- a/spec/views/timebands/index.html.erb_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -require 'spec_helper' - -describe "/timebands/index", :type => :view do - - assign_referential - let!(:timebands) { assign :timebands, Array.new(2){ create(:timeband) }.paginate } - - it "should render a show link for each timeband" do - render - timebands.each do |timeband| - expect(rendered).to have_selector("a[href='#{view.referential_timeband_path(referential, timeband)}']", :text => timeband.name) - end - end - - it "should render a link to create a new timeband" do - render - expect(view.content_for(:sidebar)).to have_selector(".actions a[href='#{new_referential_timeband_path(referential)}']") - end - -end diff --git a/spec/views/timebands/new.html.erb_spec.rb b/spec/views/timebands/new.html.erb_spec.rb deleted file mode 100644 index f5e85f20c..000000000 --- a/spec/views/timebands/new.html.erb_spec.rb +++ /dev/null @@ -1,18 +0,0 @@ -require 'spec_helper' - -describe "/timebands/new", :type => :view do - assign_referential - let!(:timeband) { assign(:timeband, build(:timeband)) } - - describe "form" do - - it "should render inputs" do - render - expect(rendered).to have_field('timeband[name]') - expect(rendered).to have_field('timeband[start_time(4i)]') - expect(rendered).to have_field('timeband[start_time(5i)]') - expect(rendered).to have_selector('button[type=submit]') - end - - end -end diff --git a/spec/views/timebands/show.html.erb_spec.rb b/spec/views/timebands/show.html.erb_spec.rb deleted file mode 100644 index d43ba588c..000000000 --- a/spec/views/timebands/show.html.erb_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -require 'spec_helper' - -describe "/timebands/show", :type => :view do - - assign_referential - let!(:timeband) { assign(:timeband, create(:timeband)) } - - it "should render h2 with the timeband name" do - render - expect(rendered).to have_selector("h2", text: Regexp.new(timeband.name)) - end - - it "should render a link to edit the timeband" do - render - expect(view.content_for(:sidebar)).to have_selector(".actions a[href='#{view.edit_referential_timeband_path(referential, timeband)}']") - end - - it "should render a link to remove the timeband" do - render - expect(view.content_for(:sidebar)).to have_selector(".actions a[href='#{view.referential_timeband_path(referential, timeband)}'][class='remove']") - end - -end - |
