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, radiobuttons, checkboxes, buttons" do # fields: input type = (text,hidden, or others) form.fields.size.should eq 4 form.checkboxes.size.should eq 1 form.radiobuttons.size.should eq 3 form.buttons.size.should eq 4 end end