Will
Will

Reputation: 182

Rspec getting undefined method error when I try to use fill_in on text field

Totally revising this question, since I fixed the first issue but have ran into a new one. My code now looks like this-

it 'should return on a partial match of Subject ID' do
  visit newpatient_path
  fill_in :subject_id, :with => "0303"
  click_button "Find Patient"
  response.should redirect_to(searchresult_path())
end

When I run this I get the following error-

  Patients SEARCH patient should return on a partial match of Subject ID
 Failure/Error: fill_in :subject_id,    :with => "0303"
 Webrat::NotFoundError:
   Could not find field: :subject_id
 # ./spec/requests/patients_spec.rb:26:in `block (3 levels) in <top (required)>'

subject_id is the text_field value for the field in question. Not sure why I can't find it? Thanks in advance!

Upvotes: 0

Views: 687

Answers (1)

Stobbej
Stobbej

Reputation: 1090

I am no Webrat expert, but doesn't the fill_in method expect a String as its first argument? You are passing a Symbol; don't know whether that's allowed.

Upvotes: 1

Related Questions