Skip to content

Commit 6c91237

Browse files
committed
Removed the before(:all) that reindexed Teams and reseeded Plans whether it was needed or not
1 parent ab7c67e commit 6c91237

File tree

4 files changed

+14
-25
lines changed

4 files changed

+14
-25
lines changed

app/models/plan.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,6 @@ def enhanced_team_page_free
5353
Plan.where(interval: MONTHLY).where(amount: 0).first
5454
end
5555

56-
def seed_plans!(reset=false)
57-
Plan.destroy_all if reset
58-
Plan.create(amount: 0, interval: Plan::MONTHLY, name: "Basic") if enhanced_team_page_free.nil?
59-
Plan.create(amount: 9900, interval: Plan::MONTHLY, name: "Monthly") if enhanced_team_page_monthly.nil?
60-
Plan.create(amount: 19900, interval: nil, name: "Single") if enhanced_team_page_one_time.nil?
61-
Plan.create(amount: 19900, interval: Plan::MONTHLY, analytics: true, name: "Analytics") if enhanced_team_page_analytics.nil?
62-
end
63-
6456
end
6557

6658
def register_on_stripe

app/models/team.rb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -210,16 +210,6 @@ def with_completed_section(section)
210210
empty = Team.new.send(section).is_a?(Array) ? [] : nil
211211
Team.where(section.to_sym.ne => empty)
212212
end
213-
214-
def rebuild_index(name = nil)
215-
raise "Unable to rebuild search index in production because it is disabled by bonsai" if Rails.env.staging? || Rails.env.production?
216-
klass = self
217-
Tire.index name || self.index_name || self.class.name do
218-
delete
219-
create
220-
klass.all.in_groups_of(1000) { |batch| import batch }
221-
end
222-
end
223213
end
224214

225215
def relevancy

spec/models/team_spec.rb

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
end
3838

3939
it 'should clear the cache when a premium team is updated' do
40+
seed_plans!
4041
Rails.cache.write(Team::FEATURED_TEAMS_CACHE_KEY, 'test')
4142
team.team_members << admin = Fabricate(:user)
4243
team.build_account
@@ -54,10 +55,18 @@
5455

5556
it 'should be able to add team link' do
5657
team.update_attributes(
57-
featured_links: [{
58-
name: 'Google',
59-
url: 'http://www.google.com'
60-
}])
58+
featured_links: [{
59+
name: 'Google',
60+
url: 'http://www.google.com'
61+
}])
6162
team.featured_links.should have(1).link
6263
end
63-
end
64+
65+
def seed_plans!(reset=false)
66+
Plan.destroy_all if reset
67+
Plan.create(amount: 0, interval: Plan::MONTHLY, name: "Basic") if Plan.enhanced_team_page_free.nil?
68+
Plan.create(amount: 9900, interval: Plan::MONTHLY, name: "Monthly") if Plan.enhanced_team_page_monthly.nil?
69+
Plan.create(amount: 19900, interval: nil, name: "Single") if Plan.enhanced_team_page_one_time.nil?
70+
Plan.create(amount: 19900, interval: Plan::MONTHLY, analytics: true, name: "Analytics") if Plan.enhanced_team_page_analytics.nil?
71+
end
72+
end

spec/spec_helper.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
REDIS.SELECT(testdb = 1)
2929
REDIS.flushdb
3030

31-
Team.rebuild_index
32-
Plan.seed_plans!
3331
end
3432

3533
config.before(:suite) do

0 commit comments

Comments
 (0)