class Object
Public Instance Methods
set_expected_key_and_value(*args)
click to toggle source
# File lib/rspec/matchers/render_local_matcher.rb, line 23 def set_expected_key_and_value(*args) locals_hash = args.extract_options! @key = nil @value = nil if locals_hash.present? @key = locals_hash.keys.first.to_sym @value = locals_hash.values.first elsif args.size == 2 @key = args.first.to_sym subject = args.pop if subject.is_a?(Class) @value = kind_of(subject) else @value = subject end elsif args.size == 1 subject = args.pop if subject.is_a?(Class) @key = subject.name.underscore.to_sym @value = kind_of(subject) end end end
using(klass)
click to toggle source
# File lib/rspec/matchers/render_local_matcher.rb, line 16 def using(klass) @intermediate_klass = klass self end
using_form(form_klass)
click to toggle source
# File lib/rspec/matchers/create_record_matcher.rb, line 25 def using_form(form_klass) @form_klass = form_klass self end
using_form?()
click to toggle source
# File lib/rspec/matchers/create_record_matcher.rb, line 30 def using_form? form_klass.present? end
using_service(klass)
click to toggle source
# File lib/rspec/matchers/destroy_record_matcher.rb, line 20 def using_service(klass) @service_klass = klass self end
using_service?()
click to toggle source
# File lib/rspec/matchers/destroy_record_matcher.rb, line 29 def using_service? service_klass.present? end
verify_local!()
click to toggle source
# File lib/rspec/matchers/render_local_matcher.rb, line 49 def verify_local! if @intermediate_klass expect(@intermediate_klass).to have_received(:call) end expect(controller).to have_received(:render). at_least(:once). with(anything, hash_including(locals: hash_including(@key => @value))) end