class MiniSpec::Mocks::Expectations
Public Class Methods
new(base, object, context, *args)
click to toggle source
# File lib/minispec/mocks/expectations.rb, line 5 def initialize base, object, context, *args @base, @object, @context, @args = base, object, context, args @expectations = [] end
Public Instance Methods
and_raise(*args, &proc)
click to toggle source
# File lib/minispec/mocks/expectations.rb, line 41 def and_raise *args, &proc push {|v| v.and_raise(*args, &proc)} end
and_return(*args, &proc)
click to toggle source
# File lib/minispec/mocks/expectations.rb, line 28 def and_return *args, &proc push {|v| proc ? v.and_return(&proc) : v.and_return(*args)} end
Also aliased as: and_returned
and_throw(*args, &proc)
click to toggle source
# File lib/minispec/mocks/expectations.rb, line 49 def and_throw *args, &proc push {|v| v.and_throw(*args, &proc)} end
and_yield(*args, &proc)
click to toggle source
# File lib/minispec/mocks/expectations.rb, line 33 def and_yield *args, &proc push {|v| proc ? v.and_yield(&proc) : v.and_yield(*args)} end
count(*expected, &proc)
click to toggle source
# File lib/minispec/mocks/expectations.rb, line 57 def count *expected, &proc push {|v| proc ? v.count(&proc) : v.count(*expected)} end
Also aliased as: times
once()
click to toggle source
# File lib/minispec/mocks/expectations.rb, line 62 def once; count(1); end
ordered(n = 1)
click to toggle source
# File lib/minispec/mocks/expectations.rb, line 65 def ordered n = 1 push {|v| v.ordered(n)} end
twice()
click to toggle source
# File lib/minispec/mocks/expectations.rb, line 63 def twice; count(2); end
validate!()
click to toggle source
# File lib/minispec/mocks/expectations.rb, line 10 def validate! validator = Validations.new(@base, @object, @context, *@args) @expectations.each {|e| e.call(validator)} end
with(*args, &proc)
click to toggle source
# File lib/minispec/mocks/expectations.rb, line 15 def with *args, &proc push {|v| proc ? v.with(&proc) : v.with(*args)} end
with_caller(*args, &proc)
click to toggle source
# File lib/minispec/mocks/expectations.rb, line 24 def with_caller *args, &proc push {|v| proc ? v.with_caller(&proc) : v.with_caller(*args)} end
without_arguments()
click to toggle source
# File lib/minispec/mocks/expectations.rb, line 19 def without_arguments push {|v| v.without_arguments} end
Also aliased as: without_any_arguments
without_raise()
click to toggle source
# File lib/minispec/mocks/expectations.rb, line 45 def without_raise push {|v| v.without_raise} end
without_throw()
click to toggle source
# File lib/minispec/mocks/expectations.rb, line 53 def without_throw push {|v| v.without_throw} end
without_yield()
click to toggle source
# File lib/minispec/mocks/expectations.rb, line 37 def without_yield push {|v| v.without_yield} end
Private Instance Methods
push(&proc)
click to toggle source
# File lib/minispec/mocks/expectations.rb, line 70 def push &proc @expectations << proc self end