fix spec and use controller_path in mongoid
This commit is contained in:
parent
a6e8ac2418
commit
23ce2b201e
|
@ -3,8 +3,8 @@ ImpressionistController::InstanceMethods.send(:define_method, :direct_create_sta
|
|||
# if :impressionable_id is a valid ObjectId then convert it into one
|
||||
base = (defined? Moped) ? Moped::BSON : BSON
|
||||
query_params.reverse_merge!(
|
||||
:impressionable_type => controller_name.singularize.camelize,
|
||||
:impressionable_type => controller_path.singularize.camelize,
|
||||
:impressionable_id=> !base::ObjectId.legal?(params[:id]) ? params[:id] : base::ObjectId.from_string(params[:id])
|
||||
)
|
||||
associative_create_statement(query_params)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -294,7 +294,7 @@ describe DummyController do
|
|||
|
||||
it "should recognize uniqueness" do
|
||||
impressionable = Post.create
|
||||
controller.stub!(:controller_name).and_return("posts") # for correct impressionable type in filter
|
||||
controller.stub!(:controller_path).and_return("posts") # for correct impressionable type in filter
|
||||
controller.stub!(:params).and_return({:id => impressionable.id.to_s}) # for correct impressionable id in filter
|
||||
controller.stub!(:session_hash).and_return("foo")
|
||||
controller.request.stub!(:remote_ip).and_return("1.2.3.4")
|
||||
|
|
Loading…
Reference in New Issue