login feature spec to test the functionality of the login page with valid and invalid creds - warvox - VoIP based wardialing tool, forked from rapid7/warvox.
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
       ---
 (DIR) commit d0d5c0f79f989db9ac60c286d2dde1a8c6878904
 (DIR) parent 60e7d18680788318e47abd21ada018d913f20eb7
 (HTM) Author: zeknox <mccann.brandon@gmail.com>
       Date:   Fri, 23 Oct 2015 22:49:53 -0500
       
       login feature spec to test the functionality of the login page with valid and invalid creds
       
       Diffstat:
         A spec/features/visitor/logins_spec.… |      58 ++++++++++++++++++++++++++++++
       
       1 file changed, 58 insertions(+), 0 deletions(-)
       ---
 (DIR) diff --git a/spec/features/visitor/logins_spec.rb b/spec/features/visitor/logins_spec.rb
       @@ -0,0 +1,58 @@
       +require 'rails_helper'
       +
       +RSpec.feature "Logins", type: :feature do
       +  it "login with valid credentials" do
       +    user = create(:user)
       +    visit login_path
       +    within "#new_user_session" do
       +      expect(page).to have_content "Username"
       +      expect(page).to have_content "Password"
       +      fill_in "user_session_login", with: user.login
       +      fill_in "user_session_password", with: 'RandomPass'
       +      click_button "Sign in"
       +    end
       +    within "div.content" do
       +      expect(page).to have_content "WarVOX Projects"
       +    end
       +  end
       +
       +  it "failed login with invalid password valid username" do
       +    user = create(:user)
       +    visit login_path
       +    within "#new_user_session" do
       +      fill_in "user_session_login", with: user.login
       +      fill_in "user_session_password", with: 'WrongPassword'
       +      click_button "Sign in"
       +    end
       +    expect(page).to have_content "Password is not valid"
       +  end
       +
       +  it "failed login with invalid username valid password" do
       +    user = create(:user)
       +    visit login_path
       +    within "#new_user_session" do
       +      fill_in "user_session_login", with: user.login + "Wrong"
       +      fill_in "user_session_password", with: 'RandomPass'
       +      click_button "Sign in"
       +    end
       +    expect(page).to have_content "Login is not valid"
       +  end
       +
       +  it "failed login with no input entered" do
       +    visit login_path
       +    within "#new_user_session" do
       +      click_button "Sign in"
       +    end
       +    expect(page).to have_content "You did not provide any details for authentication."
       +  end
       +
       +  it "failed login with no password entered" do
       +    user = create(:user)
       +    visit login_path
       +    within "#new_user_session" do
       +      fill_in "user_session_login", with: user.login
       +      click_button "Sign in"
       +    end
       +    expect(page).to have_content "Password cannot be blank"
       +  end
       +end