2021-04-20 19:58:19 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
describe CustomWizard::Step do
|
2021-09-07 14:06:13 +02:00
|
|
|
let(:step_hash) { get_wizard_fixture("step/step") }
|
|
|
|
let(:field_hash) { get_wizard_fixture("field/field") }
|
2021-04-20 19:58:19 +02:00
|
|
|
|
2024-10-16 13:52:03 +02:00
|
|
|
before { @step = CustomWizard::Step.new(step_hash[:id]) }
|
2021-04-20 19:58:19 +02:00
|
|
|
|
|
|
|
it "adds fields" do
|
|
|
|
@step.add_field(field_hash)
|
|
|
|
expect(@step.fields.size).to eq(1)
|
|
|
|
expect(@step.fields.first.index).to eq(0)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "adds fields with custom indexes" do
|
|
|
|
field_hash[:index] = 2
|
|
|
|
@step.add_field(field_hash)
|
|
|
|
expect(@step.fields.first.index).to eq(2)
|
|
|
|
end
|
|
|
|
end
|