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 6801137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:03:46+00:00 2026-05-26T19:03:46+00:00

Here is the error for update in rspec: 4) CustomersController GET customer page ‘update’

  • 0

Here is the error for update in rspec:

  4) CustomersController GET customer page 'update' should be successful
     Failure/Error: post 'update', customer
     NoMethodError:
       undefined method `symbolize_keys' for "1":String
     # ./spec/controllers/customers_controller_spec.rb:38:in `block (3 levels) in <top (required)>'

The rspec code:

it "'update' should be successful" do

  customer = Factory(:customer)      
  post 'update', customer
  response.should be_success
end

The update in customers controller:

  def update
    @customer = Customer.find(params[:id])
    if @customer.update_attributes(params[:customer], :as => :roles_new_update)
      if @customer.changed
        @message = 'The following info have been changed\n' + @customer.changes.to_s
        @subject ='Customer info was changed BY' + session[:user_name]
        notify_all_in_sales_eng(@message,@subject)
      end  

      redirect_to session[('page'+session[:page_step].to_s).to_sym], :notice => 'Customer was updated successfaully!'
    else
      render 'edit', :notice => 'Customer was not updated!'
    end
  end

Any thoughts about the error? Thanks.

  • 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-26T19:03:46+00:00Added an answer on May 26, 2026 at 7:03 pm

    I will not enter into details on RSpec, but I just met the same error and this is how I would correct it for your code:

    it "'update' should be successful" do
      customer = Factory(:customer)      
      post 'update', :id => customer.id
      response.should be_success
    end
    

    I think you can’t provide your object directly to the post method, you must pass it’s id as in a Hash instead.

    (Please note too that this code assumes your customer exists in the test database, so your Factory must create it.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is rspec code for controller: it should render edit if update was not
s = set('ABC') s.add('z') s.update('BCD') s.remove('DEF') # error here s -= set('DEFG')
Autotest broke with rspec-rails 2.2.1 update. Now I can't get it working again.. .even
Why do I get the following error here when trying to intergrate my site
An odd error here, perhaps someone can help track down source as it's attempting
See the full error here: http://notesapp.heroku.com/ I'm using DataMapper and dm-validations 0.10.2. No matter
CREATE TABLE #Report( Cell int, CellValue double) Error here DECLARE @Report TABLE ( Cell
i am developing parser using bison...in my grammar i am getting this error Here
I suck at php, and cant find the error here. The script gets 2
I'm trying the following: CREATE TABLE Table1 ( RecordNo autonumber, --error here! PersonId varchar(50),

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.