more tests

This commit is contained in:
Lucas Souza 2011-07-06 11:03:25 -03:00
parent a00f65ce68
commit 996f56b5e7
3 changed files with 23 additions and 1 deletions

View File

@ -1,2 +1,7 @@
source "http://rubygems.org" source "http://rubygems.org"
gemspec gemspec
group :test do
gem 'mocha'
gem 'flexmock'
end

View File

@ -11,6 +11,8 @@ GEM
specs: specs:
emk-sinatra-url-for (0.2.1) emk-sinatra-url-for (0.2.1)
sinatra (>= 0.9.1.1) sinatra (>= 0.9.1.1)
flexmock (0.9.0)
mocha (0.9.12)
rack (1.3.0) rack (1.3.0)
rack-test (0.6.0) rack-test (0.6.0)
rack (>= 1.0) rack (>= 1.0)
@ -23,5 +25,7 @@ PLATFORMS
ruby ruby
DEPENDENCIES DEPENDENCIES
flexmock
mocha
rack-test (>= 0.3.0) rack-test (>= 0.3.0)
sinatra-static-assets! sinatra-static-assets!

View File

@ -1,6 +1,8 @@
require 'sinatra_app' require 'sinatra_app'
require 'test/unit' require 'test/unit'
require 'rack/test' require 'rack/test'
require 'flexmock/test_unit'
require 'mocha'
set :environment, :test set :environment, :test
@ -53,5 +55,16 @@ EOD
<a href="/bar/topr">Tatry Mountains Rescue Team</a> <a href="/bar/topr">Tatry Mountains Rescue Team</a>
EOD EOD
end end
def test_tags_returns_time_stamp_when_file_exists
file_path = "#{Sinatra::Application.root}/public/bar/javascripts/summer.js"
File.expects(:"exists?").with(file_path).returns(true)
File.expects(:mtime).with(file_path).returns(123456789)
get '/javascript_script_tag', {}, 'SCRIPT_NAME' => '/bar'
assert last_response.ok?
assert_equal last_response.body, <<EOD
<script charset="iso-8859-2" src="/bar/javascripts/summer.js?123456789" type="text/javascript"></script>
EOD
end
end end