Skip to content

Instantly share code, notes, and snippets.

View shannonwells's full-sized avatar
🦞
long live Rust

Shannon Wells shannonwells

🦞
long live Rust
View GitHub Profile
@shannonwells
shannonwells / rspec_snippets.rb
Last active August 29, 2015 13:55
My favorite rspec snippets
# Sanity tests for factories and persistence in db
# Makes sure you have not inadvertently hosed validation, and suchlike when models are changed
shared_examples_for 'a model' do |factory, factory_params = {}|
let(:model) { FactoryGirl.build(factory, factory_params) }
it 'can be persisted' do
expect(model).to be_valid
model.save!
expect(model).to be_persisted
end