Skip to content

Commit

Permalink
Minor test changes
Browse files Browse the repository at this point in the history
  • Loading branch information
paulcarey committed Aug 15, 2009
1 parent f8aa105 commit 25fcac4
Showing 1 changed file with 14 additions and 20 deletions.
34 changes: 14 additions & 20 deletions spec/has_many_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,29 @@

describe "target_class in the generated view" do
it "should infer the class name from the relationship if not supplied" do
view = mock(:view)
view = mock(:view).as_null_object
RelaxDB::ViewCreator.should_receive(:has_n).with(
"", # client_class
:foos, # relationship
"Foo", # target_class
"" # relationship_to_client
).and_return( view )
view.should_receive(:save)
"", # client_class
:foo_bars, # relationship
"FooBar", # target_class
"" # relationship_to_client
).and_return view
klass = Class.new(RelaxDB::Document) do
has_many :foos
has_many :foo_bars
end
o = klass.new()
o.foos rescue nil # rescue 405 due to anonymous class name in URL
end

it "should use the class name if supplied" do
view = mock(:view)
view = mock(:view).as_null_object
RelaxDB::ViewCreator.should_receive(:has_n).with(
"", # client_class
:foos, # relationship
"Boat", # target_class
"" # relationship_to_client
).and_return( view )
view.should_receive(:save)
"", # client_class
:foo_bars, # relationship
"Bar", # target_class
"" # relationship_to_client
).and_return view
klass = Class.new(RelaxDB::Document) do
has_many :foos, :class => "Boat"
has_many :foo_bars, :class => "Bar"
end
o = klass.new()
o.foos rescue nil # rescue 405 due to anonymous class name in URL
end
end

Expand Down

0 comments on commit 25fcac4

Please sign in to comment.