random updates and fixes related

This commit is contained in:
Kyle Drake 2021-04-20 13:27:50 -05:00
parent 4b69ab232f
commit 769eabb323
7 changed files with 165 additions and 162 deletions

13
Gemfile
View file

@ -1,6 +1,6 @@
source 'https://rubygems.org' source 'https://rubygems.org'
gem 'sinatra', '2.0.5' gem 'sinatra', '2.0.8'
gem 'redis' gem 'redis'
gem 'redis-namespace' gem 'redis-namespace'
gem 'sequel' gem 'sequel'
@ -13,7 +13,7 @@ gem 'sidekiq', '~> 4.2.10'
gem 'mail' gem 'mail'
gem 'tilt' gem 'tilt'
gem 'erubis' gem 'erubis'
gem 'stripe', '~> 5.17.0' #, source: 'https://code.stripe.com/' gem 'stripe'
gem 'terrapin' gem 'terrapin'
gem 'zipruby' gem 'zipruby'
gem 'sass', require: nil gem 'sass', require: nil
@ -26,7 +26,7 @@ gem 'addressable', require: 'addressable/uri'
gem 'paypal-recurring', require: 'paypal/recurring' gem 'paypal-recurring', require: 'paypal/recurring'
gem 'geoip' gem 'geoip'
gem 'io-extra', require: 'io/extra' gem 'io-extra', require: 'io/extra'
gem 'rye' #gem 'rye'
gem 'base32' gem 'base32'
gem 'coveralls', require: false gem 'coveralls', require: false
gem 'sanitize' gem 'sanitize'
@ -53,6 +53,7 @@ gem 'activesupport'
gem 'facter', require: nil gem 'facter', require: nil
gem 'maxmind-db' gem 'maxmind-db'
gem 'json', '>= 2.3.0' gem 'json', '>= 2.3.0'
gem 'rss'
group :development, :test do group :development, :test do
gem 'pry' gem 'pry'
@ -67,15 +68,15 @@ end
group :test do group :test do
gem 'faker' gem 'faker'
gem 'fabrication', require: 'fabrication' gem 'fabrication', require: 'fabrication'
gem 'minitest' gem 'minitest', '= 5.11.3'
gem 'minitest-reporters', require: 'minitest/reporters' gem 'minitest-reporters', require: 'minitest/reporters'
gem 'rack-test', require: 'rack/test' gem 'rack-test', require: 'rack/test'
gem 'mocha', require: nil gem 'mocha', require: nil
gem 'rake', '>= 12.3.3', require: nil gem 'rake', '>= 12.3.3', require: nil
gem 'capybara', require: nil #, '2.10.1', require: nil gem 'capybara', require: nil #, '2.10.1', require: nil
gem 'rack_session_access', require: nil gem 'rack_session_access', require: nil
gem 'webmock', '3.5.1', require: nil gem 'webmock', require: nil
gem 'stripe-ruby-mock', '2.5.8', require: 'stripe_mock' gem 'stripe-ruby-mock', require: 'stripe_mock'
gem 'timecop' gem 'timecop'
gem 'mock_redis' gem 'mock_redis'
gem 'simplecov', require: nil gem 'simplecov', require: nil

View file

@ -13,112 +13,114 @@ GIT
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
acme-client (2.0.6) CFPropertyList (2.3.6)
acme-client (2.0.7)
faraday (>= 0.17, < 2.0.0) faraday (>= 0.17, < 2.0.0)
activesupport (6.0.3.1) activesupport (6.1.3)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2) i18n (>= 1.6, < 2)
minitest (~> 5.1) minitest (>= 5.1)
tzinfo (~> 1.1) tzinfo (~> 2.0)
zeitwerk (~> 2.2, >= 2.2.2) zeitwerk (~> 2.3)
addressable (2.7.0) addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0) public_suffix (>= 2.0.2, < 5.0)
annoy (0.5.6)
highline (>= 1.5.0)
ansi (1.5.0) ansi (1.5.0)
apparition (0.5.0) apparition (0.6.0)
capybara (~> 3.13, < 4) capybara (~> 3.13, < 4)
websocket-driver (>= 0.6.5) websocket-driver (>= 0.6.5)
base32 (0.3.2) base32 (0.3.4)
bcrypt (3.1.13) bcrypt (3.1.16)
builder (3.2.3) builder (3.2.4)
byebug (11.0.1) byebug (11.1.3)
capybara (3.32.2) capybara (3.35.3)
addressable addressable
mini_mime (>= 0.1.3) mini_mime (>= 0.1.3)
nokogiri (~> 1.8) nokogiri (~> 1.8)
rack (>= 1.6.0) rack (>= 1.6.0)
rack-test (>= 0.6.3) rack-test (>= 0.6.3)
regexp_parser (~> 1.5) regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2) xpath (~> 3.2)
certified (1.0.0) certified (1.0.0)
climate_control (0.2.0) climate_control (0.2.0)
coderay (1.1.2) coderay (1.1.3)
concurrent-ruby (1.1.6) concurrent-ruby (1.1.8)
connection_pool (2.2.2) connection_pool (2.2.3)
coveralls (0.8.23) coveralls (0.7.1)
json (>= 1.8, < 3) multi_json (~> 1.3)
simplecov (~> 0.16.1) rest-client
term-ansicolor (~> 1.3) simplecov (>= 0.7)
thor (>= 0.19.4, < 2.0) term-ansicolor
tins (~> 1.6) thor
crack (0.4.3) crack (0.4.5)
safe_yaml (~> 1.0.0) rexml
crass (1.0.6) crass (1.0.6)
dante (0.2.0) dante (0.2.0)
docile (1.3.2) docile (1.3.5)
domain_name (0.5.20190701) domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0) unf (>= 0.0.5, < 1.0.0)
drydock (0.6.9)
erubis (2.7.0) erubis (2.7.0)
exifr (1.3.6) exifr (1.3.9)
fabrication (2.20.2) fabrication (2.21.1)
facter (2.5.6) facter (2.5.7-universal-darwin)
faker (2.4.0) CFPropertyList (~> 2.2)
i18n (~> 1.6.0) faker (2.16.0)
faraday (0.17.3) i18n (>= 1.6, < 2)
faraday (1.3.0)
faraday-net_http (~> 1.0)
multipart-post (>= 1.2, < 3) multipart-post (>= 1.2, < 3)
faraday_middleware (0.14.0) ruby2_keywords
faraday (>= 0.7.4, < 1.0) faraday-net_http (1.0.1)
faraday_middleware (1.0.0)
faraday (~> 1.0)
feedjira (2.1.4) feedjira (2.1.4)
faraday (>= 0.9) faraday (>= 0.9)
faraday_middleware (>= 0.9) faraday_middleware (>= 0.9)
loofah (>= 2.0) loofah (>= 2.0)
sax-machine (>= 1.0) sax-machine (>= 1.0)
ffi (1.11.1) ffi (1.14.2)
ffi-compiler (1.0.1)
ffi (>= 1.0.0)
rake
filesize (0.2.0) filesize (0.2.0)
fspath (3.1.2) fspath (3.1.2)
gandi (3.3.28) gandi (3.3.28)
hashie hashie
xmlrpc xmlrpc
geoip (1.6.4) geoip (1.6.4)
hashdiff (1.0.0) hashdiff (1.0.1)
hashie (3.6.0) hashie (4.1.0)
highline (2.0.2)
hiredis (0.6.3) hiredis (0.6.3)
hoe (3.22.1) hoe (3.22.3)
rake (>= 0.8, < 15.0) rake (>= 0.8, < 15.0)
htmlentities (4.3.4) htmlentities (4.3.4)
http (4.1.1) http (4.4.1)
addressable (~> 2.3) addressable (~> 2.3)
http-cookie (~> 1.0) http-cookie (~> 1.0)
http-form_data (~> 2.0) http-form_data (~> 2.2)
http_parser.rb (~> 0.6.0) http-parser (~> 1.2.0)
http-accept (1.7.0) http-accept (1.7.0)
http-cookie (1.0.3) http-cookie (1.0.3)
domain_name (~> 0.5) domain_name (~> 0.5)
http-form_data (2.1.1) http-form_data (2.3.0)
http_parser.rb (0.6.0) http-parser (1.2.3)
i18n (1.6.0) ffi-compiler (>= 1.0, < 2.0)
i18n (1.8.9)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
image_optim (0.26.5) image_optim (0.28.0)
exifr (~> 1.2, >= 1.2.2) exifr (~> 1.2, >= 1.2.2)
fspath (~> 3.0) fspath (~> 3.0)
image_size (>= 1.5, < 3) image_size (>= 1.5, < 3)
in_threads (~> 1.3) in_threads (~> 1.3)
progress (~> 3.0, >= 3.0.1) progress (~> 3.0, >= 3.0.1)
image_optim_pack (0.6.0) image_optim_pack (0.7.0.20210206)
fspath (>= 2.1, < 4) fspath (>= 2.1, < 4)
image_optim (~> 0.19) image_optim (~> 0.19)
image_optim_pack (0.6.0-x86_64-linux) image_size (2.1.0)
fspath (>= 2.1, < 4) in_threads (1.5.4)
image_optim (~> 0.19) io-extra (1.4.0)
image_size (2.0.2)
in_threads (1.5.3)
io-extra (1.3.0)
ipaddress (0.8.3) ipaddress (0.8.3)
json (2.3.1) json (2.5.1)
loofah (2.5.0) loofah (2.9.0)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
m (1.5.1) m (1.5.1)
@ -128,88 +130,81 @@ GEM
ffi (>= 0.6.3) ffi (>= 0.6.3)
mail (2.7.1) mail (2.7.1)
mini_mime (>= 0.1.1) mini_mime (>= 0.1.1)
maxmind-db (1.0.0) maxmind-db (1.1.1)
metaclass (0.0.4) method_source (1.0.0)
method_source (0.9.2) mime-types (3.3.1)
mime-types (3.3)
mime-types-data (~> 3.2015) mime-types-data (~> 3.2015)
mime-types-data (3.2019.0904) mime-types-data (3.2021.0225)
mini_mime (1.0.2) mini_mime (1.0.2)
mini_portile2 (2.4.0)
minitest (5.11.3) minitest (5.11.3)
minitest-reporters (1.3.8) minitest-reporters (1.4.3)
ansi ansi
builder builder
minitest (>= 5.0) minitest (>= 5.0)
ruby-progressbar ruby-progressbar
mocha (1.9.0) mocha (1.12.0)
metaclass (~> 0.0.1) mock_redis (0.27.3)
mock_redis (0.21.0) ruby2_keywords
monetize (1.9.2) monetize (1.11.0)
money (~> 6.12) money (~> 6.12)
money (6.13.4) money (6.14.1)
i18n (>= 0.6.4, <= 2) i18n (>= 0.6.4, <= 2)
msgpack (1.3.1) msgpack (1.4.2)
multi_json (1.13.1) multi_json (1.15.0)
multipart-post (2.1.1) multipart-post (2.1.1)
mustermann (1.0.3) mustermann (1.1.1)
net-scp (2.0.0) ruby2_keywords (~> 0.0.1)
net-ssh (>= 2.6.5, < 6.0.0)
net-ssh (5.2.0)
netrc (0.11.0) netrc (0.11.0)
nio4r (2.5.2) nio4r (2.5.7)
nokogiri (1.10.9) nokogiri (1.11.1-arm64-darwin)
mini_portile2 (~> 2.4.0) racc (~> 1.4)
nokogumbo (2.0.2) nokogumbo (2.0.4)
nokogiri (~> 1.8, >= 1.8.4) nokogiri (~> 1.8, >= 1.8.4)
ox (2.11.0) ox (2.14.1)
paypal-recurring (1.1.0) paypal-recurring (1.1.0)
pg (1.1.4) pg (1.2.3)
progress (3.5.2) progress (3.5.2)
pry (0.12.2) pry (0.14.0)
coderay (~> 1.1.0) coderay (~> 1.1)
method_source (~> 0.9.0) method_source (~> 1.0)
pry-byebug (3.7.0) pry-byebug (3.8.0)
byebug (~> 11.0) byebug (~> 11.0)
pry (~> 0.10) pry (~> 0.10)
public_suffix (4.0.5) public_suffix (4.0.6)
puma (4.3.5) puma (5.2.2)
nio4r (~> 2.0) nio4r (~> 2.0)
racc (1.5.2)
rack (2.2.3) rack (2.2.3)
rack-cache (1.9.0) rack-cache (1.12.1)
rack (>= 0.4) rack (>= 0.4)
rack-protection (2.0.5) rack-protection (2.0.8)
rack rack
rack-test (1.1.0) rack-test (1.1.0)
rack (>= 1.0, < 3) rack (>= 1.0, < 3)
rack_session_access (0.2.0) rack_session_access (0.2.0)
builder (>= 2.0.0) builder (>= 2.0.0)
rack (>= 1.0.0) rack (>= 1.0.0)
rake (13.0.1) rake (13.0.3)
rb-fsevent (0.10.3) rb-fsevent (0.10.4)
rb-inotify (0.10.0) rb-inotify (0.10.1)
ffi (~> 1.0) ffi (~> 1.0)
redis (3.3.5) redis (3.3.5)
redis-namespace (1.6.0) redis-namespace (1.8.1)
redis (>= 3.0.4) redis (>= 3.0.4)
regexp_parser (1.7.1) regexp_parser (2.1.1)
rest-client (2.1.0) rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0) http-accept (>= 1.7.0, < 2.0)
http-cookie (>= 1.0.2, < 2.0) http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0) mime-types (>= 1.16, < 4.0)
netrc (~> 0.8) netrc (~> 0.8)
rexml (3.2.4)
rinku (2.0.6) rinku (2.0.6)
rmagick (4.1.2) rmagick (4.2.2)
ruby-progressbar (1.10.1) rss (0.2.9)
rye (0.9.13) rexml
annoy ruby-progressbar (1.11.0)
docile (>= 1.0.1) ruby2_keywords (0.0.4)
highline (>= 1.5.1) sanitize (5.2.3)
net-scp (>= 1.0.2)
net-ssh (>= 2.0.13)
sysinfo (>= 0.8.1)
safe_yaml (1.0.5)
sanitize (5.2.1)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.8.0) nokogiri (>= 1.8.0)
nokogumbo (~> 2.0) nokogumbo (~> 2.0)
@ -219,9 +214,9 @@ GEM
rb-fsevent (~> 0.9, >= 0.9.4) rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7) rb-inotify (~> 0.9, >= 0.9.7)
sax-machine (1.3.2) sax-machine (1.3.2)
sequel (5.24.0) sequel (5.42.0)
sequel_pg (1.12.2) sequel_pg (1.14.0)
pg (>= 0.18.0) pg (>= 0.18.0, != 1.2.0)
sequel (>= 4.38.0) sequel (>= 4.38.0)
shotgun (0.9.2) shotgun (0.9.2)
rack (>= 1.0) rack (>= 1.0)
@ -230,64 +225,63 @@ GEM
connection_pool (~> 2.2, >= 2.2.0) connection_pool (~> 2.2, >= 2.2.0)
rack-protection (>= 1.5.0) rack-protection (>= 1.5.0)
redis (~> 3.2, >= 3.2.1) redis (~> 3.2, >= 3.2.1)
simplecov (0.16.1) simplecov (0.21.2)
docile (~> 1.1) docile (~> 1.1)
json (>= 1.8, < 3) simplecov-html (~> 0.11)
simplecov-html (~> 0.10.0) simplecov_json_formatter (~> 0.1)
simplecov-html (0.10.2) simplecov-html (0.12.3)
simpleidn (0.1.1) simplecov_json_formatter (0.1.2)
simpleidn (0.2.1)
unf (~> 0.1.4) unf (~> 0.1.4)
sinatra (2.0.5) sinatra (2.0.8)
mustermann (~> 1.0) mustermann (~> 1.0)
rack (~> 2.0) rack (~> 2.0)
rack-protection (= 2.0.5) rack-protection (= 2.0.8)
tilt (~> 2.0) tilt (~> 2.0)
sinatra-flash (0.3.0) sinatra-flash (0.3.0)
sinatra (>= 1.0.0) sinatra (>= 1.0.0)
sinatra-xsendfile (0.4.2) sinatra-xsendfile (0.4.2)
sinatra (>= 0.9.1) sinatra (>= 0.9.1)
storable (0.8.9) stripe (5.30.0)
stripe (5.17.0) stripe-ruby-mock (3.0.1)
stripe-ruby-mock (2.5.8)
dante (>= 0.2.0) dante (>= 0.2.0)
multi_json (~> 1.0) multi_json (~> 1.0)
stripe (>= 2.0.3) stripe (> 5, < 6)
sysinfo (0.8.1) sync (0.5.0)
drydock
storable
term-ansicolor (1.7.1) term-ansicolor (1.7.1)
tins (~> 1.0) tins (~> 1.0)
terrapin (0.6.0) terrapin (0.6.0)
climate_control (>= 0.0.3, < 1.0) climate_control (>= 0.0.3, < 1.0)
thor (0.20.3) thor (1.1.0)
thread (0.2.2) thread (0.2.2)
thread_safe (0.3.6) tilt (2.0.10)
tilt (2.0.9) timecop (0.9.4)
timecop (0.9.1) tins (1.28.0)
tins (1.21.1) sync
tzinfo (1.2.7) tzinfo (2.0.4)
thread_safe (~> 0.1) concurrent-ruby (~> 1.0)
unf (0.1.4) unf (0.1.4)
unf_ext unf_ext
unf_ext (0.0.7.6) unf_ext (0.0.7.7)
uuidtools (2.1.5) uuidtools (2.1.5)
webmock (3.5.1) webmock (3.12.1)
addressable (>= 2.3.6) addressable (>= 2.3.6)
crack (>= 0.3.2) crack (>= 0.3.2)
hashdiff hashdiff (>= 0.4.0, < 2.0.0)
websocket-driver (0.7.2) webrick (1.7.0)
websocket-driver (0.7.3)
websocket-extensions (>= 0.1.0) websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5) websocket-extensions (0.1.5)
will_paginate (3.1.8) will_paginate (3.3.0)
xmlrpc (0.3.0) xmlrpc (0.3.2)
webrick
xpath (3.2.0) xpath (3.2.0)
nokogiri (~> 1.8) nokogiri (~> 1.8)
zeitwerk (2.3.0) zeitwerk (2.4.2)
zipruby (0.3.6) zipruby (0.3.6)
PLATFORMS PLATFORMS
ruby arm64-darwin-20
x86_64-linux
DEPENDENCIES DEPENDENCIES
acme-client (~> 2.0.0) acme-client (~> 2.0.0)
@ -321,7 +315,7 @@ DEPENDENCIES
magic magic
mail mail
maxmind-db maxmind-db
minitest minitest (= 5.11.3)
minitest-reporters minitest-reporters
mocha mocha
mock_redis mock_redis
@ -341,7 +335,7 @@ DEPENDENCIES
rest-client rest-client
rinku rinku
rmagick rmagick
rye rss
sanitize sanitize
sass sass
sequel sequel
@ -350,19 +344,19 @@ DEPENDENCIES
sidekiq (~> 4.2.10) sidekiq (~> 4.2.10)
simplecov simplecov
simpleidn simpleidn
sinatra (= 2.0.5) sinatra (= 2.0.8)
sinatra-flash sinatra-flash
sinatra-xsendfile sinatra-xsendfile
stripe (~> 5.17.0) stripe
stripe-ruby-mock (= 2.5.8) stripe-ruby-mock
terrapin terrapin
thread thread
tilt tilt
timecop timecop
webmock (= 3.5.1) webmock
will_paginate will_paginate
xmlrpc xmlrpc
zipruby zipruby
BUNDLED WITH BUNDLED WITH
2.1.4 2.2.3

View file

@ -89,7 +89,7 @@ def browse_sites_dataset
when 'tipping_enabled' when 'tipping_enabled'
ds = ds.where tipping_enabled: true ds = ds.where tipping_enabled: true
ds = ds.where("(tipping_paypal is not null and tipping_paypal != '') or (tipping_bitcoin is not null and tipping_bitcoin != '')") ds = ds.where("(tipping_paypal is not null and tipping_paypal != '') or (tipping_bitcoin is not null and tipping_bitcoin != '')")
ds = ds.where{views > 10_000} ds = ds.where{views > Tag::SITE_VIEWS_MINIMUM_FOR_BROWSE}
ds = ds.group :sites__id ds = ds.group :sites__id
ds = ds.order :follow_count.desc, :views.desc, :updated_at.desc ds = ds.order :follow_count.desc, :views.desc, :updated_at.desc
when 'blocks' when 'blocks'
@ -100,7 +100,7 @@ def browse_sites_dataset
ds = ds.order :total.desc ds = ds.order :total.desc
else else
params[:sort_by] = 'followers' params[:sort_by] = 'followers'
ds = ds.where{views > 10_000} ds = ds.where{views > Tag::SITE_VIEWS_MINIMUM_FOR_BROWSE}
ds = ds.order :follow_count.desc, :views.desc, :updated_at.desc ds = ds.order :follow_count.desc, :views.desc, :updated_at.desc
end end

View file

@ -720,7 +720,7 @@ class Site < Sequel::Model
begin begin
output = line.run path: uploaded_file[:tempfile].path output = line.run path: uploaded_file[:tempfile].path
rescue Terrapin::ExitStatusError => e rescue Terrapin::ExitStatusError => e
puts "WARNING: CLAMAV FAILED #{uploaded_file[:tempfile].path} #{e.message}" puts "WARNING: CLAMAV FAILED #{uploaded_file[:tempfile].path} #{e.message}" unless ENV['RACK_ENV'] == 'test'
return true return true
end end
@ -763,7 +763,7 @@ class Site < Sequel::Model
purge_cache path purge_cache path
end end
Rye::Cmd.add_command :ipfs #Rye::Cmd.add_command :ipfs
def add_to_ipfs def add_to_ipfs
# Not ideal. An SoA version is in progress. # Not ideal. An SoA version is in progress.

View file

@ -1,6 +1,7 @@
class Tag < Sequel::Model class Tag < Sequel::Model
NAME_LENGTH_MAX = 25 NAME_LENGTH_MAX = 25
NAME_WORDS_MAX = 1 NAME_WORDS_MAX = 1
SITE_VIEWS_MINIMUM_FOR_BROWSE = 10_000
many_to_many :sites many_to_many :sites
def before_create def before_create
@ -24,7 +25,7 @@ class Tag < Sequel::Model
def self.popular_names(limit=10) def self.popular_names(limit=10)
cache_key = "tag_popular_names_#{limit}".to_sym cache_key = "tag_popular_names_#{limit}".to_sym
cache = $redis_cache[cache_key] cache = $redis_cache.get cache_key
if cache.nil? if cache.nil?
res = DB["select tags.name,count(*) as c from sites_tags inner join tags on tags.id=sites_tags.tag_id where tags.name != '' and tags.is_nsfw='f' group by tags.name having count(*) > 1 order by c desc LIMIT ?", limit].all res = DB["select tags.name,count(*) as c from sites_tags inner join tags on tags.id=sites_tags.tag_id where tags.name != '' and tags.is_nsfw='f' group by tags.name having count(*) > 1 order by c desc LIMIT ?", limit].all
$redis_cache.set cache_key, res.to_msgpack $redis_cache.set cache_key, res.to_msgpack

View file

@ -73,13 +73,13 @@ describe '/password_reset' do
visit "/password_reset_confirm?#{Rack::Utils.build_query username: @site.username, token: @site.reload.password_reset_token}" visit "/password_reset_confirm?#{Rack::Utils.build_query username: @site.username, token: @site.reload.password_reset_token}"
page.current_url.must_match /.+\/settings$/ page.current_url.must_match /.+\/settings#password/
fill_in 'new_password', with: 'n3wp4s$' fill_in 'new_password', with: 'n3wp4s$'
fill_in 'new_password_confirm', with: 'n3wp4s$' fill_in 'new_password_confirm', with: 'n3wp4s$'
click_button 'Change Password' click_button 'Change Password'
page.current_url.must_match /.+\/settings$/ page.current_url.must_match /.+\/settings#password/
page.must_have_content 'Successfully changed password' page.must_have_content 'Successfully changed password'
Site.valid_login?(@site.username, 'n3wp4s$').must_equal true Site.valid_login?(@site.username, 'n3wp4s$').must_equal true
page.get_rack_session['id'].must_equal @site.id page.get_rack_session['id'].must_equal @site.id

View file

@ -63,11 +63,18 @@ describe 'site page' do
page.must_have_content /#{site.username}/ page.must_have_content /#{site.username}/
end end
=begin it 'does not allow blocked site to follow site that is blocking it' do
end
it 'allows site blocking' do it 'allows site blocking' do
Capybara.default_driver = :poltergeist #Capybara.default_driver = :poltergeist
tag = SecureRandom.hex 10 tag = SecureRandom.hex 10
blocked_site = Fabricate :site, new_tags_string: tag, created_at: 2.weeks.ago, site_changed: true blocked_site = Fabricate :site,
new_tags_string: tag,
views: Tag::SITE_VIEWS_MINIMUM_FOR_BROWSE+1,
created_at: 5.weeks.ago,
site_changed: true
site = Fabricate :site site = Fabricate :site
page.set_rack_session id: site.id page.set_rack_session id: site.id
@ -89,7 +96,7 @@ describe 'site page' do
site.blockings.length.must_equal 1 site.blockings.length.must_equal 1
site.blockings.first.site_id.must_equal blocked_site.id site.blockings.first.site_id.must_equal blocked_site.id
end end
=end
it '404s if site is banned' do it '404s if site is banned' do
site = Fabricate :site site = Fabricate :site