rspec 0.5.6 → 0.5.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. data/CHANGES +8 -0
  2. data/Rakefile +11 -11
  3. data/bin/spec +4 -1
  4. data/doc/src/documentation/index.page +37 -37
  5. data/doc/src/documentation/mocks.page +34 -34
  6. data/doc/src/documentation/underscores.page +5 -4
  7. data/doc/src/index.page +2 -2
  8. data/doc/src/tools/rails.page +11 -0
  9. data/doc/src/tools/spec.page +18 -3
  10. data/doc/src/tutorials/notes.txt +17 -6
  11. data/doc/src/tutorials/stack_04.page.orig +2 -2
  12. data/doc/src/tutorials/stack_05.page.orig +5 -5
  13. data/doc/src/tutorials/stack_06.page +7 -7
  14. data/doc/src/tutorials/stack_06.page.orig +7 -7
  15. data/examples/custom_formatter.rb +21 -0
  16. data/examples/mocking_spec.rb +1 -1
  17. data/examples/stack_spec.rb +21 -21
  18. data/lib/spec/runner/base_text_formatter.rb +42 -0
  19. data/lib/spec/runner/context_runner.rb +1 -1
  20. data/lib/spec/runner/kernel_ext.rb +1 -1
  21. data/lib/spec/runner/option_parser.rb +23 -7
  22. data/lib/spec/runner/progress_bar_formatter.rb +1 -1
  23. data/lib/spec/runner/rdoc_formatter.rb +0 -10
  24. data/lib/spec/runner/reporter.rb +3 -4
  25. data/lib/spec/runner/specdoc_formatter.rb +0 -3
  26. data/lib/spec/runner/specification.rb +3 -7
  27. data/lib/spec/tool/test_unit_translator.rb +20 -20
  28. data/lib/spec/version.rb +1 -1
  29. data/test/spec/api/mocks/mock_ordering_test.rb +28 -0
  30. data/test/spec/runner/context_test.rb +4 -4
  31. data/test/spec/runner/failure_dump_test.rb +7 -7
  32. data/test/spec/runner/option_parser_test.rb +22 -1
  33. data/test/spec/runner/progress_bar_formatter_test.rb +6 -0
  34. data/test/spec/runner/rdoc_formatter_test.rb +1 -1
  35. data/test/spec/runner/reporter_test.rb +9 -8
  36. data/test/spec/runner/specdoc_formatter_test.rb +5 -0
  37. data/test/spec/runner/specification_test.rb +8 -8
  38. data/test/spec/tool/command_line_test.rb +4 -4
  39. data/test/spec/tool/test_unit_api_spec.rb +25 -25
  40. metadata +5 -4
@@ -12,11 +12,12 @@ module Spec
12
12
  end
13
13
 
14
14
  def test_should_push_time_to_reporter
15
+ @formatter.should_receive(:start).with(5)
15
16
  @formatter.should_receive(:start_dump)
16
17
  @formatter.should_receive(:dump_summary) do |time, a, b, c|
17
18
  assert_match(/[0-9].[0-9|e|-]+/, time.to_s)
18
19
  end
19
- @reporter.start
20
+ @reporter.start(5)
20
21
  @reporter.end
21
22
  @reporter.dump
22
23
  end
@@ -42,7 +43,7 @@ module Spec
42
43
  @formatter.should_receive(:spec_passed)
43
44
  @formatter.should_receive(:start_dump)
44
45
  @formatter.should_receive(:dump_summary).with(:anything, 0, 1, 0)
45
- @reporter.add_spec spec
46
+ @reporter.spec_finished spec
46
47
  @reporter.dump
47
48
  end
48
49
 
@@ -55,7 +56,7 @@ module Spec
55
56
  @formatter.should_receive(:dump_summary).with(:anything, 1, 1, 1)
56
57
  @backtrace_tweaker.should.receive(:tweak_backtrace)
57
58
  @reporter.add_context "context"
58
- @reporter.add_spec spec, RuntimeError.new
59
+ @reporter.spec_finished spec, RuntimeError.new
59
60
  @reporter.dump
60
61
  end
61
62
 
@@ -81,11 +82,11 @@ module Spec
81
82
  @formatter.should_receive(:dump_summary).with(:anything, 2, 4, 2)
82
83
  @backtrace_tweaker.should.receive(:tweak_backtrace)
83
84
  @reporter.add_context "context"
84
- @reporter.add_spec "spec"
85
- @reporter.add_spec "spec", error
85
+ @reporter.spec_finished "spec"
86
+ @reporter.spec_finished "spec", error
86
87
  @reporter.add_context "context"
87
- @reporter.add_spec "spec"
88
- @reporter.add_spec "spec", error
88
+ @reporter.spec_finished "spec"
89
+ @reporter.spec_finished "spec", error
89
90
  @reporter.dump
90
91
  end
91
92
 
@@ -94,7 +95,7 @@ module Spec
94
95
  @formatter.should_receive(:spec_failed)
95
96
  @backtrace_tweaker.should.receive(:tweak_backtrace)
