assert 2.16.5 → 2.17.0

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.
Files changed (72) hide show
  1. checksums.yaml +7 -7
  2. data/Gemfile +3 -1
  3. data/README.md +20 -20
  4. data/assert.gemspec +5 -3
  5. data/bin/assert +4 -4
  6. data/lib/assert.rb +8 -8
  7. data/lib/assert/assert_runner.rb +7 -7
  8. data/lib/assert/assertions.rb +5 -5
  9. data/lib/assert/cli.rb +35 -35
  10. data/lib/assert/config.rb +8 -8
  11. data/lib/assert/config_helpers.rb +6 -6
  12. data/lib/assert/context.rb +17 -17
  13. data/lib/assert/context/test_dsl.rb +5 -5
  14. data/lib/assert/context_info.rb +2 -2
  15. data/lib/assert/default_runner.rb +1 -1
  16. data/lib/assert/default_suite.rb +1 -1
  17. data/lib/assert/default_view.rb +8 -8
  18. data/lib/assert/factory.rb +1 -1
  19. data/lib/assert/macro.rb +1 -1
  20. data/lib/assert/macros/methods.rb +1 -1
  21. data/lib/assert/result.rb +17 -17
  22. data/lib/assert/runner.rb +12 -8
  23. data/lib/assert/stub.rb +1 -1
  24. data/lib/assert/suite.rb +3 -3
  25. data/lib/assert/test.rb +11 -11
  26. data/lib/assert/utils.rb +8 -8
  27. data/lib/assert/version.rb +1 -1
  28. data/lib/assert/view.rb +19 -19
  29. data/lib/assert/view_helpers.rb +6 -6
  30. data/test/helper.rb +2 -11
  31. data/test/support/factory.rb +6 -6
  32. data/test/system/stub_tests.rb +204 -204
  33. data/test/system/test_tests.rb +13 -13
  34. data/test/unit/assert_tests.rb +9 -9
  35. data/test/unit/assertions/assert_block_tests.rb +2 -2
  36. data/test/unit/assertions/assert_empty_tests.rb +6 -6
  37. data/test/unit/assertions/assert_equal_tests.rb +5 -5
  38. data/test/unit/assertions/assert_file_exists_tests.rb +6 -6
  39. data/test/unit/assertions/assert_includes_tests.rb +7 -7
  40. data/test/unit/assertions/assert_instance_of_tests.rb +5 -5
  41. data/test/unit/assertions/assert_kind_of_tests.rb +5 -5
  42. data/test/unit/assertions/assert_match_tests.rb +5 -5
  43. data/test/unit/assertions/assert_nil_tests.rb +5 -5
  44. data/test/unit/assertions/assert_raises_tests.rb +2 -2
  45. data/test/unit/assertions/assert_respond_to_tests.rb +5 -5
  46. data/test/unit/assertions/assert_same_tests.rb +13 -13
  47. data/test/unit/assertions/assert_true_false_tests.rb +7 -7
  48. data/test/unit/assertions_tests.rb +2 -2
  49. data/test/unit/config_helpers_tests.rb +5 -5
  50. data/test/unit/config_tests.rb +12 -12
  51. data/test/unit/context/setup_dsl_tests.rb +7 -7
  52. data/test/unit/context/subject_dsl_tests.rb +3 -3
  53. data/test/unit/context/suite_dsl_tests.rb +3 -3
  54. data/test/unit/context/test_dsl_tests.rb +8 -8
  55. data/test/unit/context_info_tests.rb +6 -6
  56. data/test/unit/context_tests.rb +16 -16
  57. data/test/unit/default_runner_tests.rb +3 -3
  58. data/test/unit/default_suite_tests.rb +3 -3
  59. data/test/unit/factory_tests.rb +3 -3
  60. data/test/unit/file_line_tests.rb +12 -12
  61. data/test/unit/macro_tests.rb +2 -2
  62. data/test/unit/result_tests.rb +18 -18
  63. data/test/unit/runner_tests.rb +9 -9
  64. data/test/unit/suite_tests.rb +5 -5
  65. data/test/unit/test_tests.rb +19 -19
  66. data/test/unit/utils_tests.rb +18 -18
  67. data/test/unit/view_helpers_tests.rb +15 -15
  68. data/test/unit/view_tests.rb +11 -11
  69. data/tmp/.gitkeep +0 -0
  70. metadata +46 -44
  71. data/.assert.rb +0 -3
  72. data/.gitignore +0 -19
@@ -1,3 +1,3 @@
1
1
  module Assert
2
- VERSION = "2.16.5"
2
+ VERSION = "2.17.0"
3
3
  end
@@ -1,7 +1,7 @@
1
- require 'assert/config'
2
- require 'assert/config_helpers'
3
- require 'assert/suite'
4
- require 'assert/view_helpers'
1
+ require "assert/config"
2
+ require "assert/config_helpers"
3
+ require "assert/suite"
4
+ require "assert/view_helpers"
5
5
 
6
6
  module Assert
7
7
 
@@ -15,12 +15,12 @@ module Assert
15
15
 
16
16
  def self.require_user_view(view_name)
17
17
  views_file = File.expand_path(
18
- File.join("#{ENV['HOME']}/.assert/views", view_name, 'lib', view_name)
18
+ File.join("#{ENV["HOME"]}/.assert/views", view_name, "lib", view_name)
19
19
  )
20
20
 
21
- if File.exists?(view_name) || File.exists?(view_name + '.rb')
21
+ if File.exists?(view_name) || File.exists?(view_name + ".rb")
22
22
  require view_name
23
- elsif File.exists?(views_file + '.rb')
23
+ elsif File.exists?(views_file + ".rb")
24
24
  require views_file
25
25
  else
26
26
  msg = "[WARN] Can't find or require #{view_name.inspect} view."
@@ -31,18 +31,18 @@ module Assert
31
31
 
32
32
  # setup options and their default values
33
33
 
34
- option 'styled', false
35
- option 'pass_styles' # none
36
- option 'fail_styles' # none
37
- option 'error_styles' # none
38
- option 'skip_styles' # none
39
- option 'ignore_styles' # none
40
-
41
- option 'pass_abbrev', '.'
42
- option 'fail_abbrev', 'F'
43
- option 'ignore_abbrev', 'I'
44
- option 'skip_abbrev', 'S'
45
- option 'error_abbrev', 'E'
34
+ option "styled", false
35
+ option "pass_styles" # none
36
+ option "fail_styles" # none
37
+ option "error_styles" # none
38
+ option "skip_styles" # none
39
+ option "ignore_styles" # none
40
+
41
+ option "pass_abbrev", "."
42
+ option "fail_abbrev", "F"
43
+ option "ignore_abbrev", "I"
44
+ option "skip_abbrev", "S"
45
+ option "error_abbrev", "E"
46
46
 
47
47
  attr_reader :config
48
48
 
@@ -1,4 +1,4 @@
1
- require 'assert/config_helpers'
1
+ require "assert/config_helpers"
2
2
 
3
3
  module Assert
4
4
 
@@ -37,21 +37,21 @@ module Assert
37
37
 
38
38
  # show any captured output
39
39
  def re_run_test_cmd(test_id)
40
- "assert -t #{test_id.gsub(Dir.pwd, '.')}"
40
+ "assert -t #{test_id.gsub(Dir.pwd, ".")}"
41
41
  end
42
42
 
43
43
  def tests_to_run_count_statement
44
- "#{self.tests_to_run_count} test#{'s' if self.tests_to_run_count != 1}"
44
+ "#{self.tests_to_run_count} test#{"s" if self.tests_to_run_count != 1}"
45
45
  end
46
46
 
47
47
  def result_count_statement
48
- "#{self.result_count} result#{'s' if self.result_count != 1}"
48
+ "#{self.result_count} result#{"s" if self.result_count != 1}"
49
49
  end
50
50
 
51
51
  # generate a comma-seperated sentence fragment given a list of items
52
52
  def to_sentence(items)
53
53
  if items.size <= 2
54
- items.join(items.size == 2 ? ' and ' : '')
54
+ items.join(items.size == 2 ? " and " : "")
55
55
  else
56
56
  [items[0..-2].join(", "), items.last].join(", and ")
57
57
  end
@@ -173,7 +173,7 @@ module Assert
173
173
  }
174
174
 
175
175
  def self.code_for(*style_names)
176
- style_names.map{ |n| "\e[#{CODES[n]}m" if CODES.key?(n) }.compact.join('')
176
+ style_names.map{ |n| "\e[#{CODES[n]}m" if CODES.key?(n) }.compact.join("")
177
177
  end
178
178
 
179
179
  def ansi_styled_msg(msg, result_type)
@@ -6,17 +6,8 @@ ROOT_PATH = File.expand_path("../..", __FILE__)
6
6
  $LOAD_PATH.unshift(ROOT_PATH)
7
7
 
8
8
  # require pry for debugging (`binding.pry`)
9
- require 'pry'
10
- require 'test/support/factory'
11
-
12
- # 1.8.7 backfills
13
-
14
- # Array#sample
15
- if !(a = Array.new).respond_to?(:sample) && a.respond_to?(:choice)
16
- class Array
17
- alias_method :sample, :choice
18
- end
19
- end
9
+ require "pry"
10
+ require "test/support/factory"
20
11
 
21
12
  class Assert::Test
22
13
 
@@ -1,8 +1,8 @@
1
- require 'assert/config'
2
- require 'assert/default_suite'
3
- require 'assert/factory'
4
- require 'assert/result'
5
- require 'assert/test'
1
+ require "assert/config"
2
+ require "assert/default_suite"
3
+ require "assert/factory"
4
+ require "assert/result"
5
+ require "assert/test"
6
6
 
7
7
  module Factory
8
8
  extend Assert::Factory
@@ -35,7 +35,7 @@ module Factory
35
35
  config, context_info, name = [
36
36
  args.last.kind_of?(Assert::Config) ? args.pop : self.modes_off_config,
37
37
  args.last.kind_of?(Assert::ContextInfo) ? args.pop : self.context_info,
38
- args.last.kind_of?(::String) ? args.pop : 'a test'
38
+ args.last.kind_of?(::String) ? args.pop : "a test"
39
39
  ]
40
40
  Assert::Test.for_block(name, context_info, config, &block)
41
41
  end
@@ -1,5 +1,5 @@
1
- require 'assert'
2
- require 'assert/stub'
1
+ require "assert"
2
+ require "assert/stub"
3
3
 
4
4
  class Assert::Stub
5
5
 
@@ -12,48 +12,48 @@ class Assert::Stub
12
12
  desc "for instance methods"
13
13
  setup do
14
14
  @instance = TestClass.new
15
- Assert.stub(@instance, :noargs){ 'default' }
16
- Assert.stub(@instance, :noargs).with{ 'none' }
15
+ Assert.stub(@instance, :noargs){ "default" }
16
+ Assert.stub(@instance, :noargs).with{ "none" }
17
17
 
18
- Assert.stub(@instance, :withargs){ 'default' }
19
- Assert.stub(@instance, :withargs).with(1){ 'one' }
18
+ Assert.stub(@instance, :withargs){ "default" }
19
+ Assert.stub(@instance, :withargs).with(1){ "one" }
20
20
 
