Module: Resteze::Testing::Configuration

Extended by:
ActiveSupport::Concern
Defined in:
lib/resteze/testing/rspec/configure.rb,
lib/resteze/testing/minitest/configuration.rb

Instance Method Summary collapse

Instance Method Details

#assert_config_property(property, value = nil, subject: nil) ⇒ Object

Assert that a config property is supported and can be assigned



5
6
7
8
9
10
11
12
13
# File 'lib/resteze/testing/rspec/configure.rb', line 5

def assert_config_property(property, value = nil, subject: nil)
  subject ||= (defined?(@subject) && @subject) || self.subject
  original_value = subject.send(property)

  expect(subject.send(property)).to eq(value), "config property #{property} value did not match expectation"
ensure
  # Make sure to set the original value at the end
  subject.send("#{property}=", original_value)
end