96
97
  @reporter.add_context "context"
97
- @reporter.add_spec "spec", RuntimeError.new
98
+ @reporter.spec_finished "spec", RuntimeError.new
98
99
  @backtrace_tweaker.__verify
99
100
  end
100
101
 
@@ -28,6 +28,11 @@ module Spec
28
28
  assert_equal("\nFinished in 4 seconds\n\n3 contexts, 2 specifications, 1 failure\n", @io.string)
29
29
  end
30
30
 
31
+ def test_should_push_nothing_on_start
32
+ @formatter.start(5)
33
+ assert_equal("", @io.string)
34
+ end
35
+
31
36
  def test_should_push_nothing_on_start_dump
32
37
  @formatter.start_dump
33
38
  assert_equal("", @io.string)
@@ -12,26 +12,26 @@ module Spec
12
12
  self.should.not.be.instance_of Specification
13
13
  self.should.be.instance_of ExecutionContext
14
14
  end
15
- @reporter.should.receive(:add_spec).with "should pass", nil, nil
15
+ @reporter.should.receive(:spec_finished).with "should pass", nil, nil
16
16
  spec.run @reporter
17
17
  end
18
18
 
19
19
  def test_should_add_itself_to_reporter_when_passes
20
20
  spec = Specification.new("spec") {}
21
- @reporter.should.receive(:add_spec).with "spec", nil, nil
21
+ @reporter.should.receive(:spec_finished).with "spec", nil, nil
22
22
  spec.run(@reporter)
23
23
  end
24
24
 
25
25
  def test_should_add_itself_to_reporter_when_fails
26
26
  error = RuntimeError.new
27
27
  spec = Specification.new("spec") { raise error }
28
- @reporter.should.receive(:add_spec).with "spec", error, "spec"
28
+ @reporter.should.receive(:spec_finished).with "spec", error, "spec"
29
29
  spec.run(@reporter)
30
30
  end
31
31
 
32
32
  def test_should_add_itself_to_reporter_when_calling_run_dry
33
33
  spec = Specification.new("spec") {}
34
- @reporter.should.receive(:add_spec).with "spec"
34
+ @reporter.should.receive(:spec_finished).with "spec"
35
35
  spec.run(@reporter, nil, nil, true)
36
36
  end
37
37
 
@@ -40,7 +40,7 @@ module Spec
40
40
  mock = mock("a mock")
41
41
  mock.should.receive(:poke)
42
42
  end
43
- @reporter.should.receive(:add_spec) do |spec_name, error|
43
+ @reporter.should.receive(:spec_finished) do |spec_name, error|
44
44
  spec_name.should.equal "spec"
45
45
  error.message.should.match /expected 'poke' once, but received it 0 times/
46
46
  end
@@ -54,7 +54,7 @@ module Spec
54
54
  teardown = lambda do
55
55
  raise "in teardown"
56
56
  end
57
- @reporter.should.receive(:add_spec) do |spec, error, location|
57
+ @reporter.should.receive(:spec_finished) do |spec, error, location|
58
58
  spec.should.equal "spec"
59
59
  location.should.equal "spec"
60
60
  error.message.should.equal "in body"
@@ -68,7 +68,7 @@ module Spec
68
68
  setup = lambda do
69
69
  raise "in setup"
70
70
  end
71
- @reporter.should.receive(:add_spec) do |name, error, location|
71
+ @reporter.should.receive(:spec_finished) do |name, error, location|
72
72
  name.should.equal "spec"
73
73
  error.message.should.equal "in setup"
74
74
  location.should.equal "setup"
@@ -82,7 +82,7 @@ module Spec
82
82
  teardown = lambda do
83
83
  raise "in teardown"
84
84
  end
85
- @reporter.should.receive(:add_spec) do |name, error, location|
85
+ @reporter.should.receive(:spec_finished) do |name, error, location|
86
86
  name.should.equal "spec"
87
87
  error.message.should.equal "in teardown"
88
88
  location.should.equal "teardown"
@@ -7,10 +7,10 @@ module Spec
7
7
  def test_writes_translated_file
8
8
  translator = Api::Mock.new "translator"
9
9
  filesystem = Api::Mock.new "filesystem"
10
- filesystem.should.receive(:write_translation).with "./test/spec/tool/test_unit_translator_test.rb", "spec/test_unit_translator_test.rb"
11
- filesystem.should.receive(:write_translation).with "./test/spec/tool/test_unit_api_test.rb", "spec/test_unit_api_test.rb"
12
- filesystem.should.receive(:write_translation).with "./test/spec/tool/test_unit_api_spec.rb", "spec/test_unit_api_spec.rb"
13
- filesystem.should.receive(:write_translation).with "./test/spec/tool/command_line_test.rb", "spec/command_line_test.rb"
10
+ filesystem.should_receive(:write_translation).with "./test/spec/tool/test_unit_translator_test.rb", "spec/test_unit_translator_test.rb"
11
+ filesystem.should_receive(:write_translation).with "./test/spec/tool/test_unit_api_test.rb", "spec/test_unit_api_test.rb"
12
+ filesystem.should_receive(:write_translation).with "./test/spec/tool/test_unit_api_spec.rb", "spec/test_unit_api_spec.rb"
13
+ filesystem.should_receive(:write_translation).with "./test/spec/tool/command_line_test.rb", "spec/command_line_test.rb"
14
14
 
