Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6364297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:08:47+00:00 2026-05-25T00:08:47+00:00

Trying to get started on view testing in Rails 3. I want to validate

  • 0

Trying to get started on view testing in Rails 3. I want to validate that I have a form getting kicked out in the view that has the right URL for the action. So I am using assert_select. I actually got a failing test first, using this syntax in the spec (using Rspec):

response.should assert_select "form[action=#{my_model_path}]"

Looking at the rendered HTML, sure enough, the view was rendering the ‘edit’ url, not the ‘new’ url due to the wrong model being passed down. Groovy, start red.

I make the model a ‘new’ one, and I look at my rendered output, and it’s what I’d expect, BUT the test fails, and the error message says:

NoMethodError:
   undefined method `matches?' for #<Array:0x0000012a1a5d58>

I’ve looked all over the web for this, found one guy that mentioned the error, but got no resolution. Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T00:08:47+00:00Added an answer on May 25, 2026 at 12:08 am

    Figured out that I could get this to work by nesting my assert_select calls, like so:

    response.should assert_select "form" do
        assert_select "[action=?]", my_model_path
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Complete rails newbie trying to get started. I have two classes, Ingredient, and Unit.
I'm trying to get started with unit testing in Python and I was wondering
I am trying to get started with scons . I have Python 3.0.1 and
i'm trying to get started with silverlight 2. i have a weird bug. every
I'm trying to get started with Django, and have previously worked with CakePHP, and
I'm trying to get started with Ajax on MVC In my main view I
I am trying to get started developing using the .NET Micro Framework but appear
I'm trying to get started with USSD . I'm familiar with other forms of
I am trying to get started writing scalable, telecom-grade applications with Asterisk and Ruby.
I'm trying to get started with Hibernate, and when executing my program I get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.