diff --git a/features/.nav b/features/.nav new file mode 100644 index 000000000..4bfd92053 --- /dev/null +++ b/features/.nav @@ -0,0 +1,27 @@ +- customized_message.feature +- diffing.feature +- implicit_docstrings.feature +- built_in_matchers: + - be.feature + - be_within.feature + - equality.feature + - exist.feature + - expect_change.feature + - expect_error.feature + - have.feature + - include.feature + - match.feature + - operators.feature + - predicates.feature + - respond_to.feature + - satisfy.feature + - throw_symbol.feature + - types.feature +- custom_matchers: + - define_matcher.feature + - define_diffable_matcher.feature + - define_matcher_with_fluent_interface.feature + - access_running_example.feature + - define_matcher_outside_rspec.feature +- test_frameworks: + - test_unit.feature diff --git a/features/README.markdown b/features/README.markdown index 1439e2a1c..f8025cb41 100644 --- a/features/README.markdown +++ b/features/README.markdown @@ -1,5 +1,4 @@ -rspec-expectations is used to set expectations in executable -examples: +rspec-expectations is used to set expectations in executable examples. describe Account do it "has a balance of zero when first created" do @@ -7,6 +6,31 @@ examples: end end +## should and should_not + +rspec-expectations adds `should` and `should_not` to every object. Each of +these can accept a matcher and, in most cases, an optional custom failure +message (see [customized +message](/rspec/rspec-expectations/v/2-3/customized-message)). + +## Matchers + +A Matcher is any object that responds to the following methods: + + matches?(actual) + failure_message_for_should + +These methods are also part of the matcher protocol, but are optional: + + does_not_match?(actual) + failure_message_for_should_not + description + +RSpec ships with a number of [built-in +matchers](/rspec/rspec-expectations/v/2-3/dir/built-in-matchers) and a DSL for +writing your own [custom +matchers](/rspec/rspec-expectations/v/2-3/dir/custom-matchers). + ## Issues The documentation for rspec-expectations is a work in progress. We'll be adding diff --git a/features/matchers/be.feature b/features/built_in_matchers/be.feature similarity index 100% rename from features/matchers/be.feature rename to features/built_in_matchers/be.feature diff --git a/features/matchers/be_within.feature b/features/built_in_matchers/be_within.feature similarity index 100% rename from features/matchers/be_within.feature rename to features/built_in_matchers/be_within.feature diff --git a/features/matchers/equality.feature b/features/built_in_matchers/equality.feature similarity index 99% rename from features/matchers/equality.feature rename to features/built_in_matchers/equality.feature index 9dacdbee4..ee6eb88b6 100644 --- a/features/matchers/equality.feature +++ b/features/built_in_matchers/equality.feature @@ -1,4 +1,4 @@ -Feature: Equality matchers +Feature: equality matchers Ruby exposes several different methods for handling equality: diff --git a/features/matchers/exist.feature b/features/built_in_matchers/exist.feature similarity index 100% rename from features/matchers/exist.feature rename to features/built_in_matchers/exist.feature diff --git a/features/matchers/expect_change.feature b/features/built_in_matchers/expect_change.feature similarity index 98% rename from features/matchers/expect_change.feature rename to features/built_in_matchers/expect_change.feature index 40459ebca..b3a9d0c3e 100644 --- a/features/matchers/expect_change.feature +++ b/features/built_in_matchers/expect_change.feature @@ -1,4 +1,4 @@ -Feature: Expect change +Feature: expect change Expect some code (wrapped in a proc) to change the state of some object. diff --git a/features/matchers/expect_error.feature b/features/built_in_matchers/expect_error.feature similarity index 98% rename from features/matchers/expect_error.feature rename to features/built_in_matchers/expect_error.feature index 5868babc7..7bb3dbee7 100644 --- a/features/matchers/expect_error.feature +++ b/features/built_in_matchers/expect_error.feature @@ -1,4 +1,4 @@ -Feature: Expect error +Feature: expect error Expect a proc to raise an error when called. diff --git a/features/matchers/have.feature b/features/built_in_matchers/have.feature similarity index 100% rename from features/matchers/have.feature rename to features/built_in_matchers/have.feature diff --git a/features/matchers/include.feature b/features/built_in_matchers/include.feature similarity index 100% rename from features/matchers/include.feature rename to features/built_in_matchers/include.feature diff --git a/features/matchers/match.feature b/features/built_in_matchers/match.feature similarity index 100% rename from features/matchers/match.feature rename to features/built_in_matchers/match.feature diff --git a/features/matchers/operators.feature b/features/built_in_matchers/operators.feature similarity index 99% rename from features/matchers/operators.feature rename to features/built_in_matchers/operators.feature index 2a4955e61..fc1ebb91b 100644 --- a/features/matchers/operators.feature +++ b/features/built_in_matchers/operators.feature @@ -1,4 +1,4 @@ -Feature: Operator matchers +Feature: operator matchers RSpec provides a number of matchers that are based on Ruby's built-in operators. These pretty much work like you expect. For example, each of these diff --git a/features/matchers/predicates.feature b/features/built_in_matchers/predicates.feature similarity index 99% rename from features/matchers/predicates.feature rename to features/built_in_matchers/predicates.feature index 5093ee639..7f41d548a 100644 --- a/features/matchers/predicates.feature +++ b/features/built_in_matchers/predicates.feature @@ -1,4 +1,4 @@ -Feature: Predicate matchers +Feature: predicate matchers Ruby objects commonly provide predicate methods: diff --git a/features/matchers/respond_to.feature b/features/built_in_matchers/respond_to.feature similarity index 100% rename from features/matchers/respond_to.feature rename to features/built_in_matchers/respond_to.feature diff --git a/features/matchers/satisfy.feature b/features/built_in_matchers/satisfy.feature similarity index 97% rename from features/matchers/satisfy.feature rename to features/built_in_matchers/satisfy.feature index 7476e184c..31ca8adbc 100644 --- a/features/matchers/satisfy.feature +++ b/features/built_in_matchers/satisfy.feature @@ -1,4 +1,4 @@ -Feature: Satisfy matcher +Feature: satisfy matcher The satisfy matcher is extremely flexible and can handle almost anything you want to specify. It passes if the block you provide returns true: diff --git a/features/matchers/throw_symbol.feature b/features/built_in_matchers/throw_symbol.feature similarity index 99% rename from features/matchers/throw_symbol.feature rename to features/built_in_matchers/throw_symbol.feature index 4bc3346ee..86ea85613 100644 --- a/features/matchers/throw_symbol.feature +++ b/features/built_in_matchers/throw_symbol.feature @@ -1,4 +1,4 @@ -Feature: Throw symbol matcher +Feature: throw_symbol matcher The throw_symbol matcher is used to specify that a block of code throws a symbol. The most basic form passes if any symbol is thrown: diff --git a/features/matchers/types.feature b/features/built_in_matchers/types.feature similarity index 100% rename from features/matchers/types.feature rename to features/built_in_matchers/types.feature diff --git a/features/matchers/access_running_example.feature b/features/custom_matchers/access_running_example.feature similarity index 97% rename from features/matchers/access_running_example.feature rename to features/custom_matchers/access_running_example.feature index 084e57b95..2cc532d2a 100644 --- a/features/matchers/access_running_example.feature +++ b/features/custom_matchers/access_running_example.feature @@ -1,4 +1,4 @@ -Feature: Access running example +Feature: access running example In order to take advantage of services that are available in my examples when I'm writing matchers diff --git a/features/matchers/define_diffable_matcher.feature b/features/custom_matchers/define_diffable_matcher.feature similarity index 95% rename from features/matchers/define_diffable_matcher.feature rename to features/custom_matchers/define_diffable_matcher.feature index b1ff2f54f..6ea001e2c 100644 --- a/features/matchers/define_diffable_matcher.feature +++ b/features/custom_matchers/define_diffable_matcher.feature @@ -1,4 +1,4 @@ -Feature: Define diffable matcher +Feature: define diffable matcher When a matcher is defined as diffable, and the --diff flag is set, the output will include a diff of the submitted diff --git a/features/matchers/define_matcher.feature b/features/custom_matchers/define_matcher.feature similarity index 99% rename from features/matchers/define_matcher.feature rename to features/custom_matchers/define_matcher.feature index 6e29a9dd9..a063f7c7a 100644 --- a/features/matchers/define_matcher.feature +++ b/features/custom_matchers/define_matcher.feature @@ -1,4 +1,4 @@ -Feature: Define matcher +Feature: define matcher In order to express my domain clearly in my code examples As an RSpec user diff --git a/features/matchers/define_matcher_outside_rspec.feature b/features/custom_matchers/define_matcher_outside_rspec.feature similarity index 96% rename from features/matchers/define_matcher_outside_rspec.feature rename to features/custom_matchers/define_matcher_outside_rspec.feature index 2b543a2d9..3e8b546a0 100644 --- a/features/matchers/define_matcher_outside_rspec.feature +++ b/features/custom_matchers/define_matcher_outside_rspec.feature @@ -1,4 +1,4 @@ -Feature: Define matcher outside rspec +Feature: define matcher outside rspec In order to express my domain clearly in my code examples As a non-rspec user diff --git a/features/matchers/define_matcher_with_fluent_interface.feature b/features/custom_matchers/define_matcher_with_fluent_interface.feature similarity index 93% rename from features/matchers/define_matcher_with_fluent_interface.feature rename to features/custom_matchers/define_matcher_with_fluent_interface.feature index d0a9d895f..6decb4866 100644 --- a/features/matchers/define_matcher_with_fluent_interface.feature +++ b/features/custom_matchers/define_matcher_with_fluent_interface.feature @@ -1,4 +1,4 @@ -Feature: Define matcher with fluent interface +Feature: define matcher with fluent interface Use the chain() method to define matchers with a fluent interface. diff --git a/features/expectations/customized_message.feature b/features/customized_message.feature similarity index 100% rename from features/expectations/customized_message.feature rename to features/customized_message.feature diff --git a/features/expectations/diffing.feature b/features/diffing.feature similarity index 100% rename from features/expectations/diffing.feature rename to features/diffing.feature diff --git a/features/expectations/implicit_docstrings.feature b/features/implicit_docstrings.feature similarity index 100% rename from features/expectations/implicit_docstrings.feature rename to features/implicit_docstrings.feature