Module: OpenHAB::RSpec::ExampleGroup::ClassMethods
- Defined in:
- lib/openhab/rspec/example_group.rb
Overview
Extensions for ::RSpec::ExampleGroup's singleton class.
Instance Attribute Summary collapse
-
#consistent_proxies ⇒ true, ...
writeonly
Set if Items and Thing proxies should return consistent objects.
-
#mock_timers ⇒ true, ...
writeonly
Set if timers should be mocked for this example group.
-
#propagate_exceptions ⇒ true, ...
writeonly
Set if exceptions in rules should be propagated in specs, instead of just logged.
Instance Method Summary collapse
-
#consistent_proxies? ⇒ true, false
If Item and Thing proxies will consistently return the same object.
-
#mock_timers? ⇒ true, false
If timers are mocked for this example group.
-
#propagate_exceptions? ⇒ true, false
If timers are mocked for this example group.
Instance Attribute Details
#consistent_proxies=(value) ⇒ true, ... (writeonly)
Set if Items and Thing proxies should return consistent objects.
62 63 64 |
# File 'lib/openhab/rspec/example_group.rb', line 62 def consistent_proxies=(value) @consistent_proxies = value end |
#mock_timers=(value) ⇒ true, ... (writeonly)
Set if timers should be mocked for this example group.
25 26 27 |
# File 'lib/openhab/rspec/example_group.rb', line 25 def mock_timers=(value) @mock_timers = value end |
#propagate_exceptions=(value) ⇒ true, ... (writeonly)
Set if exceptions in rules should be propagated in specs, instead of just logged.
104 105 106 |
# File 'lib/openhab/rspec/example_group.rb', line 104 def propagate_exceptions=(value) @propagate_exceptions = value end |
Instance Method Details
#consistent_proxies? ⇒ true, false
If Item and Thing proxies will consistently return the same object.
Useful for mocking and using the be
matcher.
It will search through parent groups until it finds one where it's
explicitly defined, or defaults to true
if none are.
76 77 78 79 80 81 |
# File 'lib/openhab/rspec/example_group.rb', line 76 def consistent_proxies? return @consistent_proxies if instance_variable_defined?(:@consistent_proxies) && !@consistent_proxies.nil? return superclass.consistent_proxies? if superclass.is_a?(ClassMethods) true end |
#mock_timers? ⇒ true, false
If timers are mocked for this example group
It will search through parent groups until it finds one where it's
explicitly defined, or defaults to true
if none are.
37 38 39 40 41 42 |
# File 'lib/openhab/rspec/example_group.rb', line 37 def mock_timers? return @mock_timers if instance_variable_defined?(:@mock_timers) && !@mock_timers.nil? return superclass.mock_timers? if superclass.is_a?(ClassMethods) true end |
#propagate_exceptions? ⇒ true, false
If timers are mocked for this example group
It will search through parent groups until it finds one where it's
explicitly defined, or defaults to true
if none are.
116 117 118 119 120 121 122 123 |
# File 'lib/openhab/rspec/example_group.rb', line 116 def propagate_exceptions? if instance_variable_defined?(:@propagate_exceptions) && !@propagate_exceptions.nil? return @propagate_exceptions end return superclass.propagate_exceptions? if superclass.is_a?(ClassMethods) true end |