diff --git a/app/controllers/public/contact_controller.rb b/app/controllers/public/contact_controller.rb index 53defde..b7067c7 100644 --- a/app/controllers/public/contact_controller.rb +++ b/app/controllers/public/contact_controller.rb @@ -20,11 +20,7 @@ class ContactController < PublicController flash[:notice] = _('Contact not sent') end else - if logged_in? - @contact = Contact.new(:name => user.name, :email => user.email) - else - @contact = Contact.new - end + @contact = Contact.new(:name => user.name, :email => user.email) end end diff --git a/app/views/contact/new.rhtml b/app/views/contact/new.rhtml index 2cdf9f5..0003ea4 100644 --- a/app/views/contact/new.rhtml +++ b/app/views/contact/new.rhtml @@ -8,8 +8,6 @@ <%= required_fields_message %> - <%= required f.text_field(:name) %> - <%= required f.text_field(:email) %> <% unless environment.enabled?('disable_select_city_for_contact') %> <%= labelled_form_field _('City and state'), select_city(true) %> <% end %> diff --git a/test/functional/contact_controller_test.rb b/test/functional/contact_controller_test.rb index 2724efb..3629ab3 100644 --- a/test/functional/contact_controller_test.rb +++ b/test/functional/contact_controller_test.rb @@ -35,11 +35,6 @@ class ContactControllerTest < Test::Unit::TestCase assert_tag :tag => 'form', :attributes => { :action => "/contact/#{enterprise.identifier}/new", :method => 'post' } end - should 'display input for destinatary email' do - get :new, :profile => enterprise.identifier - assert_tag :tag => 'input', :attributes => { :name => 'contact[email]', :type => 'text' } - end - should 'display input for message' do get :new, :profile => enterprise.identifier assert_tag :tag => 'textarea', :attributes => { :name => 'contact[message]' } @@ -51,14 +46,14 @@ class ContactControllerTest < Test::Unit::TestCase assert_redirected_to :action => 'new' end - should 'fill email if user logged in' do + should 'have logged user email' do get :new, :profile => enterprise.identifier - assert_tag :tag => 'input', :attributes => {:name => 'contact[email]', :value => profile.email} + assert_equal profile.email, assigns(:contact).email end - should 'fill name if user logged in' do + should 'have logged user name' do get :new, :profile => enterprise.identifier - assert_tag :tag => 'input', :attributes => {:name => 'contact[name]', :value => profile.name} + assert_equal profile.name, assigns(:contact).name end should 'define city and state' do -- libgit2 0.21.2