Commit d333a169ee1278ad327614f1c5d42d3297492218
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
Merge branch 'master' into stable
Showing
6 changed files
with
29 additions
and
30 deletions
Show diff stats
app/helpers/sweeper_helper.rb
... | ... | @@ -56,12 +56,12 @@ module SweeperHelper |
56 | 56 | if profile |
57 | 57 | profile.blocks.each {|block| |
58 | 58 | conditions = block.class.expire_on |
59 | - blocks_to_expire << block unless (conditions[:profile] & causes).empty? | |
59 | + blocks_to_expire << block unless (conditions[:profile] & causes).blank? | |
60 | 60 | } |
61 | 61 | end |
62 | 62 | environment.blocks.each {|block| |
63 | 63 | conditions = block.class.expire_on |
64 | - blocks_to_expire << block unless (conditions[:environment] & causes).empty? | |
64 | + blocks_to_expire << block unless (conditions[:environment] & causes).blank? | |
65 | 65 | } |
66 | 66 | |
67 | 67 | blocks_to_expire.uniq! | ... | ... |
app/views/profile/_profile_comment_form.html.erb
... | ... | @@ -10,8 +10,8 @@ |
10 | 10 | :rows => 1, |
11 | 11 | :class => 'submit-with-keypress', |
12 | 12 | :title => _('Leave your comment'), |
13 | - :onfocus => ('if(this.value==this.title){this.value="";this.style.color="#000"};this.style.backgroundImage="url(' + profile_icon(current_person, :icon, false) + ')"' if logged_in?), | |
14 | - :onblur => ('if(this.value==""){this.value=this.title;this.style.color="#ccc"};this.style.backgroundImage="none"' if logged_in?), | |
13 | + :onfocus => ("if(this.value==this.title){this.value='';this.style.color='#000'};this.style.backgroundImage='url(" + profile_icon(current_person, :icon, false) + ")'" if logged_in?), | |
14 | + :onblur => ("if(this.value==''){this.value=this.title;this.style.color='#ccc'};this.style.backgroundImage='none'" if logged_in?), | |
15 | 15 | :value => _('Leave your comment'), |
16 | 16 | :style => 'color: #ccc' %> |
17 | 17 | <%= hidden_field_tag :source_id, activity.id, :id => "activity_id_#{activity.id}" %> | ... | ... |
app/views/profile/_profile_scrap_reply_form.html.erb
... | ... | @@ -9,9 +9,9 @@ |
9 | 9 | :rows => 1, |
10 | 10 | :class => 'submit-with-keypress', |
11 | 11 | :title => _('Leave your comment'), |
12 | - :onfocus => ('if(this.value==this.title){this.value="";this.style.color="#000"};this.style.backgroundImage="url(' + profile_icon(current_person, :icon, false) + ')"' if logged_in?), | |
13 | - :onblur => ('if(this.value==""){this.value=this.title;this.style.color="#ccc"};this.style.backgroundImage="none"' if logged_in?), | |
14 | - :value => _('Leave your comment') %> | |
12 | + :onfocus => ("if(this.value==this.title){this.value='';this.style.color='#000'};this.style.backgroundImage='url(" + profile_icon(current_person, :icon, false) + ")'" if logged_in?), | |
13 | + :onblur => ("if(this.value==''){this.value=this.title;this.style.color='#ccc'};this.style.backgroundImage='none'" if logged_in?), | |
14 | + :value => _('Leave your comment'), %> | |
15 | 15 | <%= hidden_field_tag 'scrap[scrap_id]', scrap.id %> |
16 | 16 | <%= hidden_field_tag 'receiver_id', scrap.sender.id %> |
17 | 17 | <% end %> | ... | ... |
plugins/people_block/test/unit/friends_block_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../test_helper' |
2 | 2 | |
3 | -class FriendsBlockTest < ActiveSupport::TestCase | |
3 | +class FriendsBlockTest < ActionView::TestCase | |
4 | 4 | |
5 | 5 | should 'inherit from Block' do |
6 | 6 | assert_kind_of Block, FriendsBlock.new |
... | ... | @@ -8,6 +8,7 @@ class FriendsBlockTest < ActiveSupport::TestCase |
8 | 8 | |
9 | 9 | |
10 | 10 | should 'declare its default title' do |
11 | + FriendsBlock.any_instance.expects(:profile_count).returns(0) | |
11 | 12 | assert_not_equal Block.new.default_title, FriendsBlock.new.default_title |
12 | 13 | end |
13 | 14 | |
... | ... | @@ -60,7 +61,7 @@ class FriendsBlockTest < ActiveSupport::TestCase |
60 | 61 | |
61 | 62 | |
62 | 63 | should 'prioritize profiles with image by default' do |
63 | - assert FriendsBlock.new.prioritize_people_with_image | |
64 | + assert FriendsBlock.new.prioritize_profiles_with_image | |
64 | 65 | end |
65 | 66 | |
66 | 67 | |
... | ... | @@ -98,10 +99,10 @@ class FriendsBlockTest < ActiveSupport::TestCase |
98 | 99 | block = FriendsBlock.new |
99 | 100 | block.expects(:owner).returns(person1).at_least_once |
100 | 101 | |
101 | - expects(:_).with('View all').returns('View all') | |
102 | - expects(:link_to).with('View all', :profile => 'mytestperson', :controller => 'profile', :action => 'friends').returns('link-to-friends') | |
103 | - | |
104 | - assert_equal 'link-to-friends', instance_eval(&block.footer) | |
102 | + instance_eval(&block.footer) | |
103 | + assert_select 'a.view-all' do |elements| | |
104 | + assert_select '[href=/profile/mytestperson/friends]' | |
105 | + end | |
105 | 106 | end |
106 | 107 | |
107 | 108 | ... | ... |
plugins/people_block/test/unit/members_block_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../test_helper' |
2 | 2 | |
3 | -class MembersBlockTest < ActiveSupport::TestCase | |
3 | +class MembersBlockTest < ActionView::TestCase | |
4 | 4 | |
5 | 5 | should 'inherit from Block' do |
6 | 6 | assert_kind_of Block, MembersBlock.new |
... | ... | @@ -60,7 +60,7 @@ class MembersBlockTest < ActiveSupport::TestCase |
60 | 60 | |
61 | 61 | |
62 | 62 | should 'prioritize profiles with image by default' do |
63 | - assert MembersBlock.new.prioritize_people_with_image | |
63 | + assert MembersBlock.new.prioritize_profiles_with_image | |
64 | 64 | end |
65 | 65 | |
66 | 66 | |
... | ... | @@ -145,10 +145,10 @@ class MembersBlockTest < ActiveSupport::TestCase |
145 | 145 | block.box = profile.boxes.first |
146 | 146 | block.save! |
147 | 147 | |
148 | - expects(:_).with('View all').returns('View all') | |
149 | - expects(:link_to).with('View all' , :profile => 'mytestuser', :controller => 'people_block_plugin_profile', :action => 'members', :role_key => block.visible_role).returns('link-to-members') | |
150 | - | |
151 | - assert_equal 'link-to-members', instance_eval(&block.footer) | |
148 | + instance_eval(&block.footer) | |
149 | + assert_select 'a.view-all' do |elements| | |
150 | + assert_select '[href=/profile/mytestuser/plugin/people_block/members]' | |
151 | + end | |
152 | 152 | end |
153 | 153 | |
154 | 154 | should 'provide link to members page with a selected role' do |
... | ... | @@ -158,10 +158,10 @@ class MembersBlockTest < ActiveSupport::TestCase |
158 | 158 | block.visible_role = 'profile_member' |
159 | 159 | block.save! |
160 | 160 | |
161 | - expects(:_).with('View all').returns('View all') | |
162 | - expects(:link_to).with('View all' , :profile => 'mytestuser', :controller => 'people_block_plugin_profile', :action => 'members', :role_key => block.visible_role).returns('link-to-members') | |
163 | - | |
164 | - assert_equal 'link-to-members', instance_eval(&block.footer) | |
161 | + instance_eval(&block.footer) | |
162 | + assert_select 'a.view-all' do |elements| | |
163 | + assert_select '[href=/profile/mytestuser/plugin/people_block/members?role_key=profile_member]' | |
164 | + end | |
165 | 165 | end |
166 | 166 | |
167 | 167 | should 'provide a role to be displayed (and default to nil)' do | ... | ... |
plugins/people_block/test/unit/people_block_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../test_helper' |
2 | 2 | |
3 | -class PeopleBlockTest < ActiveSupport::TestCase | |
3 | +class PeopleBlockTest < ActionView::TestCase | |
4 | 4 | |
5 | 5 | should 'inherit from Block' do |
6 | 6 | assert_kind_of Block, PeopleBlock.new |
... | ... | @@ -106,14 +106,12 @@ class PeopleBlockTest < ActiveSupport::TestCase |
106 | 106 | |
107 | 107 | should 'link to "all people"' do |
108 | 108 | env = fast_create(Environment) |
109 | - | |
110 | 109 | block = PeopleBlock.new |
111 | 110 | |
112 | - stubs(:_).with('View all').returns('View all') | |
113 | - stubs(:link_to).returns('link-to-people') | |
114 | - stubs(:url_for).returns(' ') | |
115 | - | |
116 | - assert_equal 'link-to-people', instance_exec(&block.footer) | |
111 | + instance_eval(&block.footer) | |
112 | + assert_select 'a.view-all' do |elements| | |
113 | + assert_select '[href=/search/people]' | |
114 | + end | |
117 | 115 | end |
118 | 116 | |
119 | 117 | ... | ... |