Class/Module Index [+]

Quicksearch

Spec::Example::ExampleMethods

Public Class Methods

new(example_proxy, &implementation) click to toggle source
# File lib/spec/example/example_methods.rb, line 115
def initialize(example_proxy, &implementation)
  @_proxy = example_proxy
  @_implementation = implementation
  @_backtrace = caller
end

Public Instance Methods

description() click to toggle source

Declared description for this example:

describe Account do
  it "should start with a balance of 0" do
  ...

description
=> "should start with a balance of 0"
# File lib/spec/example/example_methods.rb, line 20
def description
  if description = @_proxy.description || ::Spec::Matchers.generated_description
    description
  else
    Spec.warn Spec::Example::NoDescriptionError.message("example", @_proxy.location)
  end
end
expect(&block) click to toggle source

Extends the submitted block with aliases to and to_not for should and should_not. Allows expectations like this:

expect { this_block }.to change{this.expression}.from(old_value).to(new_value)
expect { this_block }.to raise_error
# File lib/spec/example/example_methods.rb, line 69
def expect(&block)
  block.extend BlockAliases
end
run_after_each() click to toggle source

Run all the after(:each) blocks for this example

# File lib/spec/example/example_methods.rb, line 111
def run_after_each
  example_group_hierarchy.run_after_each(self)
end
run_before_each() click to toggle source

Run all the before(:each) blocks for this example

# File lib/spec/example/example_methods.rb, line 106
def run_before_each
  example_group_hierarchy.run_before_each(self)
end
violated(message="") click to toggle source
# File lib/spec/example/example_methods.rb, line 8
def violated(message="")
  raise Spec::Expectations::ExpectationNotMetError.new(message)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.