Merge branch 'develop' into staging

This commit is contained in:
Mathieu Magnin 2017-03-29 15:14:52 +02:00
commit 1c6b95469c
8 changed files with 51 additions and 13 deletions

View file

@ -1 +1,2 @@
= render partial: 'users/description/champs/drop_down_template', locals: {values: Champ.departements, champ: champ} = select_tag("champs['#{champ.id}']",
options_for_select(Champ.departements, selected: champ.object.value))

View file

@ -1,2 +1,6 @@
- unless champ.drop_down_list.nil? - if champ.drop_down_list && champ.drop_down_list.options.any?
= render partial: 'users/description/champs/drop_down_template', locals: { drop_down_list: champ.drop_down_list, champ: champ } = select_tag("champs['#{champ.id}']",
options_for_select(champ.drop_down_list.options, selected: champ.drop_down_list.selected_options(champ),
disabled: champ.drop_down_list.disabled_options),
multiple: champ.drop_down_list.multiple,
class: champ.drop_down_list.multiple ? 'select2' : nil)

View file

@ -1,6 +0,0 @@
- unless drop_down_list.options.blank?
= select_tag("champs['#{champ.id}']",
options_for_select(drop_down_list.options, selected: drop_down_list.selected_options(champ),
disabled: drop_down_list.disabled_options),
multiple: drop_down_list.multiple,
class: drop_down_list.multiple ? 'select2' : nil)

View file

@ -1 +1,2 @@
= render partial: 'users/description/champs/drop_down_template', locals: {values: Champ.pays, champ: champ} = select_tag("champs['#{champ.id}']",
options_for_select(Champ.pays, selected: champ.object.value))

View file

@ -1,3 +1,2 @@
= render partial: 'users/description/champs/drop_down_template', locals: {values: Champ.regions, champ: champ} = select_tag("champs['#{champ.id}']",
options_for_select(Champ.regions, selected: champ.object.value))

View file

@ -0,0 +1,13 @@
require 'spec_helper'
describe 'users/description/champs/departements.html.haml', vcr: {cassette_name: 'geoapi_departements'}, type: :view do
let(:champ) { create(:champ) }
before do
render 'users/description/champs/departements.html.haml', champ: champ.decorate
end
it 'should render departments drop down list' do
expect(rendered).to include("Ain")
end
end

View file

@ -0,0 +1,13 @@
require 'spec_helper'
describe 'users/description/champs/pays.html.haml', type: :view do
let(:champ) { create(:champ) }
before do
render 'users/description/champs/pays.html.haml', champ: champ.decorate
end
it 'should render pays drop down list' do
expect(rendered).to include("FRANCE")
end
end

View file

@ -0,0 +1,13 @@
require 'spec_helper'
describe 'users/description/champs/regions.html.haml', vcr: {cassette_name: 'geoapi_regions'}, type: :view do
let(:champ) { create(:champ) }
before do
render 'users/description/champs/regions.html.haml', champ: champ.decorate
end
it 'should render regions drop down list' do
expect(rendered).to include("Normandie")
end
end