0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-27 11:20:28 +01:00
discourse-custom-wizard/spec/components/custom_wizard/log_spec.rb

34 Zeilen
903 B
Ruby

2021-03-11 07:30:15 +01:00
# frozen_string_literal: true
2020-11-03 01:24:20 +01:00
describe CustomWizard::Log do
before do
2021-08-30 15:45:57 +02:00
CustomWizard::Log.create('first-test-wizard', 'perform_first_action', 'first_test_user', 'First log message')
CustomWizard::Log.create('second-test-wizard', 'perform_second_action', 'second_test_user', 'Second log message')
CustomWizard::Log.create('third-test-wizard', 'perform_third_action', 'third_test_user', 'Third log message')
2020-11-03 01:24:20 +01:00
end
2021-03-11 07:30:15 +01:00
2020-11-03 01:24:20 +01:00
it "creates logs" do
expect(
CustomWizard::Log.list.logs.length
2020-11-03 01:24:20 +01:00
).to eq(3)
end
2021-03-11 07:30:15 +01:00
2020-11-03 01:24:20 +01:00
it "lists logs by time created" do
expect(
CustomWizard::Log.list.logs.first.message
2020-11-03 01:24:20 +01:00
).to eq("Third log message")
end
2021-03-11 07:30:15 +01:00
2020-11-03 01:24:20 +01:00
it "paginates logs" do
expect(
CustomWizard::Log.list(0, 2).logs.length
2020-11-03 01:24:20 +01:00
).to eq(2)
end
it "lists logs by wizard" do
expect(
CustomWizard::Log.list(0, 2, 'third-test-wizard').logs.length
).to eq(1)
end
2021-03-11 07:30:15 +01:00
end