diff --git a/app/models/profile.rb b/app/models/profile.rb index 75363bf..2fb6409 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -151,4 +151,9 @@ class Profile < ActiveRecord::Base self.kind_of?(Organization) end + include ActionController::UrlWriter + def url + url_for(:host => self.environment.default_hostname, :profile => self.identifier, :controller => 'content_viewer', :action => 'view_page', :page => []) + end + end diff --git a/test/unit/profile_test.rb b/test/unit/profile_test.rb index 80c5c67..aee4981 100644 --- a/test/unit/profile_test.rb +++ b/test/unit/profile_test.rb @@ -218,7 +218,12 @@ class ProfileTest < Test::Unit::TestCase end should 'provide url to itself' do - flunk 'pending' + env = Environment.default + assert_equal 'colivre.net', env.default_hostname + + profile = Profile.create!(:name => "Test Profile", :identifier => 'testprofile', :environment_id => env.id) + + assert_equal 'http://colivre.net/testprofile', profile.url end private -- libgit2 0.21.2