Remove or fix nonsense code
This commit is contained in:
parent
c380d807ab
commit
c08e356367
7 changed files with 2 additions and 102 deletions
|
@ -184,13 +184,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
|||
expect(dossier.reload.state).to eq(Dossier.states.fetch(:accepte))
|
||||
expect(response).to have_http_status(:ok)
|
||||
end
|
||||
context 'as administrateur' do
|
||||
let (:current_user) { administrateur }
|
||||
it 'it is not possible to go back to en_instruction' do
|
||||
expect(dossier.reload.state).to eq(Dossier.states.fetch(:accepte))
|
||||
expect(response).to have_http_status(:ok)
|
||||
end
|
||||
end
|
||||
|
||||
context 'as superadmin' do
|
||||
let (:current_user) { administration }
|
||||
it 'it is not possible to go back to en_instruction' do
|
||||
|
|
|
@ -8,8 +8,6 @@ describe Sessions::SessionsController, type: :controller do
|
|||
end
|
||||
|
||||
let(:user) { create(:user) }
|
||||
let(:instructeur) { create(:instructeur) }
|
||||
let(:administrateur) { create(:administrateur) }
|
||||
|
||||
describe '#create' do
|
||||
before do
|
||||
|
@ -34,17 +32,4 @@ describe Sessions::SessionsController, type: :controller do
|
|||
post :create
|
||||
end
|
||||
end
|
||||
|
||||
describe '#create with administrateur connected' do
|
||||
before do
|
||||
@request.env["devise.mapping"] = Devise.mappings[:administrateur]
|
||||
|
||||
allow_any_instance_of(described_class).to receive(:administrateur_signed_in?).and_return(true)
|
||||
end
|
||||
|
||||
it 'calls sign out for administrateur' do
|
||||
expect_any_instance_of(described_class).to receive(:sign_out).with(:administrateur)
|
||||
post :create
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -108,20 +108,6 @@ describe Users::SessionsController, type: :controller do
|
|||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
end
|
||||
|
||||
context "when associated administrateur" do
|
||||
let(:administrateur) { create(:administrateur, user: user) }
|
||||
|
||||
it 'signs user + instructeur + administrateur out' do
|
||||
sign_in user
|
||||
sign_in(administrateur.user)
|
||||
delete :destroy
|
||||
expect(@response.redirect?).to be(true)
|
||||
expect(subject.current_user).to be(nil)
|
||||
expect(subject.current_instructeur).to be(nil)
|
||||
expect(subject.current_administrateur).to be(nil)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#new' do
|
||||
|
|
|
@ -6,7 +6,7 @@ feature 'As an instructeur', js: true do
|
|||
let(:instructeur_email) { 'new_instructeur@gouv.fr' }
|
||||
|
||||
before do
|
||||
login_as administrateur, scope: :administrateur
|
||||
login_as administrateur.user, scope: :user
|
||||
visit admin_procedure_assigns_path(procedure)
|
||||
|
||||
fill_in :instructeur_email, with: instructeur_email
|
||||
|
|
|
@ -8,29 +8,6 @@ describe Administrateur, type: :model do
|
|||
it { is_expected.to have_many(:procedures) }
|
||||
end
|
||||
|
||||
context 'unified login' do
|
||||
it 'syncs credentials to associated user' do
|
||||
administrateur = create(:administrateur)
|
||||
user = administrateur.instructeur.user
|
||||
|
||||
administrateur.update(email: 'whoami@plop.com', password: 'voilà un super mdp')
|
||||
|
||||
user.reload
|
||||
expect(user.email).to eq('whoami@plop.com')
|
||||
expect(user.valid_password?('voilà un super mdp')).to be(true)
|
||||
end
|
||||
|
||||
it 'syncs credentials to associated administrateur' do
|
||||
administrateur = create(:administrateur)
|
||||
instructeur = administrateur.instructeur
|
||||
|
||||
administrateur.update(email: 'whoami@plop.com', password: 'et encore un autre mdp')
|
||||
|
||||
instructeur.reload
|
||||
expect(instructeur.email).to eq('whoami@plop.com')
|
||||
end
|
||||
end
|
||||
|
||||
describe "#renew_api_token" do
|
||||
let!(:administrateur) { create(:administrateur) }
|
||||
let!(:token) { administrateur.renew_api_token }
|
||||
|
@ -44,22 +21,6 @@ describe Administrateur, type: :model do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#find_inactive_by_token' do
|
||||
let(:administrateur) { create(:administration).invite_admin('paul@tps.fr') }
|
||||
let(:reset_password_token) { administrateur.invite!(administration.id) }
|
||||
|
||||
it { expect(Administrateur.find_inactive_by_token(reset_password_token)).not_to be_nil }
|
||||
end
|
||||
|
||||
describe '#reset_password' do
|
||||
let(:administrateur) { create(:administration).invite_admin('paul@tps.fr') }
|
||||
let(:reset_password_token) { administrateur.invite!(administration.id) }
|
||||
|
||||
it { expect(Administrateur.reset_password(reset_password_token, "j'aime manger des radis").errors).to be_empty }
|
||||
it { expect(Administrateur.reset_password('123', "j'aime manger des radis").errors).not_to be_empty }
|
||||
it { expect(Administrateur.reset_password(reset_password_token, '').errors).not_to be_empty }
|
||||
end
|
||||
|
||||
describe '#feature_enabled?' do
|
||||
let(:administrateur) { create(:administrateur) }
|
||||
|
||||
|
|
|
@ -137,18 +137,6 @@ describe Instructeur, type: :model do
|
|||
end
|
||||
end
|
||||
|
||||
context 'unified login' do
|
||||
it 'syncs credentials to associated administrateur' do
|
||||
admin = create(:administrateur)
|
||||
user = admin.instructeur.user
|
||||
|
||||
user.update(password: 'démarches-simplifiées-pwd')
|
||||
|
||||
admin.reload
|
||||
expect(admin.valid_password?('démarches-simplifiées-pwd')).to be(true)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'last_week_overview' do
|
||||
let!(:instructeur2) { create(:instructeur) }
|
||||
subject { instructeur2.last_week_overview }
|
||||
|
|
|
@ -100,18 +100,4 @@ describe User, type: :model do
|
|||
it { is_expected.to be_falsey }
|
||||
end
|
||||
end
|
||||
|
||||
context 'unified login' do
|
||||
it 'syncs credentials to associated administrateur' do
|
||||
admin = create(:administrateur)
|
||||
user = admin.instructeur.user
|
||||
|
||||
user.update(email: 'whoami@plop.com', password: 'démarches-simplifiées2')
|
||||
user.confirm
|
||||
|
||||
admin.reload
|
||||
expect(admin.email).to eq('whoami@plop.com')
|
||||
expect(admin.valid_password?('démarches-simplifiées2')).to be(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue