Adding spec for disabling automatic redirects in Mechanize
This commit is contained in:
parent
b2dddf2f09
commit
56b2f342da
@ -9,6 +9,13 @@ describe Webrat::MechanizeAdapter do
|
|||||||
@mech = Webrat::MechanizeAdapter.new
|
@mech = Webrat::MechanizeAdapter.new
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "mechanize" do
|
||||||
|
it "should disable the following of redirects on the mechanize instance" do
|
||||||
|
mech = @mech.mechanize
|
||||||
|
mech.redirect_ok.should be_false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "post" do
|
describe "post" do
|
||||||
def url
|
def url
|
||||||
'http://test.host/users'
|
'http://test.host/users'
|
||||||
@ -24,7 +31,8 @@ describe Webrat::MechanizeAdapter do
|
|||||||
|
|
||||||
it "should flatten model post data" do
|
it "should flatten model post data" do
|
||||||
mechanize = mock(:mechanize)
|
mechanize = mock(:mechanize)
|
||||||
WWW::Mechanize.stub!(:new => mechanize)
|
mechanize.stub!(:redirect_ok=)
|
||||||
|
Mechanize.stub!(:new => mechanize)
|
||||||
mechanize.should_receive(:post).with(url, flattened_data)
|
mechanize.should_receive(:post).with(url, flattened_data)
|
||||||
Webrat::MechanizeAdapter.new.post(url, data)
|
Webrat::MechanizeAdapter.new.post(url, data)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user