Commit cca918d2ed8c954f778f359b5894a66aebe565b5

Authored by Daniela Feitosa
2 parents 3c0d99a5 902adfb1

Merge commit 'refs/merge-requests/142' of git://gitorious.org/noosfero/noosfero …

…into merge-requests/142

Conflicts:
	test/functional/invite_controller_test.rb

(ActionItem2313)
test/functional/cms_controller_test.rb
@@ -583,7 +583,8 @@ class CmsControllerTest < ActionController::TestCase @@ -583,7 +583,8 @@ class CmsControllerTest < ActionController::TestCase
583 should 'be able to add image with alignment' do 583 should 'be able to add image with alignment' do
584 post :new, :type => 'TinyMceArticle', :profile => profile.identifier, :article => { :name => 'image-alignment', :body => "the text of the article with image <img src='#' align='right'/> right align..." } 584 post :new, :type => 'TinyMceArticle', :profile => profile.identifier, :article => { :name => 'image-alignment', :body => "the text of the article with image <img src='#' align='right'/> right align..." }
585 saved = TinyMceArticle.find_by_name('image-alignment') 585 saved = TinyMceArticle.find_by_name('image-alignment')
586 - assert_match /<img src="#" align="right" \/>/, saved.body 586 + assert_match /<img.*src="#".*\/>/, saved.body
  587 + assert_match /<img.*align="right".*\/>/, saved.body
587 end 588 end
588 589
589 should 'not be able to add image with alignment when textile' do 590 should 'not be able to add image with alignment when textile' do
test/functional/invite_controller_test.rb
@@ -187,9 +187,10 @@ class InviteControllerTest &lt; ActionController::TestCase @@ -187,9 +187,10 @@ class InviteControllerTest &lt; ActionController::TestCase
187 should 'return hash as invitation data if contact list was fetched' do 187 should 'return hash as invitation data if contact list was fetched' do
188 contact_list = ContactList.create(:fetched => true) 188 contact_list = ContactList.create(:fetched => true)
189 get :invitation_data, :profile => profile.identifier, :contact_list => contact_list.id 189 get :invitation_data, :profile => profile.identifier, :contact_list => contact_list.id
  190 + hash = {'fetched' => true, 'contact_list' => contact_list.id, 'error' => nil}
190 191
191 assert_equal 'application/javascript', @response.content_type 192 assert_equal 'application/javascript', @response.content_type
192 - assert_match /\{\"fetched\":\s*true,\s*\"contact_list\":\s*#{contact_list.id},\s*\"error\":\s*null\}/, @response.body 193 + assert_equal hash, json_response
193 end 194 end
194 195
195 should 'render empty list of contacts' do 196 should 'render empty list of contacts' do
@@ -232,4 +233,11 @@ class InviteControllerTest &lt; ActionController::TestCase @@ -232,4 +233,11 @@ class InviteControllerTest &lt; ActionController::TestCase
232 assert_equal 'pt', Delayed::Job.first.payload_object.locale 233 assert_equal 'pt', Delayed::Job.first.payload_object.locale
233 end 234 end
234 235
  236 + private
  237 +
  238 + def json_response
  239 + ActiveSupport::JSON.decode @response.body
  240 + end
  241 +
  242 +
235 end 243 end