Fix tests view for smart listing

This commit is contained in:
Xavier J 2016-01-11 14:10:41 +01:00
parent ad300319f4
commit 64909e85a4
3 changed files with 36 additions and 6 deletions

View file

@ -51,6 +51,17 @@ SIADETOKEN = :valid_token unless defined? SIADETOKEN
include Warden::Test::Helpers
include SmartListing::Helper
include SmartListing::Helper::ControllerExtensions
module SmartListing
module Helper
def view_context
'mock'
end
end
end
WebMock.disable_net_connect!(allow_localhost: true)
RSpec.configure do |config|

View file

@ -11,7 +11,10 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
describe 'on tab a_traiter' do
before do
assign(:dossiers, gestionnaire.dossiers.waiting_for_gestionnaire.paginate(:page => 1).decorate)
assign(:dossiers, (smart_listing_create :dossiers,
gestionnaire.dossiers.waiting_for_gestionnaire,
partial: "backoffice/dossiers/list",
array: true))
assign(:liste, 'a_traiter')
assign(:a_traiter_class, 'active')
@ -36,7 +39,10 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
describe 'on tab en_attente' do
before do
assign(:dossiers, gestionnaire.dossiers.waiting_for_user.paginate(:page => 1).decorate)
assign(:dossiers, (smart_listing_create :dossiers,
gestionnaire.dossiers.waiting_for_user,
partial: "backoffice/dossiers/list",
array: true))
assign(:liste, 'en_attente')
assign(:en_attente_class, 'active')
@ -60,13 +66,17 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
describe 'on tab termine' do
before do
assign(:dossiers, gestionnaire.dossiers.termine.paginate(:page => 1).decorate)
assign(:dossiers, (smart_listing_create :dossiers,
gestionnaire.dossiers.termine,
partial: "backoffice/dossiers/list",
array: true))
assign(:termine_class, 'active')
assign(:liste, 'termine')
render
end
subject { rendered }
it { is_expected.to have_css('#backoffice_index') }
it { is_expected.to have_content(procedure.libelle) }
it { is_expected.to have_content(decorate_dossier_closed.nom_projet) }

View file

@ -13,7 +13,10 @@ describe 'users/dossiers/index.html.haml', type: :view do
before do
sign_in user
assign(:dossiers, dossiers_list.paginate(:page => 1).decorate)
assign(:dossiers, (smart_listing_create :dossiers,
user.dossiers.waiting_for_user('DESC'),
partial: "users/dossiers/list",
array: true))
assign(:liste, 'a_traiter')
render
end
@ -41,7 +44,10 @@ describe 'users/dossiers/index.html.haml', type: :view do
before do
sign_in user
assign(:dossiers, dossiers_list.paginate(:page => 1).decorate)
assign(:dossiers, (smart_listing_create :dossiers,
user.dossiers.waiting_for_gestionnaire('DESC'),
partial: "users/dossiers/list",
array: true))
assign(:liste, 'en_attente')
render
end
@ -69,7 +75,10 @@ describe 'users/dossiers/index.html.haml', type: :view do
before do
sign_in user
assign(:dossiers, dossiers_list.paginate(:page => 1).decorate)
assign(:dossiers, (smart_listing_create :dossiers,
user.dossiers.termine('DESC'),
partial: "users/dossiers/list",
array: true))
assign(:liste, 'termine')
render
end