Remove unused interactions method in post controller

This commit is contained in:
Steffen van Bergerem 2016-11-12 14:46:23 +01:00
parent ad53a43f88
commit 04735ce9b0
No known key found for this signature in database
GPG key ID: 315C9787D548DC6B
4 changed files with 0 additions and 47 deletions

View file

@ -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});

View file

@ -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 {

View file

@ -29,7 +29,6 @@ Rails.application.routes.draw do
resources :posts, only: %i(show destroy) do
member do
get :interactions
get :mentionable
end

View file

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