-
Notifications
You must be signed in to change notification settings - Fork 3
First Homework #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
homework/podcasting/Gemfile
Outdated
| gem "selenium-webdriver" | ||
| end | ||
|
|
||
| gem "factory_bot", "~> 6.5" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
тоже лучше делать в блоке development/test
| title { 'New title' } | ||
| association :author, factory: :author | ||
|
|
||
| trait :with_archived_status do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
с одной стороны, ты аккуратно сделал через trait, но лучше использовать этот механизм для более сложных переиспользуемых случаев. Один атрибут лучше выставлять прямо в тесте передавая такие атрибуты в фабрику FactoryBot.build(:podcast, title: nil)
| factory :podcast do | ||
| status { 'new' } | ||
| title { 'New title' } | ||
| association :author, factory: :author |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
супер, что нашел эту конструкцию
| end | ||
|
|
||
| it 'should be possible to add comment' do | ||
| comments_before = episode.comments.count |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Для этого более выразительно будет использовать change, как ты делаешь ниже
| let(:podcast_with_blocked_author) { build(:podcast, :with_blocked_author) } | ||
|
|
||
| it 'should be invalid when no author' do | ||
| expect(podcast_no_author.valid?).to eq(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
тут лучше использовать be_valid
|
|
||
| context 'when user subscribed' do | ||
| it 'should include user' do | ||
| expect(subscription.user == subscriber).to eq(true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
тут лучше использовать expect(subscription.user).to eq(subscriber)
| context 'when has published episode' do | ||
| it "is expected to include episode" do | ||
| podcast.publish(episode) | ||
| expect(podcast.episodes).to be_any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В описании теста пишем, что ошжидаем, что конкретный эпизод будет в коллекции, а в проверке проверяем, что там вообще что-то есть. То есть, содержимое не соответствует описанию
No description provided.