Merge branch 'gemfile-cleanups' into 'master'

Gemfile cleanups

See merge request nilsding/retrospring!74
This commit is contained in:
Andreas Nedbal 2020-04-19 16:06:09 +00:00
commit eee7493c91
24 changed files with 109 additions and 326 deletions

View File

@ -13,7 +13,6 @@ install_plugin Capistrano::SCM::Git
require "capistrano/bundler"
require "capistrano/rails/assets"
require "capistrano/rails/migrations"
require "rollbar/capistrano3"
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }

29
Gemfile
View File

@ -1,5 +1,6 @@
# frozen_string_literal: true
source 'https://rubygems.org'
source 'https://rails-assets.org'
gem 'rails', '~> 5.2'
gem 'rails-i18n', '~> 5.0'
@ -14,7 +15,6 @@ gem 'jquery-rails'
gem 'turbolinks', '~> 2.5.3'
gem 'jquery-turbolinks'
gem 'jbuilder', '~> 2.10'
gem 'sdoc', '~> 0.4.1', group: :doc
gem 'bcrypt', '~> 3.1.7'
@ -31,18 +31,22 @@ gem 'bootstrap_form'
gem 'font-kit-rails'
gem 'nprogress-rails'
gem 'font-awesome-rails', '~> 4.7.0'
gem 'rails-assets-growl'
gem 'rails-assets-jquery', '~> 2.2.0'
gem "paperclip", "~> 4.2"
gem "paperclip", "~> 5.2"
gem 'delayed_paperclip'
gem 'fog'
gem 'fog-core'
gem 'fog-aws'
gem 'fog-local'
gem 'momentjs-rails', '>= 2.9.0'
gem 'bootstrap3-datetimepicker-rails', '~> 4.7.14'
gem 'tiny-color-rails'
gem 'jquery-minicolors-rails'
gem 'colorize'
source "https://rails-assets.org" do
gem 'rails-assets-growl'
gem 'rails-assets-jquery', '~> 2.2.0'
end
gem 'ruby-progressbar'
gem 'rails_admin'
@ -64,21 +68,18 @@ gem 'omniauth-tumblr'
# OAuth clients
gem 'twitter'
gem 'tumblr_client'
# To use a more recent Faraday version, a fork of this gem is required.
gem 'tumblr_client', git: 'https://github.com/amplifr/tumblr_client'
gem 'foreman'
gem 'redis'
gem 'fake_email_validator'
gem 'rollbar'
group :development do
# require spring 1.3.5 since shit's on fire on my local instance with 1.3.4 (Gem::LoadError)
gem 'spring', '~> 1.3.5'
# ten thousand raises no more!
gem 'spring', '~> 2.0'
gem 'byebug'
gem 'web-console', '< 3.0.0'
gem 'web-console', '< 4.0.0'
end
# Deployment
@ -100,7 +101,7 @@ group :development, :test do
gem 'rake'
gem 'puma'
gem 'rspec-rails', '~> 3.9'
gem 'factory_girl_rails', require: false
gem 'factory_bot_rails', require: false
gem 'faker'
gem 'capybara'
gem 'poltergeist'

View File

@ -1,3 +1,15 @@
GIT
remote: https://github.com/amplifr/tumblr_client
revision: 3927ee366598a9b70b095933ded32e45f730b652
specs:
tumblr_client (0.8.5)
faraday
faraday_middleware
json
mime-types
oauth
simple_oauth
GIT
remote: https://github.com/retrospring/questiongenerator.git
revision: c5f8362ff769425d42a94b3a611731eadaa5e0ca
@ -8,7 +20,6 @@ GEM
remote: https://rubygems.org/
remote: https://rails-assets.org/
specs:
CFPropertyList (2.3.6)
actioncable (5.2.4.2)
actionpack (= 5.2.4.2)
nio4r (~> 2.0)
@ -67,8 +78,7 @@ GEM
coderay (>= 1.0.0)
erubi (>= 1.0.0)
rack (>= 0.9.0)
binding_of_caller (0.8.0)
debug_inspector (>= 0.0.1)
bindex (0.8.1)
bootstrap-sass (3.4.1)
autoprefixer-rails (>= 5.2.1)
sassc (>= 2.0.0)
@ -103,8 +113,6 @@ GEM
xpath (~> 3.2)
climate_control (0.2.0)
cliver (0.3.2)
cocaine (0.5.8)
climate_control (>= 0.0.3, < 1.0)
coderay (1.1.2)
coffee-rails (4.2.2)
coffee-script (>= 2.2.0)
@ -118,7 +126,6 @@ GEM
connection_pool (2.2.2)
crass (1.0.6)
database_cleaner (1.8.4)
debug_inspector (0.0.3)
delayed_paperclip (3.0.1)
activejob (>= 4.2)
paperclip (>= 3.3)
@ -137,176 +144,44 @@ GEM
docile (1.3.2)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
dry-inflector (0.2.0)
ed25519 (1.2.4)
equalizer (0.0.11)
erubi (1.9.0)
excon (0.73.0)
execjs (2.7.0)
factory_girl (4.9.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.9.0)
factory_girl (~> 4.9.0)
railties (>= 3.0.0)
factory_bot (5.1.2)
activesupport (>= 4.2.0)
factory_bot_rails (5.1.1)
factory_bot (~> 5.1.0)
railties (>= 4.2.0)
fake_email_validator (1.0.11)
activemodel
mail
faker (2.2.1)
i18n (>= 0.8)
faraday (0.9.2)
faraday (1.0.1)
multipart-post (>= 1.2, < 3)
faraday_middleware (0.9.2)
faraday (>= 0.7.4, < 0.10)
faraday_middleware (1.0.0)
faraday (~> 1.0)
ffi (1.12.2)
ffi-compiler (1.0.1)
ffi (>= 1.0.0)
rake
fission (0.5.0)
CFPropertyList (~> 2.2)
fog (1.41.0)
fog-aliyun (>= 0.1.0)
fog-atmos
fog-aws (>= 0.6.0)
fog-brightbox (~> 0.4)
fog-cloudatcost (~> 0.1.0)
fog-core (~> 1.45)
fog-digitalocean (>= 0.3.0)
fog-dnsimple (~> 1.0)
fog-dynect (~> 0.0.2)
fog-ecloud (~> 0.1)
fog-google (<= 0.1.0)
fog-internet-archive
fog-joyent
fog-json
fog-local
fog-openstack
fog-powerdns (>= 0.1.1)
fog-profitbricks
fog-rackspace
fog-radosgw (>= 0.0.2)
fog-riakcs
fog-sakuracloud (>= 0.0.4)
fog-serverlove
fog-softlayer
fog-storm_on_demand
fog-terremark
fog-vmfusion
fog-voxel
fog-vsphere (>= 0.4.0)
fog-xenserver
fog-xml (~> 0.1.1)
ipaddress (~> 0.5)
json (>= 1.8, < 2.0)
fog-aliyun (0.3.8)
fog-core
fog-json
ipaddress (~> 0.8)
xml-simple (~> 1.1)
fog-atmos (0.1.0)
fog-core
fog-xml
fog-aws (2.0.1)
fog-core (~> 1.38)
fog-json (~> 1.0)
fog-aws (3.6.2)
fog-core (~> 2.1)
fog-json (~> 1.1)
fog-xml (~> 0.1)
ipaddress (~> 0.8)
fog-brightbox (0.16.1)
dry-inflector
fog-core
fog-json
mime-types
fog-cloudatcost (0.1.2)
fog-core (~> 1.36)
fog-json (~> 1.0)
fog-xml (~> 0.1)
ipaddress (~> 0.8)
fog-core (1.45.0)
fog-core (2.2.0)
builder
excon (~> 0.58)
excon (~> 0.71)
formatador (~> 0.2)
fog-digitalocean (0.4.0)
fog-core
fog-json
fog-xml
ipaddress (>= 0.5)
fog-dnsimple (1.0.0)
fog-core (~> 1.38)
fog-json (~> 1.0)
fog-dynect (0.0.3)
fog-core
fog-json
fog-xml
fog-ecloud (0.3.0)
fog-core
fog-xml
fog-google (0.1.0)
fog-core
fog-json
fog-xml
fog-internet-archive (0.0.1)
fog-core
fog-json
fog-xml
fog-joyent (0.0.1)
fog-core (~> 1.42)
fog-json (>= 1.0)
mime-types
fog-json (1.2.0)
fog-core
multi_json (~> 1.10)
fog-local (0.6.0)
fog-core (>= 1.27, < 3.0)
fog-openstack (0.3.10)
fog-core (>= 1.45, <= 2.1.0)
fog-json (>= 1.0)
ipaddress (>= 0.8)
fog-powerdns (0.2.0)
fog-core
fog-json
fog-xml
fog-profitbricks (4.1.1)
fog-core (~> 1.42)
fog-json (~> 1.0)
fog-rackspace (0.1.6)
fog-core (>= 1.35)
fog-json (>= 1.0)
fog-xml (>= 0.1)
ipaddress (>= 0.8)
fog-radosgw (0.0.5)
fog-core (>= 1.21.0)
fog-json
fog-xml (>= 0.0.1)
fog-riakcs (0.1.0)
fog-core
fog-json
fog-xml
fog-sakuracloud (1.7.5)
fog-core
fog-json
fog-serverlove (0.1.2)
fog-core
fog-json
fog-softlayer (1.1.4)
fog-core
fog-json
fog-storm_on_demand (0.1.1)
fog-core
fog-json
fog-terremark (0.1.0)
fog-core
fog-xml
fog-vmfusion (0.1.0)
fission
fog-core
fog-voxel (0.1.0)
fog-core
fog-xml
fog-vsphere (3.3.0)
fog-core
rbvmomi (>= 1.9, < 3)
fog-xenserver (1.0.0)
fog-core
fog-xml
xmlrpc
fog-xml (0.1.3)
fog-core
nokogiri (>= 1.5.11, < 2.0.0)
@ -369,7 +244,7 @@ GEM
turbolinks
jquery-ui-rails (6.0.1)
railties (>= 3.2.16)
json (1.8.6)
json (2.3.0)
kaminari (1.2.0)
activesupport (>= 4.1.0)
kaminari-actionview (= 1.2.0)
@ -442,13 +317,13 @@ GEM
omniauth-twitter (1.4.0)
omniauth-oauth (~> 1.1)
rack
optimist (3.0.0)
orm_adapter (0.5.0)
paperclip (4.2.4)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
cocaine (~> 0.5.5)
paperclip (5.3.0)
activemodel (>= 4.2.0)
activesupport (>= 4.2.0)
mime-types
mimemagic (~> 0.3.0)
terrapin (~> 0.6.0)
pg (1.2.3)
pghero (2.4.2)
activerecord (>= 5)
@ -521,12 +396,6 @@ GEM
ffi
rbnacl-libsodium (1.0.16)
rbnacl (>= 3.0.1)
rbvmomi (2.4.1)
builder (~> 3.0)
json (>= 1.8)
nokogiri (~> 1.5)
optimist (~> 3.0)
rdoc (4.3.0)
redcarpet (3.5.0)
redis (4.1.3)
regexp_parser (1.7.0)
@ -534,7 +403,6 @@ GEM
responders (3.0.0)
actionpack (>= 5.0)
railties (>= 5.0)
rollbar (2.24.0)
rspec-core (3.9.1)
rspec-support (~> 3.9.1)
rspec-expectations (3.9.1)
@ -576,9 +444,6 @@ GEM
sprockets (> 3.0)
sprockets-rails
tilt
sdoc (0.4.2)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
shellany (0.0.1)
sidekiq (5.2.8)
connection_pool (~> 2.2, >= 2.2.2)
@ -595,7 +460,7 @@ GEM
simplecov
simplecov-rcov (0.2.3)
simplecov (>= 0.4.1)
spring (1.3.6)
spring (2.1.0)
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
@ -609,18 +474,13 @@ GEM
sweetalert-rails (1.1.3)
railties (>= 3.1.0)
temple (0.8.2)
terrapin (0.6.0)
climate_control (>= 0.0.3, < 1.0)
thor (1.0.1)
thread_safe (0.3.6)
tilt (2.0.10)
tiny-color-rails (0.0.2)
railties (>= 3.0)
tumblr_client (0.8.5)
faraday (~> 0.9.0)
faraday_middleware (~> 0.9.0)
json
mime-types
oauth
simple_oauth
turbolinks (2.5.4)
coffee-rails
twitter (7.0.0)
@ -646,19 +506,17 @@ GEM
raindrops (~> 0.7)
warden (1.2.8)
rack (>= 2.0.6)
web-console (2.3.0)
activemodel (>= 4.0)
binding_of_caller (>= 0.7.2)
railties (>= 4.0)
sprockets-rails (>= 2.0, < 4.0)
web-console (3.7.0)
actionview (>= 5.0)
activemodel (>= 5.0)
bindex (>= 0.4.0)
railties (>= 5.0)
websocket-driver (0.7.1)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.4)
will_paginate (3.3.0)
will_paginate-bootstrap (1.0.2)
will_paginate (>= 3.0.3)
xml-simple (1.1.5)
xmlrpc (0.3.0)
xpath (3.2.0)
nokogiri (~> 1.8)
@ -686,11 +544,12 @@ DEPENDENCIES
devise-async
devise-i18n
ed25519
factory_girl_rails
factory_bot_rails
fake_email_validator
faker
fog
fog-aws
fog-core
fog-local
font-awesome-rails (~> 4.7.0)
font-kit-rails
foreman
@ -709,15 +568,15 @@ DEPENDENCIES
omniauth
omniauth-tumblr
omniauth-twitter
paperclip (~> 4.2)
paperclip (~> 5.2)
pg
pghero
poltergeist
puma
questiongenerator!
rails (~> 5.2)
rails-assets-growl
rails-assets-jquery (~> 2.2.0)
rails-assets-growl!
rails-assets-jquery (~> 2.2.0)!
rails-i18n (~> 5.0)
rails_admin
rake
@ -725,25 +584,23 @@ DEPENDENCIES
rbnacl-libsodium
redcarpet
redis
rollbar
rspec-rails (~> 3.9)
ruby-progressbar
sanitize
sass-rails (~> 5.0)
sdoc (~> 0.4.1)
sidekiq (< 6)
simplecov
simplecov-json
simplecov-rcov
spring (~> 1.3.5)
spring (~> 2.0)
sweetalert-rails
tiny-color-rails
tumblr_client
tumblr_client!
turbolinks (~> 2.5.3)
twitter
uglifier (>= 1.3.0)
unicorn
web-console (< 3.0.0)
web-console (< 4.0.0)
will_paginate
will_paginate-bootstrap

