Commit e76b5bbb8b42afec49807cded4c0e5db9c06136b

Authored by Victor Costa
2 parents ea7661fa 36b7ff2f

Merge branch 'I13-fix_partial_for_class' into stable

Conflicts:
	Gemfile
	Gemfile.lock
1 source "https://rubygems.org" 1 source "https://rubygems.org"
2 -gem 'rails'  
3 -gem 'fast_gettext'  
4 -gem 'acts-as-taggable-on'  
5 -gem 'prototype-rails'  
6 -gem 'prototype_legacy_helper', '0.0.0', :path => 'vendor/prototype_legacy_helper'  
7 -gem 'rails_autolink'  
8 -gem 'pg'  
9 -gem 'rmagick'  
10 -gem 'RedCloth'  
11 -gem 'will_paginate'  
12 -gem 'ruby-feedparser'  
13 -gem 'daemons'  
14 -gem 'thin'  
15 -gem 'hpricot'  
16 -gem 'nokogiri' 2 +gem 'rails', '~> 3.2.19'
  3 +gem 'fast_gettext', '~> 0.6.8'
  4 +gem 'acts-as-taggable-on', '~> 3.0.2'
  5 +gem 'prototype-rails', '~> 3.2.1'
  6 +gem 'prototype_legacy_helper', '0.0.0', :path => 'vendor/prototype_legacy_helper'
  7 +gem 'rails_autolink', '~> 1.1.5'
  8 +gem 'pg', '~> 0.13.2'
  9 +gem 'rmagick', '~> 2.13.1'
  10 +gem 'RedCloth', '~> 4.2.9'
  11 +gem 'will_paginate', '~> 3.0.3'
  12 +gem 'ruby-feedparser', '~> 0.7'
  13 +gem 'daemons', '~> 1.1.5'
  14 +gem 'thin', '~> 1.3.1'
  15 +gem 'hpricot', '~> 0.8.6'
  16 +gem 'nokogiri', '~> 1.5.5'
17 gem 'rake', :require => false 17 gem 'rake', :require => false
18 gem 'grape', '0.2.1' 18 gem 'grape', '0.2.1'
19 -gem 'rest-client'  
20 -gem 'exception_notification'  
21 -gem 'gettext', :require => false, :group => :development 19 +gem 'rest-client', '~> 1.6.7'
  20 +gem 'exception_notification', '~> 4.0.1'
  21 +gem 'gettext', '~> 2.2.1', :require => false, :group => :development
22 22
23 # FIXME list here all actual dependencies (i.e. the ones in debian/control), 23 # FIXME list here all actual dependencies (i.e. the ones in debian/control),
24 # with their GEM names (not the Debian package names) 24 # with their GEM names (not the Debian package names)
25 25
26 group :production do 26 group :production do
27 - gem 'dalli' 27 + gem 'dalli', '~> 2.7.0'
28 end 28 end
29 29
30 group :test do 30 group :test do
31 - gem 'rspec'  
32 - gem 'rspec-rails'  
33 - gem 'mocha', :require => false 31 + gem 'rspec', '~> 2.10.0'
  32 + gem 'rspec-rails', '~> 2.10.1'
  33 + gem 'mocha', '~> 1.1.0', :require => false
34 end 34 end
35 35
36 group :cucumber do 36 group :cucumber do
37 - gem 'cucumber-rails', :require => false  
38 - gem 'capybara'  
39 - gem 'cucumber'  
40 - gem 'database_cleaner'  
41 - gem 'selenium-webdriver' 37 + gem 'cucumber-rails', '~> 1.0.6', :require => false
  38 + gem 'capybara', '~> 2.1.0'
  39 + gem 'cucumber', '~> 1.0.6'
  40 + gem 'database_cleaner', '~> 1.2.0'
  41 + gem 'selenium-webdriver', '~> 2.39.0'
