Class: RSpecRcv::Configuration
- Inherits:
-
Object
- Object
- RSpecRcv::Configuration
- Defined in:
- lib/rspec-rcv/configuration.rb
Constant Summary collapse
- DEFAULTS =
{ exportable_proc: Proc.new { JSON.parse(response.body) }, compare_with: Proc.new do |existing, new, opts| Helpers::DeepExcept.new(existing, opts[:ignore_keys]).to_h == Helpers::DeepExcept.new(new, opts[:ignore_keys]).to_h end, codec: Codecs::PrettyJson.new, ignore_keys: [], fail_on_changed_output: true, base_path: nil, fixture: nil, parse_existing: Proc.new do |existing| existing["data"] end }
Instance Method Summary collapse
- #base_path ⇒ Object
- #base_path=(val) ⇒ Object
- #codec ⇒ Object
- #codec=(val) ⇒ Object
- #compare_with ⇒ Object
- #compare_with=(val) ⇒ Object
- #configure_rspec_metadata! ⇒ Object
- #exportable_proc ⇒ Object
- #exportable_proc=(val) ⇒ Object
- #fail_on_changed_output ⇒ Object
- #fail_on_changed_output=(val) ⇒ Object
- #ignore_keys ⇒ Object
- #ignore_keys=(val) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #opts(overrides = {}) ⇒ Object
- #parse_existing ⇒ Object
- #parse_existing=(val) ⇒ Object
- #reset! ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
18 19 20 |
# File 'lib/rspec-rcv/configuration.rb', line 18 def initialize reset! end |
Instance Method Details
#base_path ⇒ Object
69 70 71 |
# File 'lib/rspec-rcv/configuration.rb', line 69 def base_path @opts[:base_path] end |
#base_path=(val) ⇒ Object
73 74 75 |
# File 'lib/rspec-rcv/configuration.rb', line 73 def base_path=(val) @opts[:base_path] = val end |
#codec ⇒ Object
45 46 47 |
# File 'lib/rspec-rcv/configuration.rb', line 45 def codec @opts[:codec] end |
#codec=(val) ⇒ Object
49 50 51 |
# File 'lib/rspec-rcv/configuration.rb', line 49 def codec=(val) @opts[:codec] = val end |
#compare_with ⇒ Object
61 62 63 |
# File 'lib/rspec-rcv/configuration.rb', line 61 def compare_with @opts[:compare_with] end |
#compare_with=(val) ⇒ Object
65 66 67 |
# File 'lib/rspec-rcv/configuration.rb', line 65 def compare_with=(val) @opts[:compare_with] = val end |
#configure_rspec_metadata! ⇒ Object
22 23 24 25 26 27 |
# File 'lib/rspec-rcv/configuration.rb', line 22 def unless @rspec_metadata_configured RSpecRcv::RSpec::Metadata.configure! @rspec_metadata_configured = true end end |
#exportable_proc ⇒ Object
37 38 39 |
# File 'lib/rspec-rcv/configuration.rb', line 37 def exportable_proc @opts[:exportable_proc] end |
#exportable_proc=(val) ⇒ Object
41 42 43 |
# File 'lib/rspec-rcv/configuration.rb', line 41 def exportable_proc=(val) @opts[:exportable_proc] = val end |
#fail_on_changed_output ⇒ Object
77 78 79 |
# File 'lib/rspec-rcv/configuration.rb', line 77 def fail_on_changed_output @opts[:fail_on_changed_output] end |
#fail_on_changed_output=(val) ⇒ Object
81 82 83 |
# File 'lib/rspec-rcv/configuration.rb', line 81 def fail_on_changed_output=(val) @opts[:fail_on_changed_output] = val end |
#ignore_keys ⇒ Object
53 54 55 |
# File 'lib/rspec-rcv/configuration.rb', line 53 def ignore_keys @opts[:ignore_keys] end |
#ignore_keys=(val) ⇒ Object
57 58 59 |
# File 'lib/rspec-rcv/configuration.rb', line 57 def ignore_keys=(val) @opts[:ignore_keys] = val end |
#opts(overrides = {}) ⇒ Object
33 34 35 |
# File 'lib/rspec-rcv/configuration.rb', line 33 def opts(overrides={}) @opts.merge(overrides) end |
#parse_existing ⇒ Object
85 86 87 |
# File 'lib/rspec-rcv/configuration.rb', line 85 def parse_existing @opts[:parse_existing] end |
#parse_existing=(val) ⇒ Object
89 90 91 |
# File 'lib/rspec-rcv/configuration.rb', line 89 def parse_existing=(val) @opts[:parse_existing] = val end |
#reset! ⇒ Object
29 30 31 |
# File 'lib/rspec-rcv/configuration.rb', line 29 def reset! @opts = DEFAULTS.dup end |