I am specing a sinatra app.
it "should send non-valid user to /login" do
get '/'
last_response.headers['Location'].should == '/reports'
end
this is working fine but I would like to know how to convert it to the
new syntax or if there is a better way to do that.
before(:each) { get '/' }
subject { last_response }
its(:status) {should == 302}
require 'ap'
its(:headers) {should include('/login')}
another question:
it "should send valid user to /reports" do
get '/', { 'HTTP_AUTHORIZATION' => 'Basic
c2cvbGFuOmFBITExMQ==' }
last_response.headers['Location'].should == '/reports'
end
when i debug my method I see that request.env["HTTP_AUTHORIZATION"] is
nil,
so the header was not sent with it. how to mock it?
Thanks
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users