42 end 42 end
43 43
44 # include plugin gemfiles 44 # include plugin gemfiles
Gemfile.lock
@@ -1,206 +0,0 @@ @@ -1,206 +0,0 @@
1 -PATH  
2 - remote: vendor/prototype_legacy_helper  
3 - specs:  
4 - prototype_legacy_helper (0.0.0)  
5 -  
6 -GEM  
7 - remote: https://rubygems.org/  
8 - specs:  
9 - RedCloth (4.2.9)  
10 - actionmailer (3.2.6)  
11 - actionpack (= 3.2.6)  
12 - mail (~> 2.4.4)  
13 - actionpack (3.2.6)  
14 - activemodel (= 3.2.6)  
15 - activesupport (= 3.2.6)  
16 - builder (~> 3.0.0)  
17 - erubis (~> 2.7.0)  
18 - journey (~> 1.0.1)  
19 - rack (~> 1.4.0)  
20 - rack-cache (~> 1.2)  
21 - rack-test (~> 0.6.1)  
22 - sprockets (~> 2.1.3)  
23 - activemodel (3.2.6)  
24 - activesupport (= 3.2.6)  
25 - builder (~> 3.0.0)  
26 - activerecord (3.2.6)  
27 - activemodel (= 3.2.6)  
28 - activesupport (= 3.2.6)  
29 - arel (~> 3.0.2)  
30 - tzinfo (~> 0.3.29)  
31 - activeresource (3.2.6)  
32 - activemodel (= 3.2.6)  
33 - activesupport (= 3.2.6)  
34 - activesupport (3.2.6)  
35 - i18n (~> 0.6)  
36 - multi_json (~> 1.0)  
37 - acts-as-taggable-on (3.0.2)  
38 - rails (>= 3, < 5)  
39 - arel (3.0.2)  
40 - builder (3.0.0)  
41 - capybara (2.1.0)  
42 - mime-types (>= 1.16)  
43 - nokogiri (>= 1.3.3)  
44 - rack (>= 1.0.0)  
45 - rack-test (>= 0.5.4)  
46 - xpath (~> 2.0)  
47 - childprocess (0.3.3)  
48 - ffi (~> 1.0.6)  
49 - cucumber (1.0.6)  
50 - builder (>= 2.1.2)  
51 - diff-lcs (>= 1.1.2)  
52 - gherkin (~> 2.4.18)  
53 - json (>= 1.4.6)  
54 - term-ansicolor (>= 1.0.6)  
55 - cucumber-rails (1.0.6)  
56 - capybara (>= 1.1.1)  
57 - cucumber (>= 1.0.6)  
58 - nokogiri (>= 1.5.0)  
59 - daemons (1.1.5)  
60 - dalli (2.7.0)  
61 - database_cleaner (1.2.0)  
62 - diff-lcs (1.1.3)  
63 - erubis (2.7.0)  
64 - eventmachine (0.12.10)  
65 - exception_notification (4.0.1)  
66 - actionmailer (>= 3.0.4)  
67 - activesupport (>= 3.0.4)  
68 - fast_gettext (0.6.8)  
69 - ffi (1.0.11)  
70 - gettext (2.2.1)  
71 - locale  
72 - gherkin (2.4.21)  
73 - json (>= 1.4.6)  
74 - grape (0.2.1)  
75 - hashie (~> 1.2)  
76 - multi_json  
77 - multi_xml  
78 - rack  
79 - rack-mount  
80 - hashie (1.2.0)  
81 - hike (1.2.1)  
82 - hpricot (0.8.6)  
83 - i18n (0.6.0)  
84 - journey (1.0.3)  
85 - json (1.7.3)  
86 - locale (2.0.5)  
87 - mail (2.4.4)  
88 - i18n (>= 0.4.0)  
89 - mime-types (~> 1.16)  
90 - treetop (~> 1.4.8)  
91 - metaclass (0.0.1)  
92 - mime-types (1.19)  
93 - mocha (0.11.3)  
94 - metaclass (~> 0.0.1)  
95 - multi_json (1.3.6)  
96 - multi_xml (0.5.5)  
97 - nokogiri (1.5.5)  
98 - pg (0.13.2)  
99 - polyglot (0.3.3)  
100 - prototype-rails (3.2.1)  
101 - rails (~> 3.2)  
102 - rack (1.4.1)  
103 - rack-cache (1.2)  
104 - rack (>= 0.4)  
105 - rack-mount (0.8.3)  
106 - rack (>= 1.0.0)  
107 - rack-ssl (1.3.2)  
108 - rack  
109 - rack-test (0.6.1)  
110 - rack (>= 1.0)  
111 - rails (3.2.6)  
112 - actionmailer (= 3.2.6)  
113 - actionpack (= 3.2.6)  
114 - activerecord (= 3.2.6)  
115 - activeresource (= 3.2.6)  
116 - activesupport (= 3.2.6)  
117 - bundler (~> 1.0)  
118 - railties (= 3.2.6)  
119 - rails_autolink (1.1.5)  
120 - rails (> 3.1)  
121 - railties (3.2.6)  
122 - actionpack (= 3.2.6)  
123 - activesupport (= 3.2.6)  
124 - rack-ssl (~> 1.3.2)  
125 - rake (>= 0.8.7)  
126 - rdoc (~> 3.4)  
127 - thor (>= 0.14.6, < 2.0)  
128 - rake (0.9.2.2)  
129 - rdoc (3.9.4)  
130 - rest-client (1.6.7)  
131 - mime-types (>= 1.16)  
132 - rmagick (2.13.1)  
133 - rspec (2.10.0)  
134 - rspec-core (~> 2.10.0)  
135 - rspec-expectations (~> 2.10.0)  
136 - rspec-mocks (~> 2.10.0)  
137 - rspec-core (2.10.1)  
138 - rspec-expectations (2.10.0)  
139 - diff-lcs (~> 1.1.3)  
140 - rspec-mocks (2.10.1)  
141 - rspec-rails (2.10.1)  
142 - actionpack (>= 3.0)  
143 - activesupport (>= 3.0)  
144 - railties (>= 3.0)  
145 - rspec (~> 2.10.0)  
146 - ruby-feedparser (0.7)  
147 - rubyzip (1.1.2)  
148 - selenium-webdriver (2.39.0)  
149 - childprocess (>= 0.2.5)  
150 - multi_json (~> 1.0)  
151 - rubyzip (~> 1.0)  
152 - websocket (~> 1.0.4)  
153 - sprockets (2.1.3)  
154 - hike (~> 1.2)  
155 - multi_json (~> 1.0)  
156 - rack (~> 1.0)  
157 - tilt (~> 1.1, != 1.3.0)  
158 - term-ansicolor (1.0.7)  
159 - thin (1.3.1)  
160 - daemons (>= 1.0.9)  
161 - eventmachine (>= 0.12.6)  
162 - rack (>= 1.0.0)  
163 - thor (0.15.3)  
164 - tilt (1.3.3)  
165 - treetop (1.4.10)  
166 - polyglot  
167 - polyglot (>= 0.3.1)  
168 - tzinfo (0.3.33)  
169 - websocket (1.0.7)  
170 - will_paginate (3.0.3)  
171 - xpath (2.0.0)  
172 - nokogiri (~> 1.3)  
173 -  
174 -PLATFORMS  
175 - ruby  
176 -  
177 -DEPENDENCIES  
178 - RedCloth  
179 - acts-as-taggable-on  
180 - capybara  
181 - cucumber  
182 - cucumber-rails  
183 - daemons  
184 - dalli  
185 - database_cleaner  
186 - exception_notification  
187 - fast_gettext  
188 - gettext  
189 - grape (= 0.2.1)  
190 - hpricot  
191 - mocha  
192 - nokogiri  
193 - pg  
194 - prototype-rails  
195 - prototype_legacy_helper (= 0.0.0)!  
196 - rails  
197 - rails_autolink  
198 - rake  
199 - rest-client  
200 - rmagick  
201 - rspec  
202 - rspec-rails  
203 - ruby-feedparser  
204 - selenium-webdriver  
205 - thin  
206 - will_paginate  
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 3
4 VAGRANTFILE_API_VERSION = "2" 4 VAGRANTFILE_API_VERSION = "2"
5 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 5 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
6 - config.vm.box = "debian-wheezy" 6 + config.vm.box = ENV.fetch('VAGRANT_BOX', "debian-wheezy")
7 config.vm.network :forwarded_port, host: 3000, guest: 3000 7 config.vm.network :forwarded_port, host: 3000, guest: 3000
8 config.vm.provision :shell do |shell| 8 config.vm.provision :shell do |shell|
9 shell.inline = 'su vagrant -c /vagrant/script/vagrant' 9 shell.inline = 'su vagrant -c /vagrant/script/vagrant'
app/helpers/application_helper.rb
@@ -304,7 +304,7 @@ module ApplicationHelper @@ -304,7 +304,7 @@ module ApplicationHelper
304 def partial_for_class(klass, prefix=nil, suffix=nil) 304 def partial_for_class(klass, prefix=nil, suffix=nil)
305 raise ArgumentError, 'No partial for object. Is there a partial for any class in the inheritance hierarchy?' if klass.nil? 305 raise ArgumentError, 'No partial for object. Is there a partial for any class in the inheritance hierarchy?' if klass.nil?
306 name = klass.name.underscore 306 name = klass.name.underscore
307 - controller.view_paths.reverse_each do |view_path| 307 + controller.view_paths.each do |view_path|
308 partial = partial_for_class_in_view_path(klass, view_path, prefix, suffix) 308 partial = partial_for_class_in_view_path(klass, view_path, prefix, suffix)
309 return partial if partial 309 return partial if partial
310 end 310 end
app/models/environment.rb
@@ -829,7 +829,7 @@ class Environment &lt; ActiveRecord::Base @@ -829,7 +829,7 @@ class Environment &lt; ActiveRecord::Base
829 end 829 end
830 830
831 def notification_emails 831 def notification_emails
832 - [noreply_email.blank? ? nil : noreply_email].compact + admins.map(&:email) 832 + [contact_email].select(&:present?) + admins.map(&:email)
833 end 833 end
834 834
835 after_create :create_templates 835 after_create :create_templates
app/models/organization.rb
@@ -135,7 +135,11 @@ class Organization &lt; Profile @@ -135,7 +135,11 @@ class Organization &lt; Profile
135 end 135 end
136 136
137 def notification_emails 137 def notification_emails
138 - [contact_email.blank? ? nil : contact_email].compact + admins.map(&:email) 138 + emails = [contact_email].select(&:present?) + admins.map(&:email)
  139 + if emails.empty?
  140 + emails << environment.contact_email
  141 + end
  142 + emails
139 end 143 end
140 144
141 def already_request_membership?(person) 145 def already_request_membership?(person)
debian/control
@@ -9,7 +9,7 @@ Build-Depends: @@ -9,7 +9,7 @@ Build-Depends:
9 ruby-gettext, 9 ruby-gettext,
10 ruby-sqlite3, 10 ruby-sqlite3,
11 rake, 11 rake,
12 - rails3 (>= 3.2.6-1~), 12 + rails3 (>= 3.2.19-1~),
13 ruby-rspec, 13 ruby-rspec,
14 ruby-rspec-rails, 14 ruby-rspec-rails,
15 ruby-will-paginate, 15 ruby-will-paginate,
debian/noosfero.install
@@ -8,7 +8,6 @@ Rakefile usr/share/noosfero @@ -8,7 +8,6 @@ Rakefile usr/share/noosfero
8 vendor usr/share/noosfero 8 vendor usr/share/noosfero
9 9
10 Gemfile usr/share/noosfero 10 Gemfile usr/share/noosfero
11 -Gemfile.lock usr/share/noosfero  
12 debian/bundle/config usr/share/noosfero/.bundle 11 debian/bundle/config usr/share/noosfero/.bundle
13 12
14 config/application.rb usr/share/noosfero/config 13 config/application.rb usr/share/noosfero/config
debian/noosfero.links
@@ -15,3 +15,4 @@ var/lib/noosfero-data/public/thumbnails usr/share/noosfero/public/th @@ -15,3 +15,4 @@ var/lib/noosfero-data/public/thumbnails usr/share/noosfero/public/th
15 usr/share/noosfero/public/designs/themes/noosfero usr/share/noosfero/public/designs/themes/default 15 usr/share/noosfero/public/designs/themes/noosfero usr/share/noosfero/public/designs/themes/default
16 usr/share/noosfero/public/designs/icons/tango usr/share/noosfero/public/designs/icons/default 16 usr/share/noosfero/public/designs/icons/tango usr/share/noosfero/public/designs/icons/default
17 usr/share/noosfero/script/noosfero-plugins usr/sbin/noosfero-plugins 17 usr/share/noosfero/script/noosfero-plugins usr/sbin/noosfero-plugins
  18 +usr/share/noosfero/Gemfile.lock /dev/null
gitignore.example
@@ -43,3 +43,4 @@ debian/noosfero-apache/ @@ -43,3 +43,4 @@ debian/noosfero-apache/
43 features/plugins/* 43 features/plugins/*
44 plugins/solr/config/solr.yml 44 plugins/solr/config/solr.yml
45 /solr 45 /solr
  46 +/Gemfile.lock
script/install-dependencies/debian-wheezy.sh
@@ -50,6 +50,13 @@ FPQAoNmiMgP6zGF9rgOEWMEiFEryayrz @@ -50,6 +50,13 @@ FPQAoNmiMgP6zGF9rgOEWMEiFEryayrz
50 EOF 50 EOF
51 fi 51 fi
52 52
  53 +if test -f tmp/debian/Release.gpg; then
  54 + echo "deb file://$(pwd)/tmp/debian/ ./" | sudo tee /etc/apt/sources.list.d/local.list
  55 + sudo apt-key add tmp/debian/signing-key.asc
  56 +else
  57 + sudo rm -f /etc/apt/sources.list.d/local.list
  58 +fi
  59 +
53 run sudo apt-get update 60 run sudo apt-get update
54 run sudo apt-get -qy dist-upgrade 61 run sudo apt-get -qy dist-upgrade
55 62
script/install-dependencies/ubuntu-precise.sh 0 → 100644
@@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
  1 +#!/bin/sh
  2 +
  3 +export DEBIAN_INTERFACE=noninteractive
  4 +
  5 +#run sudo apt-get update
  6 +#run sudo apt-get dist-upgrade -qy
  7 +
  8 +run sudo apt-get install -qy dctrl-tools
  9 +
  10 +packages=$(grep-dctrl -n -s Build-Depends,Depends,Recommends -S -X noosfero debian/control | sed -e 's/([^)]*)//g; s/,\s*/\n/g' | grep -v 'rake\|ruby\|thin\|debhelper\|cucumber\|rail\|memcached\|debconf\|dbconfig-common\|misc:Depends\|adduser\|mail-transport-agent')
  11 +
  12 +run sudo apt-get install -qy ruby1.9.1-full build-essential libxml2-dev libxslt-dev libpq-dev libmagickcore-dev libmagickwand-dev $packages
  13 +
  14 +
  15 +export GEM_HOME=$(ruby -e 'puts Gem.user_dir')
  16 +export PATH="${GEM_HOME}/bin:${PATH}"
  17 +(gem list | grep bundler) || run gem install --no-rdoc --no-ri bundler
  18 +run bundle install
  19 +
  20 +sudo tee /etc/profile.d/rubygems-path.sh <<EOF
  21 +export GEM_HOME=\$(ruby -e 'puts Gem.user_dir')
  22 +PATH="\${GEM_HOME}/bin:\${PATH}"
  23 +EOF
test/factories.rb
@@ -174,7 +174,11 @@ module Noosfero::Factory @@ -174,7 +174,11 @@ module Noosfero::Factory
174 ############################################### 174 ###############################################
175 175
176 def defaults_for_environment 176 def defaults_for_environment
177 - { :name => 'Environment ' + factory_num_seq.to_s } 177 + seq = factory_num_seq
  178 + {
  179 + :name => "Environment %d" % seq,
  180 + :contact_email => "environment%d@example.com" % seq
  181 + }
178 end 182 end
179 183
180 ############################################### 184 ###############################################
test/functional/profile_controller_test.rb
@@ -78,7 +78,7 @@ class ProfileControllerTest &lt; ActionController::TestCase @@ -78,7 +78,7 @@ class ProfileControllerTest &lt; ActionController::TestCase
78 78
79 should 'actually add friend' do 79 should 'actually add friend' do
80 login_as(@profile.identifier) 80 login_as(@profile.identifier)
81 - person = fast_create(Person) 81 + person = create_user.person
82 assert_difference 'AddFriend.count' do 82 assert_difference 'AddFriend.count' do
83 post :add, :profile => person.identifier 83 post :add, :profile => person.identifier
84 end 84 end
@@ -366,10 +366,10 @@ class ProfileControllerTest &lt; ActionController::TestCase @@ -366,10 +366,10 @@ class ProfileControllerTest &lt; ActionController::TestCase
366 assert profile.memberships.include?(community), 'profile should be actually added to the community' 366 assert profile.memberships.include?(community), 'profile should be actually added to the community'
367 end 367 end
368 368
369 - should 'create task when join to closed organization with members' do 369 + should 'create a task when joining a closed organization with members' do
370 community = fast_create(Community) 370 community = fast_create(Community)
371 community.update_attribute(:closed, true) 371 community.update_attribute(:closed, true)
372 - admin = fast_create(Person) 372 + admin = create_user.person
373 community.add_member(admin) 373 community.add_member(admin)
374 374
375 login_as profile.identifier 375 login_as profile.identifier
@@ -587,7 +587,7 @@ class ProfileControllerTest &lt; ActionController::TestCase @@ -587,7 +587,7 @@ class ProfileControllerTest &lt; ActionController::TestCase
587 should "leave a scrap on another profile" do 587 should "leave a scrap on another profile" do
588 login_as(profile.identifier) 588 login_as(profile.identifier)
589 count = Scrap.count 589 count = Scrap.count
590 - another_person = fast_create(Person) 590 + another_person = create_user.person
591 assert another_person.scraps_received.empty? 591 assert another_person.scraps_received.empty?
592 post :leave_scrap, :profile => another_person.identifier, :scrap => {:content => 'something'} 592 post :leave_scrap, :profile => another_person.identifier, :scrap => {:content => 'something'}
593 assert_equal count + 1, Scrap.count 593 assert_equal count + 1, Scrap.count
@@ -645,7 +645,7 @@ class ProfileControllerTest &lt; ActionController::TestCase @@ -645,7 +645,7 @@ class ProfileControllerTest &lt; ActionController::TestCase
645 should "the sender be the logged user by default" do 645 should "the sender be the logged user by default" do
646 login_as(profile.identifier) 646 login_as(profile.identifier)
647 count = Scrap.count 647 count = Scrap.count
648 - another_person = fast_create(Person) 648 + another_person = create_user.person
649 post :leave_scrap, :profile => another_person.identifier, :scrap => {:content => 'something'} 649 post :leave_scrap, :profile => another_person.identifier, :scrap => {:content => 'something'}
650 last = Scrap.last 650 last = Scrap.last
651 assert_equal profile, last.sender 651 assert_equal profile, last.sender
@@ -654,7 +654,7 @@ class ProfileControllerTest &lt; ActionController::TestCase @@ -654,7 +654,7 @@ class ProfileControllerTest &lt; ActionController::TestCase
654 should "the receiver be the current profile by default" do 654 should "the receiver be the current profile by default" do
655 login_as(profile.identifier) 655 login_as(profile.identifier)
656 count = Scrap.count 656 count = Scrap.count
657 - another_person = fast_create(Person) 657 + another_person = create_user.person
658 post :leave_scrap, :profile => another_person.identifier, :scrap => {:content => 'something'} 658 post :leave_scrap, :profile => another_person.identifier, :scrap => {:content => 'something'}
659 last = Scrap.last 659 last = Scrap.last
660 assert_equal another_person, last.receiver 660 assert_equal another_person, last.receiver
@@ -686,8 +686,8 @@ class ProfileControllerTest &lt; ActionController::TestCase @@ -686,8 +686,8 @@ class ProfileControllerTest &lt; ActionController::TestCase
686 end 686 end
687 687
688 should 'not display activities of the current profile when he is not followed by the viewer' do 688 should 'not display activities of the current profile when he is not followed by the viewer' do
689 - p1= fast_create(Person)  
690 - p2= fast_create(Person) 689 + p1= create_user.person
  690 + p2= create_user.person
691 691
692 UserStampSweeper.any_instance.stubs(:current_user).returns(p1) 692 UserStampSweeper.any_instance.stubs(:current_user).returns(p1)
693 scrap1 = create(Scrap, defaults_for_scrap(:sender => p1, :receiver => p2)) 693 scrap1 = create(Scrap, defaults_for_scrap(:sender => p1, :receiver => p2))
@@ -714,9 +714,9 @@ class ProfileControllerTest &lt; ActionController::TestCase @@ -714,9 +714,9 @@ class ProfileControllerTest &lt; ActionController::TestCase
714 end 714 end
715 715
716 should 'not see the friends activities in the current profile' do 716 should 'not see the friends activities in the current profile' do
717 - p2= fast_create(Person) 717 + p2 = create_user.person
718 assert !profile.is_a_friend?(p2) 718 assert !profile.is_a_friend?(p2)
719 - p3= fast_create(Person) 719 + p3 = create_user.person
720 p3.add_friend(profile) 720 p3.add_friend(profile)
721 assert p3.is_a_friend?(profile) 721 assert p3.is_a_friend?(profile)
722 ActionTracker::Record.destroy_all 722 ActionTracker::Record.destroy_all
@@ -737,13 +737,13 @@ class ProfileControllerTest &lt; ActionController::TestCase @@ -737,13 +737,13 @@ class ProfileControllerTest &lt; ActionController::TestCase
737 end 737 end
738 738
739 should 'see all the activities in the current profile network' do 739 should 'see all the activities in the current profile network' do
740 - p1= fast_create(Person)  
741 - p2= fast_create(Person) 740 + p1= create_user.person
  741 + p2= create_user.person
742 assert !p1.is_a_friend?(p2) 742 assert !p1.is_a_friend?(p2)
743 743
744 - p3= fast_create(Person) 744 + p3= create_user.person
745 p3.add_friend(p1) 745 p3.add_friend(p1)
746 - assert p3.is_a_friend?(p1) 746 + p1.add_friend(p3)
747 747
748 ActionTracker::Record.delete_all 748 ActionTracker::Record.delete_all
749 749
@@ -759,27 +759,21 @@ class ProfileControllerTest &lt; ActionController::TestCase @@ -759,27 +759,21 @@ class ProfileControllerTest &lt; ActionController::TestCase
759 create(Scrap, defaults_for_scrap(:sender => p3, :receiver => p1)) 759 create(Scrap, defaults_for_scrap(:sender => p3, :receiver => p1))
760 a3 = ActionTracker::Record.last 760 a3 = ActionTracker::Record.last
761 761
762 - @controller.stubs(:logged_in?).returns(true)  
763 - user = mock()  
764 - user.stubs(:person).returns(p3)  
765 - user.stubs(:login).returns('some')  
766 - @controller.stubs(:current_user).returns(user)  
767 - Person.any_instance.stubs(:follows?).returns(true)  
768 -  
769 process_delayed_job_queue 762 process_delayed_job_queue
770 - get :index, :profile => p1.identifier  
771 763
  764 + login_as p3.user.login
  765 + get :index, :profile => p1.identifier
772 assert_equivalent [a1,a3].map(&:id), assigns(:network_activities).map(&:id) 766 assert_equivalent [a1,a3].map(&:id), assigns(:network_activities).map(&:id)
773 end 767 end
774 768
775 should 'the network activity be visible only to profile followers' do 769 should 'the network activity be visible only to profile followers' do
776 - p1= fast_create(Person)  
777 - p2= fast_create(Person) 770 + p1= create_user.person
  771 + p2= create_user.person
778 assert !p1.is_a_friend?(p2) 772 assert !p1.is_a_friend?(p2)
779 773
780 - p3= fast_create(Person) 774 + p3= create_user.person
781 p3.add_friend(p1) 775 p3.add_friend(p1)
782 - assert p3.is_a_friend?(p1) 776 + p1.add_friend(p3)
783 777
784 ActionTracker::Record.delete_all 778 ActionTracker::Record.delete_all
785 779
@@ -795,24 +789,11 @@ class ProfileControllerTest &lt; ActionController::TestCase @@ -795,24 +789,11 @@ class ProfileControllerTest &lt; ActionController::TestCase
795 create(Scrap, defaults_for_scrap(:sender => p3, :receiver => p1)) 789 create(Scrap, defaults_for_scrap(:sender => p3, :receiver => p1))
796 a3 = ActionTracker::Record.last 790 a3 = ActionTracker::Record.last
797 791
798 - @controller.stubs(:logged_in?).returns(true)  
799 - user = mock()  
800 - user.stubs(:person).returns(p2)  
801 - user.stubs(:login).returns('some')  
802 - @controller.stubs(:current_user).returns(user) 792 + process_delayed_job_queue
803 793
  794 + login_as p2.user.login
804 get :index, :profile => p1.identifier 795 get :index, :profile => p1.identifier
805 assert assigns(:network_activities).blank? 796 assert assigns(:network_activities).blank?
806 -  
807 - user = mock()  
808 - user.stubs(:person).returns(p3)  
809 - user.stubs(:login).returns('some')  
810 - @controller.stubs(:current_user).returns(user)  
811 - Person.any_instance.stubs(:follows?).returns(true)  
812 - process_delayed_job_queue  
813 -  
814 - get :index, :profile => p3.identifier  
815 - assert_equivalent [a1,a3], assigns(:network_activities)  
816 end 797 end
817 798
818 should 'the network activity be paginated' do 799 should 'the network activity be paginated' do
@@ -829,10 +810,10 @@ class ProfileControllerTest &lt; ActionController::TestCase @@ -829,10 +810,10 @@ class ProfileControllerTest &lt; ActionController::TestCase
829 end 810 end
830 811
831 should 'the network activity be visible only to logged users' do 812 should 'the network activity be visible only to logged users' do
832 - p1= fast_create(Person)  
833 - p2= fast_create(Person) 813 + p1= create_user.person
  814 + p2= create_user.person
834 assert !p1.is_a_friend?(p2) 815 assert !p1.is_a_friend?(p2)
835 - p3= fast_create(Person) 816 + p3= create_user.person
836 p3.add_friend(p1) 817 p3.add_friend(p1)
837 assert p3.is_a_friend?(p1) 818 assert p3.is_a_friend?(p1)
838 ActionTracker::Record.destroy_all 819 ActionTracker::Record.destroy_all
@@ -891,10 +872,10 @@ class ProfileControllerTest &lt; ActionController::TestCase @@ -891,10 +872,10 @@ class ProfileControllerTest &lt; ActionController::TestCase
891 end 872 end
892 873
893 should 'the self activity not crashes with user not logged in' do 874 should 'the self activity not crashes with user not logged in' do
894 - p1= fast_create(Person)  
895 - p2= fast_create(Person) 875 + p1= create_user.person
  876 + p2= create_user.person
896 assert !p1.is_a_friend?(p2) 877 assert !p1.is_a_friend?(p2)
897 - p3= fast_create(Person) 878 + p3= create_user.person
898 p3.add_friend(p1) 879 p3.add_friend(p1)
899 assert p3.is_a_friend?(p1) 880 assert p3.is_a_friend?(p1)
900 ActionTracker::Record.destroy_all 881 ActionTracker::Record.destroy_all
test/functional/profile_editor_controller_test.rb
@@ -865,7 +865,7 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase @@ -865,7 +865,7 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase
865 865
866 should 'not be able to destroy enterprise if is a regular member' do 866 should 'not be able to destroy enterprise if is a regular member' do
867 enterprise = fast_create(Enterprise) 867 enterprise = fast_create(Enterprise)
868 - enterprise.add_member(fast_create(Person)) # first member is admin by default 868 + enterprise.add_member(create_user.person) # first member is admin by default
869 869
870 person = create_user('foo').person 870 person = create_user('foo').person
871 enterprise.add_member(person) 871 enterprise.add_member(person)
test/unit/application_helper_test.rb
@@ -49,6 +49,20 @@ class ApplicationHelperTest &lt; ActionView::TestCase @@ -49,6 +49,20 @@ class ApplicationHelperTest &lt; ActionView::TestCase
49 end 49 end
50 end 50 end
51 51
  52 + should 'plugins path take precedence over core path' do
  53 + core_path = 'core/'
  54 + plugin_path = 'path/'
  55 + @controller = mock()
  56 + @controller.stubs(:view_paths).returns([plugin_path, core_path])
  57 + self.stubs(:params).returns({:controller => 'test'})
  58 +
  59 + File.stubs(:exists?).returns(false)
  60 + File.stubs(:exists?).with(core_path+"test/_block.html.erb").returns(true)
  61 + File.stubs(:exists?).with(plugin_path+"test/_raw_html_block.html.erb").returns(true)
  62 +
  63 + assert_equal 'raw_html_block', partial_for_class(RawHTMLBlock)
  64 + end
  65 +
