Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2018-04-10 14:22:19 +0300
committerRémy Coutable <remy@rymai.me>2018-04-10 16:38:40 +0300
commitb11e887582882bcf9c1787e18ccf34747ae50f91 (patch)
tree3eebc627a3cceceb4454664be059e2b75c7dd071 /lib/rspec_flaky/flaky_examples_collection.rb
parent9bb97abf041d7aa17fc72b850ecc1695c1bad0f5 (diff)
Improve the architecture of RspecFlaky classes by introducing a new RspecFlaky::Report class
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'lib/rspec_flaky/flaky_examples_collection.rb')
-rw-r--r--lib/rspec_flaky/flaky_examples_collection.rb8
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/rspec_flaky/flaky_examples_collection.rb b/lib/rspec_flaky/flaky_examples_collection.rb
index 27a2845fb50..dea23c325be 100644
--- a/lib/rspec_flaky/flaky_examples_collection.rb
+++ b/lib/rspec_flaky/flaky_examples_collection.rb
@@ -1,13 +1,9 @@
-require 'json'
+require 'active_support/hash_with_indifferent_access'
require_relative 'flaky_example'
module RspecFlaky
class FlakyExamplesCollection < SimpleDelegator
- def self.from_json(json)
- new(JSON.parse(json))
- end
-
def initialize(collection = {})
unless collection.is_a?(Hash)
raise ArgumentError, "`collection` must be a Hash, #{collection.class} given!"
@@ -24,7 +20,7 @@ module RspecFlaky
super(Hash[collection_of_flaky_examples])
end
- def to_report
+ def to_h
Hash[map { |uid, example| [uid, example.to_h] }].deep_symbolize_keys
end