source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
hanami/hanami
https://github.com/hanami/hanami
spec/support/warnings.rb
Ruby
mit
6,362
main
309
# frozen_string_literal: true # This file is synced from hanakai-rb/repo-sync require "warning" # Ignore warnings for experimental features Warning[:experimental] = false if Warning.respond_to?(:[]) # Ignore all warnings coming from gem dependencies Gem.path.each do |path| Warning.ignore(//, path) end
github
hanami/hanami
https://github.com/hanami/hanami
spec/support/coverage.rb
Ruby
mit
6,362
main
313
# frozen_string_literal: true # This file is synced from hanakai-rb/repo-sync if ENV["COVERAGE"] == "true" require "simplecov" require "simplecov-cobertura" SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter SimpleCov.start do add_filter "/spec/" enable_coverage :branch end end
github
hanami/hanami
https://github.com/hanami/hanami
spec/support/logging.rb
Ruby
mit
6,362
main
408
# frozen_string_literal: true module RSpec module Support module Logging # Strips ANSI escape sequences from a string, useful for asserting against colorized log # output without needing to account for terminal color codes. def strip_ansi(str) str.gsub(/\e\[[0-9;]*m/, "") end ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/support/rspec.rb
Ruby
mit
6,362
main
779
# frozen_string_literal: true # This file is synced from hanakai-rb/repo-sync RSpec.configure do |config| # When no filter given, search and run focused tests config.filter_run_when_matching :focus # Disables rspec monkey patches (no reason for their existence tbh) config.disable_monkey_patching! # Run ru...
github
hanami/hanami
https://github.com/hanami/hanami
spec/support/matchers.rb
Ruby
mit
6,362
main
671
# frozen_string_literal: true module RSpec module Support module Matchers module HTML def squish_html(str) str .gsub(/^[[:space:]]+/, "") .gsub(/>[[:space:]]+</m, "><") .strip end end end end end RSpec::Matchers.define :eq_html do |...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/setup_spec.rb
Ruby
mit
6,362
main
4,333
# frozen_string_literal: true RSpec.describe "Hanami setup", :app_integration do describe "Hanami.setup" do shared_examples "hanami setup" do it "requires the app file when found" do with_tmp_directory(Dir.mktmpdir) do write "config/app.rb", <<~RUBY require "hanami" ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/rake_tasks_spec.rb
Ruby
mit
6,362
main
2,820
# frozen_string_literal: true require "rake" require "hanami/cli/bundler" RSpec.describe "Rake tasks", :app_integration do describe "assets:precompile" do before do allow(Hanami).to receive(:bundled?) allow(Hanami).to receive(:bundled?).with("hanami-assets").and_return(hanami_assets_bundled) end...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/dotenv_loading_spec.rb
Ruby
mit
6,362
main
3,732
# frozen_string_literal: true RSpec.describe "Dotenv loading", :app_integration do before do @orig_env = ENV.to_h allow(Hanami::Env).to receive(:loaded?).and_return(false) end after do ENV.replace(@orig_env) end context "dotenv gem is available" do before do require "dotenv" end ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/slices_spec.rb
Ruby
mit
6,362
main
12,417
# frozen_string_literal: true RSpec.describe "Slices", :app_integration do specify "Loading a slice from a slice class in the app's config dir" do with_tmp_directory(Dir.mktmpdir) do write "config/app.rb", <<~RUBY require "hanami" module TestApp class App < Hanami::App ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/view/views_spec.rb
Ruby
mit
6,362
main
2,434
# frozen_string_literal: true RSpec.describe "Hanami view integration", :app_integration do specify "Views take their configuration from their slice in which they are defined" do with_tmp_directory(Dir.mktmpdir) do write "config/app.rb", <<~RUBY require "hanami" module TestApp cl...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/view/slice_configuration_spec.rb
Ruby
mit
6,362
main
7,815
# frozen_string_literal: true RSpec.describe "App view / Slice configuration", :app_integration do before do with_directory(@dir = make_tmp_directory) do write "config/app.rb", <<~RUBY require "hanami" module TestApp class App < Hanami::App end end RUBY ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/view/helpers/part_helpers_spec.rb
Ruby
mit
6,362
main
2,797
# frozen_string_literal: true RSpec.describe "App view / Helpers / Part helpers", :app_integration do before do with_directory(make_tmp_directory) do write "config/app.rb", <<~RUBY module TestApp class App < Hanami::App end end RUBY write "app/view.rb", <<~R...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/view/helpers/form_helper_spec.rb
Ruby
mit
6,362
main
4,392
# frozen_string_literal: true require "rack/test" require "stringio" RSpec.describe "Helpers / FormHelper", :app_integration do include Rack::Test::Methods let(:app) { Hanami.app } before do with_directory(make_tmp_directory) do write "config/app.rb", <<~RUBY module TestApp class Ap...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/view/helpers/scope_helpers_spec.rb
Ruby
mit
6,362
main
1,930
# frozen_string_literal: true RSpec.describe "App view / Helpers / Scope helpers", :app_integration do before do with_directory(make_tmp_directory) do write "config/app.rb", <<~RUBY module TestApp class App < Hanami::App end end RUBY write "app/view.rb", <<~...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/view/helpers/user_defined_helpers/scope_helpers_spec.rb
Ruby
mit
6,362
main
2,936
# frozen_string_literal: true RSpec.describe "App view / Helpers / User-defined helpers / Scope helpers", :app_integration do before do with_directory(make_tmp_directory) do write "config/app.rb", <<~RUBY module TestApp class App < Hanami::App end end RUBY w...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/view/helpers/user_defined_helpers/part_helpers_spec.rb
Ruby
mit
6,362
main
4,012
# frozen_string_literal: true RSpec.describe "App view / Helpers / User-defined helpers / Scope helpers", :app_integration do before do with_directory(make_tmp_directory) do write "config/app.rb", <<~RUBY module TestApp class App < Hanami::App end end RUBY w...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/view/context/inflector_spec.rb
Ruby
mit
6,362
main
856
# frozen_string_literal: true require "hanami" RSpec.describe "App view / Context / Inflector", :app_integration do before do module TestApp class App < Hanami::App end end Hanami.prepare module TestApp module Views class Context < Hanami::View::Context end ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/view/context/routes_spec.rb
Ruby
mit
6,362
main
1,671
# frozen_string_literal: true require "hanami" RSpec.describe "App view / Context / Routes", :app_integration do it "accesses app routes" do with_tmp_directory(Dir.mktmpdir) do write "config/app.rb", <<~RUBY require "hanami" module TestApp class App < Hanami::App end ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/view/context/assets_spec.rb
Ruby
mit
6,362
main
2,001
# frozen_string_literal: true require "hanami" RSpec.describe "App view / Context / Assets", :app_integration do subject(:context) { context_class.new } let(:context_class) { TestApp::Views::Context } before do with_directory(make_tmp_directory) do write "config/app.rb", <<~RUBY module TestAp...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/view/context/request_spec.rb
Ruby
mit
6,362
main
1,076
# frozen_string_literal: true require "hanami" RSpec.describe "App view / Context / Request", :app_integration do before do module TestApp class App < Hanami::App end end Hanami.prepare module TestApp module Views class Context < Hanami::View::Context end en...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/view/config/scope_class_spec.rb
Ruby
mit
6,362
main
4,045
# frozen_string_literal: true RSpec.describe "App view / Config / Scope class", :app_integration do before do with_directory(@dir = make_tmp_directory) do write "config/app.rb", <<~RUBY module TestApp class App < Hanami::App end end RUBY write "app/view.rb",...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/view/config/paths_spec.rb
Ruby
mit
6,362
main
2,727
# frozen_string_literal: true require "hanami" RSpec.describe "App view / Config / Paths", :app_integration do before do with_directory(make_tmp_directory) do write "config/app.rb", <<~RUBY module TestApp class App < Hanami::App end end RUBY write "app/view...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/view/config/default_context_spec.rb
Ruby
mit
6,362
main
4,113
# frozen_string_literal: true RSpec.describe "App view / Config / Default context", :app_integration do before do with_directory(@dir = make_tmp_directory) do write "config/app.rb", <<~RUBY module TestApp class App < Hanami::App end end RUBY write "app/view....
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/view/config/template_spec.rb
Ruby
mit
6,362
main
794
# frozen_string_literal: true require "hanami" RSpec.describe "App view / Config / Template", :app_integration do before do module TestApp class App < Hanami::App config.root = "/test_app" end end Hanami.app.instance_eval(&app_hook) if respond_to?(:app_hook) Hanami.app.register_...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/view/config/part_class_spec.rb
Ruby
mit
6,362
main
4,015
# frozen_string_literal: true RSpec.describe "App view / Config / Part class", :app_integration do before do with_directory(make_tmp_directory) do write "config/app.rb", <<~RUBY module TestApp class App < Hanami::App end end RUBY write "app/view.rb", <<~RUBY...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/view/config/part_namespace_spec.rb
Ruby
mit
6,362
main
2,219
# frozen_string_literal: true require "hanami" RSpec.describe "App view / Config / Part namespace", :app_integration do before do with_directory(make_tmp_directory) do write "config/app.rb", <<~RUBY module TestApp class App < Hanami::App end end RUBY write ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/view/config/scope_namespace_spec.rb
Ruby
mit
6,362
main
2,248
# frozen_string_literal: true require "hanami" RSpec.describe "App view / Config / Scope namespace", :app_integration do before do with_directory(make_tmp_directory) do write "config/app.rb", <<~RUBY module TestApp class App < Hanami::App end end RUBY write...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/view/config/inflector_spec.rb
Ruby
mit
6,362
main
1,400
# frozen_string_literal: true require "hanami" RSpec.describe "App view / Config / Inflector", :app_integration do before do module TestApp class App < Hanami::App config.root = "/test_app" end end Hanami.app.instance_eval(&app_hook) if respond_to?(:app_hook) Hanami.app.register...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/view/parts/default_rendering_spec.rb
Ruby
mit
6,362
main
3,272
# frozen_string_literal: true RSpec.describe "App view / Parts / Default rendering", :app_integration do before do with_directory(make_tmp_directory) do write "config/app.rb", <<~RUBY module TestApp class App < Hanami::App end end RUBY write "app/view.rb", <...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/router/resource_routes_spec.rb
Ruby
mit
6,362
main
11,690
# frozen_string_literal: true require "dry/inflector" require "hanami/slice/router" require "json" RSpec.describe "Router / Resource routes" do let(:router) { Hanami::Slice::Router.new(routes:, resolver:, inflector: Dry::Inflector.new) {} } let(:resolver) { Hanami::Slice::Routing::Resolver.new(slice:) } let(:s...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/db/db_inflector_spec.rb
Ruby
mit
6,362
main
1,252
# frozen_string_literal: true require "dry/system" RSpec.describe "ROM::Inflector", :app_integration do before do @env = ENV.to_h allow(Hanami::Env).to receive(:loaded?).and_return(false) end after do ENV.replace(@env) end around :each do |example| inflector = ROM::Inflector ROM.instan...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/db/gateways_spec.rb
Ruby
mit
6,362
main
11,158
# frozen_string_literal: true RSpec.describe "DB / Gateways", :app_integration do before do @env = ENV.to_h allow(Hanami::Env).to receive(:loaded?).and_return(false) end after do ENV.replace(@env) end it "configures gateways by detecting ENV vars" do with_tmp_directory(@dir = Dir.mktmpdir) ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/db/provider_config_spec.rb
Ruby
mit
6,362
main
2,309
# frozen_string_literal: true RSpec.describe "DB / Provider / Config", :app_integration do before do @env = ENV.to_h allow(Hanami::Env).to receive(:loaded?).and_return(false) end after do ENV.replace(@env) end describe "default config" do it "provides default plugins and extensions" do ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/db/auto_registration_spec.rb
Ruby
mit
6,362
main
839
# frozen_string_literal: true RSpec.describe "DB / auto-registration", :app_integration do before do @env = ENV.to_h allow(Hanami::Env).to receive(:loaded?).and_return(false) end after do ENV.replace(@env) end it "does not auto-register files in entities/, structs/, or db/" do with_tmp_dire...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/db/repo_spec.rb
Ruby
mit
6,362
main
7,638
# frozen_string_literal: true RSpec.describe "DB / Repo", :app_integration do before do @env = ENV.to_h allow(Hanami::Env).to receive(:loaded?).and_return(false) end after do ENV.replace(@env) end specify "repos have a root inferred from their name, or can set their own" do with_tmp_directo...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/db/logging_spec.rb
Ruby
mit
6,362
main
9,370
# frozen_string_literal: true require "json" RSpec.describe "DB / Logging", :app_integration do # Strip ANSI escape sequences from log output for assertion matching, since the development # logger enables colorization by default (including Rouge SQL syntax highlighting). def strip_ansi(str) str.gsub(/\e\[[0...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/db/relations_spec.rb
Ruby
mit
6,362
main
1,463
# frozen_string_literal: true RSpec.describe "DB / Relations", :app_integration do before do @env = ENV.to_h allow(Hanami::Env).to receive(:loaded?).and_return(false) end after do ENV.replace(@env) end it "registers nested relations" do with_tmp_directory(@dir = Dir.mktmpdir) do write...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/db/db_spec.rb
Ruby
mit
6,362
main
6,656
# frozen_string_literal: true RSpec.describe "DB", :app_integration do before do @env = ENV.to_h allow(Hanami::Env).to receive(:loaded?).and_return(false) end after do ENV.replace(@env) end it "sets up ROM and registers relations" do with_tmp_directory(Dir.mktmpdir) do write "config/a...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/db/db_slices_spec.rb
Ruby
mit
6,362
main
13,193
# frozen_string_literal: true RSpec.describe "DB / Slices", :app_integration do before do @env = ENV.to_h allow(Hanami::Env).to receive(:loaded?).and_return(false) end after do ENV.replace(@env) end specify "slices using the same database_url and extensions share a gateway/connection" do wi...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/db/commands_spec.rb
Ruby
mit
6,362
main
2,027
# frozen_string_literal: true RSpec.describe "DB / Commands", :app_integration do before do @env = ENV.to_h allow(Hanami::Env).to receive(:loaded?).and_return(false) end after do ENV.replace(@env) end it "registers custom commands" do with_tmp_directory(@dir = Dir.mktmpdir) do write "...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/db/slices_importing_from_parent.rb
Ruby
mit
6,362
main
3,288
# frozen_string_literal: true RSpec.describe "DB / Slices / Importing from app", :app_integration do before do @env = ENV.to_h allow(Hanami::Env).to receive(:loaded?).and_return(false) end after do ENV.replace(@env) end specify "app DB components do not import into slices by default" do wit...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/db/mappers_spec.rb
Ruby
mit
6,362
main
2,099
# frozen_string_literal: true RSpec.describe "DB / Mappers", :app_integration do before do @env = ENV.to_h allow(Hanami::Env).to receive(:loaded?).and_return(false) end after do ENV.replace(@env) end it "registers custom mappers" do with_tmp_directory(@dir = Dir.mktmpdir) do write "co...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/db/provider_spec.rb
Ruby
mit
6,362
main
686
# frozen_string_literal: true RSpec.describe "DB / Provider", :app_integration do before do @env = ENV.to_h allow(Hanami::Env).to receive(:loaded?).and_return(false) end after do ENV.replace(@env) end it "is registered when only a config/db/ dir exists" do with_tmp_directory(Dir.mktmpdir) d...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/i18n/i18n_spec.rb
Ruby
mit
6,362
main
29,747
# frozen_string_literal: true RSpec.describe "I18n", :app_integration do context "i18n gem is available" do before do require "i18n" end it "provides a complete i18n API" do with_tmp_directory(Dir.mktmpdir) do write "config/app.rb", <<~'RUBY' require "hanami" mod...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/action/routes_spec.rb
Ruby
mit
6,362
main
1,732
# frozen_string_literal: true RSpec.describe "App action / Routes", :app_integration do specify "Access app routes from an action" do with_tmp_directory(Dir.mktmpdir) do write "config/app.rb", <<~RUBY require "hanami" module TestApp class App < Hanami::App; end end ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/action/csrf_protection_spec.rb
Ruby
mit
6,362
main
1,398
# frozen_string_literal: true RSpec.describe "App action / CSRF protection", :app_integration do before do module TestApp class App < Hanami::App end end Hanami.app.instance_eval(&app_hook) if respond_to?(:app_hook) Hanami.app.register_slice :main Hanami.app.prepare module TestA...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/action/slice_configuration_spec.rb
Ruby
mit
6,362
main
7,616
# frozen_string_literal: true RSpec.describe "App action / Slice configuration", :app_integration do before do with_directory(@dir = make_tmp_directory) do write "config/app.rb", <<~'RUBY' require "hanami" module TestApp class App < Hanami::App end end RUB...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/action/format_config_spec.rb
Ruby
mit
6,362
main
2,883
# frozen_string_literal: true require "json" require "rack/test" RSpec.describe "App action / Format config", :app_integration do include Rack::Test::Methods let(:app) { Hanami.app } around do |example| with_tmp_directory(Dir.mktmpdir, &example) end it "adds a body parser middleware for the accepted ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/action/sessions_spec.rb
Ruby
mit
6,362
main
1,154
# frozen_string_literal: true RSpec.describe "App action / Sessions", :app_integration do before do module TestApp class App < Hanami::App end end Hanami.app.instance_eval(&app_hook) if respond_to?(:app_hook) Hanami.app.prepare module TestApp class Action < Hanami::Action ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/action/cookies_spec.rb
Ruby
mit
6,362
main
1,367
# frozen_string_literal: true RSpec.describe "App action / Cookies", :app_integration do before do module TestApp class App < Hanami::App end end Hanami.app.instance_eval(&app_hook) if respond_to?(:app_hook) Hanami.app.prepare module TestApp class Action < Hanami::Action ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/action/view_rendering_spec.rb
Ruby
mit
6,362
main
2,146
# frozen_string_literal: true RSpec.describe "App action / View rendering", :app_integration do specify "Views render with a request-specific context object" do with_tmp_directory(Dir.mktmpdir) do write "config/app.rb", <<~RUBY require "hanami" module TestApp class App < Hanami::...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/action/view_rendering/view_context_spec.rb
Ruby
mit
6,362
main
5,466
# frozen_string_literal: true RSpec.describe "App action / View rendering / View context", :app_integration do subject(:context) { # We capture the context during rendering via our view spies; see the view classes below action.call("REQUEST_METHOD" => "GET", "QUERY_STRING" => "/mock_request") action.view...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/action/view_rendering/automatic_rendering_spec.rb
Ruby
mit
6,362
main
6,222
# frozen_string_literal: true RSpec.describe "App action / View rendering / Automatic rendering", :app_integration do it "Renders a view automatically, passing all params and exposures" do within_app do write "app/actions/profile/show.rb", <<~RUBY module TestApp module Actions ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/action/view_rendering/paired_view_inference_spec.rb
Ruby
mit
6,362
main
2,802
# frozen_string_literal: true require "hanami" RSpec.describe "App action / View rendering / Paired view inference", :app_integration do before do module TestApp class App < Hanami::App end end Hanami.app.prepare module TestApp class Action < Hanami::Action end end en...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/operations/extension_spec.rb
Ruby
mit
6,362
main
2,998
# frozen_string_literal: true require "dry/operation" RSpec.describe "Operation / Extensions", :app_integration do before do @env = ENV.to_h allow(Hanami::Env).to receive(:loaded?).and_return(false) end after { ENV.replace(@env) } specify "Transaction interface is made available automatically" do ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/code_loading/loading_from_slice_spec.rb
Ruby
mit
6,362
main
4,551
# frozen_string_literal: true RSpec.describe "Code loading / Loading from slice directory", :app_integration do before :context do with_directory(@dir = make_tmp_directory) do write "config/app.rb", <<~'RUBY' require "hanami" module TestApp class App < Hanami::App end ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/code_loading/loading_from_lib_spec.rb
Ruby
mit
6,362
main
6,383
# frozen_string_literal: true RSpec.describe "Code loading / Loading from lib directory", :app_integration do describe "default root" do before :context do with_directory(@dir = make_tmp_directory.realpath) do write "config/app.rb", <<~'RUBY' require "hanami" module TestApp ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/code_loading/loading_from_app_spec.rb
Ruby
mit
6,362
main
4,060
# frozen_string_literal: true RSpec.describe "Code loading / Loading from app directory", :app_integration do before :context do with_directory(@dir = make_tmp_directory) do write "config/app.rb", <<~'RUBY' require "hanami" module TestApp class App < Hanami::App end ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/rack_app/body_parser_spec.rb
Ruby
mit
6,362
main
2,520
# frozen_string_literal: true require "rack/test" require "stringio" RSpec.describe "Hanami web app", :app_integration do include Rack::Test::Methods let(:app) { Hanami.app } around do |example| with_tmp_directory(Dir.mktmpdir, &example) end specify "Default body parser" do write "config/app.rb",...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/rack_app/middleware_spec.rb
Ruby
mit
6,362
main
19,406
# frozen_string_literal: true require "rack/test" require "stringio" RSpec.describe "Hanami web app", :app_integration do include Rack::Test::Methods let(:app) { Hanami.app } around do |example| with_tmp_directory(Dir.mktmpdir, &example) end before do module TestApp module Middlewares ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/rack_app/non_booted_rack_app_spec.rb
Ruby
mit
6,362
main
2,453
# frozen_string_literal: true require "rack/test" require "stringio" RSpec.describe "Running a Rack app for a non-booted app", :app_integration do include Rack::Test::Methods let(:app) { Hanami.app } it "lazy loads only the components required for any accessed routes" do with_tmp_directory(Dir.mktmpdir) d...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/rack_app/method_override_spec.rb
Ruby
mit
6,362
main
2,027
# frozen_string_literal: true require "rack/test" require "stringio" RSpec.describe "Hanami web app: Method Override", :app_integration do include Rack::Test::Methods let(:app) { Hanami.app } around do |example| with_tmp_directory(Dir.mktmpdir, &example) end context "enabled by default" do before...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/rack_app/rack_app_spec.rb
Ruby
mit
6,362
main
11,513
# frozen_string_literal: true require "rack/test" require "stringio" RSpec.describe "Hanami web app", :app_integration do include Rack::Test::Methods let(:app) { Hanami.app } specify "Hanami.app returns a rack builder" do with_tmp_directory do write "config/app.rb", <<~RUBY require "hanami" ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/logging/notifications_spec.rb
Ruby
mit
6,362
main
2,054
# frozen_string_literal: true require "rack/test" RSpec.describe "Logging / Notifications", :app_integration do include Rack::Test::Methods let(:app) { Hanami.app } specify "Request logging continues even when notifications bus has already been used" do dir = Dir.mktmpdir with_tmp_directory(dir) do ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/logging/request_logging_spec.rb
Ruby
mit
6,362
main
4,766
# frozen_string_literal: true require "json" require "rack/test" require "stringio" RSpec.describe "Logging / Request logging", :app_integration do include Rack::Test::Methods let(:app) { Hanami.app } let(:logger_stream) { StringIO.new } let(:logger_level) { nil } let(:root) { make_tmp_directory } de...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/logging/custom_logger_spec.rb
Ruby
mit
6,362
main
4,560
# frozen_string_literal: true require "rack/test" require "stringio" require "logger" require "dry/logger" RSpec.describe "Logging / Custom logger integration", :app_integration do include Rack::Test::Methods let(:app) { Hanami.app } let(:root) { make_tmp_directory } before do stub_const("TEST_LOGGER", ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/logging/exception_logging_spec.rb
Ruby
mit
6,362
main
3,130
# frozen_string_literal: true require "rack/test" require "stringio" RSpec.describe "Logging / Exception logging", :app_integration do include Rack::Test::Methods let(:app) { Hanami.app } let(:logger_stream) { StringIO.new } def configure_logger Hanami.app.config.logger.stream = logger_stream end ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/slices/external_slice_spec.rb
Ruby
mit
6,362
main
2,145
# frozen_string_literal: true require "rack/test" require "stringio" RSpec.describe "Slices / External slices", :app_integration do include Rack::Test::Methods let(:app) { TestApp::App.app } specify "External slices can be registered and used" do with_tmp_directory(Dir.mktmpdir) do write "config/app...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/slices/slice_routing_spec.rb
Ruby
mit
6,362
main
5,245
# frozen_string_literal: true require "rack/test" require "stringio" RSpec.describe "Slices / Slice routing", :app_integration do include Rack::Test::Methods let(:app) { Main::Slice.rack_app } specify "Slices have a nil router when no routes are defined" do with_tmp_directory(Dir.mktmpdir) do write ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/slices/slice_loading_spec.rb
Ruby
mit
6,362
main
4,724
# frozen_string_literal: true require "rack/test" RSpec.describe "Slices / Slice loading", :app_integration, :aggregate_failures do let(:app_modules) { %i[TestApp Admin Main] } describe "loading specific slices with config.slices" do describe "setup app" do it "ignores any explicitly registered slices ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/slices/slice_configuration_spec.rb
Ruby
mit
6,362
main
1,148
# frozen_string_literal: true require "stringio" RSpec.describe "Slices / Slice configuration", :app_integration do specify "Slices receive a copy of the app configuration, and can make distinct modifications" do with_tmp_directory(Dir.mktmpdir) do write "config/app.rb", <<~RUBY require "hanami" ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/slices/slice_registrations_spec.rb
Ruby
mit
6,362
main
1,868
# frozen_string_literal: true RSpec.describe "Slice Registrations", :app_integration do matcher :have_key do |name, value| match do |slice| slice.resolve(name) == value end end specify "Registrations are loaded" do with_tmp_directory(Dir.mktmpdir) do write "config/app.rb", <<~RUBY ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/assets/cross_slice_assets_helpers_spec.rb
Ruby
mit
6,362
main
3,204
# frozen_string_literal: true require "rack/test" require "stringio" RSpec.describe "Cross-slice assets via helpers", :app_integration do include Rack::Test::Methods let(:app) { Hanami.app } let(:root) { make_tmp_directory } before do with_directory(root) do write "config/app.rb", <<~RUBY m...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/assets/serve_static_assets_spec.rb
Ruby
mit
6,362
main
3,370
# frozen_string_literal: true require "rack/test" require "stringio" RSpec.describe "Serve Static Assets", :app_integration do include Rack::Test::Methods let(:app) { Hanami.app } let(:root) { make_tmp_directory } let!(:env) { ENV.to_h } before do with_directory(root) do write "config/app.rb", <<...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/assets/assets_spec.rb
Ruby
mit
6,362
main
3,878
# frozen_string_literal: true require "rack/test" require "stringio" RSpec.describe "Assets", :app_integration do include Rack::Test::Methods let(:app) { Hanami.app } let(:root) { make_tmp_directory } before do with_directory(root) do write "config/app.rb", <<~RUBY module TestApp ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/web/welcome_view_spec.rb
Ruby
mit
6,362
main
1,886
# frozen_string_literal: true require "json" require "rack/test" RSpec.describe "Web / Welcome view", :app_integration do include Rack::Test::Methods let(:app) { Hanami.app } before do with_directory(@dir = make_tmp_directory) do write "config/app.rb", <<~RUBY require "hanami" modul...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/web/render_detailed_errors_spec.rb
Ruby
mit
6,362
main
2,995
# frozen_string_literal: true require "json" require "rack/test" RSpec.describe "Web / Rendering detailed errors", :app_integration do include Rack::Test::Methods let(:app) { Hanami.app } before do with_directory(@dir = make_tmp_directory) do write "config/app.rb", <<~RUBY require "hanami" ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/web/content_security_policy_nonce_spec.rb
Ruby
mit
6,362
main
9,764
# frozen_string_literal: true require "rack/test" RSpec.describe "Web / Content security policy nonce", :app_integration do include Rack::Test::Methods let(:app) { Hanami.app } before do with_directory(@dir = make_tmp_directory) do write "config/routes.rb", <<~RUBY module TestApp c...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/web/render_errors_spec.rb
Ruby
mit
6,362
main
7,470
# frozen_string_literal: true require "json" require "rack/test" RSpec.describe "Web / Rendering errors", :app_integration do include Rack::Test::Methods let(:app) { Hanami.app } before do with_directory(@dir = make_tmp_directory) do write "config/app.rb", <<~RUBY require "hanami" m...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/container/auto_registration_spec.rb
Ruby
mit
6,362
main
2,269
# frozen_string_literal: true RSpec.describe "Container auto-registration", :app_integration do specify "Auto-registering files in slice source directories" do with_tmp_directory(Dir.mktmpdir) do write "config/app.rb", <<~RUBY require "hanami" module TestApp class App < Hanami::A...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/container/application_routes_helper_spec.rb
Ruby
mit
6,362
main
1,154
# frozen_string_literal: true require "stringio" RSpec.describe "App routes helper", :app_integration do specify "Routing to actions based on their container identifiers" do with_tmp_directory(Dir.mktmpdir) do write "config/app.rb", <<~RUBY require "hanami" module TestApp class ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/container/shutdown_spec.rb
Ruby
mit
6,362
main
2,145
# frozen_string_literal: true RSpec.describe "App shutdown", :app_integration do specify "App shutdown stops providers in both the app and slices" do with_tmp_directory(Dir.mktmpdir) do write "config/app.rb", <<~RUBY # frozen_string_literal: true require "hanami" module TestApp ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/container/auto_injection_spec.rb
Ruby
mit
6,362
main
1,143
# frozen_string_literal: true RSpec.describe "Container auto-injection (aka \"Deps\") mixin", :app_integration do def with_app with_tmp_directory(Dir.mktmpdir) do write "config/app.rb", <<~RUBY require "hanami" module TestApp class App < Hanami::App end end ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/container/prepare_container_spec.rb
Ruby
mit
6,362
main
3,758
# frozen_string_literal: true RSpec.describe "Container / prepare_container", :app_integration do # (Most of) the examples below make their expectations on a `container_to_prepare`, # which is the container yielded to the `Slice.prepare_container` block _at the moment # it is called_. # # This around hook en...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/container/imports_spec.rb
Ruby
mit
6,362
main
5,990
# frozen_string_literal: true RSpec.describe "Container imports", :app_integration do xspecify "App container is imported into slice containers by default" do with_tmp_directory(Dir.mktmpdir) do write "config/app.rb", <<~RUBY require "hanami" module TestApp class App < Hanami::Ap...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/container/provider_environment_spec.rb
Ruby
mit
6,362
main
1,196
# frozen_string_literal: true RSpec.describe "Container / Provider environment", :app_integration do let!(:app) { module TestApp class App < Hanami::App class << self attr_accessor :test_provider_target end end end before_prepare if respond_to?(:before_prepare) ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/container/provider_lifecycle_spec.rb
Ruby
mit
6,362
main
1,369
# frozen_string_literal: true RSpec.describe "Container / Provider lifecycle", :app_integration do let!(:slice) { module TestApp class App < Hanami::App register_provider :connection do prepare do module ::TestApp class Connection def initialize ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/container/autoloader_spec.rb
Ruby
mit
6,362
main
2,211
# frozen_string_literal: true RSpec.describe "App autoloader", :app_integration do specify "Classes are autoloaded through direct reference, including through components resolved from the container" do with_tmp_directory(Dir.mktmpdir) do write "config/app.rb", <<~RUBY require "hanami" modu...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/container/standard_providers_spec.rb
Ruby
mit
6,362
main
3,279
# frozen_string_literal: true RSpec.describe "Container / Standard providers", :app_integration do specify "Standard components are available on booted container" do with_tmp_directory(Dir.mktmpdir) do write "config/app.rb", <<~RUBY require "hanami" module TestApp class App < Han...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/container/standard_providers/rack_provider_spec.rb
Ruby
mit
6,362
main
1,227
# frozen_string_literal: true RSpec.describe "Container / Standard providers / Rack", :app_integration do specify "Rack provider is loaded when rack is bundled" do with_tmp_directory(Dir.mktmpdir) do write "config/app.rb", <<~RUBY require "hanami" module TestApp class App < Hanam...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/settings/settings_component_loading_spec.rb
Ruby
mit
6,362
main
2,790
# frozen_string_literal: true RSpec.describe "Settings / Component loading", :app_integration do describe "Settings are loaded from a class defined in config/settings.rb" do specify "in app" do with_directory(make_tmp_directory) do write "config/app.rb", <<~'RUBY' require "hanami" ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/settings/loading_from_env_spec.rb
Ruby
mit
6,362
main
5,215
# frozen_string_literal: true RSpec.describe "Settings / Access to constants", :app_integration do before do @env = ENV.to_h allow(Hanami::Env).to receive(:loaded?).and_return(false) end after do ENV.replace(@env) end specify "settings are loaded from ENV" do with_tmp_directory(Dir.mktmpdir...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/settings/slice_registration_spec.rb
Ruby
mit
6,362
main
3,903
# frozen_string_literal: true RSpec.describe "Settings / Slice registration", :app_integration do specify "Settings are registered for each slice with a settings file" do with_tmp_directory(Dir.mktmpdir) do write "config/app.rb", <<~RUBY require "hanami" module TestApp class App ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/settings/access_to_constants_spec.rb
Ruby
mit
6,362
main
971
# frozen_string_literal: true RSpec.describe "Settings / Access to constants", :app_integration do before do @env = ENV.to_h end after do ENV.replace(@env) end specify "Settings can not access autoloadable constants" do with_directory(make_tmp_directory) do write "config/app.rb", <<~'RUBY...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/settings/using_types_spec.rb
Ruby
mit
6,362
main
2,023
# frozen_string_literal: true require "hanami/settings" RSpec.describe "Settings / Using types", :app_integration do before do @env = ENV.to_h end after do ENV.replace(@env) end specify "types from a provided types module can be used as setting constructors to coerce values" do with_tmp_direct...
github
hanami/hanami
https://github.com/hanami/hanami
spec/integration/settings/access_in_slice_class_body_spec.rb
Ruby
mit
6,362
main
1,930
# frozen_string_literal: true RSpec.describe "Settings / Access within slice class bodies", :app_integration do before do @env = ENV.to_h allow(Hanami::Env).to receive(:loaded?).and_return(false) end after do ENV.replace(@env) end context "app class" do it "provides access to the settings i...
github
hanami/hanami
https://github.com/hanami/hanami
lib/hanami.rb
Ruby
mit
6,362
main
6,644
# frozen_string_literal: true require "pathname" require "zeitwerk" require_relative "hanami/constants" # A complete web framework for Ruby # # @since 0.1.0 # # @see http://hanamirb.org module Hanami @_mutex = Mutex.new @_bundled = {} # @api private # @since 2.0.0 def self.loader @loader ||= Zeitwerk::...
github
hanami/hanami
https://github.com/hanami/hanami
lib/hanami/env.rb
Ruby
mit
6,362
main
1,115
# frozen_string_literal: true module Hanami module Env # @since 2.0.1 # @api private @_loaded = false # Uses [dotenv](https://github.com/bkeepers/dotenv) (if available) to populate `ENV` from # various `.env` files. # # For a given `HANAMI_ENV` environment, the `.env` files are looked up...
github
hanami/hanami
https://github.com/hanami/hanami
lib/hanami/rake_tasks.rb
Ruby
mit
6,362
main
1,447
# frozen_string_literal: true require "hanami/cli" Hanami::CLI::RakeTasks.register_tasks do desc "Load the app environment" task :environment do require "hanami/prepare" end # Ruby ecosystem compatibility # # Most of the hosting SaaS automatic tasks are designed after Ruby on Rails. # They expect t...
github
hanami/hanami
https://github.com/hanami/hanami
lib/hanami/routes.rb
Ruby
mit
6,362
main
3,890
# frozen_string_literal: true require_relative "constants" require_relative "errors" require_relative "slice/router" module Hanami # App routes # # Users are expected to inherit from this class to define their app # routes. # # @example # # config/routes.rb # # frozen_string_literal: true # # ...