Commit 757778888939d5af7d2a4a2cd8678e9af047e731

Authored by Daniela Feitosa
Committed by Antonio Terceiro
1 parent 6bcb3863

ActionItem1175: cannot edit name/email on contact

app/controllers/public/contact_controller.rb
... ... @@ -20,11 +20,7 @@ class ContactController < PublicController
20 20 flash[:notice] = _('Contact not sent')
21 21 end
22 22 else
23   - if logged_in?
24   - @contact = Contact.new(:name => user.name, :email => user.email)
25   - else
26   - @contact = Contact.new
27   - end
  23 + @contact = Contact.new(:name => user.name, :email => user.email)
28 24 end
29 25 end
30 26  
... ...
app/views/contact/new.rhtml
... ... @@ -8,8 +8,6 @@
8 8  
9 9 <%= required_fields_message %>
10 10  
11   - <%= required f.text_field(:name) %>
12   - <%= required f.text_field(:email) %>
13 11 <% unless environment.enabled?('disable_select_city_for_contact') %>
14 12 <%= labelled_form_field _('City and state'), select_city(true) %>
15 13 <% end %>
... ...
test/functional/contact_controller_test.rb
... ... @@ -35,11 +35,6 @@ class ContactControllerTest &lt; Test::Unit::TestCase
35 35 assert_tag :tag => 'form', :attributes => { :action => "/contact/#{enterprise.identifier}/new", :method => 'post' }
36 36 end
37 37  
38   - should 'display input for destinatary email' do
39   - get :new, :profile => enterprise.identifier
40   - assert_tag :tag => 'input', :attributes => { :name => 'contact[email]', :type => 'text' }
41   - end
42   -
43 38 should 'display input for message' do
44 39 get :new, :profile => enterprise.identifier
45 40 assert_tag :tag => 'textarea', :attributes => { :name => 'contact[message]' }
... ... @@ -51,14 +46,14 @@ class ContactControllerTest &lt; Test::Unit::TestCase
51 46 assert_redirected_to :action => 'new'
52 47 end
53 48  
54   - should 'fill email if user logged in' do
  49 + should 'have logged user email' do
55 50 get :new, :profile => enterprise.identifier
56   - assert_tag :tag => 'input', :attributes => {:name => 'contact[email]', :value => profile.email}
  51 + assert_equal profile.email, assigns(:contact).email
57 52 end
58 53  
59   - should 'fill name if user logged in' do
  54 + should 'have logged user name' do
60 55 get :new, :profile => enterprise.identifier
61   - assert_tag :tag => 'input', :attributes => {:name => 'contact[name]', :value => profile.name}
  56 + assert_equal profile.name, assigns(:contact).name
62 57 end
63 58  
64 59 should 'define city and state' do
... ...