diff --git a/app/models/team.rb b/app/models/team.rb index fe8a3576..9033ab34 100644 --- a/app/models/team.rb +++ b/app/models/team.rb @@ -241,9 +241,7 @@ def public_json end def public_hash - neighbors = Team.find((higher_competitors(5) + lower_competitors(5)).flatten.uniq) summary.merge( - neighbors: neighbors.collect(&:summary), members: members.collect { |user| { name: user.display_name, username: user.username, diff --git a/spec/models/team_spec.rb b/spec/models/team_spec.rb index f236cda5..315917b7 100644 --- a/spec/models/team_spec.rb +++ b/spec/models/team_spec.rb @@ -5,7 +5,6 @@ let(:invitee) { Fabricate(:user) } it { is_expected.to have_one :account } - it { is_expected.to have_many :locations } it { is_expected.to have_many :links } it { is_expected.to have_many :members } @@ -28,6 +27,15 @@ end end + describe "#public_json" do + + it "returns valid JSON" do + json = team.public_json + expect{JSON.parse(json)}.to_not raise_error + end + + end + it 'adds the team id to the user when they are added to a team' do team.add_user(invitee) expect(invitee.reload.membership.team).to eq(team) @@ -91,10 +99,4 @@ def seed_plans!(reset = false) Plan.create(amount: 19_900, interval: Plan::MONTHLY, analytics: true, name: 'Analytics') if Plan.enhanced_team_page_analytics.nil? end - it { is_expected.to have_many :locations } - it { is_expected.to have_many :links } - it { is_expected.to have_many :members } - it { is_expected.to have_many :jobs } - it { is_expected.to have_many :followers } - end