mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-24 16:58:35 -04:00
Rubocop: Rails/ResponseParsedBody
This commit is contained in:
@@ -625,21 +625,6 @@ Rails/RedundantPresenceValidationOnBelongsTo:
|
||||
- 'app/models/planting.rb'
|
||||
- 'app/models/scientific_name.rb'
|
||||
|
||||
# Offense count: 16
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Rails/ResponseParsedBody:
|
||||
Exclude:
|
||||
- 'spec/controllers/api/v1/plantings_controller_spec.rb'
|
||||
- 'spec/controllers/likes_controller_spec.rb'
|
||||
- 'spec/requests/api/v1/activities_request_spec.rb'
|
||||
- 'spec/requests/api/v1/crop_request_spec.rb'
|
||||
- 'spec/requests/api/v1/gardens_request_spec.rb'
|
||||
- 'spec/requests/api/v1/harvests_request_spec.rb'
|
||||
- 'spec/requests/api/v1/members_request_spec.rb'
|
||||
- 'spec/requests/api/v1/photos_request_spec.rb'
|
||||
- 'spec/requests/api/v1/plantings_request_spec.rb'
|
||||
- 'spec/requests/api/v1/seeds_request_spec.rb'
|
||||
|
||||
# Offense count: 9
|
||||
Rails/ReversibleMigration:
|
||||
Exclude:
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::PlantingsController, type: :controller do
|
||||
subject { JSON.parse response.body }
|
||||
subject { response.parsed_body }
|
||||
|
||||
let!(:member) { create(:member) }
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ describe LikesController do
|
||||
|
||||
it { expect(Like.last.likeable_id).to eq(blogpost.id) }
|
||||
it { expect(Like.last.likeable_type).to eq('Post') }
|
||||
it { JSON.parse(response.body)["description"] == "1 like" }
|
||||
it { response.parsed_body["description"] == "1 like" }
|
||||
|
||||
describe "Liking someone else's post" do
|
||||
it { expect(response.code).to eq('201') }
|
||||
@@ -30,14 +30,14 @@ describe LikesController do
|
||||
|
||||
describe "un-liking something i liked before" do
|
||||
it { expect(response.code).to eq('200') }
|
||||
it { JSON.parse(response.body)["description"] == "0 likes" }
|
||||
it { response.parsed_body["description"] == "0 likes" }
|
||||
end
|
||||
|
||||
describe "Deleting someone else's like" do
|
||||
let(:like) { create(:like) }
|
||||
|
||||
it { expect(response.code).to eq('403') }
|
||||
it { JSON.parse(response.body)["error"] == "Unable to like" }
|
||||
it { response.parsed_body["error"] == "Unable to like" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Activities', type: :request do
|
||||
subject { JSON.parse response.body }
|
||||
subject { response.parsed_body }
|
||||
|
||||
let(:member) { create(:member) }
|
||||
let(:token) do
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Crops', type: :request do
|
||||
subject { JSON.parse response.body }
|
||||
subject { response.parsed_body }
|
||||
|
||||
let(:headers) { { 'Accept' => 'application/vnd.api+json' } }
|
||||
let!(:crop) { create(:crop) }
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Gardens', type: :request do
|
||||
subject { JSON.parse response.body }
|
||||
subject { response.parsed_body }
|
||||
|
||||
let(:headers) { { 'Accept' => 'application/vnd.api+json' } }
|
||||
let!(:garden) { create(:garden) }
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Harvests', type: :request do
|
||||
subject { JSON.parse response.body }
|
||||
subject { response.parsed_body }
|
||||
|
||||
let(:headers) { { 'Accept' => 'application/vnd.api+json' } }
|
||||
let!(:harvest) { create(:harvest) }
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Members', type: :request do
|
||||
subject { JSON.parse response.body }
|
||||
subject { response.parsed_body }
|
||||
|
||||
let(:headers) { { 'Accept' => 'application/vnd.api+json' } }
|
||||
let!(:member) { create(:member) }
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Photos', type: :request do
|
||||
subject { JSON.parse response.body }
|
||||
subject { response.parsed_body }
|
||||
|
||||
let(:headers) { { 'Accept' => 'application/vnd.api+json' } }
|
||||
let!(:photo) { create(:photo) }
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Plantings', type: :request do
|
||||
subject { JSON.parse response.body }
|
||||
subject { response.parsed_body }
|
||||
|
||||
let(:headers) { { 'Accept' => 'application/vnd.api+json' } }
|
||||
let!(:planting) { create(:planting) }
|
||||
@@ -220,18 +220,18 @@ RSpec.describe 'Plantings', type: :request do
|
||||
describe "#show" do
|
||||
it "locates the correct member" do
|
||||
get "/api/v1/plantings?filter[owner-id]=#{@member1.id}"
|
||||
expect(JSON.parse(response.body)['data'][0]['id']).to eq(planting.id.to_s)
|
||||
expect(response.parsed_body['data'][0]['id']).to eq(planting.id.to_s)
|
||||
|
||||
get "/api/v1/plantings?filter[owner-id]=#{@member2.id}"
|
||||
expect(JSON.parse(response.body)['data'][0]['id']).to eq(@planting2.id.to_s)
|
||||
expect(response.parsed_body['data'][0]['id']).to eq(@planting2.id.to_s)
|
||||
|
||||
pending "The below should be identical to the above, but aren't."
|
||||
|
||||
get "/api/v1/members/#{@member1.id}/plantings"
|
||||
expect(JSON.parse(response.body)['data'][0]['id']).to eq(planting.id.to_s)
|
||||
expect(response.parsed_body['data'][0]['id']).to eq(planting.id.to_s)
|
||||
|
||||
get "/api/v1/members/#{@member2.id}/plantings"
|
||||
expect(JSON.parse(response.body)['data'][0]['id']).to eq(@planting2.id.to_s)
|
||||
expect(response.parsed_body['data'][0]['id']).to eq(@planting2.id.to_s)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Seeds', type: :request do
|
||||
subject { JSON.parse response.body }
|
||||
subject { response.parsed_body }
|
||||
|
||||
let(:headers) { { 'Accept' => 'application/vnd.api+json' } }
|
||||
let!(:seed) { create(:seed) }
|
||||
|
||||
Reference in New Issue
Block a user