diff options
author | floppydiskette <floppydisk@hyprcat.net> | 2024-09-13 12:58:12 +0100 |
---|---|---|
committer | floppydiskette <floppydisk@hyprcat.net> | 2024-09-13 12:59:16 +0100 |
commit | 2c3400fb4f5a22951d42f286975201bf817d7883 (patch) | |
tree | a08b06f5f6d5df4f6774da7645d85418609a4cf2 /spec/setup | |
parent | d8915dcca4d9752f6f254e86afa39ef7f83617d1 (diff) |
wronglucky
Diffstat (limited to 'spec/setup')
-rw-r--r-- | spec/setup/.keep | 0 | ||||
-rw-r--r-- | spec/setup/clean_database.cr | 3 | ||||
-rw-r--r-- | spec/setup/configure_lucky_flow.cr | 37 | ||||
-rw-r--r-- | spec/setup/reset_emails.cr | 3 | ||||
-rw-r--r-- | spec/setup/setup_database.cr | 2 | ||||
-rw-r--r-- | spec/setup/start_app_server.cr | 10 |
6 files changed, 55 insertions, 0 deletions
diff --git a/spec/setup/.keep b/spec/setup/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/spec/setup/.keep diff --git a/spec/setup/clean_database.cr b/spec/setup/clean_database.cr new file mode 100644 index 0000000..a1bc631 --- /dev/null +++ b/spec/setup/clean_database.cr @@ -0,0 +1,3 @@ +Spec.before_each do + AppDatabase.truncate +end diff --git a/spec/setup/configure_lucky_flow.cr b/spec/setup/configure_lucky_flow.cr new file mode 100644 index 0000000..504a3d3 --- /dev/null +++ b/spec/setup/configure_lucky_flow.cr @@ -0,0 +1,37 @@ +# For more detailed documentation, visit +# https://luckyframework.org/guides/testing/html-and-interactivity + +LuckyFlow.configure do |settings| + settings.stop_retrying_after = 200.milliseconds + settings.base_uri = Lucky::RouteHelper.settings.base_uri + + # LuckyFlow will install the chromedriver for you located in + # ~./webdrivers/. Uncomment this to point to a specific driver + # settings.driver_path = "/path/to/specific/chromedriver" +end + +# By default, LuckyFlow is set in "headless" mode (no browser window shown). +# Uncomment this to enable running `LuckyFlow` in a Google Chrome window instead. +# Be sure to disable for CI. +# +# LuckyFlow.default_driver = "chrome" + +# LuckyFlow uses a registry for each driver. By default, chrome, and headless_chrome +# are available. If you'd like to register your own custom driver, you can register +# it here. +# +# LuckyFlow::Registry.register :firefox do +# # add your custom driver here +# end + +# Setup specs to allow you to change the driver on the fly +# per spec by setting a tag on specific specs. Requires the +# driver to be registered through `LuckyFlow::Registry` first. +# +# ``` +# it "uses headless_chrome" do +# end +# it "uses webless", tags: "webless" do +# end +# ``` +LuckyFlow::Spec.setup diff --git a/spec/setup/reset_emails.cr b/spec/setup/reset_emails.cr new file mode 100644 index 0000000..140ab41 --- /dev/null +++ b/spec/setup/reset_emails.cr @@ -0,0 +1,3 @@ +Spec.before_each do + Carbon::DevAdapter.reset +end diff --git a/spec/setup/setup_database.cr b/spec/setup/setup_database.cr new file mode 100644 index 0000000..393c6da --- /dev/null +++ b/spec/setup/setup_database.cr @@ -0,0 +1,2 @@ +Db::Create.new(quiet: true).call +Db::Migrate.new(quiet: true).call diff --git a/spec/setup/start_app_server.cr b/spec/setup/start_app_server.cr new file mode 100644 index 0000000..ff0bfee --- /dev/null +++ b/spec/setup/start_app_server.cr @@ -0,0 +1,10 @@ +app_server = AppServer.new + +spawn do + app_server.listen +end + +Spec.after_suite do + LuckyFlow.shutdown + app_server.close +end |