Skip to content

Commit

Permalink
Add specs for current steps
Browse files Browse the repository at this point in the history
  • Loading branch information
njaeggi committed Dec 17, 2024
1 parent 0ce543f commit 5c4bde0
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
12 changes: 12 additions & 0 deletions spec/models/wizards/signup/abo_basic_login_wizard_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,16 @@ def build(params = required_attrs)
expect(newsletter.people).to be_empty
end
end

describe "steps" do
it "starts at main email field step when not logged in" do
expect(wizard.step_at(0)).to be_instance_of(Wizards::Steps::Signup::MainEmailField)
expect(wizard.step_at(1)).to be_instance_of(Wizards::Steps::Signup::AboBasicLogin::PersonFields)
end

it "starts at person fields step when logged in" do
allow_any_instance_of(Wizards::Signup::AboBasicLoginWizard).to receive(:current_user).and_return(people(:admin))
expect(wizard.step_at(0)).to be_instance_of(Wizards::Steps::Signup::AboBasicLogin::PersonFields)
end
end
end
14 changes: 14 additions & 0 deletions spec/models/wizards/signup/abo_magazin_wizard_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,18 @@ def build(params = required_attrs)
expect(wizard.calculated_costs).to eq(76)
end
end

describe "steps" do
it "starts at main email field step when not logged in" do
expect(wizard.step_at(0)).to be_instance_of(Wizards::Steps::Signup::MainEmailField)
expect(wizard.step_at(1)).to be_instance_of(Wizards::Steps::Signup::AboMagazin::PersonFields)
expect(wizard.step_at(2)).to be_instance_of(Wizards::Steps::Signup::AboMagazin::Summary)
end

it "starts at person fields step when logged in" do
allow_any_instance_of(Wizards::Signup::AboBasicLoginWizard).to receive(:current_user).and_return(people(:admin))
expect(wizard.step_at(0)).to be_instance_of(Wizards::Steps::Signup::AboMagazin::PersonFields)
expect(wizard.step_at(1)).to be_instance_of(Wizards::Steps::Signup::AboMagazin::Summary)
end
end
end
12 changes: 12 additions & 0 deletions spec/models/wizards/signup/abo_touren_portal_wizard_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,16 @@ def build(params = required_attrs)
expect(newsletter.people).to eq [max]
end
end

describe "steps" do
it "starts at main email field step when not logged in" do
expect(wizard.step_at(0)).to be_instance_of(Wizards::Steps::Signup::MainEmailField)
expect(wizard.step_at(1)).to be_instance_of(Wizards::Steps::Signup::AboTourenPortal::PersonFields)
end

it "starts at person fields step when logged in" do
allow_any_instance_of(Wizards::Signup::AboBasicLoginWizard).to receive(:current_user).and_return(people(:admin))
expect(wizard.step_at(0)).to be_instance_of(Wizards::Steps::Signup::AboTourenPortal::PersonFields)
end
end
end

0 comments on commit 5c4bde0

Please sign in to comment.