I'm not sure what you are trying to do.  You've given us a single line of 
HTML, with an input field that has a (presumably unique if your team cares 
that their HTML is valid) ID value, yet your code is identifying most of 
the input fields by index within some other object.   Since I can't see any 
container objects in the HTML you gave, I can't tell which line of that 
code is trying to interact with the input field you gave.  All of which 
makes it very difficult to assist you.  Can you provide more of the HTML 
please, and indicate specifically which line in the code you presented is 
the one that is failing. 

On Sunday, March 24, 2013 10:29:48 AM UTC-7, hillary wrote:
>
> I'm currently trying to test my rails app using rspec and watir. But i'm 
> having problems filling out rails generated form fields. When I try to set 
> the field (using both set and value ==) I get the following error: 
> undefined method `set' for #<ActiveSupport::SafeBuffer:0x572aaf8>. I also 
> get a similar error when trying to do when_present or flash. 
>
> I've setup my tests within the apps spec folder. When the test runs it's 
> starting up the test server. I'm using the following gems: rspec-rails, 
> waitr-rspec, watir-rails. 
>
> the html of the field i'm trying to set is : 
>
> <input id="trip_type_name" name="trip_type[name" size="30" type="text">
>
> This is my spec: 
> require 'spec_helper'
>
> describe "TripTypes" do
>   before :all do
>     goto "/"
>   end
>
>   it 'loads the form after clicking the "Add Type" Button' do
>     link(:id, "add-trip-type").when_present.click
>     form(:id, "new_trip_type").should be_visible
>   end
>
>   context "with Variable Options" do
>
>     before :all do
>       @type_name = Faker::Lorem.sentence(2)
>       @field_one = Faker::Lorem.word
>       @field_two = Faker::Lorem.word
>     end
>
>     it "fills in the trip type name" do
>       text_field(:index, 0).set @type_name
>     end
>
>     it "adds the first field" do
>        link(:id, "add-field").click
>        tr(:index, 1).text_field(:index, 0).set @field_one
>     end
>
>     it "adds the variable field" do
>       link(:id, "add-field").click
>       tr(:index, 2).text_field(:index, 0).set @field_two
>     end
>
>     it "clicks Create Trip Type" do
>       button(:id, "create-trip-type").click
>     end
>
>     it "displays the trip type in the trip types table" do
>       div(:class, /alert-success/).should be_visible
>       div(:class, /alert-success/).text.should include "Successfully 
> created trip type."
>       table(:id, "trip-types-table").tr(:index, 1).td(:index, 
> 0).text.should == @type_name
>     end
>   end
> end
>
>
> The first test is failing. The other two fields fill in tests are passing. 
> Both of the fields i can set are created using a jquery add_fields 
> function. 
>
> Also when i try to manually set the field on the standard rails server 
> :3000 it works fine.
>
> i'm not sure what's going on.  
>
>
>
>
>

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to