Merge branch 'develop' into staging
This commit is contained in:
commit
cdeac9f36f
10 changed files with 271 additions and 13 deletions
|
@ -13,7 +13,8 @@ class Backoffice::DossiersListController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
dossiers_list_facade param_liste
|
dossiers_list_facade param_liste
|
||||||
dossiers_list_facade.service.change_sort! param_sort unless params[:dossiers_smart_listing].nil?
|
dossiers_list_facade.service.change_sort! param_sort unless param_smart_listing.nil?
|
||||||
|
dossiers_list_facade.service.change_page! param_page
|
||||||
|
|
||||||
smartlisting_dossier
|
smartlisting_dossier
|
||||||
end
|
end
|
||||||
|
@ -31,6 +32,10 @@ class Backoffice::DossiersListController < ApplicationController
|
||||||
dossiers_list_facade liste
|
dossiers_list_facade liste
|
||||||
dossiers_list = dossiers_list_facade.dossiers_to_display if dossiers_list.nil?
|
dossiers_list = dossiers_list_facade.dossiers_to_display if dossiers_list.nil?
|
||||||
|
|
||||||
|
if param_page.nil?
|
||||||
|
params[:dossiers_smart_listing] = {page: dossiers_list_facade.service.default_page}
|
||||||
|
end
|
||||||
|
|
||||||
@dossiers = smart_listing_create :dossiers,
|
@dossiers = smart_listing_create :dossiers,
|
||||||
dossiers_list,
|
dossiers_list,
|
||||||
partial: "backoffice/dossiers/list",
|
partial: "backoffice/dossiers/list",
|
||||||
|
@ -40,8 +45,19 @@ class Backoffice::DossiersListController < ApplicationController
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def param_smart_listing
|
||||||
|
params[:dossiers_smart_listing]
|
||||||
|
end
|
||||||
|
|
||||||
|
def param_page
|
||||||
|
unless param_smart_listing.nil?
|
||||||
|
return 1 if params[:dossiers_smart_listing][:page].blank?
|
||||||
|
params[:dossiers_smart_listing][:page]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def param_sort
|
def param_sort
|
||||||
params[:dossiers_smart_listing][:sort]
|
params[:dossiers_smart_listing][:sort] unless param_smart_listing.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
def param_filter
|
def param_filter
|
||||||
|
|
|
@ -4,6 +4,8 @@ class Gestionnaire < ActiveRecord::Base
|
||||||
|
|
||||||
has_and_belongs_to_many :administrateurs
|
has_and_belongs_to_many :administrateurs
|
||||||
|
|
||||||
|
has_one :preference_smart_listing_page, dependent: :destroy
|
||||||
|
|
||||||
has_many :assign_to, dependent: :destroy
|
has_many :assign_to, dependent: :destroy
|
||||||
has_many :procedures, through: :assign_to
|
has_many :procedures, through: :assign_to
|
||||||
has_many :dossiers, through: :procedures
|
has_many :dossiers, through: :procedures
|
||||||
|
@ -11,6 +13,7 @@ class Gestionnaire < ActiveRecord::Base
|
||||||
has_many :preference_list_dossiers
|
has_many :preference_list_dossiers
|
||||||
|
|
||||||
after_create :build_default_preferences_list_dossier
|
after_create :build_default_preferences_list_dossier
|
||||||
|
after_create :build_default_preferences_smart_listing_page
|
||||||
|
|
||||||
def dossiers_follow
|
def dossiers_follow
|
||||||
dossiers.joins(:follows).where("follows.gestionnaire_id = #{id}")
|
dossiers.joins(:follows).where("follows.gestionnaire_id = #{id}")
|
||||||
|
@ -55,6 +58,10 @@ class Gestionnaire < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def build_default_preferences_smart_listing_page
|
||||||
|
PreferenceSmartListingPage.create(page: 1, procedure: nil, gestionnaire: self, liste: 'a_traiter')
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def valid_couple_table_attr? table, column
|
def valid_couple_table_attr? table, column
|
||||||
|
|
11
app/models/preference_smart_listing_page.rb
Normal file
11
app/models/preference_smart_listing_page.rb
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
class PreferenceSmartListingPage < ActiveRecord::Base
|
||||||
|
belongs_to :gestionnaire
|
||||||
|
belongs_to :procedure
|
||||||
|
|
||||||
|
validates :page, presence: true, allow_blank: false, allow_nil: false
|
||||||
|
validates :liste, presence: true, allow_blank: false, allow_nil: false
|
||||||
|
validates :procedure, presence: true, allow_blank: true, allow_nil: true
|
||||||
|
validates :gestionnaire, presence: true, allow_blank: false, allow_nil: false
|
||||||
|
|
||||||
|
validates_uniqueness_of :gestionnaire_id
|
||||||
|
end
|
|
@ -68,6 +68,32 @@ class DossiersListGestionnaireService
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def default_page
|
||||||
|
pref = current_preference_smart_listing_page
|
||||||
|
return pref.page if pref.procedure == @procedure && pref.liste == @liste
|
||||||
|
|
||||||
|
1
|
||||||
|
end
|
||||||
|
|
||||||
|
def change_page! new_page
|
||||||
|
pref = current_preference_smart_listing_page
|
||||||
|
|
||||||
|
unless pref.liste == @liste && pref.procedure == @procedure
|
||||||
|
pref.liste = @liste
|
||||||
|
pref.procedure = @procedure
|
||||||
|
|
||||||
|
if new_page.nil?
|
||||||
|
pref.page = 1
|
||||||
|
pref.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
unless new_page.nil?
|
||||||
|
pref.page = new_page
|
||||||
|
pref.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def change_sort! new_sort
|
def change_sort! new_sort
|
||||||
return if new_sort.blank?
|
return if new_sort.blank?
|
||||||
|
|
||||||
|
@ -137,4 +163,8 @@ class DossiersListGestionnaireService
|
||||||
.where.not(filter: nil)
|
.where.not(filter: nil)
|
||||||
.order(:id)
|
.order(:id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def current_preference_smart_listing_page
|
||||||
|
@current_devise_profil.preference_smart_listing_page
|
||||||
|
end
|
||||||
end
|
end
|
|
@ -11,11 +11,10 @@ require 'mina/rbenv' # for rbenv support. (http://rbenv.org)
|
||||||
# branch - Branch name to deploy. (needed by mina/git)
|
# branch - Branch name to deploy. (needed by mina/git)
|
||||||
|
|
||||||
ENV['to'] ||= "staging"
|
ENV['to'] ||= "staging"
|
||||||
ENV['to'] = "staging" unless ["staging", "production"].include?(ENV['to'])
|
ENV['to'] = "staging" unless ["staging", "production", "opensimplif"].include?(ENV['to'])
|
||||||
|
|
||||||
raise "missing domain, run with 'rake deploy domain=37.187.154.237'" if ENV['domain'].nil?
|
raise "missing domain, run with 'rake deploy domain=37.187.154.237'" if ENV['domain'].nil?
|
||||||
|
|
||||||
|
|
||||||
print "Deploy to #{ENV['to']} environment branch #{branch}\n"
|
print "Deploy to #{ENV['to']} environment branch #{branch}\n"
|
||||||
|
|
||||||
# set :domain, '5.135.190.60'
|
# set :domain, '5.135.190.60'
|
||||||
|
@ -25,7 +24,6 @@ set :port, 2200
|
||||||
|
|
||||||
set :deploy_to, '/var/www/tps_dev'
|
set :deploy_to, '/var/www/tps_dev'
|
||||||
|
|
||||||
|
|
||||||
if ENV["to"] == "staging"
|
if ENV["to"] == "staging"
|
||||||
if ENV['branch'].nil?
|
if ENV['branch'].nil?
|
||||||
set :branch, 'staging'
|
set :branch, 'staging'
|
||||||
|
@ -44,10 +42,24 @@ elsif ENV["to"] == "production"
|
||||||
set :deploy_to, '/var/www/tps'
|
set :deploy_to, '/var/www/tps'
|
||||||
set :user, 'tps' # Username in the server to SSH to.
|
set :user, 'tps' # Username in the server to SSH to.
|
||||||
appname = 'tps'
|
appname = 'tps'
|
||||||
|
elsif ENV["to"] == "opensimplif"
|
||||||
|
if ENV['branch'].nil?
|
||||||
|
set :branch, 'master'
|
||||||
|
else
|
||||||
|
set :branch, ENV['branch']
|
||||||
|
end
|
||||||
|
set :deploy_to, '/var/www/opensimplif'
|
||||||
|
set :user, 'opensimplif' # Username in the server to SSH to.
|
||||||
|
appname = 'opensimplif'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
set :rails_env, ENV["to"]
|
set :rails_env, ENV["to"]
|
||||||
|
|
||||||
|
if ENV["to"] == "opensimplif"
|
||||||
|
set :rails_env, "production"
|
||||||
|
end
|
||||||
|
|
||||||
# For system-wide RVM install.
|
# For system-wide RVM install.
|
||||||
# set :rvm_path, '/usr/local/rvm/bin/rvm'
|
# set :rvm_path, '/usr/local/rvm/bin/rvm'
|
||||||
|
|
||||||
|
@ -66,7 +78,7 @@ set :shared_paths, [
|
||||||
"config/fog_credentials.yml",
|
"config/fog_credentials.yml",
|
||||||
'config/initializers/secret_token.rb',
|
'config/initializers/secret_token.rb',
|
||||||
'config/initializers/features.yml',
|
'config/initializers/features.yml',
|
||||||
"config/environments/#{ENV['to']}.rb",
|
"config/environments/#{rails_env}.rb",
|
||||||
"config/initializers/token.rb",
|
"config/initializers/token.rb",
|
||||||
"config/initializers/urls.rb",
|
"config/initializers/urls.rb",
|
||||||
"config/initializers/super_admin.rb",
|
"config/initializers/super_admin.rb",
|
||||||
|
@ -74,7 +86,8 @@ set :shared_paths, [
|
||||||
"config/initializers/raven.rb",
|
"config/initializers/raven.rb",
|
||||||
'config/france_connect.yml',
|
'config/france_connect.yml',
|
||||||
'config/initializers/mailjet.rb',
|
'config/initializers/mailjet.rb',
|
||||||
'config/initializers/storage_url.rb'
|
'config/initializers/storage_url.rb',
|
||||||
|
'app/views/root/landing.html.haml'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -112,6 +125,9 @@ task :setup => :environment do
|
||||||
queue! %[mkdir -p "#{deploy_to}/shared/config"]
|
queue! %[mkdir -p "#{deploy_to}/shared/config"]
|
||||||
queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/config"]
|
queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/config"]
|
||||||
|
|
||||||
|
queue! %[mkdir -p "#{deploy_to}/shared/app"]
|
||||||
|
queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/app"]
|
||||||
|
|
||||||
queue! %[touch "#{deploy_to}/shared/config/database.yml"]
|
queue! %[touch "#{deploy_to}/shared/config/database.yml"]
|
||||||
queue %[echo "-----> Be sure to edit 'shared/config/database.yml'."]
|
queue %[echo "-----> Be sure to edit 'shared/config/database.yml'."]
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
class CreatePreferenceSmartListingPage < ActiveRecord::Migration
|
||||||
|
class Gestionnaire < ActiveRecord::Base
|
||||||
|
has_one :preference_smart_listing_page, dependent: :destroy
|
||||||
|
|
||||||
|
def build_default_preferences_smart_listing_page
|
||||||
|
PreferenceSmartListingPage.create(page: 1, procedure: nil, gestionnaire: self, liste: 'a_traiter')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class PreferenceSmartListingPage < ActiveRecord::Base
|
||||||
|
belongs_to :gestionnaire
|
||||||
|
belongs_to :procedure
|
||||||
|
|
||||||
|
validates :page, presence: true, allow_blank: false, allow_nil: false
|
||||||
|
validates :liste, presence: true, allow_blank: false, allow_nil: false
|
||||||
|
validates :procedure, presence: true, allow_blank: true, allow_nil: true
|
||||||
|
validates :gestionnaire, presence: true, allow_blank: false, allow_nil: false
|
||||||
|
|
||||||
|
validates_uniqueness_of :gestionnaire_id
|
||||||
|
end
|
||||||
|
|
||||||
|
def change
|
||||||
|
create_table :preference_smart_listing_pages do |t|
|
||||||
|
t.string :liste
|
||||||
|
t.integer :page
|
||||||
|
end
|
||||||
|
|
||||||
|
add_belongs_to :preference_smart_listing_pages, :procedure
|
||||||
|
add_belongs_to :preference_smart_listing_pages, :gestionnaire
|
||||||
|
|
||||||
|
Gestionnaire.all.each do |gestionnaire|
|
||||||
|
gestionnaire.build_default_preferences_smart_listing_page if gestionnaire.preference_smart_listing_page.nil?
|
||||||
|
end
|
||||||
|
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: 20161007095443) do
|
ActiveRecord::Schema.define(version: 20161011125345) 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"
|
||||||
|
@ -269,6 +269,13 @@ ActiveRecord::Schema.define(version: 20161007095443) do
|
||||||
t.integer "procedure_id"
|
t.integer "procedure_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "preference_smart_listing_pages", force: :cascade do |t|
|
||||||
|
t.string "liste"
|
||||||
|
t.integer "page"
|
||||||
|
t.integer "procedure_id"
|
||||||
|
t.integer "gestionnaire_id"
|
||||||
|
end
|
||||||
|
|
||||||
create_table "procedure_paths", force: :cascade do |t|
|
create_table "procedure_paths", force: :cascade do |t|
|
||||||
t.string "path", limit: 30
|
t.string "path", limit: 30
|
||||||
t.integer "procedure_id"
|
t.integer "procedure_id"
|
||||||
|
|
|
@ -28,6 +28,7 @@ describe Gestionnaire, type: :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'association' do
|
describe 'association' do
|
||||||
|
it { is_expected.to have_one(:preference_smart_listing_page) }
|
||||||
it { is_expected.to have_and_belong_to_many(:administrateurs) }
|
it { is_expected.to have_and_belong_to_many(:administrateurs) }
|
||||||
it { is_expected.to have_many(:procedures) }
|
it { is_expected.to have_many(:procedures) }
|
||||||
it { is_expected.to have_many(:dossiers) }
|
it { is_expected.to have_many(:dossiers) }
|
||||||
|
@ -161,4 +162,26 @@ describe Gestionnaire, type: :model do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '#build_default_preferences_smart_listing_page' do
|
||||||
|
subject { gestionnaire.preference_smart_listing_page }
|
||||||
|
|
||||||
|
context 'when gestionnaire is created' do
|
||||||
|
it 'build page column' do
|
||||||
|
expect(subject.page).to eq 1
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'build liste column' do
|
||||||
|
expect(subject.liste).to eq 'a_traiter'
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'build procedure_id column' do
|
||||||
|
expect(subject.procedure).to eq nil
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'build gestionnaire column' do
|
||||||
|
expect(subject.gestionnaire).to eq gestionnaire
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
10
spec/models/preference_smart_listing_page_spec.rb
Normal file
10
spec/models/preference_smart_listing_page_spec.rb
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe PreferenceSmartListingPage do
|
||||||
|
it { is_expected.to have_db_column(:page) }
|
||||||
|
it { is_expected.to have_db_column(:liste) }
|
||||||
|
it { is_expected.to have_db_column(:procedure_id) }
|
||||||
|
|
||||||
|
it { is_expected.to belong_to(:gestionnaire) }
|
||||||
|
it { is_expected.to belong_to(:procedure) }
|
||||||
|
end
|
|
@ -2,9 +2,10 @@ require 'spec_helper'
|
||||||
|
|
||||||
describe DossiersListGestionnaireService do
|
describe DossiersListGestionnaireService do
|
||||||
let(:gestionnaire) { create :gestionnaire }
|
let(:gestionnaire) { create :gestionnaire }
|
||||||
|
let(:preference_smart_listing_page) { gestionnaire.preference_smart_listing_page }
|
||||||
let(:liste) { 'a_traiter' }
|
let(:liste) { 'a_traiter' }
|
||||||
let(:dossier) { create :dossier }
|
let(:dossier) { create :dossier }
|
||||||
let(:accompagnateur_service) { AccompagnateurService.new gestionnaire, procedure, 'assign'}
|
let(:accompagnateur_service) { AccompagnateurService.new gestionnaire, procedure, 'assign' }
|
||||||
|
|
||||||
describe '#default_sort' do
|
describe '#default_sort' do
|
||||||
let(:procedure) { dossier.procedure }
|
let(:procedure) { dossier.procedure }
|
||||||
|
@ -137,7 +138,7 @@ describe DossiersListGestionnaireService do
|
||||||
|
|
||||||
subject { DossiersListGestionnaireService.new(gestionnaire, liste, nil).where_filter }
|
subject { DossiersListGestionnaireService.new(gestionnaire, liste, nil).where_filter }
|
||||||
|
|
||||||
it { is_expected.to eq "id LIKE '%23%' AND entreprises.raison_sociale LIKE '%plop%'" }
|
it { is_expected.to eq "CAST(dossiers.id as TEXT) LIKE '%23%' AND CAST(entreprises.raison_sociale as TEXT) LIKE '%plop%'" }
|
||||||
|
|
||||||
context 'when last filter caractere is *' do
|
context 'when last filter caractere is *' do
|
||||||
|
|
||||||
|
@ -147,7 +148,7 @@ describe DossiersListGestionnaireService do
|
||||||
.update_column :filter, 'plop*'
|
.update_column :filter, 'plop*'
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to eq "id LIKE '%23%' AND entreprises.raison_sociale LIKE 'plop%'" }
|
it { is_expected.to eq "CAST(dossiers.id as TEXT) LIKE '%23%' AND CAST(entreprises.raison_sociale as TEXT) LIKE 'plop%'" }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when first filter caractere is *' do
|
context 'when first filter caractere is *' do
|
||||||
|
@ -157,7 +158,7 @@ describe DossiersListGestionnaireService do
|
||||||
.update_column :filter, '*23'
|
.update_column :filter, '*23'
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to eq "id LIKE '%23' AND entreprises.raison_sociale LIKE '%plop%'" }
|
it { is_expected.to eq "CAST(dossiers.id as TEXT) LIKE '%23' AND CAST(entreprises.raison_sociale as TEXT) LIKE '%plop%'" }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when * caractere is presente' do
|
context 'when * caractere is presente' do
|
||||||
|
@ -167,7 +168,109 @@ describe DossiersListGestionnaireService do
|
||||||
.update_column :filter, 'plop*plip'
|
.update_column :filter, 'plop*plip'
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to eq "id LIKE '%23%' AND entreprises.raison_sociale LIKE 'plop%plip'" }
|
it { is_expected.to eq "CAST(dossiers.id as TEXT) LIKE '%23%' AND CAST(entreprises.raison_sociale as TEXT) LIKE 'plop%plip'" }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe '#default_page' do
|
||||||
|
let(:page) { 2 }
|
||||||
|
let(:procedure) { nil }
|
||||||
|
|
||||||
|
before do
|
||||||
|
preference_smart_listing_page.update page: page, liste: 'a_traiter'
|
||||||
|
end
|
||||||
|
|
||||||
|
subject { described_class.new(gestionnaire, liste, procedure).default_page }
|
||||||
|
|
||||||
|
context 'when liste and procedure match with the actual preference' do
|
||||||
|
let(:liste) { 'a_traiter' }
|
||||||
|
|
||||||
|
it { is_expected.to eq 2 }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when liste and procedure does not match with the actual preference' do
|
||||||
|
let(:liste) { 'en_attente' }
|
||||||
|
|
||||||
|
it { is_expected.to eq 1 }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe '#change_page!' do
|
||||||
|
let(:procedure) { nil }
|
||||||
|
let(:liste) { 'a_traiter' }
|
||||||
|
|
||||||
|
let(:page) { 2 }
|
||||||
|
let(:new_page) { 1 }
|
||||||
|
|
||||||
|
before do
|
||||||
|
preference_smart_listing_page.update page: page, liste: 'a_traiter', procedure: nil
|
||||||
|
subject
|
||||||
|
preference_smart_listing_page.reload
|
||||||
|
end
|
||||||
|
|
||||||
|
subject { described_class.new(gestionnaire, liste, procedure).change_page! new_page }
|
||||||
|
|
||||||
|
context 'when liste and procedure does not change' do
|
||||||
|
it { expect(preference_smart_listing_page.liste).to eq liste }
|
||||||
|
it { expect(preference_smart_listing_page.procedure).to eq procedure }
|
||||||
|
it { expect(preference_smart_listing_page.page).to eq new_page }
|
||||||
|
|
||||||
|
context 'when new_page is nil' do
|
||||||
|
let(:new_page) { nil }
|
||||||
|
|
||||||
|
it { expect(preference_smart_listing_page.liste).to eq liste }
|
||||||
|
it { expect(preference_smart_listing_page.procedure).to eq procedure }
|
||||||
|
it { expect(preference_smart_listing_page.page).to eq page }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when liste change' do
|
||||||
|
let(:liste) { 'en_attente' }
|
||||||
|
|
||||||
|
it { expect(preference_smart_listing_page.liste).to eq liste }
|
||||||
|
it { expect(preference_smart_listing_page.procedure).to eq procedure }
|
||||||
|
it { expect(preference_smart_listing_page.page).to eq new_page }
|
||||||
|
|
||||||
|
context 'when new_page is nil' do
|
||||||
|
let(:new_page) { nil }
|
||||||
|
|
||||||
|
it { expect(preference_smart_listing_page.liste).to eq liste }
|
||||||
|
it { expect(preference_smart_listing_page.procedure).to eq procedure }
|
||||||
|
it { expect(preference_smart_listing_page.page).to eq 1 }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when procedure change' do
|
||||||
|
let(:procedure) { dossier.procedure }
|
||||||
|
|
||||||
|
it { expect(preference_smart_listing_page.liste).to eq liste }
|
||||||
|
it { expect(preference_smart_listing_page.procedure).to eq procedure }
|
||||||
|
it { expect(preference_smart_listing_page.page).to eq new_page }
|
||||||
|
|
||||||
|
context 'when new_page is nil' do
|
||||||
|
let(:new_page) { nil }
|
||||||
|
|
||||||
|
it { expect(preference_smart_listing_page.liste).to eq liste }
|
||||||
|
it { expect(preference_smart_listing_page.procedure).to eq procedure }
|
||||||
|
it { expect(preference_smart_listing_page.page).to eq 1 }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when procedure and liste change' do
|
||||||
|
let(:liste) { 'en_attente' }
|
||||||
|
let(:procedure) { dossier.procedure }
|
||||||
|
|
||||||
|
it { expect(preference_smart_listing_page.liste).to eq liste }
|
||||||
|
it { expect(preference_smart_listing_page.procedure).to eq procedure }
|
||||||
|
it { expect(preference_smart_listing_page.page).to eq new_page }
|
||||||
|
|
||||||
|
context 'when new_page is nil' do
|
||||||
|
let(:new_page) { nil }
|
||||||
|
|
||||||
|
it { expect(preference_smart_listing_page.liste).to eq liste }
|
||||||
|
it { expect(preference_smart_listing_page.procedure).to eq procedure }
|
||||||
|
it { expect(preference_smart_listing_page.page).to eq 1 }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue