Module | Spec::Example::ExampleGroupMethods |
In: |
lib/spec/example/example_group_methods.rb
|
description_options | -> | options |
description_options | [R] | |
description_text | [R] | |
matcher_class | [RW] | |
spec_path | [R] |
Makes the describe/it syntax available from a class. For example:
class StackSpec < Spec::ExampleGroup describe Stack, "with no elements" before @stack = Stack.new end it "should raise on pop" do lambda{ @stack.pop }.should raise_error end end
Use this to pull in examples from shared example groups. See Spec::Runner for information about shared example groups.
Dynamically generates a custom matcher that will match a predicate on your class. RSpec provides a couple of these out of the box:
exist (or state expectations) File.should exist("path/to/file") an_instance_of (for mock argument constraints) mock.should_receive(:message).with(an_instance_of(String))
class Fish def can_swim? true end end describe Fish do predicate_matchers[:swim] = :can_swim? it "should swim" do Fish.new.should swim end end