MadeTech Dushan
3 years ago
7 changed files with 30 additions and 23 deletions
@ -1,18 +1,26 @@ |
|||||||
require "rails_helper" |
require "rails_helper" |
||||||
RSpec.describe "User Features" do |
RSpec.describe "User Features" do |
||||||
let!(:user) { FactoryBot.create(:user) } |
let!(:user) { FactoryBot.create(:user) } |
||||||
context "A user navigating to case logs" do |
context "A user navigating to case logs" do |
||||||
it " is required to log in" do |
it " is required to log in" do |
||||||
visit("/case_logs") |
visit("/case_logs") |
||||||
expect(page).to have_current_path("/users/sign_in") |
expect(page).to have_current_path("/users/sign_in") |
||||||
end |
end |
||||||
|
|
||||||
|
it " is redirected to case logs after signing in" do |
||||||
|
visit("/case_logs") |
||||||
|
fill_in("user_email", with: "test@example.com") |
||||||
|
fill_in("user_password", with: "pAssword1") |
||||||
|
click_button("Log in") |
||||||
|
expect(page).to have_current_path("/case_logs") |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
it " is redirected to case logs after signing in" do |
context "A user who has forgotten their password" do |
||||||
visit("/case_logs") |
it " is redirected to the forgotten password page when they click the forgot password link" do |
||||||
fill_in("user_email", with: "test@example.com") |
visit("/case_logs") |
||||||
fill_in("user_password", with: "pAssword1") |
click_link("Forgot your password?") |
||||||
click_button("Log in") |
expect(page).to have_current_path("/users/password/new") |
||||||
expect(page).to have_current_path("/case_logs") |
|
||||||
end |
|
||||||
end |
end |
||||||
end |
end |
||||||
|
end |
||||||
|
@ -1,9 +1,9 @@ |
|||||||
require_relative './controller_macros' |
require_relative "./controller_macros" |
||||||
|
|
||||||
RSpec.configure do |config| |
RSpec.configure do |config| |
||||||
# For Devise > 4.1.1 |
# For Devise > 4.1.1 |
||||||
config.include Devise::Test::ControllerHelpers, :type => :controller |
config.include Devise::Test::ControllerHelpers, type: :controller |
||||||
# Use the following instead if you are on Devise <= 4.1.1 |
# Use the following instead if you are on Devise <= 4.1.1 |
||||||
# config.include Devise::TestHelpers, :type => :controller |
# config.include Devise::TestHelpers, :type => :controller |
||||||
config.extend ControllerMacros, :type => :controller |
config.extend ControllerMacros, type: :controller |
||||||
end |
end |
||||||
|
Loading…
Reference in new issue