Changes to RSpec Error checking

I am trying to follow a tutorial on TDD with RSpec that contains the following line:

it 'must have a first_name' do
  p = Person.new
  p.should_not be_valid
  p.errors.on(:first_name).should_not be_nil
end

However I receive the following message in my test:

undefined method `on' for #ActiveModel::Errors:0x007fde0c3eceb0>

What is the correct way to write the code above.

Answers


The correct function is errors_on. So that line should be

p.errors_on(:first_name).should_not be_nil

Need Your Help

IsAuthenticated property is still false after user authentication in SignalR

c# asp.net-mvc authentication signalr asp.net-mvc-5

I've a logged in user in my MVC web application, but IsAuthenticated property in my Hub class is still false. Here is my log in and redirection sequences:

How can I find the position of an HTML element relative to the entire desktop screen using JavaScript?

javascript html

How do i find the X,Y coordinates of a particular html element ( eg. div, table, lable, etc...) relative to the desktop screen (i.e. outside the browser window) using JavaScript?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.