Skip to content

Commit

Permalink
Modify specs tests because model validations changed
Browse files Browse the repository at this point in the history
  • Loading branch information
danifromecuador committed Oct 29, 2023
1 parent f6ba637 commit 5774eda
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions spec/models/category_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
let(:user) { User.create(name: 'John Doe', email: 'foo@bar.com', password: '123456') }

it 'is valid with a name and user' do
category = Category.new(name: 'Food', user:)
category = Category.new(name: 'Food', icon: '🍴', user:)
expect(category).to be_valid
end

Expand All @@ -15,8 +15,8 @@

it 'allows the same category name for different users' do
another_user = User.create(name: 'Alice', email: 'alice@bar.com', password: '654321')
Category.create(name: 'Food', user:)
category2 = Category.new(name: 'Food', user: another_user)
Category.create(name: 'Food', icon: '🍴', user:)
category2 = Category.new(name: 'Food', icon: '🍴', user: another_user)
expect(category2).to be_valid
end
end
4 changes: 2 additions & 2 deletions spec/models/expense_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

RSpec.describe Expense, type: :model do
let(:user) { User.create(name: 'John Doe', email: 'foo@bar.com', password: '123456') }
let(:category) { Category.create(name: 'Food', user:) }
let(:category) { Category.create(name: 'Food', icon: '🍴', user:) }

it 'is associated with a category' do
expense = Expense.new(amount: 25, category:)
Expand All @@ -25,7 +25,7 @@
end

it 'can save a valid expense' do
expense = Expense.new(amount: 50, category:, author: user)
expense = Expense.new(name: 'Pizza', amount: 25, category:, author: user)
expect(expense).to be_valid
end
end

0 comments on commit 5774eda

Please sign in to comment.