mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-25 09:19:15 -04:00
Compare commits
15 Commits
RSpec/Incl
...
even-more-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
887b1bfd7e | ||
|
|
e7659a75a4 | ||
|
|
4a66bdc9fe | ||
|
|
8de6b083f9 | ||
|
|
accab7f84c | ||
|
|
3f6dd59dfa | ||
|
|
0a71b44dea | ||
|
|
ba75afb3f5 | ||
|
|
367dec9c68 | ||
|
|
aa1c9ceb05 | ||
|
|
6f59635ca7 | ||
|
|
6736ae3142 | ||
|
|
7a4a13c949 | ||
|
|
e6627bdf86 | ||
|
|
16a13df3b1 |
@@ -242,12 +242,6 @@ RSpec/BeforeAfterAll:
|
||||
Exclude:
|
||||
- 'spec/tasks/import_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
RSpec/ContextMethod:
|
||||
Exclude:
|
||||
- 'spec/requests/api/v1/activities_request_spec.rb'
|
||||
|
||||
# Offense count: 299
|
||||
# Configuration parameters: Prefixes, AllowedPatterns.
|
||||
# Prefixes: when, with, without
|
||||
@@ -299,14 +293,6 @@ RSpec/EmptyLineAfterExample:
|
||||
RSpec/ExampleLength:
|
||||
Max: 27
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: method_call, block
|
||||
RSpec/ExpectChange:
|
||||
Exclude:
|
||||
- 'spec/models/crop_spec.rb'
|
||||
|
||||
# Offense count: 32
|
||||
RSpec/ExpectInHook:
|
||||
Exclude:
|
||||
@@ -334,6 +320,26 @@ RSpec/HooksBeforeExamples:
|
||||
Exclude:
|
||||
- 'spec/features/crops/creating_a_crop_spec.rb'
|
||||
|
||||
# Offense count: 53
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
RSpec/IncludeExamples:
|
||||
Exclude:
|
||||
- 'spec/features/conversations/index_spec.rb'
|
||||
- 'spec/features/crops/alternate_name_spec.rb'
|
||||
- 'spec/features/crops/browse_crops_spec.rb'
|
||||
- 'spec/features/crops/creating_a_crop_spec.rb'
|
||||
- 'spec/features/crops/crop_photos_spec.rb'
|
||||
- 'spec/features/crops/delete_crop_spec.rb'
|
||||
- 'spec/features/gardens/actions_spec.rb'
|
||||
- 'spec/features/gardens/adding_gardens_spec.rb'
|
||||
- 'spec/features/gardens/index_spec.rb'
|
||||
- 'spec/features/likeable_spec.rb'
|
||||
- 'spec/features/signout_spec.rb'
|
||||
- 'spec/models/crop_spec.rb'
|
||||
- 'spec/support/feature_helpers.rb'
|
||||
- 'spec/views/photos/show.html.haml_spec.rb'
|
||||
- 'spec/views/seeds/index.rss.haml_spec.rb'
|
||||
|
||||
# Offense count: 37
|
||||
# Configuration parameters: Max, AllowedIdentifiers, AllowedPatterns.
|
||||
RSpec/IndexedLet:
|
||||
@@ -466,23 +472,6 @@ RSpec/VerifiedDoubles:
|
||||
- 'spec/controllers/gardens_controller_spec.rb'
|
||||
- 'spec/views/devise/shared/_links_spec.rb'
|
||||
|
||||
# Offense count: 7
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: ResponseMethods.
|
||||
# ResponseMethods: response, last_response
|
||||
RSpecRails/HaveHttpStatus:
|
||||
Exclude:
|
||||
- 'spec/controllers/api/v1/plantings_controller_spec.rb'
|
||||
- 'spec/controllers/harvests_controller_spec.rb'
|
||||
- 'spec/controllers/likes_controller_spec.rb'
|
||||
- 'spec/requests/harvests_spec.rb'
|
||||
|
||||
# Offense count: 17
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: Inferences.
|
||||
RSpecRails/InferredSpecType:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 30
|
||||
# Configuration parameters: Database.
|
||||
# SupportedDatabases: mysql, postgresql
|
||||
@@ -602,7 +591,6 @@ Rails/RedundantActiveRecordAllMethod:
|
||||
- 'app/controllers/scientific_names_controller.rb'
|
||||
- 'spec/features/members/deletion_spec.rb'
|
||||
- 'spec/features/percy/percy_spec.rb'
|
||||
- 'spec/models/harvest_spec.rb'
|
||||
|
||||
# Offense count: 5
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::PlantingsController, type: :controller do
|
||||
RSpec.describe Api::V1::PlantingsController do
|
||||
subject { JSON.parse response.body }
|
||||
|
||||
let!(:member) { create(:member) }
|
||||
@@ -42,7 +42,7 @@ RSpec.describe Api::V1::PlantingsController, type: :controller do
|
||||
|
||||
it { expect(matching_planting).to include('id' => my_planting.id.to_s) }
|
||||
it { expect(matching_planting['attributes']).to eq expected_attributes }
|
||||
it { expect(response.status).to eq 200 }
|
||||
it { expect(response).to have_http_status :ok }
|
||||
end
|
||||
|
||||
context 'with photo' do
|
||||
@@ -81,7 +81,7 @@ RSpec.describe Api::V1::PlantingsController, type: :controller do
|
||||
|
||||
it { expect(matching_planting).to include('id' => my_planting.id.to_s) }
|
||||
it { expect(matching_planting['attributes']).to eq expected_attributes }
|
||||
it { expect(response.status).to eq 200 }
|
||||
it { expect(response).to have_http_status :ok }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe GardenTypesController, type: :controller do
|
||||
RSpec.describe GardenTypesController do
|
||||
include Devise::Test::ControllerHelpers
|
||||
|
||||
let(:valid_params) { { name: 'My second GardenType' } }
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe GardensController, type: :controller do
|
||||
RSpec.describe GardensController do
|
||||
include Devise::Test::ControllerHelpers
|
||||
|
||||
let(:valid_params) { { name: 'My second Garden' } }
|
||||
|
||||
@@ -51,7 +51,7 @@ describe HarvestsController, :search do
|
||||
describe "generates a csv" do
|
||||
before { get :index, format: "csv" }
|
||||
|
||||
it { expect(response.status).to eq 200 }
|
||||
it { expect(response).to have_http_status :ok }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ describe LikesController do
|
||||
it { JSON.parse(response.body)["description"] == "1 like" }
|
||||
|
||||
describe "Liking someone else's post" do
|
||||
it { expect(response.code).to eq('201') }
|
||||
it { expect(response).to have_http_status(:created) }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -29,14 +29,14 @@ describe LikesController do
|
||||
it { expect(response.content_type).to eq "application/json; charset=utf-8" }
|
||||
|
||||
describe "un-liking something i liked before" do
|
||||
it { expect(response.code).to eq('200') }
|
||||
it { expect(response).to have_http_status(:ok) }
|
||||
it { JSON.parse(response.body)["description"] == "0 likes" }
|
||||
end
|
||||
|
||||
describe "Deleting someone else's like" do
|
||||
let(:like) { create(:like) }
|
||||
|
||||
it { expect(response.code).to eq('403') }
|
||||
it { expect(response).to have_http_status(:forbidden) }
|
||||
it { JSON.parse(response.body)["error"] == "Unable to like" }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
FactoryBot.define do
|
||||
factory :comment do
|
||||
association :commentable, factory: :post
|
||||
commentable factory: %i(post)
|
||||
author
|
||||
sequence(:body) { |n| "OMG LOL #{n}" }
|
||||
# because our commenters are more polite than YouTube's
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
FactoryBot.define do
|
||||
factory :garden_collaborator do
|
||||
garden
|
||||
|
||||
@@ -10,7 +10,7 @@ FactoryBot.define do
|
||||
|
||||
body { "MyText" }
|
||||
read { false }
|
||||
association :notifiable, factory: :post
|
||||
notifiable factory: %i(post)
|
||||
|
||||
factory :no_email_notification do
|
||||
recipient { FactoryBot.create(:no_email_notifications_member) }
|
||||
|
||||
@@ -26,7 +26,7 @@ describe "Harvesting a crop", :js, :search do
|
||||
|
||||
within "form#new_harvest" do
|
||||
choose plant_part.name
|
||||
fill_in "When?", with: Time.new(2014, 6, 15)
|
||||
fill_in "When?", with: Time.zone.local(2014, 6, 15)
|
||||
fill_in "How many?", with: 42
|
||||
fill_in "Weighing (in total)", with: 42
|
||||
fill_in "Notes", with: "It's killer."
|
||||
|
||||
@@ -96,7 +96,7 @@ describe "member deletion", :flaky do
|
||||
end
|
||||
|
||||
describe 'member exists but is marked deleted' do
|
||||
subject { Member.all.find(member.id) }
|
||||
subject { Member.find(member.id) }
|
||||
|
||||
it { expect(subject).to eq member }
|
||||
it { expect(subject.discarded?).to be true }
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe 'Test with visual testing', :js, type: :feature do
|
||||
describe 'Test with visual testing', :js do
|
||||
# Use the same random seed every time so our random data is the same
|
||||
# on every run, so doesn't trigger percy to see changes
|
||||
before { Faker::Config.random = Random.new(42) }
|
||||
|
||||
@@ -12,7 +12,7 @@ require 'rails_helper'
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
RSpec.describe ButtonsHelper, type: :helper do
|
||||
RSpec.describe ButtonsHelper do
|
||||
before { allow(self).to receive(:can?).and_return(true) }
|
||||
|
||||
let(:garden) { create(:garden) }
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe EventHelper, type: :helper do
|
||||
RSpec.describe EventHelper do
|
||||
subject { resolve_model(event) }
|
||||
|
||||
let(:planting) { create(:planting) }
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe CropCompanion, type: :model do
|
||||
RSpec.describe CropCompanion do
|
||||
it 'has a crop' do
|
||||
cc = described_class.new
|
||||
cc.crop_a = create :tomato
|
||||
|
||||
@@ -554,7 +554,7 @@ describe Crop do
|
||||
end
|
||||
|
||||
it "destroys companion links" do
|
||||
expect { crop_a.destroy }.to change { CropCompanion.count }.from(2).to(0)
|
||||
expect { crop_a.destroy }.to change(CropCompanion, :count).from(2).to(0)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ describe Harvest do
|
||||
it 'lists most recent harvests first' do
|
||||
@h1 = create(:harvest, created_at: 1.day.ago)
|
||||
@h2 = create(:harvest, created_at: 1.hour.ago)
|
||||
expect(described_class.all.order(created_at: :desc)).to eq [@h2, @h1]
|
||||
expect(described_class.order(created_at: :desc)).to eq [@h2, @h1]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -70,8 +70,8 @@ include Warden::Test::Helpers
|
||||
# directory. Alternatively, in the individual `*_spec.rb` files, manually
|
||||
# require only the support files necessary.
|
||||
#
|
||||
Dir[Rails.root.join("spec/support/**/*.rb")].sort.each { |f| require f }
|
||||
Dir[Rails.root.join("spec/features/shared_examples/**/*.rb")].sort.each { |f| require f }
|
||||
Rails.root.glob("spec/support/**/*.rb").sort.each { |f| require f }
|
||||
Rails.root.glob("spec/features/shared_examples/**/*.rb").sort.each { |f| require f }
|
||||
|
||||
# Checks for pending migrations before tests are run.
|
||||
# If you are not using ActiveRecord, you can remove this line.
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Activities', type: :request do
|
||||
subject { JSON.parse response.body }
|
||||
RSpec.describe 'Activities' do
|
||||
subject { response.parsed_body }
|
||||
|
||||
let(:member) { create(:member) }
|
||||
let(:token) do
|
||||
@@ -60,7 +60,7 @@ RSpec.describe 'Activities', type: :request do
|
||||
end
|
||||
end
|
||||
|
||||
context '#update' do
|
||||
describe '#update' do
|
||||
let(:params) do
|
||||
{
|
||||
'data' => {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Crops', type: :request do
|
||||
RSpec.describe 'Crops' do
|
||||
subject { JSON.parse response.body }
|
||||
|
||||
let(:headers) { { 'Accept' => 'application/vnd.api+json' } }
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Gardens', type: :request do
|
||||
RSpec.describe 'Gardens' do
|
||||
subject { JSON.parse response.body }
|
||||
|
||||
let(:headers) { { 'Accept' => 'application/vnd.api+json' } }
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Harvests', type: :request do
|
||||
RSpec.describe 'Harvests' do
|
||||
subject { JSON.parse response.body }
|
||||
|
||||
let(:headers) { { 'Accept' => 'application/vnd.api+json' } }
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Members', type: :request do
|
||||
RSpec.describe 'Members' do
|
||||
subject { JSON.parse response.body }
|
||||
|
||||
let(:headers) { { 'Accept' => 'application/vnd.api+json' } }
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Photos', type: :request do
|
||||
RSpec.describe 'Photos' do
|
||||
subject { JSON.parse response.body }
|
||||
|
||||
let(:headers) { { 'Accept' => 'application/vnd.api+json' } }
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Plantings', type: :request do
|
||||
RSpec.describe 'Plantings' do
|
||||
subject { JSON.parse response.body }
|
||||
|
||||
let(:headers) { { 'Accept' => 'application/vnd.api+json' } }
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Seeds', type: :request do
|
||||
RSpec.describe 'Seeds' do
|
||||
subject { JSON.parse response.body }
|
||||
|
||||
let(:headers) { { 'Accept' => 'application/vnd.api+json' } }
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "GardenTypes", type: :request do
|
||||
RSpec.describe "GardenTypes" do
|
||||
describe "GET /garden_types" do
|
||||
it "works! (now write some real specs)" do
|
||||
get garden_types_path
|
||||
|
||||
@@ -6,7 +6,7 @@ describe "Harvests" do
|
||||
describe "GET /harvests" do
|
||||
it "works! (now write some real specs)" do
|
||||
get harvests_path
|
||||
expect(response.status).to be 200
|
||||
expect(response).to have_http_status :ok
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe "places/_map_attribution.html.haml", type: :view do
|
||||
describe "places/_map_attribution.html.haml" do
|
||||
before do
|
||||
render
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user