dchelimsky-rspec 1.1.99.9 → 1.1.99.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. data/.autotest +2 -1
  2. data/.document +7 -0
  3. data/History.txt +17 -4
  4. data/Manifest.txt +12 -2
  5. data/README.txt +1 -4
  6. data/Rakefile +1 -12
  7. data/Upgrade.markdown +62 -0
  8. data/examples/failing/pending_example.rb +9 -0
  9. data/features/matchers/create_matcher.feature +115 -0
  10. data/features/mocks/mix_stubs_and_mocks.feature +22 -0
  11. data/features/pending/pending_examples.feature +81 -0
  12. data/features/support/matchers/smart_match.rb +2 -2
  13. data/lib/spec.rb +1 -1
  14. data/lib/spec/dsl.rb +3 -1
  15. data/lib/spec/dsl/matchers.rb +13 -0
  16. data/lib/spec/example/example_group_methods.rb +6 -1
  17. data/lib/spec/example/example_methods.rb +5 -6
  18. data/lib/spec/example/subject.rb +1 -1
  19. data/lib/spec/expectations/handler.rb +13 -11
  20. data/lib/spec/matchers.rb +14 -3
  21. data/lib/spec/matchers/be.rb +2 -2
  22. data/lib/spec/matchers/be_close.rb +1 -1
  23. data/lib/spec/matchers/be_instance_of.rb +2 -2
  24. data/lib/spec/matchers/be_kind_of.rb +2 -2
  25. data/lib/spec/matchers/change.rb +3 -3
  26. data/lib/spec/matchers/eql.rb +2 -2
  27. data/lib/spec/matchers/equal.rb +2 -2
  28. data/lib/spec/matchers/exist.rb +2 -2
  29. data/lib/spec/matchers/extensions/instance_exec.rb +25 -0
  30. data/lib/spec/matchers/has.rb +2 -2
  31. data/lib/spec/matchers/have.rb +2 -2
  32. data/lib/spec/matchers/include.rb +2 -2
  33. data/lib/spec/matchers/match.rb +2 -2
  34. data/lib/spec/matchers/match_array.rb +2 -2
  35. data/lib/spec/matchers/matcher.rb +51 -0
  36. data/lib/spec/matchers/raise_error.rb +2 -2
  37. data/lib/spec/matchers/respond_to.rb +2 -2
  38. data/lib/spec/matchers/satisfy.rb +2 -2
  39. data/lib/spec/matchers/throw_symbol.rb +2 -2
  40. data/lib/spec/mocks/error_generator.rb +3 -2
  41. data/lib/spec/mocks/message_expectation.rb +1 -1
  42. data/lib/spec/mocks/proxy.rb +4 -4
  43. data/lib/spec/runner/option_parser.rb +1 -1
  44. data/lib/spec/version.rb +1 -1
  45. data/rspec.gemspec +6 -6
  46. data/spec/spec/dsl/matchers_spec.rb +25 -0
  47. data/spec/spec/example/example_methods_spec.rb +11 -5
  48. data/spec/spec/example/pending_module_spec.rb +66 -41
  49. data/spec/spec/{matchers → expectations}/handler_spec.rb +46 -5
  50. data/spec/spec/interop/test/unit/testcase_spec.rb +0 -4
  51. data/spec/spec/matchers/be_close_spec.rb +1 -1
  52. data/spec/spec/matchers/change_spec.rb +12 -0
  53. data/spec/spec/matchers/eql_spec.rb +2 -2
  54. data/spec/spec/matchers/equal_spec.rb +2 -2
  55. data/spec/spec/matchers/have_spec.rb +4 -4
  56. data/spec/spec/matchers/match_spec.rb +2 -2
  57. data/spec/spec/matchers/matcher_spec.rb +97 -0
  58. data/spec/spec/matchers/throw_symbol_spec.rb +8 -8
  59. data/spec/spec/mocks/mock_spec.rb +2 -2
  60. data/spec/spec/mocks/stubbed_message_expectations_spec.rb +13 -1
  61. metadata +16 -10
  62. data/examples/passing/priority.txt +0 -1
@@ -55,11 +55,11 @@ module Spec
55
55
  end
56
56
  end
57
57
 
58
- def failure_message
58
+ def failure_message_for_should
59
59
  @eval_block ? @given_error.message : "expected #{expected_error}#{given_error}"
60
60
  end
61
61
 
62
- def negative_failure_message
62
+ def failure_message_for_should_not
63
63
  "expected no #{expected_error}#{given_error}"
64
64
  end
65
65
 
@@ -16,11 +16,11 @@ module Spec
16
16
  return @names_not_responded_to.empty?
17
17
  end
18
18
 
19
- def failure_message
19
+ def failure_message_for_should
20
20
  "expected #{@actual.inspect} to respond to #{@names_not_responded_to.collect {|name| name.inspect }.join(', ')}#{with_arity}"
21
21
  end
22
22
 
23
- def negative_failure_message
23
+ def failure_message_for_should_not
24
24
  "expected #{@actual.inspect} not to respond to #{@names.collect {|name| name.inspect }.join(', ')}"
25
25
  end
26
26
 
@@ -12,11 +12,11 @@ module Spec
12
12
  @block.call(actual)
13
13
  end
14
14
 
15
- def failure_message
15
+ def failure_message_for_should
16
16
  "expected #{@actual} to satisfy block"
17
17
  end
18
18
 
19
- def negative_failure_message
19
+ def failure_message_for_should_not
20
20
  "expected #{@actual} not to satisfy block"
21
21
  end
22
22
  end
@@ -41,7 +41,7 @@ module Spec
41
41
  end
42
42
  end
43
43
 
44
- def failure_message
44
+ def failure_message_for_should
45
45
  if @caught_symbol
46
46
  "expected #{expected}, got #{@caught_symbol.inspect}"
47
47
  else
@@ -49,7 +49,7 @@ module Spec
49
49
  end
50
50
  end
51
51
 
52
- def negative_failure_message
52
+ def failure_message_for_should_not
53
53
  if @expected_symbol
54
54
  "expected #{expected} not to be thrown"
55
55
  else
@@ -42,9 +42,10 @@ module Spec
42
42
  __raise "#{intro} yielded |#{arg_list(*args_to_yield)}| to block with arity of #{arity}"
43
43
  end
44
44
 
45
- private
45
+ private
46
+
46
47
  def intro
47
- @name ? "Mock '#{@name}'" : @target.class == Class ? "<#{@target.inspect} (class)>" : (@target.nil? ? "nil" : @target.to_s)
48
+ @name ? "Mock '#{@name}'" : @target.class == Class ? "<#{@target.inspect} (class)>" : (@target.nil? ? "nil" : @target)
48
49
  end
49
50
 
50
51
  def __raise(message)
@@ -226,7 +226,7 @@ module Spec
226
226
  if similar_messages.empty?
227
227
  @error_generator.raise_expectation_error(@sym, @expected_received_count, @actual_received_count, *@args_expectation.args)
228
228
  else
229
- @error_generator.raise_unexpected_message_args_error(self, *@similar_messages.first)
229
+ @error_generator.raise_unexpected_message_args_error(self, *@similar_messages)
230
230
  end
231
231
  end
232
232
 
@@ -133,7 +133,7 @@ module Spec
133
133
  if target_responds_to?(sym)
134
134
  munged_sym = munge(sym)
135
135
  target_metaclass.instance_eval do
136
- alias_method munged_sym, sym if method_defined?(sym.to_s)
136
+ alias_method munged_sym, sym if method_defined?(sym)
137
137
  end
138
138
  @proxied_methods << sym
139
139
  end
@@ -166,7 +166,7 @@ module Spec
166
166
  end
167
167
 
168
168
  def munge(sym)
169
- "proxied_by_rspec__#{sym.to_s}".to_sym
169
+ "proxied_by_rspec__#{sym}"
170
170
  end
171
171
 
172
172
  def clear_expectations
@@ -195,9 +195,9 @@ module Spec
195
195
  @proxied_methods.each do |sym|
196
196
  munged_sym = munge(sym)
197
197
  target_metaclass.instance_eval do
198
- if method_defined?(munged_sym.to_s)
198
+ if method_defined?(munged_sym)
199
199
  alias_method sym, munged_sym
200
- undef_method munged_sym
200
+ remove_method munged_sym
201
201
  else
202
202
  remove_method sym
203
203
  end
@@ -50,7 +50,7 @@ module Spec
50
50
  "silent|l : No output", "progress|p : Text-based progress bar",
51
51
  "profile|o : Text-based progress bar with profiling of 10 slowest examples",
52
52
  "specdoc|s : Code example doc strings",
53
- "nested|n : Code example doc strings with nested groups intented",
53
+ "nested|n : Code example doc strings with nested groups indented",
54
54
  "html|h : A nice HTML report",
55
55
  "failing_examples|e : Write all failing examples - input for --example",
56
56
  "failing_example_groups|g : Write all failing example groups - input for --example",
data/lib/spec/version.rb CHANGED
@@ -4,7 +4,7 @@ module Spec
4
4
  MAJOR = 1
5
5
  MINOR = 1
6
6
  TINY = 99
7
- MINESCULE = 9
7
+ MINESCULE = 13
8
8
 
9
9
 
10
10
  STRING = [MAJOR, MINOR, TINY, MINESCULE].compact.join('.')
data/rspec.gemspec CHANGED
@@ -2,23 +2,23 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{rspec}
5
- s.version = "1.1.99.9"
5
+ s.version = "1.1.99.13"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["RSpec Development Team"]
9
- s.date = %q{2009-02-24}
9
+ s.date = %q{2009-03-09}
10
10
  s.description = %q{Behaviour Driven Development for Ruby.}
11
11
  s.email = ["rspec-devel@rubyforge.org"]
12
12
  s.executables = ["autospec", "spec"]
