Update gems and remove unused code

This commit is contained in:
Eugene Burmakin 2022-10-13 12:00:39 +02:00
parent 558bd6d2c2
commit ce0dcb66e2
10 changed files with 77 additions and 200 deletions

View file

@ -2,7 +2,7 @@ source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" } git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '3.1.0' ruby '3.1.0'
gem 'rails', '7.0.3.1' gem 'rails', '7.0.4'
gem 'pg', '~> 1.1' gem 'pg', '~> 1.1'
gem 'puma', '~> 5.0' gem 'puma', '~> 5.0'
gem 'tzinfo-data', platforms: %i[ mingw mswin x64_mingw jruby ] gem 'tzinfo-data', platforms: %i[ mingw mswin x64_mingw jruby ]

View file

@ -1,67 +1,67 @@
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actioncable (7.0.3.1) actioncable (7.0.4)
actionpack (= 7.0.3.1) actionpack (= 7.0.4)
activesupport (= 7.0.3.1) activesupport (= 7.0.4)
nio4r (~> 2.0) nio4r (~> 2.0)
websocket-driver (>= 0.6.1) websocket-driver (>= 0.6.1)
actionmailbox (7.0.3.1) actionmailbox (7.0.4)
actionpack (= 7.0.3.1) actionpack (= 7.0.4)
activejob (= 7.0.3.1) activejob (= 7.0.4)
activerecord (= 7.0.3.1) activerecord (= 7.0.4)
activestorage (= 7.0.3.1) activestorage (= 7.0.4)
activesupport (= 7.0.3.1) activesupport (= 7.0.4)
mail (>= 2.7.1) mail (>= 2.7.1)
net-imap net-imap
net-pop net-pop
net-smtp net-smtp
actionmailer (7.0.3.1) actionmailer (7.0.4)
actionpack (= 7.0.3.1) actionpack (= 7.0.4)
actionview (= 7.0.3.1) actionview (= 7.0.4)
activejob (= 7.0.3.1) activejob (= 7.0.4)
activesupport (= 7.0.3.1) activesupport (= 7.0.4)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
net-imap net-imap
net-pop net-pop
net-smtp net-smtp
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
actionpack (7.0.3.1) actionpack (7.0.4)
actionview (= 7.0.3.1) actionview (= 7.0.4)
activesupport (= 7.0.3.1) activesupport (= 7.0.4)
rack (~> 2.0, >= 2.2.0) rack (~> 2.0, >= 2.2.0)
rack-test (>= 0.6.3) rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (7.0.3.1) actiontext (7.0.4)
actionpack (= 7.0.3.1) actionpack (= 7.0.4)
activerecord (= 7.0.3.1) activerecord (= 7.0.4)
activestorage (= 7.0.3.1) activestorage (= 7.0.4)
activesupport (= 7.0.3.1) activesupport (= 7.0.4)
globalid (>= 0.6.0) globalid (>= 0.6.0)
nokogiri (>= 1.8.5) nokogiri (>= 1.8.5)
actionview (7.0.3.1) actionview (7.0.4)
activesupport (= 7.0.3.1) activesupport (= 7.0.4)
builder (~> 3.1) builder (~> 3.1)
erubi (~> 1.4) erubi (~> 1.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (7.0.3.1) activejob (7.0.4)
activesupport (= 7.0.3.1) activesupport (= 7.0.4)
globalid (>= 0.3.6) globalid (>= 0.3.6)
activemodel (7.0.3.1) activemodel (7.0.4)
activesupport (= 7.0.3.1) activesupport (= 7.0.4)
activerecord (7.0.3.1) activerecord (7.0.4)
activemodel (= 7.0.3.1) activemodel (= 7.0.4)
activesupport (= 7.0.3.1) activesupport (= 7.0.4)
activestorage (7.0.3.1) activestorage (7.0.4)
actionpack (= 7.0.3.1) actionpack (= 7.0.4)
activejob (= 7.0.3.1) activejob (= 7.0.4)
activerecord (= 7.0.3.1) activerecord (= 7.0.4)
activesupport (= 7.0.3.1) activesupport (= 7.0.4)
marcel (~> 1.0) marcel (~> 1.0)
mini_mime (>= 1.1.0) mini_mime (>= 1.1.0)
activesupport (7.0.3.1) activesupport (7.0.4)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2) i18n (>= 1.6, < 2)
minitest (>= 5.1) minitest (>= 5.1)
@ -82,7 +82,6 @@ GEM
responders responders
warden (~> 1.2.3) warden (~> 1.2.3)
diff-lcs (1.5.0) diff-lcs (1.5.0)
digest (3.1.0)
docile (1.4.0) docile (1.4.0)
erubi (1.11.0) erubi (1.11.0)
factory_bot (6.2.1) factory_bot (6.2.1)
@ -97,9 +96,9 @@ GEM
i18n (1.12.0) i18n (1.12.0)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
io-console (0.5.11) io-console (0.5.11)
irb (1.4.1) irb (1.4.2)
reline (>= 0.3.0) reline (>= 0.3.0)
loofah (2.18.0) loofah (2.19.0)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
mail (2.7.1) mail (2.7.1)
@ -107,57 +106,51 @@ GEM
marcel (1.0.2) marcel (1.0.2)
method_source (1.0.0) method_source (1.0.0)
mini_mime (1.1.2) mini_mime (1.1.2)
minitest (5.16.2) minitest (5.16.3)
msgpack (1.5.4) msgpack (1.6.0)
net-imap (0.2.3) net-imap (0.3.1)
digest
net-protocol net-protocol
strscan net-pop (0.1.2)
net-pop (0.1.1)
digest
net-protocol net-protocol
timeout
net-protocol (0.1.3) net-protocol (0.1.3)
timeout timeout
net-smtp (0.3.1) net-smtp (0.3.2)
digest
net-protocol net-protocol
timeout
nio4r (2.5.8) nio4r (2.5.8)
nokogiri (1.13.8-aarch64-linux) nokogiri (1.13.8-aarch64-linux)
racc (~> 1.4) racc (~> 1.4)
nokogiri (1.13.8-arm64-darwin) nokogiri (1.13.8-arm64-darwin)
racc (~> 1.4) racc (~> 1.4)
orm_adapter (0.5.0) orm_adapter (0.5.0)
pg (1.4.3) pg (1.4.4)
puma (5.6.4) puma (5.6.5)
nio4r (~> 2.0) nio4r (~> 2.0)
racc (1.6.0) racc (1.6.0)
rack (2.2.4) rack (2.2.4)
rack-test (2.0.2) rack-test (2.0.2)
rack (>= 1.3) rack (>= 1.3)
rails (7.0.3.1) rails (7.0.4)
actioncable (= 7.0.3.1) actioncable (= 7.0.4)
actionmailbox (= 7.0.3.1) actionmailbox (= 7.0.4)
actionmailer (= 7.0.3.1) actionmailer (= 7.0.4)
actionpack (= 7.0.3.1) actionpack (= 7.0.4)
actiontext (= 7.0.3.1) actiontext (= 7.0.4)
actionview (= 7.0.3.1) actionview (= 7.0.4)
activejob (= 7.0.3.1) activejob (= 7.0.4)
activemodel (= 7.0.3.1) activemodel (= 7.0.4)
activerecord (= 7.0.3.1) activerecord (= 7.0.4)
activestorage (= 7.0.3.1) activestorage (= 7.0.4)
activesupport (= 7.0.3.1) activesupport (= 7.0.4)
bundler (>= 1.15.0) bundler (>= 1.15.0)
railties (= 7.0.3.1) railties (= 7.0.4)
rails-dom-testing (2.0.3) rails-dom-testing (2.0.3)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
nokogiri (>= 1.6) nokogiri (>= 1.6)
rails-html-sanitizer (1.4.3) rails-html-sanitizer (1.4.3)
loofah (~> 2.3) loofah (~> 2.3)
railties (7.0.3.1) railties (7.0.4)
actionpack (= 7.0.3.1) actionpack (= 7.0.4)
activesupport (= 7.0.3.1) activesupport (= 7.0.4)
method_source method_source
rake (>= 12.2) rake (>= 12.2)
thor (~> 1.0) thor (~> 1.0)
@ -170,7 +163,7 @@ GEM
railties (>= 5.0) railties (>= 5.0)
rspec-core (3.11.0) rspec-core (3.11.0)
rspec-support (~> 3.11.0) rspec-support (~> 3.11.0)
rspec-expectations (3.11.0) rspec-expectations (3.11.1)
diff-lcs (>= 1.2.0, < 2.0) diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0) rspec-support (~> 3.11.0)
rspec-mocks (3.11.1) rspec-mocks (3.11.1)
@ -184,8 +177,8 @@ GEM
rspec-expectations (~> 3.10) rspec-expectations (~> 3.10)
rspec-mocks (~> 3.10) rspec-mocks (~> 3.10)
rspec-support (~> 3.10) rspec-support (~> 3.10)
rspec-support (3.11.0) rspec-support (3.11.1)
shoulda-matchers (5.1.0) shoulda-matchers (5.2.0)
activesupport (>= 5.2.0) activesupport (>= 5.2.0)
simplecov (0.21.2) simplecov (0.21.2)
docile (~> 1.1) docile (~> 1.1)
@ -202,14 +195,13 @@ GEM
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
stimulus-rails (1.1.0) stimulus-rails (1.1.0)
railties (>= 6.0.0) railties (>= 6.0.0)
strscan (3.0.4) tailwindcss-rails (2.0.14-aarch64-linux)
tailwindcss-rails (2.0.12-aarch64-linux)
railties (>= 6.0.0) railties (>= 6.0.0)
tailwindcss-rails (2.0.12-arm64-darwin) tailwindcss-rails (2.0.14-arm64-darwin)
railties (>= 6.0.0) railties (>= 6.0.0)
thor (1.2.1) thor (1.2.1)
timeout (0.3.0) timeout (0.3.0)
turbo-rails (1.1.1) turbo-rails (1.3.1)
actionpack (>= 6.0.0) actionpack (>= 6.0.0)
activejob (>= 6.0.0) activejob (>= 6.0.0)
railties (>= 6.0.0) railties (>= 6.0.0)
@ -220,7 +212,7 @@ GEM
websocket-driver (0.7.5) websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0) websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5) websocket-extensions (0.1.5)
zeitwerk (2.6.0) zeitwerk (2.6.1)
PLATFORMS PLATFORMS
aarch64-linux-musl aarch64-linux-musl
@ -235,7 +227,7 @@ DEPENDENCIES
foreman foreman
pg (~> 1.1) pg (~> 1.1)
puma (~> 5.0) puma (~> 5.0)
rails (= 7.0.3.1) rails (= 7.0.4)
rspec-rails (~> 5.1.0) rspec-rails (~> 5.1.0)
shoulda-matchers (~> 5.1) shoulda-matchers (~> 5.1)
simplecov (~> 0.21) simplecov (~> 0.21)

View file

@ -1,6 +0,0 @@
FactoryBot.define do
factory :service do
name { FFaker::Color.name }
description { FFaker::Company.catch_phrase }
end
end

View file

@ -1,8 +0,0 @@
FactoryBot.define do
factory :user_service do
user { nil }
service { nil }
price { 1 }
unit { 1 }
end
end

View file

@ -1,32 +1,9 @@
FactoryBot.define do FactoryBot.define do
factory :user, aliases: [:client] do factory :user do
sequence :email do |n| sequence :email do |n|
"user#{n}@example.com" "user#{n}@example.com"
end end
password { SecureRandom.hex(8) } password { SecureRandom.hex(8) }
is_master { false }
end
# TODO: Refactor to traits
factory :master, class: 'User' do
sequence :email do |n|
"master#{n}@example.com"
end
first_name { FFaker::Name.first_name }
last_name { FFaker::Name.last_name }
tos_accepted { true }
password { SecureRandom.hex(8) }
is_master { true }
whatsapp { 'link_to_whatsapp' }
viber { 'link_to_viber' }
telegram { 'link_to_telegram' }
facebook { 'link_to_facebook' }
portfolio_url { 'link_to_portfolio' }
end end
end end

View file

@ -1,10 +0,0 @@
require 'rails_helper'
RSpec.describe Service, type: :model do
it { is_expected.to validate_presence_of(:name) }
it { is_expected.to validate_presence_of(:description) }
it { is_expected.to validate_uniqueness_of(:name) }
it { is_expected.to have_many(:user_services) }
it { is_expected.to have_many(:users).through(:user_services) }
end

View file

@ -1,9 +0,0 @@
require 'rails_helper'
RSpec.describe UserService, type: :model do
it { is_expected.to belong_to(:user) }
it { is_expected.to belong_to(:service) }
# it { is_expected.to validate_presence_of(:price) }
# it { is_expected.to validate_presence_of(:unit) }
it { is_expected.to validate_numericality_of(:price).is_greater_than_or_equal_to(0) }
end

View file

@ -1,9 +1,4 @@
require 'rails_helper' require 'rails_helper'
RSpec.describe User, type: :model do RSpec.describe User, type: :model do
it { is_expected.to have_many(:user_services) }
it { is_expected.to have_many(:services).through(:user_services) }
it { is_expected.to validate_presence_of(:first_name) }
it { is_expected.to validate_presence_of(:last_name) }
it { is_expected.to validate_acceptance_of(:tos_accepted) }
end end

View file

@ -2,36 +2,12 @@ require 'rails_helper'
RSpec.describe 'users', type: :request do RSpec.describe 'users', type: :request do
describe 'POST /create' do describe 'POST /create' do
context 'when registers as master' do let(:user_params) do
let(:services) { FactoryBot.create_list(:service, 3) } { user: FactoryBot.attributes_for(:user) }
let(:master_params) do
{ user: FactoryBot.attributes_for(:master).merge(services_ids: services.pluck(:id)) }
end end
it 'creates master' do it 'creates master' do
expect do expect { post '/users', params: user_params }.to change(User, :count).by(1)
post '/users', params: master_params
end.to change(User, :count).by(1)
expect(User.masters.count).to eq(1)
master = User.masters.first
expect(master.whatsapp).to eq(master_params[:user][:whatsapp])
expect(master.viber).to eq(master_params[:user][:viber])
expect(master.telegram).to eq(master_params[:user][:telegram])
expect(master.facebook).to eq(master_params[:user][:facebook])
expect(master.portfolio_url).to eq(master_params[:user][:portfolio_url])
end end
it 'creates master services' do
expect do
post '/users', params: master_params
end.to change(UserService, :count).by(3)
expect(User.masters.last.services).to eq(services)
end
end
context 'when registers as client'
end end
end end

View file

@ -1,30 +0,0 @@
require 'rails_helper'
RSpec.describe "/profis", type: :request do
# Profi. As you add validations to Profi, be sure to
# adjust the attributes here as well.
let(:valid_attributes) {
skip("Add a hash of attributes valid for your model")
}
let(:invalid_attributes) {
skip("Add a hash of attributes invalid for your model")
}
describe "GET /index" do
xit "renders a successful response" do
Profi.create! valid_attributes
get profis_url
expect(response).to be_successful
end
end
describe "GET /show" do
xit "renders a successful response" do
profi = Profi.create! valid_attributes
get profi_url(profi)
expect(response).to be_successful
end
end
end