Skip to content

Instantly share code, notes, and snippets.

View StefSchenkelaars's full-sized avatar

Stef Schenkelaars StefSchenkelaars

View GitHub Profile
@fotinakis
fotinakis / cancan_matchers.rb
Last active December 8, 2023 14:18
Custom rspec matcher for testing CanCan abilities
# Custom rspec matcher for testing CanCan abilities.
# Originally inspired by https://github.com/ryanb/cancan/wiki/Testing-Abilities
#
# Usage:
# should have_abilities(:create, Post.new)
# should have_abilities([:read, :update], post)
# should have_abilities({manage: false, destroy: true}, post)
# should have_abilities({create: false}, Post.new)
# should not_have_abilities(:update, post)
# should not_have_abilities([:update, :destroy], post)
@bigfive
bigfive / example_mailer_spec.rb
Created January 7, 2014 08:14
ActionMailer RSpec helpers. Makes mailer test more similar to controller tests in that you can test that instance variables are assigned for rendering
require "spec_helper"
describe ExampleMailer do
describe :new_user do
let(:user) { FactoryGirl.create :user }
it "sends to the correct addresses" do
# :mail is similar to the controller specs 'get', 'post' etc methods
mail :new_user, user
@Arwid
Arwid / Gemfile
Created January 7, 2012 23:07
Sprockets compilation of assets
source 'http://rubygems.org'
gem 'sass'
gem 'coffee-script'
gem 'yui-compressor'
gem 'handlebars_assets'
gem 'sprockets'
gem 'rb-fsevent'