Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-26 02:50:28 +01:00
DEV: update tests for split log fields
Dieser Commit ist enthalten in:
Ursprung
35ff172967
Commit
c394656ed8
3 geänderte Dateien mit 11 neuen und 8 gelöschten Zeilen
|
@ -3,9 +3,9 @@ require_relative '../../plugin_helper'
|
||||||
|
|
||||||
describe CustomWizard::Log do
|
describe CustomWizard::Log do
|
||||||
before do
|
before do
|
||||||
CustomWizard::Log.create("First log message")
|
CustomWizard::Log.create('first-test-wizard', 'perform_first_action', 'first_test_user', 'First log message')
|
||||||
CustomWizard::Log.create("Second log message")
|
CustomWizard::Log.create('second-test-wizard', 'perform_second_action', 'second_test_user', 'Second log message')
|
||||||
CustomWizard::Log.create("Third log message")
|
CustomWizard::Log.create('third-test-wizard', 'perform_third_action', 'third_test_user', 'Third log message')
|
||||||
end
|
end
|
||||||
|
|
||||||
it "creates logs" do
|
it "creates logs" do
|
||||||
|
|
|
@ -5,9 +5,9 @@ describe CustomWizard::AdminLogsController do
|
||||||
fab!(:admin_user) { Fabricate(:user, admin: true) }
|
fab!(:admin_user) { Fabricate(:user, admin: true) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
CustomWizard::Log.create("First log message")
|
CustomWizard::Log.create('first-test-wizard', 'perform_first_action', 'first_test_user', 'First log message')
|
||||||
CustomWizard::Log.create("Second log message")
|
CustomWizard::Log.create('second-test-wizard', 'perform_second_action', 'second_test_user', 'Second log message')
|
||||||
CustomWizard::Log.create("Third log message")
|
CustomWizard::Log.create('third-test-wizard', 'perform_third_action', 'third_test_user', 'Third log message')
|
||||||
sign_in(admin_user)
|
sign_in(admin_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -6,14 +6,17 @@ describe CustomWizard::LogSerializer do
|
||||||
fab!(:user) { Fabricate(:user) }
|
fab!(:user) { Fabricate(:user) }
|
||||||
|
|
||||||
it 'should return log attributes' do
|
it 'should return log attributes' do
|
||||||
CustomWizard::Log.create("First log message")
|
CustomWizard::Log.create('first-test-wizard', 'perform_first_action', 'first_test_user', 'First log message')
|
||||||
CustomWizard::Log.create("Second log message")
|
CustomWizard::Log.create('second-test-wizard', 'perform_second_action', 'second_test_user', 'Second log message')
|
||||||
|
|
||||||
json_array = ActiveModel::ArraySerializer.new(
|
json_array = ActiveModel::ArraySerializer.new(
|
||||||
CustomWizard::Log.list(0),
|
CustomWizard::Log.list(0),
|
||||||
each_serializer: CustomWizard::LogSerializer
|
each_serializer: CustomWizard::LogSerializer
|
||||||
).as_json
|
).as_json
|
||||||
expect(json_array.length).to eq(2)
|
expect(json_array.length).to eq(2)
|
||||||
|
expect(json_array[0][:wizard]).to eq("second-test-wizard")
|
||||||
|
expect(json_array[0][:action]).to eq("perform_second_action")
|
||||||
|
expect(json_array[0][:user]).to eq("second_test_user")
|
||||||
expect(json_array[0][:message]).to eq("Second log message")
|
expect(json_array[0][:message]).to eq("Second log message")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Laden …
In neuem Issue referenzieren