Class: FlakyTestTracker::Configuration
- Inherits:
-
Object
- Object
- FlakyTestTracker::Configuration
- Defined in:
- lib/flaky_test_tracker/configuration.rb
Overview
Configuration.
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
-
#pretend ⇒ Object
Returns the value of attribute pretend.
-
#reporter_class ⇒ Object
Returns the value of attribute reporter_class.
-
#reporter_options ⇒ Object
Returns the value of attribute reporter_options.
-
#source_class ⇒ Object
Returns the value of attribute source_class.
-
#source_options ⇒ Object
Returns the value of attribute source_options.
-
#storage_class ⇒ Object
Returns the value of attribute storage_class.
-
#storage_options ⇒ Object
Returns the value of attribute storage_options.
-
#verbose ⇒ Object
Returns the value of attribute verbose.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #reporter ⇒ Object
- #reporter=(reporter) ⇒ Object
- #reporter_class_name=(reporter_class_name) ⇒ Object
- #source ⇒ Object
- #source=(source) ⇒ Object
- #source_class_name=(source_class_name) ⇒ Object
- #source_type=(source_type) ⇒ Object
- #storage ⇒ Object
- #storage=(storage) ⇒ Object
- #storage_class_name=(storage_class_name) ⇒ Object
- #storage_type=(storage_type) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/flaky_test_tracker/configuration.rb', line 10 def initialize @pretend = false @context = {} @verbose = true @source_class = nil # NullSource @source_options = {} @storage_class = nil # NullStorage @storage_options = {} @reporter_class = nil # NullReporter @reporter_options = {} end |
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
6 7 8 |
# File 'lib/flaky_test_tracker/configuration.rb', line 6 def context @context end |
#pretend ⇒ Object
Returns the value of attribute pretend.
6 7 8 |
# File 'lib/flaky_test_tracker/configuration.rb', line 6 def pretend @pretend end |
#reporter_class ⇒ Object
Returns the value of attribute reporter_class.
8 9 10 |
# File 'lib/flaky_test_tracker/configuration.rb', line 8 def reporter_class @reporter_class end |
#reporter_options ⇒ Object
Returns the value of attribute reporter_options.
8 9 10 |
# File 'lib/flaky_test_tracker/configuration.rb', line 8 def @reporter_options end |
#source_class ⇒ Object
Returns the value of attribute source_class.
8 9 10 |
# File 'lib/flaky_test_tracker/configuration.rb', line 8 def source_class @source_class end |
#source_options ⇒ Object
Returns the value of attribute source_options.
8 9 10 |
# File 'lib/flaky_test_tracker/configuration.rb', line 8 def @source_options end |
#storage_class ⇒ Object
Returns the value of attribute storage_class.
8 9 10 |
# File 'lib/flaky_test_tracker/configuration.rb', line 8 def storage_class @storage_class end |
#storage_options ⇒ Object
Returns the value of attribute storage_options.
8 9 10 |
# File 'lib/flaky_test_tracker/configuration.rb', line 8 def @storage_options end |
#verbose ⇒ Object
Returns the value of attribute verbose.
6 7 8 |
# File 'lib/flaky_test_tracker/configuration.rb', line 6 def verbose @verbose end |
Instance Method Details
#reporter ⇒ Object
130 131 132 133 134 |
# File 'lib/flaky_test_tracker/configuration.rb', line 130 def reporter self.reporter = reporter_class.build(**) unless @reporter @reporter end |
#reporter=(reporter) ⇒ Object
119 120 121 122 123 124 125 126 127 128 |
# File 'lib/flaky_test_tracker/configuration.rb', line 119 def reporter=(reporter) reporter_methods = %i[tracked_tests resolved_tests] reporter_methods.each do |reporter_method| unless reporter.respond_to?(reporter_method) raise ArgumentError, "Expect reporter to respond to #{reporter_method}" end end @reporter = reporter end |
#reporter_class_name=(reporter_class_name) ⇒ Object
103 104 105 |
# File 'lib/flaky_test_tracker/configuration.rb', line 103 def reporter_class_name=(reporter_class_name) self.reporter_class = Object.const_get(reporter_class_name) end |
#source ⇒ Object
56 57 58 59 60 |
# File 'lib/flaky_test_tracker/configuration.rb', line 56 def source self.source = source_class.build(**) unless @source @source end |
#source=(source) ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/flaky_test_tracker/configuration.rb', line 48 def source=(source) source_methods = %i[file_source_location_uri source_uri] source_methods.each do |source_method| raise ArgumentError, "Expect source to respond to #{source_method}" unless source.respond_to?(source_method) end @source = source end |
#source_class_name=(source_class_name) ⇒ Object
22 23 24 |
# File 'lib/flaky_test_tracker/configuration.rb', line 22 def source_class_name=(source_class_name) self.source_class = Object.const_get(source_class_name) end |
#source_type=(source_type) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/flaky_test_tracker/configuration.rb', line 26 def source_type=(source_type) self.source_class = case source_type.to_s when "github" FlakyTestTracker::Source::GitHubSource else raise ArgumentError, "Unkown source type #{source_type}" end end |
#storage ⇒ Object
97 98 99 100 101 |
# File 'lib/flaky_test_tracker/configuration.rb', line 97 def storage self.storage = storage_class.build(**) unless @storage @storage end |
#storage=(storage) ⇒ Object
82 83 84 85 86 87 88 89 |
# File 'lib/flaky_test_tracker/configuration.rb', line 82 def storage=(storage) storage_methods = %i[all create update delete] storage_methods.each do |storage_method| raise ArgumentError, "Expect storage to respond to #{storage_method}" unless storage.respond_to?(storage_method) end @storage = storage end |
#storage_class_name=(storage_class_name) ⇒ Object
62 63 64 |
# File 'lib/flaky_test_tracker/configuration.rb', line 62 def storage_class_name=(storage_class_name) self.storage_class = Object.const_get(storage_class_name) end |
#storage_type=(storage_type) ⇒ Object
66 67 68 69 70 71 72 73 74 |
# File 'lib/flaky_test_tracker/configuration.rb', line 66 def storage_type=(storage_type) self.storage_class = case storage_type.to_s when "github_issue" FlakyTestTracker::Storage::GitHubIssueStorage else raise ArgumentError, "Unkown storage type #{storage_type}" end end |