diff options
| author | Teddy Wing | 2017-12-05 18:26:57 +0100 |
|---|---|---|
| committer | Teddy Wing | 2017-12-05 18:26:57 +0100 |
| commit | 47181fd81105396b2db394958c39a6e40bc6f0f0 (patch) | |
| tree | e95e67d8479f348453e3e494b5991053b15ba3de /spec | |
| parent | 1098e24f15b235dce127f0398adac4bbf7cfe463 (diff) | |
| parent | 9f1aa4d40d7d968963dae5799e15ad5da4cbcbc5 (diff) | |
| download | chouette-core-47181fd81105396b2db394958c39a6e40bc6f0f0.tar.bz2 | |
Merge remote-tracking branch 'origin/master' into 5024-prevent-duplicate-referentials-from-being-created-during-parallel-db-transactions--rb201711271659
Conflicts:
app/models/referential.rb
A whitespace conflict in a place I don't even remember editing? Okaay.
Diffstat (limited to 'spec')
40 files changed, 135 insertions, 162 deletions
diff --git a/spec/db/schema_spec.rb b/spec/db/schema_spec.rb index a7fe0a162..585636124 100644 --- a/spec/db/schema_spec.rb +++ b/spec/db/schema_spec.rb @@ -44,6 +44,6 @@ Diff: #{diff} def diff RSpec::Support::Differ.new( color: RSpec::Matchers.configuration.color? - ).diff_as_string(@original, @expected) + ).diff_as_string(@expected, @original) end end diff --git a/spec/models/api/v1/api_key_spec.rb b/spec/models/api/v1/api_key_spec.rb index b700429d3..cc483a118 100644 --- a/spec/models/api/v1/api_key_spec.rb +++ b/spec/models/api/v1/api_key_spec.rb @@ -4,6 +4,7 @@ RSpec.describe Api::V1::ApiKey, type: :model do subject { create(:api_key) } it { should validate_presence_of :organisation } + it { is_expected.to be_versioned } it 'should have a valid factory' do expect(build(:api_key)).to be_valid diff --git a/spec/models/calendar_spec.rb b/spec/models/calendar_spec.rb index f5020ebf8..e71c2b081 100644 --- a/spec/models/calendar_spec.rb +++ b/spec/models/calendar_spec.rb @@ -6,6 +6,7 @@ RSpec.describe Calendar, :type => :model do it { is_expected.to validate_presence_of(:name) } it { is_expected.to validate_presence_of(:short_name) } it { is_expected.to validate_uniqueness_of(:short_name) } + it { is_expected.to be_versioned } describe '#to_time_table' do let(:calendar) { create(:calendar, date_ranges: [Date.today...(Date.today + 1.month)]) } @@ -29,7 +30,6 @@ RSpec.describe Calendar, :type => :model do end end - describe 'before_validation' do let(:calendar) { create(:calendar, date_ranges: []) } diff --git a/spec/models/chouette/access_link_spec.rb b/spec/models/chouette/access_link_spec.rb index d0f351480..ced99eb1d 100644 --- a/spec/models/chouette/access_link_spec.rb +++ b/spec/models/chouette/access_link_spec.rb @@ -4,6 +4,7 @@ describe Chouette::AccessLink, :type => :model do subject { create(:access_link) } it { is_expected.to validate_uniqueness_of :objectid } + it { is_expected.to be_versioned } describe '#get_objectid' do subject { super().get_objectid } diff --git a/spec/models/chouette/access_point_spec.rb b/spec/models/chouette/access_point_spec.rb index a6798ec3b..c734ecedf 100644 --- a/spec/models/chouette/access_point_spec.rb +++ b/spec/models/chouette/access_point_spec.rb @@ -12,6 +12,7 @@ describe Chouette::AccessPoint, :type => :model do it { is_expected.to validate_presence_of :name } it { is_expected.to validate_numericality_of :latitude } it { is_expected.to validate_numericality_of :longitude } + it { is_expected.to be_versioned } describe ".latitude" do it "should accept -90 value" do diff --git a/spec/models/chouette/company_spec.rb b/spec/models/chouette/company_spec.rb index a3101d79c..34b19eeda 100644 --- a/spec/models/chouette/company_spec.rb +++ b/spec/models/chouette/company_spec.rb @@ -3,6 +3,7 @@ require 'spec_helper' describe Chouette::Company, :type => :model do subject { create(:company) } it { should validate_presence_of :name } + it { is_expected.to be_versioned } describe "#nullables empty" do it "should set null empty nullable attributes" do diff --git a/spec/models/chouette/connection_link_spec.rb b/spec/models/chouette/connection_link_spec.rb index 04c15b42e..4ab67d007 100644 --- a/spec/models/chouette/connection_link_spec.rb +++ b/spec/models/chouette/connection_link_spec.rb @@ -8,6 +8,7 @@ describe Chouette::ConnectionLink, :type => :model do subject { create(:connection_link) } it { is_expected.to validate_uniqueness_of :objectid } + it { is_expected.to be_versioned } describe '#get_objectid' do subject { super().get_objectid } diff --git a/spec/models/chouette/group_of_line_spec.rb b/spec/models/chouette/group_of_line_spec.rb index 29b4433c5..d43d75374 100644 --- a/spec/models/chouette/group_of_line_spec.rb +++ b/spec/models/chouette/group_of_line_spec.rb @@ -4,6 +4,7 @@ describe Chouette::GroupOfLine, :type => :model do subject { create(:group_of_line) } it { should validate_presence_of :name } + it { is_expected.to be_versioned } describe "#stop_areas" do let!(:line){create(:line, :group_of_lines => [subject])} diff --git a/spec/models/chouette/journey_pattern_spec.rb b/spec/models/chouette/journey_pattern_spec.rb index 047022ade..ea7c2a2e9 100644 --- a/spec/models/chouette/journey_pattern_spec.rb +++ b/spec/models/chouette/journey_pattern_spec.rb @@ -1,6 +1,8 @@ require 'spec_helper' describe Chouette::JourneyPattern, :type => :model do + it { is_expected.to be_versioned } + describe 'checksum' do it_behaves_like 'checksum support', :journey_pattern end diff --git a/spec/models/chouette/line_spec.rb b/spec/models/chouette/line_spec.rb index bc7b6e0c7..056d5da9e 100644 --- a/spec/models/chouette/line_spec.rb +++ b/spec/models/chouette/line_spec.rb @@ -7,6 +7,7 @@ describe Chouette::Line, :type => :model do # it { is_expected.to validate_presence_of :network } # it { is_expected.to validate_presence_of :company } it { should validate_presence_of :name } + it { is_expected.to be_versioned } describe '#display_name' do it 'should display local_id, number, name and company name' do diff --git a/spec/models/chouette/network_spec.rb b/spec/models/chouette/network_spec.rb index 32bacc512..78a4150df 100644 --- a/spec/models/chouette/network_spec.rb +++ b/spec/models/chouette/network_spec.rb @@ -3,6 +3,7 @@ require 'spec_helper' describe Chouette::Network, :type => :model do subject { create(:network) } it { should validate_presence_of :name } + it { is_expected.to be_versioned } describe "#stop_areas" do let!(:line){create(:line, :network => subject)} diff --git a/spec/models/chouette/route/route_base_spec.rb b/spec/models/chouette/route/route_base_spec.rb index 79daeb6c2..26f57eae5 100644 --- a/spec/models/chouette/route/route_base_spec.rb +++ b/spec/models/chouette/route/route_base_spec.rb @@ -15,6 +15,7 @@ RSpec.describe Chouette::Route, :type => :model do #it { is_expected.to validate_presence_of :direction_code } it { is_expected.to validate_inclusion_of(:direction).in_array(%i(straight_forward backward clockwise counter_clockwise north north_west west south_west south south_east east north_east)) } it { is_expected.to validate_inclusion_of(:wayback).in_array(%i(outbound inbound)) } + it { is_expected.to be_versioned } context "reordering methods" do let(:bad_stop_point_ids){subject.stop_points.map { |sp| sp.id + 1}} diff --git a/spec/models/chouette/routing_constraint_zone_spec.rb b/spec/models/chouette/routing_constraint_zone_spec.rb index c344642e6..8ebd8695c 100644 --- a/spec/models/chouette/routing_constraint_zone_spec.rb +++ b/spec/models/chouette/routing_constraint_zone_spec.rb @@ -7,6 +7,7 @@ describe Chouette::RoutingConstraintZone, type: :model do it { is_expected.to validate_presence_of :name } # shoulda matcher to validate length of array ? xit { is_expected.to validate_length_of(:stop_point_ids).is_at_least(2) } + it { is_expected.to be_versioned } describe 'checksum' do it_behaves_like 'checksum support', :routing_constraint_zone diff --git a/spec/models/chouette/stop_area_spec.rb b/spec/models/chouette/stop_area_spec.rb index 1e0b4af84..c6aeafaf8 100644 --- a/spec/models/chouette/stop_area_spec.rb +++ b/spec/models/chouette/stop_area_spec.rb @@ -11,6 +11,7 @@ describe Chouette::StopArea, :type => :model do it { should validate_presence_of :name } it { should validate_numericality_of :latitude } it { should validate_numericality_of :longitude } + it { is_expected.to be_versioned } # describe ".latitude" do # it "should accept -90 value" do diff --git a/spec/models/chouette/stop_point_spec.rb b/spec/models/chouette/stop_point_spec.rb index 264fd26fc..6b9e7727f 100644 --- a/spec/models/chouette/stop_point_spec.rb +++ b/spec/models/chouette/stop_point_spec.rb @@ -4,6 +4,7 @@ describe Chouette::StopPoint, :type => :model do it { is_expected.to validate_uniqueness_of :objectid } it { is_expected.to validate_presence_of :stop_area } + it { is_expected.to be_versioned } describe '#objectid' do subject { super().get_objectid } diff --git a/spec/models/chouette/time_table_spec.rb b/spec/models/chouette/time_table_spec.rb index 761c39e5b..677308fc8 100644 --- a/spec/models/chouette/time_table_spec.rb +++ b/spec/models/chouette/time_table_spec.rb @@ -6,6 +6,7 @@ describe Chouette::TimeTable, :type => :model do it { is_expected.to validate_presence_of :comment } it { is_expected.to validate_uniqueness_of :objectid } + it { is_expected.to be_versioned } def create_time_table_periode time_table, start_date, end_date create(:time_table_period, time_table: time_table, :period_start => start_date, :period_end => end_date) diff --git a/spec/models/chouette/timeband_spec.rb b/spec/models/chouette/timeband_spec.rb index 1f812a6e2..b960c203f 100644 --- a/spec/models/chouette/timeband_spec.rb +++ b/spec/models/chouette/timeband_spec.rb @@ -1,6 +1,7 @@ require 'spec_helper' describe Chouette::Timeband, :type => :model do + it { is_expected.to be_versioned } describe '#create' do context 'when valid' do diff --git a/spec/models/chouette/vehicle_journey_spec.rb b/spec/models/chouette/vehicle_journey_spec.rb index 86aa475f0..ac9b21ceb 100644 --- a/spec/models/chouette/vehicle_journey_spec.rb +++ b/spec/models/chouette/vehicle_journey_spec.rb @@ -1,6 +1,7 @@ require 'spec_helper' describe Chouette::VehicleJourney, :type => :model do + it { is_expected.to be_versioned } it "must be valid with an at-stop day offset of 1" do vehicle_journey = create( diff --git a/spec/models/compliance_check_set_spec.rb b/spec/models/compliance_check_set_spec.rb index 0159d1c6b..b981a68bb 100644 --- a/spec/models/compliance_check_set_spec.rb +++ b/spec/models/compliance_check_set_spec.rb @@ -12,6 +12,7 @@ RSpec.describe ComplianceCheckSet, type: :model do it { should have_many :compliance_checks } it { should have_many :compliance_check_blocks } + it { is_expected.to be_versioned } describe "#update_status" do it "updates :status to successful when all resources are OK" do @@ -89,4 +90,13 @@ RSpec.describe ComplianceCheckSet, type: :model do expect(check_set.update_status).to be true end end + + describe 'possibility to delete the associated compliance_control_set' do + let!(:compliance_check_set) { create :compliance_check_set } + + it do + expect{ compliance_check_set.compliance_control_set.delete } + .to change{ ComplianceControlSet.count }.by(-1) + end + end end diff --git a/spec/models/compliance_check_spec.rb b/spec/models/compliance_check_spec.rb index bd797ab09..f83d78c29 100644 --- a/spec/models/compliance_check_spec.rb +++ b/spec/models/compliance_check_spec.rb @@ -1,4 +1,5 @@ RSpec.describe ComplianceCheck, type: :model do + it 'should have a valid factory' do expect(FactoryGirl.build(:compliance_check)).to be_valid end diff --git a/spec/models/compliance_control_set_spec.rb b/spec/models/compliance_control_set_spec.rb index 04d1c418c..c157dcaf3 100644 --- a/spec/models/compliance_control_set_spec.rb +++ b/spec/models/compliance_control_set_spec.rb @@ -10,4 +10,5 @@ RSpec.describe ComplianceControlSet, type: :model do it { should have_many(:compliance_control_blocks).dependent(:destroy) } it { should validate_presence_of :name } + it { is_expected.to be_versioned } end diff --git a/spec/models/referential/referential_oid_format_from_wkbch_spec.rb b/spec/models/referential/referential_oid_format_from_wkbch_spec.rb new file mode 100644 index 000000000..b3ee68be3 --- /dev/null +++ b/spec/models/referential/referential_oid_format_from_wkbch_spec.rb @@ -0,0 +1,68 @@ +RSpec.describe Referential do + + let( :legal_formats ){ described_class.objectid_format.values } + + + describe 'default attributes' do + + context 'referential w/o an objectid_format' do + let( :referential ){ described_class.new } + let( :workbench ){ build_stubbed :workbench, objectid_format: random_element(legal_formats) } + + it "but a workbench will take the format of the workbench" do + referential.workbench = workbench + referential.define_default_attributes + expect( referential.objectid_format ).to eq(workbench.objectid_format) + end + + it 'and w/o a workbench will take the default objectid_format' do + referential.define_default_attributes + expect( referential.objectid_format ).to be_nil + end + end + + + context 'referential with an objectid_format' do + let( :distinct_formats ){ distinct_random_elements(legal_formats, count: 2) } + + let( :referential ){ build_stubbed :referential, objectid_format: distinct_formats.first} + let( :workbench ){ build_stubbed :workbench, objectid_format: distinct_formats.second } + + it "and a workbench will not take the format of the workbench" do + referential.workbench = workbench + expect{ referential.define_default_attributes }.not_to change{ referential.objectid_format } + end + + it 'and w/o a workbench will not take the default objectid_format' do + expect{ referential.define_default_attributes }.not_to change{ referential.objectid_format } + end + end + + end + + + + describe 'self.new_from' do + + let( :source ){ build :referential } + let( :functional_scope ){ double('functional scope') } + + it 'copies objectid_format from source' do + expect( described_class ) + .to receive(:new) + .with(name: I18n.t("activerecord.copy", name: source.name), + slug: "#{source.slug}_clone", + prefix: source.prefix, + time_zone: source.time_zone, + bounds: source.bounds, + line_referential: source.line_referential, + stop_area_referential: source.stop_area_referential, + created_from: source, + objectid_format: source.objectid_format, + metadatas: source.metadatas.map { |m| ReferentialMetadata.new_from(m, functional_scope) }) + + described_class.new_from( source, functional_scope ) + end + + end +end diff --git a/spec/policies/company_policy_spec.rb b/spec/policies/company_policy_spec.rb index 2d249a2be..e018902ca 100644 --- a/spec/policies/company_policy_spec.rb +++ b/spec/policies/company_policy_spec.rb @@ -1,3 +1,4 @@ +# coding: utf-8 RSpec.describe CompanyPolicy, type: :policy do let( :record ){ build_stubbed :company } @@ -24,19 +25,19 @@ RSpec.describe CompanyPolicy, type: :policy do context 'Destructive actions →' do permissions :create? do - it_behaves_like 'always forbidden', 'companies.create', archived: true + it_behaves_like 'permitted policy', 'companies.create' end permissions :destroy? do - it_behaves_like 'always forbidden', 'companies.destroy', archived: true + it_behaves_like 'permitted policy', 'companies.destroy' end permissions :edit? do - it_behaves_like 'always forbidden', 'companies.update', archived: true + it_behaves_like 'permitted policy', 'companies.update' end permissions :new? do - it_behaves_like 'always forbidden', 'companies.create', archived: true + it_behaves_like 'permitted policy', 'companies.create' end permissions :update? do - it_behaves_like 'always forbidden', 'companies.update', archived: true + it_behaves_like 'permitted policy', 'companies.update' end end end diff --git a/spec/policies/import_policy_spec.rb b/spec/policies/import_policy_spec.rb index fd9f3172c..9c7fca8a5 100644 --- a/spec/policies/import_policy_spec.rb +++ b/spec/policies/import_policy_spec.rb @@ -9,10 +9,10 @@ RSpec.describe ImportPolicy, type: :policy do context 'Non Destructive actions →' do permissions :index? do - it_behaves_like 'always allowed', 'anything', archived: true + it_behaves_like 'always allowed', 'anything' end permissions :show? do - it_behaves_like 'always allowed', 'anything', archived: true + it_behaves_like 'always allowed', 'anything' end end @@ -23,19 +23,19 @@ RSpec.describe ImportPolicy, type: :policy do context 'Destructive actions →' do permissions :create? do - it_behaves_like 'permitted policy', 'imports.create', archived: true + it_behaves_like 'permitted policy', 'imports.create' end permissions :destroy? do - it_behaves_like 'permitted policy', 'imports.destroy', archived: true + it_behaves_like 'always forbidden', 'imports.destroy' end permissions :edit? do - it_behaves_like 'permitted policy', 'imports.update', archived: true + it_behaves_like 'permitted policy', 'imports.update' end permissions :new? do - it_behaves_like 'permitted policy', 'imports.create', archived: true + it_behaves_like 'permitted policy', 'imports.create' end permissions :update? do - it_behaves_like 'permitted policy', 'imports.update', archived: true + it_behaves_like 'permitted policy', 'imports.update' end end end diff --git a/spec/policies/line_policy_spec.rb b/spec/policies/line_policy_spec.rb index 334073506..452606bcf 100644 --- a/spec/policies/line_policy_spec.rb +++ b/spec/policies/line_policy_spec.rb @@ -1,3 +1,4 @@ +# coding: utf-8 RSpec.describe LinePolicy, type: :policy do let( :record ){ build_stubbed :line } @@ -24,19 +25,19 @@ RSpec.describe LinePolicy, type: :policy do context 'Destructive actions →' do permissions :create? do - it_behaves_like 'always forbidden', 'lines.create', archived: true + it_behaves_like 'permitted policy', 'lines.create' end permissions :destroy? do - it_behaves_like 'always forbidden', 'lines.destroy', archived: true + it_behaves_like 'permitted policy', 'lines.destroy' end permissions :edit? do - it_behaves_like 'always forbidden', 'lines.update', archived: true + it_behaves_like 'permitted policy', 'lines.update' end permissions :new? do - it_behaves_like 'always forbidden', 'lines.create', archived: true + it_behaves_like 'permitted policy', 'lines.create' end permissions :update? do - it_behaves_like 'always forbidden', 'lines.update', archived: true + it_behaves_like 'permitted policy', 'lines.update' end end diff --git a/spec/policies/stop_area_policy_spec.rb b/spec/policies/stop_area_policy_spec.rb index 8fe59c8e3..90835d1d8 100644 --- a/spec/policies/stop_area_policy_spec.rb +++ b/spec/policies/stop_area_policy_spec.rb @@ -1,3 +1,4 @@ +# coding: utf-8 RSpec.describe StopAreaPolicy, type: :policy do let( :record ){ build_stubbed :stop_area } @@ -24,19 +25,19 @@ RSpec.describe StopAreaPolicy, type: :policy do context 'Destructive actions →' do permissions :create? do - it_behaves_like 'always forbidden', 'stop_areas.create', archived: true + it_behaves_like 'permitted policy', 'stop_areas.create' end permissions :destroy? do - it_behaves_like 'always forbidden', 'stop_areas.destroy', archived: true + it_behaves_like 'permitted policy', 'stop_areas.destroy' end permissions :edit? do - it_behaves_like 'always forbidden', 'stop_areas.update', archived: true + it_behaves_like 'permitted policy', 'stop_areas.update' end permissions :new? do - it_behaves_like 'always forbidden', 'stop_areas.create', archived: true + it_behaves_like 'permitted policy', 'stop_areas.create' end permissions :update? do - it_behaves_like 'always forbidden', 'stop_areas.update', archived: true + it_behaves_like 'permitted policy', 'stop_areas.update' end end end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 6d9f4a4a2..47578405e 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -3,6 +3,7 @@ ENV["RAILS_ENV"] ||= 'test' require 'spec_helper' require File.expand_path("../../config/environment", __FILE__) require 'rspec/rails' + # Add additional requires below this line. Rails is not loaded until this point! # Requires supporting ruby files with custom matchers and macros, etc, in diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d8c6c92ef..9fdca585e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -34,6 +34,7 @@ require 'webmock/rspec' require 'simplecov' require 'sidekiq/testing' Sidekiq::Testing.fake! +require 'paper_trail/frameworks/rspec' # Requires supporting ruby files with custom matchers and macros, etc, in # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are diff --git a/spec/support/random.rb b/spec/support/random.rb index 0ebc2ee5e..16d8b4df3 100644 --- a/spec/support/random.rb +++ b/spec/support/random.rb @@ -10,6 +10,15 @@ module Support def random_element from from[random_int(from.size)] end + + def random_elements( from, count: ) + (1..count).map{ |_| random_element from } + end + + def distinct_random_elements( from, count: ) + f = from.dup + (1..count).map { |_| f.delete_at( random_int(f.size) ) } + end def random_int max_plus_one=PRETTY_LARGE_INT (random_number * max_plus_one).to_i diff --git a/spec/views/companies/edit.html.erb_spec.rb b/spec/views/companies/edit.html.erb_spec.rb index 4566ed64c..8aaf705ab 100644 --- a/spec/views/companies/edit.html.erb_spec.rb +++ b/spec/views/companies/edit.html.erb_spec.rb @@ -6,13 +6,6 @@ describe "/companies/edit", :type => :view do let!(:companies) { Array.new(2) { create(:company) } } let!(:line_referential) { assign :line_referential, company.line_referential } - describe "test" do - it "should render h2 with the company name" do - render - expect(rendered).to have_selector("h2", :text => Regexp.new(company.name)) - end - end - describe "form" do it "should render input for name" do render @@ -21,5 +14,4 @@ describe "/companies/edit", :type => :view do end end end - end diff --git a/spec/views/companies/show.html.erb_spec.rb b/spec/views/companies/show.html.erb_spec.rb index dbc544f63..aeb93aebb 100644 --- a/spec/views/companies/show.html.erb_spec.rb +++ b/spec/views/companies/show.html.erb_spec.rb @@ -5,24 +5,8 @@ describe "/companies/show", :type => :view do let!(:company) { assign(:company, create(:company)) } let!(:line_referential) { assign :line_referential, company.line_referential } - it "should render h1 with the company name" do - render - expect(rendered).to have_selector("h1", :text => Regexp.new(company.name)) - end - # it "should display a map with class 'company'" do # render # expect(rendered).to have_selector("#map", :class => 'company') # end - - it "should render a link to edit the company" do - render - expect(rendered).to have_selector("a[href='#{view.edit_line_referential_company_path(line_referential, company)}']") - end - - it "should render a link to remove the company" do - render - expect(rendered).to have_selector("a[href='#{view.line_referential_company_path(line_referential, company)}']") - end - end diff --git a/spec/views/lines/edit.html.erb_spec.rb b/spec/views/lines/edit.html.erb_spec.rb index 6cd2940f5..2af4df10a 100644 --- a/spec/views/lines/edit.html.erb_spec.rb +++ b/spec/views/lines/edit.html.erb_spec.rb @@ -8,13 +8,6 @@ describe "/lines/edit", :type => :view do 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 - expect(rendered).to have_selector("h2", :text => Regexp.new(line.name)) - end - end - describe "form" do it "should render input for name" do render diff --git a/spec/views/lines/show.html.erb_spec.rb b/spec/views/lines/show.html.erb_spec.rb index 7bc120f1a..9649d9c8e 100644 --- a/spec/views/lines/show.html.erb_spec.rb +++ b/spec/views/lines/show.html.erb_spec.rb @@ -17,25 +17,4 @@ describe "/lines/show", :type => :view do before do allow(view).to receive_messages(current_organisation: referential.organisation) end - - it "should render h1 with the line name" do - render - expect(rendered).to have_selector("h1", :text => Regexp.new(line.name)) - end - - # it "should display a map with class 'line'" do - # render - # expect(rendered).to have_selector("#map", :class => 'line') - # end - # FIXME #2018 - xit "should render a link to edit the line" do - render - expect(rendered).to have_selector("a[href='#{view.edit_line_referential_line_path(line_referential, line)}']") - end - - it "should render a link to remove the line" do - render - expect(rendered).to have_selector("a[href='#{view.line_referential_line_path(line_referential, line)}']") - end - end diff --git a/spec/views/networks/edit.html.erb_spec.rb b/spec/views/networks/edit.html.erb_spec.rb index f77459837..aac6d4d28 100644 --- a/spec/views/networks/edit.html.erb_spec.rb +++ b/spec/views/networks/edit.html.erb_spec.rb @@ -5,13 +5,6 @@ describe "/networks/edit", :type => :view do let!(:network) { assign(:network, create(:network) ) } let!(:line_referential) { assign :line_referential, network.line_referential } - describe "test" do - it "should render h2 with the group name" do - render - expect(rendered).to have_selector("h2", :text => Regexp.new(network.name)) - end - end - describe "form" do it "should render input for name" do render diff --git a/spec/views/networks/show.html.erb_spec.rb b/spec/views/networks/show.html.erb_spec.rb index 72605fb46..3926ead14 100644 --- a/spec/views/networks/show.html.erb_spec.rb +++ b/spec/views/networks/show.html.erb_spec.rb @@ -11,24 +11,8 @@ describe "/networks/show", :type => :view do let!(:map) { assign(:map, double(:to_html => '<div id="map"/>'.html_safe)) } let!(:line_referential) { assign :line_referential, network.line_referential } - it "should render h1 with the network name" do - render - expect(rendered).to have_selector("h1", :text => Regexp.new(network.name)) - end - # it "should display a map with class 'network'" do # render # expect(rendered).to have_selector("#map") # end - - it "should render a link to edit the network" do - render - expect(rendered).to have_selector("a[href='#{view.edit_line_referential_network_path(line_referential, network)}']") - end - - it "should render a link to remove the network" do - render - expect(rendered).to have_selector("a[href='#{view.line_referential_network_path(line_referential, network)}']") - end - end diff --git a/spec/views/routes/show.html.erb_spec.rb b/spec/views/routes/show.html.erb_spec.rb index dae8c9ed3..3bbfaa799 100644 --- a/spec/views/routes/show.html.erb_spec.rb +++ b/spec/views/routes/show.html.erb_spec.rb @@ -22,20 +22,4 @@ RSpec.describe "/routes/show", type: :view do referential )) end - - it "should render h1 with the route name" do - render - expect(rendered).to have_selector("h1", :text => Regexp.new(route.name)) - end - - it "should render a link to edit the route" do - render - expect(rendered).to have_selector("a[href='#{view.edit_referential_line_route_path(referential, line, route)}']") - end - - it "should render a link to remove the route" do - render - expect(rendered).to have_selector("a[href='#{view.referential_line_route_path(referential, line, route)}']") - end - end diff --git a/spec/views/stop_areas/edit.html.erb_spec.rb b/spec/views/stop_areas/edit.html.erb_spec.rb index 664225203..5105bff4b 100644 --- a/spec/views/stop_areas/edit.html.erb_spec.rb +++ b/spec/views/stop_areas/edit.html.erb_spec.rb @@ -6,13 +6,6 @@ describe "/stop_areas/edit", :type => :view do let!(:stop_area) { assign(:stop_area, create(:stop_area)) } let!(:map) { assign(:map, double(:to_html => '<div id="map"/>'.html_safe)) } - describe "test" do - it "should render h2 with the group name" do - render - expect(rendered).to have_selector("h2", :text => Regexp.new(stop_area.name)) - end - end - describe "form" do it "should render input for name" do render diff --git a/spec/views/stop_areas/show.html.erb_spec.rb b/spec/views/stop_areas/show.html.erb_spec.rb index 6fd416128..693d9cf1f 100644 --- a/spec/views/stop_areas/show.html.erb_spec.rb +++ b/spec/views/stop_areas/show.html.erb_spec.rb @@ -7,24 +7,8 @@ describe "/stop_areas/show", :type => :view do let!(:access_points) { assign :access_points, [] } let!(:map) { assign(:map, double(:to_html => '<div id="map"/>'.html_safe)) } - it "should render h1 with the stop_area name" do - render - expect(rendered).to have_selector("h1", :text => Regexp.new(stop_area.name)) - end - # it "should display a map with class 'stop_area'" do # render # expect(rendered).to have_selector("#map", :class => 'stop_area') # end - - it "should render a link to edit the stop_area" do - render - expect(rendered).to have_selector("a[href='#{view.edit_stop_area_referential_stop_area_path(stop_area_referential, stop_area)}']") - end - - it "should render a link to remove the stop_area" do - render - expect(rendered).to have_selector("a[href='#{view.stop_area_referential_stop_area_path(stop_area_referential, stop_area)}']") - end - end diff --git a/spec/views/time_tables/edit.html.erb_spec.rb b/spec/views/time_tables/edit.html.erb_spec.rb index c84c5eb74..f431eab7b 100644 --- a/spec/views/time_tables/edit.html.erb_spec.rb +++ b/spec/views/time_tables/edit.html.erb_spec.rb @@ -3,13 +3,5 @@ require 'spec_helper' describe "/time_tables/edit", :type => :view do assign_referential let!(:time_table) { assign(:time_table, create(:time_table) ) } - - describe "test" do - it "should render h1 with the group comment" do - render - expect(rendered).to have_selector("h1", :text => Regexp.new(time_table.comment)) - end - end - # No more test for the form, as it is now managed by React/Redux. end diff --git a/spec/views/time_tables/show.html.erb_spec.rb b/spec/views/time_tables/show.html.erb_spec.rb index edfb3f3cc..100c74b90 100644 --- a/spec/views/time_tables/show.html.erb_spec.rb +++ b/spec/views/time_tables/show.html.erb_spec.rb @@ -17,20 +17,4 @@ describe "/time_tables/show", :type => :view do before do allow(view).to receive_messages(current_organisation: referential.organisation) end - - it "should render h2 with the time_table comment" do - render - expect(rendered).to have_selector("h1", :text => Regexp.new(time_table.comment)) - end - - it "should render a link to edit the time_table" do - render - expect(rendered).to have_selector(" a[href='#{view.edit_referential_time_table_path(referential, time_table)}']") - end - - it "should render a link to remove the time_table" do - render - expect(rendered).to have_selector(" a[href='#{view.referential_time_table_path(referential, time_table)}']") - end - end |
