4.16 fixed broken tests

This commit is contained in:
Aaro Koivukangas
2023-11-11 21:54:02 +02:00
parent 024c95031a
commit 7454f6d4cd
+14
View File
@@ -1,6 +1,7 @@
require "rails_helper" require "rails_helper"
describe "Beers page" do describe "Beers page" do
let(:user) { FactoryBot.create :user }
let(:brewery){ FactoryBot.create :brewery } let(:brewery){ FactoryBot.create :brewery }
let(:beer){ FactoryBot.create :beer } let(:beer){ FactoryBot.create :beer }
@@ -24,8 +25,14 @@ describe "Beers page" do
end end
it "should be able to add a new beer" do it "should be able to add a new beer" do
user.save()
brewery.save() brewery.save()
visit new_session_path
fill_in "username", with: "MööttiTesti"
fill_in "password", with: "Unsecure1"
click_button "Log in"
visit new_beer_path visit new_beer_path
expect(page).to have_content "New beer" expect(page).to have_content "New beer"
expect(page).to_not have_content "New fancy test beer" expect(page).to_not have_content "New fancy test beer"
@@ -39,6 +46,13 @@ describe "Beers page" do
end end
it "should not be able to add a new beer without a proper beer name" do it "should not be able to add a new beer without a proper beer name" do
user.save()
visit new_session_path
fill_in "username", with: "MööttiTesti"
fill_in "password", with: "Unsecure1"
click_button "Log in"
visit new_beer_path visit new_beer_path
expect(page).to have_content "New beer" expect(page).to have_content "New beer"
expect(page).to_not have_content "New fancy test beer" expect(page).to_not have_content "New fancy test beer"