assert 2.0.0.rc.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. data/Gemfile +1 -1
  2. data/{LICENSE → LICENSE.txt} +0 -0
  3. data/Rakefile +1 -3
  4. data/assert.gemspec +15 -15
  5. data/lib/assert.rb +1 -2
  6. data/lib/assert/assert_runner.rb +2 -1
  7. data/lib/assert/assertions.rb +153 -189
  8. data/lib/assert/version.rb +1 -1
  9. data/test/helper.rb +74 -51
  10. data/test/{fixtures → support}/inherited_stuff.rb +0 -0
  11. data/test/{test → system}/running_tests.rb +16 -43
  12. data/test/{assert_test.rb → unit/assert_tests.rb} +0 -0
  13. data/test/unit/assertions/assert_block_tests.rb +57 -0
  14. data/test/unit/assertions/assert_empty_tests.rb +58 -0
  15. data/test/unit/assertions/assert_equal_tests.rb +59 -0
  16. data/test/unit/assertions/assert_file_exists_tests.rb +59 -0
  17. data/test/unit/assertions/assert_includes_tests.rb +61 -0
  18. data/test/unit/assertions/assert_instance_of_tests.rb +61 -0
  19. data/test/unit/assertions/assert_kind_of_tests.rb +60 -0
  20. data/test/unit/assertions/assert_match_tests.rb +59 -0
  21. data/test/unit/assertions/assert_nil_tests.rb +59 -0
  22. data/test/unit/assertions/assert_raises_tests.rb +73 -0
  23. data/test/unit/assertions/assert_respond_to_tests.rb +63 -0
  24. data/test/unit/assertions/assert_same_tests.rb +65 -0
  25. data/test/unit/assertions_tests.rb +65 -0
  26. data/test/unit/context/basic_singleton_tests.rb +86 -0
  27. data/test/unit/context/setup_teardown_singleton_tests.rb +105 -0
  28. data/test/unit/context/test_should_singleton_tests.rb +134 -0
  29. data/test/{context_test.rb → unit/context_tests.rb} +53 -131
  30. data/test/{macro_test.rb → unit/macro_tests.rb} +15 -11
  31. data/test/{result_test.rb → unit/result_tests.rb} +27 -26
  32. data/test/{runner_test.rb → unit/runner_tests.rb} +1 -2
  33. data/test/{suite_test.rb → unit/suite_tests.rb} +63 -95
  34. data/test/{test_test.rb → unit/test_tests.rb} +45 -77
  35. data/test/{view/base_tests.rb → unit/view_tests.rb} +0 -1
  36. metadata +63 -104
  37. data/CHANGELOG.md +0 -33
  38. data/test/assertions/assert_block_test.rb +0 -39
  39. data/test/assertions/assert_empty_test.rb +0 -43
  40. data/test/assertions/assert_equal_test.rb +0 -43
  41. data/test/assertions/assert_file_exists_test.rb +0 -43
  42. data/test/assertions/assert_includes_test.rb +0 -44
  43. data/test/assertions/assert_instance_of_test.rb +0 -43
  44. data/test/assertions/assert_kind_of_test.rb +0 -43
  45. data/test/assertions/assert_match_test.rb +0 -43
  46. data/test/assertions/assert_nil_test.rb +0 -43
  47. data/test/assertions/assert_not_block_test.rb +0 -39
  48. data/test/assertions/assert_not_empty_test.rb +0 -43
  49. data/test/assertions/assert_not_equal_test.rb +0 -43
  50. data/test/assertions/assert_not_file_exists_test.rb +0 -43
  51. data/test/assertions/assert_not_included_test.rb +0 -44
  52. data/test/assertions/assert_not_instance_of_test.rb +0 -43
  53. data/test/assertions/assert_not_kind_of_test.rb +0 -43
  54. data/test/assertions/assert_not_match_test.rb +0 -43
  55. data/test/assertions/assert_not_nil_test.rb +0 -43
  56. data/test/assertions/assert_not_respond_to_test.rb +0 -43
  57. data/test/assertions/assert_not_same_test.rb +0 -45
  58. data/test/assertions/assert_nothing_raised_test.rb +0 -46
  59. data/test/assertions/assert_raises_test.rb +0 -49
  60. data/test/assertions/assert_respond_to_test.rb +0 -43
  61. data/test/assertions/assert_same_test.rb +0 -45
  62. data/test/assertions_test.rb +0 -60
  63. data/test/context/class_methods_test.rb +0 -531
  64. data/test/fixtures/sample_context.rb +0 -13
  65. data/test/fixtures/test_root/one_test.rb +0 -0
  66. data/test/fixtures/test_root/parent/area_one/area_test.rb +0 -0
  67. data/test/fixtures/test_root/shallow/deeply/nested_test.rb +0 -0
  68. data/test/fixtures/test_root/shallow/nested_test.rb +0 -0
  69. data/test/fixtures/test_root/shallow_test.rb +0 -0
  70. data/test/fixtures/test_root/two_test.rb +0 -0
  71. data/test/suite/context_info_test.rb +0 -42
@@ -1,6 +1,5 @@
1
1
  require 'assert'
2
2
  require 'assert/suite'
3
-
4
3
  require 'assert/view/base'
5
4
  require 'stringio'
6
5
 
metadata CHANGED
@@ -1,15 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: assert
3
3
  version: !ruby/object:Gem::Version
4
- hash: -2762361102
5
- prerelease: 6
4
+ hash: 15
5
+ prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 0
9
9
  - 0
10
- - rc
11
- - 1
12
- version: 2.0.0.rc.1
10
+ version: 2.0.0
13
11
  platform: ruby
14
12
  authors:
15
13
  - Kelly Redding
@@ -18,9 +16,10 @@ autorequire:
18
16
  bindir: bin
19
17
  cert_chain: []
20
18
 
21
- date: 2013-02-16 00:00:00 Z
19
+ date: 2013-02-23 00:00:00 Z
22
20
  dependencies:
23
21
  - !ruby/object:Gem::Dependency
22
+ type: :runtime
24
23
  name: ansi
25
24
  version_requirements: &id001 !ruby/object:Gem::Requirement
26
25
  none: false
@@ -32,7 +31,6 @@ dependencies:
32
31
  - 1
33
32
  - 3
34
33
  version: "1.3"
35
- type: :runtime
36
34
  requirement: *id001
37
35
  prerelease: false
38
36
  description: Test::Unit style testing framework, just better than Test::Unit.
@@ -48,9 +46,8 @@ extra_rdoc_files: []
48
46
  files:
49
47
  - .assert.rb
50
48
  - .gitignore
51
- - CHANGELOG.md
52
49
  - Gemfile
53
- - LICENSE
50
+ - LICENSE.txt
54
51
  - README.md
55
52
  - Rakefile
56
53
  - assert.gemspec
@@ -72,51 +69,33 @@ files:
72
69
  - lib/assert/view/default_view.rb
73
70
  - lib/assert/view/helpers/ansi_styles.rb
74
71
  - lib/assert/view/helpers/common.rb
75
- - test/assert_test.rb
76
- - test/assertions/assert_block_test.rb
77
- - test/assertions/assert_empty_test.rb
78
- - test/assertions/assert_equal_test.rb
79
- - test/assertions/assert_file_exists_test.rb
80
- - test/assertions/assert_includes_test.rb
81
- - test/assertions/assert_instance_of_test.rb
82
- - test/assertions/assert_kind_of_test.rb
83
- - test/assertions/assert_match_test.rb
84
- - test/assertions/assert_nil_test.rb
85
- - test/assertions/assert_not_block_test.rb
86
- - test/assertions/assert_not_empty_test.rb
87
- - test/assertions/assert_not_equal_test.rb
88
- - test/assertions/assert_not_file_exists_test.rb
89
- - test/assertions/assert_not_included_test.rb
90
- - test/assertions/assert_not_instance_of_test.rb
91
- - test/assertions/assert_not_kind_of_test.rb
92
- - test/assertions/assert_not_match_test.rb
93
- - test/assertions/assert_not_nil_test.rb
94
- - test/assertions/assert_not_respond_to_test.rb
95
- - test/assertions/assert_not_same_test.rb
96
- - test/assertions/assert_nothing_raised_test.rb
97
- - test/assertions/assert_raises_test.rb
98
- - test/assertions/assert_respond_to_test.rb
99
- - test/assertions/assert_same_test.rb
100
- - test/assertions_test.rb
101
- - test/context/class_methods_test.rb
102
- - test/context_test.rb
103
- - test/fixtures/inherited_stuff.rb
104
- - test/fixtures/sample_context.rb
105
- - test/fixtures/test_root/one_test.rb
106
- - test/fixtures/test_root/parent/area_one/area_test.rb
107
- - test/fixtures/test_root/shallow/deeply/nested_test.rb
108
- - test/fixtures/test_root/shallow/nested_test.rb
109
- - test/fixtures/test_root/shallow_test.rb
110
- - test/fixtures/test_root/two_test.rb
111
72
  - test/helper.rb