15
15
  cl = CommandLine.new(filesystem)
16
16
  out = StringIO.new
@@ -15,45 +15,45 @@ module Spec
15
15
  a_float = 123.45
16
16
  a_nil = nil
17
17
 
18
- @an_int.should.not.be nil
19
- lambda { true }.should.be true
18
+ @an_int.should_not_be nil
19
+ lambda { true }.should_be true
20
20
  lambda do
21
21
  true
22
- end.should.be true
23
- @an_int.should.equal 789
24
- a_float.should.be.close 123.5, 0.1
25
- @an_int.should.be.instance.of Fixnum
26
- @an_int.should.be.kind.of Numeric
27
- @an_int.to_s.should.match /789/
28
- a_nil.should.be nil
29
- @an_int.to_s.should.not.match /7890/
30
- @an_int.should.not.equal 780
31
- @an_int.should.not.be nil
32
- a_float.should.not.be @an_int
33
- lambda { foo = 1 }.should.not.raise
22
+ end.should_be true
23
+ @an_int.should_equal 789
24
+ a_float.should_be_close 123.5, 0.1
25
+ @an_int.should_be_instance_of Fixnum
26
+ @an_int.should_be_kind_of Numeric
27
+ @an_int.to_s.should_match /789/
28
+ a_nil.should_be nil
29
+ @an_int.to_s.should_not_match /7890/
30
+ @an_int.should_not_equal 780
31
+ @an_int.should_not_be nil
32
+ a_float.should_not_be @an_int
33
+ lambda { foo = 1 }.should_not_raise
34
34
  lambda do
35
35
  foo = 2
36
- end.should.not.raise
37
- lambda { foo = 3 }.should.not.throw
36
+ end.should_not_raise
37
+ lambda { foo = 3 }.should_not_throw
38
38
  lambda do
39
39
  foo = 4
40
- end.should.not.throw
40
+ end.should_not_throw
41
41
  #assert_operator object1, operator, object2, "a message"
42
- lambda { raise NotImplementedError }.should.raise NotImplementedError
42
+ lambda { raise NotImplementedError }.should_raise NotImplementedError
43
43
  lambda do
44
44
  raise NotImplementedError
45
- end.should.raise NotImplementedError
46
- lambda { raise NotImplementedError }.should.raise NotImplementedError
45
+ end.should_raise NotImplementedError
46
+ lambda { raise NotImplementedError }.should_raise NotImplementedError
47
47
  lambda do
48
48
  raise NotImplementedError
49
- end.should.raise NotImplementedError
50
- @an_int.should.respond.to :to_f
51
- a_float.should.be a_float
49
+ end.should_raise NotImplementedError
50
+ @an_int.should_respond_to :to_f
51
+ a_float.should_be a_float
52
52
  #assert_send send_array, "a message"
53
- lambda { throw :foo }.should.throw :foo
53
+ lambda { throw :foo }.should_throw :foo
54
54
  lambda do
55
55
  throw :foo
56
- end.should.throw :foo
56
+ end.should_throw :foo
57
57
 
58
58
  end
59
59
  end
metadata CHANGED
@@ -3,9 +3,9 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: rspec
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.5.6
7
- date: 2006-06-06 00:00:00 -05:00
8
- summary: RSpec-0.5.6 - BDD for Ruby http://rspec.rubyforge.org/
6
+ version: 0.5.7
7
+ date: 2006-06-07 00:00:00 -05:00
8
+ summary: RSpec-0.5.7 - BDD for Ruby http://rspec.rubyforge.org/
9
9
  require_paths:
10
10
  - lib
11
11
  email: rspec-devel@rubyforge.org
@@ -29,7 +29,6 @@ authors:
29
29
  - Steven Baker, Aslak Hellesoy, Dave Astels, David Chelimsky
30
30
  files:
31
31
  - CHANGES
32
- - EXAMPLES.rd
33
32
  - Rakefile
34
33
  - README
35
34
  - lib/spec.rb
@@ -110,6 +109,7 @@ files:
110
109
  - test/spec/tool/test_unit_translator_test.rb
111
110
  - examples/airport_spec.rb
112
111
  - examples/bdd_framework_spec.rb
112
+ - examples/custom_formatter.rb
113
113
  - examples/mocking_spec.rb
114
114
  - examples/stack.rb
115
115
  - examples/stack_spec.rb
@@ -159,6 +159,7 @@ files:
159
159
  - doc/src/tutorials/stack_06.page
160
160
  - doc/src/tutorials/stack_06.page.orig
161
161
  - doc/src/tutorials/stack_spec.rb
162
+ - EXAMPLES.rd
162
163
  test_files: []
163
164
 
164
165
  rdoc_options: