Skip to content

Instantly share code, notes, and snippets.

@d11wtq
Created October 23, 2011 01:28
Show Gist options
  • Save d11wtq/1306732 to your computer and use it in GitHub Desktop.
Save d11wtq/1306732 to your computer and use it in GitHub Desktop.
Failures:
1) Acquisto::ReflectiveRoutes with a model containing a 1:n relationship generates a route to fetch the child collection
Failure/Error: model.finalize
NameError:
Cannot find the child_model Invoice for Customer in invoices
# ./spec/unit/reflective_routes_spec.rb:11:in `block (2 levels) in <top (required)>'
context "with a model containing a 1:n relationship" do
let!(:invoice_model) do
Class.new do
def self.name
"Invoice"
end
include DataMapper::Resource
property :id, DataMapper::Property::Serial
property :price, DataMapper::Property::Integer
belongs_to :customer
end
end
let!(:model) do
Class.new do
def self.name
"Customer"
end
include DataMapper::Resource
property :id, DataMapper::Property::Serial
property :name, DataMapper::Property::String
has n, :invoices
end
end
let(:customer) { model.create(:name => "Bob") }
let(:invoice) { model.invoices.create(:price => 20) }
# ... examples follow ...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment