test all kinds of possible time values for last_modified
This commit is contained in:
parent
13aea029f9
commit
60a251fb76
|
@ -580,17 +580,18 @@ class HelpersTest < Test::Unit::TestCase
|
||||||
assert ! response['Last-Modified']
|
assert ! response['Last-Modified']
|
||||||
end
|
end
|
||||||
|
|
||||||
[Time, DateTime].each do |klass|
|
[Time.now, DateTime.now, Date.today, Time.now.to_i,
|
||||||
describe "with #{klass.name}" do
|
Struct.new(:to_time).new(Time.now) ].each do |last_modified_time|
|
||||||
|
describe "with #{last_modified_time.class.name}" do
|
||||||
setup do
|
setup do
|
||||||
last_modified_time = klass.now
|
|
||||||
mock_app do
|
mock_app do
|
||||||
get '/' do
|
get '/' do
|
||||||
last_modified last_modified_time
|
last_modified last_modified_time
|
||||||
'Boo!'
|
'Boo!'
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
||||||
# fixes strange missing test error when running complete test suite.
|
# fixes strange missing test error when running complete test suite.
|
||||||
|
|
Loading…
Reference in New Issue