test to make sure mobile site does not 500 with all media types

This commit is contained in:
Maxwell Salzberg 2011-07-28 13:16:02 -07:00
parent 4442319560
commit a325970e5d
3 changed files with 35 additions and 4 deletions

View file

@ -48,10 +48,19 @@ require 'spec/support/user_methods'
time_interval = 1000 time_interval = 1000
(1..25).each do |n| (1..25).each do |n|
[alice, bob, eve].each do |u| [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.created_at = post.created_at - time_interval
post.updated_at = post.updated_at - time_interval post.updated_at = post.updated_at - time_interval
post.save post.save
time_interval += 1000 time_interval += 1000
end end
puts "successfully seeded database with bob, alice and eve (password: evankorth)"
end end

View file

@ -368,4 +368,26 @@ describe AspectsController do
end end
end 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 end

View file

@ -124,9 +124,9 @@ end
Factory.define(:activity_streams_photo, :class => ActivityStreams::Photo) do |p| Factory.define(:activity_streams_photo, :class => ActivityStreams::Photo) do |p|
p.association(:author, :factory => :person) p.association(:author, :factory => :person)
p.image_url "http://example.com/awesome.png" p.image_url "#{AppConfig[:pod_url]}/images/asterisk.png"
p.image_height 900 p.image_height 154
p.image_width 400 p.image_width 154
p.object_url "http://example.com/awesome_things.gif" p.object_url "http://example.com/awesome_things.gif"
p.objectId "http://example.com/awesome_things.gif" p.objectId "http://example.com/awesome_things.gif"
p.actor_url "http://notcubbi.es/cubber" p.actor_url "http://notcubbi.es/cubber"