rspec 0.5.12 → 0.5.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +9 -1
- data/README +2 -2
- data/Rakefile +13 -5
- data/examples/custom_formatter.rb +2 -2
- data/examples/file_accessor.rb +18 -0
- data/examples/file_accessor_spec.rb +38 -0
- data/examples/io_processor.rb +8 -0
- data/examples/io_processor_spec.rb +21 -0
- data/lib/spec/api/exceptions.rb +3 -0
- data/lib/spec/api/mocks/message_expectation.rb +45 -29
- data/lib/spec/api/mocks/mock.rb +1 -1
- data/lib/spec/api/mocks/order_group.rb +1 -1
- data/lib/spec/runner.rb +1 -5
- data/lib/spec/runner/formatter.rb +5 -0
- data/lib/spec/runner/formatter/base_text_formatter.rb +79 -0
- data/lib/spec/runner/formatter/html_formatter.rb +156 -0
- data/lib/spec/runner/formatter/progress_bar_formatter.rb +27 -0
- data/lib/spec/runner/formatter/rdoc_formatter.rb +22 -0
- data/lib/spec/runner/formatter/specdoc_formatter.rb +22 -0
- data/lib/spec/runner/option_parser.rb +17 -17
- data/lib/spec/runner/reporter.rb +1 -1
- data/lib/spec/version.rb +1 -1
- data/test/spec/api/helper/arbitrary_predicate_test.rb +38 -38
- data/test/spec/api/helper/diff_test.rb +1 -1
- data/test/spec/api/helper/identity_test.rb +17 -10
- data/test/spec/api/helper/{equality_test.rb → object_equality_test.rb} +15 -29
- data/test/spec/api/helper/regex_matching_test.rb +7 -9
- data/test/spec/api/helper/throwing_test.rb +11 -12
- data/test/spec/api/helper/true_false_special_case_test.rb +15 -17
- data/test/spec/api/helper/typing_test.rb +27 -26
- data/test/spec/api/mocks/mock_arg_constraints_test.rb +1 -1
- data/test/spec/api/mocks/mock_test.rb +45 -11
- data/test/spec/api/mocks/null_object_test.rb +3 -3
- data/test/spec/runner/context_matching_test.rb +2 -2
- data/test/spec/runner/formatter/failure_dump_test.rb +94 -0
- data/test/spec/runner/formatter/html_formatter_test.rb +48 -0
- data/test/spec/runner/formatter/progress_bar_formatter_test.rb +56 -0
- data/test/spec/runner/formatter/rdoc_formatter_test.rb +51 -0
- data/test/spec/runner/formatter/specdoc_formatter_test.rb +57 -0
- data/test/spec/runner/kernel_ext_test.rb +1 -1
- data/test/spec/runner/option_parser_test.rb +22 -12
- data/test/spec/runner/reporter_test.rb +1 -1
- data/test/test_classes.rb +7 -7
- metadata +19 -14
- data/lib/spec/runner/base_text_formatter.rb +0 -77
- data/lib/spec/runner/html_formatter.rb +0 -153
- data/lib/spec/runner/progress_bar_formatter.rb +0 -25
- data/lib/spec/runner/rdoc_formatter.rb +0 -20
- data/lib/spec/runner/specdoc_formatter.rb +0 -20
- data/test/spec/runner/failure_dump_test.rb +0 -92
- data/test/spec/runner/html_formatter_test.rb +0 -47
- data/test/spec/runner/progress_bar_formatter_test.rb +0 -54
- data/test/spec/runner/rdoc_formatter_test.rb +0 -50
- data/test/spec/runner/specdoc_formatter_test.rb +0 -55
@@ -1,47 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../test_helper'
|
2
|
-
module Spec
|
3
|
-
module Runner
|
4
|
-
class HtmlFormatterTest < Test::Unit::TestCase
|
5
|
-
|
6
|
-
def setup
|
7
|
-
@io = StringIO.new
|
8
|
-
@formatter = HtmlFormatter.new(@io)
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_should_push_header_on_start
|
12
|
-
@formatter.start(5)
|
13
|
-
assert_equal(HtmlFormatter::HEADER, @io.string)
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_should_push_context_name
|
17
|
-
@formatter.add_context("fruit", true)
|
18
|
-
assert_equal("<div class=\"context\">\n <div>fruit</div>\n <div>\n", @io.string)
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_should_push_div_with_spec_passed_class
|
22
|
-
@formatter.spec_started("spec")
|
23
|
-
@formatter.spec_passed("spec")
|
24
|
-
assert_equal("<div class=\"spec passed\">spec</div>\n", @io.string)
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_should_push_div_with_spec_failed_class
|
28
|
-
exception = StandardError.new("boo")
|
29
|
-
failure = Reporter::Failure.new("context_name", "spec_name", exception)
|
30
|
-
@formatter.spec_started("spec_name")
|
31
|
-
@formatter.spec_failed("spec_name", 98, failure)
|
32
|
-
assert_match(/<div class="spec failed">/, @io.string)
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_should_close_html_on_dump_summary
|
36
|
-
@formatter.dump_summary(3,2,1)
|
37
|
-
assert_equal("</body></html>", @io.string)
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_should_push_div_on_start_dump
|
41
|
-
@formatter.start_dump
|
42
|
-
assert_equal("</div>", @io.string.split.last)
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../test_helper'
|
2
|
-
module Spec
|
3
|
-
module Runner
|
4
|
-
class ProgressBarFormatterTest < Test::Unit::TestCase
|
5
|
-
|
6
|
-
def setup
|
7
|
-
@io = StringIO.new
|
8
|
-
@formatter = ProgressBarFormatter.new(@io)
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_should_push_nothing_on_start
|
12
|
-
@formatter.start(4)
|
13
|
-
assert_equal("", @io.string)
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_should_push_line_break_for_context
|
17
|
-
@formatter.add_context("context", :ignored)
|
18
|
-
assert_equal("\n", @io.string)
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_should_push_dot_for_passing_spec
|
22
|
-
@formatter.spec_passed("spec")
|
23
|
-
assert_equal(".", @io.string)
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_should_push_F_for_failing_spec
|
27
|
-
@formatter.spec_failed("spec", 98, nil)
|
28
|
-
assert_equal("F", @io.string)
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_should_produce_standard_summary
|
32
|
-
@formatter.dump_summary(3,2,1)
|
33
|
-
assert_equal("\nFinished in 3 seconds\n\n2 specifications, 1 failure\n", @io.string)
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_should_produce_line_break_on_start_dump
|
37
|
-
@formatter.start_dump
|
38
|
-
assert_equal("\n", @io.string)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
class ProgressBarFormatterDryRunTest < Test::Unit::TestCase
|
43
|
-
def setup
|
44
|
-
@io = StringIO.new
|
45
|
-
@formatter = ProgressBarFormatter.new(@io, true)
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_should_not_produce_summary_on_dry_run
|
49
|
-
@formatter.dump_summary(3,2,1)
|
50
|
-
assert_equal("", @io.string)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../test_helper'
|
2
|
-
module Spec
|
3
|
-
module Runner
|
4
|
-
class RdocFormatterTest < Test::Unit::TestCase
|
5
|
-
|
6
|
-
def setup
|
7
|
-
@io = StringIO.new
|
8
|
-
@formatter = RdocFormatter.new(@io, true)
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_should_push_out_context
|
12
|
-
@formatter.add_context("context", :ignored)
|
13
|
-
assert_equal("# context\n", @io.string)
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_should_push_out_spec
|
17
|
-
@formatter.spec_passed("spec")
|
18
|
-
assert_equal("# * spec\n", @io.string)
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_should_push_out_failed_spec
|
22
|
-
@formatter.spec_failed("spec", 98, nil)
|
23
|
-
assert_equal("# * spec [98 - FAILED]\n", @io.string)
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_should_produce_no_summary
|
27
|
-
@formatter.dump_summary(nil,nil,nil)
|
28
|
-
assert(@io.string.empty?)
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_should_produce_nothing_on_start_dump
|
32
|
-
@formatter.start_dump
|
33
|
-
assert(@io.string.empty?)
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
37
|
-
class RdocFormatterDryRunTest < Test::Unit::TestCase
|
38
|
-
def setup
|
39
|
-
@io = StringIO.new
|
40
|
-
@formatter = RdocFormatter.new(@io, true)
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_should_not_produce_summary_on_dry_run
|
44
|
-
@formatter.dump_summary(3,2,1)
|
45
|
-
assert_equal("", @io.string)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
50
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../test_helper'
|
2
|
-
module Spec
|
3
|
-
module Runner
|
4
|
-
class SpecdocFormatterTest < Test::Unit::TestCase
|
5
|
-
|
6
|
-
def setup
|
7
|
-
@io = StringIO.new
|
8
|
-
@formatter = SpecdocFormatter.new(@io)
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_should_push_context_name
|
12
|
-
@formatter.add_context("context", :ignored)
|
13
|
-
assert_equal("\ncontext\n", @io.string)
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_should_push_passing_spec_name
|
17
|
-
@formatter.spec_passed("spec")
|
18
|
-
assert_equal("- spec\n", @io.string)
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_should_push_failing_spec_name_and_failure_number
|
22
|
-
@formatter.spec_failed("spec", 98, nil)
|
23
|
-
assert_equal("- spec (FAILED - 98)\n", @io.string)
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_should_produce_standard_summary
|
27
|
-
@formatter.dump_summary(3,2,1)
|
28
|
-
assert_equal("\nFinished in 3 seconds\n\n2 specifications, 1 failure\n", @io.string)
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_should_push_nothing_on_start
|
32
|
-
@formatter.start(5)
|
33
|
-
assert_equal("", @io.string)
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_should_push_nothing_on_start_dump
|
37
|
-
@formatter.start_dump
|
38
|
-
assert_equal("", @io.string)
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
42
|
-
|
43
|
-
class SpecdocFormatterDryRunTest < Test::Unit::TestCase
|
44
|
-
def setup
|
45
|
-
@io = StringIO.new
|
46
|
-
@formatter = SpecdocFormatter.new(@io, true)
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_should_not_produce_summary_on_dry_run
|
50
|
-
@formatter.dump_summary(3,2,1)
|
51
|
-
assert_equal("", @io.string)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|