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
|
|
|
|
CustomWizard::Log.create("First log message")
|
|
|
|
CustomWizard::Log.create("Second log message")
|
|
|
|
CustomWizard::Log.create("Third log message")
|
|
|
|
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.length
|
|
|
|
).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.first.message
|
|
|
|
).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).length
|
|
|
|
).to eq(2)
|
|
|
|
end
|
2021-03-11 07:30:15 +01:00
|
|
|
end
|