MadeTech Dushan
3 years ago
7 changed files with 30 additions and 23 deletions
@ -1,18 +1,26 @@
|
||||
require "rails_helper" |
||||
RSpec.describe "User Features" do |
||||
let!(:user) { FactoryBot.create(:user) } |
||||
context "A user navigating to case logs" do |
||||
it " is required to log in" do |
||||
visit("/case_logs") |
||||
expect(page).to have_current_path("/users/sign_in") |
||||
end |
||||
let!(:user) { FactoryBot.create(:user) } |
||||
context "A user navigating to case logs" do |
||||
it " is required to log in" do |
||||
visit("/case_logs") |
||||
expect(page).to have_current_path("/users/sign_in") |
||||
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 |
||||
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 |
||||
context "A user who has forgotten their password" do |
||||
it " is redirected to the forgotten password page when they click the forgot password link" do |
||||
visit("/case_logs") |
||||
click_link("Forgot your password?") |
||||
expect(page).to have_current_path("/users/password/new") |
||||
end |
||||
end |
||||
end |
@ -1,9 +1,9 @@
|
||||
require_relative './controller_macros' |
||||
require_relative "./controller_macros" |
||||
|
||||
RSpec.configure do |config| |
||||
# 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 |
||||
# config.include Devise::TestHelpers, :type => :controller |
||||
config.extend ControllerMacros, :type => :controller |
||||
config.extend ControllerMacros, type: :controller |
||||
end |
||||
|
Loading…
Reference in new issue