21
- Assert.stub(@instance, :anyargs){ 'default' }
22
- Assert.stub(@instance, :anyargs).with(1, 2){ 'one-two' }
21
+ Assert.stub(@instance, :anyargs){ "default" }
22
+ Assert.stub(@instance, :anyargs).with(1, 2){ "one-two" }
23
23
 
24
- Assert.stub(@instance, :minargs){ 'default' }
25
- Assert.stub(@instance, :minargs).with(1, 2){ 'one-two' }
26
- Assert.stub(@instance, :minargs).with(1, 2, 3){ 'one-two-three' }
24
+ Assert.stub(@instance, :minargs){ "default" }
25
+ Assert.stub(@instance, :minargs).with(1, 2){ "one-two" }
26
+ Assert.stub(@instance, :minargs).with(1, 2, 3){ "one-two-three" }
27
27
 
28
- Assert.stub(@instance, :withblock){ 'default' }
28
+ Assert.stub(@instance, :withblock){ "default" }
29
29
  end
30
30
  subject{ @instance }
31
31
 
32
32
  should "allow stubbing a method that doesn't take args" do
33
- assert_equal 'none', subject.noargs
33
+ assert_equal "none", subject.noargs
34
34
  end
35
35
 
36
36
  should "allow stubbing a method that takes args" do
37
- assert_equal 'one', subject.withargs(1)
38
- assert_equal 'default', subject.withargs(2)
37
+ assert_equal "one", subject.withargs(1)
38
+ assert_equal "default", subject.withargs(2)
39
39
  end
40
40
 
41
41
  should "allow stubbing a method that takes any args" do
42
- assert_equal 'default', subject.anyargs
43
- assert_equal 'default', subject.anyargs(1)
44
- assert_equal 'one-two', subject.anyargs(1, 2)
42
+ assert_equal "default", subject.anyargs
43
+ assert_equal "default", subject.anyargs(1)
44
+ assert_equal "one-two", subject.anyargs(1, 2)
45
45
  end
46
46
 
47
47
  should "allow stubbing a method that takes a minimum number of args" do
48
- assert_equal 'one-two', subject.minargs(1, 2)
49
- assert_equal 'one-two-three', subject.minargs(1, 2, 3)
50
- assert_equal 'default', subject.minargs(1, 2, 4)
51
- assert_equal 'default', subject.minargs(1, 2, 3, 4)
48
+ assert_equal "one-two", subject.minargs(1, 2)
49
+ assert_equal "one-two-three", subject.minargs(1, 2, 3)
50
+ assert_equal "default", subject.minargs(1, 2, 4)
51
+ assert_equal "default", subject.minargs(1, 2, 3, 4)
52
52
  end
53
53
 
54
54
  should "allow stubbing a method that takes a block" do
55
- assert_equal 'default', subject.withblock
56
- assert_equal 'default', subject.withblock{ 'my-block' }
55
+ assert_equal "default", subject.withblock
56
+ assert_equal "default", subject.withblock{ "my-block" }
57
57
  end
58
58
 
59
59
  should "not allow stubbing methods with invalid arity" do
@@ -86,48 +86,48 @@ class Assert::Stub
86
86
  desc "for singleton methods on a class"
87
87
  setup do
88
88
  @class = TestClass
89
- Assert.stub(@class, :noargs){ 'default' }
90
- Assert.stub(@class, :noargs).with{ 'none' }
89
+ Assert.stub(@class, :noargs){ "default" }
90
+ Assert.stub(@class, :noargs).with{ "none" }
91
91
 
92
- Assert.stub(@class, :withargs){ 'default' }
93
- Assert.stub(@class, :withargs).with(1){ 'one' }
92
+ Assert.stub(@class, :withargs){ "default" }
93
+ Assert.stub(@class, :withargs).with(1){ "one" }
94
94
 
95
- Assert.stub(@class, :anyargs){ 'default' }
96
- Assert.stub(@class, :anyargs).with(1, 2){ 'one-two' }
95
+ Assert.stub(@class, :anyargs){ "default" }
96
+ Assert.stub(@class, :anyargs).with(1, 2){ "one-two" }
97
97
 
98
- Assert.stub(@class, :minargs){ 'default' }
99
- Assert.stub(@class, :minargs).with(1, 2){ 'one-two' }
100
- Assert.stub(@class, :minargs).with(1, 2, 3){ 'one-two-three' }
98
+ Assert.stub(@class, :minargs){ "default" }
99
+ Assert.stub(@class, :minargs).with(1, 2){ "one-two" }
100
+ Assert.stub(@class, :minargs).with(1, 2, 3){ "one-two-three" }
101
101
 
102
- Assert.stub(@class, :withblock){ 'default' }
102
+ Assert.stub(@class, :withblock){ "default" }
103
103
  end
104
104
  subject{ @class }
105
105
 
106
106
  should "allow stubbing a method that doesn't take args" do
107
- assert_equal 'none', subject.noargs
107
+ assert_equal "none", subject.noargs
108
108
  end
109
109
 
110
110
  should "allow stubbing a method that takes args" do
111
- assert_equal 'one', subject.withargs(1)
112
- assert_equal 'default', subject.withargs(2)
111
+ assert_equal "one", subject.withargs(1)
112
+ assert_equal "default", subject.withargs(2)
113
113
  end
114
114
 
115
115
  should "allow stubbing a method that takes any args" do
116
- assert_equal 'default', subject.anyargs
117
- assert_equal 'default', subject.anyargs(1)
118
- assert_equal 'one-two', subject.anyargs(1, 2)
116
+ assert_equal "default", subject.anyargs
117
+ assert_equal "default", subject.anyargs(1)
118
+ assert_equal "one-two", subject.anyargs(1, 2)
119
119
  end
