mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
refactor instance of test
This commit is contained in:
@@ -55,7 +55,7 @@ RSpec.describe FyipeLogger do
|
||||
logger = FyipeLogger.new($apiUrl, $applicationLog["_id"], $applicationLog["key"])
|
||||
response = logger.log(log)
|
||||
expect(response['content']).to eql log
|
||||
expect(response['content'].class.to_s).to eql "String"
|
||||
expect(response['content']).to be_an_instance_of(String)
|
||||
expect(response['type']).to eql "info"
|
||||
end
|
||||
it 'test_valid_object_content_of_type_info_is_logged' do
|
||||
@@ -66,7 +66,7 @@ RSpec.describe FyipeLogger do
|
||||
logger = FyipeLogger.new($apiUrl, $applicationLog["_id"], $applicationLog["key"])
|
||||
response = logger.log(log)
|
||||
expect(response['content']["location"]).to eql log["location"]
|
||||
expect(response['content'].class.to_s).to eql "Hash"
|
||||
expect(response['content']).to be_an_instance_of(Hash)
|
||||
expect(response['type']).to eql "info"
|
||||
end
|
||||
it 'test_valid_string_content_of_type_error_is_logged' do
|
||||
@@ -74,7 +74,7 @@ RSpec.describe FyipeLogger do
|
||||
logger = FyipeLogger.new($apiUrl, $applicationLog["_id"], $applicationLog["key"])
|
||||
response = logger.error(log)
|
||||
expect(response['content']).to eql log
|
||||
expect(response['content'].class.to_s).to eql "String"
|
||||
expect(response['content']).to be_an_instance_of(String)
|
||||
expect(response['type']).to eql "error"
|
||||
end
|
||||
it 'test_valid_object_content_of_type_warning_is_logged' do
|
||||
@@ -85,7 +85,7 @@ RSpec.describe FyipeLogger do
|
||||
logger = FyipeLogger.new($apiUrl, $applicationLog["_id"], $applicationLog["key"])
|
||||
response = logger.warning(log)
|
||||
expect(response['content']["location"]).to eql log["location"]
|
||||
expect(response['content'].class.to_s).to eql "Hash"
|
||||
expect(response['content']).to be_an_instance_of(Hash)
|
||||
expect(response['type']).to eql "warning"
|
||||
end
|
||||
it 'test_valid_object_content_of_type_warning_with_one_tag_is_logged' do
|
||||
@@ -97,9 +97,9 @@ RSpec.describe FyipeLogger do
|
||||
logger = FyipeLogger.new($apiUrl, $applicationLog["_id"], $applicationLog["key"])
|
||||
response = logger.warning(log, tag)
|
||||
expect(response['content']["location"]).to eql log["location"]
|
||||
expect(response['content'].class.to_s).to eql "Hash"
|
||||
expect(response['content']).to be_an_instance_of(Hash)
|
||||
expect(response['type']).to eql "warning"
|
||||
expect(response['tags'].class.to_s).to eql "Array"
|
||||
expect(response['tags']).to be_an_instance_of(Array)
|
||||
expect(response['tags'].find { |item| item == tag }).to_not be_nil
|
||||
end
|
||||
it 'test_valid_object_content_of_type_error_with_no_tag_is_logged' do
|
||||
@@ -107,10 +107,8 @@ RSpec.describe FyipeLogger do
|
||||
logger = FyipeLogger.new($apiUrl, $applicationLog["_id"], $applicationLog["key"])
|
||||
response = logger.error(log)
|
||||
expect(response['content']).to eql log
|
||||
expect(response['content'].class.to_s).to eql "String"
|
||||
expect(response['content']).to be_an_instance_of(String)
|
||||
expect(response['type']).to eql "error"
|
||||
expect(response['tags'].class.to_s).to eql "Array"
|
||||
expect(response['tags']).to eql []
|
||||
end
|
||||
it 'test_valid_object_content_of_type_warning_with_four_tags_is_logged' do
|
||||
log = {
|
||||
@@ -121,9 +119,9 @@ RSpec.describe FyipeLogger do
|
||||
logger = FyipeLogger.new($apiUrl, $applicationLog["_id"], $applicationLog["key"])
|
||||
response = logger.warning(log, tags)
|
||||
expect(response['content']["location"]).to eql log["location"]
|
||||
expect(response['content'].class.to_s).to eql "Hash"
|
||||
expect(response['content']).to be_an_instance_of(Hash)
|
||||
expect(response['type']).to eql "warning"
|
||||
expect(response['tags'].class.to_s).to eql "Array"
|
||||
expect(response['tags']).to be_an_instance_of(Array)
|
||||
tags.each {
|
||||
|tag| expect(response['tags'].find { |item| item == tag }).to_not be_nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user