0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-10 04:12:53 +01:00

Remove out of date specs

Dieser Commit ist enthalten in:
Angus McLeod 2022-07-28 20:37:10 +01:00
Ursprung 12e1d802a3
Commit dd74989562
3 geänderte Dateien mit 1 neuen und 62 gelöschten Zeilen

Datei anzeigen

@ -40,7 +40,7 @@ describe CustomWizard::Submission do
expect(described_class.list(@wizard, user_id: user.id).size).to eq(1)
end
context "#cleanup_incomplete_submissions" do
describe "#cleanup_incomplete_submissions" do
it "cleans up redundant incomplete submissions on each build" do
freeze_time Time.now + 1
described_class.new(@wizard, step_1_field_1: "I am the second submission").save

Datei anzeigen

@ -192,15 +192,6 @@ describe CustomWizard::Wizard do
).to eq(false)
end
it "lists the site groups" do
expect(@wizard.groups.length).to eq(8)
end
it "lists the site categories" do
Site.clear_cache
expect(@wizard.categories.length).to eq(1)
end
context "submissions" do
before do
CustomWizard::Submission.new(@wizard, step_1_field_1: "I am a user submission").save

Datei anzeigen

@ -47,56 +47,4 @@ describe CustomWizard::WizardSerializer do
json[:wizard][:user]
).to eq(BasicUserSerializer.new(user, root: false).as_json)
end
it "should not return categories if there are no category fields" do
@template[:steps][2][:fields].delete_at(2)
CustomWizard::Template.save(@template)
json = CustomWizard::WizardSerializer.new(
CustomWizard::Builder.new(@template[:id], user).build,
scope: Guardian.new(user)
).as_json
expect(json[:wizard][:categories].present?).to eq(false)
expect(json[:wizard][:uncategorized_category_id].present?).to eq(false)
end
it "should return categories if there is a category selector field" do
json = CustomWizard::WizardSerializer.new(
CustomWizard::Builder.new(@template[:id], user).build,
scope: Guardian.new(user)
).as_json
expect(json[:wizard][:categories].present?).to eq(true)
expect(json[:wizard][:uncategorized_category_id].present?).to eq(true)
end
it "should return categories if there is a similar topics validation scoped to category(s)" do
@template[:steps][0][:fields][0][:validations] = similar_topics_validation[:validations]
CustomWizard::Template.save(@template)
json = CustomWizard::WizardSerializer.new(
CustomWizard::Builder.new(@template[:id], user).build,
scope: Guardian.new(user)
).as_json
expect(json[:wizard][:categories].present?).to eq(true)
expect(json[:wizard][:uncategorized_category_id].present?).to eq(true)
end
it 'should return groups if there is a group selector field' do
json = CustomWizard::WizardSerializer.new(
CustomWizard::Builder.new(@template[:id], user).build,
scope: Guardian.new(user)
).as_json
expect(json[:wizard][:groups].length).to eq(8)
end
it 'should not return groups if there is not a group selector field' do
@template[:steps][2][:fields].delete_at(3)
CustomWizard::Template.save(@template)
json = CustomWizard::WizardSerializer.new(
CustomWizard::Builder.new(@template[:id], user).build,
scope: Guardian.new(user)
).as_json
expect(json[:wizard][:groups].present?).to eq(false)
end
end