The sample test has names that will not pass validation.
require 'spec_helper'
describe UsersController do
  render_views
  describe "GET 'index'" do
    describe "for signed-in users" do
      before(:each) do
        @user = test_sign_in(Factory(:user))
        second = Factory(:user, :name => "Bob", :email => "another@example.com")
        third  = Factory(:user, :name => "Ben", :email => "another@example.net")
        @users = [@user, second, third]
      end
      it "should be successful" do
        get :index
        response.should be_success
      end
      it "should have the right title" do
        get :index
        response.should have_selector("title", :content => "All users")
      end
      it "should have an element for each user" do
        get :index
        @users.each do |user|
          response.should开发者_开发百科 have_selector("li", :content => user.name)
        end
      end
    end
  end
  .
  .
  .
end
The name has to be six characters long. Bob and Ben will not pass.
class User < ActiveRecord::Base
  attr_accessor :password
  attr_accessible :name, :email,:password,:password_confirmation
  email_regex = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
  validates :name, :presence => true,
  :length   =>{ :within => 6..40}
The solution (albeit trivial) was to change the names to Bobbob and Benben.
I hope that is helpful for someone.
Best,
Evan
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论