Transpec spec/features/consumer/authentication_spec.rb and spec/features/consumer/producers_spec.rb

This commit is contained in:
luisramos0
2019-09-20 09:53:23 +01:00
parent f9f81086fd
commit 81f8b127db
2 changed files with 21 additions and 21 deletions

View File

@@ -13,7 +13,7 @@ feature "Authentication", js: true do
fill_in "Email", with: user.email
fill_in "Password", with: user.password
click_login_button
page.should have_content "Find local producers"
expect(page).to have_content "Find local producers"
expect(page).to have_current_path producers_path
end
end
@@ -28,20 +28,20 @@ feature "Authentication", js: true do
open_login_modal
end
scenario "showing login" do
page.should have_login_modal
expect(page).to have_login_modal
end
scenario "failing to login" do
fill_in "Email", with: user.email
click_login_button
page.should have_content "Invalid email or password"
expect(page).to have_content "Invalid email or password"
end
scenario "logging in successfully" do
fill_in "Email", with: user.email
fill_in "Password", with: user.password
click_login_button
page.should be_logged_in_as user
expect(page).to be_logged_in_as user
end
describe "signing up" do
@@ -53,7 +53,7 @@ feature "Authentication", js: true do
fill_in "Email", with: "test@foo.com"
fill_in "Choose a password", with: "short"
click_signup_button
page.should have_content "too short"
expect(page).to have_content "too short"
end
scenario "Failing to sign up because email is already registered" do
@@ -94,16 +94,16 @@ feature "Authentication", js: true do
scenario "failing to reset password" do
fill_in "Your email", with: "notanemail@myemail.com"
click_reset_password_button
page.should have_content "Email address not found"
expect(page).to have_content "Email address not found"
end
scenario "resetting password" do
fill_in "Your email", with: user.email
expect do
click_reset_password_button
page.should have_reset_password
expect(page).to have_reset_password
end.to enqueue_job Delayed::PerformableMethod
Delayed::Job.last.payload_object.method_name.should == :send_reset_password_instructions_without_delay
expect(Delayed::Job.last.payload_object.method_name).to eq(:send_reset_password_instructions_without_delay)
end
end
end
@@ -117,7 +117,7 @@ feature "Authentication", js: true do
scenario "showing login" do
open_off_canvas
open_login_modal
page.should have_login_modal
expect(page).to have_login_modal
end
end
end
@@ -133,7 +133,7 @@ feature "Authentication", js: true do
scenario "Loggin by typing login/ redirects to /#/login" do
visit "/login"
uri = URI.parse(current_url)
(uri.path + "#" + uri.fragment).should == '/#/login'
expect(uri.path + "#" + uri.fragment).to eq('/#/login')
end
end
end

View File

@@ -49,14 +49,14 @@ feature '
toggle_filter 'Vegetables'
page.should_not have_content producer1.name
page.should have_content producer2.name
expect(page).not_to have_content producer1.name
expect(page).to have_content producer2.name
toggle_filter 'Vegetables'
toggle_filter 'Fruit'
page.should have_content producer1.name
page.should_not have_content producer2.name
expect(page).to have_content producer1.name
expect(page).not_to have_content producer2.name
end
describe "filtering by product property" do
@@ -65,23 +65,23 @@ feature '
toggle_filter 'Organic'
page.should have_content producer1.name
page.should_not have_content producer2.name
expect(page).to have_content producer1.name
expect(page).not_to have_content producer2.name
toggle_filter 'Organic'
toggle_filter 'Biodynamic'
page.should_not have_content producer1.name
page.should have_content producer2.name
expect(page).not_to have_content producer1.name
expect(page).to have_content producer2.name
end
end
it "shows all producers with expandable details" do
page.should have_content producer1.name
expect(page).to have_content producer1.name
expand_active_table_node producer1.name
# -- Taxons
page.should have_content 'Fruit'
expect(page).to have_content 'Fruit'
# -- Properties
expect(page).to have_content 'Organic' # Product property
@@ -89,7 +89,7 @@ feature '
end
it "doesn't show invisible producers" do
page.should_not have_content invisible_producer.name
expect(page).not_to have_content invisible_producer.name
end
it "links to places to buy produce" do