Module: Spec::Runner::ExecutionContext::InstanceMethods

Included in:
Spec::Runner::ExecutionContext
Defined in:
lib/spec/runner/execution_context.rb

Instance Method Summary collapse

Instance Method Details

#duck_type(*args) ⇒ Object



15
16
17
# File 'lib/spec/runner/execution_context.rb', line 15

def duck_type(*args)
  return Api::DuckTypeArgConstraint.new(*args)
end

#initialize(spec) ⇒ Object



5
6
7
# File 'lib/spec/runner/execution_context.rb', line 5

def initialize(spec)
  @spec = spec
end

#mock(name, options = {}) ⇒ Object



9
10
11
12
13
# File 'lib/spec/runner/execution_context.rb', line 9

def mock(name, options={})
  mock = Api::Mock.new(name, options)
  @spec.add_mock(mock)
  mock
end

#violated(message = "") ⇒ Object



19
20
21
# File 'lib/spec/runner/execution_context.rb', line 19

def violated(message="")
  raise Spec::Api::ExpectationNotMetError.new(message)
end