Class: Purist::Integrations::RSpec::BePure
- Inherits:
-
Object
- Object
- Purist::Integrations::RSpec::BePure
- Defined in:
- lib/purist/integrations/rspec/be_pure.rb
Instance Method Summary collapse
- #description ⇒ Object
- #description_when_negated ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
- #matches?(block) ⇒ Boolean
- #supports_block_expectations? ⇒ Boolean
- #supports_value_expectations? ⇒ Boolean
Instance Method Details
#description ⇒ Object
25 26 27 |
# File 'lib/purist/integrations/rspec/be_pure.rb', line 25 def description 'block to be pure' end |
#description_when_negated ⇒ Object
29 30 31 |
# File 'lib/purist/integrations/rspec/be_pure.rb', line 29 def description_when_negated 'block to be impure' end |
#failure_message ⇒ Object
33 34 35 |
# File 'lib/purist/integrations/rspec/be_pure.rb', line 33 def "expected #{description}, detected impure #{purist_exception.trace_point.inspect}" end |
#failure_message_when_negated ⇒ Object
37 38 39 |
# File 'lib/purist/integrations/rspec/be_pure.rb', line 37 def "expected #{description_when_negated}, but no side-effects were detected" end |
#matches?(block) ⇒ Boolean
15 16 17 18 19 20 21 22 23 |
# File 'lib/purist/integrations/rspec/be_pure.rb', line 15 def matches?(block) Purist.trace { block.call } true rescue Purist::Errors::PurityViolationError => e @purist_exception = e false end |
#supports_block_expectations? ⇒ Boolean
11 12 13 |
# File 'lib/purist/integrations/rspec/be_pure.rb', line 11 def supports_block_expectations? true end |
#supports_value_expectations? ⇒ Boolean
7 8 9 |
# File 'lib/purist/integrations/rspec/be_pure.rb', line 7 def supports_value_expectations? false end |