Sha256: 6a1be215a325732eddde32ccd02e550721ed0d88f1c98658c3153695aaf10dd3
Contents?: true
Size: 1.28 KB
Versions: 2
Compression:
Stored size: 1.28 KB
Contents
require 'rubygems' require 'test/unit' require 'shoulda' require 'rack/test' require 'hpricot' $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'serious' class Test::Unit::TestCase include Rack::Test::Methods Serious.set :title, "Serious Test Blog" Serious.set :articles, File.join(File.dirname(__FILE__), 'articles') StupidFormatter.chain = [StupidFormatter::Erb, StupidFormatter::RDiscount] def app Serious end def self.should_contain_elements(count, selector) should "contain #{count} elements in '#{selector}'" do doc = Hpricot.parse(last_response.body) assert_equal count, (doc/selector).size end end def self.should_respond_with(status) should "respond with #{status}" do assert_equal status, last_response.status end end def self.should_contain_text(text, selector) should "contain '#{text}' in '#{selector}'" do doc = Hpricot.parse(last_response.body) assert_match /#{text}/, (doc/selector).inner_html end end def self.should_not_contain_text(text, selector) should "not contain '#{text}' in '#{selector}'" do doc = Hpricot.parse(last_response.body) assert_no_match /#{text}/, (doc/selector).inner_html end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
serious-0.1.2 | test/helper.rb |
serious-0.1.1 | test/helper.rb |