13
- s.extra_rdoc_files = ["History.txt", "License.txt", "Manifest.txt", "README.txt", "TODO.txt", "examples/failing/README.txt", "examples/passing/priority.txt", "spec/spec/runner/empty_file.txt", "spec/spec/runner/examples.txt", "spec/spec/runner/failed.txt"]
14
- s.files = [".autotest", "History.txt", "License.txt", "Manifest.txt", "README.txt", "Rakefile", "Ruby1.9.markdown", "TODO.txt", "bin/autospec", "bin/spec", "cucumber.yml", "examples/failing/README.txt", "examples/failing/diffing_spec.rb", "examples/failing/failing_autogenerated_docstrings_example.rb", "examples/failing/failure_in_after.rb", "examples/failing/failure_in_before.rb", "examples/failing/mocking_example.rb", "examples/failing/mocking_with_flexmock.rb", "examples/failing/mocking_with_mocha.rb", "examples/failing/mocking_with_rr.rb", "examples/failing/partial_mock_example.rb", "examples/failing/predicate_example.rb", "examples/failing/raising_example.rb", "examples/failing/spec_helper.rb", "examples/failing/syntax_error_example.rb", "examples/failing/team_spec.rb", "examples/failing/timeout_behaviour.rb", "examples/passing/autogenerated_docstrings_example.rb", "examples/passing/before_and_after_example.rb", "examples/passing/behave_as_example.rb", "examples/passing/custom_expectation_matchers.rb", "examples/passing/custom_formatter.rb", "examples/passing/dynamic_spec.rb", "examples/passing/file_accessor.rb", "examples/passing/file_accessor_spec.rb", "examples/passing/filtered_formatter.rb", "examples/passing/filtered_formatter_example.rb", "examples/passing/greeter_spec.rb", "examples/passing/helper_method_example.rb", "examples/passing/io_processor.rb", "examples/passing/io_processor_spec.rb", "examples/passing/mocking_example.rb", "examples/passing/multi_threaded_example_group_runner.rb", "examples/passing/nested_classes_example.rb", "examples/passing/partial_mock_example.rb", "examples/passing/pending_example.rb", "examples/passing/predicate_example.rb", "examples/passing/priority.txt", "examples/passing/shared_example_group_example.rb", "examples/passing/shared_stack_examples.rb", "examples/passing/simple_matcher_example.rb", "examples/passing/spec_helper.rb", "examples/passing/stack.rb", "examples/passing/stack_spec.rb", "examples/passing/stack_spec_with_nested_example_groups.rb", "examples/passing/stubbing_example.rb", "examples/passing/yielding_example.rb", "examples/ruby1.9.compatibility/access_to_constants_spec.rb", "features-pending/cli/conditional_exclusion.feature", "features/before_and_after_blocks/before_and_after_blocks.feature", "features/example_groups/autogenerated_docstrings.feature", "features/example_groups/example_group_with_should_methods.feature", "features/example_groups/nested_groups.feature", "features/example_groups/output.feature", "features/heckle/heckle.feature", "features/interop/examples_and_tests_together.feature", "features/interop/test_but_not_test_unit.feature", "features/interop/test_case_with_should_methods.feature", "features/mock_framework_integration/use_flexmock.feature", "features/mock_framework_integration/use_mocha.feature", "features/mock_framework_integration/use_rr.feature", "features/step_definitions/running_rspec.rb", "features/support/env.rb", "features/support/matchers/smart_match.rb", "init.rb", "lib/autotest/discover.rb", "lib/autotest/rspec.rb", "lib/spec.rb", "lib/spec/adapters/mock_frameworks/flexmock.rb", "lib/spec/adapters/mock_frameworks/mocha.rb", "lib/spec/adapters/mock_frameworks/rr.rb", "lib/spec/adapters/mock_frameworks/rspec.rb", "lib/spec/autorun.rb", "lib/spec/dsl.rb", "lib/spec/dsl/main.rb", "lib/spec/example.rb", "lib/spec/example/before_and_after_hooks.rb", "lib/spec/example/errors.rb", "lib/spec/example/example_description.rb", "lib/spec/example/example_group.rb", "lib/spec/example/example_group_factory.rb", "lib/spec/example/example_group_hierarchy.rb", "lib/spec/example/example_group_methods.rb", "lib/spec/example/example_matcher.rb", "lib/spec/example/example_methods.rb", "lib/spec/example/module_reopening_fix.rb", "lib/spec/example/pending.rb", "lib/spec/example/predicate_matchers.rb", "lib/spec/example/shared_example_group.rb", "lib/spec/example/subject.rb", "lib/spec/expectations.rb", "lib/spec/expectations/differs/default.rb", "lib/spec/expectations/errors.rb", "lib/spec/expectations/extensions.rb", "lib/spec/expectations/extensions/object.rb", "lib/spec/expectations/handler.rb", "lib/spec/interop/test.rb", "lib/spec/interop/test/unit/autorunner.rb", "lib/spec/interop/test/unit/testcase.rb", "lib/spec/interop/test/unit/testresult.rb", "lib/spec/interop/test/unit/testsuite_adapter.rb", "lib/spec/interop/test/unit/ui/console/testrunner.rb", "lib/spec/matchers.rb", "lib/spec/matchers/be.rb", "lib/spec/matchers/be_close.rb", "lib/spec/matchers/be_instance_of.rb", "lib/spec/matchers/be_kind_of.rb", "lib/spec/matchers/change.rb", "lib/spec/matchers/eql.rb", "lib/spec/matchers/equal.rb", "lib/spec/matchers/errors.rb", "lib/spec/matchers/exist.rb", "lib/spec/matchers/generated_descriptions.rb", "lib/spec/matchers/has.rb", "lib/spec/matchers/have.rb", "lib/spec/matchers/include.rb", "lib/spec/matchers/match.rb", "lib/spec/matchers/match_array.rb", "lib/spec/matchers/method_missing.rb", "lib/spec/matchers/operator_matcher.rb", "lib/spec/matchers/raise_error.rb", "lib/spec/matchers/respond_to.rb", "lib/spec/matchers/satisfy.rb", "lib/spec/matchers/simple_matcher.rb", "lib/spec/matchers/throw_symbol.rb", "lib/spec/matchers/wrap_expectation.rb", "lib/spec/mocks.rb", "lib/spec/mocks/argument_expectation.rb", "lib/spec/mocks/argument_matchers.rb", "lib/spec/mocks/error_generator.rb", "lib/spec/mocks/errors.rb", "lib/spec/mocks/extensions.rb", "lib/spec/mocks/extensions/object.rb", "lib/spec/mocks/framework.rb", "lib/spec/mocks/message_expectation.rb", "lib/spec/mocks/methods.rb", "lib/spec/mocks/mock.rb", "lib/spec/mocks/order_group.rb", "lib/spec/mocks/proxy.rb", "lib/spec/mocks/space.rb", "lib/spec/mocks/spec_methods.rb", "lib/spec/rake/spectask.rb", "lib/spec/rake/verify_rcov.rb", "lib/spec/ruby.rb", "lib/spec/runner.rb", "lib/spec/runner/backtrace_tweaker.rb", "lib/spec/runner/class_and_arguments_parser.rb", "lib/spec/runner/command_line.rb", "lib/spec/runner/configuration.rb", "lib/spec/runner/drb_command_line.rb", "lib/spec/runner/example_group_runner.rb", "lib/spec/runner/formatter/base_formatter.rb", "lib/spec/runner/formatter/base_text_formatter.rb", "lib/spec/runner/formatter/failing_example_groups_formatter.rb", "lib/spec/runner/formatter/failing_examples_formatter.rb", "lib/spec/runner/formatter/html_formatter.rb", "lib/spec/runner/formatter/nested_text_formatter.rb", "lib/spec/runner/formatter/profile_formatter.rb", "lib/spec/runner/formatter/progress_bar_formatter.rb", "lib/spec/runner/formatter/snippet_extractor.rb", "lib/spec/runner/formatter/specdoc_formatter.rb", "lib/spec/runner/formatter/text_mate_formatter.rb", "lib/spec/runner/heckle_runner.rb", "lib/spec/runner/heckle_runner_unsupported.rb", "lib/spec/runner/option_parser.rb", "lib/spec/runner/options.rb", "lib/spec/runner/reporter.rb", "lib/spec/runner/spec_parser.rb", "lib/spec/test/unit.rb", "lib/spec/version.rb", "resources/helpers/cmdline.rb", "resources/rake/examples.rake", "resources/rake/examples_with_rcov.rake", "resources/rake/failing_examples_with_html.rake", "resources/rake/verify_rcov.rake", "resources/spec/example_group_with_should_methods.rb", "resources/spec/simple_spec.rb", "resources/test/spec_and_test_together.rb", "resources/test/spec_including_test_but_not_unit.rb", "resources/test/test_case_with_should_methods.rb", "rspec.gemspec", "spec/README.jruby", "spec/autotest/autotest_helper.rb", "spec/autotest/autotest_matchers.rb", "spec/autotest/discover_spec.rb", "spec/autotest/failed_results_re_spec.rb", "spec/autotest/rspec_spec.rb", "spec/rspec_suite.rb", "spec/ruby_forker.rb", "spec/spec.opts", "spec/spec/dsl/main_spec.rb", "spec/spec/example/example_group_class_definition_spec.rb", "spec/spec/example/example_group_factory_spec.rb", "spec/spec/example/example_group_methods_spec.rb", "spec/spec/example/example_group_spec.rb", "spec/spec/example/example_matcher_spec.rb", "spec/spec/example/example_methods_spec.rb", "spec/spec/example/helper_method_spec.rb", "spec/spec/example/nested_example_group_spec.rb", "spec/spec/example/pending_module_spec.rb", "spec/spec/example/predicate_matcher_spec.rb", "spec/spec/example/shared_example_group_spec.rb", "spec/spec/example/subclassing_example_group_spec.rb", "spec/spec/expectations/differs/default_spec.rb", "spec/spec/expectations/extensions/object_spec.rb", "spec/spec/expectations/fail_with_spec.rb", "spec/spec/expectations/wrap_expectation_spec.rb", "spec/spec/interop/test/unit/resources/spec_that_fails.rb", "spec/spec/interop/test/unit/resources/spec_that_passes.rb", "spec/spec/interop/test/unit/resources/spec_with_errors.rb", "spec/spec/interop/test/unit/resources/spec_with_options_hash.rb", "spec/spec/interop/test/unit/resources/test_case_that_fails.rb", "spec/spec/interop/test/unit/resources/test_case_that_passes.rb", "spec/spec/interop/test/unit/resources/test_case_with_errors.rb", "spec/spec/interop/test/unit/resources/testsuite_adapter_spec_with_test_unit.rb", "spec/spec/interop/test/unit/spec_spec.rb", "spec/spec/interop/test/unit/test_unit_spec_helper.rb", "spec/spec/interop/test/unit/testcase_spec.rb", "spec/spec/interop/test/unit/testsuite_adapter_spec.rb", "spec/spec/matchers/be_close_spec.rb", "spec/spec/matchers/be_instance_of_spec.rb", "spec/spec/matchers/be_kind_of_spec.rb", "spec/spec/matchers/be_spec.rb", "spec/spec/matchers/change_spec.rb", "spec/spec/matchers/description_generation_spec.rb", "spec/spec/matchers/eql_spec.rb", "spec/spec/matchers/equal_spec.rb", "spec/spec/matchers/exist_spec.rb", "spec/spec/matchers/handler_spec.rb", "spec/spec/matchers/has_spec.rb", "spec/spec/matchers/have_spec.rb", "spec/spec/matchers/include_spec.rb", "spec/spec/matchers/match_array_spec.rb", "spec/spec/matchers/match_spec.rb", "spec/spec/matchers/matcher_methods_spec.rb", "spec/spec/matchers/operator_matcher_spec.rb", "spec/spec/matchers/raise_error_spec.rb", "spec/spec/matchers/respond_to_spec.rb", "spec/spec/matchers/satisfy_spec.rb", "spec/spec/matchers/simple_matcher_spec.rb", "spec/spec/matchers/throw_symbol_spec.rb", "spec/spec/mocks/any_number_of_times_spec.rb", "spec/spec/mocks/argument_expectation_spec.rb", "spec/spec/mocks/at_least_spec.rb", "spec/spec/mocks/at_most_spec.rb", "spec/spec/mocks/bug_report_10260_spec.rb", "spec/spec/mocks/bug_report_10263_spec.rb", "spec/spec/mocks/bug_report_11545_spec.rb", "spec/spec/mocks/bug_report_15719_spec.rb", "spec/spec/mocks/bug_report_496_spec.rb", "spec/spec/mocks/bug_report_600_spec.rb", "spec/spec/mocks/bug_report_7611_spec.rb", "spec/spec/mocks/bug_report_7805_spec.rb", "spec/spec/mocks/bug_report_8165_spec.rb", "spec/spec/mocks/bug_report_8302_spec.rb", "spec/spec/mocks/failing_argument_matchers_spec.rb", "spec/spec/mocks/hash_including_matcher_spec.rb", "spec/spec/mocks/hash_not_including_matcher_spec.rb", "spec/spec/mocks/mock_ordering_spec.rb", "spec/spec/mocks/mock_space_spec.rb", "spec/spec/mocks/mock_spec.rb", "spec/spec/mocks/multiple_return_value_spec.rb", "spec/spec/mocks/nil_expectation_warning_spec.rb", "spec/spec/mocks/null_object_mock_spec.rb", "spec/spec/mocks/once_counts_spec.rb", "spec/spec/mocks/options_hash_spec.rb", "spec/spec/mocks/partial_mock_spec.rb", "spec/spec/mocks/partial_mock_using_mocks_directly_spec.rb", "spec/spec/mocks/passing_argument_matchers_spec.rb", "spec/spec/mocks/precise_counts_spec.rb", "spec/spec/mocks/record_messages_spec.rb", "spec/spec/mocks/stub_spec.rb", "spec/spec/mocks/stubbed_message_expectations_spec.rb", "spec/spec/mocks/twice_counts_spec.rb", "spec/spec/package/bin_spec_spec.rb", "spec/spec/runner/class_and_argument_parser_spec.rb", "spec/spec/runner/command_line_spec.rb", "spec/spec/runner/configuration_spec.rb", "spec/spec/runner/drb_command_line_spec.rb", "spec/spec/runner/empty_file.txt", "spec/spec/runner/example_group_runner_spec.rb", "spec/spec/runner/examples.txt", "spec/spec/runner/failed.txt", "spec/spec/runner/formatter/base_formatter_spec.rb", "spec/spec/runner/formatter/base_text_formatter_spec.rb", "spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb", "spec/spec/runner/formatter/failing_examples_formatter_spec.rb", "spec/spec/runner/formatter/html_formatted-1.8.4.html", "spec/spec/runner/formatter/html_formatted-1.8.5-jruby.html", "spec/spec/runner/formatter/html_formatted-1.8.5.html", "spec/spec/runner/formatter/html_formatted-1.8.6-jruby.html", "spec/spec/runner/formatter/html_formatted-1.8.6.html", "spec/spec/runner/formatter/html_formatted-1.8.7.html", "spec/spec/runner/formatter/html_formatted-1.9.1.html", "spec/spec/runner/formatter/html_formatter_spec.rb", "spec/spec/runner/formatter/nested_text_formatter_spec.rb", "spec/spec/runner/formatter/profile_formatter_spec.rb", "spec/spec/runner/formatter/progress_bar_formatter_spec.rb", "spec/spec/runner/formatter/snippet_extractor_spec.rb", "spec/spec/runner/formatter/specdoc_formatter_spec.rb", "spec/spec/runner/formatter/text_mate_formatted-1.8.4.html", "spec/spec/runner/formatter/text_mate_formatted-1.8.6.html", "spec/spec/runner/formatter/text_mate_formatted-1.8.7.html", "spec/spec/runner/formatter/text_mate_formatted-1.9.1.html", "spec/spec/runner/formatter/text_mate_formatter_spec.rb", "spec/spec/runner/heckle_runner_spec.rb", "spec/spec/runner/heckler_spec.rb", "spec/spec/runner/noisy_backtrace_tweaker_spec.rb", "spec/spec/runner/option_parser_spec.rb", "spec/spec/runner/options_spec.rb", "spec/spec/runner/output_one_time_fixture.rb", "spec/spec/runner/output_one_time_fixture_runner.rb", "spec/spec/runner/output_one_time_spec.rb", "spec/spec/runner/quiet_backtrace_tweaker_spec.rb", "spec/spec/runner/reporter_spec.rb", "spec/spec/runner/resources/a_bar.rb", "spec/spec/runner/resources/a_foo.rb", "spec/spec/runner/resources/a_spec.rb", "spec/spec/runner/resources/custom_example_group_runner.rb", "spec/spec/runner/resources/utf8_encoded.rb", "spec/spec/runner/spec.opts", "spec/spec/runner/spec_drb.opts", "spec/spec/runner/spec_parser/spec_parser_fixture.rb", "spec/spec/runner/spec_parser_spec.rb", "spec/spec/runner/spec_spaced.opts", "spec/spec/runner_spec.rb", "spec/spec/spec_classes.rb", "spec/spec_helper.rb"]
13
+ s.extra_rdoc_files = ["History.txt", "License.txt", "Manifest.txt", "README.txt", "TODO.txt", "examples/failing/README.txt"]
14
+ s.files = [".autotest", ".document", "History.txt", "License.txt", "Manifest.txt", "README.txt", "Rakefile", "Ruby1.9.markdown", "TODO.txt", "Upgrade.markdown", "bin/autospec", "bin/spec", "cucumber.yml", "examples/failing/README.txt", "examples/failing/diffing_spec.rb", "examples/failing/failing_autogenerated_docstrings_example.rb", "examples/failing/failure_in_after.rb", "examples/failing/failure_in_before.rb", "examples/failing/mocking_example.rb", "examples/failing/mocking_with_flexmock.rb", "examples/failing/mocking_with_mocha.rb", "examples/failing/mocking_with_rr.rb", "examples/failing/partial_mock_example.rb", "examples/failing/pending_example.rb", "examples/failing/predicate_example.rb", "examples/failing/raising_example.rb", "examples/failing/spec_helper.rb", "examples/failing/syntax_error_example.rb", "examples/failing/team_spec.rb", "examples/failing/timeout_behaviour.rb", "examples/passing/autogenerated_docstrings_example.rb", "examples/passing/before_and_after_example.rb", "examples/passing/behave_as_example.rb", "examples/passing/custom_expectation_matchers.rb", "examples/passing/custom_formatter.rb", "examples/passing/dynamic_spec.rb", "examples/passing/file_accessor.rb", "examples/passing/file_accessor_spec.rb", "examples/passing/filtered_formatter.rb", "examples/passing/filtered_formatter_example.rb", "examples/passing/greeter_spec.rb", "examples/passing/helper_method_example.rb", "examples/passing/io_processor.rb", "examples/passing/io_processor_spec.rb", "examples/passing/mocking_example.rb", "examples/passing/multi_threaded_example_group_runner.rb", "examples/passing/nested_classes_example.rb", "examples/passing/partial_mock_example.rb", "examples/passing/pending_example.rb", "examples/passing/predicate_example.rb", "examples/passing/shared_example_group_example.rb", "examples/passing/shared_stack_examples.rb", "examples/passing/simple_matcher_example.rb", "examples/passing/spec_helper.rb", "examples/passing/stack.rb", "examples/passing/stack_spec.rb", "examples/passing/stack_spec_with_nested_example_groups.rb", "examples/passing/stubbing_example.rb", "examples/passing/yielding_example.rb", "examples/ruby1.9.compatibility/access_to_constants_spec.rb", "features-pending/cli/conditional_exclusion.feature", "features/before_and_after_blocks/before_and_after_blocks.feature", "features/example_groups/autogenerated_docstrings.feature", "features/example_groups/example_group_with_should_methods.feature", "features/example_groups/nested_groups.feature", "features/example_groups/output.feature", "features/heckle/heckle.feature", "features/interop/examples_and_tests_together.feature", "features/interop/test_but_not_test_unit.feature", "features/interop/test_case_with_should_methods.feature", "features/matchers/create_matcher.feature", "features/mock_framework_integration/use_flexmock.feature", "features/mock_framework_integration/use_mocha.feature", "features/mock_framework_integration/use_rr.feature", "features/mocks/mix_stubs_and_mocks.feature", "features/pending/pending_examples.feature", "features/step_definitions/running_rspec.rb", "features/support/env.rb", "features/support/matchers/smart_match.rb", "init.rb", "lib/autotest/discover.rb", "lib/autotest/rspec.rb", "lib/spec.rb", "lib/spec/adapters/mock_frameworks/flexmock.rb", "lib/spec/adapters/mock_frameworks/mocha.rb", "lib/spec/adapters/mock_frameworks/rr.rb", "lib/spec/adapters/mock_frameworks/rspec.rb", "lib/spec/autorun.rb", "lib/spec/dsl.rb", "lib/spec/dsl/main.rb", "lib/spec/dsl/matchers.rb", "lib/spec/example.rb", "lib/spec/example/before_and_after_hooks.rb", "lib/spec/example/errors.rb", "lib/spec/example/example_description.rb", "lib/spec/example/example_group.rb", "lib/spec/example/example_group_factory.rb", "lib/spec/example/example_group_hierarchy.rb", "lib/spec/example/example_group_methods.rb", "lib/spec/example/example_matcher.rb", "lib/spec/example/example_methods.rb", "lib/spec/example/module_reopening_fix.rb", "lib/spec/example/pending.rb", "lib/spec/example/predicate_matchers.rb", "lib/spec/example/shared_example_group.rb", "lib/spec/example/subject.rb", "lib/spec/expectations.rb", "lib/spec/expectations/differs/default.rb", "lib/spec/expectations/errors.rb", "lib/spec/expectations/extensions.rb", "lib/spec/expectations/extensions/object.rb", "lib/spec/expectations/handler.rb", "lib/spec/interop/test.rb", "lib/spec/interop/test/unit/autorunner.rb", "lib/spec/interop/test/unit/testcase.rb", "lib/spec/interop/test/unit/testresult.rb", "lib/spec/interop/test/unit/testsuite_adapter.rb", "lib/spec/interop/test/unit/ui/console/testrunner.rb", "lib/spec/matchers.rb", "lib/spec/matchers/be.rb", "lib/spec/matchers/be_close.rb", "lib/spec/matchers/be_instance_of.rb", "lib/spec/matchers/be_kind_of.rb", "lib/spec/matchers/change.rb", "lib/spec/matchers/eql.rb", "lib/spec/matchers/equal.rb", "lib/spec/matchers/errors.rb", "lib/spec/matchers/exist.rb", "lib/spec/matchers/extensions/instance_exec.rb", "lib/spec/matchers/generated_descriptions.rb", "lib/spec/matchers/has.rb", "lib/spec/matchers/have.rb", "lib/spec/matchers/include.rb", "lib/spec/matchers/match.rb", "lib/spec/matchers/match_array.rb", "lib/spec/matchers/matcher.rb", "lib/spec/matchers/method_missing.rb", "lib/spec/matchers/operator_matcher.rb", "lib/spec/matchers/raise_error.rb", "lib/spec/matchers/respond_to.rb", "lib/spec/matchers/satisfy.rb", "lib/spec/matchers/simple_matcher.rb", "lib/spec/matchers/throw_symbol.rb", "lib/spec/matchers/wrap_expectation.rb", "lib/spec/mocks.rb", "lib/spec/mocks/argument_expectation.rb", "lib/spec/mocks/argument_matchers.rb", "lib/spec/mocks/error_generator.rb", "lib/spec/mocks/errors.rb", "lib/spec/mocks/extensions.rb", "lib/spec/mocks/extensions/object.rb", "lib/spec/mocks/framework.rb", "lib/spec/mocks/message_expectation.rb", "lib/spec/mocks/methods.rb", "lib/spec/mocks/mock.rb", "lib/spec/mocks/order_group.rb", "lib/spec/mocks/proxy.rb", "lib/spec/mocks/space.rb", "lib/spec/mocks/spec_methods.rb", "lib/spec/rake/spectask.rb", "lib/spec/rake/verify_rcov.rb", "lib/spec/ruby.rb", "lib/spec/runner.rb", "lib/spec/runner/backtrace_tweaker.rb", "lib/spec/runner/class_and_arguments_parser.rb", "lib/spec/runner/command_line.rb", "lib/spec/runner/configuration.rb", "lib/spec/runner/drb_command_line.rb", "lib/spec/runner/example_group_runner.rb", "lib/spec/runner/formatter/base_formatter.rb", "lib/spec/runner/formatter/base_text_formatter.rb", "lib/spec/runner/formatter/failing_example_groups_formatter.rb", "lib/spec/runner/formatter/failing_examples_formatter.rb", "lib/spec/runner/formatter/html_formatter.rb", "lib/spec/runner/formatter/nested_text_formatter.rb", "lib/spec/runner/formatter/profile_formatter.rb", "lib/spec/runner/formatter/progress_bar_formatter.rb", "lib/spec/runner/formatter/snippet_extractor.rb", "lib/spec/runner/formatter/specdoc_formatter.rb", "lib/spec/runner/formatter/text_mate_formatter.rb", "lib/spec/runner/heckle_runner.rb", "lib/spec/runner/heckle_runner_unsupported.rb", "lib/spec/runner/option_parser.rb", "lib/spec/runner/options.rb", "lib/spec/runner/reporter.rb", "lib/spec/runner/spec_parser.rb", "lib/spec/test/unit.rb", "lib/spec/version.rb", "resources/helpers/cmdline.rb", "resources/rake/examples.rake", "resources/rake/examples_with_rcov.rake", "resources/rake/failing_examples_with_html.rake", "resources/rake/verify_rcov.rake", "resources/spec/example_group_with_should_methods.rb", "resources/spec/simple_spec.rb", "resources/test/spec_and_test_together.rb", "resources/test/spec_including_test_but_not_unit.rb", "resources/test/test_case_with_should_methods.rb", "rspec.gemspec", "spec/README.jruby", "spec/autotest/autotest_helper.rb", "spec/autotest/autotest_matchers.rb", "spec/autotest/discover_spec.rb", "spec/autotest/failed_results_re_spec.rb", "spec/autotest/rspec_spec.rb", "spec/rspec_suite.rb", "spec/ruby_forker.rb", "spec/spec.opts", "spec/spec/dsl/main_spec.rb", "spec/spec/dsl/matchers_spec.rb", "spec/spec/example/example_group_class_definition_spec.rb", "spec/spec/example/example_group_factory_spec.rb", "spec/spec/example/example_group_methods_spec.rb", "spec/spec/example/example_group_spec.rb", "spec/spec/example/example_matcher_spec.rb", "spec/spec/example/example_methods_spec.rb", "spec/spec/example/helper_method_spec.rb", "spec/spec/example/nested_example_group_spec.rb", "spec/spec/example/pending_module_spec.rb", "spec/spec/example/predicate_matcher_spec.rb", "spec/spec/example/shared_example_group_spec.rb", "spec/spec/example/subclassing_example_group_spec.rb", "spec/spec/expectations/differs/default_spec.rb", "spec/spec/expectations/extensions/object_spec.rb", "spec/spec/expectations/fail_with_spec.rb", "spec/spec/expectations/handler_spec.rb", "spec/spec/expectations/wrap_expectation_spec.rb", "spec/spec/interop/test/unit/resources/spec_that_fails.rb", "spec/spec/interop/test/unit/resources/spec_that_passes.rb", "spec/spec/interop/test/unit/resources/spec_with_errors.rb", "spec/spec/interop/test/unit/resources/spec_with_options_hash.rb", "spec/spec/interop/test/unit/resources/test_case_that_fails.rb", "spec/spec/interop/test/unit/resources/test_case_that_passes.rb", "spec/spec/interop/test/unit/resources/test_case_with_errors.rb", "spec/spec/interop/test/unit/resources/testsuite_adapter_spec_with_test_unit.rb", "spec/spec/interop/test/unit/spec_spec.rb", "spec/spec/interop/test/unit/test_unit_spec_helper.rb", "spec/spec/interop/test/unit/testcase_spec.rb", "spec/spec/interop/test/unit/testsuite_adapter_spec.rb", "spec/spec/matchers/be_close_spec.rb", "spec/spec/matchers/be_instance_of_spec.rb", "spec/spec/matchers/be_kind_of_spec.rb", "spec/spec/matchers/be_spec.rb", "spec/spec/matchers/change_spec.rb", "spec/spec/matchers/description_generation_spec.rb", "spec/spec/matchers/eql_spec.rb", "spec/spec/matchers/equal_spec.rb", "spec/spec/matchers/exist_spec.rb", "spec/spec/matchers/has_spec.rb", "spec/spec/matchers/have_spec.rb", "spec/spec/matchers/include_spec.rb", "spec/spec/matchers/match_array_spec.rb", "spec/spec/matchers/match_spec.rb", "spec/spec/matchers/matcher_methods_spec.rb", "spec/spec/matchers/matcher_spec.rb", "spec/spec/matchers/operator_matcher_spec.rb", "spec/spec/matchers/raise_error_spec.rb", "spec/spec/matchers/respond_to_spec.rb", "spec/spec/matchers/satisfy_spec.rb", "spec/spec/matchers/simple_matcher_spec.rb", "spec/spec/matchers/throw_symbol_spec.rb", "spec/spec/mocks/any_number_of_times_spec.rb", "spec/spec/mocks/argument_expectation_spec.rb", "spec/spec/mocks/at_least_spec.rb", "spec/spec/mocks/at_most_spec.rb", "spec/spec/mocks/bug_report_10260_spec.rb", "spec/spec/mocks/bug_report_10263_spec.rb", "spec/spec/mocks/bug_report_11545_spec.rb", "spec/spec/mocks/bug_report_15719_spec.rb", "spec/spec/mocks/bug_report_496_spec.rb", "spec/spec/mocks/bug_report_600_spec.rb", "spec/spec/mocks/bug_report_7611_spec.rb", "spec/spec/mocks/bug_report_7805_spec.rb", "spec/spec/mocks/bug_report_8165_spec.rb", "spec/spec/mocks/bug_report_8302_spec.rb", "spec/spec/mocks/failing_argument_matchers_spec.rb", "spec/spec/mocks/hash_including_matcher_spec.rb", "spec/spec/mocks/hash_not_including_matcher_spec.rb", "spec/spec/mocks/mock_ordering_spec.rb", "spec/spec/mocks/mock_space_spec.rb", "spec/spec/mocks/mock_spec.rb", "spec/spec/mocks/multiple_return_value_spec.rb", "spec/spec/mocks/nil_expectation_warning_spec.rb", "spec/spec/mocks/null_object_mock_spec.rb", "spec/spec/mocks/once_counts_spec.rb", "spec/spec/mocks/options_hash_spec.rb", "spec/spec/mocks/partial_mock_spec.rb", "spec/spec/mocks/partial_mock_using_mocks_directly_spec.rb", "spec/spec/mocks/passing_argument_matchers_spec.rb", "spec/spec/mocks/precise_counts_spec.rb", "spec/spec/mocks/record_messages_spec.rb", "spec/spec/mocks/stub_spec.rb", "spec/spec/mocks/stubbed_message_expectations_spec.rb", "spec/spec/mocks/twice_counts_spec.rb", "spec/spec/package/bin_spec_spec.rb", "spec/spec/runner/class_and_argument_parser_spec.rb", "spec/spec/runner/command_line_spec.rb", "spec/spec/runner/configuration_spec.rb", "spec/spec/runner/drb_command_line_spec.rb", "spec/spec/runner/empty_file.txt", "spec/spec/runner/example_group_runner_spec.rb", "spec/spec/runner/examples.txt", "spec/spec/runner/failed.txt", "spec/spec/runner/formatter/base_formatter_spec.rb", "spec/spec/runner/formatter/base_text_formatter_spec.rb", "spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb", "spec/spec/runner/formatter/failing_examples_formatter_spec.rb", "spec/spec/runner/formatter/html_formatted-1.8.4.html", "spec/spec/runner/formatter/html_formatted-1.8.5-jruby.html", "spec/spec/runner/formatter/html_formatted-1.8.5.html", "spec/spec/runner/formatter/html_formatted-1.8.6-jruby.html", "spec/spec/runner/formatter/html_formatted-1.8.6.html", "spec/spec/runner/formatter/html_formatted-1.8.7.html", "spec/spec/runner/formatter/html_formatted-1.9.1.html", "spec/spec/runner/formatter/html_formatter_spec.rb", "spec/spec/runner/formatter/nested_text_formatter_spec.rb", "spec/spec/runner/formatter/profile_formatter_spec.rb", "spec/spec/runner/formatter/progress_bar_formatter_spec.rb", "spec/spec/runner/formatter/snippet_extractor_spec.rb", "spec/spec/runner/formatter/specdoc_formatter_spec.rb", "spec/spec/runner/formatter/text_mate_formatted-1.8.4.html", "spec/spec/runner/formatter/text_mate_formatted-1.8.6.html", "spec/spec/runner/formatter/text_mate_formatted-1.8.7.html", "spec/spec/runner/formatter/text_mate_formatted-1.9.1.html", "spec/spec/runner/formatter/text_mate_formatter_spec.rb", "spec/spec/runner/heckle_runner_spec.rb", "spec/spec/runner/heckler_spec.rb", "spec/spec/runner/noisy_backtrace_tweaker_spec.rb", "spec/spec/runner/option_parser_spec.rb", "spec/spec/runner/options_spec.rb", "spec/spec/runner/output_one_time_fixture.rb", "spec/spec/runner/output_one_time_fixture_runner.rb", "spec/spec/runner/output_one_time_spec.rb", "spec/spec/runner/quiet_backtrace_tweaker_spec.rb", "spec/spec/runner/reporter_spec.rb", "spec/spec/runner/resources/a_bar.rb", "spec/spec/runner/resources/a_foo.rb", "spec/spec/runner/resources/a_spec.rb", "spec/spec/runner/resources/custom_example_group_runner.rb", "spec/spec/runner/resources/utf8_encoded.rb", "spec/spec/runner/spec.opts", "spec/spec/runner/spec_drb.opts", "spec/spec/runner/spec_parser/spec_parser_fixture.rb", "spec/spec/runner/spec_parser_spec.rb", "spec/spec/runner/spec_spaced.opts", "spec/spec/runner_spec.rb", "spec/spec/spec_classes.rb", "spec/spec_helper.rb"]
15
15
  s.has_rdoc = true
16
16
  s.homepage = %q{http://rspec.info/}
17
17
  s.rdoc_options = ["--main", "README.txt"]
18
18
  s.require_paths = ["lib"]
19
19
  s.rubyforge_project = %q{rspec}
20
20
  s.rubygems_version = %q{1.3.1}
21
- s.summary = %q{rspec 1.1.99.9}
21
+ s.summary = %q{rspec 1.1.99.13}
22
22
 
23
23
  if s.respond_to? :specification_version then
24
24
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
26
26
 
27
27
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
28
28
  s.add_development_dependency(%q<cucumber>, [">= 0.1.13"])
29
- s.add_development_dependency(%q<hoe>, [">= 1.8.3"])
29
+ s.add_development_dependency(%q<hoe>, [">= 1.9.0"])
30
30
  end
31
31
  end
32
32
  end
@@ -0,0 +1,25 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+
3
+ module Spec
4
+ module DSL
5
+ module Matchers
6
+ describe "#create" do
7
+ it "creates a method that initializes a new matcher with the submitted name and expected arg" do
8
+ # FIXME - this expects new to be called, but we need something
9
+ # more robust - that expects new to be called with a specific
10
+ # block (lambda, proc, whatever)
11
+ mod = Module.new
12
+ mod.extend Spec::DSL::Matchers
13
+ mod.create(:foo)
14
+
15
+ obj = Object.new
16
+ obj.extend mod
17
+
18
+ Spec::Matchers::Matcher.should_receive(:new).with(:foo, 3)
19
+
20
+ obj.foo(3)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -67,16 +67,22 @@ module Spec
67
67
  example.subject.should == []
68
68
  end
69
69
 
70
- it "should return nil for a module (as opposed to a class)" do
70
+ it "should return a Module" do
71
71
  group = Class.new(ExampleGroupDouble).describe(Enumerable)
72
72
  example = group.new("")
73
- example.subject.should be_nil
73
+ example.subject.should == Enumerable
74
74
  end
75
-
76
- it "should return nil for a string" do
75
+
76
+ it "should return a string" do
77
77
  group = Class.new(ExampleGroupDouble).describe('foo')
78
78
  example = group.new("")
79
- example.subject.should be_nil
79
+ example.subject.should == 'foo'
80
+ end
81
+
82
+ it "should return a number" do
83
+ group = Class.new(ExampleGroupDouble).describe(15)
84
+ example = group.new("")
85
+ example.subject.should == 15
80
86
  end
81
87
  end
82
88
 
@@ -2,57 +2,82 @@ module Spec
2
2
  module Example
3
3
  describe Pending do
4
4
 
5
- it 'should raise an ExamplePendingError if no block is supplied' do
6
- lambda {
7
- pending "TODO"
8
- }.should raise_error(ExamplePendingError, /TODO/)
9
- end
10
-
11
- it 'should raise an ExamplePendingError if a supplied block fails as expected' do
12
- lambda {
13
- pending "TODO" do
14
- raise "oops"
15
- end
16
- }.should raise_error(ExamplePendingError, /TODO/)
17
- end
18
-
19
- it 'should raise an ExamplePendingError if a supplied block fails as expected with a mock' do
20
- lambda {
21
- pending "TODO" do
22
- m = mock('thing')
23
- m.should_receive(:foo)
24
- m.rspec_verify
5
+ context "when no block is supplied" do
6
+ it "raises an ExamplePendingError if no block is supplied" do
7
+ lambda {
8
+ pending "TODO"
9
+ }.should raise_error(ExamplePendingError, /TODO/)
10
+ end
11
+
12
+ it "reports the file and line number" do
13
+ file = __FILE__
14
+ line_number = __LINE__ + 2
15
+ begin
16
+ pending("TODO")
17
+ rescue => error
18
+ ensure
19
+ error.pending_caller.should =~ /^#{file}:#{line_number}/
25
20
  end
26
- }.should raise_error(ExamplePendingError, /TODO/)
21
+ end
27
22
  end
28
23
 
29
- it 'should raise a PendingExampleFixedError if a supplied block starts working' do
30
- lambda {
31
- pending "TODO" do
32
- # success!
24
+ context "when the supplied block fails" do
25
+ it "raises an ExamplePendingError if a supplied block fails as expected" do
26
+ lambda {
27
+ pending "TODO" do
28
+ raise "oops"
29
+ end
30
+ }.should raise_error(ExamplePendingError, /TODO/)
31
+ end
32
+
33
+ it "reports the file and line number" do
34
+ file = __FILE__
35
+ line_number = __LINE__ + 2
36
+ begin
37
+ pending do
38
+ raise
39
+ end
40
+ rescue => error
41
+ ensure
42
+ error.pending_caller.should =~ /#{file}:#{line_number}/
33
43
  end
34
- }.should raise_error(PendingExampleFixedError, /TODO/)
44
+ end
35
45
  end
36
46
 
37
- it "should have the correct file and line number for pending given with a block which fails" do
38
- file = __FILE__
39
- line_number = __LINE__ + 2
40
- begin
41
- pending do
42
- raise
47
+ context "when the supplied block fails with a mock" do
48
+ it "raises an ExamplePendingError if a supplied block fails as expected with a mock" do
49
+ lambda {
50
+ pending "TODO" do
51
+ m = mock("thing")
52
+ m.should_receive(:foo)
53
+ m.rspec_verify
54
+ end
55
+ }.should raise_error(ExamplePendingError, /TODO/)
56
+ end
57
+
58
+ it "reports the file and line number" do
59
+ file = __FILE__
60
+ line_number = __LINE__ + 2
61
+ begin
62
+ pending do
63
+ m = mock("thing")
64
+ m.should_receive(:foo)
65
+ m.rspec_verify
66
+ end
67
+ rescue => error
68
+ ensure
69
+ error.pending_caller.should =~ /#{file}:#{line_number}/
43
70
  end
44
- rescue => error
45
- error.pending_caller.should =~ /#{file}:#{line_number}/
46
71
  end
47
72
  end
48
73
 
49
- it "should have the correct file and line number for pending given with no block" do
50
- file = __FILE__
51
- line_number = __LINE__ + 2
52
- begin
53
- pending("TODO")
54
- rescue => error
55
- error.pending_caller.should =~ /^#{file}:#{line_number}/
74
+ context "when the supplied block passes" do
75
+ it "raises a PendingExampleFixedError" do
76
+ lambda {
77
+ pending "TODO" do
78
+ # success!
79
+ end
80
+ }.should raise_error(PendingExampleFixedError, /TODO/)
56
81
  end
57
82
  end
58
83
  end
@@ -50,32 +50,52 @@ module Spec
50
50
  module Expectations
51
51
  describe ExpectationMatcherHandler do
52
52
  describe "#handle_matcher" do
53
- it "should ask the matcher if it matches" do
53
+ it "asks the matcher if it matches" do
54
54
  matcher = mock("matcher")
55
55
  actual = Object.new
56
56
  matcher.should_receive(:matches?).with(actual).and_return(true)
57
57
  Spec::Expectations::ExpectationMatcherHandler.handle_matcher(actual, matcher)
58
58
  end
59
59
 
60
- it "should return the match value" do
60
+ it "returns the match value" do
61
61
  matcher = mock("matcher")
62
62
  actual = Object.new
63
63
  matcher.should_receive(:matches?).with(actual).and_return(:this_value)
64
64
  Spec::Expectations::ExpectationMatcherHandler.handle_matcher(actual, matcher).should == :this_value
65
65
  end
66
+
67
+ it "calls failure_message_for_should if the matcher implements it" do
68
+ matcher = mock("matcher", :failure_message_for_should => "message", :matches? => false)
69
+ actual = Object.new
70
+
71
+ ::Spec::Expectations.should_receive(:fail_with).with("message")
72
+
73
+ Spec::Expectations::ExpectationMatcherHandler.handle_matcher(actual, matcher)
74
+
75
+ end
76
+
77
+ it "calls failure_message if the matcher does not implement failure_message_for_should" do
78
+ matcher = mock("matcher", :failure_message => "message", :matches? => false)
79
+ actual = Object.new
80
+
81
+ ::Spec::Expectations.should_receive(:fail_with).with("message")
82
+
83
+ Spec::Expectations::ExpectationMatcherHandler.handle_matcher(actual, matcher)
84
+
85
+ end
66
86
  end
67
87
  end
68
88
 
69
89
  describe NegativeExpectationMatcherHandler do
70
90
  describe "#handle_matcher" do
71
- it "should ask the matcher if it doesn't match when the matcher responds to #does_not_match?" do
91
+ it "asks the matcher if it doesn't match when the matcher responds to #does_not_match?" do
72
92
  matcher = mock("matcher", :does_not_match? => true, :negative_failure_message => nil)
73
93
  actual = Object.new
74
94
  matcher.should_receive(:does_not_match?).with(actual).and_return(true)
75
95
  Spec::Expectations::NegativeExpectationMatcherHandler.handle_matcher(actual, matcher)
76
96
  end
77
97
 
78
- it "should ask the matcher if it matches when the matcher doesn't respond to #does_not_match?" do
98
+ it "asks the matcher if it matches when the matcher doesn't respond to #does_not_match?" do
79
99
  matcher = mock("matcher")
80
100
  actual = Object.new
81
101
  matcher.stub!(:negative_failure_message)
@@ -83,13 +103,34 @@ module Spec
83
103
  Spec::Expectations::NegativeExpectationMatcherHandler.handle_matcher(actual, matcher)
84
104
  end
85
105
 
86
- it "should return the match value" do
106
+ it "returns the match value" do
87
107
  matcher = mock("matcher")
88
108
  actual = Object.new
89
109
  matcher.should_receive(:matches?).with(actual).and_return(false)
90
110
  matcher.stub!(:negative_failure_message).and_return("ignore")
91
111
  Spec::Expectations::NegativeExpectationMatcherHandler.handle_matcher(actual, matcher).should be_false
92
112
  end
113
+
114
+
115
+ it "calls failure_message_for_should_not if the matcher implements it" do
116
+ matcher = mock("matcher", :failure_message_for_should_not => "message", :matches? => true)
117
+ actual = Object.new
118
+
119
+ ::Spec::Expectations.should_receive(:fail_with).with("message")
120
+
121
+ Spec::Expectations::NegativeExpectationMatcherHandler.handle_matcher(actual, matcher)
122
+
123
+ end
124
+
125
+ it "calls negative_failure_message if the matcher does not implement failure_message_for_should_not" do
126
+ matcher = mock("matcher", :negative_failure_message => "message", :matches? => true)
127
+ actual = Object.new
128
+
129
+ ::Spec::Expectations.should_receive(:fail_with).with("message")
130
+
131
+ Spec::Expectations::NegativeExpectationMatcherHandler.handle_matcher(actual, matcher)
132
+
133
+ end
93
134
  end
94
135
  end
95
136