Class Index [+]

Quicksearch

Spec::Example::BeforeAndAfterHooks

Public Instance Methods

after(scope = :each, &block) click to toggle source
Alias for: prepend_after
append_after(scope = :each, &block) click to toggle source

Registers a block to be executed after each example. This method appends block to existing after blocks.

See append_before for scoping semantics.

    # File lib/spec/example/before_and_after_hooks.rb, line 45
45:       def append_after(scope = :each, &block)
46:         after_parts(scope) << block
47:       end
append_before(scope = :each, &block) click to toggle source

Registers a block to be executed before examples. scope can be :each (default), :all, or :suite. When :each, the block is executed before each example. When :all, the block is executed only once before any examples are run.

    # File lib/spec/example/before_and_after_hooks.rb, line 19
19:       def append_before(scope = :each, &block)
20:         before_parts(scope) << block
21:       end
Also aliased as: before
before(scope = :each, &block) click to toggle source
Alias for: append_before
prepend_after(scope = :each, &block) click to toggle source

Registers a block to be executed after each example. This method prepends block to existing after blocks.

See append_before for scoping semantics.

    # File lib/spec/example/before_and_after_hooks.rb, line 36
36:       def prepend_after(scope = :each, &block)
37:         after_parts(scope).unshift(block)
38:       end
Also aliased as: after
prepend_before(scope = :each, &block) click to toggle source

Registers a block to be executed before each example. This method prepends block to existing before blocks.

See append_before for scoping semantics.

    # File lib/spec/example/before_and_after_hooks.rb, line 28
28:       def prepend_before(scope = :each, &block)
29:         before_parts(scope).unshift(block)
30:       end

Private Instance Methods

after_parts(scope) click to toggle source
    # File lib/spec/example/before_and_after_hooks.rb, line 83
83:       def after_parts(scope)
84:         case scope
85:         when :each; after_each_parts
86:         when :all; after_all_parts
87:         when :suite; after_suite_parts
88:         end
89:       end
before_parts(scope) click to toggle source
    # File lib/spec/example/before_and_after_hooks.rb, line 75
75:       def before_parts(scope)
76:         case scope
77:         when :each; before_each_parts
78:         when :all; before_all_parts
79:         when :suite; before_suite_parts
80:         end
81:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.