Skip to content
Browse files

Cria formulário de login (baseado no de signup)

  • Loading branch information...
1 parent 5e82338 commit ee166d235a44d866f79eb8d1d670917b5cb9df15 @elomar committed Mar 17, 2012
Showing with 20 additions and 2 deletions.
  1. +18 −0 app/views/sessions/new.html.erb
  2. +2 −2 spec/requests/autenticacao_spec.rb
View
18 app/views/sessions/new.html.erb
@@ -1,2 +1,20 @@
<% provide(:title, "Entre no site") %>
<h1>Entre no site</h1>
+
+<%= form_for(:session, url: login_path) do |f| %>
+ <p>
+ <%= f.label :email %>
+ <%= f.text_field :email %>
+ </p>
+
+ <p>
+ <%= f.label :password, "Senha" %>
+ <%= f.password_field :password %>
+ </p>
+
+ <p>
+ <%= f.submit "Entre no site" %>
+ </p>
+<% end %>
+
+<p>Novo no site? <%= link_to 'Cadastr-se agora!', signup_path %>
View
4 spec/requests/autenticacao_spec.rb
@@ -23,11 +23,11 @@
let(:usuario) { FactoryGirl.create(:usuario) }
before do
fill_in "Email", with: usuario.email
- fill_in "Senha", with: usuario.senha
+ fill_in "Senha", with: usuario.password
click_button "Entre no site"
end
- it { should have_selector('title', text: usuario.name) }
+ it { should have_selector('title', text: usuario.nome) }
it { should have_link('Perfil', href: usuario_path(usuario)) }
it { should have_link('Sair', href: logout_path) }
it { should_not have_link('Entre no site', href: login_path) }

0 comments on commit ee166d2

Please sign in to comment.
Something went wrong with that request. Please try again.