Last active
August 29, 2015 14:01
-
-
Save cmilfont/71814ed0c6efa09314e6 to your computer and use it in GitHub Desktop.
Incomplete, but an idea about that DHH wrote https://gist.github.com/dhh/4849a20d2ba89b34b201
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#RSPEC | |
require 'spec_helper' | |
describe EmployeesController do | |
let(:employee_params) { ... } | |
describe "POST create" do | |
it "should create bla bla bla" do | |
employee = mock_model(Employee, id: 666) | |
Employee.should_receive(:create).with(employee_params).and_return employee | |
post :create, employee: employee_params | |
end | |
end | |
end | |
#RAILS CONTROLLER | |
class EmployeesController < ApplicationController | |
def create | |
@employee = Employee.create(employee_params) | |
respond_with @employee | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment