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-action
https://github.com/hanami/hanami-action
lib/hanami/action/view_name_inferrer.rb
Ruby
mit
244
main
1,542
# frozen_string_literal: true module Hanami class Action # @since 2.0.0 # @api private class ViewNameInferrer # @since 2.0.0 # @api private ALTERNATIVE_NAMES = { "create" => "new", "update" => "edit" }.freeze class << self # @since 2.0.0 # @a...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
lib/hanami/action/cookies.rb
Ruby
mit
244
main
497
# frozen_string_literal: true module Hanami class Action # Cookies API # # This module isn't included by default. # # @since 0.1.0 # # @see Hanami::Action::Cookies#cookies module Cookies private # Finalize the response by flushing cookies into the response # #...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
lib/hanami/action/constants.rb
Ruby
mit
244
main
6,356
# frozen_string_literal: true require "rack" module Hanami class Action # Rack SPEC response code # # @since 1.0.0 # @api private RESPONSE_CODE = 0 # Rack SPEC response headers # # @since 1.0.0 # @api private RESPONSE_HEADERS = 1 # Rack SPEC response body # # @s...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
lib/hanami/action/params.rb
Ruby
mit
244
main
11,308
# frozen_string_literal: true require "rack/request" require "hanami/utils/hash" module Hanami class Action # Provides access to params included in a Rack request. # # Offers useful access to params via methods like {#[]}, {#get} and {#to_h}. # # These params are available via {Request#params}. ...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
lib/hanami/action/validatable.rb
Ruby
mit
244
main
6,902
# frozen_string_literal: true module Hanami class Action # Support for validating params when calling actions. # # Included only when dry-validation is bundled. # # @api private # @since 0.1.0 module Validatable # Defines the class name for anonymous params # # @api priv...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
lib/hanami/action/cookie_jar.rb
Ruby
mit
244
main
5,936
# frozen_string_literal: true require "rack/utils" require "hanami/utils/hash" module Hanami class Action # A set of HTTP Cookies # # It acts as an Hash # # @since 0.1.0 # # @see Hanami::Action::Cookies#cookies class CookieJar # @since 0.4.5 # @api private COOKIE_SE...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
lib/hanami/action/flash.rb
Ruby
mit
244
main
4,269
# frozen_string_literal: true # The Hanami::Action::Flash implementation is derived from Roda's FlashHash, also released under the # MIT Licence: # # Copyright (c) 2014-2020 Jeremy Evans # Copyright (c) 2010-2014 Michel Martens, Damian Janowski and Cyril David # Copyright (c) 2008-2009 Christian Neukirchen module Han...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
lib/hanami/action/csrf_protection.rb
Ruby
mit
244
main
6,268
# frozen_string_literal: true require "hanami/utils/blank" require "rack/utils" require "securerandom" require_relative "errors" module Hanami # @api private class Action # CSRF Protection # # This security mechanism is enabled automatically if sessions are turned on. # # It stores a "challeng...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
lib/hanami/action/session.rb
Ruby
mit
244
main
1,007
# frozen_string_literal: true module Hanami class Action # Session support for actions. # # Not included by default; you should include this module manually to enable session support. # For actions within an Hanami app, this module will be included automatically if sessions are # configured in th...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
lib/hanami/action/mime.rb
Ruby
mit
244
main
14,763
# frozen_string_literal: true require "hanami/utils" require "rack/utils" require "rack/mime" require_relative "errors" module Hanami class Action # @api private module Mime # Most commom media types used for responses # # @since 1.0.0 # @api public TYPES = { atom: "app...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
lib/hanami/action/request.rb
Ruby
mit
244
main
3,491
# frozen_string_literal: true require "rack/mime" require "rack/request" require "rack/utils" require "securerandom" require_relative "errors" module Hanami class Action # The HTTP request for an action, given to {Action#handle}. # # Inherits from `Rack::Request`, providing compatibility with Rack funct...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
lib/hanami/action/errors.rb
Ruby
mit
244
main
2,847
# frozen_string_literal: true module Hanami class Action # Base class for all Action errors. # # @api public # @since 2.0.0 class Error < ::StandardError end # Unknown status HTTP Status error # # @since 2.0.2 # # @see Hanami::Action::Response#status= # @see https://g...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
lib/hanami/action/version.rb
Ruby
mit
244
main
205
# frozen_string_literal: true module Hanami class Action # The current hanami-action version. # # @return [String] # # @since 3.0.0 # @api public VERSION = "3.0.0" end end
github
hanami/hanami-action
https://github.com/hanami/hanami-action
lib/hanami/action/rack/file.rb
Ruby
mit
244
main
820
# frozen_string_literal: true require "rack/files" module Hanami class Action # Rack extensions for actions. # # @api private # @since 0.4.3 module Rack # File to be sent # # @see Hanami::Action::Response#send_file # # @since 0.4.3 # @api private class F...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
lib/hanami/action/body_parsers/json.rb
Ruby
mit
244
main
422
# frozen_string_literal: true require "json" require_relative "../errors" module Hanami class Action module BodyParsers # Body parser for JSON request bodies. # # @api private module JSON def self.call(body, env) ::JSON.parse(body) rescue ::JSON::ParserError => ...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
lib/hanami/action/body_parsers/multipart_form.rb
Ruby
mit
244
main
627
# frozen_string_literal: true require "rack/multipart" require_relative "../errors" module Hanami class Action module BodyParsers # Body parser for multipart form data (file uploads). # # @api private module MultipartForm def self.call(body, env) # Rack's `parse_multipa...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
lib/hanami/action/mime/request_mime_weight.rb
Ruby
mit
244
main
1,425
# frozen_string_literal: true module Hanami class Action module Mime # @since 1.0.1 # @api private class RequestMimeWeight # @since 2.0.0 # @api private MIME_SEPARATOR = "/" private_constant :MIME_SEPARATOR # @since 2.0.0 # @api private M...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
lib/hanami/action/config/formats.rb
Ruby
mit
244
main
7,078
# frozen_string_literal: true require "hanami/utils/kernel" require "dry/core" module Hanami class Action class Config # Action format configuration. # # @since 2.0.0 # @api private class Formats include Dry.Equalizer(:accepted, :mapping) # @since 2.0.0 # @...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
lib/hanami/action/cache/directives.rb
Ruby
mit
244
main
2,874
# frozen_string_literal: true module Hanami class Action module Cache # Cache-Control directives which have values # # @since 0.3.0 # @api private VALUE_DIRECTIVES = %i[max_age s_maxage min_fresh max_stale].freeze # Cache-Control directives which are implicitly true ...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
lib/hanami/action/cache/cache_control.rb
Ruby
mit
244
main
2,017
# frozen_string_literal: true module Hanami class Action module Cache # Module with Cache-Control logic # # @since 0.3.0 # @api private module CacheControl # @since 0.3.0 # @api private def self.included(base) base.class_eval do extend C...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
lib/hanami/action/cache/expires.rb
Ruby
mit
244
main
2,005
# frozen_string_literal: true module Hanami class Action module Cache # Module with Expires logic # # @since 0.3.0 # @api private module Expires # @since 0.3.0 # @api private def self.included(base) base.class_eval do extend ClassMethods...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
lib/hanami/action/cache/conditional_get.rb
Ruby
mit
244
main
2,261
# frozen_string_literal: true require "hanami/utils/blank" module Hanami class Action module Cache # ETag value object # # @since 0.3.0 # @api private class ETag # @since 0.3.0 # @api private def initialize(env, value) @env, @value = env, value ...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
lib/hanami/action/request/session.rb
Ruby
mit
244
main
1,496
# frozen_string_literal: true require "forwardable" module Hanami class Action class Request < ::Rack::Request # Wrapper for Rack-provided sessions, allowing access using symbol keys. # # @since 2.3.0 # @api public class Session extend Forwardable def_delegators \ ...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/integration/sessions_without_cookies_spec.rb
Ruby
mit
244
main
759
# frozen_string_literal: true require "rack/test" RSpec.describe "Sessions without cookies application" do include Rack::Test::Methods let(:app) { SessionsWithoutCookies::Application.new } def response last_response end it "Set-Cookie with rack.session value is sent only one time" do get "/", {},...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/integration/head_spec.rb
Ruby
mit
244
main
4,525
# frozen_string_literal: true require "rack/test" require "rack/utils" RSpec.describe "HTTP HEAD" do include Rack::Test::Methods def app HeadTest::Application.new end def response last_response end it "Returns headers but an empty body " do head "/" headers = response.headers.to_a ...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/integration/mime_type_spec.rb
Ruby
mit
244
main
9,170
# frozen_string_literal: true RSpec.describe "MIME Type" do describe "Content type" do let(:app) { Rack::MockRequest.new(Mimes::Application.new) } it 'fallbacks to the default "Content-Type" header when the request is lacking of this information' do response = app.get("/") expect(response.header...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/integration/send_file_spec.rb
Ruby
mit
244
main
7,123
# frozen_string_literal: true require "rack/test" RSpec.describe "Full stack application" do include Rack::Test::Methods def app SendFileTest::Application.new end def response last_response end context "send files from anywhere in the system" do it "responds 200 when a local file exists" do...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/integration/cache_spec.rb
Ruby
mit
244
main
15,238
# frozen_string_literal: true require "hanami/router" module CacheControl class Default < Hanami::Action include Hanami::Action::Cache cache_control :public, max_age: 600 def handle(*) end end class Overriding < Hanami::Action include Hanami::Action::Cache cache_control :public, max_...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/integration/body_parsing_spec.rb
Ruby
mit
244
main
8,112
# frozen_string_literal: true require "stringio" RSpec.describe "Body parsing", :app_integration do describe "JSON" do it "parses JSON for actions accepting :json format" do action_class = Class.new(Hanami::Action) do config.formats.accept :json def handle(req, res) res.body = "...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/integration/body_parser_route_params_spec.rb
Ruby
mit
244
main
1,908
# frozen_string_literal: true RSpec.describe "Body parser route params integration" do let(:action) do Class.new(Hanami::Action) do config.formats.accept :html, :json params do required(:id).filled(:str?) required(:painter).schema do required(:first_name).filled(:str?) ...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/integration/rack_errors_spec.rb
Ruby
mit
244
main
4,176
# frozen_string_literal: true require "hanami/router" class ExceptionHandler def initialize(app) @app = app end def call(env) @app.call(env) rescue StandardError => exception [500, {}, [exception.message]] end end UnhandledException = Class.new(StandardError) UnhandledExceptio...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/integration/routing_spec.rb
Ruby
mit
244
main
4,424
# frozen_string_literal: true RSpec.describe "Hanami::Router integration" do let(:app) { Rack::MockRequest.new(RouterIntegration::Application.new) } before do pending end it "calls simple action" do response = app.get("/") expect(response.status).to be(200) expect(response.body).t...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/integration/rack_exception_spec.rb
Ruby
mit
244
main
738
# frozen_string_literal: true RSpec.describe "Exception notifiers integration" do let(:env) { {} } it "reference error in rack.exception" do expect { RackExceptionAction.new.call(env) }.to raise_error(RackExceptionAction::TestException) expect(env["rack.exception"]).to be_kind_of(RackExceptionAction::Tes...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/integration/sessions_spec.rb
Ruby
mit
244
main
1,782
# frozen_string_literal: true require "rack/test" require "hanami/router" require "hanami" RSpec.describe "HTTP sessions" do include Rack::Test::Methods let(:router) do Hanami::Router.new do get "/", to: Dashboard::Index.new post "/login", to: Sessions::Create.new delete "/logou...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/integration/inheritance_spec.rb
Ruby
mit
244
main
603
# frozen_string_literal: true require "rack/test" RSpec.describe Hanami::Action do describe "inheritance" do include Rack::Test::Methods let(:app) { Inheritance::Application.new } before do pending end it "calls the exact chain of events" do get "/books/23" expect(last_resp...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/integration/flash_spec.rb
Ruby
mit
244
main
1,362
# frozen_string_literal: true require "rack/test" RSpec.describe "Flash application" do include Rack::Test::Methods def app Flash::Application.new end it "doesn't return empty? true after setting flash and using redirect" do get "/" follow_redirect! if RUBY_VERSION < "3.4" expect(last...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/integration/sessions_with_cookies_spec.rb
Ruby
mit
244
main
717
# frozen_string_literal: true require "rack/test" RSpec.describe "Sessions with cookies application" do include Rack::Test::Methods let(:app) { SessionWithCookies::Application.new } def response last_response end # FIXME: Check with Alfonso if the last assertion is right xit "Set-Cookie with rack.s...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/integration/full_stack_spec.rb
Ruby
mit
244
main
3,043
# frozen_string_literal: true require "rack/test" RSpec.describe "Full stack application" do include Rack::Test::Methods def app FullStack::Application.new end before do pending end it "passes action inside the Rack env" do get "/", {}, "HTTP_ACCEPT" => "text/html" expect(last_response...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/isolation/hanami_controller_deprecation_spec.rb
Ruby
mit
244
main
1,132
# frozen_string_literal: true require_relative "../support/isolation_spec_helper" require "stringio" Warning[:deprecated] = true def capture_stderr original = $stderr $stderr = StringIO.new yield $stderr.string ensure $stderr = original end controller_warning = capture_stderr { require "hanami/controller"...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/isolation/without_dry_validation_spec.rb
Ruby
mit
244
main
1,628
# frozen_string_literal: true require_relative "../support/isolation_spec_helper" RSpec.describe "Without validations" do it "doesn't load Dry::Validation" do expect(defined?(Dry::Validation)).to be(nil) end it "doesn't load Hanami::Action::Validatable" do expect(defined?(Hanami::Action::Validatable))....
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/unit/hanami/action_spec.rb
Ruby
mit
244
main
5,186
# frozen_string_literal: true require "hanami/devtools/unit" RSpec.describe Hanami::Action do let(:action_class) { Class.new(described_class) } subject(:action) { action_class.new } describe ".new" do it "instantiates a frozen action" do expect(action).to be_frozen end end describe "#call" d...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/unit/hanami/action/base_param_spec.rb
Ruby
mit
244
main
1,362
# frozen_string_literal: true # TODO: merge these tests into params_spec RSpec.describe Hanami::Action::Params do let(:action) { Test::Index.new } describe "#initialize" do it "creates params without changing the raw request params" do env = {"router.params" => {"some" => {"hash" => "value"}}} act...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/unit/hanami/action/cookies_spec.rb
Ruby
mit
244
main
5,040
# frozen_string_literal: true RSpec.describe Hanami::Action do describe "#cookies" do it "gets cookies" do action = GetCookiesAction.new response = action.call("HTTP_COOKIE" => "foo=bar") expect(response.cookies).to include(foo: "bar") expected_headers = if Hanami::Action.rack_3?...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/unit/hanami/action/mime_spec.rb
Ruby
mit
244
main
301
# frozen_string_literal: true RSpec.describe Hanami::Action do describe "#content_type" do it "exposes MIME type" do action = CallAction.new response = action.call({}) expect(response.headers["Content-Type"]).to eq("application/octet-stream; charset=utf-8") end end end
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/unit/hanami/action/csrf_protection_spec.rb
Ruby
mit
244
main
4,420
# frozen_string_literal: true RSpec.describe Hanami::Action::CSRFProtection do subject(:action) { Class.new(Hanami::Action) { include Hanami::Action::CSRFProtection }.new } let(:response) { action.(request) } describe "Requests requiring protection (Non-idempotent request methods)" do let(:...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/unit/hanami/action/request_mime_weight_spec.rb
Ruby
mit
244
main
1,600
# frozen_string_literal: true require "spec_helper" RSpec.describe Hanami::Action::Mime::RequestMimeWeight do let(:plain_text) { described_class.new("text/plain", 0.7, 2) } let(:any_text) { described_class.new("text/*", 1, 0) } let(:anything) { described_class.new("*/*", 1, 3) } it "compares against another ...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/unit/hanami/action/throw_spec.rb
Ruby
mit
244
main
2,402
# frozen_string_literal: true RSpec.describe Hanami::Action do describe ".handle_exception" do it "handle an exception with the given status" do response = HandledExceptionAction.new.call({}) expect(response.status).to be(404) end it "raises the exception, if not handled" do expect { ...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/unit/hanami/action/session_spec.rb
Ruby
mit
244
main
679
# frozen_string_literal: true RSpec.describe Hanami::Action do describe "#session" do it "captures session from Rack env" do action = SessionAction.new response = action.call("rack.session" => {"user_id" => "23"}) expect(response.session).to eq(user_id: "23") end it "returns empty h...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/unit/hanami/action/request_spec.rb
Ruby
mit
244
main
6,079
# frozen_string_literal: true RSpec.describe Hanami::Action::Request do describe "#body" do it "exposes the raw body of the request" do body = build_request(input: "This is the body").body content = body.read expect(content).to eq("This is the body") end end describe "#script_name"...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/unit/hanami/action/rack_spec.rb
Ruby
mit
244
main
383
# frozen_string_literal: true RSpec.describe Hanami::Action::Rack do let(:action) { MethodInspectionAction.new } %w[GET POST PATCH PUT DELETE TRACE OPTIONS].each do |verb| it "returns current request method (#{verb})" do env = Rack::MockRequest.env_for("/", method: verb) response = action.call(env...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/unit/hanami/action/contract_spec.rb
Ruby
mit
244
main
4,244
# frozen_string_literal: true require "rack" RSpec.describe "Contract" do describe "defined inline in action" do let(:action) { ContractAction.new } context "when it has errors" do it "returns them" do response = action.call("birth_date" => "2000-01-01") expect(response.status).to eq...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/unit/hanami/action/body_parser_spec.rb
Ruby
mit
244
main
12,990
# frozen_string_literal: true require "stringio" RSpec.describe Hanami::Action::BodyParser do let(:config) { Class.new(Hanami::Action).config } describe ".parse" do it "skips if body already parsed" do env = {"router.parsed_body" => {existing: "data"}} described_class.parse(env, config) e...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/unit/hanami/action/flash_spec.rb
Ruby
mit
244
main
4,479
# frozen_string_literal: true RSpec.describe Hanami::Action::Flash do let(:flash) { described_class.new(input_hash) } let(:input_hash) { {} } describe ".new" do context "nil given" do let(:input_hash) { nil } it "creates an empty hash" do expect(flash.now).to eq({}) expect(flash...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/unit/hanami/action/after_spec.rb
Ruby
mit
244
main
769
# frozen_string_literal: true RSpec.describe Hanami::Action do describe ".after" do it "invokes the method(s) from the given symbol(s) after the action is run" do action = AfterMethodAction.new response = action.call({}) expect(response[:egg]).to eq("gE!g") expect(response[:logger].join(...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/unit/hanami/action/config_spec.rb
Ruby
mit
244
main
3,580
# frozen_string_literal: true RSpec.describe Hanami::Action::Config do subject(:config) { Class.new(Hanami::Action).config } describe "#handled_exceptions" do it "is an empty hash by default" do expect(config.handled_exceptions).to eq({}) end it "allows specifying a complete set of exceptions" ...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/unit/hanami/action/before_spec.rb
Ruby
mit
244
main
804
# frozen_string_literal: true RSpec.describe Hanami::Action do describe ".before" do it "invokes the method(s) from the given symbol(s) before the action is run" do action = BeforeMethodAction.new response = action.call({}) expect(response[:article]).to eq("Bonjour!".reverse) ex...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/unit/hanami/action/redirect_spec.rb
Ruby
mit
244
main
1,041
# frozen_string_literal: true RSpec.describe Hanami::Action do describe "#redirect" do it "redirects to the given path" do action = RedirectAction.new response = action.call({}) expect(response.status).to be(302) expected_headers = if Hanami::Action.rack_3? {"content-...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/unit/hanami/action/params_spec.rb
Ruby
mit
244
main
17,419
# frozen_string_literal: true require "rack" RSpec.describe Hanami::Action::Params do describe "#raw" do let(:params) { Class.new(Hanami::Action::Params) } context "when this feature isn't enabled" do let(:action) { ParamsAction.new } it "raw gets all params" do File.open("spec/support...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/unit/hanami/action/format_spec.rb
Ruby
mit
244
main
5,089
# frozen_string_literal: true RSpec.describe Hanami::Action do class FormatController class Lookup < Hanami::Action def handle(*) end end class Custom < Hanami::Action def handle(req, res) input = req.params[:format] input = input.to_sym unless input.nil? res.f...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/unit/hanami/action/response/status_spec.rb
Ruby
mit
244
main
1,151
# frozen_string_literal: true RSpec.describe Hanami::Action::Response, "status codes" do subject(:response) { described_class.new( env: rack_env, request: request, config: Hanami::Action.config.dup ) } let(:request) { Hanami::Action::Request.new( env: rack_env, params: {...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/unit/hanami/action/response/view_rendering_spec.rb
Ruby
mit
244
main
4,153
# frozen_string_literal: true RSpec.describe Hanami::Action::Response, "view rendering" do describe "#render" do subject(:response) { described_class.new( request: request, config: Hanami::Action.config.dup, env: env, view_options: view_options ) } let(:request) { dou...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/unit/hanami/action/response/session_spec.rb
Ruby
mit
244
main
683
# frozen_string_literal: true RSpec.describe Hanami::Action::Response, "session features" do subject(:response) { described_class.new( env: rack_env, request: request, config: Hanami::Action.config.dup, session_enabled: true ) } let(:request) { Hanami::Action::Request.new( ...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/unit/hanami/action/cache/value_directive_spec.rb
Ruby
mit
244
main
271
# frozen_string_literal: true RSpec.describe Hanami::Action::Cache::ValueDirective do describe "#to_str" do it "returns as http cache format" do subject = described_class.new(:max_age, 600) expect(subject.to_str).to eq("max-age=600") end end end
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/unit/hanami/action/cache/directives_spec.rb
Ruby
mit
244
main
3,248
# frozen_string_literal: true RSpec.describe Hanami::Action::Cache::Directives do describe "#directives" do context "non value directives" do it "accepts public symbol" do subject = described_class.new(:public) expect(subject.values.size).to eq(1) end it "accepts private symbol...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/unit/hanami/action/cache/non_value_directive_spec.rb
Ruby
mit
244
main
267
# frozen_string_literal: true RSpec.describe Hanami::Action::Cache::NonValueDirective do describe "#to_str" do it "returns as http cache format" do subject = described_class.new(:no_cache) expect(subject.to_str).to eq("no-cache") end end end
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/unit/hanami/action/halt/status_spec.rb
Ruby
mit
244
main
743
# frozen_string_literal: true RSpec.describe Hanami::Action::Halt do it "throws :halt with an integer status code" do expect { described_class.(401) }.to throw_symbol(:halt, [401, "Unauthorized"]) end it "normalizes a symbolic status code" do expect { described_class.(:unauthorized) }.to throw_symbol(:h...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/unit/hanami/action/rack/file_spec.rb
Ruby
mit
244
main
363
# frozen_string_literal: true RSpec.describe Hanami::Action::Rack::File do describe "#call" do it "doesn't mutate given env" do env = Rack::MockRequest.env_for("/download", method: "GET") expected = env.dup file = described_class.new("/report.pdf", __dir__) file.call(env) exp...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/unit/hanami/action/body_parsers/multipart_form_spec.rb
Ruby
mit
244
main
2,264
# frozen_string_literal: true require "stringio" RSpec.describe Hanami::Action::BodyParsers::MultipartForm, ".call" do it "parses multipart form data" do boundary = "----WebKitFormBoundary7MA4YWxkTrZu0gW" body = [ "------WebKitFormBoundary7MA4YWxkTrZu0gW", 'Content-Disposition: form-data; name="...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/unit/hanami/action/body_parsers/json_spec.rb
Ruby
mit
244
main
855
# frozen_string_literal: true RSpec.describe Hanami::Action::BodyParsers::JSON, ".call" do it "parses valid JSON" do body = '{"user":{"name":"Alice","address":{"city":"Rome"}}}' result = described_class.call(body, {}) expect(result).to eq( "user" => { "name" => "Alice", "address" =...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/unit/hanami/action/config/formats_spec.rb
Ruby
mit
244
main
6,492
# frozen_string_literal: true RSpec.describe Hanami::Action::Config::Formats do subject(:formats) { described_class.new } describe "#register" do it "registers a mapping" do expect { formats.register(:custom, "application/custom") } .to change { formats.mapping } .to include(custom: have...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/unit/hanami/http/status_spec.rb
Ruby
mit
244
main
3,911
# frozen_string_literal: true RSpec.describe Hanami::Http::Status do subject(:status) { described_class } describe ".for_code" do it "accepts an Integer status code" do expect(status.for_code(200)).to eq([200, "OK"]) expect(status.for_code(301)).to eq([301, "Moved Permanently"]) expect(statu...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/support/fixtures.rb
Ruby
mit
244
main
43,030
# frozen_string_literal: true require "json" require "digest/md5" require "hanami/router" require "hanami/middleware/body_parser" require "hanami/view/html" require "rack/session/cookie" require_relative "renderer" HTTP_TEST_STATUSES = { 100 => "Continue", 101 => "Switching Protocols", 102 => "Processing", 10...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/support/version_matcher.rb
Ruby
mit
244
main
577
# frozen_string_literal: true class VersionMatcher attr_reader :spec def initialize(spec) @spec = Gem.loaded_specs[spec] end def matches?(version) requirement(version).satisfied_by? spec.version end def excludes?(version) !matches?(version) end def to_proc method(:excludes?).to_proc...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/support/controller.rb
Ruby
mit
244
main
207
# frozen_string_literal: true if defined?(Hanami::Action::CookieJar) Hanami::Action::CookieJar.class_eval do def include?(hash) key, value = *hash @cookies[key] == value end end end
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/support/rack.rb
Ruby
mit
244
main
423
# frozen_string_literal: true module RSpec module Support module Rack # Given a string HTTP header, respond with a header name compatible with current Rack version def rack_header(http_header) if Hanami::Action.rack_3? http_header.downcase else http_header ...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/support/renderer.rb
Ruby
mit
244
main
1,182
# frozen_string_literal: true module Inspector def self.included(action) action.class_eval do after do |req, res| res[:params] = req.params.to_h req.env["hanami.response"] = res end end end end class Renderer def render(env, response) action = env.delete("hanami.action"...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
spec/support/isolation_spec_helper.rb
Ruby
mit
244
main
360
# frozen_string_literal: true require "rubygems" require "bundler" Bundler.setup(:default, :development, :test) $LOAD_PATH.unshift "lib" require "hanami/action" require "rspec" require_relative "rspec" require "hanami/devtools/unit" module RSpec module Support module Runner def self.run Core::Run...
github
hanami/hanami-action
https://github.com/hanami/hanami-action
benchmarks/memory_profile_action.rb
Ruby
mit
244
main
358
# frozen_string_literal: true require "hanami/action" require "memory_profiler" RETAIN = [] # rubocop:disable Style/MutableConstant def inherit_action(times) times.times do RETAIN << Class.new(Hanami::Action).new end end times = Integer(ENV.fetch("TIMES", 100)) report = MemoryProfiler.report do inherit_a...
github
orta/cocoapods-fix-react-native
https://github.com/orta/cocoapods-fix-react-native
Gemfile
Ruby
mit
243
master
240
source 'https://rubygems.org' # Specify your gem's dependencies in cocoapods-fix-react-native.gemspec gemspec group :development do gem 'cocoapods' gem 'mocha' gem 'bacon' gem 'mocha-on-bacon' gem 'prettybacon' gem 'pry' end
github
orta/cocoapods-fix-react-native
https://github.com/orta/cocoapods-fix-react-native
cocoapods-fix-react-native.gemspec
Ruby
mit
243
master
923
lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) Gem::Specification.new do |spec| spec.name = 'cocoapods-fix-react-native' spec.version = Time.now.strftime("%Y.%m.%d.%H") spec.authors = ['Orta Therox'] spec.email = ['orta.therox@gma...
github
orta/cocoapods-fix-react-native
https://github.com/orta/cocoapods-fix-react-native
spec/command/native_spec.rb
Ruby
mit
243
master
274
require File.expand_path('../../spec_helper', __FILE__) # This project has about 8 LOC of Ruby, I'm # not particularly bothered with testing it. # # It'd need integration really. # describe 'Empty test' do it 'is a pretty chill spec' do 23.should.equal 23 end end
github
orta/cocoapods-fix-react-native
https://github.com/orta/cocoapods-fix-react-native
lib/cocoapods_plugin.rb
Ruby
mit
243
master
822
require 'cocoapods-fix-react-native/fix_with_context' require 'cocoapods-fix-react-native/issues/react_dependency_version' Pod::HooksManager.register('cocoapods-fix-react-native', :pre_install) do |context| # The pre-fix resolver, usually for modifying Podspecs fixer = CocoaPodsFixReactNative.new fixer.pre_fix_w...
github
orta/cocoapods-fix-react-native
https://github.com/orta/cocoapods-fix-react-native
lib/cocoapods-fix-react-native/fix_with_context.rb
Ruby
mit
243
master
2,973
require 'molinillo/dependency_graph' class CocoaPodsFixReactNative def post_fix_with_context(context) # Get the current version of React Native in your app react_spec = nil context.umbrella_targets.each do |target| react = target.specs.find { |s| s.name == 'React' || s.name.start_with?('React/') } ...
github
orta/cocoapods-fix-react-native
https://github.com/orta/cocoapods-fix-react-native
lib/cocoapods-fix-react-native/helpers/root_helper.rb
Ruby
mit
243
master
1,090
# Notes: # # - All file paths should be relative to the React repo, rather than the Pods dir, or node_modules # - An enviroment variable of `COCOAPODS_FIX_REACT_NATIVE_DEV_ROOT` will override the defaults for dev. # # - Returns the root directory to use for React Native def get_root # Are you using :path based Po...
github
orta/cocoapods-fix-react-native
https://github.com/orta/cocoapods-fix-react-native
lib/cocoapods-fix-react-native/versions/0_56_0-post.rb
Ruby
mit
243
master
2,558
require 'cocoapods' require 'cocoapods-fix-react-native/helpers/root_helper' # Obtain the React Native root directory $root = get_root # Detect CocoaPods + Frameworks $has_frameworks = File.exists?'Pods/Target Support Files/React/React-umbrella.h' # TODO: move to be both file in pods and file in node_mods? def patch...
github
orta/cocoapods-fix-react-native
https://github.com/orta/cocoapods-fix-react-native
lib/cocoapods-fix-react-native/versions/0_57_0-post.rb
Ruby
mit
243
master
1,764
require 'cocoapods' require 'cocoapods-fix-react-native/helpers/root_helper' # Obtain the React Native root directory $root = get_root # Detect CocoaPods + Frameworks $has_frameworks = File.exists?'Pods/Target Support Files/React/React-umbrella.h' # Detect source file dependency in the generated Pods.xcodeproj works...
github
orta/cocoapods-fix-react-native
https://github.com/orta/cocoapods-fix-react-native
lib/cocoapods-fix-react-native/versions/0_54_4-post.rb
Ruby
mit
243
master
4,949
require 'cocoapods' require 'cocoapods-fix-react-native/helpers/root_helper' # Obtain the React Native root directory $root = get_root # Detect CocoaPods + Frameworks $has_frameworks = File.exists?'Pods/Target Support Files/React/React-umbrella.h' # TODO: move to be both file in pods and file in node_mods? def patch...
github
orta/cocoapods-fix-react-native
https://github.com/orta/cocoapods-fix-react-native
lib/cocoapods-fix-react-native/versions/0_55_4-post.rb
Ruby
mit
243
master
4,487
require 'cocoapods' require 'cocoapods-fix-react-native/helpers/root_helper' # Obtain the React Native root directory $root = get_root # Detect CocoaPods + Frameworks $has_frameworks = File.exists?'Pods/Target Support Files/React/React-umbrella.h' # TODO: move to be both file in pods and file in node_mods? def patch...
github
orta/cocoapods-fix-react-native
https://github.com/orta/cocoapods-fix-react-native
lib/cocoapods-fix-react-native/versions/0_58_6-pre.rb
Ruby
mit
243
master
1,658
require_relative './0_58_5-pre' # https://github.com/facebook/react-native/issues/23390 react_podspec_file = 'React.podspec' react_podspec_old_code = ' s.subspec "cxxreact" do |ss| ss.dependency "React/jsinspector" ss.dependency "boost-for-react-native", "1.63.0" ss.dependency ...
github
orta/cocoapods-fix-react-native
https://github.com/orta/cocoapods-fix-react-native
lib/cocoapods-fix-react-native/versions/0_58_0-pre.rb
Ruby
mit
243
master
1,891
require 'cocoapods' require 'cocoapods-fix-react-native/helpers/root_helper' # Obtain the React Native root directory $root = get_root # TODO: move to be both file in pods and file in node_mods? def patch_pod_file(path, old_code, new_code) file = File.join($root, path) unless File.exist?(file) Pod::UI.warn "#...
github
orta/cocoapods-fix-react-native
https://github.com/orta/cocoapods-fix-react-native
lib/cocoapods-fix-react-native/versions/0_55_3-post.rb
Ruby
mit
243
master
5,056
require 'cocoapods' require 'cocoapods-fix-react-native/helpers/root_helper' # Obtain the React Native root directory $root = get_root # Detect CocoaPods + Frameworks $has_frameworks = File.exists?'Pods/Target Support Files/React/React-umbrella.h' # TODO: move to be both file in pods and file in node_mods? def patch...
github
orta/cocoapods-fix-react-native
https://github.com/orta/cocoapods-fix-react-native
lib/cocoapods-fix-react-native/versions/0_53_3-post.rb
Ruby
mit
243
master
2,176
require 'cocoapods' require 'cocoapods-fix-react-native/helpers/root_helper' # Obtain the React Native root directory $root = get_root # Detect CocoaPods + Frameworks $has_frameworks = File.exists?'Pods/Target Support Files/React/React-umbrella.h' # TODO: move to be both file in pods and file in node_mods? def patch...
github
orta/cocoapods-fix-react-native
https://github.com/orta/cocoapods-fix-react-native
lib/cocoapods-fix-react-native/versions/0_54_2-post.rb
Ruby
mit
243
master
3,068
require 'cocoapods-fix-react-native/helpers/root_helper' # Obtain the React Native root directory $root = get_root # TODO: move to be both file in pods and file in node_mods? def edit_pod_file(path, old_code, new_code) file = File.join($root, path) code = File.read(file) if code.include?(old_code) puts "[CP...
github
orta/cocoapods-fix-react-native
https://github.com/orta/cocoapods-fix-react-native
lib/cocoapods-fix-react-native/issues/react_dependency_version.rb
Ruby
mit
243
master
642
class ReactDependencyVersion def fix_with_context(context) all_pods_targets = context.pods_project.targets all_pods_targets.each do |t| deployment_target = t.build_configurations.first.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] has_react_dep = t.dependencies.find { |dep| dep.name == 'React' } ...
github
iriscouch/bigdecimal.js
https://github.com/iriscouch/bigdecimal.js
Rakefile
Ruby
apache-2.0
243
master
5,837
require 'erb' HERE = File.expand_path(File.dirname __FILE__) GWT = "#{HERE}/BigDecimalApp" GWT_SRC = "#{GWT}/src/com/iriscouch/gwtapp/client" CJS_DIR = "#{HERE}/lib" JS_BUILD = "#{HERE}/build/out.js" CJS_PATH = "#{CJS_DIR}/bigdecimal.js" task :default => :bigdecimal directory CJS_DIR java_sources = %w[ RoundingMod...
github
grosser/single_cov
https://github.com/grosser/single_cov
Rakefile
Ruby
mit
243
master
523
# frozen_string_literal: true require "bundler/setup" require "bundler/gem_tasks" require "bump/tasks" task default: [:spec, :rubocop] task :spec do sh "bundle exec rspec specs/single_cov_spec.rb --warnings" end task :rubocop do sh "bundle exec rubocop" end desc "bundle all gemfiles CMD=install" task :bundle do...
github
grosser/single_cov
https://github.com/grosser/single_cov
single_cov.gemspec
Ruby
mit
243
master
744
# frozen_string_literal: true name = "single_cov" require "./lib/#{name.gsub("-", "/")}/version" Gem::Specification.new name, SingleCov::VERSION do |s| s.summary = "Actionable code coverage." s.authors = ["Michael Grosser"] s.email = "michael@grosser.it" s.homepage = "https://github.com/grosser/#{name}" s.fi...
github
grosser/single_cov
https://github.com/grosser/single_cov
lib/single_cov.rb
Ruby
mit
243
master
15,800
# frozen_string_literal: true module SingleCov COVERAGES = [] MAX_OUTPUT = Integer(ENV["SINGLE_COV_MAX_OUTPUT"] || "40") RAILS_APP_FOLDERS = ["models", "serializers", "helpers", "controllers", "mailers", "views", "jobs", "channels"] UNCOVERED_COMMENT_MARKER = /#.*uncovered/ NOCOV_MARKER = /^\s*#\s*:nocov:/ # ...
github
grosser/single_cov
https://github.com/grosser/single_cov
specs/single_cov_spec.rb
Ruby
mit
243
master
25,398
# frozen_string_literal: true require_relative "spec_helper" SingleCov.instance_variable_set(:@root, File.expand_path('fixtures/minitest', __dir__)) describe SingleCov do def self.it_does_not_complain_when_everything_is_covered(in_test: false) it "does not complain when everything is covered" do result = ...
github
jsonapi-rb/jsonapi-rb
https://github.com/jsonapi-rb/jsonapi-rb
jsonapi-rb.gemspec
Ruby
mit
243
master
685
version = File.read(File.expand_path('../VERSION', __FILE__)).strip Gem::Specification.new do |spec| spec.name = 'jsonapi-rb' spec.version = version spec.author = 'Lucas Hosseini' spec.email = 'lucas.hosseini@gmail.com' spec.summary = 'Build and consume JSON API documents....