Skip to content

Instantly share code, notes, and snippets.

@thomasv314
Created February 29, 2012 00:46
Show Gist options
  • Save thomasv314/1936611 to your computer and use it in GitHub Desktop.
Save thomasv314/1936611 to your computer and use it in GitHub Desktop.
class BusinessesController < ApplicationController
# GET /businesses/new
# GET /businesses/new.json
def new
@business = Business.new
@business_address = BusinessAddress.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @business }
end
end
end
describe BusinessesController do
def valid_attributes
{ :business => { :name => "My Test Biz", :id => 1 } }
end
describe "GET new" do
it "assigns a new business as @business and a new business address as @business_address" do
get :new, {}, valid_session
assigns(:business).should be_a_new(Business)
assigns(:business_address).should be_a_new(BusinessAddress)
end
end
end
Failures:
1) BusinessesController GET new assigns a new business as @business and a new business address as @business_address
Failure/Error: assigns(:business).should be_a_new(Business)
expected nil to be a new Business(id: integer, name: string, created_at: datetime, updated_at: datetime)
# ./spec/controllers/businesses_controller_spec.rb:43:in `block (3 levels) in <top (required)>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment