Merge pull request #1678 from betagouv/frederic/fix-instance-class-method-description
describe '#method' rather than describe '.method' for instance methods
This commit is contained in:
commit
51fff9eb17
16 changed files with 32 additions and 32 deletions
|
@ -5,7 +5,7 @@ describe Administrateurs::SessionsController, type: :controller do
|
||||||
@request.env["devise.mapping"] = Devise.mappings[:administrateur]
|
@request.env["devise.mapping"] = Devise.mappings[:administrateur]
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '.create' do
|
describe '#create' do
|
||||||
it { expect(described_class).to be < Sessions::SessionsController }
|
it { expect(described_class).to be < Sessions::SessionsController }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,7 +5,7 @@ describe Gestionnaires::SessionsController, type: :controller do
|
||||||
@request.env["devise.mapping"] = Devise.mappings[:gestionnaire]
|
@request.env["devise.mapping"] = Devise.mappings[:gestionnaire]
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '.create' do
|
describe '#create' do
|
||||||
it { expect(described_class).to be < Sessions::SessionsController }
|
it { expect(described_class).to be < Sessions::SessionsController }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -152,7 +152,7 @@ describe NewGestionnaire::AvisController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'without a gestionnaire signed in' do
|
context 'without a gestionnaire signed in' do
|
||||||
describe '.sign_up' do
|
describe '#sign_up' do
|
||||||
let(:invited_email) { 'invited@avis.com' }
|
let(:invited_email) { 'invited@avis.com' }
|
||||||
let(:dossier) { create(:dossier) }
|
let(:dossier) { create(:dossier) }
|
||||||
let!(:avis) { create(:avis, email: invited_email, dossier: dossier) }
|
let!(:avis) { create(:avis, email: invited_email, dossier: dossier) }
|
||||||
|
@ -215,7 +215,7 @@ describe NewGestionnaire::AvisController, type: :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '.create_gestionnaire' do
|
describe '#create_gestionnaire' do
|
||||||
let(:invited_email) { 'invited@avis.com' }
|
let(:invited_email) { 'invited@avis.com' }
|
||||||
let(:dossier) { create(:dossier) }
|
let(:dossier) { create(:dossier) }
|
||||||
let!(:avis) { create(:avis, email: invited_email, dossier: dossier) }
|
let!(:avis) { create(:avis, email: invited_email, dossier: dossier) }
|
||||||
|
|
|
@ -11,7 +11,7 @@ describe Sessions::SessionsController, type: :controller do
|
||||||
let(:gestionnaire) { create(:gestionnaire) }
|
let(:gestionnaire) { create(:gestionnaire) }
|
||||||
let(:administrateur) { create(:administrateur) }
|
let(:administrateur) { create(:administrateur) }
|
||||||
|
|
||||||
describe '.create' do
|
describe '#create' do
|
||||||
before do
|
before do
|
||||||
@request.env["devise.mapping"] = Devise.mappings[:user]
|
@request.env["devise.mapping"] = Devise.mappings[:user]
|
||||||
end
|
end
|
||||||
|
@ -22,7 +22,7 @@ describe Sessions::SessionsController, type: :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '.create with user connected' do
|
describe '#create with user connected' do
|
||||||
before do
|
before do
|
||||||
@request.env["devise.mapping"] = Devise.mappings[:user]
|
@request.env["devise.mapping"] = Devise.mappings[:user]
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ describe Sessions::SessionsController, type: :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '.create with gestionnaire connected' do
|
describe '#create with gestionnaire connected' do
|
||||||
before do
|
before do
|
||||||
@request.env["devise.mapping"] = Devise.mappings[:gestionnaire]
|
@request.env["devise.mapping"] = Devise.mappings[:gestionnaire]
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ describe Sessions::SessionsController, type: :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '.create with administrateur connected' do
|
describe '#create with administrateur connected' do
|
||||||
before do
|
before do
|
||||||
@request.env["devise.mapping"] = Devise.mappings[:administrateur]
|
@request.env["devise.mapping"] = Devise.mappings[:administrateur]
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ describe Users::RegistrationsController, type: :controller do
|
||||||
@request.env["devise.mapping"] = Devise.mappings[:user]
|
@request.env["devise.mapping"] = Devise.mappings[:user]
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '.create' do
|
describe '#create' do
|
||||||
subject { post :create, params: { user: user } }
|
subject { post :create, params: { user: user } }
|
||||||
|
|
||||||
context 'when user is correct' do
|
context 'when user is correct' do
|
||||||
|
|
|
@ -8,7 +8,7 @@ describe Users::SessionsController, type: :controller do
|
||||||
@request.env["devise.mapping"] = Devise.mappings[:user]
|
@request.env["devise.mapping"] = Devise.mappings[:user]
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '.create' do
|
describe '#create' do
|
||||||
it { expect(described_class).to be < Sessions::SessionsController }
|
it { expect(described_class).to be < Sessions::SessionsController }
|
||||||
|
|
||||||
describe 'France Connect attribut' do
|
describe 'France Connect attribut' do
|
||||||
|
@ -99,7 +99,7 @@ describe Users::SessionsController, type: :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '.destroy' do
|
describe '#destroy' do
|
||||||
before do
|
before do
|
||||||
sign_in user
|
sign_in user
|
||||||
delete :destroy
|
delete :destroy
|
||||||
|
@ -181,7 +181,7 @@ describe Users::SessionsController, type: :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '.new' do
|
describe '#new' do
|
||||||
subject { get :new }
|
subject { get :new }
|
||||||
|
|
||||||
context 'when procedure_id is not present in user_return_to session params' do
|
context 'when procedure_id is not present in user_return_to session params' do
|
||||||
|
|
|
@ -10,25 +10,25 @@ describe AdminProceduresShowFacades do
|
||||||
|
|
||||||
subject { AdminProceduresShowFacades.new procedure }
|
subject { AdminProceduresShowFacades.new procedure }
|
||||||
|
|
||||||
describe '.procedure' do
|
describe '#procedure' do
|
||||||
subject { super().procedure }
|
subject { super().procedure }
|
||||||
|
|
||||||
it { is_expected.to eq(procedure) }
|
it { is_expected.to eq(procedure) }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '.dossiers' do
|
describe '#dossiers' do
|
||||||
subject { super().dossiers }
|
subject { super().dossiers }
|
||||||
|
|
||||||
it { expect(subject.size).to eq(3) }
|
it { expect(subject.size).to eq(3) }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '.dossiers_for_pie_highchart' do
|
describe '#dossiers_for_pie_highchart' do
|
||||||
subject { super().dossiers_for_pie_highchart }
|
subject { super().dossiers_for_pie_highchart }
|
||||||
|
|
||||||
it { expect(subject).to eq({ 'En construction' => 2 }) }
|
it { expect(subject).to eq({ 'En construction' => 2 }) }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '.dossiers_archived_by_state_total' do
|
describe '#dossiers_archived_by_state_total' do
|
||||||
subject { super().dossiers_archived_by_state_total }
|
subject { super().dossiers_archived_by_state_total }
|
||||||
|
|
||||||
it { expect(subject.size).to eq(1) }
|
it { expect(subject.size).to eq(1) }
|
||||||
|
@ -37,19 +37,19 @@ describe AdminProceduresShowFacades do
|
||||||
it { expect(subject.first.total).to eq(1) }
|
it { expect(subject.first.total).to eq(1) }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'dossiers_archived_total' do
|
describe '#dossiers_archived_total' do
|
||||||
subject { super().dossiers_archived_total }
|
subject { super().dossiers_archived_total }
|
||||||
|
|
||||||
it { is_expected.to eq(1) }
|
it { is_expected.to eq(1) }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'dossiers_total' do
|
describe '#dossiers_total' do
|
||||||
subject { super().dossiers_total }
|
subject { super().dossiers_total }
|
||||||
|
|
||||||
it { is_expected.to eq(3) }
|
it { is_expected.to eq(3) }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'dossiers_termine_total' do
|
describe '#dossiers_termine_total' do
|
||||||
subject { super().dossiers_termine_total }
|
subject { super().dossiers_termine_total }
|
||||||
|
|
||||||
it { is_expected.to eq(0) }
|
it { is_expected.to eq(0) }
|
||||||
|
|
|
@ -19,13 +19,13 @@ describe Carto::GeoAPI::Driver do
|
||||||
it { is_expected.to eq File.open('app/lib/carto/geo_api/pays.json').read }
|
it { is_expected.to eq File.open('app/lib/carto/geo_api/pays.json').read }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'departements_url' do
|
describe '.departements_url' do
|
||||||
subject { described_class.departements_url }
|
subject { described_class.departements_url }
|
||||||
|
|
||||||
it { is_expected.to eq 'https://geo.api.gouv.fr/departements' }
|
it { is_expected.to eq 'https://geo.api.gouv.fr/departements' }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'regions_url' do
|
describe '.regions_url' do
|
||||||
subject { described_class.regions_url }
|
subject { described_class.regions_url }
|
||||||
|
|
||||||
it { is_expected.to eq 'https://geo.api.gouv.fr/regions' }
|
it { is_expected.to eq 'https://geo.api.gouv.fr/regions' }
|
||||||
|
|
|
@ -3,7 +3,7 @@ require 'rails_helper'
|
||||||
RSpec.describe Avis, type: :model do
|
RSpec.describe Avis, type: :model do
|
||||||
let(:claimant) { create(:gestionnaire) }
|
let(:claimant) { create(:gestionnaire) }
|
||||||
|
|
||||||
describe '.email_to_display' do
|
describe '#email_to_display' do
|
||||||
let(:invited_email) { 'invited@avis.com' }
|
let(:invited_email) { 'invited@avis.com' }
|
||||||
let!(:avis) do
|
let!(:avis) do
|
||||||
avis = create(:avis, email: invited_email, dossier: create(:dossier))
|
avis = create(:avis, email: invited_email, dossier: create(:dossier))
|
||||||
|
@ -58,7 +58,7 @@ RSpec.describe Avis, type: :model do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '.avis_exists_and_email_belongs_to_avis' do
|
describe '.avis_exists_and_email_belongs_to_avis?' do
|
||||||
let(:dossier) { create(:dossier) }
|
let(:dossier) { create(:dossier) }
|
||||||
let(:invited_email) { 'invited@avis.com' }
|
let(:invited_email) { 'invited@avis.com' }
|
||||||
let!(:avis) { create(:avis, email: invited_email, dossier: dossier) }
|
let!(:avis) { create(:avis, email: invited_email, dossier: dossier) }
|
||||||
|
|
|
@ -33,14 +33,14 @@ describe MailTemplateConcern do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '.subject_for_dossier' do
|
describe '#subject_for_dossier' do
|
||||||
before { initiated_mail.subject = template }
|
before { initiated_mail.subject = template }
|
||||||
subject { initiated_mail.subject_for_dossier(dossier) }
|
subject { initiated_mail.subject_for_dossier(dossier) }
|
||||||
|
|
||||||
it_behaves_like "can replace tokens in template"
|
it_behaves_like "can replace tokens in template"
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '.body_for_dossier' do
|
describe '#body_for_dossier' do
|
||||||
before { initiated_mail.body = template }
|
before { initiated_mail.body = template }
|
||||||
subject { initiated_mail.body_for_dossier(dossier) }
|
subject { initiated_mail.body_for_dossier(dossier) }
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ describe MailTemplateConcern do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '.replace_tags' do
|
describe '#replace_tags' do
|
||||||
before { initiated_mail.body = "n --numéro du dossier--" }
|
before { initiated_mail.body = "n --numéro du dossier--" }
|
||||||
it "avoids side effects" do
|
it "avoids side effects" do
|
||||||
expect(initiated_mail.body_for_dossier(dossier)).to eq("n #{dossier.id}")
|
expect(initiated_mail.body_for_dossier(dossier)).to eq("n #{dossier.id}")
|
||||||
|
|
|
@ -621,7 +621,7 @@ describe Dossier do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '.build_attestation' do
|
describe '#build_attestation' do
|
||||||
let(:attestation_template) { nil }
|
let(:attestation_template) { nil }
|
||||||
let(:procedure) { create(:procedure, attestation_template: attestation_template) }
|
let(:procedure) { create(:procedure, attestation_template: attestation_template) }
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe FranceConnectParticulierClient do
|
describe FranceConnectParticulierClient do
|
||||||
describe '.initialize' do
|
describe '#initialize' do
|
||||||
subject { FranceConnectParticulierClient.new(code) }
|
subject { FranceConnectParticulierClient.new(code) }
|
||||||
|
|
||||||
context 'when given code in params' do
|
context 'when given code in params' do
|
||||||
|
|
|
@ -174,7 +174,7 @@ describe Gestionnaire, type: :model do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '.can_view_dossier?' do
|
describe '#can_view_dossier?' do
|
||||||
subject{ gestionnaire.can_view_dossier?(dossier.id) }
|
subject{ gestionnaire.can_view_dossier?(dossier.id) }
|
||||||
|
|
||||||
context 'when gestionnaire is assigned on dossier' do
|
context 'when gestionnaire is assigned on dossier' do
|
||||||
|
|
|
@ -7,7 +7,7 @@ describe Individual do
|
||||||
it { is_expected.to have_db_column(:birthdate) }
|
it { is_expected.to have_db_column(:birthdate) }
|
||||||
it { is_expected.to belong_to(:dossier) }
|
it { is_expected.to belong_to(:dossier) }
|
||||||
|
|
||||||
describe ".save" do
|
describe "#save" do
|
||||||
let(:individual) { build(:individual) }
|
let(:individual) { build(:individual) }
|
||||||
|
|
||||||
subject { individual.save }
|
subject { individual.save }
|
||||||
|
|
|
@ -495,7 +495,7 @@ describe Procedure do
|
||||||
it { expect(Procedure.default_sort).to eq("{\"table\":\"self\",\"column\":\"id\",\"order\":\"desc\"}") }
|
it { expect(Procedure.default_sort).to eq("{\"table\":\"self\",\"column\":\"id\",\"order\":\"desc\"}") }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe ".export_filename" do
|
describe "#export_filename" do
|
||||||
before { Timecop.freeze(Time.new(2018, 1, 2, 23, 11, 14)) }
|
before { Timecop.freeze(Time.new(2018, 1, 2, 23, 11, 14)) }
|
||||||
|
|
||||||
subject { procedure.export_filename }
|
subject { procedure.export_filename }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe Search do
|
describe Search do
|
||||||
describe '.results' do
|
describe '#results' do
|
||||||
subject { liste_dossiers }
|
subject { liste_dossiers }
|
||||||
|
|
||||||
let(:liste_dossiers) do
|
let(:liste_dossiers) do
|
||||||
|
|
Loading…
Reference in a new issue