Module: Clowne::RSpec::Helpers
- Included in:
- Matchers::CloneAssociation, Matchers::CloneAssociations
- Defined in:
- lib/clowne/rspec/helpers.rb
Overview
:nodoc: all
Instance Attribute Summary collapse
-
#cloner ⇒ Object
readonly
Returns the value of attribute cloner.
Instance Method Summary collapse
- #matches?(actual) ⇒ Boolean
- #non_cloner_message ⇒ Object
- #plan ⇒ Object
- #with_traits(*traits) ⇒ Object
Instance Attribute Details
#cloner ⇒ Object (readonly)
Returns the value of attribute cloner.
6 7 8 |
# File 'lib/clowne/rspec/helpers.rb', line 6 def cloner @cloner end |
Instance Method Details
#matches?(actual) ⇒ Boolean
13 14 15 16 17 18 |
# File 'lib/clowne/rspec/helpers.rb', line 13 def matches?(actual) raise ArgumentError, unless actual <= ::Clowne::Cloner @cloner = actual super end |
#non_cloner_message ⇒ Object
29 30 31 32 |
# File 'lib/clowne/rspec/helpers.rb', line 29 def "expected a cloner to be passed to `expect(...)`, " \ "but got #{actual_formatted}" end |
#plan ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/clowne/rspec/helpers.rb', line 20 def plan @plan ||= if @traits.nil? cloner.default_plan else cloner.plan_with_traits(@traits) end end |
#with_traits(*traits) ⇒ Object
8 9 10 11 |
# File 'lib/clowne/rspec/helpers.rb', line 8 def with_traits(*traits) @traits = traits self end |