Skip to content

Instantly share code, notes, and snippets.

@fidothe
Created March 18, 2015 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fidothe/a4f35b4f0102169f097a to your computer and use it in GitHub Desktop.
Save fidothe/a4f35b4f0102169f097a to your computer and use it in GitHub Desktop.
Approaching App Controller load problem
require 'spec_helper'
require_relative '../../../../apps/api/application'
RSpec.describe "Api::Controllers::Stuff::Create" do
let(:action) { Api::Controllers::Stuff::Create.new }
before(:all) do
Api::Application.preload!
end
context "successfully performing the action" do
it "causes stuff to happen" do
thing = double()
expect(Stuff).to receive(:new).with({a: 'b'}) { thing }
expect(StuffRepository).to receive(:happen).with(thing)
action.call(stuff: {a: 'b'})
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment