rspec 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. data/CHANGES +78 -1
  2. data/EXAMPLES.rd +8 -5
  3. data/README +1 -0
  4. data/Rakefile +1 -1
  5. data/examples/pending_example.rb +20 -0
  6. data/lib/autotest/rspec.rb +46 -18
  7. data/lib/spec/dsl.rb +1 -0
  8. data/lib/spec/dsl/behaviour.rb +37 -27
  9. data/lib/spec/dsl/behaviour_callbacks.rb +4 -0
  10. data/lib/spec/dsl/behaviour_eval.rb +27 -16
  11. data/lib/spec/dsl/behaviour_factory.rb +2 -2
  12. data/lib/spec/dsl/composite_proc_builder.rb +9 -4
  13. data/lib/spec/dsl/configuration.rb +20 -4
  14. data/lib/spec/dsl/description.rb +7 -0
  15. data/lib/spec/dsl/errors.rb +9 -0
  16. data/lib/spec/dsl/example.rb +18 -10
  17. data/lib/spec/matchers/have.rb +10 -13
  18. data/lib/spec/matchers/operator_matcher.rb +3 -3
  19. data/lib/spec/matchers/raise_error.rb +8 -3
  20. data/lib/spec/mocks/error_generator.rb +1 -1
  21. data/lib/spec/mocks/message_expectation.rb +11 -0
  22. data/lib/spec/mocks/methods.rb +9 -5
  23. data/lib/spec/mocks/proxy.rb +13 -9
  24. data/lib/spec/rake/spectask.rb +80 -38
  25. data/lib/spec/runner/backtrace_tweaker.rb +2 -1
  26. data/lib/spec/runner/behaviour_runner.rb +37 -16
  27. data/lib/spec/runner/formatter/base_formatter.rb +23 -15
  28. data/lib/spec/runner/formatter/base_text_formatter.rb +39 -11
  29. data/lib/spec/runner/formatter/failing_behaviours_formatter.rb +7 -3
  30. data/lib/spec/runner/formatter/failing_examples_formatter.rb +3 -3
  31. data/lib/spec/runner/formatter/html_formatter.rb +32 -25
  32. data/lib/spec/runner/formatter/progress_bar_formatter.rb +6 -5
  33. data/lib/spec/runner/formatter/rdoc_formatter.rb +6 -6
  34. data/lib/spec/runner/formatter/specdoc_formatter.rb +7 -6
  35. data/lib/spec/runner/option_parser.rb +6 -5
  36. data/lib/spec/runner/options.rb +60 -43
  37. data/lib/spec/runner/reporter.rb +17 -6
  38. data/lib/spec/runner/spec_parser.rb +1 -1
  39. data/lib/spec/translator.rb +8 -0
  40. data/lib/spec/version.rb +3 -3
  41. data/plugins/mock_frameworks/flexmock.rb +14 -18
  42. data/plugins/mock_frameworks/mocha.rb +0 -2
  43. data/plugins/mock_frameworks/rr.rb +21 -0
  44. data/spec/autotest/discover_spec.rb +19 -0
  45. data/spec/autotest/rspec_spec.rb +257 -0
  46. data/spec/autotest_helper.rb +4 -0
  47. data/spec/spec/dsl/behaviour_eval_spec.rb +30 -0
  48. data/spec/spec/dsl/behaviour_factory_spec.rb +18 -0
  49. data/spec/spec/dsl/behaviour_spec.rb +95 -58
  50. data/spec/spec/dsl/composite_proc_builder_spec.rb +0 -13
  51. data/spec/spec/dsl/configuration_spec.rb +6 -1
  52. data/spec/spec/dsl/description_spec.rb +9 -1
  53. data/spec/spec/dsl/example_class_spec.rb +3 -3
  54. data/spec/spec/dsl/example_instance_spec.rb +26 -28
  55. data/spec/spec/dsl/example_matcher_spec.rb +91 -0
  56. data/spec/spec/dsl/shared_behaviour_spec.rb +24 -0
  57. data/spec/spec/expectations/extensions/object_spec.rb +2 -2
  58. data/spec/spec/expectations/fail_with_spec.rb +2 -2
  59. data/spec/spec/matchers/have_spec.rb +1 -1
  60. data/spec/spec/matchers/operator_matcher_spec.rb +10 -10
  61. data/spec/spec/matchers/raise_error_spec.rb +38 -0
  62. data/spec/spec/mocks/argument_expectation_spec.rb +18 -14
  63. data/spec/spec/mocks/at_most_spec.rb +1 -1
  64. data/spec/spec/mocks/bug_report_11545_spec.rb +31 -0
  65. data/spec/spec/mocks/partial_mock_spec.rb +33 -1
  66. data/spec/spec/runner/behaviour_runner_spec.rb +72 -49
  67. data/spec/spec/runner/command_line_spec.rb +1 -1
  68. data/spec/spec/runner/context_matching_spec.rb +10 -10
  69. data/spec/spec/runner/drb_command_line_spec.rb +62 -59
  70. data/spec/spec/runner/extensions/bug_report_10577_spec.rb +35 -0
  71. data/spec/spec/runner/formatter/failing_behaviours_formatter_spec.rb +15 -2
  72. data/spec/spec/runner/formatter/failing_examples_formatter_spec.rb +3 -3
  73. data/spec/spec/runner/formatter/html_formatter_spec.rb +1 -1
  74. data/spec/spec/runner/formatter/progress_bar_formatter_dry_run_spec.rb +14 -15
  75. data/spec/spec/runner/formatter/progress_bar_formatter_failure_dump_spec.rb +1 -1
  76. data/spec/spec/runner/formatter/progress_bar_formatter_spec.rb +42 -9
  77. data/spec/spec/runner/formatter/rdoc_formatter_spec.rb +40 -40
  78. data/spec/spec/runner/formatter/specdoc_formatter_spec.rb +55 -49
  79. data/spec/spec/runner/option_parser_spec.rb +16 -15
  80. data/spec/spec/runner/options_spec.rb +64 -31
  81. data/spec/spec/runner/reporter_spec.rb +67 -15
  82. data/spec/spec/spec_classes.rb +9 -1
  83. data/spec/spec/translator_spec.rb +48 -0
  84. data/spec/spec_helper.rb +5 -2
  85. metadata +13 -6
  86. data/examples/not_yet_implemented_spec.rb +0 -12
  87. data/spec/spec/runner/example_matcher_spec.rb +0 -127
@@ -1,12 +0,0 @@
1
- require File.dirname(__FILE__) + '/spec_helper'
2
- require File.dirname(__FILE__) + "/stack"
3
-
4
- describe Stack, ' (not implemented features)' do
5
- before(:each) do
6
- @stack = Stack.new
7
- end
8
-
9
- it "should transform to xml using #to_xml"
10
-
11
- it "should convert from xml using #from_xml"
12
- end
@@ -1,127 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper.rb'
2
-
3
- module Spec
4
- module DSL
5
- module ExampleMatcherSpecHelper
6
- class MatchDescription
7
- def initialize(description)
8
- @description = description
9
- end
10
-
11
- def matches?(matcher)
12
- matcher.matches?(@description)
13
- end
14
-
15
- def failure_message
16
- "expected matcher.matches?(#{@description.inspect}) to return true, got false"
17
- end
18
-
19
- def negative_failure_message
20
- "expected matcher.matches?(#{@description.inspect}) to return false, got true"
21
- end
22
- end
23
- def match_description(description)
24
- MatchDescription.new(description)
25
- end
26
- end
27
-
28
- describe ExampleMatcher do
29
- include ExampleMatcherSpecHelper
30
-
31
- it "should match correct behaviour and example" do
32
- matcher=ExampleMatcher.new("behaviour", "example")
33
- matcher.should match_description("behaviour example")
34
- end
35
-
36
- it "should not match wrong example" do
37
- matcher=ExampleMatcher.new("behaviour", "other example")
38
- matcher.should_not match_description("behaviour example")
39
- end
40
-
41
- it "should not match wrong behaviour" do
42
- matcher=ExampleMatcher.new("other behaviour", "example")
43
- matcher.should_not match_description("behaviour example")
44
- end
45
-
46
- it "should match example only" do
47
- matcher=ExampleMatcher.new("behaviour", "example")
48
- matcher.should match_description("example")
49
- end
50
-
51
- it "should match behaviour only" do
52
- matcher=ExampleMatcher.new("behaviour", "example")
53
- matcher.should match_description("behaviour")
54
- end
55
-
56
- it "should escape regexp chars" do
57
- matcher=ExampleMatcher.new("(con|text)", "[example]")
58
- matcher.should_not match_description("con p")
59
- end
60
-
61
- it "should match when behaviour is modularized" do
62
- matcher=ExampleMatcher.new("MyModule::MyClass", "example")
63
- matcher.should match_description("MyClass example")
64
- end
65
-
66
- # it "should match with regexp reserved (characters) in the example" do
67
- # matcher=ExampleMatcher.new("with ([#]) an example", "a context")
68
- # matcher.should match_description("a context")
69
- # matcher.should match_description("with ([#]) an example")
70
- # matcher.should match_description("a context with ([#]) an example")
71
- # end
72
- #
73
- # it "should match with regexp reserved (characters) in the context" do
74
- # matcher=ExampleMatcher.new("with an example", "a ([#]) context")
75
- # matcher.should match_description("a ([#]) context with an example")
76
- # matcher.should match_description("a ([#]) context with an example")
77
- # matcher.should match_description("a ([#]) context with an example")
78
- # end
79
-
80
- # it "should not match wrong example only" do
81
- # matcher=ExampleMatcher.new("with another example", "a context")
82
- # matcher.should_not match_description("with an example")
83
- # end
84
- #
85
- # it "should not match wrong context" do
86
- # matcher=ExampleMatcher.new("another context with an example", "a context")
87
- # matcher.should_not match_description("with an example")
88
- # end
89
- #
90
- # it "should not match wrong context only" do
91
- # matcher=ExampleMatcher.new("another context", "a context")
92
- # matcher.should_not match_description("with an example")
93
- # end
94
- #
95
- # it "should not match wrong example" do
96
- # matcher=ExampleMatcher.new("a context with another example", "a context")
97
- # matcher.should_not match_description("with an example")
98
- # end
99
-
100
- end
101
-
102
- describe ExampleMatcher, "normal case" do
103
- it "matches when passed in example matches" do
104
- @matcher = ExampleMatcher.new("Foo", "bar")
105
- @matcher.matches?(["no match", "Foo bar"]).should == true
106
- end
107
-
108
- it "does not match when no passed in examples match" do
109
- @matcher = ExampleMatcher.new("Foo", "bar")
110
- @matcher.matches?(["no match1", "no match2"]).should == false
111
- end
112
- end
113
-
114
- describe ExampleMatcher, "where description has '::' in it" do
115
- it "matches when passed in example matches" do
116
- @matcher = ExampleMatcher.new("Foo::Bar", "baz")
117
- @matcher.matches?(["no match", "Foo::Bar baz"]).should == true
118
- end
119
-
120
- it "does not match when no passed in examples match" do
121
- @matcher = ExampleMatcher.new("Foo::Bar", "baz")
122
- @matcher.matches?(["no match1", "no match2"]).should == false
123
- end
124
- end
125
-
126
- end
127
- end