120
120
 
121
121
  should "allow stubbing a method that takes a minimum number of args" do
122
- assert_equal 'one-two', subject.minargs(1, 2)
123
- assert_equal 'one-two-three', subject.minargs(1, 2, 3)
124
- assert_equal 'default', subject.minargs(1, 2, 4)
125
- assert_equal 'default', subject.minargs(1, 2, 3, 4)
122
+ assert_equal "one-two", subject.minargs(1, 2)
123
+ assert_equal "one-two-three", subject.minargs(1, 2, 3)
124
+ assert_equal "default", subject.minargs(1, 2, 4)
125
+ assert_equal "default", subject.minargs(1, 2, 3, 4)
126
126
  end
127
127
 
128
128
  should "allow stubbing a method that takes a block" do
129
- assert_equal 'default', subject.withblock
130
- assert_equal 'default', subject.withblock{ 'my-block' }
129
+ assert_equal "default", subject.withblock
130
+ assert_equal "default", subject.withblock{ "my-block" }
131
131
  end
132
132
 
133
133
  should "not allow stubbing methods with invalid arity" do
@@ -160,48 +160,48 @@ class Assert::Stub
160
160
  desc "for singleton methods on a module"
161
161
  setup do
162
162
  @module = TestModule
163
- Assert.stub(@module, :noargs){ 'default' }
164
- Assert.stub(@module, :noargs).with{ 'none' }
163
+ Assert.stub(@module, :noargs){ "default" }
164
+ Assert.stub(@module, :noargs).with{ "none" }
165
165
 
166
- Assert.stub(@module, :withargs){ 'default' }
167
- Assert.stub(@module, :withargs).with(1){ 'one' }
166
+ Assert.stub(@module, :withargs){ "default" }
167
+ Assert.stub(@module, :withargs).with(1){ "one" }
168
168
 
169
- Assert.stub(@module, :anyargs){ 'default' }
170
- Assert.stub(@module, :anyargs).with(1, 2){ 'one-two' }
169
+ Assert.stub(@module, :anyargs){ "default" }
170
+ Assert.stub(@module, :anyargs).with(1, 2){ "one-two" }
171
171
 
172
- Assert.stub(@module, :minargs){ 'default' }
173
- Assert.stub(@module, :minargs).with(1, 2){ 'one-two' }
174
- Assert.stub(@module, :minargs).with(1, 2, 3){ 'one-two-three' }
172
+ Assert.stub(@module, :minargs){ "default" }
173
+ Assert.stub(@module, :minargs).with(1, 2){ "one-two" }
174
+ Assert.stub(@module, :minargs).with(1, 2, 3){ "one-two-three" }
175
175
 
176
- Assert.stub(@module, :withblock){ 'default' }
176
+ Assert.stub(@module, :withblock){ "default" }
177
177
  end
178
178
  subject{ @module }
179
179
 
180
180
  should "allow stubbing a method that doesn't take args" do
181
- assert_equal 'none', subject.noargs
181
+ assert_equal "none", subject.noargs
182
182
  end
183
183
 
184
184
  should "allow stubbing a method that takes args" do
185
- assert_equal 'one', subject.withargs(1)
186
- assert_equal 'default', subject.withargs(2)
185
+ assert_equal "one", subject.withargs(1)
186
+ assert_equal "default", subject.withargs(2)
187
187
  end
188
188
 
189
189
  should "allow stubbing a method that takes any args" do
190
- assert_equal 'default', subject.anyargs
191
- assert_equal 'default', subject.anyargs(1)
192
- assert_equal 'one-two', subject.anyargs(1, 2)
190
+ assert_equal "default", subject.anyargs
191
+ assert_equal "default", subject.anyargs(1)
192
+ assert_equal "one-two", subject.anyargs(1, 2)
193
193
  end
194
194
 
195
195
  should "allow stubbing a method that takes a minimum number of args" do
196
- assert_equal 'one-two', subject.minargs(1, 2)
197
- assert_equal 'one-two-three', subject.minargs(1, 2, 3)
198
- assert_equal 'default', subject.minargs(1, 2, 4)
199
- assert_equal 'default', subject.minargs(1, 2, 3, 4)
196
+ assert_equal "one-two", subject.minargs(1, 2)
197
+ assert_equal "one-two-three", subject.minargs(1, 2, 3)
198
+ assert_equal "default", subject.minargs(1, 2, 4)
199
+ assert_equal "default", subject.minargs(1, 2, 3, 4)
200
200
  end
201
201
 
202
202
  should "allow stubbing a method that takes a block" do
203
- assert_equal 'default', subject.withblock
204
- assert_equal 'default', subject.withblock{ 'my-block' }
203
+ assert_equal "default", subject.withblock
204
+ assert_equal "default", subject.withblock{ "my-block" }
205
205
  end
206
206
 
207
207
  should "not allow stubbing methods with invalid arity" do
@@ -234,48 +234,48 @@ class Assert::Stub
234
234
  desc "for extended methods"
235
235
  setup do
236
236
  @class = Class.new{ extend TestMixin }
237
- Assert.stub(@class, :noargs){ 'default' }
238
- Assert.stub(@class, :noargs).with{ 'none' }
237
+ Assert.stub(@class, :noargs){ "default" }
238
+ Assert.stub(@class, :noargs).with{ "none" }
239
239
 
240
- Assert.stub(@class, :withargs){ 'default' }
241
- Assert.stub(@class, :withargs).with(1){ 'one' }
240
+ Assert.stub(@class, :withargs){ "default" }
241
+ Assert.stub(@class, :withargs).with(1){ "one" }
242
242
 
243
- Assert.stub(@class, :anyargs){ 'default' }
244
- Assert.stub(@class, :anyargs).with(1, 2){ 'one-two' }
243
+ Assert.stub(@class, :anyargs){ "default" }
244
+ Assert.stub(@class, :anyargs).with(1, 2){ "one-two" }
245
245
 
246
- Assert.stub(@class, :minargs){ 'default' }
247
- Assert.stub(@class, :minargs).with(1, 2){ 'one-two' }
248
- Assert.stub(@class, :minargs).with(1, 2, 3){ 'one-two-three' }
246
+ Assert.stub(@class, :minargs){ "default" }
247
+ Assert.stub(@class, :minargs).with(1, 2){ "one-two" }
248
+ Assert.stub(@class, :minargs).with(1, 2, 3){ "one-two-three" }
249
249
 
250
- Assert.stub(@class, :withblock){ 'default' }
250
+ Assert.stub(@class, :withblock){ "default" }
251
251
  end
252
252
  subject{ @class }
253
253
 
254
254
  should "allow stubbing a method that doesn't take args" do
255
- assert_equal 'none', subject.noargs
255
+ assert_equal "none", subject.noargs
256
256
  end
257
257
 
258
258
  should "allow stubbing a method that takes args" do
259
- assert_equal 'one', subject.withargs(1)
260
- assert_equal 'default', subject.withargs(2)
259
+ assert_equal "one", subject.withargs(1)
260
+ assert_equal "default", subject.withargs(2)
261
261
  end
262
262
 
263
263
  should "allow stubbing a method that takes any args" do
264
- assert_equal 'default', subject.anyargs
265
- assert_equal 'default', subject.anyargs(1)
266
- assert_equal 'one-two', subject.anyargs(1, 2)
264
+ assert_equal "default", subject.anyargs
265
+ assert_equal "default", subject.anyargs(1)
266
+ assert_equal "one-two", subject.anyargs(1, 2)
267
267
  end
268
268
 
269
269
  should "allow stubbing a method that takes a minimum number of args" do
270
- assert_equal 'one-two', subject.minargs(1, 2)
271
- assert_equal 'one-two-three', subject.minargs(1, 2, 3)
272
- assert_equal 'default', subject.minargs(1, 2, 4)
273
- assert_equal 'default', subject.minargs(1, 2, 3, 4)
270
+ assert_equal "one-two", subject.minargs(1, 2)
271
+ assert_equal "one-two-three", subject.minargs(1, 2, 3)
272
+ assert_equal "default", subject.minargs(1, 2, 4)
273
+ assert_equal "default", subject.minargs(1, 2, 3, 4)
274
274
  end
275
275
 
276
276
  should "allow stubbing a method that takes a block" do
277
- assert_equal 'default', subject.withblock
278
- assert_equal 'default', subject.withblock{ 'my-block' }
277
+ assert_equal "default", subject.withblock
278
+ assert_equal "default", subject.withblock{ "my-block" }
279
279
  end
280
280
 
281
281
  should "not allow stubbing methods with invalid arity" do
@@ -309,48 +309,48 @@ class Assert::Stub
309
309
  setup do
310
310
  @class = Class.new{ include TestMixin }
311
311
  @instance = @class.new
312
- Assert.stub(@instance, :noargs){ 'default' }
313
- Assert.stub(@instance, :noargs).with{ 'none' }
312
+ Assert.stub(@instance, :noargs){ "default" }
313
+ Assert.stub(@instance, :noargs).with{ "none" }
314
314
 
315
- Assert.stub(@instance, :withargs){ 'default' }
316
- Assert.stub(@instance, :withargs).with(1){ 'one' }
315
+ Assert.stub(@instance, :withargs){ "default" }
316
+ Assert.stub(@instance, :withargs).with(1){ "one" }
317
317
 
318
- Assert.stub(@instance, :anyargs){ 'default' }
319
- Assert.stub(@instance, :anyargs).with(1, 2){ 'one-two' }
318
+ Assert.stub(@instance, :anyargs){ "default" }
319
+ Assert.stub(@instance, :anyargs).with(1, 2){ "one-two" }
320
320
 
321
- Assert.stub(@instance, :minargs){ 'default' }
322
- Assert.stub(@instance, :minargs).with(1, 2){ 'one-two' }
323
- Assert.stub(@instance, :minargs).with(1, 2, 3){ 'one-two-three' }
321
+ Assert.stub(@instance, :minargs){ "default" }
322
+ Assert.stub(@instance, :minargs).with(1, 2){ "one-two" }
323
+ Assert.stub(@instance, :minargs).with(1, 2, 3){ "one-two-three" }
324
324
 
325
- Assert.stub(@instance, :withblock){ 'default' }
325
+ Assert.stub(@instance, :withblock){ "default" }
326
326
  end
327
327
  subject{ @instance }
328
328
 
329
329
  should "allow stubbing a method that doesn't take args" do
330
- assert_equal 'none', subject.noargs
330
+ assert_equal "none", subject.noargs
331
331
  end
332
332
 
333
333
  should "allow stubbing a method that takes args" do
334
- assert_equal 'one', subject.withargs(1)
335
- assert_equal 'default', subject.withargs(2)
334
+ assert_equal "one", subject.withargs(1)
335
+ assert_equal "default", subject.withargs(2)
336
336
  end
337
337
 
338
338
  should "allow stubbing a method that takes any args" do
339
- assert_equal 'default', subject.anyargs
340
- assert_equal 'default', subject.anyargs(1)
341
- assert_equal 'one-two', subject.anyargs(1, 2)
339
+ assert_equal "default", subject.anyargs
340
+ assert_equal "default", subject.anyargs(1)
341
+ assert_equal "one-two", subject.anyargs(1, 2)
342
342
  end
343
343
 
344
344
  should "allow stubbing a method that takes a minimum number of args" do
345
- assert_equal 'one-two', subject.minargs(1, 2)
346
- assert_equal 'one-two-three', subject.minargs(1, 2, 3)
347
- assert_equal 'default', subject.minargs(1, 2, 4)
348
- assert_equal 'default', subject.minargs(1, 2, 3, 4)
345
+ assert_equal "one-two", subject.minargs(1, 2)
346
+ assert_equal "one-two-three", subject.minargs(1, 2, 3)
347
+ assert_equal "default", subject.minargs(1, 2, 4)
348
+ assert_equal "default", subject.minargs(1, 2, 3, 4)
349
349
  end
350
350
 
351
351
  should "allow stubbing a method that takes a block" do
352
- assert_equal 'default', subject.withblock
353
- assert_equal 'default', subject.withblock{ 'my-block' }
352
+ assert_equal "default", subject.withblock
353
+ assert_equal "default", subject.withblock{ "my-block" }
354
354
  end
355
355
 
356
356
  should "not allow stubbing methods with invalid arity" do
@@ -383,48 +383,48 @@ class Assert::Stub
383
383
  desc "for an inherited class method"
384
384
  setup do
385
385
  @class = Class.new(TestClass)
386
- Assert.stub(@class, :noargs){ 'default' }
387
- Assert.stub(@class, :noargs).with{ 'none' }
386
+ Assert.stub(@class, :noargs){ "default" }
387
+ Assert.stub(@class, :noargs).with{ "none" }
388
388
 
389
- Assert.stub(@class, :withargs){ 'default' }
390
- Assert.stub(@class, :withargs).with(1){ 'one' }
389
+ Assert.stub(@class, :withargs){ "default" }
390
+ Assert.stub(@class, :withargs).with(1){ "one" }
391
391
 
392
- Assert.stub(@class, :anyargs){ 'default' }
393
- Assert.stub(@class, :anyargs).with(1, 2){ 'one-two' }
392
+ Assert.stub(@class, :anyargs){ "default" }
393
+ Assert.stub(@class, :anyargs).with(1, 2){ "one-two" }
394
394
 
395
- Assert.stub(@class, :minargs){ 'default' }
396
- Assert.stub(@class, :minargs).with(1, 2){ 'one-two' }
397
- Assert.stub(@class, :minargs).with(1, 2, 3){ 'one-two-three' }
395
+ Assert.stub(@class, :minargs){ "default" }
396
+ Assert.stub(@class, :minargs).with(1, 2){ "one-two" }
397
+ Assert.stub(@class, :minargs).with(1, 2, 3){ "one-two-three" }
398
398
 
399
- Assert.stub(@class, :withblock){ 'default' }
399
+ Assert.stub(@class, :withblock){ "default" }
400
400
  end
401
401
  subject{ @class }
402
402
 
403
403
  should "allow stubbing a method that doesn't take args" do
404
- assert_equal 'none', subject.noargs
404
+ assert_equal "none", subject.noargs
405
405
  end
406
406
 
407
407
  should "allow stubbing a method that takes args" do
408
- assert_equal 'one', subject.withargs(1)
409
- assert_equal 'default', subject.withargs(2)
408
+ assert_equal "one", subject.withargs(1)
409
+ assert_equal "default", subject.withargs(2)
410
410
  end
411
411
 
412
412
  should "allow stubbing a method that takes any args" do
413
- assert_equal 'default', subject.anyargs
414
- assert_equal 'default', subject.anyargs(1)
415
- assert_equal 'one-two', subject.anyargs(1, 2)
413
+ assert_equal "default", subject.anyargs
414
+ assert_equal "default", subject.anyargs(1)
415
+ assert_equal "one-two", subject.anyargs(1, 2)
416
416
  end
417
417
 
418
418
  should "allow stubbing a method that takes a minimum number of args" do
419
- assert_equal 'one-two', subject.minargs(1, 2)
420
- assert_equal 'one-two-three', subject.minargs(1, 2, 3)
421
- assert_equal 'default', subject.minargs(1, 2, 4)
422
- assert_equal 'default', subject.minargs(1, 2, 3, 4)
419
+ assert_equal "one-two", subject.minargs(1, 2)
420
+ assert_equal "one-two-three", subject.minargs(1, 2, 3)
421
+ assert_equal "default", subject.minargs(1, 2, 4)
422
+ assert_equal "default", subject.minargs(1, 2, 3, 4)
423
423
  end
424
424
 
425
425
  should "allow stubbing a method that takes a block" do
426
- assert_equal 'default', subject.withblock
427
- assert_equal 'default', subject.withblock{ 'my-block' }
426
+ assert_equal "default", subject.withblock
427
+ assert_equal "default", subject.withblock{ "my-block" }
428
428
  end
429
429
 
430
430
  should "not allow stubbing methods with invalid arity" do
@@ -458,48 +458,48 @@ class Assert::Stub
458
458
  setup do
459
459
  @class = Class.new(TestClass)
460
460
  @instance = @class.new
461
- Assert.stub(@instance, :noargs){ 'default' }
462
- Assert.stub(@instance, :noargs).with{ 'none' }
461
+ Assert.stub(@instance, :noargs){ "default" }
462
+ Assert.stub(@instance, :noargs).with{ "none" }
463
463
 
464
- Assert.stub(@instance, :withargs){ 'default' }
465
- Assert.stub(@instance, :withargs).with(1){ 'one' }
464
+ Assert.stub(@instance, :withargs){ "default" }
465
+ Assert.stub(@instance, :withargs).with(1){ "one" }
466
466
 
467
- Assert.stub(@instance, :anyargs){ 'default' }
468
- Assert.stub(@instance, :anyargs).with(1, 2){ 'one-two' }
467
+ Assert.stub(@instance, :anyargs){ "default" }
468
+ Assert.stub(@instance, :anyargs).with(1, 2){ "one-two" }
469
469
 
470
- Assert.stub(@instance, :minargs){ 'default' }
471
- Assert.stub(@instance, :minargs).with(1, 2){ 'one-two' }
472
- Assert.stub(@instance, :minargs).with(1, 2, 3){ 'one-two-three' }
470
+ Assert.stub(@instance, :minargs){ "default" }
471
+ Assert.stub(@instance, :minargs).with(1, 2){ "one-two" }
472
+ Assert.stub(@instance, :minargs).with(1, 2, 3){ "one-two-three" }
473
473
 
474
- Assert.stub(@instance, :withblock){ 'default' }
474
+ Assert.stub(@instance, :withblock){ "default" }
475
475
  end
476
476
  subject{ @instance }
477
477
 
478
478
  should "allow stubbing a method that doesn't take args" do
479
- assert_equal 'none', subject.noargs
479
+ assert_equal "none", subject.noargs
480
480
  end
481
481
 
482
482
  should "allow stubbing a method that takes args" do
483
- assert_equal 'one', subject.withargs(1)
484
- assert_equal 'default', subject.withargs(2)
483
+ assert_equal "one", subject.withargs(1)
484
+ assert_equal "default", subject.withargs(2)
485
485
  end
486
486
 
487
487
  should "allow stubbing a method that takes any args" do
488
- assert_equal 'default', subject.anyargs
489
- assert_equal 'default', subject.anyargs(1)
490
- assert_equal 'one-two', subject.anyargs(1, 2)
488
+ assert_equal "default", subject.anyargs
489
+ assert_equal "default", subject.anyargs(1)
490
+ assert_equal "one-two", subject.anyargs(1, 2)
491
491
  end
492
492
 
493
493
  should "allow stubbing a method that takes a minimum number of args" do
494
- assert_equal 'one-two', subject.minargs(1, 2)
495
- assert_equal 'one-two-three', subject.minargs(1, 2, 3)
496
- assert_equal 'default', subject.minargs(1, 2, 4)
497
- assert_equal 'default', subject.minargs(1, 2, 3, 4)
494
+ assert_equal "one-two", subject.minargs(1, 2)
495
+ assert_equal "one-two-three", subject.minargs(1, 2, 3)
496
+ assert_equal "default", subject.minargs(1, 2, 4)
497
+ assert_equal "default", subject.minargs(1, 2, 3, 4)
498
498
  end
499
499
 
500
500
  should "allow stubbing a method that takes a block" do
501
- assert_equal 'default', subject.withblock
502
- assert_equal 'default', subject.withblock{ 'my-block' }
501
+ assert_equal "default", subject.withblock
502
+ assert_equal "default", subject.withblock{ "my-block" }
503
503
  end
504
504
 
505
505
  should "not allow stubbing methods with invalid arity" do
@@ -532,48 +532,48 @@ class Assert::Stub
532
532
  desc "a class that delegates another object"
533
533
  setup do
534
534
  @class = DelegateClass
535
- Assert.stub(@class, :noargs){ 'default' }
536
- Assert.stub(@class, :noargs).with{ 'none' }
535
+ Assert.stub(@class, :noargs){ "default" }
536
+ Assert.stub(@class, :noargs).with{ "none" }
537
537
 
538
- Assert.stub(@class, :withargs){ 'default' }
539
- Assert.stub(@class, :withargs).with(1){ 'one' }
538
+ Assert.stub(@class, :withargs){ "default" }
539
+ Assert.stub(@class, :withargs).with(1){ "one" }
540
540
 
541
- Assert.stub(@class, :anyargs){ 'default' }
542
- Assert.stub(@class, :anyargs).with(1, 2){ 'one-two' }
541
+ Assert.stub(@class, :anyargs){ "default" }
542
+ Assert.stub(@class, :anyargs).with(1, 2){ "one-two" }
543
543
 
544
- Assert.stub(@class, :minargs){ 'default' }
545
- Assert.stub(@class, :minargs).with(1, 2){ 'one-two' }
546
- Assert.stub(@class, :minargs).with(1, 2, 3){ 'one-two-three' }
544
+ Assert.stub(@class, :minargs){ "default" }
545
+ Assert.stub(@class, :minargs).with(1, 2){ "one-two" }
546
+ Assert.stub(@class, :minargs).with(1, 2, 3){ "one-two-three" }
547
547
 
548
- Assert.stub(@class, :withblock){ 'default' }
548
+ Assert.stub(@class, :withblock){ "default" }
549
549
  end
550
550
  subject{ @class }
551
551
 
552
552
  should "allow stubbing a method that doesn't take args" do
553
- assert_equal 'none', subject.noargs
553
+ assert_equal "none", subject.noargs
554
554
  end
555
555
 
556
556
  should "allow stubbing a method that takes args" do
557
- assert_equal 'one', subject.withargs(1)
558
- assert_equal 'default', subject.withargs(2)
557
+ assert_equal "one", subject.withargs(1)
558
+ assert_equal "default", subject.withargs(2)
559
559
  end
560
560
 
561
561
  should "allow stubbing a method that takes any args" do
562
- assert_equal 'default', subject.anyargs
563
- assert_equal 'default', subject.anyargs(1)
564
- assert_equal 'one-two', subject.anyargs(1, 2)
562
+ assert_equal "default", subject.anyargs
563
+ assert_equal "default", subject.anyargs(1)
564
+ assert_equal "one-two", subject.anyargs(1, 2)
565
565
  end
566
566
 
567
567
  should "allow stubbing a method that takes a minimum number of args" do
568
- assert_equal 'one-two', subject.minargs(1, 2)
569
- assert_equal 'one-two-three', subject.minargs(1, 2, 3)
570
- assert_equal 'default', subject.minargs(1, 2, 4)
571
- assert_equal 'default', subject.minargs(1, 2, 3, 4)
568
+ assert_equal "one-two", subject.minargs(1, 2)
569
+ assert_equal "one-two-three", subject.minargs(1, 2, 3)
570
+ assert_equal "default", subject.minargs(1, 2, 4)
571
+ assert_equal "default", subject.minargs(1, 2, 3, 4)
572
572
  end
573
573
 
574
574
  should "allow stubbing a method that takes a block" do
575
- assert_equal 'default', subject.withblock
576
- assert_equal 'default', subject.withblock{ 'my-block' }
575
+ assert_equal "default", subject.withblock
576
+ assert_equal "default", subject.withblock{ "my-block" }
577
577
  end
578
578
 
579
579
  should "allow stubbing methods with invalid arity" do
@@ -606,48 +606,48 @@ class Assert::Stub
606
606
  desc "an instance that delegates another object"
607
607
  setup do
608
608
  @instance = DelegateClass.new
609
- Assert.stub(@instance, :noargs){ 'default' }
610
- Assert.stub(@instance, :noargs).with{ 'none' }
609
+ Assert.stub(@instance, :noargs){ "default" }
610
+ Assert.stub(@instance, :noargs).with{ "none" }
611
611
 
612
- Assert.stub(@instance, :withargs){ 'default' }
613
- Assert.stub(@instance, :withargs).with(1){ 'one' }
612
+ Assert.stub(@instance, :withargs){ "default" }
613
+ Assert.stub(@instance, :withargs).with(1){ "one" }
614
614
 
615
- Assert.stub(@instance, :anyargs){ 'default' }
616
- Assert.stub(@instance, :anyargs).with(1, 2){ 'one-two' }
615
+ Assert.stub(@instance, :anyargs){ "default" }
616
+ Assert.stub(@instance, :anyargs).with(1, 2){ "one-two" }
617
617
 
618
- Assert.stub(@instance, :minargs){ 'default' }
619
- Assert.stub(@instance, :minargs).with(1, 2){ 'one-two' }
620
- Assert.stub(@instance, :minargs).with(1, 2, 3){ 'one-two-three' }
618
+ Assert.stub(@instance, :minargs){ "default" }
619
+ Assert.stub(@instance, :minargs).with(1, 2){ "one-two" }
620
+ Assert.stub(@instance, :minargs).with(1, 2, 3){ "one-two-three" }
621
621
 
622
- Assert.stub(@instance, :withblock){ 'default' }
622
+ Assert.stub(@instance, :withblock){ "default" }
623
623
  end
624
624
  subject{ @instance }
625
625
 
626
626
  should "allow stubbing a method that doesn't take args" do
627
- assert_equal 'none', subject.noargs
627
+ assert_equal "none", subject.noargs
628
628
  end
629
629
 
630
630
  should "allow stubbing a method that takes args" do
631
- assert_equal 'one', subject.withargs(1)
632
- assert_equal 'default', subject.withargs(2)
631
+ assert_equal "one", subject.withargs(1)
632
+ assert_equal "default", subject.withargs(2)
633
633
  end
634
634
 
635
635
  should "allow stubbing a method that takes any args" do
636
- assert_equal 'default', subject.anyargs
637
- assert_equal 'default', subject.anyargs(1)
638
- assert_equal 'one-two', subject.anyargs(1, 2)
636
+ assert_equal "default", subject.anyargs
637
+ assert_equal "default", subject.anyargs(1)
638
+ assert_equal "one-two", subject.anyargs(1, 2)
639
639
  end
640
640
 
641
641
  should "allow stubbing a method that takes a minimum number of args" do
642
- assert_equal 'one-two', subject.minargs(1, 2)
643
- assert_equal 'one-two-three', subject.minargs(1, 2, 3)
644
- assert_equal 'default', subject.minargs(1, 2, 4)
645
- assert_equal 'default', subject.minargs(1, 2, 3, 4)
642
+ assert_equal "one-two", subject.minargs(1, 2)
643
+ assert_equal "one-two-three", subject.minargs(1, 2, 3)
644
+ assert_equal "default", subject.minargs(1, 2, 4)
645
+ assert_equal "default", subject.minargs(1, 2, 3, 4)
646
646
  end
647
647
 
648
648
  should "allow stubbing a method that takes a block" do
649
- assert_equal 'default', subject.withblock
650
- assert_equal 'default', subject.withblock{ 'my-block' }
649
+ assert_equal "default", subject.withblock
650
+ assert_equal "default", subject.withblock{ "my-block" }
651
651
  end
652
652
 
653
653
  should "allow stubbing methods with invalid arity" do
@@ -682,13 +682,13 @@ class Assert::Stub
682
682
  @parent_class = Class.new
683
683
  @child_class = Class.new(@parent_class)
684
684
 
685
- Assert.stub(@parent_class, :new){ 'parent' }
686
- Assert.stub(@child_class, :new){ 'child' }
685
+ Assert.stub(@parent_class, :new){ "parent" }
686
+ Assert.stub(@child_class, :new){ "child" }
687
687
  end
688
688
 
689
689
  should "allow stubbing the methods individually" do
690
- assert_equal 'parent', @parent_class.new
691
- assert_equal 'child', @child_class.new
690
+ assert_equal "parent", @parent_class.new
691
+ assert_equal "child", @child_class.new
692
692
  end
693
693
 
694
694
  end