Skip to content

Commit

Permalink
fix spec and use controller_path in mongoid
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmcaliley committed Apr 2, 2013
1 parent a6e8ac2 commit 23ce2b2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Expand Up @@ -3,8 +3,8 @@
# 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
2 changes: 1 addition & 1 deletion test_app/spec/controllers/impressionist_uniqueness_spec.rb
Expand Up @@ -294,7 +294,7 @@

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")
Expand Down

0 comments on commit 23ce2b2

Please sign in to comment.