Module: Intermodal::RSpec::HasParentResource

Extended by:
ActiveSupport::Concern
Defined in:
lib/intermodal/rspec/models/has_parent_resource.rb

Overview

All Intermodal nested resource controllers require models that belongs to an parent object that belongs to an account. It should also respond to #get and verify authorization for the account.

This RSpec macro tests these assumptions.

Usage:

class ParentResource < ActiveRecord::Base

include Intermodal::Models::Accountability

end

class NestedResource < ActiveRecord::Base

include Intermodal::Models::HasParentResources

parent_resource :parent_resource

end

describe NestedResource do

include Intermodal::RSpec::HasParentResource

concerned_with_parent_resource :parent_resource

end

It works with Remarkable. It might work with Shoulda

If you don’t want to use either, you can pass:

describe NestedResource do

include Intermodal::RSpec::HasParentResource

let(:parent_resource_name) { :parent_resource }
let(:different_parent) { ParentResource.make!(:account => ) }
let(:parent_with_different_account) { ParentResource.make!(:account => ) }
let(:different_account) { Account.make! }

implements_get_interface_for_nested_resource

end

Defined Under Namespace

Modules: ClassMethods