require "./spec_helper" WebMock.stub(:get, "example.com/check_form").to_return(body: <<-BODY page_title
BODY ) describe "Mechanize Form test" do agent = Mechanize.new uri = "http://example.com/check_form" page = agent.get(uri) form = page.forms.first it "returns form attribute" do form.action.should eq "post_path" form.method.should eq "POST" form.enctype.should eq "application/x-www-form-urlencoded" form.name.should eq "sample_form" end it "includes fields" do form.fields.size.should eq 2 end end