View File

@ -9,7 +9,7 @@ class DeletionWorker
User.find(resource_id).destroy!
rescue => e
logger.info "failed to delete user: #{e.message}"
Rollbar.error(e)
NewRelic::Agent.notice_error(e)
end
end
end

View File

@ -22,7 +22,7 @@ class QuestionWorker
end
rescue => e
logger.info "failed to ask question: #{e.message}"
Rollbar.error(e)
NewRelic::Agent.notice_error(e)
end
end
end

View File

@ -12,7 +12,7 @@ class ShareWorker
service.post(Answer.find(answer_id)) if services.include? service.provider
rescue => e
logger.info "failed to post answer #{answer_id} to #{service.provider} for user #{user_id}: #{e.message}"
Rollbar.error(e)
NewRelic::Agent.notice_error(e)
end
end
end

View File

@ -36,11 +36,6 @@ append :linked_dirs, "log", "tmp/pids", "tmp/cache", "tmp/sockets", "public/uplo
# Ruby version / RVM
set :rvm1_ruby_version, '2.3.3@retrospring'
# Rollbar
set :rollbar_token, '35f65946f562414da66d0d48073f5290' # TODO: before publishing this repo (again) remove this token
set :rollbar_env, Proc.new { fetch :stage }
set :rollbar_role, Proc.new { :app }
# Create JS i18n files before precompiling assets
before 'deploy:assets:precompile', 'deploy:i18n_js'

