mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-28 10:47:43 -04:00
Compare commits
9 Commits
release81
...
Rails/Resp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8731573cfb | ||
|
|
c5254772da | ||
|
|
7b2013964c | ||
|
|
bbe75df0ad | ||
|
|
279cc88162 | ||
|
|
9b135b29e5 | ||
|
|
d625eb2dbd | ||
|
|
a51471d715 | ||
|
|
79c4981899 |
@@ -76,3 +76,8 @@ Rails/SkipsModelValidations:
|
||||
- 'db/migrate/20240810160538_set_default_language_for_existing_alternate_names.rb'
|
||||
- 'db/migrate/20240101010102_populate_crop_fields_from_openfarm_data.rb'
|
||||
- 'db/seeds.rb'
|
||||
|
||||
Rails/ResponseParsedBody:
|
||||
Exclude:
|
||||
- spec/controllers/api/v1/plantings_controller_spec.rb
|
||||
- spec/requests/api/v1/members_request_spec.rb
|
||||
@@ -601,21 +601,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:
|
||||
@@ -728,13 +713,6 @@ Style/FloatDivision:
|
||||
Exclude:
|
||||
- 'app/models/concerns/predict_planting.rb'
|
||||
|
||||
# Offense count: 22
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: always, always_true, never
|
||||
Style/FrozenStringLiteralComment:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 2
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Style/GlobalStdStream:
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Be sure to restart your server when you modify this file.
|
||||
#
|
||||
# This file contains migration options to ease your Rails 6.0 upgrade.
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# This migration comes from active_storage (originally 20180723000244)
|
||||
class AddForeignKeyConstraintToActiveStorageAttachmentsForBlobId < ActiveRecord::Migration[6.0]
|
||||
def up
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AddFieldsToCrops < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :crops, :row_spacing, :integer
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class PopulateCropFieldsFromOpenfarmData < ActiveRecord::Migration[5.2]
|
||||
def up
|
||||
Crop.find_each do |crop|
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AddSocialMediaToMembers < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column :members, :website_url, :string
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class RenameOtherHandleToOtherUrlInMembers < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
rename_column :members, :other_handle, :other_url
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class CreateGardenCollaborators < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
create_table :garden_collaborators do |t|
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class CreateAustralianFoodClassificationData < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :australian_food_classification_data do |t|
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class MakeNotificationsPolymorphic < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :notifications, :notifiable_type, :string
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ChangeCommentsPolymorphic < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
add_column :comments, :commentable_type, :string
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AddSourceToSeeds < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
add_column :seeds, :source, :string
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AddIndexesCrops < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
add_index :alternate_names, :crop_id
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AddOverallRatingPlantings < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
add_column :plantings, :overall_rating, :integer
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AddEnYoutubeUrlToCrops < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
add_column :crops, :en_youtube_url, :string
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# This migration creates the `versions` table for the Version class.
|
||||
# All other migrations PT provides are optional.
|
||||
class CreateVersions < ActiveRecord::Migration[7.2]
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# This migration adds the optional `object_changes` column, in which PaperTrail
|
||||
# will store the `changes` diff for each update event. See the readme for
|
||||
# details.
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AddPublicFoodKeyToCrops < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :crops, :public_food_key, :string
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'csv'
|
||||
|
||||
namespace :import do
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::PlantingsController do
|
||||
subject { JSON.parse response.body }
|
||||
subject { JSON.parse(response.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).to have_http_status(:created) }
|
||||
@@ -30,14 +30,14 @@ describe LikesController do
|
||||
|
||||
describe "un-liking something i liked before" do
|
||||
it { expect(response).to have_http_status(:ok) }
|
||||
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).to have_http_status(:forbidden) }
|
||||
it { JSON.parse(response.body)["error"] == "Unable to like" }
|
||||
it { response.parsed_body["error"] == "Unable to like" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
FactoryBot.define do
|
||||
factory :garden_collaborator do
|
||||
garden
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.feature 'Creating a recurring activity' do
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Activities' 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' 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' 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' 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 'Photos' 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' 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' 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' do
|
||||
subject { JSON.parse response.body }
|
||||
subject { response.parsed_body }
|
||||
|
||||
let(:headers) { { 'Accept' => 'application/vnd.api+json' } }
|
||||
let!(:seed) { create(:seed) }
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
require 'rake'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user