diff --git a/spec/form/field_spec.cr b/spec/form/field_spec.cr index 1731b28..37a13f6 100644 --- a/spec/form/field_spec.cr +++ b/spec/form/field_spec.cr @@ -9,6 +9,7 @@ WebMock.stub(:get, "example.com/form/fields").to_return(body:
+
@@ -33,8 +34,19 @@ describe "Form Fields" do # dom_id and class returns empty string if there are no id, class field.dom_id.should eq "" field.dom_class.should eq "" - field = form.fields[1] + field = form.fields[2] field.dom_id.should eq "emailID" field.dom_class.should eq "emailClass" end + + it "can be found by field_with method" do + name_field = form.field_with("name") + name_field.name.should eq "name" + end + + it "can be found by fields_with method" do + name_fields = form.fields_with("name") + name_fields.size.should eq 2 + name_fields[0].name.should eq "name" + end end