Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Missing tests #519

Merged
merged 6 commits into from

3 participants

@mattwildig

Running RUBYOPT=-w rake test revealed several tests that were hidden by redefining the same method, so they ended up being lost. This uncovers 6 tests and 11 assertions.

mattwildig added some commits
@mattwildig mattwildig Resolve test name conflict
In delegator_test.rb, there are two tests named
"registers helpers with the delegation target", causing "method
redefined" warnings and the first test not to be run.

Rename the second test so that all tests run.
1c36d54
@mattwildig mattwildig Resolve test name conflict
In AfterFilterTest in filter_test.rb there are two tests named
"executes filters in the order defined", causing the first not to be
run.

Rename the first test, and fix the mock app in the test so it doesn't
cause a Rack::Lint error.
1950d20
@mattwildig mattwildig Resolve test name conflict
There are two tests named
"is possible to apply user_agent conditions to before filters with a path"
in filters_test.rb, causing "method redefined" warnings and tests not
being run.

Rename second of these to accurately describe what it's testing
ad4cfaf
@mattwildig mattwildig Resolve test name conflict
sanitize_name in contest.rb strips out any non-word characters, so
'is false for status > 404' and 'is false for status < 404' end up as
having the same test name, causing lost tests.

Rename these tests to use 'gt' and 'lt' rather then '>' and '<'.
f91c411
@mattwildig mattwildig Resolve test name conflict
There are two tests named
'sets the Content-Type response header without extname' in
helpers_test.rb.

Rename the second to accurately describe what it tests.
4b361c9
@mattwildig mattwildig Resolve test name conflict
There are two tests named 'allows passing time objects'.

Rename tests so they don't clash.
1c262be
@travisbot

This pull request passes (merged 1c262be into f948c23).

@rkh rkh merged commit 40e967b into sinatra:master
@rkh
Owner

Maybe we should fix this in contest somehow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 29, 2012
  1. @mattwildig

    Resolve test name conflict

    mattwildig authored
    In delegator_test.rb, there are two tests named
    "registers helpers with the delegation target", causing "method
    redefined" warnings and the first test not to be run.
    
    Rename the second test so that all tests run.
  2. @mattwildig

    Resolve test name conflict

    mattwildig authored
    In AfterFilterTest in filter_test.rb there are two tests named
    "executes filters in the order defined", causing the first not to be
    run.
    
    Rename the first test, and fix the mock app in the test so it doesn't
    cause a Rack::Lint error.
  3. @mattwildig

    Resolve test name conflict

    mattwildig authored
    There are two tests named
    "is possible to apply user_agent conditions to before filters with a path"
    in filters_test.rb, causing "method redefined" warnings and tests not
    being run.
    
    Rename second of these to accurately describe what it's testing
  4. @mattwildig

    Resolve test name conflict

    mattwildig authored
    sanitize_name in contest.rb strips out any non-word characters, so
    'is false for status > 404' and 'is false for status < 404' end up as
    having the same test name, causing lost tests.
    
    Rename these tests to use 'gt' and 'lt' rather then '>' and '<'.
  5. @mattwildig

    Resolve test name conflict

    mattwildig authored
    There are two tests named
    'sets the Content-Type response header without extname' in
    helpers_test.rb.
    
    Rename the second to accurately describe what it tests.
  6. @mattwildig

    Resolve test name conflict

    mattwildig authored
    There are two tests named 'allows passing time objects'.
    
    Rename tests so they don't clash.
This page is out of date. Refresh to see the latest.
View
2  test/delegator_test.rb
@@ -100,7 +100,7 @@ def target
assert_equal ["helpers", mixin.to_s], app.last_call
end
- it "registers helpers with the delegation target" do
+ it "registers middleware with the delegation target" do
app, mixin = mirror, Module.new
Sinatra.use mixin
assert_equal ["use", mixin.to_s], app.last_call
View
6 test/filter_test.rb
@@ -156,11 +156,11 @@ class BeforeFilterTest < Test::Unit::TestCase
end
class AfterFilterTest < Test::Unit::TestCase
- it "executes filters in the order defined" do
+ it "executes before and after filters in correct order" do
invoked = 0
mock_app do
before { invoked = 2 }
- get('/') { invoked += 2 }
+ get('/') { invoked += 2; 'hello' }
after { invoked *= 2 }
end
@@ -410,7 +410,7 @@ class AfterFilterTest < Test::Unit::TestCase
assert ran
end
- it 'is possible to apply user_agent conditions to before filters with a path' do
+ it 'is possible to apply user_agent conditions to after filters with a path' do
ran = false
mock_app do
after('/foo', :user_agent => /foo/) { ran = true }
View
10 test/helpers_test.rb
@@ -31,12 +31,12 @@ def status_app(code, &block)
assert_body 'true'
end
- it 'is false for status > 404' do
+ it 'is false for status gt 404' do
status_app(405) { not_found? }
assert_body 'false'
end
- it 'is false for status < 404' do
+ it 'is false for status lt 404' do
status_app(403) { not_found? }
assert_body 'false'
end
@@ -601,7 +601,7 @@ def attachment_app(filename=nil)
assert_equal '<sinatra></sinatra>', body
end
- it 'sets the Content-Type response header without extname' do
+ it 'sets the Content-Type response header with extname' do
mock_app do
get('/attachment') do
content_type :atom
@@ -812,12 +812,12 @@ def obj.is_a?(thing) 60.is_a?(thing) end
assert_not_nil response['Expires']
end
- it 'allows passing time objects' do
+ it 'allows passing Time.now objects' do
get '/bar'
assert_not_nil response['Expires']
end
- it 'allows passing time objects' do
+ it 'allows passing Time.at objects' do
get '/baz'
assert_equal 'Thu, 01 Jan 1970 00:00:00 GMT', response['Expires']
end
Something went wrong with that request. Please try again.