Commit 902adfb1c2855a737686bf6e2fa39227a7b1b4a2
1 parent
f462e462
Exists in
master
and in
29 other branches
Fixing cms and invite controller tests
(ActionItem2313)
Showing
2 changed files
with
11 additions
and
2 deletions
Show diff stats
test/functional/cms_controller_test.rb
... | ... | @@ -584,7 +584,8 @@ class CmsControllerTest < Test::Unit::TestCase |
584 | 584 | should 'be able to add image with alignment' do |
585 | 585 | 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..." } |
586 | 586 | saved = TinyMceArticle.find_by_name('image-alignment') |
587 | - assert_match /<img src="#" align="right" \/>/, saved.body | |
587 | + assert_match /<img.*src="#".*\/>/, saved.body | |
588 | + assert_match /<img.*align="right".*\/>/, saved.body | |
588 | 589 | end |
589 | 590 | |
590 | 591 | should 'not be able to add image with alignment when textile' do | ... | ... |
test/functional/invite_controller_test.rb
... | ... | @@ -188,9 +188,10 @@ class InviteControllerTest < ActionController::TestCase |
188 | 188 | should 'return hash as invitation data if contact list was fetched' do |
189 | 189 | contact_list = ContactList.create(:fetched => true) |
190 | 190 | get :invitation_data, :profile => profile.identifier, :contact_list => contact_list.id |
191 | + hash = {'fetched' => true, 'contact_list' => contact_list.id, 'error' => nil} | |
191 | 192 | |
192 | 193 | assert_equal 'application/javascript', @response.content_type |
193 | - assert_equal "{\"fetched\": true, \"contact_list\": #{contact_list.id}, \"error\": null}", @response.body | |
194 | + assert_equal hash, json_response | |
194 | 195 | end |
195 | 196 | |
196 | 197 | should 'render empty list of contacts' do |
... | ... | @@ -233,4 +234,11 @@ class InviteControllerTest < ActionController::TestCase |
233 | 234 | assert_equal 'pt', Delayed::Job.first.payload_object.locale |
234 | 235 | end |
235 | 236 | |
237 | + private | |
238 | + | |
239 | + def json_response | |
240 | + ActiveSupport::JSON.decode @response.body | |
241 | + end | |
242 | + | |
243 | + | |
236 | 244 | end | ... | ... |