21
1
Fork 0
mirror of https://github.com/Evolix/chexpire.git synced 2024-05-05 18:25:09 +02:00

Merge pull request #103 from Evolix/updates

Updates a few gems
This commit is contained in:
Jérémy Lecour 2019-03-02 18:30:03 +01:00 committed by GitHub
commit 8de758c9f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 187 additions and 189 deletions

View file

@ -59,7 +59,7 @@ group :development, :test do
gem 'pry-byebug' gem 'pry-byebug'
gem 'pry-rails' gem 'pry-rails'
gem "factory_bot_rails" gem "factory_bot_rails", '~> 5.0'
end end
group :development do group :development do

View file

@ -1,55 +1,55 @@
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actioncable (5.2.1) actioncable (5.2.2)
actionpack (= 5.2.1) actionpack (= 5.2.2)
nio4r (~> 2.0) nio4r (~> 2.0)
websocket-driver (>= 0.6.1) websocket-driver (>= 0.6.1)
actionmailer (5.2.1) actionmailer (5.2.2)
actionpack (= 5.2.1) actionpack (= 5.2.2)
actionview (= 5.2.1) actionview (= 5.2.2)
activejob (= 5.2.1) activejob (= 5.2.2)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
actionpack (5.2.1) actionpack (5.2.2)
actionview (= 5.2.1) actionview (= 5.2.2)
activesupport (= 5.2.1) activesupport (= 5.2.2)
rack (~> 2.0) rack (~> 2.0)
rack-test (>= 0.6.3) rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2) rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.2.1) actionview (5.2.2)
activesupport (= 5.2.1) activesupport (= 5.2.2)
builder (~> 3.1) builder (~> 3.1)
erubi (~> 1.4) erubi (~> 1.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3) rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.2.1) activejob (5.2.2)
activesupport (= 5.2.1) activesupport (= 5.2.2)
globalid (>= 0.3.6) globalid (>= 0.3.6)
activemodel (5.2.1) activemodel (5.2.2)
activesupport (= 5.2.1) activesupport (= 5.2.2)
activerecord (5.2.1) activerecord (5.2.2)
activemodel (= 5.2.1) activemodel (= 5.2.2)
activesupport (= 5.2.1) activesupport (= 5.2.2)
arel (>= 9.0) arel (>= 9.0)
activestorage (5.2.1) activestorage (5.2.2)
actionpack (= 5.2.1) actionpack (= 5.2.2)
activerecord (= 5.2.1) activerecord (= 5.2.2)
marcel (~> 0.3.1) marcel (~> 0.3.1)
activesupport (5.2.1) activesupport (5.2.2)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2) i18n (>= 0.7, < 2)
minitest (~> 5.1) minitest (~> 5.1)
tzinfo (~> 1.1) tzinfo (~> 1.1)
addressable (2.5.2) addressable (2.6.0)
public_suffix (>= 2.0.2, < 4.0) public_suffix (>= 2.0.2, < 4.0)
airbrussh (1.3.0) airbrussh (1.3.1)
sshkit (>= 1.6.1, != 1.7.0) sshkit (>= 1.6.1, != 1.7.0)
annotate (2.7.3) annotate (2.7.4)
activerecord (>= 3.2, < 6.0) activerecord (>= 3.2, < 6.0)
rake (>= 10.4, < 13.0) rake (>= 10.4, < 13.0)
archive-zip (0.11.0) archive-zip (0.12.0)
io-like (~> 0.3.0) io-like (~> 0.3.0)
arel (9.0.0) arel (9.0.0)
ast (2.4.0) ast (2.4.0)
@ -58,67 +58,67 @@ GEM
bindex (0.5.0) bindex (0.5.0)
binding_of_caller (0.8.0) binding_of_caller (0.8.0)
debug_inspector (>= 0.0.1) debug_inspector (>= 0.0.1)
bootsnap (1.3.0) bootsnap (1.4.1)
msgpack (~> 1.0) msgpack (~> 1.0)
builder (3.2.3) builder (3.2.3)
byebug (10.0.2) byebug (11.0.0)
capistrano (3.10.2) capistrano (3.11.0)
airbrussh (>= 1.0.0) airbrussh (>= 1.0.0)
i18n i18n
rake (>= 10.0.0) rake (>= 10.0.0)
sshkit (>= 1.9.0) sshkit (>= 1.9.0)
capistrano-bundler (1.3.0) capistrano-bundler (1.5.0)
capistrano (~> 3.1) capistrano (~> 3.1)
sshkit (~> 1.2)
capistrano-rails (1.4.0) capistrano-rails (1.4.0)
capistrano (~> 3.1) capistrano (~> 3.1)
capistrano-bundler (~> 1.1) capistrano-bundler (~> 1.1)
capistrano-rbenv (2.1.3) capistrano-rbenv (2.1.4)
capistrano (~> 3.1) capistrano (~> 3.1)
sshkit (~> 1.3) sshkit (~> 1.3)
capistrano3-puma (3.1.1) capistrano3-puma (3.1.1)
capistrano (~> 3.7) capistrano (~> 3.7)
capistrano-bundler capistrano-bundler
puma (~> 3.4) puma (~> 3.4)
capybara (3.1.0) capybara (3.14.0)
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)
xpath (~> 3.0) regexp_parser (~> 1.2)
xpath (~> 3.2)
childprocess (0.9.0) childprocess (0.9.0)
ffi (~> 1.0, >= 1.0.11) ffi (~> 1.0, >= 1.0.11)
chromedriver-helper (1.2.0) chromedriver-helper (2.1.0)
archive-zip (~> 0.10) archive-zip (~> 0.10)
nokogiri (~> 1.8) nokogiri (~> 1.8)
chronic (0.10.2) chronic (0.10.2)
coderay (1.1.2) coderay (1.1.2)
concurrent-ruby (1.0.5) concurrent-ruby (1.1.4)
crass (1.0.4) crass (1.0.4)
database_cleaner (1.7.0) database_cleaner (1.7.0)
debug_inspector (0.0.3) debug_inspector (0.0.3)
devise (4.4.3) devise (4.6.1)
bcrypt (~> 3.0) bcrypt (~> 3.0)
orm_adapter (~> 0.1) orm_adapter (~> 0.1)
railties (>= 4.1.0, < 6.0) railties (>= 4.1.0, < 6.0)
responders responders
warden (~> 1.2.3) warden (~> 1.2.3)
devise-i18n (1.6.2) devise-i18n (1.8.0)
devise (>= 4.4) devise (>= 4.6)
docile (1.3.1) docile (1.3.1)
erubi (1.7.1) erubi (1.8.0)
execjs (2.7.0) execjs (2.7.0)
factory_bot (4.10.0) factory_bot (5.0.2)
activesupport (>= 3.0.0)
factory_bot_rails (4.10.0)
factory_bot (~> 4.10.0)
railties (>= 3.0.0)
ffi (1.9.23)
formatador (0.2.5)
globalid (0.4.1)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
guard (2.14.2) factory_bot_rails (5.0.1)
factory_bot (~> 5.0.0)
railties (>= 4.2.0)
ffi (1.10.0)
formatador (0.2.5)
globalid (0.4.2)
activesupport (>= 4.2.0)
guard (2.15.0)
formatador (>= 0.2.4) formatador (>= 0.2.4)
listen (>= 2.7, < 4.0) listen (>= 2.7, < 4.0)
lumberjack (>= 1.0.12, < 2.0) lumberjack (>= 1.0.12, < 2.0)
@ -134,14 +134,14 @@ GEM
has_scope (0.7.2) has_scope (0.7.2)
actionpack (>= 4.1) actionpack (>= 4.1)
activesupport (>= 4.1) activesupport (>= 4.1)
hashie (3.5.7) hashie (3.6.0)
i18n (1.1.0) i18n (1.5.3)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
io-like (0.3.0) io-like (0.3.0)
jbuilder (2.7.0) jbuilder (2.8.0)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
multi_json (>= 1.2) multi_json (>= 1.2)
json (2.1.0) json (2.2.0)
kaminari (1.1.1) kaminari (1.1.1)
activesupport (>= 4.1.0) activesupport (>= 4.1.0)
kaminari-actionview (= 1.1.1) kaminari-actionview (= 1.1.1)
@ -156,7 +156,7 @@ GEM
kaminari-core (1.1.1) kaminari-core (1.1.1)
launchy (2.4.3) launchy (2.4.3)
addressable (~> 2.3) addressable (~> 2.3)
letter_opener (1.6.0) letter_opener (1.7.0)
launchy (~> 2.2) launchy (~> 2.2)
letter_opener_web (1.3.4) letter_opener_web (1.3.4)
actionmailer (>= 3.2) actionmailer (>= 3.2)
@ -170,97 +170,98 @@ GEM
logging (2.2.2) logging (2.2.2)
little-plugger (~> 1.1) little-plugger (~> 1.1)
multi_json (~> 1.10) multi_json (~> 1.10)
loofah (2.2.2) loofah (2.2.3)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
lumberjack (1.0.13) lumberjack (1.0.13)
mail (2.7.0) mail (2.7.1)
mini_mime (>= 0.1.1) mini_mime (>= 0.1.1)
marcel (0.3.2) marcel (0.3.3)
mimemagic (~> 0.3.2) mimemagic (~> 0.3.2)
method_source (0.9.0) method_source (0.9.2)
mimemagic (0.3.2) mimemagic (0.3.3)
mini_mime (1.0.0) mini_mime (1.0.1)
mini_portile2 (2.3.0) mini_portile2 (2.4.0)
minitest (5.11.3) minitest (5.11.3)
msgpack (1.2.4) msgpack (1.2.7)
multi_json (1.13.1) multi_json (1.13.1)
mysql2 (0.5.1) mysql2 (0.5.2)
naught (1.1.0) naught (1.1.0)
nenv (0.3.0) nenv (0.3.0)
net-scp (1.2.1) net-scp (1.2.1)
net-ssh (>= 2.6.5) net-ssh (>= 2.6.5)
net-ssh (4.2.0) net-ssh (5.1.0)
nio4r (2.3.1) nio4r (2.3.1)
nokogiri (1.8.4) nokogiri (1.10.1)
mini_portile2 (~> 2.3.0) mini_portile2 (~> 2.4.0)
notiffany (0.1.1) notiffany (0.1.1)
nenv (~> 0.1) nenv (~> 0.1)
shellany (~> 0.0) shellany (~> 0.0)
octicons (7.3.0) octicons (8.5.0)
nokogiri (>= 1.6.3.1) nokogiri (>= 1.6.3.1)
open4 (1.3.4) open4 (1.3.4)
orm_adapter (0.5.0) orm_adapter (0.5.0)
parallel (1.12.1) parallel (1.14.0)
parser (2.5.1.0) parser (2.6.0.0)
ast (~> 2.4.0) ast (~> 2.4.0)
powerpack (0.1.1) powerpack (0.1.2)
pry (0.11.3) pry (0.12.2)
coderay (~> 1.1.0) coderay (~> 1.1.0)
method_source (~> 0.9.0) method_source (~> 0.9.0)
pry-byebug (3.6.0) pry-byebug (3.7.0)
byebug (~> 10.0) byebug (~> 11.0)
pry (~> 0.10) pry (~> 0.10)
pry-rails (0.3.6) pry-rails (0.3.9)
pry (>= 0.10.4) pry (>= 0.10.4)
public_suffix (3.0.2) public_suffix (3.0.3)
puma (3.11.4) puma (3.12.0)
pundit (1.1.0) pundit (1.1.0)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
rack (2.0.5) rack (2.0.6)
rack-contrib (2.0.1) rack-contrib (2.1.0)
rack (~> 2.0) rack (~> 2.0)
rack-proxy (0.6.4) rack-proxy (0.6.5)
rack rack
rack-test (1.1.0) rack-test (1.1.0)
rack (>= 1.0, < 3) rack (>= 1.0, < 3)
rails (5.2.1) rails (5.2.2)
actioncable (= 5.2.1) actioncable (= 5.2.2)
actionmailer (= 5.2.1) actionmailer (= 5.2.2)
actionpack (= 5.2.1) actionpack (= 5.2.2)
actionview (= 5.2.1) actionview (= 5.2.2)
activejob (= 5.2.1) activejob (= 5.2.2)
activemodel (= 5.2.1) activemodel (= 5.2.2)
activerecord (= 5.2.1) activerecord (= 5.2.2)
activestorage (= 5.2.1) activestorage (= 5.2.2)
activesupport (= 5.2.1) activesupport (= 5.2.2)
bundler (>= 1.3.0) bundler (>= 1.3.0)
railties (= 5.2.1) railties (= 5.2.2)
sprockets-rails (>= 2.0.0) sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3) rails-dom-testing (2.0.3)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
nokogiri (>= 1.6) nokogiri (>= 1.6)
rails-html-sanitizer (1.0.4) rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2) loofah (~> 2.2, >= 2.2.2)
rails-i18n (5.1.1) rails-i18n (5.1.3)
i18n (>= 0.7, < 2) i18n (>= 0.7, < 2)
railties (>= 5.0, < 6) railties (>= 5.0, < 6)
railties (5.2.1) railties (5.2.2)
actionpack (= 5.2.1) actionpack (= 5.2.2)
activesupport (= 5.2.1) activesupport (= 5.2.2)
method_source method_source
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0) thor (>= 0.19.0, < 2.0)
rainbow (3.0.0) rainbow (3.0.0)
rake (12.3.1) rake (12.3.2)
rb-fsevent (0.10.3) rb-fsevent (0.10.3)
rb-inotify (0.9.10) rb-inotify (0.10.0)
ffi (>= 0.5.0, < 2) ffi (~> 1.0)
rbnacl (4.0.2) rbnacl (4.0.2)
ffi ffi
responders (2.4.0) regexp_parser (1.3.0)
actionpack (>= 4.2.0, < 5.3) responders (2.4.1)
railties (>= 4.2.0, < 5.3) actionpack (>= 4.2.0, < 6.0)
railties (>= 4.2.0, < 6.0)
rubocop (0.56.0) rubocop (0.56.0)
parallel (~> 1.10) parallel (~> 1.10)
parser (>= 2.5) parser (>= 2.5)
@ -268,10 +269,10 @@ GEM
rainbow (>= 2.2.2, < 4.0) rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1) unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.9.0) ruby-progressbar (1.10.0)
ruby_dep (1.5.0) ruby_dep (1.5.0)
rubyzip (1.2.1) rubyzip (1.2.2)
sass (3.5.6) sass (3.7.3)
sass-listen (~> 4.0.0) sass-listen (~> 4.0.0)
sass-listen (4.0.0) sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4) rb-fsevent (~> 0.9, >= 0.9.4)
@ -282,11 +283,11 @@ GEM
sprockets (>= 2.8, < 4.0) sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0) sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3) tilt (>= 1.1, < 3)
selenium-webdriver (3.12.0) selenium-webdriver (3.141.0)
childprocess (~> 0.5) childprocess (~> 0.5)
rubyzip (~> 1.2) rubyzip (~> 1.2, >= 1.2.2)
shellany (0.0.1) shellany (0.0.1)
simple_form (4.0.1) simple_form (4.1.0)
actionpack (>= 5.0) actionpack (>= 5.0)
activemodel (>= 5.0) activemodel (>= 5.0)
simplecov (0.16.1) simplecov (0.16.1)
@ -306,28 +307,28 @@ GEM
actionpack (>= 4.0) actionpack (>= 4.0)
activesupport (>= 4.0) activesupport (>= 4.0)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
sshkit (1.16.1) sshkit (1.18.2)
net-scp (>= 1.1.2) net-scp (>= 1.1.2)
net-ssh (>= 2.8.0) net-ssh (>= 2.8.0)
thor (0.20.0) thor (0.20.3)
thread_safe (0.3.6) thread_safe (0.3.6)
tilt (2.0.8) tilt (2.0.9)
turbolinks (5.1.1) turbolinks (5.2.0)
turbolinks-source (~> 5.1) turbolinks-source (~> 5.2)
turbolinks-source (5.1.0) turbolinks-source (5.2.0)
tzinfo (1.2.5) tzinfo (1.2.5)
thread_safe (~> 0.1) thread_safe (~> 0.1)
uglifier (4.1.10) uglifier (4.1.20)
execjs (>= 0.3.0, < 3) execjs (>= 0.3.0, < 3)
unicode-display_width (1.3.2) unicode-display_width (1.4.1)
warden (1.2.7) warden (1.2.8)
rack (>= 1.0) rack (>= 2.0.6)
web-console (3.6.2) web-console (3.7.0)
actionview (>= 5.0) actionview (>= 5.0)
activemodel (>= 5.0) activemodel (>= 5.0)
bindex (>= 0.4.0) bindex (>= 0.4.0)
railties (>= 5.0) railties (>= 5.0)
webpacker (3.5.3) webpacker (3.5.5)
activesupport (>= 4.2) activesupport (>= 4.2)
rack-proxy (>= 0.6.1) rack-proxy (>= 0.6.1)
railties (>= 4.2) railties (>= 4.2)
@ -336,7 +337,7 @@ GEM
websocket-extensions (0.1.3) websocket-extensions (0.1.3)
whenever (0.10.0) whenever (0.10.0)
chronic (>= 0.6.3) chronic (>= 0.6.3)
xpath (3.0.0) xpath (3.2.0)
nokogiri (~> 1.8) nokogiri (~> 1.8)
PLATFORMS PLATFORMS
@ -357,7 +358,7 @@ DEPENDENCIES
database_cleaner database_cleaner
devise (~> 4.4) devise (~> 4.4)
devise-i18n (~> 1.6) devise-i18n (~> 1.6)
factory_bot_rails factory_bot_rails (~> 5.0)
guard guard
guard-minitest guard-minitest
has_scope has_scope
@ -398,4 +399,4 @@ RUBY VERSION
ruby 2.3.3p222 ruby 2.3.3p222
BUNDLED WITH BUNDLED WITH
1.16.2 1.17.2

