diff --git a/Gemfile b/Gemfile index ac5eca57..7030ff4e 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby '3.1.0' -gem 'rails', '7.0.3.1' +gem 'rails', '7.0.4' gem 'pg', '~> 1.1' gem 'puma', '~> 5.0' gem 'tzinfo-data', platforms: %i[ mingw mswin x64_mingw jruby ] diff --git a/Gemfile.lock b/Gemfile.lock index 53c5df89..3f342cff 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,67 +1,67 @@ GEM remote: https://rubygems.org/ specs: - actioncable (7.0.3.1) - actionpack (= 7.0.3.1) - activesupport (= 7.0.3.1) + actioncable (7.0.4) + actionpack (= 7.0.4) + activesupport (= 7.0.4) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.3.1) - actionpack (= 7.0.3.1) - activejob (= 7.0.3.1) - activerecord (= 7.0.3.1) - activestorage (= 7.0.3.1) - activesupport (= 7.0.3.1) + actionmailbox (7.0.4) + actionpack (= 7.0.4) + activejob (= 7.0.4) + activerecord (= 7.0.4) + activestorage (= 7.0.4) + activesupport (= 7.0.4) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.3.1) - actionpack (= 7.0.3.1) - actionview (= 7.0.3.1) - activejob (= 7.0.3.1) - activesupport (= 7.0.3.1) + actionmailer (7.0.4) + actionpack (= 7.0.4) + actionview (= 7.0.4) + activejob (= 7.0.4) + activesupport (= 7.0.4) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.3.1) - actionview (= 7.0.3.1) - activesupport (= 7.0.3.1) + actionpack (7.0.4) + actionview (= 7.0.4) + activesupport (= 7.0.4) rack (~> 2.0, >= 2.2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.3.1) - actionpack (= 7.0.3.1) - activerecord (= 7.0.3.1) - activestorage (= 7.0.3.1) - activesupport (= 7.0.3.1) + actiontext (7.0.4) + actionpack (= 7.0.4) + activerecord (= 7.0.4) + activestorage (= 7.0.4) + activesupport (= 7.0.4) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.3.1) - activesupport (= 7.0.3.1) + actionview (7.0.4) + activesupport (= 7.0.4) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.3.1) - activesupport (= 7.0.3.1) + activejob (7.0.4) + activesupport (= 7.0.4) globalid (>= 0.3.6) - activemodel (7.0.3.1) - activesupport (= 7.0.3.1) - activerecord (7.0.3.1) - activemodel (= 7.0.3.1) - activesupport (= 7.0.3.1) - activestorage (7.0.3.1) - actionpack (= 7.0.3.1) - activejob (= 7.0.3.1) - activerecord (= 7.0.3.1) - activesupport (= 7.0.3.1) + activemodel (7.0.4) + activesupport (= 7.0.4) + activerecord (7.0.4) + activemodel (= 7.0.4) + activesupport (= 7.0.4) + activestorage (7.0.4) + actionpack (= 7.0.4) + activejob (= 7.0.4) + activerecord (= 7.0.4) + activesupport (= 7.0.4) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (7.0.3.1) + activesupport (7.0.4) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -82,7 +82,6 @@ GEM responders warden (~> 1.2.3) diff-lcs (1.5.0) - digest (3.1.0) docile (1.4.0) erubi (1.11.0) factory_bot (6.2.1) @@ -97,9 +96,9 @@ GEM i18n (1.12.0) concurrent-ruby (~> 1.0) io-console (0.5.11) - irb (1.4.1) + irb (1.4.2) reline (>= 0.3.0) - loofah (2.18.0) + loofah (2.19.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) @@ -107,57 +106,51 @@ GEM marcel (1.0.2) method_source (1.0.0) mini_mime (1.1.2) - minitest (5.16.2) - msgpack (1.5.4) - net-imap (0.2.3) - digest + minitest (5.16.3) + msgpack (1.6.0) + net-imap (0.3.1) net-protocol - strscan - net-pop (0.1.1) - digest + net-pop (0.1.2) net-protocol - timeout net-protocol (0.1.3) timeout - net-smtp (0.3.1) - digest + net-smtp (0.3.2) net-protocol - timeout nio4r (2.5.8) nokogiri (1.13.8-aarch64-linux) racc (~> 1.4) nokogiri (1.13.8-arm64-darwin) racc (~> 1.4) orm_adapter (0.5.0) - pg (1.4.3) - puma (5.6.4) + pg (1.4.4) + puma (5.6.5) nio4r (~> 2.0) racc (1.6.0) rack (2.2.4) rack-test (2.0.2) rack (>= 1.3) - rails (7.0.3.1) - actioncable (= 7.0.3.1) - actionmailbox (= 7.0.3.1) - actionmailer (= 7.0.3.1) - actionpack (= 7.0.3.1) - actiontext (= 7.0.3.1) - actionview (= 7.0.3.1) - activejob (= 7.0.3.1) - activemodel (= 7.0.3.1) - activerecord (= 7.0.3.1) - activestorage (= 7.0.3.1) - activesupport (= 7.0.3.1) + rails (7.0.4) + actioncable (= 7.0.4) + actionmailbox (= 7.0.4) + actionmailer (= 7.0.4) + actionpack (= 7.0.4) + actiontext (= 7.0.4) + actionview (= 7.0.4) + activejob (= 7.0.4) + activemodel (= 7.0.4) + activerecord (= 7.0.4) + activestorage (= 7.0.4) + activesupport (= 7.0.4) bundler (>= 1.15.0) - railties (= 7.0.3.1) + railties (= 7.0.4) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) rails-html-sanitizer (1.4.3) loofah (~> 2.3) - railties (7.0.3.1) - actionpack (= 7.0.3.1) - activesupport (= 7.0.3.1) + railties (7.0.4) + actionpack (= 7.0.4) + activesupport (= 7.0.4) method_source rake (>= 12.2) thor (~> 1.0) @@ -170,7 +163,7 @@ GEM railties (>= 5.0) rspec-core (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) rspec-support (~> 3.11.0) rspec-mocks (3.11.1) @@ -184,8 +177,8 @@ GEM rspec-expectations (~> 3.10) rspec-mocks (~> 3.10) rspec-support (~> 3.10) - rspec-support (3.11.0) - shoulda-matchers (5.1.0) + rspec-support (3.11.1) + shoulda-matchers (5.2.0) activesupport (>= 5.2.0) simplecov (0.21.2) docile (~> 1.1) @@ -202,14 +195,13 @@ GEM sprockets (>= 3.0.0) stimulus-rails (1.1.0) railties (>= 6.0.0) - strscan (3.0.4) - tailwindcss-rails (2.0.12-aarch64-linux) + tailwindcss-rails (2.0.14-aarch64-linux) railties (>= 6.0.0) - tailwindcss-rails (2.0.12-arm64-darwin) + tailwindcss-rails (2.0.14-arm64-darwin) railties (>= 6.0.0) thor (1.2.1) timeout (0.3.0) - turbo-rails (1.1.1) + turbo-rails (1.3.1) actionpack (>= 6.0.0) activejob (>= 6.0.0) railties (>= 6.0.0) @@ -220,7 +212,7 @@ GEM websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - zeitwerk (2.6.0) + zeitwerk (2.6.1) PLATFORMS aarch64-linux-musl @@ -235,7 +227,7 @@ DEPENDENCIES foreman pg (~> 1.1) puma (~> 5.0) - rails (= 7.0.3.1) + rails (= 7.0.4) rspec-rails (~> 5.1.0) shoulda-matchers (~> 5.1) simplecov (~> 0.21) diff --git a/spec/factories/services.rb b/spec/factories/services.rb deleted file mode 100644 index b1983750..00000000 --- a/spec/factories/services.rb +++ /dev/null @@ -1,6 +0,0 @@ -FactoryBot.define do - factory :service do - name { FFaker::Color.name } - description { FFaker::Company.catch_phrase } - end -end diff --git a/spec/factories/user_services.rb b/spec/factories/user_services.rb deleted file mode 100644 index d94f076f..00000000 --- a/spec/factories/user_services.rb +++ /dev/null @@ -1,8 +0,0 @@ -FactoryBot.define do - factory :user_service do - user { nil } - service { nil } - price { 1 } - unit { 1 } - end -end diff --git a/spec/factories/users.rb b/spec/factories/users.rb index cb54887a..52eebd22 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -1,32 +1,9 @@ FactoryBot.define do - factory :user, aliases: [:client] do + factory :user do sequence :email do |n| "user#{n}@example.com" end 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 diff --git a/spec/models/service_spec.rb b/spec/models/service_spec.rb deleted file mode 100644 index 7c5a00a1..00000000 --- a/spec/models/service_spec.rb +++ /dev/null @@ -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 diff --git a/spec/models/user_service_spec.rb b/spec/models/user_service_spec.rb deleted file mode 100644 index db05f6f3..00000000 --- a/spec/models/user_service_spec.rb +++ /dev/null @@ -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 diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 745612ae..ab0da922 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,9 +1,4 @@ require 'rails_helper' 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 diff --git a/spec/requests/devise/registrations_spec.rb b/spec/requests/devise/registrations_spec.rb index e31d8b7e..dda46e9e 100644 --- a/spec/requests/devise/registrations_spec.rb +++ b/spec/requests/devise/registrations_spec.rb @@ -2,36 +2,12 @@ require 'rails_helper' RSpec.describe 'users', type: :request do describe 'POST /create' do - context 'when registers as master' do - let(:services) { FactoryBot.create_list(:service, 3) } - let(:master_params) do - { user: FactoryBot.attributes_for(:master).merge(services_ids: services.pluck(:id)) } - end - - it 'creates master' do - expect do - 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 - - 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 + let(:user_params) do + { user: FactoryBot.attributes_for(:user) } end - context 'when registers as client' + it 'creates master' do + expect { post '/users', params: user_params }.to change(User, :count).by(1) + end end end diff --git a/spec/requests/profis_spec.rb b/spec/requests/profis_spec.rb deleted file mode 100644 index a034d05d..00000000 --- a/spec/requests/profis_spec.rb +++ /dev/null @@ -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