View File

@ -1,65 +0,0 @@
Rollbar.configure do |config|
# Without configuration, Rollbar is enabled in all environments.
# To disable in specific environments, set config.enabled=false.
config.access_token = APP_CONFIG.dig('rollbar', 'access_token')
# Here we'll disable in 'test':
if Rails.env.test?
config.enabled = false
end
# Here we'll disable it anywhere else:
config.enabled = false
# scrub out the "confirmation_token" field
config.scrub_fields |= [:confirmation_token]
# By default, Rollbar will try to call the `current_user` controller method
# to fetch the logged-in user object, and then call that object's `id`,
# `username`, and `email` methods to fetch those properties. To customize:
# config.person_method = "my_current_user"
# config.person_id_method = "my_id"
# config.person_username_method = "my_username"
# config.person_email_method = "my_email"
# If you want to attach custom data to all exception and message reports,
# provide a lambda like the following. It should return a hash.
# config.custom_data_method = lambda { {:some_key => "some_value" } }
# Add exception class names to the exception_level_filters hash to
# change the level that exception is reported at. Note that if an exception
# has already been reported and logged the level will need to be changed
# via the rollbar interface.
# Valid levels: 'critical', 'error', 'warning', 'info', 'debug', 'ignore'
# 'ignore' will cause the exception to not be reported at all.
# config.exception_level_filters.merge!('MyCriticalException' => 'critical')
#
# You can also specify a callable, which will be called with the exception instance.
# config.exception_level_filters.merge!('MyCriticalException' => lambda { |e| 'critical' })
config.exception_level_filters.merge!(
'ActiveRecord::RecordNotFound' => 'ignore'
)
# Enable asynchronous reporting (uses girl_friday or Threading if girl_friday
# is not installed)
# config.use_async = true
# Supply your own async handler:
# config.async_handler = Proc.new { |payload|
# Thread.new { Rollbar.process_from_async_handler(payload) }
# }
# Enable asynchronous reporting (using sucker_punch)
# config.use_sucker_punch
# Enable delayed reporting (using Sidekiq)
config.use_sidekiq
# You can supply custom Sidekiq options:
config.use_sidekiq 'queue' => 'rollbar'
# If you run your staging application instance in production environment then
# you'll want to override the environment reported by `Rails.env` with an
# environment variable like this: `ROLLBAR_ENV=staging`. This is a recommended
# setup for Heroku. See:
# https://devcenter.heroku.com/articles/deploying-to-a-custom-rails-environment
config.environment = ENV['ROLLBAR_ENV'] || Rails.env
end

View File

@ -62,6 +62,3 @@ fog:
directory: 'retrospring'
# URL host, comment out to use default, GENERALLY you don't want to define this
# host: ''
rollbar:
access_token: 'sdklgfnaldkfg'

View File

@ -22,7 +22,7 @@ class Exporter
finalize
publish
rescue => e
Rollbar.error(e)
NewRelic::Agent.notice_error(e)
@user.export_processing = false
@user.save validate: false
end

View File

@ -1,8 +1,8 @@
FactoryGirl.define do
FactoryBot.define do
factory :user do |u|
u.sequence(:screen_name) { |n| "#{Faker::Internet.user_name 0..12, %w(_)}#{n}" }
u.sequence(:email) { |n| "#{n}#{Faker::Internet.email}" }
u.password "P4s5w0rD"
u.password { "P4s5w0rD" }
u.sequence(:confirmed_at) { Time.zone.now }
u.display_name { Faker::Name.name }
end

View File

@ -1,6 +1,6 @@
FactoryGirl.define do
FactoryBot.define do
factory :answer do |u|
u.sequence(:content) { |n| "This is an answer. I'm number #{n}!" }
u.user FactoryGirl.create(:user)
u.user { FactoryBot.create(:user) }
end
end

View File

@ -1,9 +1,8 @@
FactoryGirl.define do
FactoryBot.define do
factory :notification do
target_type "MyString"
target_id 1
recipient_id 1
new false
target_type { "MyString" }
target_id { 1 }
recipient_id { 1 }
new { false }
end
end

View File

@ -1,6 +1,6 @@
FactoryGirl.define do
FactoryBot.define do
factory :question do |u|
u.sequence(:content) { |n| "#{QuestionGenerator.generate}#{n}" }
u.author_is_anonymous true
u.author_is_anonymous { true }
end
end

View File

@ -17,7 +17,7 @@ feature "Ban users", :devise do
# And I am banned
# Then I see the sign in page
scenario "user gets banned", js: true do
me = FactoryGirl.create :user
me = FactoryBot.create :user
login_as me, scope: :user
visit root_path
@ -34,7 +34,7 @@ feature "Ban users", :devise do
end
scenario 'user visits banned user profiles', js: true do
evil_user = FactoryGirl.create :user
evil_user = FactoryBot.create :user
evil_user.permanently_banned = true
evil_user.save

View File

@ -8,8 +8,8 @@ feature "User profile page", :devise do
end
scenario "user gets followed", js: true do
me = FactoryGirl.create(:user)
other = FactoryGirl.create(:user)
me = FactoryBot.create(:user)
other = FactoryBot.create(:user)
login_as me, scope: :user
visit show_user_profile_path(other.screen_name)

View File

@ -18,8 +18,8 @@ feature "Inbox", :devise do
# Then I can answer my question
# And see the answer on my user profile
scenario "user answers a question", js: true do
me = FactoryGirl.create :user
question = FactoryGirl.create :question
me = FactoryBot.create :user
question = FactoryBot.create :question
Inbox.create question: question, user: me, new: true
login_as me, scope: :user
@ -46,7 +46,7 @@ feature "Inbox", :devise do
# And I click "Get new question"
# Then I get a new question
scenario 'user generates new question', js: true do
me = FactoryGirl.create :user
me = FactoryBot.create :user
login_as me, scope: :user
visit inbox_path
@ -65,7 +65,7 @@ feature "Inbox", :devise do
# And I don't want to receive questions by anonymous users
# Then I get a new question
scenario 'user with privacy options generates new question', js: true do
me = FactoryGirl.create :user
me = FactoryBot.create :user
me.privacy_allow_anonymous_questions = false
me.save
@ -87,8 +87,8 @@ feature "Inbox", :devise do
# And I delete the question
# Then don't see it anymore in my inbox
scenario "user deletes a question", js: true do
me = FactoryGirl.create :user
question = FactoryGirl.create :question
me = FactoryBot.create :user
question = FactoryBot.create :question
Inbox.create question: question, user: me
login_as me, scope: :user
@ -116,9 +116,9 @@ feature "Inbox", :devise do
# And I click on "Delete all questions"
# Then don't see them anymore in my inbox
scenario "user deletes all questions", js: true do
me = FactoryGirl.create :user
me = FactoryBot.create :user
5.times do
question = FactoryGirl.create :question
question = FactoryBot.create :question
Inbox.create question: question, user: me
end

View File

@ -5,7 +5,7 @@
feature 'Sign in', :devise do
scenario 'user cannot sign in if not registered', js: true do
user = FactoryGirl.build(:user)
user = FactoryBot.build(:user)
signin(user.screen_name, user.password)
expect(page).to have_content I18n.t 'devise.failure.not_found_in_database', authentication_keys: 'login'
end
@ -16,7 +16,7 @@ feature 'Sign in', :devise do
# When I sign in with valid credentials
# Then I see a success message
scenario 'user can sign in with valid credentials', js: true do
user = FactoryGirl.create(:user)
user = FactoryBot.create(:user)
signin(user.email, user.password)
expect(page).to have_content I18n.t 'devise.sessions.signed_in'
end
@ -27,7 +27,7 @@ feature 'Sign in', :devise do
# When I sign in with a wrong email
# Then I see an invalid email message
scenario 'user cannot sign in with wrong email', js: true do
user = FactoryGirl.create(:user)
user = FactoryBot.create(:user)
signin('invalid@email.com', user.password)
expect(page).to have_content I18n.t 'devise.failure.not_found_in_database', authentication_keys: 'login'
end
@ -38,7 +38,7 @@ feature 'Sign in', :devise do
# When I sign in with a wrong password
# Then I see an invalid password message
scenario 'user cannot sign in with wrong password', js: true do
user = FactoryGirl.create(:user)
user = FactoryBot.create(:user)
signin(user.email, 'what the fuck is my p4s5w0rD again?')
expect(page).to have_content I18n.t 'devise.failure.invalid', authentication_keys: 'login'
end

View File

@ -9,7 +9,7 @@ feature 'Sign out', :devise do
# When I sign out
# Then I see a signed out message
scenario 'user signs out successfully', js: true do
user = FactoryGirl.create(:user)
user = FactoryBot.create(:user)
signin(user.email, user.password)
expect(page).to have_content I18n.t 'devise.sessions.signed_in'
click_link user.screen_name

View File

@ -16,7 +16,7 @@ feature "User profile page", :devise do
# When I visit the user profile page
# Then I see my own screen name and follower count
scenario 'user sees own profile', js: true do
user = FactoryGirl.create(:user)
user = FactoryBot.create(:user)
login_as(user, :scope => :user)
@ -31,8 +31,8 @@ feature "User profile page", :devise do
# When I visit another user's profile
# Then I see that user's screen name and follower count
scenario "user sees another user's profile", js: true do
me = FactoryGirl.create(:user)
other = FactoryGirl.create(:user)
me = FactoryBot.create(:user)
other = FactoryBot.create(:user)
login_as me, scope: :user
@ -49,8 +49,8 @@ feature "User profile page", :devise do
# And I click on "Ask"
# Then I see "Question asked successfully."
scenario "user gets asked a question", js: true do
me = FactoryGirl.create(:user)
other = FactoryGirl.create(:user)
me = FactoryBot.create(:user)
other = FactoryBot.create(:user)
login_as me, scope: :user
visit show_user_profile_path(other.screen_name)

View File

@ -4,8 +4,8 @@ RSpec.describe Answer, :type => :model do
before :each do
@answer = Answer.new(
content: 'This is an answer.',
user: FactoryGirl.create(:user),
question: FactoryGirl.create(:question)
user: FactoryBot.create(:user),
question: FactoryBot.create(:question)
)
end

View File

@ -4,7 +4,7 @@ RSpec.describe Question, :type => :model do
before :each do
@question = Question.new(
content: 'Is this a question?',
user: FactoryGirl.create(:user)
user: FactoryBot.create(:user)
)
end
@ -22,12 +22,12 @@ RSpec.describe Question, :type => :model do
end
it 'has many answers' do
5.times { |i| Answer.create(content: "This is an answer. #{i}", user: FactoryGirl.create(:user), question: @question) }
5.times { |i| Answer.create(content: "This is an answer. #{i}", user: FactoryBot.create(:user), question: @question) }
expect(@question.answer_count).to match 5
end
it 'also deletes the answers when deleted' do
5.times { |i| Answer.create(content: "This is an answer. #{i}", user: FactoryGirl.create(:user), question: @question) }
5.times { |i| Answer.create(content: "This is an answer. #{i}", user: FactoryBot.create(:user), question: @question) }
first_answer_id = @question.answers.first.id
@question.destroy
expect{Answer.find(first_answer_id)}.to raise_error(ActiveRecord::RecordNotFound)

View File

@ -17,7 +17,7 @@ Capybara.register_driver :poltergeist do |app|
end
Capybara.javascript_driver = :poltergeist
require 'factory_girl_rails'
require 'factory_bot_rails'
# 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`.

View File

@ -1,3 +1,3 @@
RSpec.configure do |config|
config.include FactoryGirl::Syntax::Methods
config.include FactoryBot::Syntax::Methods
end