diff --git a/spec/models/wizards/signup/abo_basic_login_wizard_spec.rb b/spec/models/wizards/signup/abo_basic_login_wizard_spec.rb index 6c51657d7..0b4f81ba8 100644 --- a/spec/models/wizards/signup/abo_basic_login_wizard_spec.rb +++ b/spec/models/wizards/signup/abo_basic_login_wizard_spec.rb @@ -104,6 +104,13 @@ def build(params = required_attrs) expect(max.subscriptions).to be_empty expect(newsletter.people).to be_empty end + + it "saves role for current_user when logged in" do + allow_any_instance_of(Wizards::Signup::AboBasicLoginWizard).to receive(:current_user).and_return(people(:admin)) + expect(wizard).to be_valid + expect { wizard.save! }.not_to change { Person.count } + expect(people(:admin).roles.last.type).to eq Group::AboBasicLogin::BasicLogin.sti_name + end end describe "steps" do diff --git a/spec/models/wizards/signup/abo_magazin_wizard_spec.rb b/spec/models/wizards/signup/abo_magazin_wizard_spec.rb index 8e9cf68a8..449ddbf4c 100644 --- a/spec/models/wizards/signup/abo_magazin_wizard_spec.rb +++ b/spec/models/wizards/signup/abo_magazin_wizard_spec.rb @@ -129,6 +129,13 @@ def build(params = required_attrs) .with(kind_of(Person), group, true) end end + + it "saves role for current_user when logged in" do + allow_any_instance_of(Wizards::Signup::AboBasicLoginWizard).to receive(:current_user).and_return(people(:admin)) + expect(wizard).to be_valid + expect { wizard.save! }.not_to change { Person.count } + expect(people(:admin).roles.last.type).to eq Group::AboMagazin::Abonnent.sti_name + end end describe "#calculate_costs" do diff --git a/spec/models/wizards/signup/abo_touren_portal_wizard_spec.rb b/spec/models/wizards/signup/abo_touren_portal_wizard_spec.rb index 3d68d2113..663debad2 100644 --- a/spec/models/wizards/signup/abo_touren_portal_wizard_spec.rb +++ b/spec/models/wizards/signup/abo_touren_portal_wizard_spec.rb @@ -114,6 +114,13 @@ def build(params = required_attrs) expect(max.subscriptions).to have(1).item expect(newsletter.people).to eq [max] end + + it "saves role for current_user when logged in" do + allow_any_instance_of(Wizards::Signup::AboBasicLoginWizard).to receive(:current_user).and_return(people(:admin)) + expect(wizard).to be_valid + expect { wizard.save! }.not_to change { Person.count } + expect(people(:admin).roles.last.type).to eq Group::AboTourenPortal::Abonnent.sti_name + end end describe "steps" do