Skip to content

Commit

Permalink
rubocop fix all
Browse files Browse the repository at this point in the history
  • Loading branch information
jparr committed May 10, 2024
1 parent f8f2d1c commit 7e961ef
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ inherit_gem:
- config/rails.yml

AllCops:
TargetRailsVersion: 6.1
TargetRailsVersion: 7.0
TargetRubyVersion: 3.0
NewCops: enable
SuggestExtensions: false
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/concerns/logged_invisible_captcha.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ module LoggedInvisibleCaptcha

def on_spam(options = {})
log_failure
super options
super(options)
end

def on_timestamp_spam(options = {})
log_failure
super options
super(options)
end

def log_failure
Expand Down
6 changes: 2 additions & 4 deletions app/models/topic_category.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ class TopicCategory < ApplicationRecord
has_many :congress_message_campaigns

def as_2d_array
arr = []
topic_sets.order(:tier).each do |ts|
arr.push ts.topics.map(&:name)
arr = topic_sets.order(:tier).map do |ts|
ts.topics.map(&:name)
end
arr
end

def best_match(options)
Expand Down
16 changes: 8 additions & 8 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= "test"
require_relative '../config/environment'
require_relative "../config/environment"
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rails.env.production?
require "spec_helper"
Expand Down Expand Up @@ -31,13 +31,13 @@
Capybara.server = :puma
Capybara.register_driver :selenium_chrome_headless do |app|
# Capybara::Selenium::Driver.load_selenium
browser_options = ::Selenium::WebDriver::Chrome::Options.new.tap do |opts|
opts.args << '--window-size=1920,1080'
opts.args << '--force-device-scale-factor=0.95'
opts.args << '--headless'
opts.args << '--disable-gpu'
opts.args << '--disable-site-isolation-trials'
opts.args << '--no-sandbox'
browser_options = Selenium::WebDriver::Chrome::Options.new.tap do |opts|
opts.args << "--window-size=1920,1080"
opts.args << "--force-device-scale-factor=0.95"
opts.args << "--headless"
opts.args << "--disable-gpu"
opts.args << "--disable-site-isolation-trials"
opts.args << "--no-sandbox"
end
Capybara::Selenium::Driver.new(app, browser: :chrome, options: browser_options)
end
Expand Down
12 changes: 6 additions & 6 deletions spec/requests/action_pages_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
expect(response.body).to eq "1000"
end
end

describe "json" do
it "returns json" do
FactoryBot.create(:action_page)
Expand All @@ -51,9 +51,9 @@
expect(response.code).to eq "200"
expect(response.parsed_body).to include(a_hash_including({
"title" => "Sample Action Page",
"featured_image"=> a_hash_including({
"alt"=>"Test.Png",
"url"=> a_string_matching(%r{/action_pages/featured_images/([0-9]+)/([0-9]+)/([0-9]+)/original/test.png})
"featured_image" => a_hash_including({
"alt" => "Test.Png",
"url" => a_string_matching(%r{/action_pages/featured_images/([0-9]+)/([0-9]+)/([0-9]+)/original/test.png})
})
}))
end
Expand All @@ -69,8 +69,8 @@

it "returns image attributes in atom" do
allow_any_instance_of(ActionPageImageUploader).to receive(:content_type).and_return("image/png")
stub_request(:get, %r{fakeimages/test.png}).to_return(status: 200, body: file_fixture("test-image.png").read, headers: {content_type: "image/png"})
stub_request(:any, %r{/action_pages/featured_images/([0-9]+)/([0-9]+)/([0-9]+)/original/test.png}).to_return(status: 200, body: file_fixture("test-image.png").read, headers: {content_type: "image/png"})
stub_request(:get, %r{fakeimages/test.png}).to_return(status: 200, body: file_fixture("test-image.png").read, headers: { content_type: "image/png" })
stub_request(:any, %r{/action_pages/featured_images/([0-9]+)/([0-9]+)/([0-9]+)/original/test.png}).to_return(status: 200, body: file_fixture("test-image.png").read, headers: { content_type: "image/png" })
FactoryBot.create(:action_page, remote_featured_image_url: "https://example.com/fakeimages/test.png")

get "/action.atom"
Expand Down

0 comments on commit 7e961ef

Please sign in to comment.