Permalink
Browse files

test all kinds of possible time values for last_modified

  • Loading branch information...
1 parent 13aea02 commit 60a251fb76bb03fab32a3318d6f7372a6fa4b633 @rkh rkh committed Feb 26, 2011
Showing with 5 additions and 4 deletions.
  1. +5 −4 test/helpers_test.rb
View
@@ -580,17 +580,18 @@ def send_file_app(opts={})
assert ! response['Last-Modified']
end
- [Time, DateTime].each do |klass|
- describe "with #{klass.name}" do
+ [Time.now, DateTime.now, Date.today, Time.now.to_i,
+ Struct.new(:to_time).new(Time.now) ].each do |last_modified_time|
+ describe "with #{last_modified_time.class.name}" do
setup do
- last_modified_time = klass.now
mock_app do
get '/' do
last_modified last_modified_time
'Boo!'
end
end
- @last_modified_time = Time.parse last_modified_time.to_s
+ wrapper = Object.new.extend Sinatra::Helpers
+ @last_modified_time = wrapper.send :time_for, last_modified_time
end
# fixes strange missing test error when running complete test suite.

0 comments on commit 60a251f

Please sign in to comment.