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