Skip to content

Commit

Permalink
rubocop
Browse files Browse the repository at this point in the history
* Capybara/ClickLinkOrButtonStyle
* Capybara/RSpec/HaveSelector
* Rails/RedundantActiveRecordAllMethod
* RSpec/Rails/HaveHttpStatus
* RSpec/Rails/HttpStatus
* RSpec/Rails/InferredSpecType
* Style/RedundantConstantBase
  • Loading branch information
agilous committed Sep 22, 2023
1 parent 1ea2c0b commit 00a0797
Show file tree
Hide file tree
Showing 26 changed files with 48 additions and 48 deletions.
2 changes: 1 addition & 1 deletion app/controllers/admin/past_events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class PastEventsController < AdminController
before_action :past_event, only: %i[destroy edit show update]

def index
@past_events = PastEvent.all.order('date DESC')
@past_events = PastEvent.order('date DESC')
end

def show; end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/speakers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class SpeakersController < AdminController
before_action :speaker, only: %i[destroy edit show update]

def index
@speakers = Speaker.all.order('name')
@speakers = Speaker.order('name')
end

def show; end
Expand Down
2 changes: 1 addition & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
config.active_support.report_deprecations = false

# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
config.log_formatter = Logger::Formatter.new

# Use a different logger for distributed setups.
# require "syslog/logger"
Expand Down
2 changes: 1 addition & 1 deletion config/environments/staging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
config.active_support.deprecation = :notify

# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
config.log_formatter = Logger::Formatter.new

# Use a different logger for distributed setups.
# require 'syslog/logger'
Expand Down
4 changes: 2 additions & 2 deletions lib/tasks/cucumber.rake
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ unless ARGV.any? { |a| a =~ /^gems/ } # Don't load anything when running the gem

task statsetup: :environment do
require 'rails/code_statistics'
::STATS_DIRECTORIES << ['Cucumber features', 'features'] if File.exist?('features')
::CodeStatistics::TEST_TYPES << "Cucumber features" if File.exist?('features')
STATS_DIRECTORIES << ['Cucumber features', 'features'] if File.exist?('features')
CodeStatistics::TEST_TYPES << "Cucumber features" if File.exist?('features')
end
end
desc 'Alias for cucumber:ok'
Expand Down
2 changes: 1 addition & 1 deletion spec/models/meeting_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'rails_helper'

RSpec.describe Meeting, type: :model do
RSpec.describe Meeting do
describe ".next_meeting" do
before { allow(described_class).to receive(:ruby_brigade_meetings).and_return([1, 2, 3, 4]) }

Expand Down
2 changes: 1 addition & 1 deletion spec/models/past_event_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'rails_helper'

RSpec.describe PastEvent, type: :model do
RSpec.describe PastEvent do
context 'Associations & Validations' do # rubocop:disable RSpec/ContextWording
before { build(:past_event) }

Expand Down
2 changes: 1 addition & 1 deletion spec/models/speaker_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'rails_helper'

RSpec.describe Speaker, type: :model do
RSpec.describe Speaker do
context 'Associations & Validations' do # rubocop:disable RSpec/ContextWording
before { build(:speaker) }

Expand Down
2 changes: 1 addition & 1 deletion spec/models/video_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'rails_helper'

RSpec.describe Video, type: :model do
RSpec.describe Video do
context 'Associations & Validations' do # rubocop:disable RSpec/ContextWording
before { build(:video) }

Expand Down
2 changes: 1 addition & 1 deletion spec/requests/admin/past_events_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'rails_helper'

RSpec.describe '/admin/past_events', type: :request do
RSpec.describe '/admin/past_events' do
let!(:admin_user) { create(:admin_user, password: 'P4ssw0rd!') }
let!(:speaker) { create(:speaker) }
let(:valid_attributes) {
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/admin/speakers_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'rails_helper'

RSpec.describe '/admin/speakers', type: :request do
RSpec.describe '/admin/speakers' do
let!(:admin_user) { create(:admin_user, password: 'P4ssw0rd!') }
let!(:speaker) { create(:speaker) }
let(:valid_attributes) { { name: Faker::Name.unique.name } }
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/admin/videos_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'securerandom'

module Admin
RSpec.describe VideosController, type: :request do
RSpec.describe VideosController do
let!(:admin_user) { create(:admin_user, password: 'P4ssw0rd!') }
let!(:video) { create(:video) }
let(:valid_attributes) { { past_event_id: video.past_event.id, url: Faker::Internet.url(host: 'example.com', path: "/videos/#{SecureRandom.alphanumeric(8)}") } }
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/application_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'rails_helper'

RSpec.describe ApplicationController, type: :request do
RSpec.describe ApplicationController do
describe 'logging in' do
let(:admin_user) { create(:admin_user, password:) }
let(:email) { admin_user.email }
Expand Down
4 changes: 2 additions & 2 deletions spec/requests/pages_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
describe 'GET #index' do
it 'is publicly accessible' do
VCR.use_cassette('pages_controller_spec-get-index', record: :new_episodes) { get :index, params: {} }
expect(response.code).to eq('200')
expect(response).to have_http_status(:ok)
end
end

describe 'GET #this_month_in_ruby' do
it 'is publicly accessible' do
get :this_month_in_ruby

expect(response.code).to eq('200')
expect(response).to have_http_status(:ok)
end
end
end
4 changes: 2 additions & 2 deletions spec/requests/past_events_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
describe 'GET #index' do
it 'is publicly accessible' do
VCR.use_cassette('past_events_controller_spec-get-index', record: :new_episodes) { get :index, params: {} }
expect(response.code).to eq('200')
expect(response).to have_http_status(:ok)
end
end

describe 'GET #show' do
it 'is publicly accessible' do
get :show, params: { year: '2005', month: '2' }

expect(response.code).to eq('200')
expect(response).to have_http_status(:ok)
end
end
end
2 changes: 1 addition & 1 deletion spec/routing/admin/past_events_routing_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rails_helper"

RSpec.describe Admin::PastEventsController, type: :routing do
RSpec.describe Admin::PastEventsController do
describe "routing" do
it "routes to #create" do
expect(post: "/admin/past_events").to route_to("admin/past_events#create")
Expand Down
2 changes: 1 addition & 1 deletion spec/routing/admin/speakers_routing_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rails_helper"

RSpec.describe Admin::SpeakersController, type: :routing do
RSpec.describe Admin::SpeakersController do
describe "routing" do
it "routes to #create" do
expect(post: "/admin/speakers").to route_to("admin/speakers#create")
Expand Down
2 changes: 1 addition & 1 deletion spec/routing/admin/videos_routing_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rails_helper"

RSpec.describe Admin::VideosController, type: :routing do
RSpec.describe Admin::VideosController do
describe "routing" do
it "routes to #create" do
expect(post: "/admin/videos").to route_to("admin/videos#create")
Expand Down
4 changes: 2 additions & 2 deletions spec/routing/devise_routing_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'rails_helper'

module Devise
RSpec.describe SessionsController, type: :routing do
RSpec.describe SessionsController do
describe 'routing' do
it 'routes to #new' do
expect(get: '/admin/login').to route_to('devise/sessions#new')
Expand All @@ -21,7 +21,7 @@ module Devise
end
end

RSpec.describe PasswordsController, type: :routing do
RSpec.describe PasswordsController do
describe 'routing' do
it 'routes to #create' do
expect(post: '/admin/password').to route_to('devise/passwords#create')
Expand Down
2 changes: 1 addition & 1 deletion spec/routing/pages_routing_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'rails_helper'

RSpec.describe PagesController, type: :routing do
RSpec.describe PagesController do
it { is_expected.to route(:get, '/').to(action: :index) }
it { is_expected.to route(:get, '/this_month_in_ruby').to(action: :this_month_in_ruby) }
end
2 changes: 1 addition & 1 deletion spec/routing/past_events_routing_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'rails_helper'

RSpec.describe PastEventsController, type: :routing do
RSpec.describe PastEventsController do
it { is_expected.to route(:get, '/past_events').to(action: :index) }
it { is_expected.to route(:get, '/past_events/2005/2').to(action: :show, year: '2005', month: '2') }
end
6 changes: 3 additions & 3 deletions spec/system/admin/authentication_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'rails_helper'

RSpec.describe 'Authentication', type: :system do
RSpec.describe 'Authentication' do
subject { page }

let(:password) { 'P4ssw0rd' }
Expand All @@ -12,7 +12,7 @@

fill_in :admin_user_email, with: admin_user.email
fill_in :admin_user_password, with: password
click_on 'Log in'
click_button 'Log in'
end

it { is_expected.to have_text('Signed in successfully.') }
Expand All @@ -24,7 +24,7 @@

fill_in :admin_user_email, with: admin_user.email
fill_in :admin_user_password, with: "#{password}-fat-fingers!"
click_on 'Log in'
click_button 'Log in'
end

it { is_expected.to have_text('Invalid email or password.') }
Expand Down
12 changes: 6 additions & 6 deletions spec/system/admin/past_events_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rails_helper"

RSpec.describe "PastEvent Administration", type: :system do
RSpec.describe "PastEvent Administration" do
let!(:admin_user) { create(:admin_user, email: '[email protected]', password: 'P4ssw0rd') }
let!(:other_speaker) { create(:speaker, name: 'Chris Nelson') }

Expand All @@ -12,7 +12,7 @@

fill_in :admin_user_email, with: admin_user.email
fill_in :admin_user_password, with: 'P4ssw0rd'
click_on 'Log in'
click_button 'Log in'

visit new_admin_past_event_path
expect(page).to have_text('New Past Event')
Expand All @@ -25,7 +25,7 @@
select other_speaker.name, from: 'past_event[speaker_ids][]'
fill_in 'past_event[description]', with: 'No, we mean it! This is a reeeeally cool Rails feature.'

click_on 'commit'
click_button 'commit'

new_past_event = PastEvent.last
expect(new_past_event.topic).to eq('A Really Cool Rails Feature')
Expand All @@ -41,7 +41,7 @@

fill_in :admin_user_email, with: admin_user.email
fill_in :admin_user_password, with: 'P4ssw0rd'
click_on 'Log in'
click_button 'Log in'

visit edit_admin_past_event_path(past_event)
expect(page).to have_text('Editing Past Event')
Expand All @@ -51,7 +51,7 @@
unselect past_event.speakers.first.name, from: 'past_event[speaker_ids][]'
select other_speaker.name, from: 'past_event[speaker_ids][]'

click_on 'commit'
click_button 'commit'

expect(past_event.reload.speakers.map(&:name).sort).to eq([other_speaker.name, past_event.speakers.last.name].sort)
end
Expand All @@ -67,7 +67,7 @@

fill_in :admin_user_email, with: admin_user.email
fill_in :admin_user_password, with: 'P4ssw0rd'
click_on 'Log in'
click_button 'Log in'

visit admin_past_events_path
expect(page).to have_text('Past Events')
Expand Down
12 changes: 6 additions & 6 deletions spec/system/admin/speakers_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rails_helper"

RSpec.describe "Speaker Administration", type: :system do
RSpec.describe "Speaker Administration" do
let!(:admin_user) { create(:admin_user, email: '[email protected]', password: 'P4ssw0rd') }

context 'when creating' do
Expand All @@ -10,7 +10,7 @@
fill_in :admin_user_email, with: admin_user.email
fill_in :admin_user_password, with: 'P4ssw0rd'

click_on 'Log in'
click_button 'Log in'

visit new_admin_speaker_path
expect(page).to have_text('New Speaker')
Expand All @@ -22,7 +22,7 @@
fill_in 'speaker[email]', with: '[email protected]'
fill_in 'speaker[image_url]', with: 'https://example.com/jimweirich/images/avatar.png'

click_on 'commit'
click_button 'commit'

new_speaker = Speaker.last
expect(new_speaker.name).to eq('Jim Weirich')
Expand All @@ -40,7 +40,7 @@

fill_in :admin_user_email, with: admin_user.email
fill_in :admin_user_password, with: 'P4ssw0rd'
click_on 'Log in'
click_button 'Log in'

visit edit_admin_speaker_path(speaker)
expect(page).to have_text('Editing Speaker')
Expand All @@ -52,7 +52,7 @@
fill_in 'speaker[email]', with: "new.#{speaker.email}"
fill_in 'speaker[image_url]', with: Faker::Internet.url(host: 'example.com', path: '/avatar/new.jpeg')

click_on 'commit'
click_button 'commit'

old_data = speaker.attributes
speaker.reload
Expand All @@ -73,7 +73,7 @@

fill_in :admin_user_email, with: admin_user.email
fill_in :admin_user_password, with: 'P4ssw0rd'
click_on 'Log in'
click_button 'Log in'

visit admin_speakers_path
expect(page).to have_text('Speakers')
Expand Down
12 changes: 6 additions & 6 deletions spec/system/admin/videos_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "rails_helper"
require 'securerandom'

RSpec.describe "Video Administration", type: :system do
RSpec.describe "Video Administration" do
let!(:admin_user) { create(:admin_user, email: '[email protected]', password: 'P4ssw0rd') }
let!(:past_event) { create(:past_event) }
let(:url) { Faker::Internet.url(host: 'example.com', path: "/videos/#{SecureRandom.alphanumeric(8)}") }
Expand All @@ -12,7 +12,7 @@

fill_in :admin_user_email, with: admin_user.email
fill_in :admin_user_password, with: 'P4ssw0rd'
click_on 'Log in'
click_button 'Log in'

visit new_admin_video_path
expect(page).to have_text('New Video')
Expand All @@ -22,7 +22,7 @@
fill_in 'video[url]', with: url
select past_event.topic, from: 'video[past_event_id]'

click_on 'commit'
click_button 'commit'

new_video = Video.last
expect(new_video.url).to eq(url)
Expand All @@ -39,7 +39,7 @@

fill_in :admin_user_email, with: admin_user.email
fill_in :admin_user_password, with: 'P4ssw0rd'
click_on 'Log in'
click_button 'Log in'

visit edit_admin_video_path(video)
expect(page).to have_text('Editing Video')
Expand All @@ -49,7 +49,7 @@
fill_in 'video[url]', with: "#{video.url}v2"
select other_event.topic, from: 'video[past_event_id]'

click_on 'commit'
click_button 'commit'

old_data = video.attributes
video.reload
Expand All @@ -68,7 +68,7 @@

fill_in :admin_user_email, with: admin_user.email
fill_in :admin_user_password, with: 'P4ssw0rd'
click_on 'Log in'
click_button 'Log in'

visit admin_videos_path
expect(page).to have_text('Videos')
Expand Down
Loading

0 comments on commit 00a0797

Please sign in to comment.