mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +02:00
fixes for tests
This commit is contained in:
parent
88f419ce67
commit
498f29bfa2
3 changed files with 5 additions and 10 deletions
|
@ -1,8 +1,4 @@
|
|||
get '/?' do
|
||||
if params[:_ga_adgroupid]
|
||||
session[:ga_adgroupid] = params[:_ga_adgroupid]
|
||||
end
|
||||
|
||||
if current_site
|
||||
require_login
|
||||
|
||||
|
@ -32,7 +28,6 @@ get '/?' do
|
|||
halt erb :'home', locals: {site: current_site}
|
||||
end
|
||||
|
||||
|
||||
if SimpleCache.expired?(:index)
|
||||
@sites_count = Site.count.roundup(100)
|
||||
@total_hits_count = DB['SELECT SUM(hits) AS hits FROM SITES'].first[:hits] || 0
|
||||
|
@ -52,7 +47,7 @@ get '/?' do
|
|||
|
||||
@create_disabled = false
|
||||
|
||||
@index_rendered = SimpleCache.store :index, erb(:index, layout: :index_layout), 1.hour
|
||||
@index_rendered = SimpleCache.store :index, erb(:index, layout: :index_layout), (ENV['RACK_ENV'] == 'test' ? -1 : 1.hour)
|
||||
|
||||
return @index_rendered
|
||||
else
|
||||
|
|
|
@ -111,7 +111,7 @@ class Site < Sequel::Model
|
|||
COMMENTING_ALLOWED_UPDATED_COUNT = 2
|
||||
|
||||
SUGGESTIONS_LIMIT = 30
|
||||
SUGGESTIONS_VIEWS_MIN = 500
|
||||
SUGGESTIONS_VIEWS_MIN = 10000
|
||||
CHILD_SITES_MAX = 30
|
||||
|
||||
IP_CREATE_LIMIT = 1000
|
||||
|
|
|
@ -112,7 +112,7 @@ describe Site do
|
|||
describe 'suggestions' do
|
||||
it 'should return suggestions for tags' do
|
||||
site = Fabricate :site, new_tags_string: 'vegetables'
|
||||
Site::SUGGESTIONS_LIMIT.times { Fabricate :site, new_tags_string: 'vegetables' }
|
||||
Site::SUGGESTIONS_LIMIT.times { Fabricate :site, new_tags_string: 'vegetables', site_changed: true }
|
||||
|
||||
_(site.suggestions.length).must_equal Site::SUGGESTIONS_LIMIT
|
||||
|
||||
|
@ -122,10 +122,10 @@ describe Site do
|
|||
|
||||
site = Fabricate :site, new_tags_string: 'gardening'
|
||||
(Site::SUGGESTIONS_LIMIT-5).times {
|
||||
Fabricate :site, new_tags_string: 'gardening', views: Site::SUGGESTIONS_VIEWS_MIN
|
||||
Fabricate :site, new_tags_string: 'gardening', views: Site::SUGGESTIONS_VIEWS_MIN, site_changed: true
|
||||
}
|
||||
|
||||
_(site.suggestions.length).must_equal(Site::SUGGESTIONS_LIMIT - 5)
|
||||
_(site.suggestions.length).must_equal(Site::SUGGESTIONS_LIMIT)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue