Skip to content

Commit

Permalink
Added tests (f yeah\!)
Browse files Browse the repository at this point in the history
  • Loading branch information
rb2k committed Aug 23, 2013
1 parent 70565fa commit 120de43
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 2 deletions.
5 changes: 5 additions & 0 deletions Gemfile
Expand Up @@ -2,3 +2,8 @@ source 'https://rubygems.org'
ruby "1.9.3"
gem "rake"
gem "serious", :path => './serious'

group :test do
gem 'rack-test'
gem 'test-unit'
end
5 changes: 5 additions & 0 deletions Gemfile.lock
Expand Up @@ -14,6 +14,8 @@ GEM
rack (1.5.2)
rack-protection (1.5.0)
rack
rack-test (0.6.2)
rack (>= 1.0)
rake (10.1.0)
rdiscount (2.1.6)
sinatra (1.4.3)
Expand All @@ -23,11 +25,14 @@ GEM
stupid_formatter (0.2.0)
coderay (>= 0.9.0)
rdiscount (>= 1.5.0)
test-unit (2.5.5)
tilt (1.4.1)

PLATFORMS
ruby

DEPENDENCIES
rack-test
rake
serious!
test-unit
8 changes: 6 additions & 2 deletions Rakefile
@@ -1,5 +1,9 @@
require 'rake/testtask'

task :default => [:test]

task :test do
puts "Nothing to see here so far!"
Rake::TestTask.new do |t|
t.libs << "test"
t.test_files = FileList['tests/*.rb']
t.verbose = true
end
46 changes: 46 additions & 0 deletions tests/smoke_test.rb
@@ -0,0 +1,46 @@
require 'test/unit'
require "rack/test"

OUTER_APP = Rack::Builder.parse_file('config.ru').first

class SmokeTest < Test::Unit::TestCase
include Rack::Test::Methods

def app
OUTER_APP
end

def test_homepage_is_a_200
get "/"
assert last_response.ok?
end

def test_mp3_feed_works
get "/podcast_feed/all/mp3/atom.xml"
assert last_response.ok?
end

def test_talk_category_feed_works
get "/podcast_feed/talk/m4a/atom.xml"
assert last_response.ok?
end

def test_spezial_category_feed_works
get "/podcast_feed/spezial/m4a/atom.xml"
assert last_response.ok?
end

def test_random_crap_fails
get "/lol/catpoop.php"
assert !last_response.ok?
end

def test_that_all_posts_work
get "/archives"
last_response.body.scan(/a href="(.*)"/).each do |match|
get match[0]
assert last_response.ok?
end
end

end

0 comments on commit 120de43

Please sign in to comment.