Skip to content

Instantly share code, notes, and snippets.

@hyperbolic-motion
Created April 13, 2012 22:52
Show Gist options
  • Save hyperbolic-motion/2380657 to your computer and use it in GitHub Desktop.
Save hyperbolic-motion/2380657 to your computer and use it in GitHub Desktop.
Rspec: test factory works as advertised
require 'spec_helper'
# -------------------------------------------------
# Just build a model instance using a factory
# and assert that it is valid
#
# Model => model class
# @base_model => model instance
# :model => factory name
#
# Note:
# config.include FactoryGirl::Syntax::Methods
# must be in the spec_helper.rb
# -------------------------------------------------
describe Model do
before do
@base_model = build(:model)
end
subject {@base_model}
it {should be_valid}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment