Skip to content

Commit 7ccf409

Browse files
authored
Remove uuid dependency (#561)
1 parent 36cb2b5 commit 7ccf409

File tree

7 files changed

+6
-9
lines changed

7 files changed

+6
-9
lines changed

.github/dependabot.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ updates:
2020
dependency-type: indirect
2121
- dependency-name: require_all
2222
dependency-type: indirect
23-
- dependency-name: uuid
24-
dependency-type: indirect
2523
- package-ecosystem: bundler
2624
directory: /allure-rspec
2725
schedule:

allure-ruby-commons/allure-ruby-commons.gemspec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,4 @@ Gem::Specification.new do |s|
3131
s.add_dependency "mime-types", ">= 3.3", "< 4"
3232
s.add_dependency "require_all", ">= 2", "< 4"
3333
s.add_dependency "rspec-expectations", "~> 3.12"
34-
s.add_dependency "uuid", ">= 2.3", "< 3"
3534
end

allure-ruby-commons/lib/allure-ruby-commons.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# frozen_string_literal: true
33

44
require "require_all"
5-
require "uuid"
5+
require "securerandom"
66

77
require_rel "allure_ruby_commons/**/*rb"
88

allure-ruby-commons/lib/allure_ruby_commons/model/test_result.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class TestResult < ExecutableItem
1919
# @option options [Array<Allure::Link>] :links ([])
2020
# @option options [Array<Allure::Attachment>] :attachments ([])
2121
# @option options [Array<Allure::Parameter>] :parameters ([])
22-
def initialize(uuid: UUID.generate, history_id: UUID.generate, environment: nil, **options)
22+
def initialize(uuid: SecureRandom.uuid, history_id: SecureRandom.uuid, environment: nil, **options)
2323
super
2424

2525
@name = options[:name]

allure-ruby-commons/lib/allure_ruby_commons/model/test_result_container.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Allure
44
# Allure model step result container
55
class TestResultContainer < JSONable
6-
def initialize(uuid: UUID.generate, name: "Unnamed")
6+
def initialize(uuid: SecureRandom.uuid, name: "Unnamed")
77
super()
88

99
@uuid = uuid

allure-ruby-commons/lib/allure_ruby_commons/result_utils.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def status_details(exception)
168168
# @return [Allure::Attachment]
169169
def prepare_attachment(name, type)
170170
extension = ContentType.to_extension(type) || return
171-
file_name = "#{UUID.generate}-attachment.#{extension}"
171+
file_name = "#{SecureRandom.uuid}-attachment.#{extension}"
172172
Attachment.new(name: name, source: file_name, type: type)
173173
end
174174

allure-ruby-commons/spec/unit/file_writer_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
attachment = Allure::Attachment.new(
3030
name: "Test attachment",
3131
type: Allure::ContentType::TXT,
32-
source: "#{UUID.generate}-attachment.txt"
32+
source: "#{SecureRandom.uuid}-attachment.txt"
3333
)
3434
attachment_file = File.join(results_dir, attachment.source)
3535
file_writer.write_attachment("Test attachment", attachment)
@@ -41,7 +41,7 @@
4141
attachment = Allure::Attachment.new(
4242
name: "Test attachment",
4343
type: Allure::ContentType::PNG,
44-
source: "#{UUID.generate}-attachment.png"
44+
source: "#{SecureRandom.uuid}-attachment.png"
4545
)
4646
source = File.new(File.join(Dir.pwd, "spec", "fixtures", "ruby-logo.png"))
4747
attachment_file = File.join(results_dir, attachment.source)

0 commit comments

Comments
 (0)