From a325970e5dbd647e587f83d7407b2d3472a66d7a Mon Sep 17 00:00:00 2001 From: Maxwell Salzberg Date: Thu, 28 Jul 2011 13:16:02 -0700 Subject: [PATCH] test to make sure mobile site does not 500 with all media types --- db/seeds.rb | 11 ++++++++++- spec/controllers/aspects_controller_spec.rb | 22 +++++++++++++++++++++ spec/factories.rb | 6 +++--- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/db/seeds.rb b/db/seeds.rb index 2d6a6d399..f60329e62 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -48,10 +48,19 @@ require 'spec/support/user_methods' time_interval = 1000 (1..25).each do |n| [alice, bob, eve].each do |u| - post = u.post :status_message, :text => "#{u.username} - #{n} - #seeded", :to => u.aspects.first.id + if(n%3==1) + post = u.post :status_message, :text => "#{u.username} - #{n} - #seeded", :to => u.aspects.first.id + elsif(n%3==2) + post =u.post(:reshare, :root_guid => Factory(:status_message, :public => true).guid, :to => 'all') + else + post = Factory(:activity_streams_photo, :public => true, :author => u.person) + u.add_to_streams(post, u.aspects) + end + post.created_at = post.created_at - time_interval post.updated_at = post.updated_at - time_interval post.save time_interval += 1000 end + puts "successfully seeded database with bob, alice and eve (password: evankorth)" end diff --git a/spec/controllers/aspects_controller_spec.rb b/spec/controllers/aspects_controller_spec.rb index 5c2185320..f0b5f3d79 100644 --- a/spec/controllers/aspects_controller_spec.rb +++ b/spec/controllers/aspects_controller_spec.rb @@ -368,4 +368,26 @@ describe AspectsController do end end end + + describe "mobile site" do + before do + ap = alice.person + posts = [] + posts << alice.post(:reshare, :root_guid => Factory(:status_message, :public => true).guid, :to => 'all') + posts << alice.post(:status_message, :text => 'foo', :to => alice.aspects) + photo = Factory(:activity_streams_photo, :public => true, :author => ap) + posts << photo + posts.each do |p| + alice.build_like(:positive => true, :target => p).save + end + alice.add_to_streams(photo, alice.aspects) + sign_in alice + end + + it 'should not 500' do + get :index, :format => :mobile + response.should be_success + + end + end end diff --git a/spec/factories.rb b/spec/factories.rb index ab39142e6..abe0a7f85 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -124,9 +124,9 @@ end Factory.define(:activity_streams_photo, :class => ActivityStreams::Photo) do |p| p.association(:author, :factory => :person) - p.image_url "http://example.com/awesome.png" - p.image_height 900 - p.image_width 400 + p.image_url "#{AppConfig[:pod_url]}/images/asterisk.png" + p.image_height 154 + p.image_width 154 p.object_url "http://example.com/awesome_things.gif" p.objectId "http://example.com/awesome_things.gif" p.actor_url "http://notcubbi.es/cubber"