-
-
Save anonymous/2997168 to your computer and use it in GitHub Desktop.
The first file is my test file and the second file is the embedded ruby file that is supposed to make the test pass. Any help would be great!
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 'spec_helper' | |
describe "Authentication" do | |
subject { page } | |
describe "signin page" do | |
before { visit signin_path } | |
it { should have_selector('h1', text: "Sign in") } | |
it { should have_selector('title', text: "Sign in") } | |
end | |
describe "signin" do | |
before { visit signin_path } | |
describe "with invalid information" do | |
before { click_button "Sign in" } | |
it { should have_selector('title', text: 'Sign in') } | |
it { should have_selector('div.alert.alert-error', text: 'Invalid') } | |
end | |
describe "with valid information" do | |
let(:user) { FactoryGirl.create(:user) } | |
before do | |
fill_in "Email", with: user.email | |
fill_in "Password", with: user.password | |
click_button "Sign in" | |
end | |
it { should have_selector('title', text: user.name) } | |
it { should have_link('Profile', href: user_path(user)) } | |
it { should have_link('Sign out', href: signout_path) } | |
it { should_not have_link('Sign in', href: signin_path) } | |
end | |
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
<% provide(:title, "Sign in") %> | |
<h1>Sign in</h1> | |
<div class="row"> | |
<div class="span6 offset3"> | |
<%= form_for(:session, url: sessions_path) do |f| %> | |
<%= f.label :email %> | |
<%= f.text_field: :email %> | |
<%= f.label :password %> | |
<%= f.password_field :password %> | |
<%= f.submit "Sign in", class: "btn btn-large btn-primary" %> | |
<% end %> | |
<p>New user? <%= link_to "Sign up now!", signup_path %></p> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment