In production mode and when running the frozen specs, clover_freeze now calls freeze on all autoloaded constants, and Clover is an autoloaded constant. Both the specs and config.ru call clover_freeze unconditionally. This also removes the override of Clover.freeze. In production and when running the frozen specs, it would call Sequel::Model.freeze_descendants and DB.freeze. The freezing of all autoloaded constants handles DB.freeze, and clover_freeze calls Sequel::Model.freeze_descendants before freezing all autoloaded constants. This does remove the `Sequel::Model.descendants.each(&:finalize_associations)` when running non-frozen specs, but that's solely an optimization and I don't think it is worth the complexity. The `return self if frozen?` code was added to work around a bug in autoload_hash_branches, where Roda.freeze would break if you called it the second time on the same object. Now that Clover.freeze is only called once, it is not needed.
41 lines
805 B
Ruby
41 lines
805 B
Ruby
# frozen_string_literal: true
|
|
|
|
require_relative "../spec_helper"
|
|
|
|
css_file = File.expand_path("../../../assets/css/app.css", __dir__)
|
|
File.write(css_file, "") unless File.file?(css_file)
|
|
|
|
require "capybara"
|
|
require "capybara/rspec"
|
|
|
|
Gem.suffix_pattern
|
|
|
|
Capybara.app = Clover.app
|
|
Capybara.exact = true
|
|
|
|
module RackTestPlus
|
|
include Rack::Test::Methods
|
|
|
|
def app
|
|
Capybara.app
|
|
end
|
|
end
|
|
|
|
RSpec.configure do |config|
|
|
config.include RackTestPlus
|
|
config.include Capybara::DSL
|
|
config.after do
|
|
Capybara.reset_sessions!
|
|
Capybara.use_default_driver
|
|
end
|
|
end
|
|
|
|
def login(email = TEST_USER_EMAIL, password = TEST_USER_PASSWORD)
|
|
visit "/login"
|
|
fill_in "Email Address", with: email
|
|
fill_in "Password", with: password
|
|
click_button "Sign in"
|
|
|
|
expect(page.title).to end_with("Dashboard")
|
|
end
|