View file

@ -27,9 +27,9 @@
FactoryBot.define do FactoryBot.define do
factory :check_log do factory :check_log do
check check
status :pending status { :pending }
exit_status nil exit_status { nil }
parsed_response nil parsed_response { nil }
raw_response nil raw_response { nil }
end end
end end

View file

@ -25,20 +25,20 @@ FactoryBot.define do
factory :check_notification do factory :check_notification do
check check
notification notification
status :pending status { :pending }
sent_at nil sent_at { nil }
trait :ongoing do trait :ongoing do
status :ongoing status { :ongoing }
end end
trait :succeed do trait :succeed do
status :succeed status { :succeed }
sent_at { 1.day.ago } sent_at { 1.day.ago }
end end
trait :failed do trait :failed do
status :failed status { :failed }
end end
end end
end end

View file

@ -34,62 +34,54 @@
FactoryBot.define do FactoryBot.define do
factory :check do factory :check do
user user
kind :domain kind { :domain }
domain "domain.fr" domain { "domain.fr" }
domain_created_at Time.new(2016, 4, 1, 12, 0, 0, "+02:00") domain_created_at { Time.new(2016, 4, 1, 12, 0, 0, "+02:00") }
domain_updated_at Time.new(2017, 3, 1, 12, 0, 0, "+02:00") domain_updated_at { Time.new(2017, 3, 1, 12, 0, 0, "+02:00") }
domain_expires_at Time.new(2019, 4, 1, 12, 0, 0, "+02:00") domain_expires_at { Time.new(2019, 4, 1, 12, 0, 0, "+02:00") }
active true active { true }
vendor nil vendor { nil }
comment nil comment { nil }
last_run_at nil last_run_at { nil }
last_success_at nil last_success_at { nil }
consecutive_failures 0 consecutive_failures { 0 }
mode :auto mode { :auto }
trait :domain do trait :domain do
kind :domain kind { :domain }
end end
trait :ssl do trait :ssl do
kind :ssl kind { :ssl }
end end
trait :nil_dates do trait :nil_dates do
domain_created_at nil domain_created_at { nil }
domain_updated_at nil domain_updated_at { nil }
domain_expires_at nil domain_expires_at { nil }
end end
trait :expires_next_week do trait :expires_next_week do
domain_expires_at 1.week.from_now domain_expires_at { 1.week.from_now }
end end
trait :expires_next_year do trait :expires_next_year do
domain_expires_at 1.year.from_now domain_expires_at { 1.year.from_now }
end end
trait :last_runs_failed do trait :last_runs_failed do
consecutive_failures 5 consecutive_failures { 5 }
last_run_at 3.days.ago - 90.minutes last_run_at { 3.days.ago - 90.minutes }
last_success_at 7.days.ago - 2.hours last_success_at { 7.days.ago - 2.hours }
end end
trait :last_run_succeed do trait :last_run_succeed do
last_run_at 25.hour.ago last_run_at { 25.hours.ago }
last_success_at 25.hour.ago last_success_at { 25.hours.ago }
end end
trait :inactive do trait :inactive do
active false active { false }
end
trait :with_notifications do
after :create do |check|
create_list :check_notification, 2,
check: check,
notification: build(:notification, user: check.user)
end
end end
end end
end end

