Created
May 13, 2017 03:46
-
-
Save staycreativedesign/64b9f63496ed46870a4b3a8ee15a33d4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rails_helper' | |
RSpec.feature "Administrator logs in" do | |
before(:each) do | |
@admin = build_stubbed(:user, role: "admin") | |
end | |
scenario "with valid credentials" do | |
visit new_user_session_path | |
fill_in "Email", with: @admin.email | |
fill_in "Password", with: @admin.email | |
click_button "Log in" | |
expect(page).to have_current_path(root_path) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Failures: | |
1) Administrator logs in with valid credentials | |
Failure/Error: expect(page).to have_current_path(root_path) | |
expected "/users/sign_in" to equal "/" | |
# ./spec/features/admin_logs_ins_spec.rb:13:in `block (2 levels) in <top (required)>' | |
# /Users/mindblown/.rvm/gems/ruby-2.4.1@g/gems/zeus-0.15.13/lib/zeus/rails.rb:208:in `test' | |
# /Users/mindblown/.rvm/gems/ruby-2.4.1@g/gems/zeus-0.15.13/lib/zeus.rb:156:in `block in command' | |
# /Users/mindblown/.rvm/gems/ruby-2.4.1@g/gems/zeus-0.15.13/lib/zeus.rb:142:in `fork' | |
# /Users/mindblown/.rvm/gems/ruby-2.4.1@g/gems/zeus-0.15.13/lib/zeus.rb:142:in `command' | |
# /Users/mindblown/.rvm/gems/ruby-2.4.1@g/gems/zeus-0.15.13/lib/zeus.rb:50:in `go' | |
# -e:1:in `<main>' | |
Finished in 4.37 seconds (files took 4 minutes 25.2 seconds to load) | |
1 example, 1 failure | |
Failed examples: | |
rspec ./spec/features/admin_logs_ins_spec.rb:8 # Administrator logs in with valid credentials | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%h2 Log in | |
= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| | |
.field | |
= f.label :email | |
%br/ | |
= f.email_field :email, autofocus: true | |
.field | |
= f.label :password | |
%br/ | |
= f.password_field :password, autocomplete: "off" | |
- if devise_mapping.rememberable? | |
.field | |
= f.check_box :remember_me | |
= f.label :remember_me | |
.actions | |
= f.submit "Log in" | |
= render "devise/shared/links" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment