Skip to content

Instantly share code, notes, and snippets.

@kris-luminar
Created February 11, 2013 03:30
Show Gist options
  • Save kris-luminar/4752280 to your computer and use it in GitHub Desktop.
Save kris-luminar/4752280 to your computer and use it in GitHub Desktop.
trying to create an integration spec to test a nested resource (location is a nested resource of mailbox).
require 'spec_helper'
feature "Editing mailboxes" do
scenario "Updating a mailbox" do
let!(:mailbox) { Factory(:mailbox) }
let!(:location) { Factory(:location, :street_one => "6th NE", :street_two => "Kent NE", :zip => '99999', :city => "Auburn", :state => 'WA', :mailbox => mailbox) }
visit '/'
click_link '6th NE and Kent NE'
click_link 'Edit mailbox'
fill_in "Street One", :with => "7th NW"
click_link "Update mailbox"
page.should have_content "Mailbox has been updated"
page.should have_content "7th NW and Kent NE"
end
end
@kris-luminar
Copy link
Author

I've gotten farther along in the text and I'm now thinking something along these lines will do the trick:

user = Factory(:user)
ticket = Factory(:ticket,
                 :project => textmate_2,
                 :title   => "Make it shiny!",
                 :description => "Gradients! Starbursts! Oh my!")
ticket.update_attribute(:user, user)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment