fix spec and use controller_path in mongoid

This commit is contained in:
John McAliley 2013-04-01 22:40:09 -04:00
parent a6e8ac2418
commit 23ce2b201e
2 changed files with 3 additions and 3 deletions

View File

@ -3,7 +3,7 @@ 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)

View File

@ -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")