Commit 05eaa3f1afd4a73a40757486699478a530dd3808

Authored by Gabriela Navarro
1 parent b478a424

find_offerer: New tests for find offerer

Signed-off-by: Gabriela Navarro <navarro1703@gmail.com>
Signed-off-by: Luciano Prestes <lucianopcbr@gmail.com>
test/functional/mpog_software_plugin_myprofile_controller_test.rb
... ... @@ -79,4 +79,20 @@ class MpogSoftwarePluginMyprofileControllerTest &lt; ActionController::TestCase
79 79 assert_equal "Ana de Souza",response[1]["name"]
80 80 assert_equal "Angela Silva",response[2]["name"]
81 81 end
  82 +
  83 + should 'make search for Ang for offerer in software creation' do
  84 + offer_token = "Ang"
  85 + post :search_offerers, :profile => person.identifier,:q => offer_token
  86 + response = JSON.parse(@response.body)
  87 + assert_equal "Angelo Roberto",response[0]["name"]
  88 + assert_equal "Angela Silva",response[1]["name"]
  89 + end
  90 +
  91 + should 'not find any offerer for software creation' do
  92 + offer_token = "Jos"
  93 + post :search_offerers, :profile => person.identifier,:q => offer_token
  94 + response = JSON.parse(@response.body)
  95 + assert response.count == 0
  96 + end
  97 +
82 98 end
... ...
views/mpog_software_plugin_myprofile/new_software.html.erb
... ... @@ -97,13 +97,13 @@
97 97 <%= swf.text_field(:demonstration_url) %>
98 98 </div>
99 99 <% end %>
100   -
  100 +
101 101 <div class="formfieldline">
102 102 <%= content_tag('label', _('Fill in the search field to add offerers for this Software'), :id => "text-input-search-offerers") %>
103 103 <%= token_input_field_tag(:q, 'search-offerers', {:action => 'search_offerers'}, { :focus => true, :hint_text => _('Type in a search term for a person to be added as
104 104 offerers'), :pre_populate => @tokenized_children}) %>
105 105 </div>
106   -
  106 +
107 107 <div id='libraries_fields'>
108 108 <h4> <%= _("Libraries") %> </h4>
109 109 <%= render :partial => 'library_fields', :locals => { :f => f, :object_name => 'community', :profile => @community, :libraries => @list_libraries } %>
... ...