Class: Surrogate::RSpec::WithFilter
- Inherits:
-
Object
- Object
- Surrogate::RSpec::WithFilter
- Defined in:
- lib/surrogate/rspec/with_filter.rb,
lib/surrogate/rspec/block_asserter.rb
Defined Under Namespace
Classes: BlockAsserter, RSpecMatchAsserter
Instance Attribute Summary collapse
-
#block ⇒ Object
Returns the value of attribute block.
-
#expected_invocation ⇒ Object
Returns the value of attribute expected_invocation.
-
#filter_name ⇒ Object
Returns the value of attribute filter_name.
-
#pass ⇒ Object
Returns the value of attribute pass.
Instance Method Summary collapse
- #default? ⇒ Boolean
- #filter(invocations) ⇒ Object
-
#initialize(args = [], filter_name = :default_filter, &block) ⇒ WithFilter
constructor
A new instance of WithFilter.
Constructor Details
#initialize(args = [], filter_name = :default_filter, &block) ⇒ WithFilter
Returns a new instance of WithFilter.
36 37 38 39 40 41 |
# File 'lib/surrogate/rspec/with_filter.rb', line 36 def initialize(args=[], filter_name=:default_filter, &block) self.expected_invocation = Invocation.new args.dup, &block self.block = block self.pass = send filter_name self.filter_name = filter_name end |
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block
34 35 36 |
# File 'lib/surrogate/rspec/with_filter.rb', line 34 def block @block end |
#expected_invocation ⇒ Object
Returns the value of attribute expected_invocation
34 35 36 |
# File 'lib/surrogate/rspec/with_filter.rb', line 34 def expected_invocation @expected_invocation end |
#filter_name ⇒ Object
Returns the value of attribute filter_name
34 35 36 |
# File 'lib/surrogate/rspec/with_filter.rb', line 34 def filter_name @filter_name end |
#pass ⇒ Object
Returns the value of attribute pass
34 35 36 |
# File 'lib/surrogate/rspec/with_filter.rb', line 34 def pass @pass end |
Instance Method Details
#default? ⇒ Boolean
47 48 49 |
# File 'lib/surrogate/rspec/with_filter.rb', line 47 def default? filter_name == :default_filter end |
#filter(invocations) ⇒ Object
43 44 45 |
# File 'lib/surrogate/rspec/with_filter.rb', line 43 def filter(invocations) invocations.select &pass end |