Commit 2efb80a26924c689e58ba57e59c65bc3cd9de32b
Exists in
staging
and in
4 other branches
Merge branch 'master' into rails3_stable
Conflicts: Gemfile Gemfile.lock
Showing
21 changed files
with
135 additions
and
324 deletions
Show diff stats
Gemfile
1 | 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 | 17 | gem 'rake', :require => false |
18 | -gem 'grape', '0.2.1' | |
19 | -gem 'rest-client' | |
20 | -gem 'exception_notification' | |
21 | -gem 'gettext', :require => false, :group => :development | |
18 | +gem 'grape', '~> 0.2.1' | |
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 | 23 | # FIXME list here all actual dependencies (i.e. the ones in debian/control), |
24 | 24 | # with their GEM names (not the Debian package names) |
25 | 25 | |
26 | 26 | group :production do |
27 | - gem 'dalli' | |
27 | + gem 'dalli', '~> 2.7.0' | |
28 | 28 | end |
29 | 29 | |
30 | 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 | 34 | end |
35 | 35 | |
36 | 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 | 42 | end |
43 | 43 | |
44 | 44 | # include plugin gemfiles | ... | ... |
Gemfile.lock
... | ... | @@ -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 |
Vagrantfile
... | ... | @@ -3,7 +3,7 @@ |
3 | 3 | |
4 | 4 | VAGRANTFILE_API_VERSION = "2" |
5 | 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 | 7 | config.vm.network :forwarded_port, host: 3000, guest: 3000 |
8 | 8 | config.vm.provision :shell do |shell| |
9 | 9 | shell.inline = 'su vagrant -c /vagrant/script/vagrant' | ... | ... |
app/models/environment.rb
... | ... | @@ -829,7 +829,7 @@ class Environment < ActiveRecord::Base |
829 | 829 | end |
830 | 830 | |
831 | 831 | def notification_emails |
832 | - [noreply_email.blank? ? nil : noreply_email].compact + admins.map(&:email) | |
832 | + [contact_email].select(&:present?) + admins.map(&:email) | |
833 | 833 | end |
834 | 834 | |
835 | 835 | after_create :create_templates | ... | ... |
app/models/organization.rb
... | ... | @@ -135,7 +135,11 @@ class Organization < Profile |
135 | 135 | end |
136 | 136 | |
137 | 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 | 143 | end |
140 | 144 | |
141 | 145 | def already_request_membership?(person) | ... | ... |
debian/control
debian/noosfero.install
debian/noosfero.links
... | ... | @@ -15,3 +15,4 @@ var/lib/noosfero-data/public/thumbnails usr/share/noosfero/public/th |
15 | 15 | usr/share/noosfero/public/designs/themes/noosfero usr/share/noosfero/public/designs/themes/default |
16 | 16 | usr/share/noosfero/public/designs/icons/tango usr/share/noosfero/public/designs/icons/default |
17 | 17 | usr/share/noosfero/script/noosfero-plugins usr/sbin/noosfero-plugins |
18 | +usr/share/noosfero/Gemfile.lock /dev/null | ... | ... |
gitignore.example
script/install-dependencies/debian-wheezy.sh
... | ... | @@ -50,6 +50,13 @@ FPQAoNmiMgP6zGF9rgOEWMEiFEryayrz |
50 | 50 | EOF |
51 | 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 | 60 | run sudo apt-get update |
54 | 61 | run sudo apt-get -qy dist-upgrade |
55 | 62 | ... | ... |
... | ... | @@ -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 | 174 | ############################################### |
175 | 175 | |
176 | 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 | 182 | end |
179 | 183 | |
180 | 184 | ############################################### | ... | ... |
test/functional/profile_controller_test.rb
... | ... | @@ -78,7 +78,7 @@ class ProfileControllerTest < ActionController::TestCase |
78 | 78 | |
79 | 79 | should 'actually add friend' do |
80 | 80 | login_as(@profile.identifier) |
81 | - person = fast_create(Person) | |
81 | + person = create_user.person | |
82 | 82 | assert_difference 'AddFriend.count' do |
83 | 83 | post :add, :profile => person.identifier |
84 | 84 | end |
... | ... | @@ -366,10 +366,10 @@ class ProfileControllerTest < ActionController::TestCase |
366 | 366 | assert profile.memberships.include?(community), 'profile should be actually added to the community' |
367 | 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 | 370 | community = fast_create(Community) |
371 | 371 | community.update_attribute(:closed, true) |
372 | - admin = fast_create(Person) | |
372 | + admin = create_user.person | |
373 | 373 | community.add_member(admin) |
374 | 374 | |
375 | 375 | login_as profile.identifier |
... | ... | @@ -587,7 +587,7 @@ class ProfileControllerTest < ActionController::TestCase |
587 | 587 | should "leave a scrap on another profile" do |
588 | 588 | login_as(profile.identifier) |
589 | 589 | count = Scrap.count |
590 | - another_person = fast_create(Person) | |
590 | + another_person = create_user.person | |
591 | 591 | assert another_person.scraps_received.empty? |
592 | 592 | post :leave_scrap, :profile => another_person.identifier, :scrap => {:content => 'something'} |
593 | 593 | assert_equal count + 1, Scrap.count |
... | ... | @@ -645,7 +645,7 @@ class ProfileControllerTest < ActionController::TestCase |
645 | 645 | should "the sender be the logged user by default" do |
646 | 646 | login_as(profile.identifier) |
647 | 647 | count = Scrap.count |
648 | - another_person = fast_create(Person) | |
648 | + another_person = create_user.person | |
649 | 649 | post :leave_scrap, :profile => another_person.identifier, :scrap => {:content => 'something'} |
650 | 650 | last = Scrap.last |
651 | 651 | assert_equal profile, last.sender |
... | ... | @@ -654,7 +654,7 @@ class ProfileControllerTest < ActionController::TestCase |
654 | 654 | should "the receiver be the current profile by default" do |
655 | 655 | login_as(profile.identifier) |
656 | 656 | count = Scrap.count |
657 | - another_person = fast_create(Person) | |
657 | + another_person = create_user.person | |
658 | 658 | post :leave_scrap, :profile => another_person.identifier, :scrap => {:content => 'something'} |
659 | 659 | last = Scrap.last |
660 | 660 | assert_equal another_person, last.receiver |
... | ... | @@ -686,8 +686,8 @@ class ProfileControllerTest < ActionController::TestCase |
686 | 686 | end |
687 | 687 | |
688 | 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 | 692 | UserStampSweeper.any_instance.stubs(:current_user).returns(p1) |
693 | 693 | scrap1 = create(Scrap, defaults_for_scrap(:sender => p1, :receiver => p2)) |
... | ... | @@ -714,9 +714,9 @@ class ProfileControllerTest < ActionController::TestCase |
714 | 714 | end |
715 | 715 | |
716 | 716 | should 'not see the friends activities in the current profile' do |
717 | - p2= fast_create(Person) | |
717 | + p2 = create_user.person | |
718 | 718 | assert !profile.is_a_friend?(p2) |
719 | - p3= fast_create(Person) | |
719 | + p3 = create_user.person | |
720 | 720 | p3.add_friend(profile) |
721 | 721 | assert p3.is_a_friend?(profile) |
722 | 722 | ActionTracker::Record.destroy_all |
... | ... | @@ -737,13 +737,13 @@ class ProfileControllerTest < ActionController::TestCase |
737 | 737 | end |
738 | 738 | |
739 | 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 | 742 | assert !p1.is_a_friend?(p2) |
743 | 743 | |
744 | - p3= fast_create(Person) | |
744 | + p3= create_user.person | |
745 | 745 | p3.add_friend(p1) |
746 | - assert p3.is_a_friend?(p1) | |
746 | + p1.add_friend(p3) | |
747 | 747 | |
748 | 748 | ActionTracker::Record.delete_all |
749 | 749 | |
... | ... | @@ -759,27 +759,21 @@ class ProfileControllerTest < ActionController::TestCase |
759 | 759 | create(Scrap, defaults_for_scrap(:sender => p3, :receiver => p1)) |
760 | 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 | 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 | 766 | assert_equivalent [a1,a3].map(&:id), assigns(:network_activities).map(&:id) |
773 | 767 | end |
774 | 768 | |
775 | 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 | 772 | assert !p1.is_a_friend?(p2) |
779 | 773 | |
780 | - p3= fast_create(Person) | |
774 | + p3= create_user.person | |
781 | 775 | p3.add_friend(p1) |
782 | - assert p3.is_a_friend?(p1) | |
776 | + p1.add_friend(p3) | |
783 | 777 | |
784 | 778 | ActionTracker::Record.delete_all |
785 | 779 | |
... | ... | @@ -795,24 +789,11 @@ class ProfileControllerTest < ActionController::TestCase |
795 | 789 | create(Scrap, defaults_for_scrap(:sender => p3, :receiver => p1)) |
796 | 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 | 795 | get :index, :profile => p1.identifier |
805 | 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 | 797 | end |
817 | 798 | |
818 | 799 | should 'the network activity be paginated' do |
... | ... | @@ -829,10 +810,10 @@ class ProfileControllerTest < ActionController::TestCase |
829 | 810 | end |
830 | 811 | |
831 | 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 | 815 | assert !p1.is_a_friend?(p2) |
835 | - p3= fast_create(Person) | |
816 | + p3= create_user.person | |
836 | 817 | p3.add_friend(p1) |
837 | 818 | assert p3.is_a_friend?(p1) |
838 | 819 | ActionTracker::Record.destroy_all |
... | ... | @@ -891,10 +872,10 @@ class ProfileControllerTest < ActionController::TestCase |
891 | 872 | end |
892 | 873 | |
893 | 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 | 877 | assert !p1.is_a_friend?(p2) |
897 | - p3= fast_create(Person) | |
878 | + p3= create_user.person | |
898 | 879 | p3.add_friend(p1) |
899 | 880 | assert p3.is_a_friend?(p1) |
900 | 881 | ActionTracker::Record.destroy_all | ... | ... |
test/functional/profile_editor_controller_test.rb
... | ... | @@ -865,7 +865,7 @@ class ProfileEditorControllerTest < ActionController::TestCase |
865 | 865 | |
866 | 866 | should 'not be able to destroy enterprise if is a regular member' do |
867 | 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 | 870 | person = create_user('foo').person |
871 | 871 | enterprise.add_member(person) | ... | ... |
test/unit/comment_notifier_test.rb
... | ... | @@ -57,15 +57,6 @@ class CommentNotifierTest < ActiveSupport::TestCase |
57 | 57 | assert_match /comment body/, sent.body.to_s |
58 | 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 | 60 | should "deliver mail to followers" do |
70 | 61 | author = create_user('follower_author').person |
71 | 62 | follower = create_user('follower').person | ... | ... |
test/unit/environment_test.rb
... | ... | @@ -195,6 +195,12 @@ class EnvironmentTest < ActiveSupport::TestCase |
195 | 195 | assert !env.errors[:contact_email.to_s].present? |
196 | 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 | 204 | should 'provide a default hostname' do |
199 | 205 | env = fast_create(Environment) |
200 | 206 | env.domains << create(Domain, :name => 'example.com', :is_default => true) | ... | ... |
test/unit/feed_reader_block_test.rb
... | ... | @@ -53,7 +53,7 @@ class FeedReaderBlockTest < ActiveSupport::TestCase |
53 | 53 | end |
54 | 54 | |
55 | 55 | should 'display last fetched date' do |
56 | - now = Time.now | |
56 | + now = Time.new(2014,1,1) | |
57 | 57 | feed.feed_items = ['one', 'two'] |
58 | 58 | feed.fetched_at = now |
59 | 59 | assert_equal "Updated: #{show_date(now)}", feed.footer | ... | ... |
test/unit/organization_test.rb
... | ... | @@ -123,9 +123,9 @@ class OrganizationTest < ActiveSupport::TestCase |
123 | 123 | assert_equal ['admin1@email.com', 'admin2@email.com'], o.notification_emails |
124 | 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 | 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 | 129 | end |
130 | 130 | |
131 | 131 | should 'list pending enterprise validations' do | ... | ... |
test/unit/person_test.rb
... | ... | @@ -1198,8 +1198,8 @@ class PersonTest < ActiveSupport::TestCase |
1198 | 1198 | |
1199 | 1199 | should 'return tracked_actions and scraps as activities' do |
1200 | 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 | 1204 | UserStampSweeper.any_instance.stubs(:current_user).returns(another_person) |
1205 | 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 < ActiveSupport::TestCase |
57 | 57 | |
58 | 58 | should 'not deliver mail if is a reply on a community' do |
59 | 59 | community = fast_create(Community) |
60 | - person = fast_create(Person) | |
60 | + person = create_user.person | |
61 | 61 | scrap = fast_create(Scrap, :receiver_id => community.id, :sender_id => @sender.id) |
62 | 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 | 64 | end |
65 | 65 | end |
66 | 66 | ... | ... |
test/unit/scrap_test.rb
... | ... | @@ -42,7 +42,7 @@ class ScrapTest < ActiveSupport::TestCase |
42 | 42 | end |
43 | 43 | |
44 | 44 | should "be associated to Person as sender" do |
45 | - person = fast_create(Person) | |
45 | + person = create_user.person | |
46 | 46 | s = Scrap.new |
47 | 47 | assert_nothing_raised do |
48 | 48 | s.sender = person |
... | ... | @@ -50,7 +50,7 @@ class ScrapTest < ActiveSupport::TestCase |
50 | 50 | end |
51 | 51 | |
52 | 52 | should "be associated to Person as receiver" do |
53 | - person = fast_create(Person) | |
53 | + person = create_user.person | |
54 | 54 | s = Scrap.new |
55 | 55 | assert_nothing_raised do |
56 | 56 | s.receiver = person |
... | ... | @@ -66,7 +66,7 @@ class ScrapTest < ActiveSupport::TestCase |
66 | 66 | end |
67 | 67 | |
68 | 68 | should "collect all scraps sent and received of a person" do |
69 | - person = fast_create(Person) | |
69 | + person = create_user.person | |
70 | 70 | s1 = fast_create(Scrap, :sender_id => person.id) |
71 | 71 | assert_equal [s1], Scrap.all_scraps(person) |
72 | 72 | s2 = fast_create(Scrap, :sender_id => person.id) |
... | ... | @@ -77,7 +77,7 @@ class ScrapTest < ActiveSupport::TestCase |
77 | 77 | |
78 | 78 | should "collect all scraps sent and received of a community" do |
79 | 79 | community = fast_create(Community) |
80 | - person = fast_create(Person) | |
80 | + person = create_user.person | |
81 | 81 | s1 = fast_create(Scrap, :sender_id => person.id) |
82 | 82 | assert_equal [], Scrap.all_scraps(community) |
83 | 83 | s2 = fast_create(Scrap, :receiver_id => community.id, :sender_id => person.id) |
... | ... | @@ -87,8 +87,8 @@ class ScrapTest < ActiveSupport::TestCase |
87 | 87 | end |
88 | 88 | |
89 | 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 | 92 | s = Scrap.new |
93 | 93 | s.sender= p1 |
94 | 94 | s.receiver= p2 |
... | ... | @@ -104,7 +104,7 @@ class ScrapTest < ActiveSupport::TestCase |
104 | 104 | end |
105 | 105 | |
106 | 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 | 108 | c = fast_create(Community) |
109 | 109 | s = Scrap.new |
110 | 110 | s.sender= p |
... | ... | @@ -122,8 +122,8 @@ class ScrapTest < ActiveSupport::TestCase |
122 | 122 | end |
123 | 123 | |
124 | 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 | 127 | p1.add_friend(p2) |
128 | 128 | ActionTrackerNotification.delete_all |
129 | 129 | Delayed::Job.delete_all |
... | ... | @@ -140,7 +140,7 @@ class ScrapTest < ActiveSupport::TestCase |
140 | 140 | end |
141 | 141 | |
142 | 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 | 144 | c = fast_create(Community) |
145 | 145 | c.add_member(p) |
146 | 146 | ActionTrackerNotification.delete_all |
... | ... | @@ -158,7 +158,7 @@ class ScrapTest < ActiveSupport::TestCase |
158 | 158 | end |
159 | 159 | |
160 | 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 | 162 | s = Scrap.new |
163 | 163 | s.sender= p |
164 | 164 | s.receiver= p |
... | ... | @@ -172,8 +172,8 @@ class ScrapTest < ActiveSupport::TestCase |
172 | 172 | end |
173 | 173 | |
174 | 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 | 177 | p1.add_friend(p2) |
178 | 178 | ActionTrackerNotification.delete_all |
179 | 179 | Delayed::Job.delete_all |
... | ... | @@ -216,7 +216,7 @@ class ScrapTest < ActiveSupport::TestCase |
216 | 216 | end |
217 | 217 | |
218 | 218 | should "update the scrap on reply creation" do |
219 | - person = fast_create(Person) | |
219 | + person = create_user.person | |
220 | 220 | s = fast_create(Scrap, :updated_at => DateTime.parse('2010-01-01')) |
221 | 221 | assert_equal DateTime.parse('2010-01-01'), s.updated_at.strftime('%Y-%m-%d') |
222 | 222 | DateTime.stubs(:now).returns(DateTime.parse('2010-09-07')) |
... | ... | @@ -242,20 +242,20 @@ class ScrapTest < ActiveSupport::TestCase |
242 | 242 | end |
243 | 243 | |
244 | 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 | 246 | s = build Scrap, :sender => s, :receiver => r, :content => "<p>Test <b>Rails</b></p>" |
247 | 247 | assert_equal "Test Rails", s.strip_all_html_tags |
248 | 248 | end |
249 | 249 | |
250 | 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 | 252 | s = build Scrap, :sender => s, :receiver => r, :content => "<p>Test <b>Rails</b></p>" |
253 | 253 | s.save! |
254 | 254 | assert_equal "Test Rails", s.reload.content |
255 | 255 | end |
256 | 256 | |
257 | 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 | 259 | s = build Scrap, :sender => s, :receiver => r, :content => "<p><b></b></p>" |
260 | 260 | assert !s.valid? |
261 | 261 | s.content = "<p>Test</p>" |
... | ... | @@ -272,7 +272,7 @@ class ScrapTest < ActiveSupport::TestCase |
272 | 272 | end |
273 | 273 | |
274 | 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 | 276 | r = create Scrap, :sender => p1, :receiver => p2, :content => "Hello!" |
277 | 277 | s = build Scrap, :sender => p2, :receiver => p1, :content => "Hi!" |
278 | 278 | r.replies << s; s.reload |
... | ... | @@ -280,13 +280,13 @@ class ScrapTest < ActiveSupport::TestCase |
280 | 280 | end |
281 | 281 | |
282 | 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 | 284 | s = create Scrap, :sender => p1, :receiver => p2, :content => "Hello!" |
285 | 285 | assert_equal s.scrap_wall_url, s.receiver.wall_url |
286 | 286 | end |
287 | 287 | |
288 | 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 | 290 | root = fast_create(Scrap, :sender_id => s.id, :receiver_id => r.id) |
291 | 291 | assert_difference 'ActionTracker::Record.count', 1 do |
292 | 292 | reply = create(Scrap, :sender => r, :receiver => s, :scrap_id => root.id, :content => 'sample') | ... | ... |