52 should 'generate link to stylesheet' do 66 should 'generate link to stylesheet' do
53 File.stubs(:exists?).returns(false) 67 File.stubs(:exists?).returns(false)
54 File.expects(:exists?).with(Rails.root.join('public', 'stylesheets', 'something.css')).returns(true) 68 File.expects(:exists?).with(Rails.root.join('public', 'stylesheets', 'something.css')).returns(true)
test/unit/comment_notifier_test.rb
@@ -57,15 +57,6 @@ class CommentNotifierTest &lt; ActiveSupport::TestCase @@ -57,15 +57,6 @@ class CommentNotifierTest &lt; ActiveSupport::TestCase
57 assert_match /comment body/, sent.body.to_s 57 assert_match /comment body/, sent.body.to_s
58 end 58 end
59 59
60 - should 'not deliver mail if has no notification emails' do  
61 - community = fast_create(Community)  
62 - assert_equal [], community.notification_emails  
63 - article = fast_create(Article, :name => 'Article test', :profile_id => community.id, :notify_comments => true)  
64 - assert_no_difference 'ActionMailer::Base.deliveries.size' do  
65 - create_comment_and_notify(:author => @author, :title => 'test comment', :body => 'there is no addresses to send notification', :source => article)  
66 - end  
67 - end  
68 -  
69 should "deliver mail to followers" do 60 should "deliver mail to followers" do
70 author = create_user('follower_author').person 61 author = create_user('follower_author').person
71 follower = create_user('follower').person 62 follower = create_user('follower').person
test/unit/environment_test.rb
@@ -195,6 +195,12 @@ class EnvironmentTest &lt; ActiveSupport::TestCase @@ -195,6 +195,12 @@ class EnvironmentTest &lt; ActiveSupport::TestCase
195 assert !env.errors[:contact_email.to_s].present? 195 assert !env.errors[:contact_email.to_s].present?
196 end 196 end
197 197
  198 + should 'notify contact email' do
  199 + env = Environment.new(:contact_email => 'foo@bar.com')
  200 + env.stubs(:admins).returns([])
  201 + assert_equal ['foo@bar.com'], env.notification_emails
  202 + end
  203 +
198 should 'provide a default hostname' do 204 should 'provide a default hostname' do
199 env = fast_create(Environment) 205 env = fast_create(Environment)
200 env.domains << create(Domain, :name => 'example.com', :is_default => true) 206 env.domains << create(Domain, :name => 'example.com', :is_default => true)
test/unit/feed_reader_block_test.rb
@@ -53,7 +53,7 @@ class FeedReaderBlockTest &lt; ActiveSupport::TestCase @@ -53,7 +53,7 @@ class FeedReaderBlockTest &lt; ActiveSupport::TestCase
53 end 53 end
54 54
55 should 'display last fetched date' do 55 should 'display last fetched date' do
56 - now = Time.now 56 + now = Time.new(2014,1,1)
57 feed.feed_items = ['one', 'two'] 57 feed.feed_items = ['one', 'two']
58 feed.fetched_at = now 58 feed.fetched_at = now
59 assert_equal "Updated: #{show_date(now)}", feed.footer 59 assert_equal "Updated: #{show_date(now)}", feed.footer
test/unit/organization_test.rb
@@ -123,9 +123,9 @@ class OrganizationTest &lt; ActiveSupport::TestCase @@ -123,9 +123,9 @@ class OrganizationTest &lt; ActiveSupport::TestCase
123 assert_equal ['admin1@email.com', 'admin2@email.com'], o.notification_emails 123 assert_equal ['admin1@email.com', 'admin2@email.com'], o.notification_emails
124 end 124 end
125 125
126 - should 'return empty array if contact_email is a blank string and it has no admin' do 126 + should 'use the environment contact email if no emails are listed here' do
127 o = build(Organization, :contact_email => '', :environment => Environment.default) 127 o = build(Organization, :contact_email => '', :environment => Environment.default)
128 - assert_equal [], o.notification_emails 128 + assert_equal [o.environment.contact_email], o.notification_emails
129 end 129 end
130 130
131 should 'list pending enterprise validations' do 131 should 'list pending enterprise validations' do
test/unit/person_test.rb
@@ -1198,8 +1198,8 @@ class PersonTest &lt; ActiveSupport::TestCase @@ -1198,8 +1198,8 @@ class PersonTest &lt; ActiveSupport::TestCase
1198 1198
1199 should 'return tracked_actions and scraps as activities' do 1199 should 'return tracked_actions and scraps as activities' do
1200 ActionTracker::Record.destroy_all 1200 ActionTracker::Record.destroy_all
1201 - person = fast_create(Person)  
1202 - another_person = fast_create(Person) 1201 + person = create_user.person
  1202 + another_person = create_user.person
