Skip to content

Instantly share code, notes, and snippets.

@dbussink
Created August 2, 2008 14:39
Show Gist options
  • Save dbussink/3738 to your computer and use it in GitHub Desktop.
Save dbussink/3738 to your computer and use it in GitHub Desktop.
diff --git a/spec/integration/association_spec.rb b/spec/integration/association_spec.rb
index 953338c..bbad032 100644
--- a/spec/integration/association_spec.rb
+++ b/spec/integration/association_spec.rb
@@ -370,6 +370,13 @@ if ADAPTER
Machine.first(:name => 'machine10').should_not be_nil
end
+ it 'should set and retrieve associations on not yet saved objects' do
+ e = Machine.create(:name => 'machine10')
+ y = e.areas.build(:name => 'area10')
+
+ y.machine.name.should == 'machine10'
+ end
+
it 'should convert NULL parent ids into nils' do
Area.first(:name => 'area2').machine.should be_nil
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment