2021-03-11 07:30:15 +01:00
|
|
|
# frozen_string_literal: true
|
2020-11-30 22:20:10 +01:00
|
|
|
require_relative '../../../plugin_helper'
|
2020-11-03 01:24:20 +01:00
|
|
|
|
|
|
|
describe CustomWizard::AdminLogsController do
|
|
|
|
fab!(:admin_user) { Fabricate(:user, admin: true) }
|
2021-03-11 07:30:15 +01:00
|
|
|
|
2020-11-03 01:24:20 +01:00
|
|
|
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
|
|
|
sign_in(admin_user)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "returns a list of logs" do
|
|
|
|
get "/admin/wizards/logs.json"
|
|
|
|
expect(response.parsed_body.length).to eq(3)
|
|
|
|
end
|
2021-03-11 07:30:15 +01:00
|
|
|
|
2020-11-03 01:24:20 +01:00
|
|
|
it "paginates" do
|
|
|
|
get "/admin/wizards/logs.json", params: { page: 1, limit: 2 }
|
|
|
|
expect(response.parsed_body.length).to eq(1)
|
|
|
|
end
|
2021-03-11 07:30:15 +01:00
|
|
|
end
|