Remove unused interactions method in post controller
This commit is contained in:
parent
ad53a43f88
commit
04735ce9b0
4 changed files with 0 additions and 47 deletions
|
|
@ -3,10 +3,6 @@
|
|||
//require ../post
|
||||
|
||||
app.models.Post.Interactions = Backbone.Model.extend({
|
||||
url : function(){
|
||||
return this.post.url() + "/interactions";
|
||||
},
|
||||
|
||||
initialize : function(options){
|
||||
this.post = options.post;
|
||||
this.comments = new app.collections.Comments(this.get("comments"), {post : this.post});
|
||||
|
|
|
|||
|
|
@ -39,16 +39,6 @@ class PostsController < ApplicationController
|
|||
head :not_found
|
||||
end
|
||||
|
||||
def interactions
|
||||
respond_to do |format|
|
||||
format.json {
|
||||
post = post_service.find!(params[:id])
|
||||
render json: PostInteractionPresenter.new(post, current_user)
|
||||
}
|
||||
format.any { head :not_acceptable }
|
||||
end
|
||||
end
|
||||
|
||||
def mentionable
|
||||
respond_to do |format|
|
||||
format.json {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ Rails.application.routes.draw do
|
|||
|
||||
resources :posts, only: %i(show destroy) do
|
||||
member do
|
||||
get :interactions
|
||||
get :mentionable
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -129,38 +129,6 @@ describe PostsController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
describe "#interactions" do
|
||||
context "user not signed in" do
|
||||
it "returns a 401 for private posts and format json" do
|
||||
get :interactions, params: {id: post.id}, format: :json
|
||||
expect(response.status).to eq(401)
|
||||
expect(JSON.parse(response.body)["error"]).to eq(I18n.t("devise.failure.unauthenticated"))
|
||||
end
|
||||
|
||||
it "returns a 406 for private posts and format html" do
|
||||
get :interactions, params: {id: post.id}
|
||||
expect(response.status).to eq(406)
|
||||
end
|
||||
end
|
||||
|
||||
context "user signed in" do
|
||||
before do
|
||||
sign_in alice
|
||||
end
|
||||
|
||||
it "shows interactions of a post as json" do
|
||||
get :interactions, params: {id: post.id}, format: :json
|
||||
expect(response.body).to eq(PostInteractionPresenter.new(post, alice).to_json)
|
||||
end
|
||||
|
||||
it "returns a 406 for format html" do
|
||||
sign_in alice
|
||||
get :interactions, params: {id: post.id}
|
||||
expect(response.status).to eq(406)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#mentionable" do
|
||||
context "with a user signed in" do
|
||||
before do
|
||||
|
|
|
|||
Loading…
Reference in a new issue