112
- - test/macro_test.rb
113
- - test/result_test.rb
114
- - test/runner_test.rb
115
- - test/suite/context_info_test.rb
116
- - test/suite_test.rb
117
- - test/test/running_tests.rb
118
- - test/test_test.rb
119
- - test/view/base_tests.rb
73
+ - test/support/inherited_stuff.rb
74
+ - test/system/running_tests.rb
75
+ - test/unit/assert_tests.rb
76
+ - test/unit/assertions/assert_block_tests.rb
77
+ - test/unit/assertions/assert_empty_tests.rb
78
+ - test/unit/assertions/assert_equal_tests.rb
79
+ - test/unit/assertions/assert_file_exists_tests.rb
80
+ - test/unit/assertions/assert_includes_tests.rb
81
+ - test/unit/assertions/assert_instance_of_tests.rb
82
+ - test/unit/assertions/assert_kind_of_tests.rb
83
+ - test/unit/assertions/assert_match_tests.rb
84
+ - test/unit/assertions/assert_nil_tests.rb
85
+ - test/unit/assertions/assert_raises_tests.rb
86
+ - test/unit/assertions/assert_respond_to_tests.rb
87
+ - test/unit/assertions/assert_same_tests.rb
88
+ - test/unit/assertions_tests.rb
89
+ - test/unit/context/basic_singleton_tests.rb
90
+ - test/unit/context/setup_teardown_singleton_tests.rb
91
+ - test/unit/context/test_should_singleton_tests.rb
92
+ - test/unit/context_tests.rb
93
+ - test/unit/macro_tests.rb
94
+ - test/unit/result_tests.rb
95
+ - test/unit/runner_tests.rb
96
+ - test/unit/suite_tests.rb
97
+ - test/unit/test_tests.rb
98
+ - test/unit/view_tests.rb
120
99
  homepage: http://github.com/redding/assert
121
100
  licenses: []
122
101
 
@@ -137,64 +116,44 @@ required_ruby_version: !ruby/object:Gem::Requirement
137
116
  required_rubygems_version: !ruby/object:Gem::Requirement
138
117
  none: false
139
118
  requirements:
140
- - - ">"
119
+ - - ">="
141
120
  - !ruby/object:Gem::Version
142
- hash: 25
121
+ hash: 3
143
122
  segments:
144
- - 1
145
- - 3
146
- - 1
147
- version: 1.3.1
123
+ - 0
124
+ version: "0"
148
125
  requirements: []
149
126
 
150
127
  rubyforge_project:
151
- rubygems_version: 1.8.24
128
+ rubygems_version: 1.8.25
152
129
  signing_key:
153
130
  specification_version: 3
154
131
  summary: Test::Unit style testing framework, just better than Test::Unit.
155
132
  test_files:
