spec/rackapp_spec.rb in heel-2.0.0 vs spec/rackapp_spec.rb in heel-3.0.0
- old
+ new
@@ -1,6 +1,6 @@
-require 'spec/spec_helper'
+require 'spec_helper'
require 'rack/mock'
require 'heel/rackapp'
describe Heel::RackApp do
before(:each) do
@@ -8,36 +8,36 @@
@request = Rack::MockRequest.new(@app)
end
it "should return the a listing for the currrent directory" do
res = @request.get("/")
- res.should be_ok
- res['Content-Type'].should == "text/html"
- res.body.should =~ /Rakefile/
+ res.must_be :ok?
+ res['Content-Type'].must_equal "text/html"
+ res.body.must_match( /Rakefile/ )
end
it 'should highlight a ruby file' do
- res = @request.get("/gemspec.rb")
- res.should be_ok
- res['Content-Type'].should == "text/html"
- res.body.should =~ /class="CodeRay"/
+ res = @request.get("/lib/heel.rb")
+ res.must_be :ok?
+ res['Content-Type'].must_equal "text/html"
+ res.body.must_match( /class="CodeRay"/ )
end
it "should not highlight a ruby file if told not to" do
- res = @request.get("/gemspec.rb?highlighting=off")
- res.should be_ok
- res.body.size.should == File.size("gemspec.rb")
- res['Content-Type'].should == "application/x-ruby"
+ res = @request.get("/lib/heel.rb?highlighting=off")
+ res.must_be :ok?
+ res.body.size.must_equal File.size("lib/heel.rb")
+ res['Content-Type'].must_equal "application/x-ruby"
end
it "should return a 405 if given a non-GET request" do
res = @request.post("/")
- res.should_not be_ok
- res.status.should == 405
+ res.wont_be :ok?
+ res.status.must_equal 405
end
it "should return a 403 if accessing an invalid location" do
res = @request.get("/../../../../etc/passwd")
- res.should_not be_ok
- res.status.should == 403
+ res.wont_be :ok?
+ res.status.must_equal 403
end
end