rspec should now be running a green build
This commit is contained in:
parent
89d468cdcc
commit
be86014540
10 changed files with 47 additions and 41 deletions
|
|
@ -1,8 +1,6 @@
|
|||
app.models.Person = Backbone.Model.extend({
|
||||
urlRoot: '/people',
|
||||
|
||||
url: function() {
|
||||
return this.urlRoot + '/' + this.get('guid');
|
||||
return Routes.person_path(this.get('guid'));
|
||||
},
|
||||
|
||||
initialize: function() {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
<div id="profile_photo" class="profile_photo">
|
||||
{{#linkToPerson this}}
|
||||
{{{personImage this "l"}}}
|
||||
{{{personImage this "large"}}}
|
||||
{{/linkToPerson}}
|
||||
</div>
|
||||
|
||||
|
|
@ -74,7 +74,7 @@
|
|||
</h4>
|
||||
<div class="section photo_pictures">
|
||||
{{#each photos.items}}
|
||||
<img src="{{sizes.s}}" alt="{{guid}}" />
|
||||
<img src="{{sizes.small}}" alt="{{guid}}" />
|
||||
{{/each}}
|
||||
</div>
|
||||
<p class="see_all">
|
||||
|
|
@ -90,7 +90,7 @@
|
|||
</h4>
|
||||
<div class="section contact_pictures">
|
||||
{{#each contacts.items}}
|
||||
{{#linkToPerson this}}{{{personImage this "s"}}}{{/linkToPerson}}
|
||||
{{#linkToPerson this}}{{{personImage this "small"}}}{{/linkToPerson}}
|
||||
{{/each}}
|
||||
</div>
|
||||
<p class="see_all">
|
||||
|
|
|
|||
|
|
@ -65,6 +65,6 @@ LISTITEM
|
|||
return {}
|
||||
end
|
||||
|
||||
{ aspects: aspects, aspect: aspect, aspect_ids: aspect_ids }
|
||||
{ selected_aspects: aspects, aspect: aspect, aspect_ids: aspect_ids }
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ module User::Querying
|
|||
|
||||
def block_for(person)
|
||||
return nil unless person
|
||||
self.blocks.where(person_id: person.id).limit(1).first
|
||||
self.blocks.where(person_id: person.id).first
|
||||
end
|
||||
|
||||
def aspects_with_shareable(base_class_name_or_class, shareable_id)
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ class AvatarPresenter < BasePresenter
|
|||
DEFAULT_IMAGE = ActionController::Base.helpers.image_path('user/default.png')
|
||||
|
||||
def base_hash
|
||||
{ s: image_url_small || DEFAULT_IMAGE,
|
||||
m: image_url_medium || DEFAULT_IMAGE,
|
||||
l: image_url || DEFAULT_IMAGE
|
||||
{ small: image_url_small || DEFAULT_IMAGE,
|
||||
medium: image_url_medium || DEFAULT_IMAGE,
|
||||
large: image_url || DEFAULT_IMAGE
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -46,18 +46,14 @@ class PersonPresenter < BasePresenter
|
|||
|
||||
def relationship
|
||||
return false unless current_user
|
||||
return :blocked if is_blocked?
|
||||
|
||||
contact = current_user_person_contact
|
||||
return :not_sharing unless contact
|
||||
|
||||
is_mutual = contact ? contact.mutual? : false
|
||||
is_sharing = contact ? contact.sharing? : false
|
||||
is_receiving = contact ? contact.receiving? : false
|
||||
|
||||
if is_blocked? then :blocked
|
||||
elsif is_mutual then :mutual
|
||||
elsif is_sharing then :sharing
|
||||
elsif is_receiving then :receiving
|
||||
else :not_sharing
|
||||
end
|
||||
[:mutual, :sharing, :receiving].find do |status|
|
||||
contact.public_send("#{status}?")
|
||||
end || :not_sharing
|
||||
end
|
||||
|
||||
def person_is_following_current_user
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@ class PhotoPresenter < BasePresenter
|
|||
{ id: id,
|
||||
guid: guid,
|
||||
dimensions: {
|
||||
h: height,
|
||||
w: width
|
||||
height: height,
|
||||
width: width
|
||||
},
|
||||
sizes: {
|
||||
s: url(:thumb_small),
|
||||
m: url(:thumb_medium),
|
||||
l: url(:scaled_full)
|
||||
small: url(:thumb_small),
|
||||
medium: url(:thumb_medium),
|
||||
large: url(:scaled_full)
|
||||
}
|
||||
}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -13,18 +13,16 @@
|
|||
|
||||
.span-6
|
||||
#profile
|
||||
-# = render :partial => 'people/profile_sidebar', :locals => {:person => @person, :contact => @contact }
|
||||
-# here be JS
|
||||
|
||||
.span-18.last
|
||||
.profile_header
|
||||
-# = render 'people/sub_header', :person => @person, :contact => @contact
|
||||
-# more JS
|
||||
|
||||
.stream_container
|
||||
|
||||
#main_stream.stream
|
||||
-# - if @block.present?
|
||||
.dull
|
||||
= t('.ignoring', :name => @person.first_name)
|
||||
-# JS
|
||||
|
||||
#paginate
|
||||
|
||||
|
|
|
|||
|
|
@ -307,6 +307,20 @@ describe User::Querying, :type => :model do
|
|||
end
|
||||
end
|
||||
|
||||
describe "#block_for" do
|
||||
let(:person) { FactoryGirl.create :person }
|
||||
|
||||
before do
|
||||
eve.blocks.create({person: person})
|
||||
end
|
||||
|
||||
it 'returns the block' do
|
||||
block = eve.block_for(person)
|
||||
expect(block).to be_present
|
||||
expect(block.person.id).to be person.id
|
||||
end
|
||||
end
|
||||
|
||||
describe '#posts_from' do
|
||||
before do
|
||||
@user3 = FactoryGirl.create(:user)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ describe PersonPresenter do
|
|||
describe "#as_json" do
|
||||
context "with no current_user" do
|
||||
it "returns the user's public information if a user is not logged in" do
|
||||
expect(PersonPresenter.new(person, nil).as_json).to include(person.as_api_response(:backbone).reject { |k,v| k == :avatar })
|
||||
expect(PersonPresenter.new(person, nil).as_json).to include(person.as_api_response(:backbone).except(:avatar))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -32,10 +32,10 @@ describe PersonPresenter do
|
|||
|
||||
describe "#full_hash" do
|
||||
let(:current_user) { FactoryGirl.create(:user) }
|
||||
let(:m_contact) { double(:id => 1, :mutual? => true, :sharing? => true, :receiving? => true ) }
|
||||
let(:r_contact) { double(:id => 1, :mutual? => false, :sharing? => false, :receiving? => true) }
|
||||
let(:s_contact) { double(:id => 1, :mutual? => false, :sharing? => true, :receiving? => false) }
|
||||
let(:n_contact) { double(:id => 1, :mutual? => false, :sharing? => false, :receiving? => false) }
|
||||
let(:mutual_contact) { double(:id => 1, :mutual? => true, :sharing? => true, :receiving? => true ) }
|
||||
let(:receiving_contact) { double(:id => 1, :mutual? => false, :sharing? => false, :receiving? => true) }
|
||||
let(:sharing_contact) { double(:id => 1, :mutual? => false, :sharing? => true, :receiving? => false) }
|
||||
let(:non_contact) { double(:id => 1, :mutual? => false, :sharing? => false, :receiving? => false) }
|
||||
|
||||
before do
|
||||
@p = PersonPresenter.new(person, current_user)
|
||||
|
|
@ -44,27 +44,27 @@ describe PersonPresenter do
|
|||
context "relationship" do
|
||||
it "is blocked?" do
|
||||
allow(current_user).to receive(:block_for) { double(id: 1) }
|
||||
allow(current_user).to receive(:contact_for) { n_contact }
|
||||
allow(current_user).to receive(:contact_for) { non_contact }
|
||||
expect(@p.full_hash[:relationship]).to be(:blocked)
|
||||
end
|
||||
|
||||
it "is mutual?" do
|
||||
allow(current_user).to receive(:contact_for) { m_contact }
|
||||
allow(current_user).to receive(:contact_for) { mutual_contact }
|
||||
expect(@p.full_hash[:relationship]).to be(:mutual)
|
||||
end
|
||||
|
||||
it "is receiving?" do
|
||||
allow(current_user).to receive(:contact_for) { r_contact }
|
||||
allow(current_user).to receive(:contact_for) { receiving_contact }
|
||||
expect(@p.full_hash[:relationship]).to be(:receiving)
|
||||
end
|
||||
|
||||
it "is sharing?" do
|
||||
allow(current_user).to receive(:contact_for) { s_contact }
|
||||
allow(current_user).to receive(:contact_for) { sharing_contact }
|
||||
expect(@p.full_hash[:relationship]).to be(:sharing)
|
||||
end
|
||||
|
||||
it "isn't sharing?" do
|
||||
allow(current_user).to receive(:contact_for) { n_contact }
|
||||
allow(current_user).to receive(:contact_for) { non_contact }
|
||||
expect(@p.full_hash[:relationship]).to be(:not_sharing)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue