Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

because Rack::Test is the new hotness

  • Loading branch information...
commit 58e51d446d3e7405e0bb15c08f83183f5fb070d2 1 parent 46c5378
@zapnap zapnap authored
Showing with 11 additions and 7 deletions.
  1. +1 −1  Rakefile
  2. +9 −5 spec/application_spec.rb
  3. +1 −1  spec/spec_helper.rb
View
2  Rakefile
@@ -36,7 +36,7 @@ end
namespace :gems do
desc 'Install required gems'
task :install do
- required_gems = %w{ sinatra rspec dm-core dm-validations
+ required_gems = %w{ sinatra rspec rack-test dm-core dm-validations
dm-aggregates haml twitter rspec_hpricot_matchers }
required_gems.each { |required_gem| system "sudo gem install #{required_gem}" }
end
View
14 spec/application_spec.rb
@@ -1,7 +1,11 @@
require "#{File.dirname(__FILE__)}/spec_helper"
describe 'main application' do
- include Sinatra::Test
+ include Rack::Test::Methods
+
+ def app
+ Sinatra::Application.new
+ end
before(:each) do
@status = mock('Status', :null_object => true)
@@ -10,14 +14,14 @@
specify "should show the default index page" do
get '/'
- @response.should be_ok
- @response.body.should match(/#{SiteConfig.title}/)
+ last_response.should be_ok
+ last_response.body[0].should have_tag('title', /#{SiteConfig.title}/)
end
specify 'should show the most recent statuses' do
Status.should_receive(:random).and_return([@status])
get '/'
- @response.should be_ok
- @response.should have_tag('li', /#{@status.text}/, :count => 1)
+ last_response.should be_ok
+ last_response.body.should have_tag('li', /#{@status.text}/, :count => 1)
end
end
View
2  spec/spec_helper.rb
@@ -2,7 +2,7 @@
require 'sinatra'
require 'spec'
require 'spec/interop/test'
-require 'sinatra/test'
+require 'rack/test'
require 'rspec_hpricot_matchers'
# set test environment
Please sign in to comment.
Something went wrong with that request. Please try again.