Created
February 29, 2012 00:46
-
-
Save thomasv314/1936611 to your computer and use it in GitHub Desktop.
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
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 |
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
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 |
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
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