repo
stringlengths
5
92
file_url
stringlengths
80
287
file_path
stringlengths
5
197
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:37:27
2026-01-04 17:58:21
truncated
bool
2 classes
eliotsykes/rspec-rails-examples
https://github.com/eliotsykes/rspec-rails-examples/blob/f6ba3d6f6f95e9430c3207d0d21e672de4a98359/config/initializers/mime_types.rb
config/initializers/mime_types.rb
# Be sure to restart your server when you modify this file. # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf
ruby
MIT
f6ba3d6f6f95e9430c3207d0d21e672de4a98359
2026-01-04T15:57:41.510156Z
false
eliotsykes/rspec-rails-examples
https://github.com/eliotsykes/rspec-rails-examples/blob/f6ba3d6f6f95e9430c3207d0d21e672de4a98359/config/environments/test.rb
config/environments/test.rb
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suit...
ruby
MIT
f6ba3d6f6f95e9430c3207d0d21e672de4a98359
2026-01-04T15:57:41.510156Z
false
eliotsykes/rspec-rails-examples
https://github.com/eliotsykes/rspec-rails-examples/blob/f6ba3d6f6f95e9430c3207d0d21e672de4a98359/config/environments/development.rb
config/environments/development.rb
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the web serv...
ruby
MIT
f6ba3d6f6f95e9430c3207d0d21e672de4a98359
2026-01-04T15:57:41.510156Z
false
eliotsykes/rspec-rails-examples
https://github.com/eliotsykes/rspec-rails-examples/blob/f6ba3d6f6f95e9430c3207d0d21e672de4a98359/config/environments/production.rb
config/environments/production.rb
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both threaded web serve...
ruby
MIT
f6ba3d6f6f95e9430c3207d0d21e672de4a98359
2026-01-04T15:57:41.510156Z
false
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/spec/oauth2_spec.rb
spec/oauth2_spec.rb
# frozen_string_literal: true RSpec.describe OAuth2 do it "silence_extra_tokens_warning is a boolean" do expect(described_class.config.silence_extra_tokens_warning).to be(true).or be(false) end describe ".configure" do subject(:configure) do described_class.configure do |config| config.sil...
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
false
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/spec/spec_helper.rb
spec/spec_helper.rb
# frozen_string_literal: true # ensure test env ENV["RACK_ENV"] = "test" # Global Extensions require_relative "ext/backports" # External libraries require "addressable/uri" require "rspec/pending_for" # Family libraries require "kettle/test/rspec" # Library Configs require_relative "config/debug" require_relative ...
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
false
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/spec/oauth2/response_spec.rb
spec/oauth2/response_spec.rb
# frozen_string_literal: true RSpec.describe OAuth2::Response do subject { described_class.new(raw_response) } let(:raw_response) { Faraday::Response.new(status: status, response_headers: headers, body: body) } let(:status) { 200 } let(:headers) { {"foo" => "bar"} } let(:body) { "foo" } describe "#initia...
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
false
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/spec/oauth2/version_spec.rb
spec/oauth2/version_spec.rb
# frozen_string_literal: true RSpec.describe OAuth2::Version do it_behaves_like "a Version module", described_class it "is greater than 1.0.0" do expect(Gem::Version.new(described_class) >= Gem::Version.new("1.0.0")).to(be(true)) end end
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
false
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/spec/oauth2/client_spec.rb
spec/oauth2/client_spec.rb
# coding: utf-8 # frozen_string_literal: true require "nkf" RSpec.describe OAuth2::Client do subject(:instance) do described_class.new("abc", "def", {site: "https://api.example.com"}.merge(options)) do |builder| builder.adapter :test do |stub| stub.get("/success") { |_env| [200, {"Content-Type" =>...
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
true
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/spec/oauth2/authenticator_spec.rb
spec/oauth2/authenticator_spec.rb
# frozen_string_literal: true RSpec.describe OAuth2::Authenticator do subject do described_class.new(client_id, client_secret, mode) end let(:client_id) { "foo" } let(:client_secret) { "bar" } let(:mode) { :undefined } it "raises NotImplementedError for unknown authentication mode" do expect { su...
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
false
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/spec/oauth2/error_spec.rb
spec/oauth2/error_spec.rb
# encoding: utf-8 # frozen_string_literal: true class StirredHash < Hash def to_str '{"hello":"� Cool � StirredHash"}' end end class XmledString < String XML = ' <things> <thing id="101"> <name>� Cool � XmledString</name> </thing> </things> ' def to_str XML end end RSpec.describe OAuth2::Error do ...
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
false
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/spec/oauth2/access_token_spec.rb
spec/oauth2/access_token_spec.rb
# frozen_string_literal: true RSpec.describe OAuth2::AccessToken do subject { described_class.new(client, token, token_options) } let(:base_options) { {site: "https://api.example.com"} } let(:token_options) { {} } let(:options) { {} } let(:token) { "monkey" } let(:refresh_body) { JSON.dump(access_token: "...
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
true
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/spec/oauth2/strategy/auth_code_spec.rb
spec/oauth2/strategy/auth_code_spec.rb
# encoding: utf-8 # frozen_string_literal: true RSpec.describe OAuth2::Strategy::AuthCode do subject { client.auth_code } let(:code) { "sushi" } let(:kvform_token) { "expires_in=600&access_token=salmon&refresh_token=trout&extra_param=steve" } let(:facebook_token) { kvform_token.gsub("_in", "") } let(:json_t...
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
false
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/spec/oauth2/strategy/client_credentials_spec.rb
spec/oauth2/strategy/client_credentials_spec.rb
# frozen_string_literal: true RSpec.describe OAuth2::Strategy::ClientCredentials do subject { client.client_credentials } let(:kvform_token) { "expires_in=600&access_token=salmon&refresh_token=trout" } let(:json_token) { '{"expires_in":600,"access_token":"salmon","refresh_token":"trout"}' } let(:client) do ...
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
false
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/spec/oauth2/strategy/assertion_spec.rb
spec/oauth2/strategy/assertion_spec.rb
# frozen_string_literal: true require "openssl" require "jwt" RSpec.describe OAuth2::Strategy::Assertion do let(:client_assertion) { client.assertion } let(:client) do cli = OAuth2::Client.new("abc", "def", site: "http://api.example.com", auth_scheme: auth_scheme) cli.connection = Faraday.new(cli.site, c...
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
false
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/spec/oauth2/strategy/password_spec.rb
spec/oauth2/strategy/password_spec.rb
# frozen_string_literal: true RSpec.describe OAuth2::Strategy::Password do subject { client.password } let(:client) do cli = OAuth2::Client.new("abc", "def", site: "http://api.example.com") cli.connection = Faraday.new(cli.site, cli.options[:connection_opts]) do |b| b.request :url_encoded b.ad...
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
false
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/spec/oauth2/strategy/base_spec.rb
spec/oauth2/strategy/base_spec.rb
# frozen_string_literal: true RSpec.describe OAuth2::Strategy::Base do it "initializes with a Client" do expect { described_class.new(OAuth2::Client.new("abc", "def")) }.not_to raise_error end end
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
false
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/spec/oauth2/strategy/implicit_spec.rb
spec/oauth2/strategy/implicit_spec.rb
# frozen_string_literal: true RSpec.describe OAuth2::Strategy::Implicit do subject { client.implicit } let(:client) { OAuth2::Client.new("abc", "def", site: "http://api.example.com") } describe "#authorize_url" do it "includes the client_id" do expect(subject.authorize_url).to include("client_id=abc"...
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
false
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/spec/ext/backports.rb
spec/ext/backports.rb
# frozen_string_literal: true require "backports/2.5.0/hash/transform_keys" require "backports/2.5.0/string/delete_prefix"
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
false
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/spec/examples/google_spec.rb
spec/examples/google_spec.rb
# frozen_string_literal: true require "jwt" RSpec.describe "using OAuth2 with Google" do # This describes authenticating to a Google API via a service account. # See their docs: https://developers.google.com/identity/protocols/OAuth2ServiceAccount describe "via 2-legged JWT assertion" do let(:client) do ...
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
false
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/spec/config/faraday.rb
spec/config/faraday.rb
# frozen_string_literal: true require "faraday" Faraday.default_adapter = :test
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
false
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/spec/config/constants.rb
spec/config/constants.rb
VERBS = %i[get post put delete patch].freeze
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
false
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/spec/config/debug.rb
spec/config/debug.rb
load_debugger = ENV.fetch("DEBUG", "false").casecmp("true") == 0 puts "LOADING DEBUGGER: #{load_debugger}" if load_debugger require "debug" if load_debugger
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
false
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/spec/config/multi_xml.rb
spec/config/multi_xml.rb
# frozen_string_literal: true require "multi_xml" MultiXml.parser = :rexml
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
false
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/examples/e2e.rb
examples/e2e.rb
# frozen_string_literal: true # End-to-end example using oauth2 gem against a local mock-oauth2-server. # Prerequisites: # 1) Start the mock server (HTTP on 8080): # docker compose -f docker-compose-ssl.yml up -d --wait # 2) Run this script: # ruby examples/e2e.rb # 3) Stop the server when you're d...
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
false
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/lib/oauth2.rb
lib/oauth2.rb
# frozen_string_literal: true # includes modules from stdlib require "cgi" require "time" # third party gems require "snaky_hash" require "version_gem" # includes gem files require_relative "oauth2/version" require_relative "oauth2/filtered_attributes" require_relative "oauth2/error" require_relative "oauth2/authent...
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
false
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/lib/oauth2/version.rb
lib/oauth2/version.rb
# frozen_string_literal: true module OAuth2 module Version VERSION = "2.0.18" end end
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
false
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/lib/oauth2/filtered_attributes.rb
lib/oauth2/filtered_attributes.rb
module OAuth2 # Mixin that redacts sensitive instance variables in #inspect output. # # Classes include this module and declare which attributes should be filtered # using {.filtered_attributes}. Any instance variable name that includes one of # those attribute names will be shown as [FILTERED] in the object'...
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
false
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/lib/oauth2/response.rb
lib/oauth2/response.rb
# frozen_string_literal: true require "json" require "multi_xml" require "rack" module OAuth2 # The Response class handles HTTP responses in the OAuth2 gem, providing methods # to access and parse response data in various formats. # # @since 1.0.0 class Response # Default configuration options for Respo...
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
false
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/lib/oauth2/authenticator.rb
lib/oauth2/authenticator.rb
# frozen_string_literal: true require "base64" module OAuth2 # Builds and applies client authentication to token and revoke requests. # # Depending on the selected mode, credentials are applied as Basic Auth # headers, request body parameters, or only the client_id is sent (TLS). class Authenticator inc...
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
false
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/lib/oauth2/client.rb
lib/oauth2/client.rb
# frozen_string_literal: true require "faraday" require "logger" # :nocov: since coverage tracking only runs on the builds with Faraday v2 # We do run builds on Faraday v0 (and v1!), so this code is actually covered! # This is the only nocov in the whole project! if Faraday::Utils.respond_to?(:default_space_encoding)...
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
false
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/lib/oauth2/error.rb
lib/oauth2/error.rb
# frozen_string_literal: true module OAuth2 # Represents an OAuth2 error condition. # # Wraps details from an OAuth2::Response or Hash payload returned by an # authorization server, exposing error code and description per RFC 6749. class Error < StandardError # @return [OAuth2::Response, Hash, Object] Or...
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
false
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/lib/oauth2/access_token.rb
lib/oauth2/access_token.rb
# frozen_string_literal: true # :nocov: begin # The first version of hashie that has a version file was 1.1.0 # The first version of hashie that required the version file at runtime was 3.2.0 # If it has already been loaded then this is very low cost, as Kernel.require uses maintains a cache # If this it hasn'...
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
false
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/lib/oauth2/strategy/password.rb
lib/oauth2/strategy/password.rb
# frozen_string_literal: true module OAuth2 module Strategy # The Resource Owner Password Credentials Authorization Strategy # # IMPORTANT (OAuth 2.1): The Resource Owner Password Credentials grant is omitted in OAuth 2.1. # It remains here for backward compatibility with OAuth 2.0 providers. Prefer ...
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
false
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/lib/oauth2/strategy/client_credentials.rb
lib/oauth2/strategy/client_credentials.rb
# frozen_string_literal: true module OAuth2 module Strategy # The Client Credentials Strategy # # @see http://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-15#section-4.4 class ClientCredentials < Base # Not used for this strategy # # @raise [NotImplementedError] def autho...
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
false
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/lib/oauth2/strategy/auth_code.rb
lib/oauth2/strategy/auth_code.rb
# frozen_string_literal: true module OAuth2 module Strategy # The Authorization Code Strategy # # OAuth 2.1 notes: # - PKCE is required for all OAuth clients using the authorization code flow (especially public clients). # This library does not enforce PKCE generation/verification; implement PK...
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
false
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/lib/oauth2/strategy/assertion.rb
lib/oauth2/strategy/assertion.rb
# frozen_string_literal: true require "jwt" module OAuth2 module Strategy # The Client Assertion Strategy # # @see https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-10#section-4.1.3 # # Sample usage: # client = OAuth2::Client.new(client_id, client_secret, # ...
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
false
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/lib/oauth2/strategy/base.rb
lib/oauth2/strategy/base.rb
# frozen_string_literal: true module OAuth2 module Strategy class Base def initialize(client) @client = client end end end end
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
false
ruby-oauth/oauth2
https://github.com/ruby-oauth/oauth2/blob/5354d13211a531e4b1c20e485db574dd56cd9115/lib/oauth2/strategy/implicit.rb
lib/oauth2/strategy/implicit.rb
# frozen_string_literal: true module OAuth2 module Strategy # The Implicit Strategy # # IMPORTANT (OAuth 2.1): The Implicit grant (response_type=token) is omitted from the OAuth 2.1 draft specification. # It remains here for backward compatibility with OAuth 2.0 providers. Prefer the Authorization Co...
ruby
MIT
5354d13211a531e4b1c20e485db574dd56cd9115
2026-01-04T15:57:36.841593Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-api/spec/spec_helper.rb
rswag-api/spec/spec_helper.rb
# frozen_string_literal: true require 'simplecov' RSpec.configure do |_config| SimpleCov.start do enable_coverage :branch primary_coverage :branch filters.clear add_filter %r{^/spec/} end end require 'rswag/api'
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-api/spec/rswag/api/middleware_spec.rb
rswag-api/spec/rswag/api/middleware_spec.rb
# frozen_string_literal: true require 'spec_helper' require 'rswag/api/middleware' require 'rswag/api/configuration' describe Rswag::Api::Middleware do subject { described_class.new(app, config) } let(:app) { double('app') } let(:openapi_root) { File.expand_path('fixtures/openapi', __dir__) } let(:config) d...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-api/spec/rswag/api/fixtures/config/routes.rb
rswag-api/spec/rswag/api/fixtures/config/routes.rb
# frozen_string_literal: true TestApp::Application.routes.draw do resources :blogs, defaults: { format: :json } mount Rswag::Api::Engine => 'api-docs' mount Rswag::Ui::Engine => 'api-docs' end
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-api/spec/generators/rswag/api/install_generator_spec.rb
rswag-api/spec/generators/rswag/api/install_generator_spec.rb
# frozen_string_literal: true require 'generator_spec' require 'generators/rswag/api/install/install_generator' module Rswag module Api describe InstallGenerator do include GeneratorSpec::TestCase destination File.expand_path('tmp', __dir__) before(:all) do prepare_destination ...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-api/spec/generators/rswag/api/fixtures/config/routes.rb
rswag-api/spec/generators/rswag/api/fixtures/config/routes.rb
# frozen_string_literal: true TestApp::Application.routes.draw do end
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-api/spec/lib/rswag/api_spec.rb
rswag-api/spec/lib/rswag/api_spec.rb
# frozen_string_literal: true require 'spec_helper' RSpec.describe Rswag::Api do describe '::configure' do it 'yields a configuration object' do expect { |b| described_class.configure(&b) }.to yield_with_args(instance_of(Rswag::Api::Configuration)) end end end
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-api/spec/lib/rswag/api/configuration_spec.rb
rswag-api/spec/lib/rswag/api/configuration_spec.rb
# frozen_string_literal: true require 'spec_helper' RSpec.describe Rswag::Api::Configuration do subject(:configuration) { described_class.new } end
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-api/lib/rswag/api.rb
rswag-api/lib/rswag/api.rb
# frozen_string_literal: true require 'active_support/deprecation' require 'rswag/api/configuration' require 'rswag/api/engine' if defined?(Rails::Engine) module Rswag module Api def self.configure yield(config) end def self.config @config ||= Configuration.new end end end
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-api/lib/rswag/api/middleware.rb
rswag-api/lib/rswag/api/middleware.rb
# frozen_string_literal: true require 'json' require 'yaml' require 'rack/mime' module Rswag module Api class Middleware def initialize(app, config) @app = app @config = config end def call(env) path = env['PATH_INFO'] # Sanitize the filename for directory trav...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-api/lib/rswag/api/configuration.rb
rswag-api/lib/rswag/api/configuration.rb
# frozen_string_literal: true module Rswag module Api class Configuration attr_accessor :openapi_root, :openapi_filter, :openapi_headers def resolve_openapi_root(env) path_params = env['action_dispatch.request.path_parameters'] || {} path_params[:openapi_root] || openapi_root e...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-api/lib/rswag/api/engine.rb
rswag-api/lib/rswag/api/engine.rb
# frozen_string_literal: true require 'rswag/api/middleware' module Rswag module Api class Engine < ::Rails::Engine isolate_namespace Rswag::Api initializer 'rswag-api.initialize' do |_app| middleware.use Rswag::Api::Middleware, Rswag::Api.config end end end end
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-api/lib/generators/rswag/api/install/install_generator.rb
rswag-api/lib/generators/rswag/api/install/install_generator.rb
# frozen_string_literal: true require 'rails/generators' module Rswag module Api class InstallGenerator < Rails::Generators::Base source_root File.expand_path('templates', __dir__) def add_initializer template('rswag_api.rb', 'config/initializers/rswag_api.rb') end def add_rout...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-api/lib/generators/rswag/api/install/templates/rswag_api.rb
rswag-api/lib/generators/rswag/api/install/templates/rswag_api.rb
# frozen_string_literal: true Rswag::Api.configure do |c| # Specify a root folder where Swagger JSON files are located # This is used by the Swagger middleware to serve requests for API descriptions # NOTE: If you're using rswag-specs to generate Swagger, you'll need to ensure # that it's configured to generat...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag/spec/generators/rswag/specs/install_generator_spec.rb
rswag/spec/generators/rswag/specs/install_generator_spec.rb
# frozen_string_literal: true require 'generator_spec' require 'generators/rswag/install/install_generator' module Rswag module Specs describe InstallGenerator do include GeneratorSpec::TestCase destination File.expand_path('tmp', __dir__) before(:all) do prepare_destination f...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag/spec/generators/rswag/specs/fixtures/config/routes.rb
rswag/spec/generators/rswag/specs/fixtures/config/routes.rb
# frozen_string_literal: true TestApp::Application.routes.draw do end
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag/lib/rswag.rb
rswag/lib/rswag.rb
# frozen_string_literal: true require 'rswag/specs' require 'rswag/api' require 'rswag/ui' module Rswag end
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag/lib/rswag/railtie.rb
rswag/lib/rswag/railtie.rb
# frozen_string_literal: true module Rswag class Railtie < ::Rails::Railtie end end
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag/lib/generators/rswag/install/install_generator.rb
rswag/lib/generators/rswag/install/install_generator.rb
# frozen_string_literal: true require 'rails/generators' module Rswag class InstallGenerator < Rails::Generators::Base def install_components generate 'rswag:specs:install' generate 'rswag:api:install' generate 'rswag:ui:install' end end end
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-specs/spec/openapi_helper.rb
rswag-specs/spec/openapi_helper.rb
# frozen_string_literal: true # NOTE: For the specs in this gem, all configuration is completely mocked out # The file just needs to be present because it gets required by the openapi_formatter
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-specs/spec/spec_helper.rb
rswag-specs/spec/spec_helper.rb
# frozen_string_literal: true require 'simplecov' RSpec.configure do |_config| SimpleCov.start do enable_coverage :branch primary_coverage :branch filters.clear add_filter %r{^/spec/} end end require 'rswag/specs'
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-specs/spec/rswag/route_parser_spec.rb
rswag-specs/spec/rswag/route_parser_spec.rb
# frozen_string_literal: true RSpec.describe Rswag::RouteParser do describe '#routes' do subject { described_class.new(controller) } let(:controller) { 'api/v1/posts' } let(:routes) do [ double( defaults: { controller: controller }, path: double( ...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-specs/spec/rswag/specs_spec.rb
rswag-specs/spec/rswag/specs_spec.rb
# frozen_string_literal: true RSpec.describe Rswag::Specs do describe 'settings' do let(:rspec_config) do RSpec::Core::Configuration.new.tap do |c| c.add_setting :openapi_root end end it 'defines openapi settings' do expect { rspec_config.openapi_root = 'foobar' }.not_to raise_...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-specs/spec/rswag/specs/example_helpers_spec.rb
rswag-specs/spec/rswag/specs/example_helpers_spec.rb
# frozen_string_literal: true require 'rswag/specs/example_helpers' module Rswag module Specs RSpec.describe ExampleHelpers do mock_example = Struct.new(:request_headers, :request_params) subject { mock_example.new({}, {}) } before do subject.extend(ExampleHelpers) allow(Rswag...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-specs/spec/rswag/specs/configuration_spec.rb
rswag-specs/spec/rswag/specs/configuration_spec.rb
# frozen_string_literal: true require 'rswag/specs/configuration' require 'climate_control' RspecConfig = Struct.new( :openapi_root, :openapi_specs, :openapi_format, :rswag_dry_run, :openapi_strict_schema_validation, :openapi_all_properties_required, :openapi_no_additional_properties, keyword_init: true ) RSpe...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-specs/spec/rswag/specs/response_validator_spec.rb
rswag-specs/spec/rswag/specs/response_validator_spec.rb
# frozen_string_literal: true require 'rswag/specs/response_validator' module Rswag module Specs Response = Struct.new(:code, :headers, :body, keyword_init: true) RSpec.describe ResponseValidator do subject { ResponseValidator.new(config) } before do allow(config).to receive(:get_opena...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-specs/spec/rswag/specs/example_group_helpers_spec.rb
rswag-specs/spec/rswag/specs/example_group_helpers_spec.rb
# frozen_string_literal: true require 'rswag/specs/example_group_helpers' module Rswag module Specs RSpec.describe ExampleGroupHelpers do subject { double('example_group') } before do subject.extend ExampleGroupHelpers allow(subject).to receive(:describe) allow(subject).to r...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-specs/spec/rswag/specs/openapi_formatter_spec.rb
rswag-specs/spec/rswag/specs/openapi_formatter_spec.rb
# frozen_string_literal: true require 'rswag/specs/openapi_formatter' require 'ostruct' module Rswag module Specs Metadata = Struct.new(:metadata) Group = Struct.new(:group) RSpec.describe OpenapiFormatter do subject { described_class.new(output, config) } # Mock out some infrastructure ...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-specs/spec/rswag/specs/request_factory_spec.rb
rswag-specs/spec/rswag/specs/request_factory_spec.rb
# frozen_string_literal: true # cspell:ignore Bfoo Bbar require 'rswag/specs/request_factory' module Rswag module Specs RSpec.describe RequestFactory do subject { RequestFactory.new(metadata, example, config) } before do allow(config).to receive(:get_openapi_spec).and_return(openapi_spec) ...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-specs/spec/generators/rspec/openapi_generator_spec.rb
rswag-specs/spec/generators/rspec/openapi_generator_spec.rb
# frozen_string_literal: true require 'generator_spec' require 'generators/rspec/openapi_generator' require 'tmpdir' module Rspec describe OpenapiGenerator do include GeneratorSpec::TestCase destination Dir.mktmpdir before(:all) do prepare_destination fixtures_dir = File.expand_path('fixtur...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-specs/spec/generators/rswag/specs/install_generator_spec.rb
rswag-specs/spec/generators/rswag/specs/install_generator_spec.rb
# frozen_string_literal: true require 'generator_spec' require 'generators/rswag/specs/install/install_generator' module Rswag module Specs RSpec.describe InstallGenerator do include GeneratorSpec::TestCase destination File.expand_path('tmp', __dir__) before(:all) do prepare_destinati...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-specs/lib/rswag/route_parser.rb
rswag-specs/lib/rswag/route_parser.rb
# frozen_string_literal: true module Rswag class RouteParser attr_reader :controller def initialize(controller) @controller = controller end def routes ::Rails.application.routes.routes.select do |route| route.defaults[:controller] == controller end.each_with_object({}) do...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-specs/lib/rswag/specs.rb
rswag-specs/lib/rswag/specs.rb
# frozen_string_literal: true require 'rspec/core' require 'rswag/specs/example_group_helpers' require 'rswag/specs/example_helpers' require 'rswag/specs/configuration' require 'rswag/specs/railtie' if defined?(Rails::Railtie) module Rswag module Specs # Extend RSpec with a swagger-based DSL ::RSpec.configu...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-specs/lib/rswag/specs/example_group_helpers.rb
rswag-specs/lib/rswag/specs/example_group_helpers.rb
# frozen_string_literal: true require 'active_support' module Rswag module Specs module ExampleGroupHelpers def path(template, *tags, **metadata, &block) metadata[:path_item] = { template: template } describe(template, *tags, **metadata, &block) end %i[get post patch put delet...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-specs/lib/rswag/specs/openapi_formatter.rb
rswag-specs/lib/rswag/specs/openapi_formatter.rb
# frozen_string_literal: true require 'active_support/core_ext/hash/deep_merge' require 'rspec/core/formatters/base_text_formatter' require 'openapi_helper' module Rswag module Specs class OpenapiFormatter < ::RSpec::Core::Formatters::BaseTextFormatter ::RSpec::Core::Formatters.register self, :example_gro...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-specs/lib/rswag/specs/example_helpers.rb
rswag-specs/lib/rswag/specs/example_helpers.rb
# frozen_string_literal: true require 'rswag/specs/request_factory' require 'rswag/specs/response_validator' module Rswag module Specs module ExampleHelpers def submit_request(metadata) request = RequestFactory.new(metadata, self).build_request send( request[:verb], re...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-specs/lib/rswag/specs/railtie.rb
rswag-specs/lib/rswag/specs/railtie.rb
# frozen_string_literal: true module Rswag module Specs class Railtie < ::Rails::Railtie rake_tasks do load File.expand_path('../../tasks/rswag-specs_tasks.rake', __dir__) end generators do require 'generators/rspec/openapi_generator' end end end end
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-specs/lib/rswag/specs/configuration.rb
rswag-specs/lib/rswag/specs/configuration.rb
# frozen_string_literal: true module Rswag module Specs class Configuration def initialize(rspec_config) @rspec_config = rspec_config end def openapi_root @openapi_root ||= @rspec_config.openapi_root || raise(ConfigurationError, 'No openapi_root provided. See openapi_...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-specs/lib/rswag/specs/response_validator.rb
rswag-specs/lib/rswag/specs/response_validator.rb
# frozen_string_literal: true require 'active_support/core_ext/enumerable' require 'active_support/core_ext/hash/slice' require 'json-schema' require 'json' require 'rswag/specs/extended_schema' module Rswag module Specs class ResponseValidator def initialize(config = ::Rswag::Specs.config) @confi...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-specs/lib/rswag/specs/extended_schema.rb
rswag-specs/lib/rswag/specs/extended_schema.rb
# frozen_string_literal: true require 'json-schema' module Rswag module Specs class ExtendedSchema < JSON::Schema::Draft4 def initialize super @uri = URI.parse('http://tempuri.org/rswag/specs/extended_schema') @names = ['http://tempuri.org/rswag/specs/extended_schema'] end ...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-specs/lib/rswag/specs/request_factory.rb
rswag-specs/lib/rswag/specs/request_factory.rb
# frozen_string_literal: true require 'active_support' require 'active_support/core_ext/hash/slice' require 'active_support/core_ext/hash/conversions' require 'json' module Rswag module Specs class RequestFactory attr_accessor :example, :metadata, :params, :headers def initialize(metadata, example,...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-specs/lib/generators/rspec/openapi_generator.rb
rswag-specs/lib/generators/rspec/openapi_generator.rb
# frozen_string_literal: true require 'rswag/route_parser' require 'rails/generators' module Rspec class OpenapiGenerator < ::Rails::Generators::NamedBase source_root File.expand_path('templates', __dir__) class_option :spec_path, type: :string, default: 'requests' def setup @routes = Rswag::Rout...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-specs/lib/generators/rspec/templates/spec.rb
rswag-specs/lib/generators/rspec/templates/spec.rb
require 'openapi_helper' RSpec.describe '<%= controller_path %>', type: :request do <% @routes.each do | template, path_item | %> path '<%= template %>' do <% unless path_item[:params].empty? -%> # You'll want to customize the parameter types... <% path_item[:params].each do |param| -%> parameter na...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-specs/lib/generators/rswag/specs/install/install_generator.rb
rswag-specs/lib/generators/rswag/specs/install/install_generator.rb
# frozen_string_literal: true require 'rails/generators' module Rswag module Specs class InstallGenerator < Rails::Generators::Base source_root File.expand_path('templates', __dir__) def add_openapi_helper template('openapi_helper.rb', 'spec/openapi_helper.rb') end end end end
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-specs/lib/generators/rswag/specs/install/templates/openapi_helper.rb
rswag-specs/lib/generators/rswag/specs/install/templates/openapi_helper.rb
# frozen_string_literal: true require 'rails_helper' RSpec.configure do |config| # Specify a root folder where OpenAPI JSON files are generated # NOTE: If you're using the rswag-api to serve API descriptions, you'll need # to ensure that it's configured to serve OpenAPI from the same folder config.openapi_roo...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-ui/spec/spec_helper.rb
rswag-ui/spec/spec_helper.rb
# frozen_string_literal: true require 'simplecov' # This file was generated by the `rspec --init` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # The generated `.rspec` file contains `--require spec_helper` which will cause # this file to always be loaded, w...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-ui/spec/rswag/ui/configuration_spec.rb
rswag-ui/spec/rswag/ui/configuration_spec.rb
# frozen_string_literal: true require 'rswag/ui/configuration' require_relative '../../spec_helper' RSpec.describe Rswag::Ui::Configuration do describe '#openapi_endpoints' describe '#basic_auth_enabled' do context 'when unspecified' do it 'defaults to false' do configuration = described_class...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-ui/spec/generators/rswag/ui/custom_generator_spec.rb
rswag-ui/spec/generators/rswag/ui/custom_generator_spec.rb
# frozen_string_literal: true require 'generator_spec' require 'generators/rswag/ui/custom/custom_generator' module Rswag module Ui describe CustomGenerator do include GeneratorSpec::TestCase destination File.expand_path('tmp', __dir__) before(:all) do prepare_destination run_...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-ui/spec/generators/rswag/ui/install_generator_spec.rb
rswag-ui/spec/generators/rswag/ui/install_generator_spec.rb
# frozen_string_literal: true require 'generator_spec' require 'generators/rswag/ui/install/install_generator' module Rswag module Ui describe InstallGenerator do include GeneratorSpec::TestCase destination File.expand_path('tmp', __dir__) before(:all) do prepare_destination f...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-ui/spec/generators/rswag/ui/fixtures/config/routes.rb
rswag-ui/spec/generators/rswag/ui/fixtures/config/routes.rb
# frozen_string_literal: true TestApp::Application.routes.draw do end
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-ui/lib/rswag/ui.rb
rswag-ui/lib/rswag/ui.rb
# frozen_string_literal: true require 'rswag/ui/configuration' require 'rswag/ui/engine' module Rswag module Ui def self.configure yield(config) end def self.config @config ||= Configuration.new end end end
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-ui/lib/rswag/ui/middleware.rb
rswag-ui/lib/rswag/ui/middleware.rb
# frozen_string_literal: true module Rswag module Ui class Middleware < Rack::Static def initialize(app, config) @config = config super(app, urls: [''], root: config.assets_root) end def call(env) if base_path?(env) redirect_uri = "#{env['SCRIPT_NAME'].chomp('...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-ui/lib/rswag/ui/basic_auth.rb
rswag-ui/lib/rswag/ui/basic_auth.rb
# frozen_string_literal: true require 'rack/auth/basic' module Rswag module Ui # Extend Rack HTTP Basic Authentication, as per RFC 2617. # @api private # class BasicAuth < ::Rack::Auth::Basic def call(env) return @app.call(env) unless env_matching_path(env) super(env) en...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-ui/lib/rswag/ui/configuration.rb
rswag-ui/lib/rswag/ui/configuration.rb
# frozen_string_literal: true require 'ostruct' require 'rack' module Rswag module Ui class Configuration attr_reader :template_locations, :assets_root attr_accessor :basic_auth_enabled, :config_object, :oauth_config_object def initialize @template_locations = [ # preferred ...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-ui/lib/rswag/ui/engine.rb
rswag-ui/lib/rswag/ui/engine.rb
# frozen_string_literal: true require 'rswag/ui/middleware' require 'rswag/ui/basic_auth' module Rswag module Ui class Engine < ::Rails::Engine isolate_namespace Rswag::Ui initializer 'rswag-ui.initialize' do |app| middleware.use Rswag::Ui::Middleware, Rswag::Ui.config if Rswag::Ui...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-ui/lib/generators/rswag/ui/custom/custom_generator.rb
rswag-ui/lib/generators/rswag/ui/custom/custom_generator.rb
# frozen_string_literal: true require 'rails/generators' module Rswag module Ui class CustomGenerator < Rails::Generators::Base source_root File.expand_path('../../../../../lib/rswag/ui', __dir__) def add_custom_index copy_file('index.erb', 'app/views/rswag/ui/home/index.html.erb') en...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-ui/lib/generators/rswag/ui/install/install_generator.rb
rswag-ui/lib/generators/rswag/ui/install/install_generator.rb
# frozen_string_literal: true require 'rails/generators' module Rswag module Ui class InstallGenerator < Rails::Generators::Base source_root File.expand_path('templates', __dir__) def add_initializer template('rswag_ui.rb', 'config/initializers/rswag_ui.rb') end def add_routes ...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/rswag-ui/lib/generators/rswag/ui/install/templates/rswag_ui.rb
rswag-ui/lib/generators/rswag/ui/install/templates/rswag_ui.rb
# frozen_string_literal: true Rswag::Ui.configure do |c| # List the Swagger endpoints that you want to be documented through the # swagger-ui. The first parameter is the path (absolute or relative to the UI # host) to the corresponding endpoint and the second is a title that will be # displayed in the document...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/test-app/app/helpers/stubs_helper.rb
test-app/app/helpers/stubs_helper.rb
# frozen_string_literal: true module StubsHelper end
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/test-app/app/controllers/blogs_controller.rb
test-app/app/controllers/blogs_controller.rb
# frozen_string_literal: true require 'fileutils' class BlogsController < ApplicationController # POST /blogs def create @blog = Blog.create(params.require(:blog).permit(:title, :content)) respond_with @blog end # POST /blogs/flexible def flexible_create # contrived example to play around with ...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/test-app/app/controllers/auth_tests_controller.rb
test-app/app/controllers/auth_tests_controller.rb
# frozen_string_literal: true class AuthTestsController < ApplicationController # POST /auth-tests/basic def basic return head :unauthorized unless authenticate_basic head :no_content end # POST /auth-tests/api-key def api_key return head :unauthorized unless authenticate_api_key head :no_...
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false
rswag/rswag
https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/test-app/app/controllers/stubs_controller.rb
test-app/app/controllers/stubs_controller.rb
# frozen_string_literal: true class StubsController < ApplicationController def index render plain: 'OK' end def create render plain: 'OK' end def show render plain: 'OK' end end
ruby
MIT
0a5a04983b5fe16f1698f2acf7ec787bf08ebf08
2026-01-04T15:57:26.551519Z
false