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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:10:20+00:00 2026-06-16T11:10:20+00:00

I have a still pretty simple Rails application that I want to develop using

  • 0

I have a still pretty simple Rails application that I want to develop using BDD with Cucumber and TDD with RSpec. Currently, I am hanging at a test where I want to check that if a new instance of an Organizer (that’s the model I have) cannot be created due to a validation error. I would like to check that the errors Array of the object to be created is not empty so that I can be sure that error messages are available for showing them in the view.

require ‘spec_helper’

describe OrganizersController do
render_views

describe "POST 'create'" do

  describe "with invalid arguments" do
    before(:each) do
      request.env["HTTP_REFERER"] = organizers_new_path
      @organizer_args = { :name => "" }
    end      

    it "should return a non-empty list of errors" do
      post 'create', :organizer => @organizer_args
      @organizer.errors.empty?.should_not be_true
    end
  end
end      

end

I am developing based on Rails 3.2.9 with RSpec 2 and cucumber-rails.

Any suggestions are appreciated. 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-06-16T11:10:23+00:00Added an answer on June 16, 2026 at 11:10 am

    You should use assigns method to get instance variable from controller action:

    assigns(:organizer).errors.empty?.should_not be_true
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have something pretty simple I want to do. I'm still working through all
I am still pretty new to using jQuery to do anything, but I have
I have a probably pretty simple question but I am still not sure! Actually
I have a pretty simple question, but am still finding my way around cocoa.
I have a pretty simple scenario using manual data operations with rad list view.
Simple question. I have a ActiveRecord model that I want to perform post processing
I have some pretty basic code to capture a still image using AVFoundation. AVCaptureDeviceInput
I have the following seemingly simple scenario, however I'm still pretty new to NHibernate.
I have some pretty simple code that reads lines from a network stream that
I have this pretty simple jquery example: http://jsfiddle.net/clifgray/NTd95/1/ and in that jsfiddle it works

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.