156
- - test/assert_test.rb
157
- - test/assertions/assert_block_test.rb
158
- - test/assertions/assert_empty_test.rb
159
- - test/assertions/assert_equal_test.rb
160
- - test/assertions/assert_file_exists_test.rb
161
- - test/assertions/assert_includes_test.rb
162
- - test/assertions/assert_instance_of_test.rb
163
- - test/assertions/assert_kind_of_test.rb
164
- - test/assertions/assert_match_test.rb
165
- - test/assertions/assert_nil_test.rb
166
- - test/assertions/assert_not_block_test.rb
167
- - test/assertions/assert_not_empty_test.rb
168
- - test/assertions/assert_not_equal_test.rb
169
- - test/assertions/assert_not_file_exists_test.rb
170
- - test/assertions/assert_not_included_test.rb
171
- - test/assertions/assert_not_instance_of_test.rb
172
- - test/assertions/assert_not_kind_of_test.rb
173
- - test/assertions/assert_not_match_test.rb
174
- - test/assertions/assert_not_nil_test.rb
175
- - test/assertions/assert_not_respond_to_test.rb
176
- - test/assertions/assert_not_same_test.rb
177
- - test/assertions/assert_nothing_raised_test.rb
178
- - test/assertions/assert_raises_test.rb
179
- - test/assertions/assert_respond_to_test.rb
180
- - test/assertions/assert_same_test.rb
181
- - test/assertions_test.rb
182
- - test/context/class_methods_test.rb
183
- - test/context_test.rb
184
- - test/fixtures/inherited_stuff.rb
185
- - test/fixtures/sample_context.rb
186
- - test/fixtures/test_root/one_test.rb
187
- - test/fixtures/test_root/parent/area_one/area_test.rb
188
- - test/fixtures/test_root/shallow/deeply/nested_test.rb
189
- - test/fixtures/test_root/shallow/nested_test.rb
190
- - test/fixtures/test_root/shallow_test.rb
191
- - test/fixtures/test_root/two_test.rb
192
133
  - test/helper.rb
193
- - test/macro_test.rb
194
- - test/result_test.rb
195
- - test/runner_test.rb
196
- - test/suite/context_info_test.rb
197
- - test/suite_test.rb
198
- - test/test/running_tests.rb
199
- - test/test_test.rb
200
- - test/view/base_tests.rb
134
+ - test/support/inherited_stuff.rb
135
+ - test/system/running_tests.rb
136
+ - test/unit/assert_tests.rb
137
+ - test/unit/assertions/assert_block_tests.rb
138
+ - test/unit/assertions/assert_empty_tests.rb
139
+ - test/unit/assertions/assert_equal_tests.rb
140
+ - test/unit/assertions/assert_file_exists_tests.rb
141
+ - test/unit/assertions/assert_includes_tests.rb
142
+ - test/unit/assertions/assert_instance_of_tests.rb
143
+ - test/unit/assertions/assert_kind_of_tests.rb
144
+ - test/unit/assertions/assert_match_tests.rb
145
+ - test/unit/assertions/assert_nil_tests.rb
146
+ - test/unit/assertions/assert_raises_tests.rb
147
+ - test/unit/assertions/assert_respond_to_tests.rb
148
+ - test/unit/assertions/assert_same_tests.rb
149
+ - test/unit/assertions_tests.rb
150
+ - test/unit/context/basic_singleton_tests.rb
151
+ - test/unit/context/setup_teardown_singleton_tests.rb
152
+ - test/unit/context/test_should_singleton_tests.rb
153
+ - test/unit/context_tests.rb
154
+ - test/unit/macro_tests.rb
155
+ - test/unit/result_tests.rb
156
+ - test/unit/runner_tests.rb
157
+ - test/unit/suite_tests.rb
158
+ - test/unit/test_tests.rb
159
+ - test/unit/view_tests.rb
@@ -1,33 +0,0 @@
1
- ## Assert Changes
2
-
3
- ### v0.8.x
4
- * added more succinct `have_imeth` and `have_cmeth` macro methods
5
- * deprecated assert-view sister repo
6
- * `DefaultView` now provided by assert directly
7
- * views render by defining callbacks that are fired by the runner
8
- * added in the corresponding `not_*` method macros (#87)
9
- * added in aliases for `assert_responds_to` assertion helpers (#86)
10
- * added in `assert_file_exists` assertion helpers (#85)
11
- * allows test files ending in `_tests.rb` to be recognized by rake task generator
12
- * `DefaultView` syncs its io output
13
- * README enhanced; added docs for view rendering and customization
14
-
15
- ### v0.7.x
16
- * tests know context info (klass, called_from, file) (#62)
17
- * suites track tests ungrouped
18
- * fixed issue where method macros display incorrect fail traces
19
- * fixed bug where 'assert_raises' and 'assert_nothing_raised' generate fail messages with trailing newlines
20
- * default halt on failed assertions (#68)
21
- * fixed for setup error when no $HOME env var (#76)
22
- * changelog tracking (#79)
23
- * removed past tense from Result model #to_sym (#75)
24
- * showing exception class in Error result message (#64)
25
- * don't show verbose loading statement when running rake tasks (#72)
26
- * forced loading rubygems when running rake tasks (#65)
27
- * removed warning if no test/helper present (#66)
28
- * fix to not load helpers twice (#67)
29
- * overhaul to how the rake tasks are generated and handled (#69)
30
- * added name attr to Result model (#61)
31
-
32
- ### v0.6.x
33
- * everything prior to changelog tracking...
@@ -1,39 +0,0 @@
1
- require 'assert'
2
-
3
- class Assert::Assertions::AssertBlockTest < Assert::Context
4
- desc "the assert_block helper run in a test"
5
- setup do
6
- fail_desc = @fail_desc = "assert block fail desc"
7
- @test = Factory.test do
8
- assert_block{ true }
9
- assert_block(fail_desc){ false }
10
- end
11
- @test.run
12
- end
13
- subject{ @test }
14
-
15
- should "have 2 total results" do
16
- assert_equal 2, subject.result_count
17
- end
18
- should "have 1 pass result" do
19
- assert_equal 1, subject.result_count(:pass)
20
- end
21
- should "have 1 fail result" do
22
- assert_equal 1, subject.result_count(:fail)
23
- end
24
-
25
- class FailMessageTest < AssertBlockTest
26
- desc "with a failed result"
27
- setup do
28
- @expected = [@fail_desc, "Expected block to return true value."].join("\n")
29
- @fail_message = @test.fail_results.first.message
30
- end
31
- subject{ @fail_message }
32
-
33
- should "have a fail message with an explanation of what failed and my fail description" do
34
- assert_equal @expected, subject
35
- end
36
-
37
- end
38
-
39
- end
@@ -1,43 +0,0 @@
1
- require 'assert'
2
-
3
- class Assert::Assertions::AssertEmptyTest < Assert::Context
4
- desc "the assert_empty helper run in a test"
5
- setup do
6
- fail_desc = @fail_desc = "assert empty fail desc"
7
- fail_args = @fail_args = [ [ 1 ], fail_desc ]
8
- @test = Factory.test do
9
- assert_empty([]) # pass
10
- assert_empty(*fail_args) # fail
11
- end
12
- @test.run
13
- end
14
- subject{ @test }
15
-
16
- should "have 2 total results" do
17
- assert_equal 2, subject.result_count
18
- end
19
- should "have 1 pass result" do
20
- assert_equal 1, subject.result_count(:pass)
21
- end
22
- should "have 1 fail result" do
23
- assert_equal 1, subject.result_count(:fail)
24
- end
25
-
26
- class FailMessageTest < AssertEmptyTest
27
- desc "with a failed result"
28
- setup do
29
- @expected = [
30
- @fail_args[1],
31
- "Expected #{@fail_args[0].inspect} to be empty."
32
- ].join("\n")
33
- @fail_message = @test.fail_results.first.message
34
- end
35
- subject{ @fail_message }
36
-
37
- should "have a fail message with an explanation of what failed and my fail description" do
38
- assert_equal @expected, subject
39
- end
40
-
41
- end
42
-
43
- end
@@ -1,43 +0,0 @@
1
- require 'assert'
2
-
3
- class Assert::Assertions::AssertEqualTest < Assert::Context
4
- desc "the assert_equal helper run in a test"
5
- setup do
6
- fail_desc = @fail_desc = "assert equal fail desc"
7
- fail_args = @fail_args = [ 1, 2, fail_desc ]
8
- @test = Factory.test do
9
- assert_equal(1, 1) # pass
10
- assert_equal(*fail_args) # fail
11
- end
12
- @test.run
13
- end
14
- subject{ @test }
15
-
16
- should "have 2 total results" do
17
- assert_equal 2, subject.result_count
18
- end
19
- should "have 1 pass result" do
20
- assert_equal 1, subject.result_count(:pass)
21
- end
22
- should "have 1 fail result" do
23
- assert_equal 1, subject.result_count(:fail)
24
- end
25
-
26
- class FailMessageTest < AssertEqualTest
27
- desc "with a failed result"
28
- setup do
29
- @expected = [
30
- @fail_args[2],
31
- "Expected #{@fail_args[0]}, not #{@fail_args[1]}."
32
- ].join("\n")
33
- @fail_message = @test.fail_results.first.message
34
- end
35
- subject{ @fail_message }
36
-
37
- should "have a fail message with an explanation of what failed and my fail description" do
38
- assert_equal @expected, subject
39
- end
40
-
41
- end
42
-
43
- end
@@ -1,43 +0,0 @@
1
- require 'assert'
2
-
3
- class Assert::Assertions::AssertFileExistsTests < Assert::Context
4
- desc "the assert_file_exists helper run in a test"
5
- setup do
6
- fail_desc = @fail_desc = "assert file exists empty fail desc"
7
- fail_args = @fail_args = [ '/a/path/to/some/file/that/no/exists', fail_desc ]
8
- @test = Factory.test do
9
- assert_file_exists(__FILE__) # pass
10
- assert_file_exists(*fail_args) # fail
11
- end
12
- @test.run
13
- end
14
- subject{ @test }
15
-
16
- should "have 2 total results" do
17
- assert_equal 2, subject.result_count
18
- end
19
- should "have 1 pass result" do
20
- assert_equal 1, subject.result_count(:pass)
21
- end
22
- should "have 1 fail result" do
23
- assert_equal 1, subject.result_count(:fail)
24
- end
25
-
26
- class FailMessageTest < AssertFileExistsTests
27
- desc "with a failed result"
28
- setup do
29
- @expected = [
30
- @fail_args[1],
31
- "Expected #{@fail_args[0].inspect} to exist."
32
- ].join("\n")
33
- @fail_message = @test.fail_results.first.message
34
- end
35
- subject{ @fail_message }
36
-
37
- should "have a fail message with an explanation of what failed and my fail description" do
38
- assert_equal @expected, subject
39
- end
40
-
41
- end
42
-
43
- end
@@ -1,44 +0,0 @@
1
- require 'assert'
2
-
3
- class Assert::Assertions::AssertIncludes < Assert::Context
4
- desc "the assert_includes helper run in a test"
5
- setup do
6
-
7
- fail_desc = @fail_desc = "assert includes fail desc"
8
- fail_args = @fail_args = [ 2, [ 1 ], fail_desc ]
9
- @test = Factory.test do
10
- assert_includes(1, [ 1 ]) # pass
11
- assert_includes(*fail_args) # fail
12
- end
13
- @test.run
14
- end
15
- subject{ @test }
16
-
17
- should "have 2 total results" do
18
- assert_equal 2, subject.result_count
19
- end
20
- should "have 1 pass result" do
21
- assert_equal 1, subject.result_count(:pass)
22
- end
23
- should "have 1 fail result" do
24
- assert_equal 1, subject.result_count(:fail)
25
- end
26
-
27
- class FailMessageTest < AssertIncludes
28
- desc "with a failed result"
29
- setup do
30
- @expected = [
31
- @fail_args[2],
32
- "Expected #{@fail_args[1].inspect} to include #{@fail_args[0].inspect}."
33
- ].join("\n")
34
- @fail_message = @test.fail_results.first.message
35
- end
36
- subject{ @fail_message }
37
-
38
- should "have a fail message with an explanation of what failed and my fail description" do
39
- assert_equal @expected, subject
40
- end
41
-
42
- end
43
-
44
- end