View file

@ -29,13 +29,13 @@
FactoryBot.define do FactoryBot.define do
factory :notification do factory :notification do
user user
interval 30 interval { 30 }
channel :email channel { :email }
label { "#{recipient} (#{interval})" } sequence(:label) { |n| "#{recipient}-#{n} (#{interval})" }
recipient "recipient@domain.fr" recipient { "recipient@domain.fr" }
trait :email do trait :email do
channel :email channel { :email }
end end
end end
end end

View file

@ -38,14 +38,14 @@ require "securerandom"
FactoryBot.define do FactoryBot.define do
factory :user do factory :user do
sequence(:email) { |n| "user-#{n}@chexpire.org" } sequence(:email) { |n| "user-#{n}@chexpire.org" }
password "password" password { "password" }
confirmed_at Time.new(2018, 4, 1, 12, 0, 0, "+02:00") confirmed_at { Time.new(2018, 4, 1, 12, 0, 0, "+02:00") }
notifications_enabled true notifications_enabled { true }
locale "en" locale { "en" }
tos_accepted true tos_accepted { true }
trait :fr do trait :fr do
locale "fr" locale { "fr" }
end end
end end
end end

View file

@ -32,9 +32,8 @@ class ChecksTest < ApplicationSystemTestCase
fill_in("check[domain]", with: domain) fill_in("check[domain]", with: domain)
page.find("body").click # simulate blur page.find("body").click # simulate blur
fill_in("check[domain_expires_at]", with: "2022-04-05") fill_in("check[domain_expires_at]", with: Date.new(2022, 4, 5))
click_button "Create Check"
click_button
assert_equal checks_path, page.current_path assert_equal checks_path, page.current_path
@ -53,48 +52,54 @@ class ChecksTest < ApplicationSystemTestCase
fill_and_valid_new_check fill_and_valid_new_check
end end
test "dissociate a notification" do test "dettach a notification from a check" do
check = create(:check, :with_notifications, user: @user) initial_notifications_count = 2
check = create(:check, user: @user)
existing_notifications = create_list(:notification, initial_notifications_count, user: @user)
check.notifications << existing_notifications
notification = create(:notification, label: "label-notification", user: @user) notification = create(:notification, label: "label-notification", user: @user)
check.notifications << notification check.notifications << notification
visit edit_check_path(check) visit edit_check_path(check)
uncheck notification.label uncheck notification.label
click_button "Update Check" click_button "Update Check"
notification.reload notification.reload
check.reload
assert_equal 0, notification.checks_count assert_equal 0, notification.checks_count
assert_equal 2, check.check_notifications.count assert_equal initial_notifications_count, check.notifications.count
end end
test "associate a notification" do test "attach a notification to a check" do
check = create(:check, user: @user) check = create(:check, user: @user)
notification = create(:notification, label: "label-notification", user: @user) notification = create(:notification, label: "label-notification", user: @user)
visit edit_check_path(check)
visit edit_check_path(check)
check notification.label check notification.label
click_button "Update Check" click_button "Update Check"
notification.reload notification.reload
check.reload
assert_equal 1, notification.checks_count assert_equal 1, notification.checks_count
assert_equal 1, check.check_notifications.count assert_equal 1, check.check_notifications.count
end end
test "update a check" do test "update a check" do
check = create(:check, :with_notifications, domain: "dom-with-notif.net", user: @user) check = create(:check, domain: "dom-with-notif.net", user: @user)
check.notifications << create_list(:notification, 2, user: @user)
visit edit_check_path(check) visit edit_check_path(check)
fill_in "check[comment]", with: "My comment" fill_in "check[comment]", with: "My comment"
click_button "Update Check" click_button "Update Check"
assert_equal checks_path, page.current_path assert_equal checks_path, page.current_path
assert page.has_css?(".alert-success") assert page.has_css?(".alert-success")
check.reload check.reload
assert_equal "My comment", check.comment assert_equal "My comment", check.comment
end end