source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | recurly/recurly-client-ruby | https://github.com/recurly/recurly-client-ruby | lib/recurly/requests/external_charge_create.rb | Ruby | mit | 182 | v3-v2021-02-25 | 1,001 | # This file is automatically created by Recurly's OpenAPI generation process
# and thus any edits you make by hand will be lost. If you wish to make a
# change to this file, please create a Github issue explaining the changes you
# need and we will usher them to the appropriate places.
module Recurly
module Requests
... |
github | recurly/recurly-client-ruby | https://github.com/recurly/recurly-client-ruby | lib/recurly/requests/account_reference.rb | Ruby | mit | 182 | v3-v2021-02-25 | 551 | # This file is automatically created by Recurly's OpenAPI generation process
# and thus any edits you make by hand will be lost. If you wish to make a
# change to this file, please create a Github issue explaining the changes you
# need and we will usher them to the appropriate places.
module Recurly
module Requests
... |
github | recurly/recurly-client-ruby | https://github.com/recurly/recurly-client-ruby | lib/recurly/requests/account_external_subscription.rb | Ruby | mit | 182 | v3-v2021-02-25 | 590 | # This file is automatically created by Recurly's OpenAPI generation process
# and thus any edits you make by hand will be lost. If you wish to make a
# change to this file, please create a Github issue explaining the changes you
# need and we will usher them to the appropriate places.
module Recurly
module Requests
... |
github | recurly/recurly-client-ruby | https://github.com/recurly/recurly-client-ruby | lib/recurly/requests/invoice_create.rb | Ruby | mit | 182 | v3-v2021-02-25 | 5,934 | # This file is automatically created by Recurly's OpenAPI generation process
# and thus any edits you make by hand will be lost. If you wish to make a
# change to this file, please create a Github issue explaining the changes you
# need and we will usher them to the appropriate places.
module Recurly
module Requests
... |
github | recurly/recurly-client-ruby | https://github.com/recurly/recurly-client-ruby | lib/recurly/requests/external_payment_phase_base.rb | Ruby | mit | 182 | v3-v2021-02-25 | 1,770 | # This file is automatically created by Recurly's OpenAPI generation process
# and thus any edits you make by hand will be lost. If you wish to make a
# change to this file, please create a Github issue explaining the changes you
# need and we will usher them to the appropriate places.
module Recurly
module Requests
... |
github | recurly/recurly-client-ruby | https://github.com/recurly/recurly-client-ruby | lib/recurly/requests/add_on_pricing.rb | Ruby | mit | 182 | v3-v2021-02-25 | 1,113 | # This file is automatically created by Recurly's OpenAPI generation process
# and thus any edits you make by hand will be lost. If you wish to make a
# change to this file, please create a Github issue explaining the changes you
# need and we will usher them to the appropriate places.
module Recurly
module Requests
... |
github | recurly/recurly-client-ruby | https://github.com/recurly/recurly-client-ruby | lib/recurly/requests/address.rb | Ruby | mit | 182 | v3-v2021-02-25 | 1,356 | # This file is automatically created by Recurly's OpenAPI generation process
# and thus any edits you make by hand will be lost. If you wish to make a
# change to this file, please create a Github issue explaining the changes you
# need and we will usher them to the appropriate places.
module Recurly
module Requests
... |
github | recurly/recurly-client-ruby | https://github.com/recurly/recurly-client-ruby | lib/recurly/requests/account_acquisition_cost.rb | Ruby | mit | 182 | v3-v2021-02-25 | 674 | # This file is automatically created by Recurly's OpenAPI generation process
# and thus any edits you make by hand will be lost. If you wish to make a
# change to this file, please create a Github issue explaining the changes you
# need and we will usher them to the appropriate places.
module Recurly
module Requests
... |
github | recurly/recurly-client-ruby | https://github.com/recurly/recurly-client-ruby | lib/recurly/requests/add_on_create.rb | Ruby | mit | 182 | v3-v2021-02-25 | 10,188 | # This file is automatically created by Recurly's OpenAPI generation process
# and thus any edits you make by hand will be lost. If you wish to make a
# change to this file, please create a Github issue explaining the changes you
# need and we will usher them to the appropriate places.
module Recurly
module Requests
... |
github | recurly/recurly-client-ruby | https://github.com/recurly/recurly-client-ruby | lib/recurly/requests/subscription_shipping_create.rb | Ruby | mit | 182 | v3-v2021-02-25 | 1,660 | # This file is automatically created by Recurly's OpenAPI generation process
# and thus any edits you make by hand will be lost. If you wish to make a
# change to this file, please create a Github issue explaining the changes you
# need and we will usher them to the appropriate places.
module Recurly
module Requests
... |
github | recurly/recurly-client-ruby | https://github.com/recurly/recurly-client-ruby | lib/recurly/requests/subscription_add_on_percentage_tier.rb | Ruby | mit | 182 | v3-v2021-02-25 | 835 | # This file is automatically created by Recurly's OpenAPI generation process
# and thus any edits you make by hand will be lost. If you wish to make a
# change to this file, please create a Github issue explaining the changes you
# need and we will usher them to the appropriate places.
module Recurly
module Requests
... |
github | recurly/recurly-client-ruby | https://github.com/recurly/recurly-client-ruby | lib/recurly/requests/plan_create.rb | Ruby | mit | 182 | v3-v2021-02-25 | 9,742 | # This file is automatically created by Recurly's OpenAPI generation process
# and thus any edits you make by hand will be lost. If you wish to make a
# change to this file, please create a Github issue explaining the changes you
# need and we will usher them to the appropriate places.
module Recurly
module Requests
... |
github | recurly/recurly-client-ruby | https://github.com/recurly/recurly-client-ruby | lib/recurly/requests/pricing.rb | Ruby | mit | 182 | v3-v2021-02-25 | 758 | # This file is automatically created by Recurly's OpenAPI generation process
# and thus any edits you make by hand will be lost. If you wish to make a
# change to this file, please create a Github issue explaining the changes you
# need and we will usher them to the appropriate places.
module Recurly
module Requests
... |
github | recurly/recurly-client-ruby | https://github.com/recurly/recurly-client-ruby | lib/recurly/requests/external_product_reference_update.rb | Ruby | mit | 182 | v3-v2021-02-25 | 874 | # This file is automatically created by Recurly's OpenAPI generation process
# and thus any edits you make by hand will be lost. If you wish to make a
# change to this file, please create a Github issue explaining the changes you
# need and we will usher them to the appropriate places.
module Recurly
module Requests
... |
github | recurly/recurly-client-ruby | https://github.com/recurly/recurly-client-ruby | lib/recurly/requests/external_refund.rb | Ruby | mit | 182 | v3-v2021-02-25 | 872 | # This file is automatically created by Recurly's OpenAPI generation process
# and thus any edits you make by hand will be lost. If you wish to make a
# change to this file, please create a Github issue explaining the changes you
# need and we will usher them to the appropriate places.
module Recurly
module Requests
... |
github | recurly/recurly-client-ruby | https://github.com/recurly/recurly-client-ruby | lib/recurly/requests/subscription_update.rb | Ruby | mit | 182 | v3-v2021-02-25 | 6,197 | # This file is automatically created by Recurly's OpenAPI generation process
# and thus any edits you make by hand will be lost. If you wish to make a
# change to this file, please create a Github issue explaining the changes you
# need and we will usher them to the appropriate places.
module Recurly
module Requests
... |
github | recurly/recurly-client-ruby | https://github.com/recurly/recurly-client-ruby | lib/recurly/requests/external_account_create.rb | Ruby | mit | 182 | v3-v2021-02-25 | 779 | # This file is automatically created by Recurly's OpenAPI generation process
# and thus any edits you make by hand will be lost. If you wish to make a
# change to this file, please create a Github issue explaining the changes you
# need and we will usher them to the appropriate places.
module Recurly
module Requests
... |
github | recurly/recurly-client-ruby | https://github.com/recurly/recurly-client-ruby | lib/recurly/schema/request_caster.rb | Ruby | mit | 182 | v3-v2021-02-25 | 2,365 | require "date"
module Recurly
class Schema
# *Note*: This module is for internal use.
# The RequestCaster turns mixed data into a pure Hash
# so it can be serialized into JSON and used as the body of a request.
# This module is to be extended by the Request class.
module RequestCaster
# Th... |
github | recurly/recurly-client-ruby | https://github.com/recurly/recurly-client-ruby | lib/recurly/schema/schema_validator.rb | Ruby | mit | 182 | v3-v2021-02-25 | 4,743 | module Recurly
class Schema
# This module is responsible for validating that the raw data
# passed in to *attributes* matches the schema belonging to this class.
# It should be mixed in to the Request class.
module SchemaValidator
# Validates the attributes and throws an error if something is wr... |
github | recurly/recurly-client-ruby | https://github.com/recurly/recurly-client-ruby | lib/recurly/schema/json_parser.rb | Ruby | mit | 182 | v3-v2021-02-25 | 2,140 | require "json"
module Recurly
# This is a wrapper class to help parse http response into Recurly objects.
class JSONParser
# Parses the json body into a recurly object.
#
# @param client [Client] The Recurly client which made the request.
# @param body [String] The JSON string to parse.
# @ret... |
github | recurly/recurly-client-ruby | https://github.com/recurly/recurly-client-ruby | lib/recurly/schema/resource_caster.rb | Ruby | mit | 182 | v3-v2021-02-25 | 1,615 | require "date"
module Recurly
class Schema
# The purpose of this class is to turn JSON parsed Hashes
# defined into Recurly ruby objects. It's to be used
# by the Resource as an extension.
module ResourceCaster
# Gives the class the ability to initialize itself
# given some json data.
... |
github | recurly/recurly-client-ruby | https://github.com/recurly/recurly-client-ruby | lib/recurly/schema/file_parser.rb | Ruby | mit | 182 | v3-v2021-02-25 | 343 | module Recurly
# This is a wrapper class to help parse http response into Recurly objects.
class FileParser
# Parses the json body into a recurly object.
#
# @param body [String] The data string to cast.
# @return [Resource]
def self.parse(body)
Recurly::Resources::BinaryFile.cast(data: b... |
github | recurly/recurly-client-ruby | https://github.com/recurly/recurly-client-ruby | lib/recurly/schema/schema_factory.rb | Ruby | mit | 182 | v3-v2021-02-25 | 1,306 | module Recurly
class Schema
# A mixin that allows a class to be treated like a recurly
# object. This gives the class the power to describe
# it's schema. It adds the *define_attribute* method
# and a *schema* reader.
module SchemaFactory
# Gets the schema for this class
# @return [Sc... |
github | recurly/recurly-client-ruby | https://github.com/recurly/recurly-client-ruby | spec/test_schemas.rb | Ruby | mit | 182 | v3-v2021-02-25 | 1,605 | # These must be in the Recurly::Requests namespace
class Recurly::Requests::MySubRequest < Recurly::Request
define_attribute :a_string, String
end
# These must be in the Recurly::Requests namespace
class Recurly::Requests::MyRequest < Recurly::Request
define_attribute :a_string, String
define_attribute :a_hash, ... |
github | recurly/recurly-client-ruby | https://github.com/recurly/recurly-client-ruby | spec/spec_helper.rb | Ruby | mit | 182 | v3-v2021-02-25 | 425 | require "bundler/setup"
require "simplecov"
SimpleCov.start do
# we will ignore this generated file
add_filter "lib/recurly/client/operations.rb"
end
require "recurly"
require_relative "./test_schemas"
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_pers... |
github | recurly/recurly-client-ruby | https://github.com/recurly/recurly-client-ruby | spec/recurly/pager_spec.rb | Ruby | mit | 182 | v3-v2021-02-25 | 3,527 | require "spec_helper"
require "date"
RSpec.describe Recurly::Pager do
let(:subdomain) { "test" }
let(:api_key) { "recurly-good" }
let(:client) { Recurly::Client.new(api_key: api_key) }
let(:path) { "/next_url" }
let(:options) { { params: { a: 1, b: "testing" } } }
subject do
Recurly::Pager.new(client: ... |
github | recurly/recurly-client-ruby | https://github.com/recurly/recurly-client-ruby | spec/recurly/resource_spec.rb | Ruby | mit | 182 | v3-v2021-02-25 | 2,917 | require "spec_helper"
RSpec.describe Recurly::Resource do
context "with a valid resource" do
let(:json_data) do
{
"object" => "my_resource",
"a_string" => "A String",
"a_hash" => { "a" => 1, "b" => 2 },
"an_integer" => 42,
"a_float" => 4.2,
"a_boolean" => fal... |
github | recurly/recurly-client-ruby | https://github.com/recurly/recurly-client-ruby | spec/recurly/client_spec.rb | Ruby | mit | 182 | v3-v2021-02-25 | 19,512 | require "spec_helper"
RSpec.describe Recurly::Client do
subject(:client) { Recurly::Client.new(**client_options) }
let(:client_options) { { api_key: api_key } }
let(:keep_alive_timeout) { 600 }
let(:subdomain) { "test" }
let(:api_key) { "recurly-good" }
let(:resp_headers) do
{
"x-request-id" => "... |
github | recurly/recurly-client-ruby | https://github.com/recurly/recurly-client-ruby | spec/recurly/webhooks_spec.rb | Ruby | mit | 182 | v3-v2021-02-25 | 2,906 | require "spec_helper"
RSpec.describe Recurly::Webhooks do
describe "verify_signature" do
let(:secret) { "354fab5bd35f5a0d50845ee7e30165244468b13c2c343f104e4e730a59326d9d" }
let(:body) { '{"id":"rjxwmwedwqug","object_type":"account","site_id":"qc326l1hl8k9","event_type":"created","event_time":"2022-09-13T21:1... |
github | recurly/recurly-client-ruby | https://github.com/recurly/recurly-client-ruby | spec/recurly/request_spec.rb | Ruby | mit | 182 | v3-v2021-02-25 | 6,641 | require "spec_helper"
RSpec.describe Recurly::Request do
let(:hash_data) do
{
a_string: "A String",
a_hash: { a: 1, b: 2 },
an_integer: 42,
a_float: 4.2,
a_boolean: false,
a_datetime: DateTime.new(2020, 1, 1),
a_string_array: %w(I am a string array),
a_sub_request:... |
github | recurly/recurly-client-ruby | https://github.com/recurly/recurly-client-ruby | spec/recurly/errors_spec.rb | Ruby | mit | 182 | v3-v2021-02-25 | 547 | require "spec_helper"
require "date"
RSpec.describe Recurly::Errors::APIError do
describe ".error_class" do
error_keys = Recurly::Errors.constants - [:APIError, :ERROR_MAP]
error_keys = error_keys.map do |key|
key.to_s.split(/(?=[A-Z])/).map(&:downcase).join("_")
end
error_keys.each do |error_... |
github | recurly/recurly-client-ruby | https://github.com/recurly/recurly-client-ruby | spec/recurly/schema/json_parser_spec.rb | Ruby | mit | 182 | v3-v2021-02-25 | 1,898 | require "spec_helper"
RSpec.describe Recurly::JSONParser do
let(:json_data) { '{"object": "my_resource", "a_string": "A String"}' }
let(:client) {
Recurly::Client.new(api_key: "test123")
}
describe ".parse" do
subject { described_class.parse(client, json_data) }
context "when the resource does no... |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | Rakefile | Ruby | mit | 182 | master | 266 | # frozen_string_literal: true
require "bundler/gem_tasks"
require "rake/testtask"
Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib"
t.warning = true
t.verbose = true
t.test_files = FileList['test/**/*_test.rb']
end
task :default => :test |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | motorhead.gemspec | Ruby | mit | 182 | master | 1,217 | # coding: utf-8
# frozen_string_literal: true
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'motorhead/version'
Gem::Specification.new do |spec|
spec.name = "motorhead"
spec.version = Motorhead::VERSION
spec.authors = ["Akira Matsu... |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | lib/motorhead.rb | Ruby | mit | 182 | master | 338 | # frozen_string_literal: true
require "motorhead/version"
require 'motorhead/config'
module Motorhead
class Railtie < ::Rails::Railtie
ActiveSupport.on_load :action_controller do
require 'motorhead/abstract_controller'
end
ActiveSupport.on_load :action_view do
require 'motorhead/action_view'
... |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | lib/motorhead/abstract_controller.rb | Ruby | mit | 182 | master | 2,236 | # frozen_string_literal: true
module Motorhead
module Helpers
module UrlHelper
#FIXME there has to be a better way doing this...
def method_missing(meth, *args, &block)
if main_app.routes.url_helpers.instance_methods.include? meth
main_app.send meth, *args, &block
else
... |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | lib/motorhead/config.rb | Ruby | mit | 182 | master | 266 | # frozen_string_literal: true
module Motorhead
include ActiveSupport::Configurable
configure do |config|
config.on_error = ->(err) do
if ['development', 'test'].include? Rails.env
raise err
else
p err
end
end
end
end |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | lib/motorhead/engine.rb | Ruby | mit | 182 | master | 764 | # frozen_string_literal: true
require 'motorhead/errors'
module Motorhead
module Engine
extend ActiveSupport::Concern
module ClassMethods
attr_accessor :on_error
def active_if(&block)
@active_if = block
end
def active?(controller)
controller.instance_eval(&@active_i... |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | lib/motorhead/action_view.rb | Ruby | mit | 182 | master | 1,513 | # frozen_string_literal: true
ActionView::Base.class_eval do
#FIXME FIXHAML AMCing here because prepending on `render` causes infinite loop when Haml is bundled
def render_with_motorhead(options = {}, locals = {}, &block)
if (Hash === options) && options.key?(:engine)
ext_name = options[:engine][/[^\/]*/]... |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | lib/motorhead/road_crew/road_crew.gemspec | Ruby | mit | 182 | master | 502 | # frozen_string_literal: true
$:.push File.expand_path("../lib", __FILE__)
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "road_crew"
s.version = '0'
s.authors = [""]
s.email = [""]
s.homepage = ""
s.summary = ""
s.description = ""
s... |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | lib/motorhead/road_crew/app/controllers/road_crew/engine_settings_controller.rb | Ruby | mit | 182 | master | 830 | # frozen_string_literal: true
class RoadCrew::EngineSettingsController < ActionController::Base
include Motorhead::Controller
layout false
def index
@engine_settings = JSON.parse(cookies['road_crew_engine_settings'].presence || '{}')
all_engine_names = Rails::Engine.subclasses.select {|e| e < Motorhead::... |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | lib/motorhead/road_crew/lib/road_crew/engine.rb | Ruby | mit | 182 | master | 620 | # frozen_string_literal: true
require 'motorhead/engine'
module RoadCrew
class Engine < ::Rails::Engine
include Motorhead::Engine
active_if { true }
mount_at 'motorhead/road_crew'
Motorhead::Engine::ClassMethods.class_eval do
remove_possible_method :active?
# overwrite active? to check ... |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | lib/generators/motorhead_generator.rb | Ruby | mit | 182 | master | 1,931 | # frozen_string_literal: true
require 'rails/generators/rails/plugin/plugin_generator'
class MotorheadGenerator < ::Rails::Generators::PluginGenerator
class EngineBuilder < ::Rails::PluginBuilder
def readme() end
end
argument :base_controller, type: :string, optional: true, banner: 'base controller'
argum... |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | lib/generators/motorhead/controller_generator.rb | Ruby | mit | 182 | master | 1,145 | # frozen_string_literal: true
require 'rails/generators/rails/controller/controller_generator'
module Motorhead
module Generators
class ControllerGenerator < ::Rails::Generators::ControllerGenerator
source_root ::Rails::Generators::ControllerGenerator.source_root
remove_hook_for :template_engine, :t... |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | lib/generators/motorhead/templates/controller.rb | Ruby | mit | 182 | master | 364 | <% if namespaced? -%>
require_dependency "<%= namespaced_path %>/application_controller"
<% end -%>
<% module_namespacing do -%>
class <%= class_name %>Controller < ::<%= file_name.camelize %>Controller
include Motorhead::Controller
<% actions.each do |action| -%>
def <%= action %>
end
<%= "\n" unless action ==... |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | lib/generators/motorhead/templates/lib/%name%/engine.rb | Ruby | mit | 182 | master | 408 | require 'motorhead/engine'
module <%= camelized %>
class Engine < ::Rails::Engine
include Motorhead::Engine
active_if { raise Motorhead::ActiveIfNotConfigured, <<-MSG }
Please configure appropriate access control for <%= camelized %> Engine.
e.g.
1) accessible for the admin users only:
active_if { curr... |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | test/test_helper.rb | Ruby | mit | 182 | master | 1,187 | # frozen_string_literal: true
# Configure Rails Environment
ENV["RAILS_ENV"] = "test"
require 'byebug'
require File.expand_path("../../test/dummy_app/config/environment.rb", __FILE__)
ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../test/dummy_app/db/migrate", __FILE__)]
ActiveRecord::Migrator.migra... |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | test/features/routes_fallback_test.rb | Ruby | mit | 182 | master | 391 | # frozen_string_literal: true
require 'test_helper'
class RoutesFallbackTest < ActionDispatch::IntegrationTest
setup do
RoutesFallback::Engine.active_if { true }
end
teardown do
RoutesFallback::Engine.active_if { false }
end
test 'URL helpers successfully fall back to the main_app routes' do
vis... |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | test/features/controller_filter_test.rb | Ruby | mit | 182 | master | 220 | # frozen_string_literal: true
require 'test_helper'
class ControllerFilterTest < ActionDispatch::IntegrationTest
test 'Filters are properly executed' do
visit '/greeting'
assert has_content? 'world'
end
end |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | test/features/simple_controller_test.rb | Ruby | mit | 182 | master | 402 | # frozen_string_literal: true
require 'test_helper'
class SimpleControllerTest < ActionDispatch::IntegrationTest
setup do
SimpleController::Engine.active_if { true }
end
teardown do
SimpleController::Engine.active_if { false }
end
test 'Motorhead engine successfully extends action methods that has n... |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | test/features/multiple_extensions_test.rb | Ruby | mit | 182 | master | 496 | # frozen_string_literal: true
require 'test_helper'
class MultipleExtensionsTest < ActionDispatch::IntegrationTest
setup do
Italian::Engine.active_if { true }
Spanish::Engine.active_if { true }
end
teardown do
Italian::Engine.active_if { false }
Spanish::Engine.active_if { false }
end
test '... |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | test/features/controller_redirection_test.rb | Ruby | mit | 182 | master | 374 | # frozen_string_literal: true
require 'test_helper'
class ControllerRedirectionTest < ActionDispatch::IntegrationTest
setup do
Redirector::Engine.active_if { true }
end
teardown do
Redirector::Engine.active_if { false }
end
test 'Motorhead engine successfully performs redirect' do
visit '/greeti... |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | test/features/controller_extension_test.rb | Ruby | mit | 182 | master | 404 | # frozen_string_literal: true
require 'test_helper'
class ControllerExtensionTest < ActionDispatch::IntegrationTest
setup do
ControllerExtension::Engine.active_if { true }
end
teardown do
ControllerExtension::Engine.active_if { false }
end
test 'Motorhead engine successfully extends action methods' ... |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | test/features/greeting_test.rb | Ruby | mit | 182 | master | 226 | # frozen_string_literal: true
require 'test_helper'
class GreetingTest < ActionDispatch::IntegrationTest
test 'The controller works without engines' do
visit '/greeting'
assert has_content? 'hello, world'
end
end |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | test/features/view_render_fallback_test.rb | Ruby | mit | 182 | master | 991 | # frozen_string_literal: true
require 'test_helper'
class ViewRenderFallbackTest < ActionDispatch::IntegrationTest
setup do
ViewRenderFallback::Engine.active_if { true }
end
teardown do
ViewRenderFallback::Engine.active_if { false }
end
test 'Motorhead engine successfully extends the view' do
vi... |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | test/features/view_rendering_test.rb | Ruby | mit | 182 | master | 288 | # frozen_string_literal: true
require 'test_helper'
class ViewRenderingTest < ActionDispatch::IntegrationTest
setup do
$view_engine_rendered = false
end
test 'views in inactive engines are never be rendered' do
visit '/greeting'
refute $view_engine_rendered
end
end |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | test/features/on_error_test.rb | Ruby | mit | 182 | master | 975 | # frozen_string_literal: true
require 'test_helper'
class OnErrorTest < ActionDispatch::IntegrationTest
setup do
ControllerFallback::Engine.active_if { true }
@on_error_was, ControllerFallback::Engine.on_error = ControllerFallback::Engine.on_error, ->(e) { raise e }
end
teardown do
ControllerFallback... |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | test/features/mount_at_test.rb | Ruby | mit | 182 | master | 416 | # frozen_string_literal: true
require 'test_helper'
class MountAtTest < ActionDispatch::IntegrationTest
setup do
MountAtCapricorn::Engine.active_if { true }
end
teardown do
MountAtCapricorn::Engine.active_if { false }
end
test 'the Engine should be mounted at the configured mount_at path' do
vis... |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | test/features/controller_fallback_test.rb | Ruby | mit | 182 | master | 407 | # frozen_string_literal: true
require 'test_helper'
class ControllerFallbackTest < ActionDispatch::IntegrationTest
setup do
ControllerFallback::Engine.active_if { true }
end
teardown do
ControllerFallback::Engine.active_if { false }
end
test 'successfully falls back to the original action method on ... |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | test/dummy_app/config/application.rb | Ruby | mit | 182 | master | 915 | # frozen_string_literal: true
require File.expand_path('../boot', __FILE__)
require 'rails/all'
Bundler.require(*Rails.groups)
require "motorhead"
module DummyApp
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuratio... |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | test/dummy_app/config/boot.rb | Ruby | mit | 182 | master | 271 | # frozen_string_literal: true
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
$LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__) |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | test/dummy_app/config/environments/test.rb | Ruby | mit | 182 | master | 1,613 | # frozen_string_literal: true
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 "sc... |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | test/dummy_app/app/engines/controller_fallback/controller_fallback.gemspec | Ruby | mit | 182 | master | 606 | # frozen_string_literal: true
$:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "controller_fallback/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "controller_fallback"
s.version = ControllerFallback::VERSION
s.auth... |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | test/dummy_app/app/engines/redirector/redirector.gemspec | Ruby | mit | 182 | master | 580 | # frozen_string_literal: true
$:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "redirector/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "redirector"
s.version = Redirector::VERSION
s.authors = [""]
s.email ... |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | test/dummy_app/app/engines/routes_fallback/routes_fallback.gemspec | Ruby | mit | 182 | master | 594 | # frozen_string_literal: true
$:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "routes_fallback/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "routes_fallback"
s.version = RoutesFallback::VERSION
s.authors = ["... |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | test/dummy_app/app/engines/mount_at_capricorn/mount_at_capricorn.gemspec | Ruby | mit | 182 | master | 511 | # frozen_string_literal: true
$:.push File.expand_path("../lib", __FILE__)
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "mount_at_capricorn"
s.version = '0'
s.authors = [""]
s.email = [""]
s.homepage = ""
s.summary = ""
s.description... |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | test/dummy_app/app/engines/mount_at_capricorn/lib/mount_at_capricorn/engine.rb | Ruby | mit | 182 | master | 205 | # frozen_string_literal: true
require 'motorhead/engine'
module MountAtCapricorn
class Engine < ::Rails::Engine
include Motorhead::Engine
active_if { false }
mount_at 'capricorn'
end
end |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | test/dummy_app/app/engines/mount_at_capricorn/app/controllers/mount_at_capricorn/top_controller.rb | Ruby | mit | 182 | master | 207 | # frozen_string_literal: true
class MountAtCapricorn::TopController < ActionController::Base
include Motorhead::Controller
def show
render plain: 'My life, my heart, black night, my star'
end
end |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | test/dummy_app/app/engines/simple_controller/simple_controller.gemspec | Ruby | mit | 182 | master | 542 | # frozen_string_literal: true
$:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "simple_controller"
s.version = '0'
s.authors = [""]
s.email = [""]
s.homepage = ""
s.s... |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | test/dummy_app/app/engines/italian/italian.gemspec | Ruby | mit | 182 | master | 500 | # frozen_string_literal: true
$:.push File.expand_path("../lib", __FILE__)
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "italian"
s.version = '0'
s.authors = [""]
s.email = [""]
s.homepage = ""
s.summary = ""
s.description = ""
s.l... |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | test/dummy_app/app/engines/view_render_fallback/view_render_fallback.gemspec | Ruby | mit | 182 | master | 608 | # frozen_string_literal: true
$:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "view_render_fallback/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "view_render_fallback"
s.version = ViewRenderFallback::VERSION
s.au... |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | test/dummy_app/app/engines/spanish/spanish.gemspec | Ruby | mit | 182 | master | 500 | # frozen_string_literal: true
$:.push File.expand_path("../lib", __FILE__)
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "spanish"
s.version = '0'
s.authors = [""]
s.email = [""]
s.homepage = ""
s.summary = ""
s.description = ""
s.l... |
github | amatsuda/motorhead | https://github.com/amatsuda/motorhead | test/dummy_app/app/engines/controller_extension/controller_extension.gemspec | Ruby | mit | 182 | master | 609 | # frozen_string_literal: true
$:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "controller_extension/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "controller_extension"
s.version = ControllerExtension::VERSION
s.a... |
github | sporkrb/spork-rails | https://github.com/sporkrb/spork-rails | Gemfile | Ruby | mit | 182 | master | 272 | source 'https://rubygems.org'
gemspec
# rails is required by the gemspec
gem 'cucumber', '~>1.3.2'
gem 'rspec', '~>2.13.0'
gem 'rake'
gem 'spork', '>= 1.0rc0'
gem "spork-rails", :path => "./"
if RUBY_VERSION =~ /^2\.0|^1\.9/
gem 'debugger'
else
gem 'ruby-debug'
end |
github | sporkrb/spork-rails | https://github.com/sporkrb/spork-rails | spork-rails.gemspec | Ruby | mit | 182 | master | 971 | require 'date'
Gem::Specification.new do |s|
s.name = %q{spork-rails}
s.version = "4.0.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Tim Harper", "Sahil Muthoo"]
s.date = Date.today.to_s
s.description = %q{Plugin for Spork to suppo... |
github | sporkrb/spork-rails | https://github.com/sporkrb/spork-rails | lib/spork/ext/rails-reloader.rb | Ruby | mit | 182 | master | 456 | Spork.each_run do
::ActiveSupport.const_defined?(:Dependencies) ?
::ActiveSupport::Dependencies.mechanism = :load :
::Dependencies.mechanism = :load
require 'action_controller/dispatcher'
dispatcher = ::ActionController::Dispatcher.new($stdout)
if ::ActionController::Dispatcher.respond_to?(:reload_app... |
github | sporkrb/spork-rails | https://github.com/sporkrb/spork-rails | lib/spork/app_framework/rails.rb | Ruby | mit | 182 | master | 2,899 | class Spork::AppFramework::Rails < Spork::AppFramework
def preload(&block)
STDERR.puts "Preloading Rails environment"
STDERR.flush
ENV["RAILS_ENV"] ||= 'test'
preload_rails
yield
ActiveRecord::Base.remove_connection if defined?(ActiveRecord)
end
def entry_point
@entry_point ||= File.... |
github | sporkrb/spork-rails | https://github.com/sporkrb/spork-rails | spec/spec_helper.rb | Ruby | mit | 182 | master | 402 | require 'rspec'
require 'spork'
SPEC_TMP_DIR = File.expand_path('tmp', File.dirname(__FILE__))
require "spork/test/test_helpers"
Dir.glob("#{File.dirname(__FILE__)}/support/*.rb").each { |f| require(f) }
RSpec.configure do |config|
include(TmpProjectHelpers)
config.before(:each) do
TestIOStreams.set_stream... |
github | sporkrb/spork-rails | https://github.com/sporkrb/spork-rails | spec/spork/app_framework_spec.rb | Ruby | mit | 182 | master | 347 | require 'spec_helper'
describe Spork::AppFramework do
describe ".detect_framework" do
it "detects when rails is installed and available" do
create_file("config/environment.rb", "RAILS_GEM_VERSION = '2.1.0'")
in_current_dir do
Spork::AppFramework.detect_framework.short_name.should == "Rails"
... |
github | sporkrb/spork-rails | https://github.com/sporkrb/spork-rails | spec/spork/app_framework/rails_spec.rb | Ruby | mit | 182 | master | 723 | require 'spec_helper'
describe Spork::AppFramework::Rails do
describe ".deprecated_version" do
it "detects the current version of rails" do
create_file("config/environment.rb", "RAILS_GEM_VERSION = '2.1.0'")
in_current_dir do
Spork::AppFramework::Rails.new.deprecated_version.should == "2.1.0"... |
github | sporkrb/spork-rails | https://github.com/sporkrb/spork-rails | features/support/env.rb | Ruby | mit | 182 | master | 398 | require "spork/test/cucumber_helpers.rb"
APP_ROOT = Pathname.new(File.expand_path('../../', File.dirname(__FILE__)))
SANDBOX_DIR = APP_ROOT + "tmp/sandbox"
BundlerHelpers.set_gemfile(APP_ROOT + "features/gemsets/#{ENV["GEMSET"] || 'rails3.2'}/Gemfile")
World do
SporkWorld.new
end
# FileUtils.rm_rf SporkWorld::... |
github | sporkrb/spork-rails | https://github.com/sporkrb/spork-rails | features/gemsets/rails3.0/Gemfile | Ruby | mit | 182 | master | 305 | source 'https://rubygems.org'
gem 'sqlite3', '~> 1.3.4'
gem 'cucumber', '~> 1.3.2'
gem "rspec", "~> 2.13.0"
gem 'rspec-rails', "~> 2.13.2"
gem 'rails', '~> 3.0'
if RUBY_VERSION =~ /^2\.0|^1\.9/
gem 'debugger'
else
gem 'ruby-debug'
end
gem 'spork', '>= 1.0rc0'
gem 'spork-rails', :path => "../../../" |
github | sporkrb/spork-rails | https://github.com/sporkrb/spork-rails | features/gemsets/rails4.0/Gemfile | Ruby | mit | 182 | master | 341 | source 'https://rubygems.org'
gem 'sqlite3', '~> 1.3.7'
gem 'cucumber', '~> 1.3.2'
gem 'rspec', '~> 2.13.0'
gem 'rspec-rails', '~> 2.13.2'
gem 'rails', '~> 4.0'
gem 'jquery-rails'
gem 'turbolinks'
if RUBY_VERSION =~ /^2\.0|^1\.9/
gem 'debugger'
else
gem 'ruby-debug'
end
gem 'spork', '>= 1.0rc0'
gem 'spork-rails', ... |
github | sporkrb/spork-rails | https://github.com/sporkrb/spork-rails | features/gemsets/rails3.1/Gemfile | Ruby | mit | 182 | master | 305 | source 'https://rubygems.org'
gem 'sqlite3', '~> 1.3.4'
gem 'cucumber', '~> 1.3.2'
gem "rspec", "~> 2.13.0"
gem 'rspec-rails', "~> 2.13.2"
gem 'rails', '~> 3.1'
if RUBY_VERSION =~ /^2\.0|^1\.9/
gem 'debugger'
else
gem 'ruby-debug'
end
gem 'spork', '>= 1.0rc0'
gem 'spork-rails', :path => "../../../" |
github | sporkrb/spork-rails | https://github.com/sporkrb/spork-rails | features/gemsets/rails3.2/Gemfile | Ruby | mit | 182 | master | 305 | source 'https://rubygems.org'
gem 'sqlite3', '~> 1.3.4'
gem 'cucumber', '~> 1.3.2'
gem "rspec", "~> 2.13.0"
gem 'rspec-rails', "~> 2.13.2"
gem 'rails', '~> 3.2'
if RUBY_VERSION =~ /^2\.0|^1\.9/
gem 'debugger'
else
gem 'ruby-debug'
end
gem 'spork', '>= 1.0rc0'
gem 'spork-rails', :path => "../../../" |
github | sporkrb/spork-rails | https://github.com/sporkrb/spork-rails | features/steps/rails_steps.rb | Ruby | mit | 182 | master | 3,437 | Given /^I am in a fresh rails project named "(.+)"$/ do |folder_name|
@current_dir = SporkWorld::SANDBOX_DIR
# version_argument = ENV['RAILS_VERSION'] ? "_#{ENV['RAILS_VERSION']}_" : nil
# run("#{SporkWorld::RUBY_BINARY} #{%x{which rails}.chomp} #{folder_name}")
run(["rails", "new", folder_name].compact * " ")
... |
github | activeadmin-plugins/active_admin_import | https://github.com/activeadmin-plugins/active_admin_import | Gemfile | Ruby | mit | 182 | master | 575 | source 'https://rubygems.org'
gemspec
default_rails_version = '7.1.0'
default_activeadmin_version = '3.2.0'
gem 'rails', "~> #{ENV['RAILS'] || default_rails_version}"
gem 'activeadmin', "~> #{ENV['AA'] || default_activeadmin_version}"
gem 'sprockets-rails'
gem 'sass-rails'
group :test do
gem 'simplecov', require: ... |
github | activeadmin-plugins/active_admin_import | https://github.com/activeadmin-plugins/active_admin_import | active_admin_import.gemspec | Ruby | mit | 182 | master | 985 | # -*- encoding: utf-8 -*-
# frozen_string_literal: true
require File.expand_path('../lib/active_admin_import/version', __FILE__)
Gem::Specification.new do |gem|
gem.authors = ['Igor Fedoronchuk']
gem.email = ['fedoronchuk@gmail.com']
gem.description = 'The most efficient way to import for Active Admin'
gem.sum... |
github | activeadmin-plugins/active_admin_import | https://github.com/activeadmin-plugins/active_admin_import | lib/active_admin_import.rb | Ruby | mit | 182 | master | 491 | # frozen_string_literal: true
require 'activerecord-import'
require 'active_admin'
require 'active_admin_import/version'
require 'active_admin_import/engine'
require 'active_admin_import/exception'
require 'active_admin_import/import_result'
require 'active_admin_import/options'
require 'active_admin_import/dsl'
requir... |
github | activeadmin-plugins/active_admin_import | https://github.com/activeadmin-plugins/active_admin_import | lib/active_admin_import/options.rb | Ruby | mit | 182 | master | 1,107 | # frozen_string_literal: true
module ActiveAdminImport
module Options
VALID_OPTIONS = [
:back,
:csv_options,
:validate,
:batch_size,
:batch_transaction,
:before_import,
:after_import,
:before_batch_import,
:after_batch_import,
:on_duplicate_key_update,
... |
github | activeadmin-plugins/active_admin_import | https://github.com/activeadmin-plugins/active_admin_import | lib/active_admin_import/importer.rb | Ruby | mit | 182 | master | 4,589 | # frozen_string_literal: true
require 'csv'
module ActiveAdminImport
class Importer
attr_reader :resource, :options, :result, :model
attr_accessor :csv_lines, :headers
OPTIONS = [
:validate,
:on_duplicate_key_update,
:on_duplicate_key_ignore,
:ignore,
:timestamps,
:bef... |
github | activeadmin-plugins/active_admin_import | https://github.com/activeadmin-plugins/active_admin_import | lib/active_admin_import/model.rb | Ruby | mit | 182 | master | 4,764 | # encoding: utf-8
# frozen_string_literal: true
require 'rchardet'
require 'zip'
module ActiveAdminImport
class Model
include ActiveModel::Model
include ActiveModel::Validations
include ActiveModel::Validations::Callbacks
module CONST
ZIP_TYPE = 'application/zip'.freeze
TMP_FILE = 'acti... |
github | activeadmin-plugins/active_admin_import | https://github.com/activeadmin-plugins/active_admin_import | lib/active_admin_import/dsl.rb | Ruby | mit | 182 | master | 5,593 | # frozen_string_literal: true
module ActiveAdminImport
# Declares import functionality
#
# Options
# +back+:: resource action to redirect after processing
# +csv_options+:: hash to override default CSV options
# +batch_size+:: integer value of max record count inserted by 1 query/transaction
# +batch_tra... |
github | activeadmin-plugins/active_admin_import | https://github.com/activeadmin-plugins/active_admin_import | lib/active_admin_import/import_result.rb | Ruby | mit | 182 | master | 1,081 | # frozen_string_literal: true
module ActiveAdminImport
class ImportResult
attr_reader :failed, :total
def initialize
@failed = []
@total = 0
end
def add(result, qty)
@failed += result.failed_instances
@total += qty
end
def imported_qty
total - failed.count
... |
github | activeadmin-plugins/active_admin_import | https://github.com/activeadmin-plugins/active_admin_import | spec/import_spec.rb | Ruby | mit | 182 | master | 24,684 | # frozen_string_literal: true
require 'spec_helper'
describe 'import', type: :feature do
shared_examples 'successful inserts' do |encoding, csv_file_name|
let(:options) do
attributes = { force_encoding: encoding }
{ template_object: ActiveAdminImport::Model.new(attributes) }
end
before do
... |
github | activeadmin-plugins/active_admin_import | https://github.com/activeadmin-plugins/active_admin_import | spec/import_result_spec.rb | Ruby | mit | 182 | master | 1,180 | # frozen_string_literal: true
require 'spec_helper'
describe ActiveAdminImport::ImportResult do
context 'failed_message' do
let(:import_result) { ActiveAdminImport::ImportResult.new }
let(:failed_instances) do
[
Author.new(last_name: 'Doe').tap {|r| r.errors.add(:last_name, :taken) },
... |
github | activeadmin-plugins/active_admin_import | https://github.com/activeadmin-plugins/active_admin_import | spec/spec_helper.rb | Ruby | mit | 182 | master | 1,593 | require 'simplecov'
SimpleCov.start do
add_filter '/spec/'
end
$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH << File.expand_path('../support', __FILE__)
ENV['BUNDLE_GEMFILE'] = File.expand_path('../../Gemfile', __FILE__)
require 'bundler'
Bundler.setup
ENV['RAILS_ENV'] = 'test'
require 'rails'
ENV['RAILS']... |
github | activeadmin-plugins/active_admin_import | https://github.com/activeadmin-plugins/active_admin_import | spec/support/rails_template.rb | Ruby | mit | 182 | master | 2,198 | create_file "app/assets/config/manifest.js", skip: true
db = ENV['DB'] || 'sqlite'
case db
when 'mysql'
remove_file 'config/database.yml'
create_file 'config/database.yml', <<~YAML
default: &default
adapter: mysql2
encoding: utf8mb4
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
host... |
github | activeadmin-plugins/active_admin_import | https://github.com/activeadmin-plugins/active_admin_import | spec/support/admin.rb | Ruby | mit | 182 | master | 841 | # frozen_string_literal: true
def add_author_resource(options = {}, &block)
ActiveAdmin.register Author do
config.filters = false
active_admin_import(options, &block)
end
Rails.application.reload_routes!
end
def add_post_resource(options = {}, &block)
cb = options.delete(:controller_block)
ActiveAdmi... |
github | activeadmin-plugins/active_admin_import | https://github.com/activeadmin-plugins/active_admin_import | spec/support/active_model_lint.rb | Ruby | mit | 182 | master | 316 | # frozen_string_literal: true
shared_examples_for 'ActiveModel' do
include ActiveModel::Lint::Tests
# to_s is to support ruby-1.9
ActiveModel::Lint::Tests.public_instance_methods.map(&:to_s).grep(/^test/).each do |m|
example m.tr('_', ' ') do
send m
end
end
def model
subject
end
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.