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?
This is not “the new syntax.” It is simply an alternate syntax that has
been around for over a year and works well for a small subset of things
you might want to specify like initial state:
describe Array do
context “when first created” do
subject { Array.new }
its(:length) { should eq(0) }
end
end
It is not in any way an all-purpose replacement for more specifying behaviour.
so the header was not sent with it. how to mock it?
I don’t have any personal experience w/ Sinatra yet (I know, I know, but
there are only so many hours in a day), so I’ll leave it to someone else
to comment on how to approach the Sinatra questions.