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
rahmal/rconfig
https://github.com/rahmal/rconfig/blob/3b829194a54c25f6385152469cb3a2978e1742a1/spec/spec_helper.rb
spec/spec_helper.rb
ROOT_DIR = File.expand_path(File.dirname(__FILE__)) CONF_DIR = File.join(ROOT_DIR, 'config') # Set the environment to test ENV['CONFIG_ENV'] = 'test' # Host-specific config to test cascade logic cascade_host_file = File.join(File.dirname(__FILE__),'config',"cascade2_#{Socket.gethostname}.yml") unless File.exist?(casc...
ruby
MIT
3b829194a54c25f6385152469cb3a2978e1742a1
2026-01-04T17:40:43.421770Z
false
rahmal/rconfig
https://github.com/rahmal/rconfig/blob/3b829194a54c25f6385152469cb3a2978e1742a1/spec/rconfig/reload_spec.rb
spec/rconfig/reload_spec.rb
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe RConfig do before :each do RConfig.load_paths = ['spec/config'] end context 'reload' do it 'should reload when path is added' do RConfig.should_receive(:reload).with(true).and_return(true) RConfig.add_load_path('sp...
ruby
MIT
3b829194a54c25f6385152469cb3a2978e1742a1
2026-01-04T17:40:43.421770Z
false
rahmal/rconfig
https://github.com/rahmal/rconfig/blob/3b829194a54c25f6385152469cb3a2978e1742a1/spec/rconfig/cascade_spec.rb
spec/rconfig/cascade_spec.rb
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe RConfig do before :each do RConfig.load_paths = ['spec/config'] end context 'cascading configs' do it 'should set ENV_TIER from CONFIG_ENV' do RConfig::Constants::ENV_TIER.should == ENV['CONFIG_ENV'] end it 'sho...
ruby
MIT
3b829194a54c25f6385152469cb3a2978e1742a1
2026-01-04T17:40:43.421770Z
false
rahmal/rconfig
https://github.com/rahmal/rconfig/blob/3b829194a54c25f6385152469cb3a2978e1742a1/spec/rconfig/load_paths_spec.rb
spec/rconfig/load_paths_spec.rb
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe RConfig do before :each do RConfig.load_paths = ['spec/config'] end context 'load paths' do it 'should have a valid load path' do RConfig.load_paths.should_not be_blank RConfig.load_paths.all?{|path| File.exists?(p...
ruby
MIT
3b829194a54c25f6385152469cb3a2978e1742a1
2026-01-04T17:40:43.421770Z
false
rahmal/rconfig
https://github.com/rahmal/rconfig/blob/3b829194a54c25f6385152469cb3a2978e1742a1/lib/rconfig.rb
lib/rconfig.rb
## # # Copyright (c) 2009 Rahmal Conda <rahmal@gmail.com> # ------------------------------------------------------------------- # The complete solution for Ruby Configuration Management. RConfig is a Ruby library that # manages configuration within Ruby applications. It bridges the gap between yaml, xml, and # key/valu...
ruby
MIT
3b829194a54c25f6385152469cb3a2978e1742a1
2026-01-04T17:40:43.421770Z
false
rahmal/rconfig
https://github.com/rahmal/rconfig/blob/3b829194a54c25f6385152469cb3a2978e1742a1/lib/generators/rconfig/install_generator.rb
lib/generators/rconfig/install_generator.rb
module RConfig module Generators class InstallGenerator < Rails::Generators::Base namespace 'rconfig:install' source_root File.expand_path('../templates', __FILE__) desc 'Create RConfig settings initializer file' def copy_initializer template 'rconfig.rb', 'config/initializers/rco...
ruby
MIT
3b829194a54c25f6385152469cb3a2978e1742a1
2026-01-04T17:40:43.421770Z
false
rahmal/rconfig
https://github.com/rahmal/rconfig/blob/3b829194a54c25f6385152469cb3a2978e1742a1/lib/generators/rconfig/templates/rconfig.rb
lib/generators/rconfig/templates/rconfig.rb
# Use this hook to configure rconfig mailer, warden hooks and so forth. The first # four configuration values can also be set straight in your models. RConfig.setup do |config| # ==> Configuration File Load Paths # The list of directories from which to load configuration files. # If This is a Rails Application, ...
ruby
MIT
3b829194a54c25f6385152469cb3a2978e1742a1
2026-01-04T17:40:43.421770Z
false
rahmal/rconfig
https://github.com/rahmal/rconfig/blob/3b829194a54c25f6385152469cb3a2978e1742a1/lib/rconfig/core_methods.rb
lib/rconfig/core_methods.rb
## # Copyright (c) 2009 Rahmal Conda <rahmal@gmail.com> # module RConfig module CoreMethods include Constants ## # Get each config file's yaml hash for the given config name, # to be merged later. Files will only be loaded if they have # not been loaded before or the files have changed within the...
ruby
MIT
3b829194a54c25f6385152469cb3a2978e1742a1
2026-01-04T17:40:43.421770Z
false
rahmal/rconfig
https://github.com/rahmal/rconfig/blob/3b829194a54c25f6385152469cb3a2978e1742a1/lib/rconfig/reload.rb
lib/rconfig/reload.rb
module RConfig module Reload ## # Flag indicating whether or not reload should be executed. def reload? self.enable_reload end def reload_disabled? not reload? end ## # Sets the flag indicating whether or not reload should be executed. def enable_reload=(reload) ...
ruby
MIT
3b829194a54c25f6385152469cb3a2978e1742a1
2026-01-04T17:40:43.421770Z
false
rahmal/rconfig
https://github.com/rahmal/rconfig/blob/3b829194a54c25f6385152469cb3a2978e1742a1/lib/rconfig/load_paths.rb
lib/rconfig/load_paths.rb
module RConfig module LoadPaths include Constants ## # Sets the list of directories to search for # configuration files. # The argument must be an array of strings representing # the paths to the directories, or a string representing # either a single path or a list of paths separated by ...
ruby
MIT
3b829194a54c25f6385152469cb3a2978e1742a1
2026-01-04T17:40:43.421770Z
false
rahmal/rconfig
https://github.com/rahmal/rconfig/blob/3b829194a54c25f6385152469cb3a2978e1742a1/lib/rconfig/exceptions.rb
lib/rconfig/exceptions.rb
## # Copyright (c) 2009 Rahmal Conda <rahmal@gmail.com> # # RConfig Exceptions # module RConfig # General error in config initialization or operation. class ConfigError < StandardError; end # Load path(s) are not set, don't exist, or Invalid in some manner class InvalidLoadPathError < ConfigError; end modul...
ruby
MIT
3b829194a54c25f6385152469cb3a2978e1742a1
2026-01-04T17:40:43.421770Z
false
rahmal/rconfig
https://github.com/rahmal/rconfig/blob/3b829194a54c25f6385152469cb3a2978e1742a1/lib/rconfig/cascade.rb
lib/rconfig/cascade.rb
module RConfig module Cascade include Constants ## # Sets a custome overlay for def overlay=(value) reload(false) if self.overlay != value self.overlay = value && value.dup.freeze end ## # Returns a list of suffixes to try for a given config name. # # A config name wi...
ruby
MIT
3b829194a54c25f6385152469cb3a2978e1742a1
2026-01-04T17:40:43.421770Z
false
rahmal/rconfig
https://github.com/rahmal/rconfig/blob/3b829194a54c25f6385152469cb3a2978e1742a1/lib/rconfig/logger.rb
lib/rconfig/logger.rb
module RConfig class Logger #:nodoc: attr_accessor :level, :log_format, :date_format attr_reader :output FATAL = 4 ERROR = 3 WARN = 2 INFO = 1 DEBUG = 0 MAX_LEVEL = 4 def initialize(options={}) # Use provided output if output = options[:ou...
ruby
MIT
3b829194a54c25f6385152469cb3a2978e1742a1
2026-01-04T17:40:43.421770Z
false
rahmal/rconfig
https://github.com/rahmal/rconfig/blob/3b829194a54c25f6385152469cb3a2978e1742a1/lib/rconfig/utils.rb
lib/rconfig/utils.rb
module RConfig module Utils include Constants # Used to customize configuration of RConfig. Run 'rails generate rconfig:install' to create # a fresh initializer with all configuration values. def setup yield self raise_load_path_error if load_paths.empty? self.logger ||= DisabledLog...
ruby
MIT
3b829194a54c25f6385152469cb3a2978e1742a1
2026-01-04T17:40:43.421770Z
false
rahmal/rconfig
https://github.com/rahmal/rconfig/blob/3b829194a54c25f6385152469cb3a2978e1742a1/lib/rconfig/callbacks.rb
lib/rconfig/callbacks.rb
module RConfig module Callbacks ## # Register a callback when a config has been reloaded. If no config name # is specified, the callback will be registered under the name :ANY. The # name :ANY will register a callback for any config file change. # # Example: # # class MyClass # ...
ruby
MIT
3b829194a54c25f6385152469cb3a2978e1742a1
2026-01-04T17:40:43.421770Z
false
rahmal/rconfig
https://github.com/rahmal/rconfig/blob/3b829194a54c25f6385152469cb3a2978e1742a1/lib/rconfig/constants.rb
lib/rconfig/constants.rb
module RConfig module Constants # Sets CONFIG_ROOT to RAILS_ROOT/config unless it has already # been defined (i.e. in rails env, or calling ruby app). CONFIG_ROOT = File.join(::Rails.root || '', 'config').gsub(/^\//, '').gsub(/\/$/,'') if defined?(::Rails) && !defined?(CONFIG_ROOT) # ENV TIER i.e. (...
ruby
MIT
3b829194a54c25f6385152469cb3a2978e1742a1
2026-01-04T17:40:43.421770Z
false
rahmal/rconfig
https://github.com/rahmal/rconfig/blob/3b829194a54c25f6385152469cb3a2978e1742a1/lib/rconfig/settings.rb
lib/rconfig/settings.rb
module RConfig module Settings extend Utils include Constants ### Configuration Settings ====> # Load paths for configuration files. Add folders to this load path # to load up other resources for administration. External gems can # include their paths in this load path to provide active_admi...
ruby
MIT
3b829194a54c25f6385152469cb3a2978e1742a1
2026-01-04T17:40:43.421770Z
false
rahmal/rconfig
https://github.com/rahmal/rconfig/blob/3b829194a54c25f6385152469cb3a2978e1742a1/lib/rconfig/config.rb
lib/rconfig/config.rb
## # Copyright (c) 2009 Rahmal Conda <rahmal@gmail.com> # # Config is a special class, derived from HashWithIndifferentAccess. # It was specifically created for handling config data or creating mock # objects from yaml files. It provides a dotted notation for accessing # embedded hash values, similar to the way one m...
ruby
MIT
3b829194a54c25f6385152469cb3a2978e1742a1
2026-01-04T17:40:43.421770Z
false
rahmal/rconfig
https://github.com/rahmal/rconfig/blob/3b829194a54c25f6385152469cb3a2978e1742a1/lib/rconfig/properties_file.rb
lib/rconfig/properties_file.rb
## # Copyright (c) 2009 Rahmal Conda <rahmal@gmail.com> # # This class parses key/value based properties files used for configuration. # It is used by rconfig to import configuration files of the aforementioned # format. Unlike yaml, and xml files it can only support three levels. First, # it can have root level proper...
ruby
MIT
3b829194a54c25f6385152469cb3a2978e1742a1
2026-01-04T17:40:43.421770Z
false
rahmal/rconfig
https://github.com/rahmal/rconfig/blob/3b829194a54c25f6385152469cb3a2978e1742a1/lib/rconfig/core_ext/array.rb
lib/rconfig/core_ext/array.rb
class Array alias_method :blank?, :empty? end
ruby
MIT
3b829194a54c25f6385152469cb3a2978e1742a1
2026-01-04T17:40:43.421770Z
false
rahmal/rconfig
https://github.com/rahmal/rconfig/blob/3b829194a54c25f6385152469cb3a2978e1742a1/lib/rconfig/core_ext/string.rb
lib/rconfig/core_ext/string.rb
class String alias_method :blank?, :empty? end
ruby
MIT
3b829194a54c25f6385152469cb3a2978e1742a1
2026-01-04T17:40:43.421770Z
false
rahmal/rconfig
https://github.com/rahmal/rconfig/blob/3b829194a54c25f6385152469cb3a2978e1742a1/lib/rconfig/core_ext/nil.rb
lib/rconfig/core_ext/nil.rb
class NilClass def blank? true end end
ruby
MIT
3b829194a54c25f6385152469cb3a2978e1742a1
2026-01-04T17:40:43.421770Z
false
rahmal/rconfig
https://github.com/rahmal/rconfig/blob/3b829194a54c25f6385152469cb3a2978e1742a1/lib/rconfig/core_ext/hash.rb
lib/rconfig/core_ext/hash.rb
## # source: http://rubyforge.org/projects/facets/ # version: 1.7.46 # license: Ruby License # NOTE: remove this method if the Facets gem is installed. # BUG: weave is destructive to values in the source hash that are arrays! # (this is acceptable for RConfig's use as the basis for weave!) # # class Hash ## #...
ruby
MIT
3b829194a54c25f6385152469cb3a2978e1742a1
2026-01-04T17:40:43.421770Z
false
rahmal/rconfig
https://github.com/rahmal/rconfig/blob/3b829194a54c25f6385152469cb3a2978e1742a1/demo/demo.rb
demo/demo.rb
#!/usr/bin/env ruby $LOAD_PATH << File.join(File.dirname(__FILE__),"..","lib") require 'rconfig' dir = File.dirname(__FILE__) puts "Current Dir: " + dir puts "RConfig.add_config_path File.dirname(__FILE__) => #{RConfig.add_config_path(dir)}" puts "RConfig.demo[:admin_email] => #{RConfig.demo[:admin_email]}" ...
ruby
MIT
3b829194a54c25f6385152469cb3a2978e1742a1
2026-01-04T17:40:43.421770Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/app/controllers/fake_controller.rb
app/controllers/fake_controller.rb
class FakeController < ApplicationController def data result = FakeApi::Handler.handle( request.method, path: params[:path], params: params, headers: request.headers, cookies: cookies, session: session ) response.status = result.status result.headers.each { |k, v...
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/test_helper.rb
test/test_helper.rb
# Configure Rails Environment ENV["RAILS_ENV"] = "test" require 'simplecov' SimpleCov.start require_relative "../test/dummy/config/environment" ActiveRecord::Migrator.migrations_paths = [File.expand_path("../test/dummy/db/migrate", __dir__)] require "rails/test_help" # Filter out the backtrace from minitest while pr...
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/fake_api_test.rb
test/fake_api_test.rb
require 'test_helper' class FakeApi::Test < ActiveSupport::TestCase test 'debug' do puts pp FakeApi::Debug.status assert FakeApi::Debug.status.present? end end
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/fake_api_controller_test.rb
test/fake_api_controller_test.rb
require 'test_helper' class FakeApiControllerTest < ActionDispatch::IntegrationTest test "should projects.json" do get '/api/projects.json' assert_response :success assert response.body.include?('[{"id":') assert_equal response.status, 202 assert_equal response.headers["TOKEN"], "SECRET" end ...
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/dummy/app/fake_api/projects_routing.rb
test/dummy/app/fake_api/projects_routing.rb
class ProjectsRouting < FakeApi::Routing get('/projects') .and_return { create_list(:project, 5) } .with_status(202) .with_headers({TOKEN: "SECRET"}) get(%r{/projects/\d+$}).and_return { object(:project) } post('/projects').and_return { object(:project).merge({created: 'ok'}) } delete(%r{/project...
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/dummy/app/fake_api/login_routing.rb
test/dummy/app/fake_api/login_routing.rb
class LoginRouting < FakeApi::Routing post('/auth') .and_return { { status: "OK" } } .with_cookies({x: "A"}) .with_session({y: "B"}) .with_headers({token: "C"}) get('/return-js').and_return do "alert('returned from fake_api');" end end
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/dummy/app/fake_api/factory.rb
test/dummy/app/fake_api/factory.rb
class Factory < FakeApi::Factoring factory(:user) do { id: rand(100), first_name: Faker::Name.first_name, age: rand(100) } end factory(:project) do { id: rand(1_000), title: Faker::Company.name, description: Faker::Company.catch_phrase, type: Faker::Company....
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/dummy/app/fake_api/status_routing.rb
test/dummy/app/fake_api/status_routing.rb
class StatusRouting < FakeApi::Routing post('/post-status').and_return do { created: 'ok', status: Project.count, data: object(:complex) } end get('/hash').and_return do { status: "OK" } end end
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/dummy/app/jobs/application_job.rb
test/dummy/app/jobs/application_job.rb
class ApplicationJob < ActiveJob::Base # Automatically retry jobs that encountered a deadlock # retry_on ActiveRecord::Deadlocked # Most jobs are safe to ignore if the underlying records are no longer available # discard_on ActiveJob::DeserializationError end
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/dummy/app/helpers/application_helper.rb
test/dummy/app/helpers/application_helper.rb
module ApplicationHelper end
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/dummy/app/helpers/home_helper.rb
test/dummy/app/helpers/home_helper.rb
module HomeHelper end
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/dummy/app/controllers/home_controller.rb
test/dummy/app/controllers/home_controller.rb
class HomeController < ApplicationController def index end end
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/dummy/app/controllers/application_controller.rb
test/dummy/app/controllers/application_controller.rb
class ApplicationController < ActionController::Base end
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/dummy/app/models/project.rb
test/dummy/app/models/project.rb
class Project < ApplicationRecord end
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/dummy/app/models/application_record.rb
test/dummy/app/models/application_record.rb
class ApplicationRecord < ActiveRecord::Base self.abstract_class = true end
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/dummy/app/mailers/application_mailer.rb
test/dummy/app/mailers/application_mailer.rb
class ApplicationMailer < ActionMailer::Base default from: 'from@example.com' layout 'mailer' end
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/dummy/app/channels/application_cable/channel.rb
test/dummy/app/channels/application_cable/channel.rb
module ApplicationCable class Channel < ActionCable::Channel::Base end end
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/dummy/app/channels/application_cable/connection.rb
test/dummy/app/channels/application_cable/connection.rb
module ApplicationCable class Connection < ActionCable::Connection::Base end end
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/dummy/db/schema.rb
test/dummy/db/schema.rb
# This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # This file is the source Rails uses to define your schema when running `rails #...
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/dummy/db/migrate/20200212150637_create_projects.rb
test/dummy/db/migrate/20200212150637_create_projects.rb
class CreateProjects < ActiveRecord::Migration[6.0] def change create_table :projects do |t| t.string :title t.string :description t.timestamps end end end
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/dummy/config/application.rb
test/dummy/config/application.rb
require_relative 'boot' require 'rails/all' Bundler.require(*Rails.groups) require "fake_api" module Dummy class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. config.load_defaults 6.0 config.hosts.clear # Settings in config/environmen...
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/dummy/config/environment.rb
test/dummy/config/environment.rb
# Load the Rails application. require_relative 'application' # Initialize the Rails application. Rails.application.initialize!
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/dummy/config/puma.rb
test/dummy/config/puma.rb
# Puma can serve each request in a thread from an internal thread pool. # The `threads` method setting takes two numbers: a minimum and maximum. # Any libraries that use thread pools should be configured to match # the maximum value specified for Puma. Default is set to 5 threads for minimum # and maximum; this matches...
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/dummy/config/routes.rb
test/dummy/config/routes.rb
Rails.application.routes.draw do mount FakeApi::Engine => '/api' root to: 'home#index' end
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/dummy/config/spring.rb
test/dummy/config/spring.rb
Spring.watch( ".ruby-version", ".rbenv-vars", "tmp/restart.txt", "tmp/caching-dev.txt" )
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/dummy/config/boot.rb
test/dummy/config/boot.rb
# Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__) require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) $LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/dummy/config/initializers/content_security_policy.rb
test/dummy/config/initializers/content_security_policy.rb
# Be sure to restart your server when you modify this file. # Define an application-wide content security policy # For further information see the following documentation # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy # Rails.application.config.content_security_policy do |policy| ...
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/dummy/config/initializers/filter_parameter_logging.rb
test/dummy/config/initializers/filter_parameter_logging.rb
# Be sure to restart your server when you modify this file. # Configure sensitive parameters which will be filtered from the log file. Rails.application.config.filter_parameters += [:password]
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/dummy/config/initializers/application_controller_renderer.rb
test/dummy/config/initializers/application_controller_renderer.rb
# Be sure to restart your server when you modify this file. # ActiveSupport::Reloader.to_prepare do # ApplicationController.renderer.defaults.merge!( # http_host: 'example.org', # https: false # ) # end
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/dummy/config/initializers/wrap_parameters.rb
test/dummy/config/initializers/wrap_parameters.rb
# Be sure to restart your server when you modify this file. # This file contains settings for ActionController::ParamsWrapper which # is enabled by default. # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. ActiveSupport.on_load(:action_controller) do wrap_parameters f...
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/dummy/config/initializers/inflections.rb
test/dummy/config/initializers/inflections.rb
# Be sure to restart your server when you modify this file. # Add new inflection rules using the following format. Inflections # are locale specific, and you may define rules for as many different # locales as you wish. All of these examples are active by default: # ActiveSupport::Inflector.inflections(:en) do |inflec...
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/dummy/config/initializers/cookies_serializer.rb
test/dummy/config/initializers/cookies_serializer.rb
# Be sure to restart your server when you modify this file. # Specify a serializer for the signed and encrypted cookie jars. # Valid options are :json, :marshal, and :hybrid. Rails.application.config.action_dispatch.cookies_serializer = :json
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/dummy/config/initializers/assets.rb
test/dummy/config/initializers/assets.rb
# Be sure to restart your server when you modify this file. # Version of your assets, change this if you want to expire all your assets. Rails.application.config.assets.version = '1.0' # Add additional assets to the asset load path. # Rails.application.config.assets.paths << Emoji.images_path # Precompile additional...
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/dummy/config/initializers/backtrace_silencers.rb
test/dummy/config/initializers/backtrace_silencers.rb
# Be sure to restart your server when you modify this file. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } # You can also remove all the silencers if you're trying to debug a probl...
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/dummy/config/initializers/mime_types.rb
test/dummy/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
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/dummy/config/environments/test.rb
test/dummy/config/environments/test.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 suite and is wiped # and recreated between test runs. Don't rely on the data there! Rails.application.configure do # Settings...
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/dummy/config/environments/development.rb
test/dummy/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
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/test/dummy/config/environments/production.rb
test/dummy/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
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/lib/fake_api.rb
lib/fake_api.rb
require "fake_api/engine" require "faker" require "ostruct" require_relative './fake_api/data.rb' require_relative './fake_api/base.rb' require_relative './fake_api/route.rb' require_relative './fake_api/factory.rb' require_relative './fake_api/handler.rb' require_relative './fake_api/debug.rb' require_relative './ge...
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/lib/fake_api/data.rb
lib/fake_api/data.rb
module FakeApi class FakeApiData attr_reader :responses, :routes def FakeApiData.instance @@instance ||= FakeApiData.new end def initialize @responses = {} @routes = {} end def factory(name, &block) response = Factory.new(name: name, value: block) @response...
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/lib/fake_api/version.rb
lib/fake_api/version.rb
module FakeApi VERSION = '0.9.1' end
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/lib/fake_api/route.rb
lib/fake_api/route.rb
module FakeApi class Route attr_reader :route, :response, :status, :headers, :cookies, :session def initialize(route:, response: nil, status: 200, headers: {}, cookies: {}, session: {}) @route = route @response = response @status = status @headers = headers @cookies = coo...
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/lib/fake_api/base.rb
lib/fake_api/base.rb
module FakeApi class Base mattr_accessor :data @@data = FakeApiData.instance class << self delegate_missing_to :data end end Routing = Base Factoring = Base Inline = Base end
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/lib/fake_api/debug.rb
lib/fake_api/debug.rb
module FakeApi class Debug def Debug.status result = {} result[:factories] = [] result[:responses] = {} FakeApiData.instance.responses.each do |name, response| result[:factories] << name end FakeApiData.instance.routes.each do |request_method, info| result[:...
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/lib/fake_api/handler.rb
lib/fake_api/handler.rb
module FakeApi class Handler def Handler.handle(method, path:, params: {}, headers: {}, session: {}, cookies: {}) if route = Handler.resolve(method, path) result( data: route.response.call, status: route.status, headers: route.headers, cookies: route.cookies,...
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/lib/fake_api/factory.rb
lib/fake_api/factory.rb
module FakeApi class Factory attr_reader :name, :value def initialize(name:, value: nil, &block) @name = name @value = value || block end def returns(new_value = nil, &block) @value = new_value || block self end end end
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/lib/fake_api/engine.rb
lib/fake_api/engine.rb
module FakeApi class Engine < ::Rails::Engine def Engine.mounted_in @mounted_in ||= FakeApi::Engine.routes.url_helpers.__test__test_path.gsub("/__test__test", '') end config.to_prepare do Engine.load_fake_api_dependencies end config.after_initialize do |app| app.config.paths.ad...
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/lib/fake_api/standalone.rb
lib/fake_api/standalone.rb
require "rails" require "fake_api" require "action_controller/railtie" require "active_support/railtie" class FakeApiApp < Rails::Application config.session_store :cookie_store, key: '_fake_session' config.secret_key_base = SecureRandom.hex(30) Rails.logger = Logger.new($stdout) config.hosts.clear en...
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/lib/generators/fake_api_generator.rb
lib/generators/fake_api_generator.rb
class FakeApiGenerator < Rails::Generators::Base source_root File.expand_path("templates", __dir__) def create_fake_api_file if file_name.blank? puts "Sample: rails g fake_api Product" exit end template 'routing.rb', File.join('app/fake_api', "#{file_name}_routing.rb") template 'factory...
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/lib/generators/templates/routing.rb
lib/generators/templates/routing.rb
class <%= class_name %>Routing < FakeApi::Routing get('/projects').and_return { create_list(:project, 5) }.with_status(202).with_headers({TOKEN: "SECRET"}) get(%r{/projects/\d+$}) .and_return { object(:project) } .with_cookies({x: "A"}) .with_session({y: "B"}) .with_headers({token: "C"}) ...
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/lib/generators/templates/factory.rb
lib/generators/templates/factory.rb
class <%= class_name %>Factory < FakeApi::Factoring factory(:user) do { id: rand(100), first_name: Faker::Name.first_name, last_name: Faker::Name.first_name, avatar_url: Faker::Avatar.image(size: '128x128') } end factory(:project) do { id: rand(1_000), title: Fake...
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
igorkasyanchuk/fake_api
https://github.com/igorkasyanchuk/fake_api/blob/179ce8189c81ecb5073ccb4387a03d38f7d500d6/config/routes.rb
config/routes.rb
FakeApi::Engine.routes.draw do match '/*path', to: 'fake#data', via: :all # to get mounted route get '/__test__test', to: 'fake#data', as: :__test__test end
ruby
MIT
179ce8189c81ecb5073ccb4387a03d38f7d500d6
2026-01-04T17:40:41.776875Z
false
ruby-grape/grape-active_model_serializers
https://github.com/ruby-grape/grape-active_model_serializers/blob/c985c86410eecbdb38c5f4a08c8e01344d67d2b5/spec/old_grape_ams_spec.rb
spec/old_grape_ams_spec.rb
require 'spec_helper' require 'support/models/user' require 'support/models/blog_post' require 'support/serializers/user_serializer' require 'support/serializers/blog_post_serializer' require 'grape-active_model_serializers' describe Grape::ActiveModelSerializers do let(:app) { Class.new(Grape::API) } subject { la...
ruby
MIT
c985c86410eecbdb38c5f4a08c8e01344d67d2b5
2026-01-04T17:41:05.144005Z
false
ruby-grape/grape-active_model_serializers
https://github.com/ruby-grape/grape-active_model_serializers/blob/c985c86410eecbdb38c5f4a08c8e01344d67d2b5/spec/spec_helper.rb
spec/spec_helper.rb
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'bundler' Bundler.setup :default, :test require 'active_model_serializers' require 'active_support/core_ext/hash/conversions' require 'active_support/json' require 'rspec' require 'rack/test' require ...
ruby
MIT
c985c86410eecbdb38c5f4a08c8e01344d67d2b5
2026-01-04T17:41:05.144005Z
false
ruby-grape/grape-active_model_serializers
https://github.com/ruby-grape/grape-active_model_serializers/blob/c985c86410eecbdb38c5f4a08c8e01344d67d2b5/spec/support/serializers/blog_post_serializer.rb
spec/support/serializers/blog_post_serializer.rb
class BlogPostSerializer < ActiveModel::Serializer attributes :title, :body end
ruby
MIT
c985c86410eecbdb38c5f4a08c8e01344d67d2b5
2026-01-04T17:41:05.144005Z
false
ruby-grape/grape-active_model_serializers
https://github.com/ruby-grape/grape-active_model_serializers/blob/c985c86410eecbdb38c5f4a08c8e01344d67d2b5/spec/support/serializers/user_serializer.rb
spec/support/serializers/user_serializer.rb
class UserSerializer < ActiveModel::Serializer attributes :first_name, :last_name end
ruby
MIT
c985c86410eecbdb38c5f4a08c8e01344d67d2b5
2026-01-04T17:41:05.144005Z
false
ruby-grape/grape-active_model_serializers
https://github.com/ruby-grape/grape-active_model_serializers/blob/c985c86410eecbdb38c5f4a08c8e01344d67d2b5/spec/support/serializers/v4/user_serializer.rb
spec/support/serializers/v4/user_serializer.rb
module V4 class UserSerializer < ActiveModel::Serializer attributes :first_name, :last_name, :email end end
ruby
MIT
c985c86410eecbdb38c5f4a08c8e01344d67d2b5
2026-01-04T17:41:05.144005Z
false
ruby-grape/grape-active_model_serializers
https://github.com/ruby-grape/grape-active_model_serializers/blob/c985c86410eecbdb38c5f4a08c8e01344d67d2b5/spec/support/serializers/v5/user_serializer.rb
spec/support/serializers/v5/user_serializer.rb
module V5 class UserSerializer < ActiveModel::Serializer attributes :first_name, :last_name, :email end end
ruby
MIT
c985c86410eecbdb38c5f4a08c8e01344d67d2b5
2026-01-04T17:41:05.144005Z
false
ruby-grape/grape-active_model_serializers
https://github.com/ruby-grape/grape-active_model_serializers/blob/c985c86410eecbdb38c5f4a08c8e01344d67d2b5/spec/support/serializers/v1/user_serializer.rb
spec/support/serializers/v1/user_serializer.rb
module V1 class UserSerializer < ActiveModel::Serializer attributes :first_name, :last_name, :email end end
ruby
MIT
c985c86410eecbdb38c5f4a08c8e01344d67d2b5
2026-01-04T17:41:05.144005Z
false
ruby-grape/grape-active_model_serializers
https://github.com/ruby-grape/grape-active_model_serializers/blob/c985c86410eecbdb38c5f4a08c8e01344d67d2b5/spec/support/serializers/v2/user_serializer.rb
spec/support/serializers/v2/user_serializer.rb
module V2 class UserSerializer < ActiveModel::Serializer attributes :first_name, :last_name, :email end end
ruby
MIT
c985c86410eecbdb38c5f4a08c8e01344d67d2b5
2026-01-04T17:41:05.144005Z
false
ruby-grape/grape-active_model_serializers
https://github.com/ruby-grape/grape-active_model_serializers/blob/c985c86410eecbdb38c5f4a08c8e01344d67d2b5/spec/support/serializers/v3/user_serializer.rb
spec/support/serializers/v3/user_serializer.rb
module V3 class UserSerializer < ActiveModel::Serializer attributes :first_name, :last_name, :email end end
ruby
MIT
c985c86410eecbdb38c5f4a08c8e01344d67d2b5
2026-01-04T17:41:05.144005Z
false
ruby-grape/grape-active_model_serializers
https://github.com/ruby-grape/grape-active_model_serializers/blob/c985c86410eecbdb38c5f4a08c8e01344d67d2b5/spec/support/models/blog_post.rb
spec/support/models/blog_post.rb
class BlogPost include ActiveModel::Serialization attr_accessor :title, :body def self.model_name to_s end def initialize(params = {}) params.each do |k, v| instance_variable_set("@#{k}", v) unless v.nil? end end end
ruby
MIT
c985c86410eecbdb38c5f4a08c8e01344d67d2b5
2026-01-04T17:41:05.144005Z
false
ruby-grape/grape-active_model_serializers
https://github.com/ruby-grape/grape-active_model_serializers/blob/c985c86410eecbdb38c5f4a08c8e01344d67d2b5/spec/support/models/user.rb
spec/support/models/user.rb
class User include ActiveModel::Serialization attr_accessor :first_name, :last_name, :password, :email def self.model_name to_s end def initialize(params = {}) params.each do |k, v| instance_variable_set("@#{k}", v) unless v.nil? end end end
ruby
MIT
c985c86410eecbdb38c5f4a08c8e01344d67d2b5
2026-01-04T17:41:05.144005Z
false
ruby-grape/grape-active_model_serializers
https://github.com/ruby-grape/grape-active_model_serializers/blob/c985c86410eecbdb38c5f4a08c8e01344d67d2b5/spec/support/api/users_api.rb
spec/support/api/users_api.rb
class UsersApi < Grape::API resource :users do desc 'all users' get do [User.new] end desc 'specified user' get '/:id' do User.new end end end
ruby
MIT
c985c86410eecbdb38c5f4a08c8e01344d67d2b5
2026-01-04T17:41:05.144005Z
false
ruby-grape/grape-active_model_serializers
https://github.com/ruby-grape/grape-active_model_serializers/blob/c985c86410eecbdb38c5f4a08c8e01344d67d2b5/spec/support/api/v4/users_api.rb
spec/support/api/v4/users_api.rb
module V4 class UsersApi < Grape::API resource :users do desc 'all users' get do [User.new] end desc 'specified user' get '/:id' do User.new end end end end
ruby
MIT
c985c86410eecbdb38c5f4a08c8e01344d67d2b5
2026-01-04T17:41:05.144005Z
false
ruby-grape/grape-active_model_serializers
https://github.com/ruby-grape/grape-active_model_serializers/blob/c985c86410eecbdb38c5f4a08c8e01344d67d2b5/spec/integration/sequel_spec.rb
spec/integration/sequel_spec.rb
require 'sequel' require 'spec_helper' describe 'Sequel Integration' do before do DB = Sequel.sqlite unless defined?(DB) DB.create_table(:users) do primary_key :id String :name end ActiveModelSerializers.config.adapter = :json app.format :json app.formatter :json, Grape::Formatter...
ruby
MIT
c985c86410eecbdb38c5f4a08c8e01344d67d2b5
2026-01-04T17:41:05.144005Z
false
ruby-grape/grape-active_model_serializers
https://github.com/ruby-grape/grape-active_model_serializers/blob/c985c86410eecbdb38c5f4a08c8e01344d67d2b5/spec/grape/active_model_serializers/options_builder_spec.rb
spec/grape/active_model_serializers/options_builder_spec.rb
require 'spec_helper' describe Grape::ActiveModelSerializers::OptionsBuilder do let(:resolver) { described_class.new(resource, env) } let(:resource) { User.new } let(:env) { { 'api.endpoint' => UsersApi.endpoints.first } } context '#options' do let(:options) { resolver.options } context 'meta options...
ruby
MIT
c985c86410eecbdb38c5f4a08c8e01344d67d2b5
2026-01-04T17:41:05.144005Z
false
ruby-grape/grape-active_model_serializers
https://github.com/ruby-grape/grape-active_model_serializers/blob/c985c86410eecbdb38c5f4a08c8e01344d67d2b5/spec/grape/active_model_serializers/serializer_resolver_spec.rb
spec/grape/active_model_serializers/serializer_resolver_spec.rb
require 'spec_helper' # asserts serializer resolution order: # 1. resource_defined_class # V1::UserSerializer # 2. collection_class # CollectionSerializer, V2::UserSerializer # 3. options[:serializer] # V3::UserSerializer # 4. namespace_inferred_class # V4::UserSerializer # 5. version_i...
ruby
MIT
c985c86410eecbdb38c5f4a08c8e01344d67d2b5
2026-01-04T17:41:05.144005Z
false
ruby-grape/grape-active_model_serializers
https://github.com/ruby-grape/grape-active_model_serializers/blob/c985c86410eecbdb38c5f4a08c8e01344d67d2b5/spec/features/grape-active_model_serializers/render_spec.rb
spec/features/grape-active_model_serializers/render_spec.rb
require 'spec_helper' require 'securerandom' describe '#render' do let(:app) { Class.new(Grape::API) } before do ActiveModelSerializers.config.adapter = :json app.format :json app.formatter :json, Grape::Formatter::ActiveModelSerializers end def get_resource_with(meta) url = "/#{SecureRandom....
ruby
MIT
c985c86410eecbdb38c5f4a08c8e01344d67d2b5
2026-01-04T17:41:05.144005Z
false
ruby-grape/grape-active_model_serializers
https://github.com/ruby-grape/grape-active_model_serializers/blob/c985c86410eecbdb38c5f4a08c8e01344d67d2b5/spec/grape-active_model_serializers/error_formatter_spec.rb
spec/grape-active_model_serializers/error_formatter_spec.rb
require 'spec_helper' require 'grape-active_model_serializers/error_formatter' describe Grape::ErrorFormatter::ActiveModelSerializers do subject { Grape::ErrorFormatter::ActiveModelSerializers } let(:backtrace) { ['Line:1'] } let(:options) { {} } let(:env) { { 'api.endpoint' => app.endpoints.first } } let(:o...
ruby
MIT
c985c86410eecbdb38c5f4a08c8e01344d67d2b5
2026-01-04T17:41:05.144005Z
false
ruby-grape/grape-active_model_serializers
https://github.com/ruby-grape/grape-active_model_serializers/blob/c985c86410eecbdb38c5f4a08c8e01344d67d2b5/spec/grape-active_model_serializers/formatter_spec.rb
spec/grape-active_model_serializers/formatter_spec.rb
require 'spec_helper' require 'grape-active_model_serializers/formatter' describe Grape::Formatter::ActiveModelSerializers do subject { Grape::Formatter::ActiveModelSerializers } describe 'serializer options from namespace' do let(:app) { Class.new(Grape::API) } before do app.format :json app...
ruby
MIT
c985c86410eecbdb38c5f4a08c8e01344d67d2b5
2026-01-04T17:41:05.144005Z
false
ruby-grape/grape-active_model_serializers
https://github.com/ruby-grape/grape-active_model_serializers/blob/c985c86410eecbdb38c5f4a08c8e01344d67d2b5/spec/grape-active_model_serializers/versioned_api_formatter_spec.rb
spec/grape-active_model_serializers/versioned_api_formatter_spec.rb
require 'spec_helper' require 'grape-active_model_serializers/formatter' describe Grape::Formatter::ActiveModelSerializers do describe 'with a versioned API' do subject { Grape::Formatter::ActiveModelSerializers } describe 'serializer options from namespace' do let(:app) { Class.new(Grape::API) } ...
ruby
MIT
c985c86410eecbdb38c5f4a08c8e01344d67d2b5
2026-01-04T17:41:05.144005Z
false
ruby-grape/grape-active_model_serializers
https://github.com/ruby-grape/grape-active_model_serializers/blob/c985c86410eecbdb38c5f4a08c8e01344d67d2b5/spec/grape-active_model_serializers/endpoint_extension_spec.rb
spec/grape-active_model_serializers/endpoint_extension_spec.rb
require 'spec_helper' describe 'Grape::EndpointExtension' do if Grape::Util.const_defined?('InheritableSetting') subject do Grape::Endpoint.new( Grape::Util::InheritableSetting.new, path: '/', method: 'foo' ) end else subject do Grape::Endpoint.new({}, path: '/...
ruby
MIT
c985c86410eecbdb38c5f4a08c8e01344d67d2b5
2026-01-04T17:41:05.144005Z
false
ruby-grape/grape-active_model_serializers
https://github.com/ruby-grape/grape-active_model_serializers/blob/c985c86410eecbdb38c5f4a08c8e01344d67d2b5/lib/grape-active_model_serializers.rb
lib/grape-active_model_serializers.rb
require 'active_model_serializers' require 'grape' require 'grape-active_model_serializers/endpoint_extension' require 'grape-active_model_serializers/error_formatter' require 'grape-active_model_serializers/formatter' require 'grape-active_model_serializers/serializer_resolver' require 'grape-active_model_serializers/...
ruby
MIT
c985c86410eecbdb38c5f4a08c8e01344d67d2b5
2026-01-04T17:41:05.144005Z
false
ruby-grape/grape-active_model_serializers
https://github.com/ruby-grape/grape-active_model_serializers/blob/c985c86410eecbdb38c5f4a08c8e01344d67d2b5/lib/grape-active_model_serializers/version.rb
lib/grape-active_model_serializers/version.rb
module Grape module ActiveModelSerializers VERSION = '2.0.2'.freeze end end
ruby
MIT
c985c86410eecbdb38c5f4a08c8e01344d67d2b5
2026-01-04T17:41:05.144005Z
false
ruby-grape/grape-active_model_serializers
https://github.com/ruby-grape/grape-active_model_serializers/blob/c985c86410eecbdb38c5f4a08c8e01344d67d2b5/lib/grape-active_model_serializers/endpoint_extension.rb
lib/grape-active_model_serializers/endpoint_extension.rb
# # Make the Grape::Endpoint quack like a ActionController # # This allows us to rely on the ActiveModel::Serializer#build_json method # to lookup the approriate serializer. # module Grape module EndpointExtension attr_accessor :controller_name def namespace_options if respond_to?(:inheritable_setting)...
ruby
MIT
c985c86410eecbdb38c5f4a08c8e01344d67d2b5
2026-01-04T17:41:05.144005Z
false