Fix code styles
This commit is contained in:
parent
e6fd043206
commit
b4dc13f1ce
10 changed files with 49 additions and 52 deletions
|
|
@ -31,7 +31,6 @@ module Api
|
|||
def comment_service
|
||||
@comment_service ||= CommentService.new(current_user)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -53,7 +53,6 @@ module Api
|
|||
aspect_ids
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -222,14 +222,14 @@ Rails.application.routes.draw do
|
|||
get "podmin", to: "home#podmin"
|
||||
|
||||
api_version(module: "Api::V0", path: {value: "api/v0"}, default: true) do
|
||||
match "user", to: "users#show", via: %i(get post)
|
||||
resources :posts, only: %i(show create destroy) do
|
||||
resources :comments, only: %i(create destroy)
|
||||
resources :likes, only: %i(create destroy)
|
||||
match "user", to: "users#show", via: %i[get post]
|
||||
resources :posts, only: %i[show create destroy] do
|
||||
resources :comments, only: %i[create destroy]
|
||||
resources :likes, only: %i[create destroy]
|
||||
end
|
||||
resources :conversations, only: %i(show index create destroy) do
|
||||
resources :conversations, only: %i[show index create destroy] do
|
||||
delete "visibility" => "conversation_visibilities#destroy"
|
||||
resources :messages, only: %i(index create)
|
||||
resources :messages, only: %i[index create]
|
||||
end
|
||||
get "activity" => "streams#activity", :as => "activity_stream"
|
||||
get "stream" => "streams#multi", :as => "stream"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ describe Api::V0::CommentsController do
|
|||
let!(:access_token) { auth.create_access_token.to_s }
|
||||
|
||||
before do
|
||||
@status = auth.user.post("Post",
|
||||
@status = auth.user.post(
|
||||
"Post",
|
||||
status_message: {text: "This is a status message"},
|
||||
public: true,
|
||||
to: "all",
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ describe Api::V0::ConversationsController do
|
|||
|
||||
context "without valid data" do
|
||||
it "fails at creating the conversation" do
|
||||
post api_v0_conversations_path, params: { access_token: access_token }
|
||||
post api_v0_conversations_path, params: {access_token: access_token}
|
||||
expect(response.status).to eq 400
|
||||
end
|
||||
end
|
||||
|
|
@ -62,7 +62,7 @@ describe Api::V0::ConversationsController do
|
|||
end
|
||||
|
||||
it "returns all the user conversations" do
|
||||
get api_v0_conversations_path, params: { access_token: access_token }
|
||||
get api_v0_conversations_path, params: {access_token: access_token}
|
||||
expect(response.status).to eq 200
|
||||
expect(JSON.parse(response.body).length).to eq 3
|
||||
end
|
||||
|
|
@ -70,7 +70,7 @@ describe Api::V0::ConversationsController do
|
|||
it "returns all the user unread conversations" do
|
||||
get(
|
||||
api_v0_conversations_path,
|
||||
params: { unread: true, access_token: access_token }
|
||||
params: {unread: true, access_token: access_token}
|
||||
)
|
||||
expect(response.status).to eq 200
|
||||
expect(JSON.parse(response.body).length).to eq 2
|
||||
|
|
@ -79,7 +79,7 @@ describe Api::V0::ConversationsController do
|
|||
it "returns all the user conversations after a given date" do
|
||||
get(
|
||||
api_v0_conversations_path,
|
||||
params: { only_after: @date, access_token: access_token }
|
||||
params: {only_after: @date, access_token: access_token}
|
||||
)
|
||||
expect(response.status).to eq 200
|
||||
expect(JSON.parse(response.body).length).to eq 1
|
||||
|
|
@ -96,7 +96,7 @@ describe Api::V0::ConversationsController do
|
|||
conversation_guid = JSON.parse(response.body)["conversation"]["guid"]
|
||||
get(
|
||||
api_v0_conversation_path(conversation_guid),
|
||||
params: { access_token: access_token }
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
expect(response.status).to eq 200
|
||||
conversation = JSON.parse(response.body)["conversation"]
|
||||
|
|
@ -111,7 +111,7 @@ describe Api::V0::ConversationsController do
|
|||
it "returns a not found error (404)" do
|
||||
get(
|
||||
api_v0_conversation_path(42),
|
||||
params: { access_token: access_token }
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
expect(response.status).to eq 404
|
||||
end
|
||||
|
|
@ -141,17 +141,17 @@ describe Api::V0::ConversationsController do
|
|||
it "destroys the first participant visibility" do
|
||||
delete(
|
||||
api_v0_conversation_path(@conversation_guid),
|
||||
params: { access_token: access_token }
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
expect(response.status).to eq 204
|
||||
get api_v0_conversation_path(
|
||||
@conversation_guid,
|
||||
params: { access_token: access_token }
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
expect(response.status).to eq 404
|
||||
get api_v0_conversation_path(
|
||||
@conversation_guid,
|
||||
params: { access_token: access_token_participant }
|
||||
params: {access_token: access_token_participant}
|
||||
)
|
||||
expect(response.status).to eq 200
|
||||
end
|
||||
|
|
@ -161,17 +161,17 @@ describe Api::V0::ConversationsController do
|
|||
it "destroys the second participant visibilty and the conversation" do
|
||||
delete(
|
||||
api_v0_conversation_path(@conversation_guid),
|
||||
params: { access_token: access_token }
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
delete(
|
||||
api_v0_conversation_path(@conversation_guid),
|
||||
params: { access_token: access_token_participant }
|
||||
params: {access_token: access_token_participant}
|
||||
)
|
||||
expect(response.status).to eq 204
|
||||
|
||||
get api_v0_conversation_path(
|
||||
@conversation_guid,
|
||||
params: { access_token: access_token_participant }
|
||||
params: {access_token: access_token_participant}
|
||||
)
|
||||
expect(response.status).to eq 404
|
||||
|
||||
|
|
@ -185,7 +185,7 @@ describe Api::V0::ConversationsController do
|
|||
it "returns a not found error (404)" do
|
||||
delete(
|
||||
api_v0_conversation_path(42),
|
||||
params: { access_token: access_token }
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
expect(response.status).to eq 404
|
||||
end
|
||||
|
|
@ -195,5 +195,4 @@ describe Api::V0::ConversationsController do
|
|||
def conversation_service
|
||||
ConversationService.new(alice)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ describe Api::V0::LikesController do
|
|||
it "returns the expected author" do
|
||||
post(
|
||||
api_v0_post_likes_path(post_id: @status.id),
|
||||
params: { access_token: access_token }
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
json = JSON.parse(response.body)
|
||||
expect(json["author"]["id"]).to eq(auth.user.person.id)
|
||||
|
|
@ -30,7 +30,7 @@ describe Api::V0::LikesController do
|
|||
before do
|
||||
post(
|
||||
api_v0_post_likes_path(post_id: @status.id),
|
||||
params: { access_token: access_token }
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
@like_id = JSON.parse(response.body)["id"]
|
||||
end
|
||||
|
|
@ -38,7 +38,7 @@ describe Api::V0::LikesController do
|
|||
it "succeeds" do
|
||||
delete(
|
||||
api_v0_post_like_path(post_id: @status.id, id: @like_id),
|
||||
params: { access_token: access_token }
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
expect(response).to be_success
|
||||
end
|
||||
|
|
@ -46,7 +46,7 @@ describe Api::V0::LikesController do
|
|||
it "fails on random like id" do
|
||||
delete(
|
||||
api_v0_post_like_path(post_id: @status.id, id: 99_999_999),
|
||||
params: { access_token: access_token }
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
expect(response.body).to eq("Post or like not found")
|
||||
end
|
||||
|
|
|
|||
|
|
@ -100,5 +100,4 @@ describe Api::V0::MessagesController do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -54,11 +54,11 @@ describe Api::V0::PostsController do
|
|||
aspect_ids: "public"
|
||||
}
|
||||
)
|
||||
expect(Post.find_by_text("Hello this is a public post!").public).to eq(true)
|
||||
expect(Post.find_by(text: "Hello this is a public post!").public).to eq(true)
|
||||
end
|
||||
|
||||
it "creates a private post" do
|
||||
response = post(
|
||||
post(
|
||||
api_v0_posts_path,
|
||||
params: {
|
||||
access_token: access_token_with_read_and_write,
|
||||
|
|
|
|||
Loading…
Reference in a new issue