Rebuild rubocop TODOs after auto-correcting

This commit is contained in:
James Mason 2018-04-04 10:18:51 -07:00
parent 31c50255e9
commit 84dbb52d11
No known key found for this signature in database
GPG key ID: 1B3951886C449023
580 changed files with 3689 additions and 3133 deletions

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Source: https://robots.thoughtbot.com/validating-json-schemas-with-an-rspec-matcher
RSpec::Matchers.define :match_response_schema do |schema|

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Mock external requests to youtube
require 'webmock/rspec'
WebMock.disable_net_connect!(allow_localhost: true, allow: /stripe.com/)
@ -25,5 +27,5 @@ def mock_commercial_request
height: 344
}
WebMock.stub_request(:get, /.*youtube.*/)
.to_return(status: 200, body: response.to_json, headers: {})
.to_return(status: 200, body: response.to_json, headers: {})
end

View file

@ -1,7 +1,8 @@
# frozen_string_literal: true
require_relative 'external_request'
RSpec.configure do |config|
config.before(:suite) do
if ENV['OSEM_FACTORY_LINT'] != 'false'
DatabaseCleaner.strategy = :transaction

View file

@ -1,12 +1,12 @@
# frozen_string_literal: true
module Flash
def flash
results = all(:css, 'div#flash p')
if results.empty?
return 'none'
end
return 'none' if results.empty?
if results.count > 1
texts = results.map { |r| r.text }
fail "One flash expected, but we had #{texts.inspect}"
texts = results.map(&:text)
raise "One flash expected, but we had #{texts.inspect}"
end
results.first.text
end

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module ActiveRecord
class Base
mattr_accessor :shared_connection

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module LoginMacros
include Warden::Test::Helpers
Warden.test_mode!

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module OmniauthMacros
# The mock_auth configuration allows you to set per-provider (or default)
# authentication hashes to return during integration testing.
@ -14,33 +16,33 @@ module OmniauthMacros
def mock_auth_new_user
OmniAuth.config.mock_auth[:google] =
OmniAuth::AuthHash.new(
provider: 'google',
uid: 'google-test-uid-1',
info: {
name: 'new user name',
email: 'test-1@example.com'
},
credentials: {
token: 'mock_token',
secret: 'mock_secret'
}
)
provider: 'google',
uid: 'google-test-uid-1',
info: {
name: 'new user name',
email: 'test-1@example.com'
},
credentials: {
token: 'mock_token',
secret: 'mock_secret'
}
)
end
def mock_auth_new_user_fb
OmniAuth.config.mock_auth[:facebook] =
OmniAuth::AuthHash.new(
provider: 'facebook',
uid: 'facebook-test-uid-1',
info: {
name: 'new user fb name',
email: 'test-1@example.com'
},
credentials: {
token: 'mock_token',
secret: 'mock_secret'
}
)
provider: 'facebook',
uid: 'facebook-test-uid-1',
info: {
name: 'new user fb name',
email: 'test-1@example.com'
},
credentials: {
token: 'mock_token',
secret: 'mock_secret'
}
)
end
def mock_auth_existing_user_participant
@ -48,17 +50,17 @@ module OmniauthMacros
# authentication hashes to return during integration testing.
OmniAuth.config.mock_auth[:google] =
OmniAuth::AuthHash.new(
provider: 'google',
uid: 'google-test-uid-participant-1',
info: {
name: 'existing user participant name',
email: 'test-participant-1@example.com'
},
credentials: {
token: 'mock_token',
secret: 'mock_secret'
}
)
provider: 'google',
uid: 'google-test-uid-participant-1',
info: {
name: 'existing user participant name',
email: 'test-participant-1@example.com'
},
credentials: {
token: 'mock_token',
secret: 'mock_secret'
}
)
end
def mock_auth_existing_user_admin
@ -66,17 +68,17 @@ module OmniauthMacros
# authentication hashes to return during integration testing.
OmniAuth.config.mock_auth[:google] =
OmniAuth::AuthHash.new(
provider: 'google',
uid: 'google-test-uid-admin-1',
info: {
name: 'existing user admin name',
email: 'test-admin-1@example.com'
},
credentials: {
token: 'mock_token',
secret: 'mock_secret'
}
)
provider: 'google',
uid: 'google-test-uid-admin-1',
info: {
name: 'existing user admin name',
email: 'test-admin-1@example.com'
},
credentials: {
token: 'mock_token',
secret: 'mock_secret'
}
)
end
# We use these mock accounts to ensure that the ones which are available in
@ -87,62 +89,62 @@ module OmniauthMacros
def mock_auth_accounts
OmniAuth.config.mock_auth[:facebook] =
OmniAuth::AuthHash.new(
provider: 'facebook',
uid: 'facebook-test-uid-1',
info: {
name: 'facebook user',
email: 'user-facebook@example.com',
username: 'user_facebook'
},
credentials: {
token: 'fb_mock_token',
secret: 'fb_mock_secret'
}
)
provider: 'facebook',
uid: 'facebook-test-uid-1',
info: {
name: 'facebook user',
email: 'user-facebook@example.com',
username: 'user_facebook'
},
credentials: {
token: 'fb_mock_token',
secret: 'fb_mock_secret'
}
)
OmniAuth.config.mock_auth[:google] =
OmniAuth::AuthHash.new(
provider: 'google',
uid: 'google-test-uid-1',
info: {
name: 'google user',
email: 'user-google@example.com',
username: 'user_google'
},
credentials: {
token: 'google_mock_token',
secret: 'google_mock_secret'
}
)
provider: 'google',
uid: 'google-test-uid-1',
info: {
name: 'google user',
email: 'user-google@example.com',
username: 'user_google'
},
credentials: {
token: 'google_mock_token',
secret: 'google_mock_secret'
}
)
OmniAuth.config.mock_auth[:suse] =
OmniAuth::AuthHash.new(
provider: 'suse',
uid: 'suse-test-uid-1',
info: {
name: 'suse user',
email: 'user-suse@example.com',
username: 'user_suse'
},
credentials: {
token: 'suse_mock_token',
secret: 'suse_mock_secret'
}
)
provider: 'suse',
uid: 'suse-test-uid-1',
info: {
name: 'suse user',
email: 'user-suse@example.com',
username: 'user_suse'
},
credentials: {
token: 'suse_mock_token',
secret: 'suse_mock_secret'
}
)
OmniAuth.config.mock_auth[:github] =
OmniAuth::AuthHash.new(
provider: 'github',
uid: 'github-test-uid-1',
info: {
name: 'github user',
email: 'user-github@example.com',
username: 'user_github'
},
credentials: {
token: 'github_mock_token',
secret: 'github_mock_secret'
}
)
provider: 'github',
uid: 'github-test-uid-1',
info: {
name: 'github user',
email: 'user-github@example.com',
username: 'user_github'
},
credentials: {
token: 'github_mock_token',
secret: 'github_mock_secret'
}
)
end
end

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Automatically save the page a test fails
Capybara.save_and_open_page_path = Rails.root.join('tmp', 'capybara')

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Sidebar
def sidebar
@conference = create(:conference)