MS DG down to four failures

This commit is contained in:
danielgrippi 2012-03-20 18:03:46 -07:00
parent 835f808e5a
commit 5c431d933f
9 changed files with 21 additions and 26 deletions

View file

@ -3,8 +3,6 @@
# the COPYRIGHT file.
module ApplicationHelper
include Rails.application.routes.url_helpers
def how_long_ago(obj)
timeago(obj.created_at)
end

View file

@ -1,7 +1,5 @@
module NotificationsHelper
include PeopleHelper
include Rails.application.routes.url_helpers
def object_link(note, actors)
target_type = note.popup_translation_key

View file

@ -4,15 +4,14 @@
module PeopleHelper
include ERB::Util
include Rails.application.routes.url_helpers
def search_header
if search_query.blank?
content_tag(:h2, t('people.index.no_results'))
else
content_tag(:h2, :id => 'search_title') do
content_tag(:h2, :id => 'search_title') do
t('people.index.results_for').html_safe + ' ' +
content_tag(:span, search_query, :class => 'term')
content_tag(:span, search_query, :class => 'term')
end
end
end
@ -67,13 +66,13 @@ module PeopleHelper
def person_href(person, opts={})
"href=\"#{local_or_remote_person_path(person, opts)}\"".html_safe
end
# Rails.application.routes.url_helpers is needed since this is indirectly called from a model
def local_or_remote_person_path(person, opts={})
opts.merge!(:protocol => AppConfig[:pod_uri].scheme, :host => AppConfig[:pod_uri].authority)
absolute = opts.delete(:absolute)
if person.local?
username = person.diaspora_handle.split('@')[0]
unless username.include?('.')
@ -85,7 +84,7 @@ module PeopleHelper
end
end
end
if absolute
return Rails.application.routes.url_helpers.person_url(person, opts)
else

View file

@ -29,7 +29,9 @@ Diaspora::Application.configure do
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
config.active_support.deprecation = :stderr
config.threadsafe!
# fixes url helper issue in rspec
#config.threadsafe!
# Use SQL instead of Active Record's schema dumper when creating the test database.
# This is necessary if your schema can't be completely dumped by the schema dumper,

View file

@ -49,7 +49,7 @@ describe PostsController do
get :show, :id => photo.id
response.should be_success
end
it 'redirects if the post is missing' do
get :show, :id => 1234567
response.should be_redirect
@ -94,7 +94,7 @@ describe PostsController do
end
it 'assumes guids less than 8 chars are ids and not guids' do
Post.should_receive(:where).with(hash_including(:id => @status.id)).and_return(Post)
Post.should_receive(:where).with(hash_including(:id => @status.id.to_s)).and_return(Post)
get :show, :id => @status.id
response.should be_success
end

View file

@ -5,8 +5,6 @@
require 'spec_helper'
describe ApplicationHelper do
include Rails.application.routes.url_helpers
before do
@user = alice
@person = Factory(:person)

View file

@ -3,8 +3,7 @@ require 'spec_helper'
describe NotificationsHelper do
include ApplicationHelper
include Rails.application.routes.url_helpers
before do
@user = Factory(:user)
@person = Factory(:person)

View file

@ -5,12 +5,11 @@
require 'spec_helper'
describe PeopleHelper do
include Rails.application.routes.url_helpers
before do
@user = alice
@person = Factory(:person)
end
describe "#person_image_link" do
it "returns an empty string if person is nil" do
person_image_link(nil).should == ""
@ -64,12 +63,12 @@ describe PeopleHelper do
describe "#person_href" do
it "calls local_or_remote_person_path and passes through the options" do
opts = {:absolute => true}
self.should_receive(:local_or_remote_person_path).with(@person, opts).exactly(1).times
person_href(@person, opts)
end
it "returns a href attribute" do
person_href(@person).should include "href="
end
@ -79,7 +78,7 @@ describe PeopleHelper do
before do
@user = Factory(:user)
end
it "links by id if there is a period in the user's username" do
@user.username = "invalid.username"
@user.save(:validate => false).should == true
@ -93,7 +92,7 @@ describe PeopleHelper do
it 'links by username for a local user' do
local_or_remote_person_path(@user.person).should == user_profile_path(:username => @user.username)
end
it 'links by id for a remote person' do
local_or_remote_person_path(@person).should == person_path(@person)
end

View file

@ -5,11 +5,13 @@ describe TagsHelper do
it 'returns nil if there is a @ in the query' do
helper.stub(:search_query).and_return('foo@bar.com')
helper.looking_for_tag_link.should be_nil
end
end
it 'returns nil if it normalizes to blank' do
helper.stub(:search_query).and_return('++')
helper.looking_for_tag_link.should be_nil
end
it 'returns a link to the tag otherwise' do
helper.stub(:search_query).and_return('foo')
helper.looking_for_tag_link.should include(helper.tag_link)