rubocop-autocorrect #202
| @ -10,4 +10,8 @@ AllCops: | |||||||
|     - 'config/**/*' |     - 'config/**/*' | ||||||
|     - 'script/**/*' |     - 'script/**/*' | ||||||
|     - 'bin/{rails,rake}' |     - 'bin/{rails,rake}' | ||||||
|     - '*.yml' |     - '*.yml' | ||||||
|  | Layout/LineLength: | ||||||
|  |   Max: 120 | ||||||
|  | RSpec/ExampleLength: | ||||||
|  |   Max: 10 | ||||||
| @ -1,12 +1,14 @@ | |||||||
|  | # frozen_string_literal: true | ||||||
|  | 
 | ||||||
| # Copyright (C) 2024 Manuel Bustillo | # Copyright (C) 2024 Manuel Bustillo | ||||||
| 
 | 
 | ||||||
| require 'rails_helper' | require 'rails_helper' | ||||||
| 
 | 
 | ||||||
| RSpec.describe Expense, type: :model do | RSpec.describe Expense do | ||||||
|   describe 'validations' do |   describe 'validations' do | ||||||
|     it { should validate_presence_of(:name) } |     it { is_expected.to validate_presence_of(:name) } | ||||||
|     it { should validate_presence_of(:amount) } |     it { is_expected.to validate_presence_of(:amount) } | ||||||
|     it { should validate_numericality_of(:amount).is_greater_than(0) } |     it { is_expected.to validate_numericality_of(:amount).is_greater_than(0) } | ||||||
|     it { should validate_presence_of(:pricing_type) } |     it { is_expected.to validate_presence_of(:pricing_type) } | ||||||
|   end |   end | ||||||
| end | end | ||||||
|  | |||||||
| @ -4,16 +4,20 @@ | |||||||
| 
 | 
 | ||||||
| require 'rails_helper' | require 'rails_helper' | ||||||
| 
 | 
 | ||||||
| RSpec.describe GroupAffinity, type: :model do | RSpec.describe GroupAffinity do | ||||||
|  |   subject(:affinity) { build(:group_affinity, group_a:, group_b:) } | ||||||
|  | 
 | ||||||
|   let(:wedding) { create(:wedding) } |   let(:wedding) { create(:wedding) } | ||||||
|   let(:group_a) { create(:group, wedding:) } |   let(:group_a) { create(:group, wedding:) } | ||||||
|   let(:group_b) { create(:group, wedding:) } |   let(:group_b) { create(:group, wedding:) } | ||||||
|   let(:group_c) { create(:group, wedding:) } |   let(:group_c) { create(:group, wedding:) } | ||||||
| 
 | 
 | ||||||
|   subject { build(:group_affinity, group_a:, group_b: ) } |  | ||||||
| 
 |  | ||||||
|   describe 'validations' do |   describe 'validations' do | ||||||
|     it { should validate_numericality_of(:discomfort).is_greater_than_or_equal_to(0).is_less_than_or_equal_to(2) } |     it do | ||||||
|  |       expect(affinity).to validate_numericality_of(:discomfort) | ||||||
|  |         .is_greater_than_or_equal_to(0) | ||||||
|  |         .is_less_than_or_equal_to(2) | ||||||
|  |     end | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   describe '.create' do |   describe '.create' do | ||||||
|  | |||||||
| @ -1,10 +1,12 @@ | |||||||
|  | # frozen_string_literal: true | ||||||
|  | 
 | ||||||
| # Copyright (C) 2024 Manuel Bustillo | # Copyright (C) 2024 Manuel Bustillo | ||||||
| 
 | 
 | ||||||
| require 'rails_helper' | require 'rails_helper' | ||||||
| 
 | 
 | ||||||
| RSpec.describe Group, type: :model do | RSpec.describe Group do | ||||||
|   describe 'callbacks' do |   describe 'callbacks' do | ||||||
|     it 'should set color before create' do |     it 'sets color before create' do | ||||||
|       expect(create(:group).color).to be_present |       expect(create(:group).color).to be_present | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|  | |||||||
| @ -1,12 +1,17 @@ | |||||||
|  | # frozen_string_literal: true | ||||||
|  | 
 | ||||||
| # Copyright (C) 2024 Manuel Bustillo | # Copyright (C) 2024 Manuel Bustillo | ||||||
| 
 | 
 | ||||||
| require 'rails_helper' | require 'rails_helper' | ||||||
| 
 | 
 | ||||||
| RSpec.describe Guest, type: :model do | RSpec.describe Guest do | ||||||
|   describe 'validations' do |   describe 'validations' do | ||||||
|     it { should validate_presence_of(:name) } |     subject(:guest) { build(:guest) } | ||||||
|  | 
 | ||||||
|  |     it { is_expected.to validate_presence_of(:name) } | ||||||
|  | 
 | ||||||
|     it do |     it do | ||||||
|       should define_enum_for(:status).with_values( |       expect(guest).to define_enum_for(:status).with_values( | ||||||
|         considered: 0, |         considered: 0, | ||||||
|         invited: 10, |         invited: 10, | ||||||
|         confirmed: 20, |         confirmed: 20, | ||||||
| @ -16,7 +21,7 @@ RSpec.describe Guest, type: :model do | |||||||
|     end |     end | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   it { should belong_to(:group).optional } |   it { is_expected.to belong_to(:group).optional } | ||||||
| 
 | 
 | ||||||
|   describe 'scopes' do |   describe 'scopes' do | ||||||
|     describe '.potential' do |     describe '.potential' do | ||||||
| @ -27,7 +32,7 @@ RSpec.describe Guest, type: :model do | |||||||
|         confirmed_guest = create(:guest, status: :confirmed) |         confirmed_guest = create(:guest, status: :confirmed) | ||||||
|         tentative_guest = create(:guest, status: :tentative) |         tentative_guest = create(:guest, status: :tentative) | ||||||
| 
 | 
 | ||||||
|         expect(Guest.potential).to match_array([invited_guest, confirmed_guest, tentative_guest]) |         expect(described_class.potential).to contain_exactly(invited_guest, confirmed_guest, tentative_guest) | ||||||
|       end |       end | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|  | |||||||
| @ -1,7 +1,9 @@ | |||||||
|  | # frozen_string_literal: true | ||||||
|  | 
 | ||||||
| # Copyright (C) 2024 Manuel Bustillo | # Copyright (C) 2024 Manuel Bustillo | ||||||
| 
 | 
 | ||||||
| require 'rails_helper' | require 'rails_helper' | ||||||
| 
 | 
 | ||||||
| RSpec.describe Seat, type: :model do | RSpec.describe Seat do | ||||||
|   pending "add some examples to (or delete) #{__FILE__}" |   pending "add some examples to (or delete) #{__FILE__}" | ||||||
| end | end | ||||||
|  | |||||||
| @ -1,8 +1,10 @@ | |||||||
|  | # frozen_string_literal: true | ||||||
|  | 
 | ||||||
| # Copyright (C) 2024 Manuel Bustillo | # Copyright (C) 2024 Manuel Bustillo | ||||||
| 
 | 
 | ||||||
| require 'rails_helper' | require 'rails_helper' | ||||||
| 
 | 
 | ||||||
| RSpec.describe TablesArrangement, type: :model do | RSpec.describe TablesArrangement do | ||||||
|   describe 'callbacks' do |   describe 'callbacks' do | ||||||
|     it 'assigns a name before creation' do |     it 'assigns a name before creation' do | ||||||
|       expect(create(:tables_arrangement).name).to be_present |       expect(create(:tables_arrangement).name).to be_present | ||||||
|  | |||||||
| @ -1,7 +1,9 @@ | |||||||
|  | # frozen_string_literal: true | ||||||
|  | 
 | ||||||
| # Copyright (C) 2024 Manuel Bustillo | # Copyright (C) 2024 Manuel Bustillo | ||||||
| 
 | 
 | ||||||
| require 'rails_helper' | require 'rails_helper' | ||||||
| 
 | 
 | ||||||
| RSpec.describe User, type: :model do | RSpec.describe User do | ||||||
|   pending "add some examples to (or delete) #{__FILE__}" |   pending "add some examples to (or delete) #{__FILE__}" | ||||||
| end | end | ||||||
|  | |||||||
| @ -1,22 +1,25 @@ | |||||||
|  | # frozen_string_literal: true | ||||||
|  | 
 | ||||||
| # Copyright (C) 2024 Manuel Bustillo | # Copyright (C) 2024 Manuel Bustillo | ||||||
| 
 | 
 | ||||||
| require 'rails_helper' | require 'rails_helper' | ||||||
| 
 | 
 | ||||||
| RSpec.describe Wedding, type: :model do | RSpec.describe Wedding do | ||||||
|   describe 'validations' do |   describe 'validations' do | ||||||
|     subject { build(:wedding) } |     subject { build(:wedding) } | ||||||
|     describe 'slug' do |  | ||||||
|       it { should allow_value('foo').for(:slug) } |  | ||||||
|       it { should allow_value('foo-bar').for(:slug) } |  | ||||||
|       it { should allow_value('foo-123').for(:slug) } |  | ||||||
|       it { should allow_value('foo-123-').for(:slug) } |  | ||||||
|       it { should allow_value('foo--123').for(:slug) } |  | ||||||
| 
 | 
 | ||||||
|       it { should_not allow_value('Foo').for(:slug) } |     describe 'slug' do | ||||||
|       it { should_not allow_value('/foo').for(:slug) } |       it { is_expected.to allow_value('foo').for(:slug) } | ||||||
|       it { should_not allow_value('foo/123').for(:slug) } |       it { is_expected.to allow_value('foo-bar').for(:slug) } | ||||||
|       it { should_not allow_value('foo_123').for(:slug) } |       it { is_expected.to allow_value('foo-123').for(:slug) } | ||||||
|       it { should_not allow_value('foo/').for(:slug) } |       it { is_expected.to allow_value('foo-123-').for(:slug) } | ||||||
|  |       it { is_expected.to allow_value('foo--123').for(:slug) } | ||||||
|  | 
 | ||||||
|  |       it { is_expected.not_to allow_value('Foo').for(:slug) } | ||||||
|  |       it { is_expected.not_to allow_value('/foo').for(:slug) } | ||||||
|  |       it { is_expected.not_to allow_value('foo/123').for(:slug) } | ||||||
|  |       it { is_expected.not_to allow_value('foo_123').for(:slug) } | ||||||
|  |       it { is_expected.not_to allow_value('foo/').for(:slug) } | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
| end | end | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user