diff options
| author | Alban Peignier | 2017-12-20 22:33:53 +0100 | 
|---|---|---|
| committer | Alban Peignier | 2017-12-20 22:33:53 +0100 | 
| commit | c955658d634c5975af446ca9885903ff8fa2c0a9 (patch) | |
| tree | 40094e623ffccd052d5c078d5dae691bd79cbf5e | |
| parent | ffa7c137f0d06f37f67561f09472b304efa90069 (diff) | |
| download | chouette-core-5351-stop-area-waiting-time.tar.bz2 | |
Check stop_area_waiting_time feature to display StopArea#waiting_time. Refs #53515351-stop-area-waiting-time
| -rw-r--r-- | app/views/stop_areas/_form.html.slim | 3 | ||||
| -rw-r--r-- | app/views/stop_areas/show.html.slim | 2 | ||||
| -rw-r--r-- | spec/views/stop_areas/edit.html.erb_spec.rb | 5 | ||||
| -rw-r--r-- | spec/views/stop_areas/new.html.erb_spec.rb | 4 | 
4 files changed, 11 insertions, 3 deletions
| diff --git a/app/views/stop_areas/_form.html.slim b/app/views/stop_areas/_form.html.slim index 6c8129d77..e44680499 100644 --- a/app/views/stop_areas/_form.html.slim +++ b/app/views/stop_areas/_form.html.slim @@ -26,7 +26,8 @@          .stop_areas.stop_area.general_info            h3 = t("stop_areas.stop_area.general") -          = f.input :waiting_time +          - if has_feature?(:stop_area_waiting_time) +            = f.input :waiting_time            = f.input :registration_number, required: format_restriction_for_locales(@referential) == '.hub', :input_html => {:title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.registration_number")}            = f.input :fare_code diff --git a/app/views/stop_areas/show.html.slim b/app/views/stop_areas/show.html.slim index 0b79f5736..0c23710b6 100644 --- a/app/views/stop_areas/show.html.slim +++ b/app/views/stop_areas/show.html.slim @@ -19,7 +19,7 @@              @stop_area.human_attribute_name(:stop_area_type) => Chouette::AreaType.find(@stop_area.area_type).try(:label),              @stop_area.human_attribute_name(:registration_number) => @stop_area.registration_number,              } -        - attributes.merge!(@stop_area.human_attribute_name(:waiting_time) => @stop_area.waiting_time_text) +        - attributes.merge!(@stop_area.human_attribute_name(:waiting_time) => @stop_area.waiting_time_text) if has_feature?(:stop_area_waiting_time)          - attributes.merge!({ "Coordonnées" => geo_data(@stop_area, @stop_area_referential),              @stop_area.human_attribute_name(:zip_code) => @stop_area.zip_code,              @stop_area.human_attribute_name(:city_name) => @stop_area.city_name, diff --git a/spec/views/stop_areas/edit.html.erb_spec.rb b/spec/views/stop_areas/edit.html.erb_spec.rb index 5105bff4b..bfbb0bb55 100644 --- a/spec/views/stop_areas/edit.html.erb_spec.rb +++ b/spec/views/stop_areas/edit.html.erb_spec.rb @@ -6,6 +6,10 @@ 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)) } +  before do +    allow(view).to receive(:has_feature?) +  end +    describe "form" do      it "should render input for name" do        render @@ -13,6 +17,5 @@ describe "/stop_areas/edit", :type => :view do          with_tag "input[type=text][name='stop_area[name]'][value=?]", stop_area.name        end      end -    end  end diff --git a/spec/views/stop_areas/new.html.erb_spec.rb b/spec/views/stop_areas/new.html.erb_spec.rb index 749782349..23f7387fa 100644 --- a/spec/views/stop_areas/new.html.erb_spec.rb +++ b/spec/views/stop_areas/new.html.erb_spec.rb @@ -5,6 +5,10 @@ describe "/stop_areas/new", :type => :view do    let!(:stop_area_referential) { assign :stop_area_referential, stop_area.stop_area_referential }    let!(:stop_area) { assign(:stop_area, build(:stop_area)) } +  before do +    allow(view).to receive(:has_feature?) +  end +    describe "form" do      it "should render input for name" do | 