1203 1203
1204 UserStampSweeper.any_instance.stubs(:current_user).returns(another_person) 1204 UserStampSweeper.any_instance.stubs(:current_user).returns(another_person)
1205 scrap = create(Scrap, defaults_for_scrap(:sender => another_person, :receiver => person, :content => 'A scrap')) 1205 scrap = create(Scrap, defaults_for_scrap(:sender => another_person, :receiver => person, :content => 'A scrap'))
test/unit/scrap_notifier_test.rb
@@ -57,10 +57,10 @@ class ScrapNotifierTest &lt; ActiveSupport::TestCase @@ -57,10 +57,10 @@ class ScrapNotifierTest &lt; ActiveSupport::TestCase
57 57
58 should 'not deliver mail if is a reply on a community' do 58 should 'not deliver mail if is a reply on a community' do
59 community = fast_create(Community) 59 community = fast_create(Community)
60 - person = fast_create(Person) 60 + person = create_user.person
61 scrap = fast_create(Scrap, :receiver_id => community.id, :sender_id => @sender.id) 61 scrap = fast_create(Scrap, :receiver_id => community.id, :sender_id => @sender.id)
62 assert_no_difference 'ActionMailer::Base.deliveries.size' do 62 assert_no_difference 'ActionMailer::Base.deliveries.size' do
63 - Scrap.create!(:sender_id => person, :receiver_id => @sender.id, :scrap_id => scrap.id, :content => 'Hi myself!') 63 + Scrap.create!(:sender_id => person.id, :receiver_id => @sender.id, :scrap_id => scrap.id, :content => 'Hi myself!')
64 end 64 end
65 end 65 end
66 66
test/unit/scrap_test.rb
@@ -42,7 +42,7 @@ class ScrapTest &lt; ActiveSupport::TestCase @@ -42,7 +42,7 @@ class ScrapTest &lt; ActiveSupport::TestCase
42 end 42 end
43 43
44 should "be associated to Person as sender" do 44 should "be associated to Person as sender" do
45 - person = fast_create(Person) 45 + person = create_user.person
46 s = Scrap.new 46 s = Scrap.new
47 assert_nothing_raised do 47 assert_nothing_raised do
48 s.sender = person 48 s.sender = person
@@ -50,7 +50,7 @@ class ScrapTest &lt; ActiveSupport::TestCase @@ -50,7 +50,7 @@ class ScrapTest &lt; ActiveSupport::TestCase
50 end 50 end
51 51
52 should "be associated to Person as receiver" do 52 should "be associated to Person as receiver" do
53 - person = fast_create(Person) 53 + person = create_user.person
54 s = Scrap.new 54 s = Scrap.new
55 assert_nothing_raised do 55 assert_nothing_raised do
56 s.receiver = person 56 s.receiver = person
@@ -66,7 +66,7 @@ class ScrapTest &lt; ActiveSupport::TestCase @@ -66,7 +66,7 @@ class ScrapTest &lt; ActiveSupport::TestCase
66 end 66 end
67 67
68 should "collect all scraps sent and received of a person" do 68 should "collect all scraps sent and received of a person" do
69 - person = fast_create(Person) 69 + person = create_user.person
70 s1 = fast_create(Scrap, :sender_id => person.id) 70 s1 = fast_create(Scrap, :sender_id => person.id)
71 assert_equal [s1], Scrap.all_scraps(person) 71 assert_equal [s1], Scrap.all_scraps(person)
72 s2 = fast_create(Scrap, :sender_id => person.id) 72 s2 = fast_create(Scrap, :sender_id => person.id)
@@ -77,7 +77,7 @@ class ScrapTest &lt; ActiveSupport::TestCase @@ -77,7 +77,7 @@ class ScrapTest &lt; ActiveSupport::TestCase
77 77
78 should "collect all scraps sent and received of a community" do 78 should "collect all scraps sent and received of a community" do
79 community = fast_create(Community) 79 community = fast_create(Community)
80 - person = fast_create(Person) 80 + person = create_user.person
81 s1 = fast_create(Scrap, :sender_id => person.id) 81 s1 = fast_create(Scrap, :sender_id => person.id)
82 assert_equal [], Scrap.all_scraps(community) 82 assert_equal [], Scrap.all_scraps(community)
83 s2 = fast_create(Scrap, :receiver_id => community.id, :sender_id => person.id) 83 s2 = fast_create(Scrap, :receiver_id => community.id, :sender_id => person.id)
@@ -87,8 +87,8 @@ class ScrapTest &lt; ActiveSupport::TestCase @@ -87,8 +87,8 @@ class ScrapTest &lt; ActiveSupport::TestCase
87 end 87 end
88 88
89 should "create the leave_scrap action tracker verb on scrap creation of one user to another" do 89 should "create the leave_scrap action tracker verb on scrap creation of one user to another" do
90 - p1 = fast_create(Person)  
91 - p2 = fast_create(Person) 90 + p1 = create_user.person
  91 + p2 = create_user.person
92 s = Scrap.new 92 s = Scrap.new
93 s.sender= p1 93 s.sender= p1
94 s.receiver= p2 94 s.receiver= p2
@@ -104,7 +104,7 @@ class ScrapTest &lt; ActiveSupport::TestCase @@ -104,7 +104,7 @@ class ScrapTest &lt; ActiveSupport::TestCase
104 end 104 end
105 105
106 should "create the leave_scrap action tracker verb on scrap creation of one user to community" do 106 should "create the leave_scrap action tracker verb on scrap creation of one user to community" do
107 - p = fast_create(Person) 107 + p = create_user.person
108 c = fast_create(Community) 108 c = fast_create(Community)
109 s = Scrap.new 109 s = Scrap.new
110 s.sender= p 110 s.sender= p
@@ -122,8 +122,8 @@ class ScrapTest &lt; ActiveSupport::TestCase @@ -122,8 +122,8 @@ class ScrapTest &lt; ActiveSupport::TestCase
122 end 122 end
123 123
124 should "notify leave_scrap action tracker verb to friends and itself" do 124 should "notify leave_scrap action tracker verb to friends and itself" do
125 - p1 = fast_create(Person)  
126 - p2 = fast_create(Person) 125 + p1 = create_user.person
  126 + p2 = create_user.person
127 p1.add_friend(p2) 127 p1.add_friend(p2)
128 ActionTrackerNotification.delete_all 128 ActionTrackerNotification.delete_all
129 Delayed::Job.delete_all 129 Delayed::Job.delete_all
@@ -140,7 +140,7 @@ class ScrapTest &lt; ActiveSupport::TestCase @@ -140,7 +140,7 @@ class ScrapTest &lt; ActiveSupport::TestCase
140 end 140 end
141 141
142 should "notify leave_scrap action tracker verb to members of the communities and the community itself" do 142 should "notify leave_scrap action tracker verb to members of the communities and the community itself" do
143 - p = fast_create(Person) 143 + p = create_user.person
144 c = fast_create(Community) 144 c = fast_create(Community)
145 c.add_member(p) 145 c.add_member(p)
146 ActionTrackerNotification.delete_all 146 ActionTrackerNotification.delete_all
@@ -158,7 +158,7 @@ class ScrapTest &lt; ActiveSupport::TestCase @@ -158,7 +158,7 @@ class ScrapTest &lt; ActiveSupport::TestCase
158 end 158 end
159 159
160 should "create the leave_scrap_to_self action tracker verb on scrap creation of one user to itself" do 160 should "create the leave_scrap_to_self action tracker verb on scrap creation of one user to itself" do
161 - p = fast_create(Person) 161 + p = create_user.person
162 s = Scrap.new 162 s = Scrap.new
163 s.sender= p 163 s.sender= p
164 s.receiver= p 164 s.receiver= p
@@ -172,8 +172,8 @@ class ScrapTest &lt; ActiveSupport::TestCase @@ -172,8 +172,8 @@ class ScrapTest &lt; ActiveSupport::TestCase
172 end 172 end
173 173
174 should "notify leave_scrap_to_self action tracker verb to friends and itself" do 174 should "notify leave_scrap_to_self action tracker verb to friends and itself" do
175 - p1 = fast_create(Person)  
176 - p2 = fast_create(Person) 175 + p1 = create_user.person
  176 + p2 = create_user.person
177 p1.add_friend(p2) 177 p1.add_friend(p2)
178 ActionTrackerNotification.delete_all 178 ActionTrackerNotification.delete_all
179 Delayed::Job.delete_all 179 Delayed::Job.delete_all
@@ -216,7 +216,7 @@ class ScrapTest &lt; ActiveSupport::TestCase @@ -216,7 +216,7 @@ class ScrapTest &lt; ActiveSupport::TestCase
216 end 216 end
217 217
218 should "update the scrap on reply creation" do 218 should "update the scrap on reply creation" do
219 - person = fast_create(Person) 219 + person = create_user.person
220 s = fast_create(Scrap, :updated_at => DateTime.parse('2010-01-01')) 220 s = fast_create(Scrap, :updated_at => DateTime.parse('2010-01-01'))
221 assert_equal DateTime.parse('2010-01-01'), s.updated_at.strftime('%Y-%m-%d') 221 assert_equal DateTime.parse('2010-01-01'), s.updated_at.strftime('%Y-%m-%d')
222 DateTime.stubs(:now).returns(DateTime.parse('2010-09-07')) 222 DateTime.stubs(:now).returns(DateTime.parse('2010-09-07'))
@@ -242,20 +242,20 @@ class ScrapTest &lt; ActiveSupport::TestCase @@ -242,20 +242,20 @@ class ScrapTest &lt; ActiveSupport::TestCase
242 end 242 end
243 243
244 should 'strip all html tags' do 244 should 'strip all html tags' do
245 - s, r = fast_create(Person), fast_create(Person) 245 + s, r = create_user.person, create_user.person
246 s = build Scrap, :sender => s, :receiver => r, :content => "<p>Test <b>Rails</b></p>" 246 s = build Scrap, :sender => s, :receiver => r, :content => "<p>Test <b>Rails</b></p>"
247 assert_equal "Test Rails", s.strip_all_html_tags 247 assert_equal "Test Rails", s.strip_all_html_tags
248 end 248 end
249 249
250 should 'strip html before save' do 250 should 'strip html before save' do
251 - s, r = fast_create(Person), fast_create(Person) 251 + s, r = create_user.person, create_user.person
252 s = build Scrap, :sender => s, :receiver => r, :content => "<p>Test <b>Rails</b></p>" 252 s = build Scrap, :sender => s, :receiver => r, :content => "<p>Test <b>Rails</b></p>"
253 s.save! 253 s.save!
254 assert_equal "Test Rails", s.reload.content 254 assert_equal "Test Rails", s.reload.content
255 end 255 end
256 256
257 should 'strip html before validate' do 257 should 'strip html before validate' do
258 - s, r = fast_create(Person), fast_create(Person) 258 + s, r = create_user.person, create_user.person
259 s = build Scrap, :sender => s, :receiver => r, :content => "<p><b></b></p>" 259 s = build Scrap, :sender => s, :receiver => r, :content => "<p><b></b></p>"
260 assert !s.valid? 260 assert !s.valid?
261 s.content = "<p>Test</p>" 261 s.content = "<p>Test</p>"
@@ -272,7 +272,7 @@ class ScrapTest &lt; ActiveSupport::TestCase @@ -272,7 +272,7 @@ class ScrapTest &lt; ActiveSupport::TestCase
272 end 272 end
273 273
274 should 'scrap wall url be the root scrap receiver url if it is a reply' do 274 should 'scrap wall url be the root scrap receiver url if it is a reply' do
275 - p1, p2 = fast_create(Person), fast_create(Person) 275 + p1, p2 = create_user.person, create_user.person
276 r = create Scrap, :sender => p1, :receiver => p2, :content => "Hello!" 276 r = create Scrap, :sender => p1, :receiver => p2, :content => "Hello!"
277 s = build Scrap, :sender => p2, :receiver => p1, :content => "Hi!" 277 s = build Scrap, :sender => p2, :receiver => p1, :content => "Hi!"
278 r.replies << s; s.reload 278 r.replies << s; s.reload
@@ -280,13 +280,13 @@ class ScrapTest &lt; ActiveSupport::TestCase @@ -280,13 +280,13 @@ class ScrapTest &lt; ActiveSupport::TestCase
280 end 280 end
281 281
282 should 'scrap wall url be the scrap receiver url if it is not a reply' do 282 should 'scrap wall url be the scrap receiver url if it is not a reply' do
283 - p1, p2 = fast_create(Person), fast_create(Person) 283 + p1, p2 = create_user.person, create_user.person
284 s = create Scrap, :sender => p1, :receiver => p2, :content => "Hello!" 284 s = create Scrap, :sender => p1, :receiver => p2, :content => "Hello!"
285 assert_equal s.scrap_wall_url, s.receiver.wall_url 285 assert_equal s.scrap_wall_url, s.receiver.wall_url
286 end 286 end
287 287
288 should 'create activity with reply_scrap_on_self when top_root scrap receiver is the same as sender' do 288 should 'create activity with reply_scrap_on_self when top_root scrap receiver is the same as sender' do
289 - s, r = fast_create(Person), fast_create(Person) 289 + s, r = create_user.person, create_user.person
290 root = fast_create(Scrap, :sender_id => s.id, :receiver_id => r.id) 290 root = fast_create(Scrap, :sender_id => s.id, :receiver_id => r.id)
291 assert_difference 'ActionTracker::Record.count', 1 do 291 assert_difference 'ActionTracker::Record.count', 1 do
292 reply = create(Scrap, :sender => r, :receiver => s, :scrap_id => root.id, :content => 'sample') 292 reply = create(Scrap, :sender => r, :receiver => s, :scrap_id => root.id, :content => 'sample')