Top "Shoulda" questions

Shoulda, developed by thoughtbot, provides constructs for organizing Test::Unit tests and matchers for testing Ruby on Rails applications that work with Test::Unit or RSpec.

How to run Rails console in the test environment and load test_helper.rb?

The background: I'm having some problems with Thoughtbot's "Factory Girl" gem, with is used to create objects to use in …

ruby-on-rails ruby testing shoulda
How can I test :inclusion validation in Rails using RSpec

I have the following validation in my ActiveRecord. validates :active, :inclusion => {:in => ['Y', 'N']} I am using the …

ruby-on-rails-3 shoulda rspec-rails
How do you specify POST params in a Rails test?

Working with Test::Unit and Shoulda. Trying to test Users.create. My understanding is that Rails forms send params for …

ruby-on-rails ruby testing shoulda
when does factory girl create objects in db?

I am trying to simulate a session using FactoryGirl/shoulda (it worked with fixtures but i am having problems with …

ruby-on-rails shoulda factory-bot
Shoulda/RSpec matchers - conditional validation

In my code I had the following validation with Shoulda matchers, which works fine: it { should validate_presence_of(:name) } …

ruby-on-rails ruby rspec shoulda
Setup Factory Girl with Test::Unit and Shoulda

I'm trying to set up Factory Girl with Test::Unit and Shoulda in Ruby on Rails. I have installed the …

ruby-on-rails ruby shoulda factory-bot testunit
Can't get uniqueness validation test pass with shoulda matcher

I have a shoulda matcher in my avatar_parts_spec.rb and I can't get it pass: Test: require 'rails_…

ruby-on-rails ruby ruby-on-rails-3 sqlite shoulda
How can I use `should validate_presence_of` with a custom error message?

I'm testing my ActiveRecord models with Rspec. I've just added a custom error message to one of my validations, like …

ruby activerecord rspec shoulda
Rspec, shoulda, validate_uniqueness_of with scope and wrong error message

I have following Rspec test: describe Productlimit do before(:each) do @productlimit = Factory.create(:productlimit, :user => Factory.create(:user)) …

ruby-on-rails ruby-on-rails-3 validation rspec shoulda
shoulda-matchers RSpec expect syntax

What is the correct format for using shoulda-matchers and RSpec's new expect syntax?

rspec shoulda