calendar_helper 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.2.2 / 2007-08-29
2
+
3
+ * Fixed missing tr tag in thead section. [Ian Struble]
4
+
1
5
  === 0.2.1 / 2007-07-07
2
6
 
3
7
  * Added html output to the tests for visual confirmation or
@@ -3,7 +3,7 @@ require 'date'
3
3
  # CalendarHelper allows you to draw a databound calendar with fine-grained CSS formatting
4
4
  module CalendarHelper
5
5
 
6
- VERSION = '0.2.1'
6
+ VERSION = '0.2.2'
7
7
 
8
8
  # Returns an HTML calendar. In its simplest form, this method generates a plain
9
9
  # calendar (which can then be customized using CSS) for a given month and year.
@@ -93,7 +93,7 @@ module CalendarHelper
93
93
  end
94
94
 
95
95
  cal = %(<table class="#{options[:table_class]}" border="0" cellspacing="0" cellpadding="0">)
96
- cal << %(<caption class="#{options[:month_name_class]}"></caption><thead><th colspan="7">#{Date::MONTHNAMES[options[:month]]}</th></tr><tr class="#{options[:day_name_class]}">)
96
+ cal << %(<caption class="#{options[:month_name_class]}"></caption><thead><tr><th colspan="7">#{Date::MONTHNAMES[options[:month]]}</th></tr><tr class="#{options[:day_name_class]}">)
97
97
  day_names.each do |d|
98
98
  unless d[options[:abbrev]].eql? d
99
99
  cal << "<th scope='col'><abbr title='#{d}'>#{d[options[:abbrev]]}</abbr></th>"
@@ -1,10 +1,20 @@
1
+ require 'rubygems'
1
2
  require 'test/unit'
2
3
  require 'fileutils'
3
4
  require File.expand_path(File.dirname(__FILE__) + "/../lib/calendar_helper")
4
5
 
6
+ require 'flexmock/test_unit'
7
+
8
+ # require 'action_controller'
9
+ # require 'action_controller/assertions'
10
+ # require 'active_support/inflector'
11
+
5
12
  class CalendarHelperTest < Test::Unit::TestCase
6
13
 
14
+ # include Inflector
15
+ # include ActionController::Assertions::SelectorAssertions
7
16
  include CalendarHelper
17
+
8
18
 
9
19
  def test_with_output
10
20
  output = "<h2>Past Month</h2>" + calendar_with_defaults
@@ -80,6 +90,14 @@ class CalendarHelperTest < Test::Unit::TestCase
80
90
  assert_no_match %r{today}, calendar_for_this_month(:show_today => false)
81
91
  end
82
92
 
93
+ # HACK Tried to use assert_select, but it's not made for free-standing
94
+ # HTML parsing.
95
+ def test_should_have_two_tr_tags_in_the_thead
96
+ # TODO Use a validating service to make sure the rendered HTML is valid
97
+ html = calendar_with_defaults
98
+ assert_match %r{<thead><tr>.*</tr><tr.*</tr></thead>}, html
99
+ end
100
+
83
101
  private
84
102
 
85
103
  def assert_correct_css_class_for_key(css_class, key)
@@ -103,7 +121,7 @@ class CalendarHelperTest < Test::Unit::TestCase
103
121
  def write_sample(filename, content)
104
122
  FileUtils.mkdir_p "test/output"
105
123
  File.open("test/output/#{filename}", 'w') do |f|
106
- f.write %(<html><head><title>Stylesheet Tester</title><link href="../../generators/calendar_styles/templates/grey/style.css" media="screen" rel="Stylesheet" type="text/css" /></head><body>)
124
+ f.write %(<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html><head><title>Stylesheet Tester</title><link href="../../generators/calendar_styles/templates/grey/style.css" media="screen" rel="Stylesheet" type="text/css" /></head><body>)
107
125
  f.write content
108
126
  f.write %(</body></html>)
109
127
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: calendar_helper
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.2.1
7
- date: 2007-07-07 00:00:00 -07:00
6
+ version: 0.2.2
7
+ date: 2007-08-29 00:00:00 -07:00
8
8
  summary: Generates a configurable, CSS-tagged HTML calendar.
9
9
  require_paths:
10
10
  - lib
@@ -64,5 +64,5 @@ dependencies:
64
64
  requirements:
65
65
  - - ">="
66
66
  - !ruby/object:Gem::Version
67
- version: 1.2.1
67
+ version: 1.3.0
68
68
  version: