Skip to content
This repository has been archived by the owner on Mar 29, 2022. It is now read-only.

Commit

Permalink
use single quoted strings
Browse files Browse the repository at this point in the history
  • Loading branch information
Frida Casas committed Aug 14, 2019
1 parent 96b2939 commit c3a8880
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 162 deletions.
4 changes: 0 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,3 @@ group :development do

gem 'web-console', '>= 3.3.0'
end

group :test do
gem 'chromedriver-helper'
end
7 changes: 0 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,13 @@ GEM
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
archive-zip (0.12.0)
io-like (~> 0.3.0)
arel (9.0.0)
ast (2.4.0)
bindex (0.8.1)
bootsnap (1.4.4)
msgpack (~> 1.0)
builder (3.2.3)
byebug (11.0.1)
chromedriver-helper (2.1.1)
archive-zip (~> 0.10)
nokogiri (~> 1.8)
coderay (1.1.2)
coffee-rails (4.2.2)
coffee-script (>= 2.2.0)
Expand Down Expand Up @@ -94,7 +89,6 @@ GEM
hashie (3.5.7)
i18n (1.6.0)
concurrent-ruby (~> 1.0)
io-like (0.3.0)
jaro_winkler (1.5.3)
jbuilder (2.9.1)
activesupport (>= 4.2.0)
Expand Down Expand Up @@ -262,7 +256,6 @@ PLATFORMS
DEPENDENCIES
bootsnap (>= 1.1.0)
byebug
chromedriver-helper
coffee-rails (~> 4.2)
dotenv-rails
guard-rspec
Expand Down
32 changes: 3 additions & 29 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -1,33 +1,7 @@
# frozen_string_literal: true

# A sample Guardfile
# More info at https://github.com/guard/guard#readme

## Uncomment and set this to only include directories you want to watch
# directories %w(app lib config test spec features) \
# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}

## Note: if you are using the `directories` clause above and you are not
## watching the project directory ('.'), then you will want to move
## the Guardfile to a watched dir and symlink it back, e.g.
#
# $ mkdir config
# $ mv Guardfile config/
# $ ln -s config/Guardfile .
#
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"

# Note: The cmd option is now required due to the increasing number of ways
# rspec may be run, below are examples of the most common uses.
# * bundler: 'bundle exec rspec'
# * bundler binstubs: 'bin/rspec'
# * spring: 'bin/rspec' (This will use spring if running and you have
# installed the spring binstubs per the docs)
# * zeus: 'zeus rspec' (requires the server to be started separately)
# * 'just' rspec: 'rspec'

guard :rspec, cmd: "bundle exec rspec --format=documentation" do
require "guard/rspec/dsl"
guard :rspec, cmd: 'bundle exec rspec --format=documentation' do
require 'guard/rspec/dsl'
dsl = Guard::RSpec::Dsl.new(self)

# Feel free to open issues for suggestions and improvements
Expand Down Expand Up @@ -69,6 +43,6 @@ guard :rspec, cmd: "bundle exec rspec --format=documentation" do
# Turnip features and steps
watch(%r{^spec/acceptance/(.+)\.feature$})
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance'
end
end
3 changes: 0 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# frozen_string_literal: true

# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require_relative 'config/application'

Rails.application.load_tasks
3 changes: 2 additions & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# frozen_string_literal: true

require_relative 'boot'

require 'pry'
require 'rails/all'

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.

Bundler.require(*Rails.groups)

module Hacktoberfest
Expand Down
2 changes: 1 addition & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
# require 'syslog/logger'
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')

if ENV["RAILS_LOG_TO_STDOUT"].present?
if ENV['RAILS_LOG_TO_STDOUT'].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
Expand Down
8 changes: 4 additions & 4 deletions config/puma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches the default thread size of Active Record.
#
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
threads_count = ENV.fetch('RAILS_MAX_THREADS') { 5 }
threads threads_count, threads_count

# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
#
port ENV.fetch("PORT") { 3000 }
port ENV.fetch('PORT') { 3000 }

# Specifies the `environment` that Puma will run in.
#
environment ENV.fetch("RAILS_ENV") { "development" }
environment ENV.fetch('RAILS_ENV') { 'development' }

# Specifies the number of `workers` to boot in clustered mode.
# Workers are forked webserver processes. If using threads and workers together
# the concurrency of the application would be max `threads` * `workers`.
# Workers do not work on JRuby or Windows (both of which do not support
# processes).
#
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
# workers ENV.fetch('WEB_CONCURRENCY') { 2 }

# Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code
Expand Down
8 changes: 4 additions & 4 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# frozen_string_literal: true

Rails.application.routes.draw do
root to: "home#index"
get "/auth/:provider/callback", to: "sessions#create"
get "/logout" => "sessions#destroy", as: :logout
get "/login" => redirect("/auth/github"), as: :login
root to: 'home#index'
get '/auth/:provider/callback', to: 'sessions#create'
get '/logout' => 'sessions#destroy', as: :logout
get '/login' => redirect('/auth/github'), as: :login
end
2 changes: 2 additions & 0 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2019_08_13_184016) do

create_table "issues", force: :cascade do |t|
t.integer "gh_id"
t.datetime "created_at", null: false
Expand Down Expand Up @@ -38,4 +39,5 @@
t.datetime "updated_at", null: false
t.string "provider", default: "github"
end

end
9 changes: 0 additions & 9 deletions db/seeds.rb
Original file line number Diff line number Diff line change
@@ -1,9 +0,0 @@
# frozen_string_literal: true

# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Character.create(name: 'Luke', movie: movies.first)
6 changes: 3 additions & 3 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
# This file is copied to spec/ when you run 'rails generate rspec:install'
require 'spec_helper'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require File.expand_path('../config/environment', __dir__)
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rails.env.production?
abort('The Rails env is running in production mode!') if Rails.env.production?
require 'rspec/rails'
# Add additional requires below this line. Rails is not loaded until this point!

Expand Down Expand Up @@ -33,7 +33,7 @@
exit 1
end

Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }

RSpec.configure do |config|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
Expand Down
24 changes: 12 additions & 12 deletions spec/requests/sessions_spec.rb
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
# frozen_string_literal: true

require "rails_helper"
require 'rails_helper'

RSpec.describe 'Sessions', type: :request do
describe "signup and login" do
it "logs the user in" do
describe 'signup and login' do
it 'logs the user in' do
login
expect(session[:current_user_id]).to_not eq(nil)
end

context "user already exists" do
context 'user already exists' do
before do
user = User.create(gh_id: 123456)
User.create(gh_id: 123_456)
end

it "does not create a new User" do
it 'does not create a new User' do
expect { login }.to change { User.count }.by(0)
end
end

context "user does not exist" do
it "creates a new user" do
context 'user does not exist' do
it 'creates a new user' do
expect { login }.to change { User.count }.by(1)
end
end
end

describe "logout" do
context "The user is logged in" do
describe 'logout' do
context 'The user is logged in' do
before do
login
end

it "logs the user out" do
get "/logout"
it 'logs the user out' do
get '/logout'
expect(session[:current_user_id]).to eq(nil)
end
end
Expand Down
84 changes: 1 addition & 83 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,100 +2,18 @@

require 'omniauth'

# This file was generated by the `rails generate rspec:install` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
# this file to always be loaded, without a need to explicitly require it in any
# files.
#
# Given that it is always loaded, you are encouraged to keep this file as
# light-weight as possible. Requiring heavyweight dependencies from this file
# will add to the boot time of your test suite on EVERY test run, even for an
# individual file that may not need all of that loaded. Instead, consider making
# a separate helper file that requires the additional dependencies and performs
# the additional setup, and require it from the spec files that actually need
# it.
#
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
# rspec-expectations config goes here. You can use an alternate
# assertion/expectation library such as wrong or the stdlib/minitest
# assertions if you prefer.
config.expect_with :rspec do |expectations|
# This option will default to `true` in RSpec 4. It makes the `description`
# and `failure_message` of custom matchers include text for helper methods
# defined using `chain`, e.g.:
# be_bigger_than(2).and_smaller_than(4).description
# # => "be bigger than 2 and smaller than 4"
# ...rather than:
# # => "be bigger than 2"
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end

# rspec-mocks config goes here. You can use an alternate test double
# library (such as bogus or mocha) by changing the `mock_with` option here.
# rspec-mocks config goes here.
config.mock_with :rspec do |mocks|
# Prevents you from mocking or stubbing a method that does not exist on
# a real object. This is generally recommended, and will default to
# `true` in RSpec 4.
mocks.verify_partial_doubles = true
end

# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
# have no way to turn it off -- the option exists only for backwards
# compatibility in RSpec 3). It causes shared context metadata to be
# inherited by the metadata hash of host groups and examples, rather than
# triggering implicit auto-inclusion in groups with matching metadata.
config.shared_context_metadata_behavior = :apply_to_host_groups

# The settings below are suggested to provide a good initial experience
# with RSpec, but feel free to customize to your heart's content.
=begin
# This allows you to limit a spec run to individual examples or groups
# you care about by tagging them with `:focus` metadata. When nothing
# is tagged with `:focus`, all examples get run. RSpec also provides
# aliases for `it`, `describe`, and `context` that include `:focus`
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
config.filter_run_when_matching :focus
# Allows RSpec to persist some state between runs in order to support
# the `--only-failures` and `--next-failure` CLI options. We recommend
# you configure your source control system to ignore this file.
config.example_status_persistence_file_path = "spec/examples.txt"
# Limits the available syntax to the non-monkey patched syntax that is
# recommended. For more details, see:
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
config.disable_monkey_patching!
# Many RSpec users commonly either run the entire suite or an individual
# file, and it's useful to allow more verbose output when running an
# individual spec file.
if config.files_to_run.one?
# Use the documentation formatter for detailed output,
# unless a formatter has already been configured
# (e.g. via a command-line flag).
config.default_formatter = "doc"
end
# Print the 10 slowest examples and example groups at the
# end of the spec run, to help surface which specs are running
# particularly slow.
config.profile_examples = 10
# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = :random
# Seed global randomization in this process using the `--seed` CLI option.
# Setting this allows you to use `--seed` to deterministically reproduce
# test failures related to randomization by passing the same `--seed` value
# as the one that triggered the failure.
Kernel.srand config.seed
=end
OmniAuth.config.test_mode = true
end
4 changes: 2 additions & 2 deletions spec/support/authentication_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ def login(provider = 'github', uid = '123456')
}
}
OmniAuth.config.add_mock(:github, omniauth_hash)
Rails.application.env_config["omniauth.auth"] =
Rails.application.env_config['omniauth.auth'] =
OmniAuth.config.mock_auth[:github]
get "/auth/github/callback"
get '/auth/github/callback'
end
end

0 comments on commit c3a8880

Please sign in to comment.