ZenTest 3.4.2 → 3.4.3

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.
@@ -1,3 +1,11 @@
1
+ *** 3.4.3 / 2006-12-19
2
+
3
+ + 2 minor enhancements:
4
+ + Add assert_title and assert_h (for header).
5
+ + 2 bug fixes:
6
+ + Rereleased against latest version of hoe to fix load path problems.
7
+ + Fix case ViewTestCase for case-sensitive file systems.
8
+
1
9
  *** 3.4.2 / 2006-11-09
2
10
 
3
11
  + 2 minor enhancements:
@@ -183,6 +183,7 @@ class Test::Rails::ViewTestCase < Test::Rails::FunctionalTestCase
183
183
  @controller.send :forget_variables_added_to_assigns rescue nil
184
184
 
185
185
  # Do the render
186
+ options[:TR_force] = true
186
187
  @controller.render options, deprecated_status
187
188
 
188
189
  # Rails 1.1
@@ -218,6 +219,19 @@ class Test::Rails::ViewTestCase < Test::Rails::FunctionalTestCase
218
219
  assert_label form_action, "#{model}_#{column}", false
219
220
  end
220
221
 
222
+ ##
223
+ # Asserts a h tag of level +level+ exists and contains +content+.
224
+ #
225
+ # view:
226
+ # <h3>Recent Builds</h3>
227
+ #
228
+ # test:
229
+ # assert_h 3, 'Recent Builds'
230
+
231
+ def assert_h(level, content)
232
+ assert_tag :tag => "h#{level}", :content => content
233
+ end
234
+
221
235
  ##
222
236
  # Asserts that an image exists with a src of +src+.
223
237
  #
@@ -412,6 +426,19 @@ class Test::Rails::ViewTestCase < Test::Rails::FunctionalTestCase
412
426
  assert_tag_in_form form_action, attribs
413
427
  end
414
428
 
429
+ ##
430
+ # Asserts that a title with +title+ exists.
431
+ #
432
+ # view:
433
+ # <title>some content</title>
434
+ #
435
+ # test:
436
+ # assert_title 'some content'
437
+
438
+ def assert_title(title)
439
+ assert_tag :tag => 'title', :content => title
440
+ end
441
+
415
442
  ##
416
443
  # Creates a new Paginator that uses the current controller. +item_count+,
417
444
  # +items_per_page+ and +page_number+ are passed straight through.
@@ -439,8 +466,7 @@ class Test::Rails::ViewTestCase < Test::Rails::FunctionalTestCase
439
466
 
440
467
  def action_name(test)
441
468
  orig_name = test = test.sub(/.*in `test_(.*)'/, '\1')
442
- controller = @controller.class.name.sub('Controller', '')
443
- controller = controller.gsub(/([A-Z])/, '_\1'.downcase).sub('_', '')
469
+ controller = @controller.class.name.sub('Controller', '').underscore
444
470
 
445
471
  extensions = %w(rhtml rxml mab)
446
472
 
@@ -53,21 +53,21 @@ end
53
53
  #
54
54
  # Method names are mapped bidirectionally in the following way:
55
55
  #
56
- # method test_method
57
- # method? test_method_eh (too much exposure to Canadians :)
58
- # method! test_method_bang
59
- # method= test_method_equals
60
- # [] test_index
61
- # * test_times
62
- # == test_equals2
63
- # === test_equals3
56
+ # method test_method
57
+ # method? test_method_eh (too much exposure to Canadians :)
58
+ # method! test_method_bang
59
+ # method= test_method_equals
60
+ # [] test_index
61
+ # * test_times
62
+ # == test_equals2
63
+ # === test_equals3
64
64
  #
65
65
  # Further, any of the test methods should be able to have arbitrary
66
66
  # extensions put on the name to distinguish edge cases:
67
67
  #
68
- # method test_method
69
- # method test_method_simple
70
- # method test_method_no_network
68
+ # method test_method
69
+ # method test_method_simple
70
+ # method test_method_no_network
71
71
  #
72
72
  # To allow for unmapped test methods (ie, non-unit tests), name them:
73
73
  #
@@ -75,7 +75,7 @@ end
75
75
 
76
76
  class ZenTest
77
77
 
78
- VERSION = '3.4.2'
78
+ VERSION = '3.4.3'
79
79
 
80
80
  if $TESTING then
81
81
  attr_reader :missing_methods
@@ -101,9 +101,9 @@ class ZenTest
101
101
 
102
102
  unless file == $0 then
103
103
  begin
104
- require file
104
+ require file
105
105
  rescue LoadError => err
106
- puts "Could not load #{file}: #{err}"
106
+ puts "Could not load #{file}: #{err}"
107
107
  end
108
108
  else
109
109
  puts "# Skipping loading myself (#{file})" if $DEBUG
@@ -116,11 +116,11 @@ class ZenTest
116
116
  puts "# found class #{klass.name}" if $DEBUG
117
117
  rescue NameError
118
118
  ObjectSpace.each_object(Class) do |cls|
119
- if cls.name =~ /(^|::)#{klassname}$/ then
120
- klass = cls
121
- klassname = cls.name
119
+ if cls.name =~ /(^|::)#{klassname}$/ then
120
+ klass = cls
121
+ klassname = cls.name
122
122
  break
123
- end
123
+ end
124
124
  end
125
125
  puts "# searched and found #{klass.name}" if klass and $DEBUG
126
126
  end
@@ -162,13 +162,13 @@ class ZenTest
162
162
  superklass = klass.superclass
163
163
  if superklass then
164
164
  the_methods = superklass.instance_methods(true)
165
-
165
+
166
166
  # generally we don't test Object's methods...
167
167
  unless full then
168
168
  the_methods -= Object.instance_methods(true)
169
169
  the_methods -= Kernel.methods # FIX (true) - check 1.6 vs 1.8
170
170
  end
171
-
171
+
172
172
  the_methods.each do |meth|
173
173
  klassmethods[meth] = true
174
174
  end
@@ -208,13 +208,13 @@ class ZenTest
208
208
  klass = self.get_class(klassname)
209
209
  raise "Couldn't get class for #{klassname}" if klass.nil?
210
210
  klassname = klass.name # refetch to get full name
211
-
211
+
212
212
  is_test_class = self.is_test_class(klassname)
213
213
  target = is_test_class ? @test_klasses : @klasses
214
214
 
215
215
  # record public instance methods JUST in this class
216
216
  target[klassname] = self.get_methods_for(klass, full)
217
-
217
+
218
218
  # record ALL instance methods including superclasses (minus Object)
219
219
  @inherited_methods[klassname] = self.get_inherited_methods_for(klass, full)
220
220
  return klassname
@@ -242,27 +242,27 @@ class ZenTest
242
242
  end
243
243
  end
244
244
 
245
- if line =~ /^\s*(?:class|module)\s+([\w:]+)/ then
246
- klassname = $1
245
+ if line =~ /^\s*(?:class|module)\s+([\w:]+)/ then
246
+ klassname = $1
247
247
 
248
- if line =~ /\#\s*ZenTest SKIP/ then
249
- klassname = nil
250
- next
251
- end
248
+ if line =~ /\#\s*ZenTest SKIP/ then
249
+ klassname = nil
250
+ next
251
+ end
252
252
 
253
253
  full = false
254
- if line =~ /\#\s*ZenTest FULL/ then
255
- full = true
256
- end
254
+ if line =~ /\#\s*ZenTest FULL/ then
255
+ full = true
256
+ end
257
257
 
258
- unless is_loaded then
258
+ unless is_loaded then
259
259
  unless path == "-" then
260
260
  self.load_file(path)
261
261
  else
262
262
  eval file, TOPLEVEL_BINDING
263
263
  end
264
264
  is_loaded = true
265
- end
265
+ end
266
266
 
267
267
  begin
268
268
  klassname = self.process_class(klassname, full)
@@ -277,7 +277,7 @@ class ZenTest
277
277
  self.process_class(klassname, false)
278
278
  end
279
279
 
280
- end # if /class/
280
+ end # if /class/
281
281
  end # IO.foreach
282
282
  end # files
283
283
 
@@ -429,7 +429,7 @@ class ZenTest
429
429
 
430
430
  found = false
431
431
  until methodname == "" or methods[methodname] or @inherited_methods[klassname][methodname] do
432
- # try the name minus an option (ie mut_opt1 -> mut)
432
+ # try the name minus an option (ie mut_opt1 -> mut)
433
433
  if methodname.sub!(/_[^_]+$/, '') then
434
434
  if methods[methodname] or @inherited_methods[klassname][methodname] then
435
435
  found = true
@@ -438,11 +438,11 @@ class ZenTest
438
438
  break # no more substitutions will take place
439
439
  end
440
440
  end # methodname == "" or ...
441
-
441
+
442
442
  unless found or methods[methodname] or methodname == "initialize" then
443
443
  self.add_missing_method(klassname, orig_name)
444
444
  end
445
-
445
+
446
446
  else # not a test_.* method
447
447
  unless testmethodname =~ /^util_/ then
448
448
  puts "# WARNING Skipping #{testklassname}\##{testmethodname}" if $DEBUG
@@ -505,8 +505,8 @@ class ZenTest
505
505
  klasspath.each do | modulename |
506
506
  m = self.get_class(modulename)
507
507
  type = m.nil? ? "module" : m.class.name.downcase
508
- @result.push indentunit*indent + "#{type} #{modulename}"
509
- indent += 1
508
+ @result.push indentunit*indent + "#{type} #{modulename}"
509
+ indent += 1
510
510
  end
511
511
  @result.push indentunit*indent + "class #{klassname}" + (is_test_class ? " < Test::Unit::TestCase" : '')
512
512
  indent += 1
@@ -514,26 +514,26 @@ class ZenTest
514
514
  meths = []
515
515
 
516
516
  cls_methods.sort.each do |method|
517
- meth = []
518
- meth.push indentunit*indent + "def #{method}"
517
+ meth = []
518
+ meth.push indentunit*indent + "def #{method}"
519
519
  meth.last << "(*args)" unless method =~ /^test/
520
- indent += 1
521
- meth.push indentunit*indent + "raise NotImplementedError, 'Need to write #{method}'"
522
- indent -= 1
523
- meth.push indentunit*indent + "end"
524
- meths.push meth.join("\n")
520
+ indent += 1
521
+ meth.push indentunit*indent + "raise NotImplementedError, 'Need to write #{method}'"
522
+ indent -= 1
523
+ meth.push indentunit*indent + "end"
524
+ meths.push meth.join("\n")
525
525
  end
526
526
 
527
527
  methods.keys.sort.each do |method|
528
528
  next if method =~ /pretty_print/
529
- meth = []
530
- meth.push indentunit*indent + "def #{method}"
529
+ meth = []
530
+ meth.push indentunit*indent + "def #{method}"
531
531
  meth.last << "(*args)" unless method =~ /^test/
532
- indent += 1
533
- meth.push indentunit*indent + "raise NotImplementedError, 'Need to write #{method}'"
534
- indent -= 1
535
- meth.push indentunit*indent + "end"
536
- meths.push meth.join("\n")
532
+ indent += 1
533
+ meth.push indentunit*indent + "raise NotImplementedError, 'Need to write #{method}'"
534
+ indent -= 1
535
+ meth.push indentunit*indent + "end"
536
+ meths.push meth.join("\n")
537
537
  end
538
538
 
539
539
  @result.push meths.join("\n\n")
@@ -541,8 +541,8 @@ class ZenTest
541
541
  indent -= 1
542
542
  @result.push indentunit*indent + "end"
543
543
  klasspath.each do | modulename |
544
- indent -= 1
545
- @result.push indentunit*indent + "end"
544
+ indent -= 1
545
+ @result.push indentunit*indent + "end"
546
546
  end
547
547
  @result.push ''
548
548
  end
@@ -584,4 +584,3 @@ class ZenTest
584
584
  Object.class_eval code
585
585
  end
586
586
  end
587
-
metadata CHANGED
@@ -3,12 +3,11 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: ZenTest
5
5
  version: !ruby/object:Gem::Version
6
- version: 3.4.2
7
- date: 2006-11-09 00:00:00 -05:00
6
+ version: 3.4.3
7
+ date: 2006-12-19 00:00:00 -08:00
8
8
  summary: "ZenTest provides 4 different tools and 1 library: zentest, unit_diff, autotest, multiruby, and Test::Rails."
9
9
  require_paths:
10
10
  - lib
11
- - test
12
11
  email: ryand-ruby@zenspider.com
13
12
  homepage: http://www.zenspider.com/ZSS/Products/ZenTest/
14
13
  rubyforge_project: zentest
@@ -116,5 +115,5 @@ dependencies:
116
115
  requirements:
117
116
  - - ">="
118
117
  - !ruby/object:Gem::Version
119
- version: 1.1.3
118
+ version: 1.1.4
120
119
  version: