rename type_champs into type_champ and change links/routes for procedure : use show instead of edit
This commit is contained in:
parent
9942525984
commit
5a422c75ac
21 changed files with 84 additions and 48 deletions
|
@ -88,8 +88,8 @@ function add_new_type_de_champ_params() {
|
||||||
$("#new_type_de_champ .description").attr('id', 'procedure_new_type_de_champ_'+types_de_champ_index+'__description');
|
$("#new_type_de_champ .description").attr('id', 'procedure_new_type_de_champ_'+types_de_champ_index+'__description');
|
||||||
$("#new_type_de_champ .description").val('');
|
$("#new_type_de_champ .description").val('');
|
||||||
|
|
||||||
$("#new_type_de_champ .type_champs").attr('name', 'procedure[new_type_de_champ[' + types_de_champ_index + ']][type_champs]');
|
$("#new_type_de_champ .type_champ").attr('name', 'procedure[new_type_de_champ[' + types_de_champ_index + ']][type_champ]');
|
||||||
$("#new_type_de_champ .type_champs").attr('id', 'procedure_new_type_de_champ_'+types_de_champ_index+'__type_champs');
|
$("#new_type_de_champ .type_champ").attr('id', 'procedure_new_type_de_champ_'+types_de_champ_index+'__type_champ');
|
||||||
|
|
||||||
$("#new_type_de_champ .order_place").attr('name', 'procedure[new_type_de_champ[' + types_de_champ_index + ']][order_place]');
|
$("#new_type_de_champ .order_place").attr('name', 'procedure[new_type_de_champ[' + types_de_champ_index + ']][order_place]');
|
||||||
$("#new_type_de_champ .order_place").attr('id', 'procedure_new_type_de_champ_'+types_de_champ_index+'__order_place');
|
$("#new_type_de_champ .order_place").attr('id', 'procedure_new_type_de_champ_'+types_de_champ_index+'__order_place');
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.type_champs-text {
|
.type_champ-text {
|
||||||
@extend .col-md-6;
|
@extend .col-md-6;
|
||||||
@extend .col-lg-6;
|
@extend .col-lg-6;
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.type_champs-textarea {
|
.type_champ-textarea {
|
||||||
@extend .col-md-8;
|
@extend .col-md-8;
|
||||||
@extend .col-lg-8;
|
@extend .col-lg-8;
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.type_champs-number {
|
.type_champ-number {
|
||||||
@extend .col-md-3;
|
@extend .col-md-3;
|
||||||
@extend .col-lg-3;
|
@extend .col-lg-3;
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.type_champs-datetime {
|
.type_champ-datetime {
|
||||||
@extend .col-md-2;
|
@extend .col-md-2;
|
||||||
@extend .col-lg-2;
|
@extend .col-lg-2;
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ class Admin::TypesDeChampController < AdminController
|
||||||
render json: { message: 'Champ not found' }, status: 404
|
render json: { message: 'Champ not found' }, status: 404
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def show
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
@ -20,7 +20,7 @@ class Admin::TypesDeChampController < AdminController
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_params
|
def update_params
|
||||||
params.require(:procedure).permit(types_de_champ_attributes: [:libelle, :description, :order_place, :type_champs, :id])
|
params.require(:procedure).permit(types_de_champ_attributes: [:libelle, :description, :order_place, :type_champ, :id])
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class Champ < ActiveRecord::Base
|
class Champ < ActiveRecord::Base
|
||||||
belongs_to :dossier
|
belongs_to :dossier
|
||||||
belongs_to :type_de_champ
|
belongs_to :type_de_champ
|
||||||
delegate :libelle, :type_champs, :order_place, to: :type_de_champ
|
delegate :libelle, :type_champ, :order_place, to: :type_de_champ
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,6 +9,6 @@ class TypeDeChamp < ActiveRecord::Base
|
||||||
has_many :champ
|
has_many :champ
|
||||||
|
|
||||||
validates :libelle, presence: true, allow_blank: false, allow_nil: false
|
validates :libelle, presence: true, allow_blank: false, allow_nil: false
|
||||||
validates :type_champs, presence: true, allow_blank: false, allow_nil: false
|
validates :type_champ, presence: true, allow_blank: false, allow_nil: false
|
||||||
# validates :order_place, presence: true, allow_blank: false, allow_nil: false
|
# validates :order_place, presence: true, allow_blank: false, allow_nil: false
|
||||||
end
|
end
|
|
@ -2,7 +2,7 @@
|
||||||
%li
|
%li
|
||||||
= link_to('Description', admin_procedure_path(@procedure))
|
= link_to('Description', admin_procedure_path(@procedure))
|
||||||
%li
|
%li
|
||||||
= link_to('Champs', edit_admin_procedure_types_de_champ_path(@procedure))
|
= link_to('Champs', admin_procedure_types_de_champ_path(@procedure))
|
||||||
%li.active
|
%li.active
|
||||||
= link_to('Pièces justificatives', edit_admin_procedure_pieces_justificatives_path(@procedure))
|
= link_to('Pièces justificatives', edit_admin_procedure_pieces_justificatives_path(@procedure))
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
%li.active
|
%li.active
|
||||||
= link_to('Description', admin_procedure_path(@procedure))
|
= link_to('Description', admin_procedure_path(@procedure))
|
||||||
%li
|
%li
|
||||||
= link_to('Champs', edit_admin_procedure_types_de_champ_path(@procedure))
|
= link_to('Champs', admin_procedure_types_de_champ_path(@procedure))
|
||||||
%li
|
%li
|
||||||
= link_to('Pièces justificatives', edit_admin_procedure_pieces_justificatives_path(@procedure))
|
= link_to('Pièces justificatives', edit_admin_procedure_pieces_justificatives_path(@procedure))
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
= ff.text_field :libelle, class: 'form-control libelle', placeholder: 'Libellé'
|
= ff.text_field :libelle, class: 'form-control libelle', placeholder: 'Libellé'
|
||||||
.form-group
|
.form-group
|
||||||
%h4 Type
|
%h4 Type
|
||||||
= ff.select :type_champs, TypeDeChamp.type_champs, {}, {class: 'form-control type_champs'}
|
= ff.select :type_champ, TypeDeChamp.type_champ, {}, {class: 'form-control type_champ'}
|
||||||
.form-group
|
.form-group
|
||||||
%h4 Description
|
%h4 Description
|
||||||
= ff.text_area :description, class: 'form-control description', placeholder: 'Description'
|
= ff.text_area :description, class: 'form-control description', placeholder: 'Description'
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
|
|
||||||
/ .form-group{ style: 'padding-right: 2%' }
|
/ .form-group{ style: 'padding-right: 2%' }
|
||||||
/ %h4 Type
|
/ %h4 Type
|
||||||
/ =ff.select :type_champs, TypeDeChamp.type_champs, {}, {class: 'form-control type_champs'}
|
/ =ff.select :type_champ, TypeDeChamp.type_champ, {}, {class: 'form-control type_champ'}
|
||||||
|
|
||||||
/ .form-group{ style: 'padding-right: 2%' }
|
/ .form-group{ style: 'padding-right: 2%' }
|
||||||
/ %h4 Description
|
/ %h4 Description
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
= ff.text_field :libelle, class: 'form-control libelle', placeholder: 'Libellé'
|
= ff.text_field :libelle, class: 'form-control libelle', placeholder: 'Libellé'
|
||||||
.form-group
|
.form-group
|
||||||
%h4 Type
|
%h4 Type
|
||||||
= ff.select :type_champs, TypeDeChamp.type_champs, {}, {class: 'form-control type_champs'}
|
= ff.select :type_champ, TypeDeChamp.type_champs, {}, {class: 'form-control type_champ'}
|
||||||
.form-group
|
.form-group
|
||||||
%h4 Description
|
%h4 Description
|
||||||
= ff.text_area :description, class: 'form-control description', placeholder: 'Description'
|
= ff.text_area :description, class: 'form-control description', placeholder: 'Description'
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
= render partial: 'fields', locals: { types_de_champ: @procedure.types_de_champ, f: f }
|
= render partial: 'fields', locals: { types_de_champ: @procedure.types_de_champ, f: f }
|
||||||
#new_type_de_champ
|
#new_type_de_champ
|
||||||
= render partial: 'fields', locals: { types_de_champ: TypeDeChamp.new, f: f }
|
= render partial: 'fields', locals: { types_de_champ: TypeDeChamp.new, f: f }
|
||||||
= f.submit "Ajouter un champ", class: 'btn btn-success'
|
= f.submit "Ajouter un champ", class: 'btn btn-success', id: :add_type_de_champ
|
|
@ -2,7 +2,7 @@
|
||||||
%li
|
%li
|
||||||
= link_to('Description', admin_procedure_path(@procedure))
|
= link_to('Description', admin_procedure_path(@procedure))
|
||||||
%li.active
|
%li.active
|
||||||
= link_to('Champs', edit_admin_procedure_types_de_champ_path(@procedure))
|
= link_to('Champs', admin_procedure_types_de_champ_path(@procedure))
|
||||||
%li
|
%li
|
||||||
= link_to('Pièces justificatives', edit_admin_procedure_pieces_justificatives_path(@procedure))
|
= link_to('Pièces justificatives', edit_admin_procedure_pieces_justificatives_path(@procedure))
|
||||||
|
|
|
@ -19,11 +19,11 @@
|
||||||
-unless @champs.nil?
|
-unless @champs.nil?
|
||||||
-@champs.each do |champ|
|
-@champs.each do |champ|
|
||||||
.row
|
.row
|
||||||
%div{class: "type_champs-#{champ.type_champs}"}
|
%div{class: "type_champ-#{champ.type_champ}"}
|
||||||
%h4
|
%h4
|
||||||
= champ.libelle
|
= champ.libelle
|
||||||
|
|
||||||
-if champ.type_champs == 'textarea'
|
-if champ.type_champ == 'textarea'
|
||||||
%textarea.form-control{name:"champs['#{champ.id}']",
|
%textarea.form-control{name:"champs['#{champ.id}']",
|
||||||
placeholder: champ.libelle,
|
placeholder: champ.libelle,
|
||||||
id: "champs_#{champ.id}"}
|
id: "champs_#{champ.id}"}
|
||||||
|
@ -33,9 +33,9 @@
|
||||||
placeholder: champ.libelle,
|
placeholder: champ.libelle,
|
||||||
id: "champs_#{champ.id}",
|
id: "champs_#{champ.id}",
|
||||||
value: champ.value,
|
value: champ.value,
|
||||||
type:"#{champ.type_champs}",
|
type:"#{champ.type_champ}",
|
||||||
'data-provide' => ('datepicker' if champ.type_champs == 'datetime'),
|
'data-provide' => ('datepicker' if champ.type_champ == 'datetime'),
|
||||||
'data-date-format' => ('dd/mm/yyyy' if champ.type_champs == 'datetime')}
|
'data-date-format' => ('dd/mm/yyyy' if champ.type_champ == 'datetime')}
|
||||||
|
|
||||||
%br
|
%br
|
||||||
%h3 Documents administratifs
|
%h3 Documents administratifs
|
||||||
|
|
|
@ -42,7 +42,7 @@ Rails.application.routes.draw do
|
||||||
namespace :admin do
|
namespace :admin do
|
||||||
get 'sign_in' => '/administrateurs/sessions#new'
|
get 'sign_in' => '/administrateurs/sessions#new'
|
||||||
resources :procedures do
|
resources :procedures do
|
||||||
resource :types_de_champ, only: [:edit, :update]
|
resource :types_de_champ, only: [:show, :update]
|
||||||
resources :types_de_champ, only: [:destroy]
|
resources :types_de_champ, only: [:destroy]
|
||||||
resource :pieces_justificatives, only: [:edit, :update]
|
resource :pieces_justificatives, only: [:edit, :update]
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class RenameTypeChampsIntoTypeChamp < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
rename_column :types_de_champ, :type_champs, :type_champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20151110091451) do
|
ActiveRecord::Schema.define(version: 20151116175817) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
@ -146,7 +146,7 @@ ActiveRecord::Schema.define(version: 20151110091451) do
|
||||||
|
|
||||||
create_table "types_de_champ", force: :cascade do |t|
|
create_table "types_de_champ", force: :cascade do |t|
|
||||||
t.string "libelle"
|
t.string "libelle"
|
||||||
t.string "type_champs"
|
t.string "type_champ"
|
||||||
t.integer "order_place"
|
t.integer "order_place"
|
||||||
t.integer "procedure_id"
|
t.integer "procedure_id"
|
||||||
t.text "description"
|
t.text "description"
|
||||||
|
|
|
@ -9,7 +9,7 @@ describe Admin::TypesDeChampController, type: :controller do
|
||||||
describe '#update' do
|
describe '#update' do
|
||||||
let(:procedure) { create(:procedure) }
|
let(:procedure) { create(:procedure) }
|
||||||
let(:libelle) { 'mon libelle' }
|
let(:libelle) { 'mon libelle' }
|
||||||
let(:type_champs) { 'text' }
|
let(:type_champ) { 'text' }
|
||||||
let(:description) { 'titi' }
|
let(:description) { 'titi' }
|
||||||
let(:order_place) { '' }
|
let(:order_place) { '' }
|
||||||
let(:types_de_champ_id) { '' }
|
let(:types_de_champ_id) { '' }
|
||||||
|
@ -19,7 +19,7 @@ describe Admin::TypesDeChampController, type: :controller do
|
||||||
{ '0' =>
|
{ '0' =>
|
||||||
{
|
{
|
||||||
libelle: libelle,
|
libelle: libelle,
|
||||||
type_champs: type_champs,
|
type_champ: type_champ,
|
||||||
description: description,
|
description: description,
|
||||||
order_place: order_place,
|
order_place: order_place,
|
||||||
id: types_de_champ_id
|
id: types_de_champ_id
|
||||||
|
@ -41,7 +41,7 @@ describe Admin::TypesDeChampController, type: :controller do
|
||||||
subject { procedure.types_de_champ.first }
|
subject { procedure.types_de_champ.first }
|
||||||
|
|
||||||
it { expect(subject.libelle).to eq('mon libelle') }
|
it { expect(subject.libelle).to eq('mon libelle') }
|
||||||
it { expect(subject.type_champs).to eq('text') }
|
it { expect(subject.type_champ).to eq('text') }
|
||||||
it { expect(subject.description).to eq('titi') }
|
it { expect(subject.description).to eq('titi') }
|
||||||
# it { expect(subject.order_place).to eq('0') }
|
# it { expect(subject.order_place).to eq('0') }
|
||||||
end
|
end
|
||||||
|
@ -51,7 +51,7 @@ describe Admin::TypesDeChampController, type: :controller do
|
||||||
let(:type_de_champ) { procedure.types_de_champ.first }
|
let(:type_de_champ) { procedure.types_de_champ.first }
|
||||||
let(:types_de_champ_id) { type_de_champ.id }
|
let(:types_de_champ_id) { type_de_champ.id }
|
||||||
let(:libelle) { 'toto' }
|
let(:libelle) { 'toto' }
|
||||||
let(:type_champs) { 'text' }
|
let(:type_champ) { 'text' }
|
||||||
let(:description) { 'citrouille' }
|
let(:description) { 'citrouille' }
|
||||||
let(:order_place) { '0' }
|
let(:order_place) { '0' }
|
||||||
before do
|
before do
|
||||||
|
@ -60,7 +60,7 @@ describe Admin::TypesDeChampController, type: :controller do
|
||||||
end
|
end
|
||||||
subject { procedure.types_de_champ.first }
|
subject { procedure.types_de_champ.first }
|
||||||
it { expect(subject.libelle).to eq('toto') }
|
it { expect(subject.libelle).to eq('toto') }
|
||||||
it { expect(subject.type_champs).to eq('text') }
|
it { expect(subject.type_champ).to eq('text') }
|
||||||
it { expect(subject.description).to eq('citrouille') }
|
it { expect(subject.description).to eq('citrouille') }
|
||||||
# it { expect(subject.order_place).to eq(0) }
|
# it { expect(subject.order_place).to eq(0) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,7 @@ FactoryGirl.define do
|
||||||
factory :type_de_champ do
|
factory :type_de_champ do
|
||||||
libelle 'Libellé'
|
libelle 'Libellé'
|
||||||
description 'description de votre projet'
|
description 'description de votre projet'
|
||||||
type_champs 'textarea'
|
type_champ 'textarea'
|
||||||
order_place 1
|
order_place 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,12 +1,43 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
# feature 'add a new type de champs', js: true do
|
feature 'add a new type de champs', js: true do
|
||||||
# let(:administrateur) { create(:administrateur) }
|
|
||||||
|
|
||||||
# before do
|
let(:administrateur) { create(:administrateur) }
|
||||||
# login_as administrateur, scope: :administrateur
|
let(:procedure) { create(:procedure) }
|
||||||
# end
|
|
||||||
|
|
||||||
|
before do
|
||||||
|
login_as administrateur, scope: :administrateur
|
||||||
|
visit admin_procedure_types_de_champ_path(procedure)
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario 'displays a form for type de champs' do
|
||||||
|
expect(page).to have_css('#procedure_types_de_champ_attributes_0_libelle')
|
||||||
|
expect(page).to have_css('#procedure_types_de_champ_attributes_0_type_champ')
|
||||||
|
expect(page).to have_css('#procedure_types_de_champ_attributes_0_description')
|
||||||
|
expect(page).to have_css('#add_type_de_champ')
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'user fill a new type de champ', js: true do
|
||||||
|
let(:libelle) { 'mon libelle' }
|
||||||
|
let(:type_champ) { 'text' }
|
||||||
|
let(:description) { 'ma super histoire' }
|
||||||
|
before do
|
||||||
|
page.find_by_id('procedure_types_de_champ_attributes_0_libelle').set libelle
|
||||||
|
page.find_by_id('procedure_types_de_champ_attributes_0_type_champ').set type_champ
|
||||||
|
page.find_by_id('procedure_types_de_champ_attributes_0_description').set description
|
||||||
|
click_button 'Ajouter un champ'
|
||||||
|
procedure.reload
|
||||||
|
end
|
||||||
|
subject { procedure.types_de_champ.first }
|
||||||
|
scenario 'creates the type de champ', js: true do
|
||||||
|
expect(page).to have_css('#procedure_types_de_champ_attributes_1_libelle')
|
||||||
|
expect(subject.libelle).to eq(libelle)
|
||||||
|
expect(subject.type_champ).to eq(type_champ)
|
||||||
|
expect(subject.description).to eq(description)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
# context 'when create a new procedure' do
|
# context 'when create a new procedure' do
|
||||||
# before do
|
# before do
|
||||||
# visit new_admin_procedure_path
|
# visit new_admin_procedure_path
|
||||||
|
@ -15,7 +46,7 @@ require 'spec_helper'
|
||||||
# scenario 'page have form to created new type de champs' do
|
# scenario 'page have form to created new type de champs' do
|
||||||
# expect(page).to have_css('#type_de_champ_0')
|
# expect(page).to have_css('#type_de_champ_0')
|
||||||
# expect(page).to have_css('input[name="procedure[new_type_de_champ[0]][libelle]"]')
|
# expect(page).to have_css('input[name="procedure[new_type_de_champ[0]][libelle]"]')
|
||||||
# expect(page).to have_css('select[name="procedure[new_type_de_champ[0]][type_champs]"]')
|
# expect(page).to have_css('select[name="procedure[new_type_de_champ[0]][type_champ]"]')
|
||||||
# expect(page).to have_css('textarea[name="procedure[new_type_de_champ[0]][description]"]')
|
# expect(page).to have_css('textarea[name="procedure[new_type_de_champ[0]][description]"]')
|
||||||
# expect(page).to have_css('input[name="procedure[new_type_de_champ[0]][order_place]"]', visible: false)
|
# expect(page).to have_css('input[name="procedure[new_type_de_champ[0]][order_place]"]', visible: false)
|
||||||
# expect(page).to have_css('input[name="procedure[new_type_de_champ[0]][_destroy]"]', visible: false)
|
# expect(page).to have_css('input[name="procedure[new_type_de_champ[0]][_destroy]"]', visible: false)
|
||||||
|
@ -37,7 +68,7 @@ require 'spec_helper'
|
||||||
# scenario 'a new champs type line is appeared with increment index id' do
|
# scenario 'a new champs type line is appeared with increment index id' do
|
||||||
# expect(page).to have_css('#type_de_champ_1')
|
# expect(page).to have_css('#type_de_champ_1')
|
||||||
# expect(page).to have_css('input[name="procedure[new_type_de_champ[1]][libelle]"]')
|
# expect(page).to have_css('input[name="procedure[new_type_de_champ[1]][libelle]"]')
|
||||||
# expect(page).to have_css('select[name="procedure[new_type_de_champ[1]][type_champs]"]')
|
# expect(page).to have_css('select[name="procedure[new_type_de_champ[1]][type_champ]"]')
|
||||||
# expect(page).to have_css('textarea[name="procedure[new_type_de_champ[1]][description]"]')
|
# expect(page).to have_css('textarea[name="procedure[new_type_de_champ[1]][description]"]')
|
||||||
# expect(page).to have_css('input[name="procedure[new_type_de_champ[1]][order_place]"]', visible: false)
|
# expect(page).to have_css('input[name="procedure[new_type_de_champ[1]][order_place]"]', visible: false)
|
||||||
# expect(page).to have_css('input[name="procedure[new_type_de_champ[1]][_destroy]"]', visible: false)
|
# expect(page).to have_css('input[name="procedure[new_type_de_champ[1]][_destroy]"]', visible: false)
|
||||||
|
|
|
@ -12,7 +12,7 @@ describe Champ do
|
||||||
|
|
||||||
describe 'delegation' do
|
describe 'delegation' do
|
||||||
it { is_expected.to delegate_method(:libelle).to(:type_de_champ) }
|
it { is_expected.to delegate_method(:libelle).to(:type_de_champ) }
|
||||||
it { is_expected.to delegate_method(:type_champs).to(:type_de_champ) }
|
it { is_expected.to delegate_method(:type_champ).to(:type_de_champ) }
|
||||||
it { is_expected.to delegate_method(:order_place).to(:type_de_champ) }
|
it { is_expected.to delegate_method(:order_place).to(:type_de_champ) }
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -3,7 +3,7 @@ require 'spec_helper'
|
||||||
describe TypeDeChamp do
|
describe TypeDeChamp do
|
||||||
describe 'database columns' do
|
describe 'database columns' do
|
||||||
it { is_expected.to have_db_column(:libelle) }
|
it { is_expected.to have_db_column(:libelle) }
|
||||||
it { is_expected.to have_db_column(:type_champs) }
|
it { is_expected.to have_db_column(:type_champ) }
|
||||||
it { is_expected.to have_db_column(:order_place) }
|
it { is_expected.to have_db_column(:order_place) }
|
||||||
it { is_expected.to have_db_column(:description) }
|
it { is_expected.to have_db_column(:description) }
|
||||||
end
|
end
|
||||||
|
@ -21,13 +21,13 @@ describe TypeDeChamp do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'type' do
|
context 'type' do
|
||||||
it { is_expected.not_to allow_value(nil).for(:type_champs) }
|
it { is_expected.not_to allow_value(nil).for(:type_champ) }
|
||||||
it { is_expected.not_to allow_value('').for(:type_champs) }
|
it { is_expected.not_to allow_value('').for(:type_champ) }
|
||||||
|
|
||||||
it { is_expected.to allow_value('text').for(:type_champs) }
|
it { is_expected.to allow_value('text').for(:type_champ) }
|
||||||
it { is_expected.to allow_value('textarea').for(:type_champs) }
|
it { is_expected.to allow_value('textarea').for(:type_champ) }
|
||||||
it { is_expected.to allow_value('datetime').for(:type_champs) }
|
it { is_expected.to allow_value('datetime').for(:type_champ) }
|
||||||
it { is_expected.to allow_value('number').for(:type_champs) }
|
it { is_expected.to allow_value('number').for(:type_champ) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'order_place' do
|
context 'order_place' do
|
||||||
|
|
|
@ -95,13 +95,13 @@ describe 'users/description/show.html.haml', type: :view do
|
||||||
|
|
||||||
describe 'first champs' do
|
describe 'first champs' do
|
||||||
subject { dossier.champs.first }
|
subject { dossier.champs.first }
|
||||||
it { expect(rendered).to have_css(".type_champs-#{subject.type_champs}") }
|
it { expect(rendered).to have_css(".type_champ-#{subject.type_champ}") }
|
||||||
it { expect(rendered).to have_css("#champs_#{subject.id}") }
|
it { expect(rendered).to have_css("#champs_#{subject.id}") }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'last champs' do
|
describe 'last champs' do
|
||||||
subject { dossier.champs.last }
|
subject { dossier.champs.last }
|
||||||
it { expect(rendered).to have_css(".type_champs-#{subject.type_champs}") }
|
it { expect(rendered).to have_css(".type_champ-#{subject.type_champ}") }
|
||||||
it { expect(rendered).to have_css("#champs_#{subject.id}") }
|
it { expect(rendered).to have_css("#champs_#{subject.id}") }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue