Class: Surrogate::RSpec::WithFilter
- Inherits:
-
Object
- Object
- Surrogate::RSpec::WithFilter
- Defined in:
- lib/surrogate/rspec/with_filter.rb
Defined Under Namespace
Classes: BlockAsserter, RSpecMatchAsserter
Instance Attribute Summary collapse
-
#block ⇒ Object
rename args to invocation.
-
#expected_invocation ⇒ Object
rename args to invocation.
-
#filter_name ⇒ Object
rename args to invocation.
-
#pass ⇒ Object
rename args to invocation.
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.
100 101 102 103 104 105 |
# File 'lib/surrogate/rspec/with_filter.rb', line 100 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
rename args to invocation
98 99 100 |
# File 'lib/surrogate/rspec/with_filter.rb', line 98 def block @block end |
#expected_invocation ⇒ Object
rename args to invocation
98 99 100 |
# File 'lib/surrogate/rspec/with_filter.rb', line 98 def expected_invocation @expected_invocation end |
#filter_name ⇒ Object
rename args to invocation
98 99 100 |
# File 'lib/surrogate/rspec/with_filter.rb', line 98 def filter_name @filter_name end |
#pass ⇒ Object
rename args to invocation
98 99 100 |
# File 'lib/surrogate/rspec/with_filter.rb', line 98 def pass @pass end |
Instance Method Details
#default? ⇒ Boolean
111 112 113 |
# File 'lib/surrogate/rspec/with_filter.rb', line 111 def default? filter_name == :default_filter end |
#filter(invocations) ⇒ Object
107 108 109 |
# File 'lib/surrogate/rspec/with_filter.rb', line 107 def filter(invocations) invocations.select &pass end |