This is code in 开发者_运维知识库a model: def find_tech Category.find_by_name(\"tech\") end and this is the rspec test:
Very simple spec... @post.user.should == @user Spec fails even though both objects are identical in every way except their object_id. ActiveRecord objects should equal (==) if their id\'s are the s
I\'m testing my Rails application with RSpec, but then I ran into a problem. I want a consistent database, therefore I imposed a constraint that some columns can not be null.
I am using Ruby on Rails 3.0.9 and RSpect 2. I am trying to refactoring some spec file in the following way (in order to test with less code similar User cl开发者_JS百科ass object attribute values):
I am using Ruby on Rails 3.0.9 and RSpect 2. I am trying to refactoring some spec file in the following way (in order to test with less code similar User class object attribute values):
I am needing to stub the response of a current_user method in an Rspec/capybara request spec. The method is defined in ApplicationController and is using helper_method. The method should simply return
They say the perfect test just includes the test framework and the class being tested; everything else should be mocked. Then, what about associations?
I am using Ruby on Rails 3.0.10, RSpec 2 and FactoryGirl. I have the following scenario: In the models/user_spec.rb file I have
I am using Ruby on Rails 3.0.9 and RSpec 2. I would like to know what \"validation logic\" I should test. That is, if in my model I have:
I am using Rub开发者_如何学编程y on Rails 3.0.9 and RSpec 2. I would like to know how I can\\should run test for the following validation mathod: