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
tc/elastic-mapreduce-ruby
https://github.com/tc/elastic-mapreduce-ruby
amazon/coral/call.rb
Ruby
apache-2.0
84
master
1,768
# # Copyright 2008-2010 Amazon.com, Inc. or its affiliates. All Rights Reserved. require 'uuidtools' module Amazon module Coral class Call # Create a new Call object tied to a specific Dispatcher. def initialize(dispatcher) @dispatcher = dispatcher @identity = {} @request...
github
tc/elastic-mapreduce-ruby
https://github.com/tc/elastic-mapreduce-ruby
amazon/coral/v2signaturehandler.rb
Ruby
apache-2.0
84
master
1,300
# # Copyright 2008-2010 Amazon.com, Inc. or its affiliates. All Rights Reserved. require 'openssl' require 'base64' require 'time' require 'amazon/coral/handler' require 'amazon/coral/v2signaturehelper' require 'amazon/coral/logfactory' module Amazon module Coral class V2SignatureHandler < Handler def i...
github
tc/elastic-mapreduce-ruby
https://github.com/tc/elastic-mapreduce-ruby
amazon/coral/handler.rb
Ruby
apache-2.0
84
master
397
# # Copyright 2008-2010 Amazon.com, Inc. or its affiliates. All Rights Reserved. module Amazon module Coral class Handler # Operate on the specified Job on the "outbound" side of the execution def before(job) end # Operation on the specified Job on the "inbound" side o...
github
tc/elastic-mapreduce-ruby
https://github.com/tc/elastic-mapreduce-ruby
amazon/coral/elasticmapreduceclient.rb
Ruby
apache-2.0
84
master
8,645
# # Copyright 2008-2010 Amazon.com, Inc. or its affiliates. All Rights Reserved. require 'amazon/coral/dispatcher' require 'amazon/coral/call' require 'amazon/coral/service' module Amazon module Coral # Client interface for calling ElasticMapReduce. # # The client supports two mechanisms to invoke eac...
github
tc/elastic-mapreduce-ruby
https://github.com/tc/elastic-mapreduce-ruby
amazon/coral/v0signaturehelper.rb
Ruby
apache-2.0
84
master
2,432
# # Copyright 2008-2010 Amazon.com, Inc. or its affiliates. All Rights Reserved. require 'openssl' require 'base64' require 'time' module Amazon module Coral # Performs AWS V0 Signatures on QueryStringMap objects. class V0SignatureHelper def initialize(aws_access_key_id, aws_secret_key) @aw...
github
tc/elastic-mapreduce-ruby
https://github.com/tc/elastic-mapreduce-ruby
amazon/coral/service.rb
Ruby
apache-2.0
84
master
4,640
# # Copyright 2008-2010 Amazon.com, Inc. or its affiliates. All Rights Reserved. require 'amazon/coral/option' require 'amazon/coral/orchestrator' require 'amazon/coral/dispatcher' require 'amazon/coral/call' require 'amazon/coral/awsquery' require 'amazon/coral/simplelog' module Amazon module Coral # Provide...
github
tc/elastic-mapreduce-ruby
https://github.com/tc/elastic-mapreduce-ruby
amazon/coral/urlencoding.rb
Ruby
apache-2.0
84
master
401
# # Copyright 2008-2010 Amazon.com, Inc. or its affiliates. All Rights Reserved. require 'cgi' module Amazon module Coral # Performs AWS's preferred method of URLEncoding. class UrlEncoding # Convert a string into URL encoded form. def UrlEncoding.encode(plaintext) CGI.escape(pla...
github
tc/elastic-mapreduce-ruby
https://github.com/tc/elastic-mapreduce-ruby
amazon/coral/awsqueryhandler.rb
Ruby
apache-2.0
84
master
5,627
# # Copyright 2008-2010 Amazon.com, Inc. or its affiliates. All Rights Reserved. require 'json/lexer' require 'json/objects' require 'rexml/document' require 'amazon/coral/handler' require 'amazon/coral/querystringmap' require 'amazon/coral/logfactory' require 'amazon/aws/exceptions' module Amazon module Coral ...
github
tc/elastic-mapreduce-ruby
https://github.com/tc/elastic-mapreduce-ruby
amazon/coral/dispatcher.rb
Ruby
apache-2.0
84
master
997
# # Copyright 2008-2010 Amazon.com, Inc. or its affiliates. All Rights Reserved. module Amazon module Coral # Dispatches requests to a particular remote service operation. class Dispatcher # Instantiates a Dispatcher with the specified Orchestrator and # strings declaring the service and opera...
github
tc/elastic-mapreduce-ruby
https://github.com/tc/elastic-mapreduce-ruby
amazon/coral/awsquerychainhelper.rb
Ruby
apache-2.0
84
master
3,398
# # Copyright 2008-2010 Amazon.com, Inc. or its affiliates. All Rights Reserved. require 'uri' require 'amazon/coral/identityhandler' require 'amazon/coral/httpdestinationhandler' require 'amazon/coral/awsqueryhandler' require 'amazon/coral/v0signaturehandler' require 'amazon/coral/v1signaturehandler' require 'amazon...
github
tc/elastic-mapreduce-ruby
https://github.com/tc/elastic-mapreduce-ruby
amazon/coral/ec2client.rb
Ruby
apache-2.0
84
master
3,585
# # Copyright 2008-2011 Amazon.com, Inc. or its affiliates. All Rights Reserved. require 'amazon/coral/dispatcher' require 'amazon/coral/call' require 'amazon/coral/service' module Amazon module Coral # Client interface for calling Ec2. # # The client supports two mechanisms to invoke each remote serv...
github
tc/elastic-mapreduce-ruby
https://github.com/tc/elastic-mapreduce-ruby
amazon/coral/httpdestinationhandler.rb
Ruby
apache-2.0
84
master
914
# Copyright 2008-2010 Amazon.com, Inc. or its affiliates. All Rights Reserved. require 'uri' require 'amazon/coral/handler' require 'amazon/coral/logfactory' module Amazon module Coral # Attaches the specified endpoint URI to the outgoing request. class HttpDestinationHandler < Handler # Initialize...
github
tc/elastic-mapreduce-ruby
https://github.com/tc/elastic-mapreduce-ruby
amazon/coral/querystringmap.rb
Ruby
apache-2.0
84
master
2,227
# # Copyright 2008-2010 Amazon.com, Inc. or its affiliates. All Rights Reserved. require 'amazon/coral/urlencoding' module Amazon module Coral # A hash containing query string parameters that produces a query # string via to_s. Also consumes hashes representing hierarchies of # data to encode as quer...
github
tc/elastic-mapreduce-ruby
https://github.com/tc/elastic-mapreduce-ruby
amazon/coral/option.rb
Ruby
apache-2.0
84
master
1,877
# Copyright 2008-2010 Amazon.com, Inc. or its affiliates. All Rights Reserved. module Amazon module Coral # A simple library for processing command line arguments. class Option def initialize(args) @long = args[:long] @short = args[:short] @num_parameters = args[:parameters] ...
github
tc/elastic-mapreduce-ruby
https://github.com/tc/elastic-mapreduce-ruby
amazon/coral/awsquery.rb
Ruby
apache-2.0
84
master
5,314
# # Copyright 2008-2010 Amazon.com, Inc. or its affiliates. All Rights Reserved. require 'uri' require 'amazon/coral/identityhandler' require 'amazon/coral/httpdestinationhandler' require 'amazon/coral/awsqueryhandler' require 'amazon/coral/v0signaturehandler' require 'amazon/coral/v1signaturehandler' require 'amazon...
github
tc/elastic-mapreduce-ruby
https://github.com/tc/elastic-mapreduce-ruby
amazon/coral/identityhandler.rb
Ruby
apache-2.0
84
master
959
# # Copyright 2008-2010 Amazon.com, Inc. or its affiliates. All Rights Reserved. require 'amazon/coral/handler' module Amazon module Coral # Preloads identity information into request objects. Useful if all # requests through a client will utilize the same identity. class IdentityHandler < Handler ...
github
tc/elastic-mapreduce-ruby
https://github.com/tc/elastic-mapreduce-ruby
amazon/coral/simplelog.rb
Ruby
apache-2.0
84
master
2,638
# # Copyright 2008-2010 Amazon.com, Inc. or its affiliates. All Rights Reserved. require 'amazon/coral/logfactory' require 'logger' module Amazon module Coral # Wraps Ruby's built in Logger to prepend a context string to log messages. # This is useful to prefix log messages with the name of the originatin...
github
tc/elastic-mapreduce-ruby
https://github.com/tc/elastic-mapreduce-ruby
amazon/coral/httpdelegationhelper.rb
Ruby
apache-2.0
84
master
578
# # Copyright 2008-2010 Amazon.com, Inc. or its affiliates. All Rights Reserved. module Amazon module Coral class HttpDelegationHelper def self.add_delegation_token(delegate_identity, request_identity) token = "" first = true delegate_identity.each do |k,v| ...
github
tc/elastic-mapreduce-ruby
https://github.com/tc/elastic-mapreduce-ruby
amazon/coral/awsqueryurihandler.rb
Ruby
apache-2.0
84
master
894
# # Copyright 2008-2010 Amazon.com, Inc. or its affiliates. All Rights Reserved. require 'uri' require 'amazon/coral/handler' require 'amazon/coral/logfactory' module Amazon module Coral # Compiles the request URL from AwsQueryHandler and any intervening # signature handler. class AwsQueryUriHandler <...
github
tc/elastic-mapreduce-ruby
https://github.com/tc/elastic-mapreduce-ruby
amazon/coral/v1signaturehandler.rb
Ruby
apache-2.0
84
master
816
# # Copyright 2008-2010 Amazon.com, Inc. or its affiliates. All Rights Reserved. require 'openssl' require 'base64' require 'time' require 'amazon/coral/handler' require 'amazon/coral/v1signaturehelper' module Amazon module Coral # Applies an AWS version 1 signature to the outgoing request. class V1Signat...
github
tc/elastic-mapreduce-ruby
https://github.com/tc/elastic-mapreduce-ruby
amazon/coral/httphandler.rb
Ruby
apache-2.0
84
master
4,731
# # Copyright 2008-2010 Amazon.com, Inc. or its affiliates. All Rights Reserved. require 'uri' require 'net/http' require 'net/https' require 'amazon/coral/handler' require 'amazon/coral/logfactory' module Amazon module Coral # Executes HTTP requests via the Net::HTTP library. Supports HTTP, # HTTPS and ...
github
tc/elastic-mapreduce-ruby
https://github.com/tc/elastic-mapreduce-ruby
amazon/coral/job.rb
Ruby
apache-2.0
84
master
413
# # Copyright 2008-2010 Amazon.com, Inc. or its affiliates. All Rights Reserved. module Amazon module Coral class Job def initialize(request) @request = request @reply = {} end # Returns the hash of request attributes def request @request end # Retu...
github
tc/elastic-mapreduce-ruby
https://github.com/tc/elastic-mapreduce-ruby
amazon/coral/v2signaturehelper.rb
Ruby
apache-2.0
84
master
2,012
# # Copyright 2008-2010 Amazon.com, Inc. or its affiliates. All Rights Reserved. require 'openssl' require 'base64' require 'time' module Amazon module Coral # Performs AWS V2 signatures on QueryStringMap objects. class V2SignatureHelper def initialize(aws_access_key_id, aws_secret_key) @aw...
github
tc/elastic-mapreduce-ruby
https://github.com/tc/elastic-mapreduce-ruby
amazon/aws/exceptions.rb
Ruby
apache-2.0
84
master
6,848
# This file has been copied from: #-- # Amazon Web Services EC2 + ELB API Ruby library # # Ruby Gem Name:: amazon-ec2 # Author:: Glenn Rempe (mailto:glenn@rempe.us) # Copyright:: Copyright (c) 2007-2009 Glenn Rempe # License:: Distributes under the same terms as Ruby # Home:: http://github.com/grempe/amazon...
github
tomdalling/resonad
https://github.com/tomdalling/resonad
resonad.gemspec
Ruby
mit
84
master
995
# coding: utf-8 $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib')) require 'resonad/version' Gem::Specification.new do |spec| spec.name = 'resonad' spec.version = Resonad::VERSION spec.authors = ["Tom Dalling"] spec.email = ['tom' + '@' + 'tomdalling.com'] spec.summary...
github
tomdalling/resonad
https://github.com/tomdalling/resonad
lib/resonad.rb
Ruby
mit
84
master
6,870
class Resonad class NonExistentError < StandardError; end class NonExistentValue < StandardError; end class Success < Resonad attr_accessor :value def self.[](value = nil) if nil == value NIL_SUCCESS else new(value) end end def initialize(value) @value = ...
github
tomdalling/resonad
https://github.com/tomdalling/resonad
spec/spec_helper.rb
Ruby
mit
84
master
648
require "bundler/setup" require "byebug" require "resonad" require "support/naming" RSpec.shared_context 'higher_order_send using block argument' do def higher_order_send(method_name, &block) subject.public_send(method_name, &block) end end RSpec.shared_context 'higher_order_send using callable positional arg...
github
tomdalling/resonad
https://github.com/tomdalling/resonad
spec/unit/mixin_spec.rb
Ruby
mit
84
master
1,670
RSpec.describe Resonad::Mixin do class MixinHost include Resonad::Mixin def gimme_success; Success; end def gimme_failure; Failure; end end def host_eval(&block) MixinHost.new.instance_eval(&block) end it 'has a #Success constructor' do result = host_eval { Success(5) } expect(result...
github
tomdalling/resonad
https://github.com/tomdalling/resonad
spec/unit/success_spec.rb
Ruby
mit
84
master
3,410
RSpec.describe Resonad::Success do subject { Resonad.Success('hello') } it "has an alternate, more-standardly-named constructor method" do alternate = Resonad.success(subject.value) expect(alternate.class).to be(subject.class) expect(alternate.value).to be(subject.value) end it "has an alternate c...
github
tomdalling/resonad
https://github.com/tomdalling/resonad
spec/unit/pattern_matching_spec.rb
Ruby
mit
84
master
918
RSpec.describe 'Ruby 2.7 pattern matching' do describe Resonad::Success do subject { described_class.new('hello') } it 'deconstructs to an array' do case subject in [type, value] expect(type).to eq(:success) expect(value).to eq('hello') else fail end end ...
github
tomdalling/resonad
https://github.com/tomdalling/resonad
spec/unit/failure_spec.rb
Ruby
mit
84
master
3,358
RSpec.describe Resonad::Failure do subject { Resonad.Failure(:buzz) } it "has an alternate, more-standardly-named constructor method" do alternate = Resonad.failure(subject.error) expect(alternate.class).to be(subject.class) expect(alternate.error).to be(subject.error) end it "has an alternate cla...
github
tomdalling/resonad
https://github.com/tomdalling/resonad
spec/unit/resonad_spec.rb
Ruby
mit
84
master
1,510
RSpec.describe Resonad do describe '#rescuing_from' do it 'is successful if no exception is raised' do result = Resonad.rescuing_from { 'hello' } expect(result).to be_success expect(result.value).to eq('hello') end it 'rescues the specified kinds of exceptions' do result = Resonad...
github
tomdalling/resonad
https://github.com/tomdalling/resonad
spec/support/naming.rb
Ruby
mit
84
master
591
module Naming AND_THEN_ALIASES = [:and_then, :flat_map] OR_ELSE_ALIASES = [:or_else, :otherwise, :flat_map_error] SUCCESS_ALIASES = [:success?, :successful?, :ok?] FAILURE_ALIASES = [:failure?, :failed?, :bad?] MAP_ALIASES = [:map, :map_value] ON_PREFIXES = ["on_", "if_", "when_"] ON_SUCCESS_SUFFIXES = S...
github
asonas/rspec-daemon
https://github.com/asonas/rspec-daemon
Gemfile
Ruby
mit
84
main
200
# frozen_string_literal: true source "https://rubygems.org" # Specify your gem's dependencies in rspec-daemon.gemspec gemspec gem "rake", "~> 13.0" gem "rspec", "~> 3.0" gem "rubocop", "~> 1.21"
github
asonas/rspec-daemon
https://github.com/asonas/rspec-daemon
rspec-daemon.gemspec
Ruby
mit
84
main
1,470
# frozen_string_literal: true require_relative "lib/rspec/daemon/version" Gem::Specification.new do |spec| spec.name = "rspec-daemon" spec.version = RSpec::Daemon::VERSION spec.authors = ["Yuya Fujiwara"] spec.email = ["asonas@cookpad.com"] spec.summary = "rspec-daemon is a mechanism to run tests at super ...
github
asonas/rspec-daemon
https://github.com/asonas/rspec-daemon
spec/spec_helper.rb
Ruby
mit
84
main
375
# frozen_string_literal: true require "rspec/daemon" RSpec.configure do |config| # Enable flags like --only-failures and --next-failure config.example_status_persistence_file_path = ".rspec_status" # Disable RSpec exposing methods globally on `Module` and `main` config.disable_monkey_patching! config.expe...
github
asonas/rspec-daemon
https://github.com/asonas/rspec-daemon
example/user_spec.rb
Ruby
mit
84
main
401
class User attr_accessor :birthday def initialize(birthday) @birthday = birthday end def age (Time.now.strftime("%Y%m%d").to_i - self.birthday.strftime("%Y%m%d").to_i) / 10000 end end RSpec.describe "User" do describe "#age" do before do @user = User.new(Time.new(1988, 11, 7)) end ...
github
asonas/rspec-daemon
https://github.com/asonas/rspec-daemon
lib/rspec/daemon.rb
Ruby
mit
84
main
2,656
# frozen_string_literal: true require_relative "daemon/version" require_relative "daemon/configuration" require "socket" require "stringio" require "rspec" module RSpec class Daemon SCRIPT_NAME = File.basename(__FILE__).freeze class Error < StandardError; end def initialize(bind_address, port) ...
github
asonas/rspec-daemon
https://github.com/asonas/rspec-daemon
lib/rspec/daemon/cli.rb
Ruby
mit
84
main
1,136
require_relative '../daemon' module RSpec class Daemon class Cli DEFAULT_OPTIONS = { bind_address: "0.0.0.0", port: 3002, } def self.start(...) new.start(...) end def start(argv) options = DEFAULT_OPTIONS.dup if ENV['RSPEC_DAEMON_BIND_ADDRES...
github
asonas/rspec-daemon
https://github.com/asonas/rspec-daemon
lib/rspec/daemon/configuration.rb
Ruby
mit
84
main
2,116
module RSpec class Daemon class Configuration attr_accessor :config_proxy, :root_shared_examples class RecordingProxy < Struct.new(:target, :recorded_messages) [:include, :extend].each do |method| define_method(method) do |*args| method_missing(method, *args) e...
github
asonas/rspec-daemon
https://github.com/asonas/rspec-daemon
lib/rspec/daemon/client_cli.rb
Ruby
mit
84
main
1,376
require_relative '../daemon' module RSpec class Daemon class ClientCli DEFAULT_OPTIONS = { host: "localhost", port: 3002, } def self.start(...) new.start(...) end def start(argv) options = DEFAULT_OPTIONS.dup option_parser = OptionParser.new...
github
bluerail/twitter-bootstrap-rails-confirm
https://github.com/bluerail/twitter-bootstrap-rails-confirm
twitter-bootstrap-rails-confirm.gemspec
Ruby
mit
84
master
838
# -*- encoding: utf-8 -*- require File.expand_path('../lib/twitter-bootstrap-rails-confirm/version', __FILE__) Gem::Specification.new do |gem| gem.authors = ["Rene van Lieshout"] gem.email = ["rene@bluerail.nl"] gem.description = %q{Confirm dialogs using Twitter Bootstrap} gem.summary = %...
github
bluerail/twitter-bootstrap-rails-confirm
https://github.com/bluerail/twitter-bootstrap-rails-confirm
lib/twitter-bootstrap-rails-confirm.rb
Ruby
mit
84
master
227
require "twitter-bootstrap-rails-confirm/version" module Twitter module Bootstrap module Rails module Confirm require 'twitter-bootstrap-rails-confirm/engine' if defined?(Rails) end end end end
github
remko/kburns
https://github.com/remko/kburns
kburns.rb
Ruby
mit
85
master
9,511
#!/usr/bin/env ruby require 'fastimage' require 'optparse' require 'ostruct' require 'open3' require 'tempfile' ################################################################################ # Parse options ################################################################################ options = OpenStruct.new op...
github
bbc/audio_waveform-ruby
https://github.com/bbc/audio_waveform-ruby
Rakefile
Ruby
apache-2.0
84
master
471
require "bundler/gem_tasks" require 'rspec/core/rake_task' require 'yard' task :default => :test RSpec::Core::RakeTask.new(:test) do |t| t.rspec_opts = ["--color"] end desc "Run tests with code coverage" task :coverage do ENV['COVERAGE'] = "true" Rake::Task["test"].execute end YARD::Rake::YardocTask.new(:doc...
github
bbc/audio_waveform-ruby
https://github.com/bbc/audio_waveform-ruby
audio_waveform-ruby.gemspec
Ruby
apache-2.0
84
master
1,054
$:.unshift File.expand_path('../lib', __FILE__) require 'audio_waveform/version' Gem::Specification.new do |s| s.name = "audio_waveform-ruby" s.version = AudioWaveform::VERSION s.license = 'Apache-2.0' s.authors = ["Chris Needham"] s.email = ["chris.needham@bbc.co.uk"] s...
github
bbc/audio_waveform-ruby
https://github.com/bbc/audio_waveform-ruby
spec/spec_helper.rb
Ruby
apache-2.0
84
master
364
require 'rubygems' require 'bundler/setup' require 'logger' Bundler.require :test if ENV['COVERAGE'] require 'simplecov' SimpleCov.start do # Exclude test code from coverage report add_filter '/spec/' add_filter '/vendor/' end end # add lib to current path $:.unshift(File.join(File.dirname(__FILE_...
github
bbc/audio_waveform-ruby
https://github.com/bbc/audio_waveform-ruby
spec/audio_waveform/version_spec.rb
Ruby
apache-2.0
84
master
202
require 'spec_helper' describe AudioWaveform do describe "version" do it "should return version number" do expect(AudioWaveform::VERSION).to match %r{^(\d+)(\.(\d+)){2}$} end end end
github
bbc/audio_waveform-ruby
https://github.com/bbc/audio_waveform-ruby
spec/audio_waveform/waveform_data_file_spec.rb
Ruby
apache-2.0
84
master
10,875
require 'spec_helper' require 'digest' require 'tempfile' def get_temp_filename(prefix) temp_file = Tempfile.new(prefix) path = temp_file.path temp_file.unlink path end describe AudioWaveform::WaveformDataFile do context "with valid 8-bit data file" do let(:filename) { "spec/data/test_file_stereo_8bit_...
github
bbc/audio_waveform-ruby
https://github.com/bbc/audio_waveform-ruby
lib/audio_waveform/waveform_data_file.rb
Ruby
apache-2.0
84
master
7,063
require 'json' module AudioWaveform # Provides access to audio waveform data, and serialization to and from # binary and JSON data formats. # class WaveformDataFile # @param args [Hash] # # @option args [String] :filename Loads the specified binary waveform data # file. # # @option ...
github
jeremysmithco/active_operator
https://github.com/jeremysmithco/active_operator
active_operator.gemspec
Ruby
mit
84
main
903
# frozen_string_literal: true require_relative "lib/active_operator/version" Gem::Specification.new do |spec| spec.name = "active_operator" spec.version = ActiveOperator::VERSION spec.authors = ["Jeremy Smith"] spec.email = ["jeremy@jeremysmith.co"] spec.summary = "A Rail...
github
jeremysmithco/active_operator
https://github.com/jeremysmithco/active_operator
Rakefile
Ruby
mit
84
main
273
#!/usr/bin/env rake # frozen_string_literal: true require "bundler/gem_tasks" require "minitest/test_task" Minitest::TestTask.create(:test) do |t| t.libs << "test" t.libs << "lib" t.warning = false t.test_globs = ["test/**/*_test.rb"] end task :default => :test
github
jeremysmithco/active_operator
https://github.com/jeremysmithco/active_operator
Gemfile
Ruby
mit
84
main
238
# frozen_string_literal: true source "https://rubygems.org" gemspec gem "rake", "~> 13.0" gem "minitest", "~> 5.0" gem "debug" gem "activerecord", ">= 7.2" gem "activejob", ">= 7.2" gem "railties", ">= 7.2" gem "sqlite3", "~> 2.7"
github
jeremysmithco/active_operator
https://github.com/jeremysmithco/active_operator
test/test_helper.rb
Ruby
mit
84
main
4,755
# frozen_string_literal: true $LOAD_PATH.unshift File.expand_path("../lib", __dir__) require "rails/railtie" require "active_record" require "active_job" require "active_operator" require "debug" require "minitest/autorun" ActiveOperator::Railtie.run_initializers GlobalID.app = "active-operator" ActiveRecord::B...
github
jeremysmithco/active_operator
https://github.com/jeremysmithco/active_operator
test/active_operator/perform_operation_job_test.rb
Ruby
mit
84
main
872
# frozen_string_literal: true require "test_helper" module ActiveOperator class PerformOperationJobTest < ActiveSupport::TestCase test "#perform" do location = create_location location.geocoding.save! with_operation_methods(Geocoding::V2, GeocodingValid) do assert_nil location.latitud...
github
jeremysmithco/active_operator
https://github.com/jeremysmithco/active_operator
test/active_operator/operation_test.rb
Ruby
mit
84
main
3,200
# frozen_string_literal: true require "test_helper" module ActiveOperator class OperationTest < ActiveSupport::TestCase test "#received?" do location = create_location location.geocoding.save! refute location.geocoding.received? location.geocoding.touch(:received_at) assert locati...
github
jeremysmithco/active_operator
https://github.com/jeremysmithco/active_operator
test/active_operator/model_test.rb
Ruby
mit
84
main
742
# frozen_string_literal: true require "test_helper" module ActiveOperator class ModelTest < ActiveSupport::TestCase test "has_operation associations" do location = create_location assert location.address_verification.new_record? assert location.geocoding.new_record? assert_equal locati...
github
jeremysmithco/active_operator
https://github.com/jeremysmithco/active_operator
test/generators/active_operator/install_generator_test.rb
Ruby
mit
84
main
938
# frozen_string_literal: true require "test_helper" require "rails/generators" require "generators/active_operator/install_generator" module ActiveOperator module Generators class InstallGeneratorTest < Rails::Generators::TestCase tests ActiveOperator::Generators::InstallGenerator destination File...
github
jeremysmithco/active_operator
https://github.com/jeremysmithco/active_operator
test/generators/active_operator/operation_generator_test.rb
Ruby
mit
84
main
2,518
# frozen_string_literal: true require "test_helper" require "rails/generators" require "generators/active_operator/operation_generator" module ActiveOperator module Generators class OperationGeneratorTest < Rails::Generators::TestCase tests ActiveOperator::Generators::OperationGenerator destinatio...
github
jeremysmithco/active_operator
https://github.com/jeremysmithco/active_operator
lib/active_operator.rb
Ruby
mit
84
main
329
# frozen_string_literal: true require "active_operator/version" require "active_operator/model" require "active_operator/operation" require "active_operator/perform_operation_job" module ActiveOperator def self.table_name_prefix "active_operator_" end end require "active_operator/railtie" if defined?(Rails::...
github
jeremysmithco/active_operator
https://github.com/jeremysmithco/active_operator
lib/generators/active_operator/operation_generator.rb
Ruby
mit
84
main
490
require 'rails/generators' require 'active_support/inflector' module ActiveOperator module Generators class OperationGenerator < Rails::Generators::NamedBase include Rails::Generators::ResourceHelpers check_class_collision source_root File.expand_path("templates", __dir__) desc "Genera...
github
jeremysmithco/active_operator
https://github.com/jeremysmithco/active_operator
lib/generators/active_operator/install_generator.rb
Ruby
mit
84
main
659
# frozen_string_literal: true require "rails/generators/active_record" module ActiveOperator module Generators class InstallGenerator < Rails::Generators::Base include ActiveRecord::Generators::Migration source_root File.expand_path("templates", __dir__) def copy_migration_file migra...
github
jeremysmithco/active_operator
https://github.com/jeremysmithco/active_operator
lib/active_operator/model.rb
Ruby
mit
84
main
375
# frozen_string_literal: true module ActiveOperator module Model extend ActiveSupport::Concern class_methods do def has_operation(name, class_name: name.to_s.classify) has_one name, class_name:, as: :record, inverse_of: :record, dependent: :destroy define_method(name) { super() || publ...
github
jeremysmithco/active_operator
https://github.com/jeremysmithco/active_operator
lib/active_operator/perform_operation_job.rb
Ruby
mit
84
main
213
# frozen_string_literal: true module ActiveOperator class PerformOperationJob < ActiveJob::Base discard_on ActiveRecord::RecordNotFound def perform(operation) operation.perform end end end
github
jeremysmithco/active_operator
https://github.com/jeremysmithco/active_operator
lib/active_operator/railtie.rb
Ruby
mit
84
main
250
# frozen_string_literal: true module ActiveOperator class Railtie < Rails::Railtie initializer "active_operator.include_model" do ActiveSupport.on_load(:active_record) do include ActiveOperator::Model end end end end
github
jeremysmithco/active_operator
https://github.com/jeremysmithco/active_operator
lib/active_operator/operation.rb
Ruby
mit
84
main
1,087
# frozen_string_literal: true module ActiveOperator class Operation < ActiveRecord::Base self.table_name = "active_operator_operations" belongs_to :record, polymorphic: true def received? = received_at? def processed? = processed_at? def errored? = errored_at? def perform request!...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
Gemfile
Ruby
mit
84
main
7,441
# frozen_string_literal: true ruby(File.read(".ruby-version").strip) # As of Ruby 3.0, the SortedSet class has been extracted from the set library. # You must use the sorted_set gem or other alternatives gem("sorted_set") source("https://rubygems.org") # To bundle edge Rails instead: gem "rails", github: "rails/rai...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
Rakefile
Ruby
mit
84
main
287
# frozen_string_literal: true # Add your own tasks in files placed in lib/tasks ending in .rake, for example # lib/tasks/capistrano.rake, and they will automatically be available to Rake. require_relative("config/application") require("rake") MushroomObserver::Application.load_tasks
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
lib/core_extensions/action_view/log_subscriber.rb
Ruby
mit
84
main
1,777
# frozen_string_literal: true # Overrides because we want these logged at info, not debug level module CoreExtensions module ActionView module LogSubscriber def render_collection(event) identifier = event.payload[:identifier] || "templates" info do message = " Rendered collectio...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
lib/tasks/log_verbose.rake
Ruby
mit
84
main
228
# frozen_string_literal: true # example: rake log db:migrate. Can be very helpful! desc("Run any task with verbose logging, such as a migration") task(log: :environment) do ActiveRecord::Base.logger = Logger.new($stdout) end
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
lib/tasks/cache.rake
Ruby
mit
84
main
5,439
# frozen_string_literal: true namespace :cache do desc "Refresh all the caches" task all: [ :refresh_contributions, :refresh_votes ] desc "Recalculate user contributions" task(refresh_contributions: :environment) do print "Refreshing user.contribution...\n" SiteData.new.get_all_user_data e...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
lib/tasks/user_management.rake
Ruby
mit
84
main
667
# frozen_string_literal: true # lib/tasks/user_management.rake namespace :user do desc "Add a user from the command line" task add: :environment do config_logger service = UserManagementService.new result = service.create_user? exit 1 unless result end desc "Verify a user by login or email" ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
lib/tasks/visual_model.rake
Ruby
mit
84
main
6,428
# frozen_string_literal: true namespace :visual_model do desc "Update a VisualModel from a list of updates" task(update: :environment) do Rails.logger = Logger.new($stdout) model_name = ENV.fetch("MODEL_NAME", nil) update_list = ENV.fetch("UPDATE_LIST", nil) unless model_name && update_list && File...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
lib/tasks/parallel_test.rake
Ruby
mit
84
main
518
# frozen_string_literal: true namespace :parallel do namespace :test do desc "Set up MySQL config files for parallel testing" task setup: :environment do service = ParallelTestConfigService.new result = service.setup_config_files exit 1 unless result end desc "Clean up MySQL config...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
lib/tasks/lang.rake
Ruby
mit
84
main
3,729
# frozen_string_literal: true # This has to be done without access to Language because it is used # to declare tasks before the MO environment has been loaded. def all_locales locales = [] Rails.root.glob("config/locales/*.yml").each do |file| match = /(\w+).yml$/.match(file.to_s) locales << match[1] if ma...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
lib/rubocop/cop/mushroom_observer/no_user_current_in_views.rb
Ruby
mit
84
main
1,732
# frozen_string_literal: true module RuboCop module Cop module MushroomObserver # Flags use of `User.current` in controllers and components. # # Controllers should use `@user` instead, which is set by # ApplicationController. Components should receive `user` as a prop. # # The...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/functional_test_case.rb
Ruby
mit
84
main
1,100
# frozen_string_literal: true # # = Functional Test Case # # The test case class that all functional tests currently derive from. # Includes: # # 1. Some general-purpose helpers and assertions from GeneralExtensions. # 2. Some controller-related helpers and assertions from ControllerExtensions. # 3. A few helper...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/application_system_test_case.rb
Ruby
mit
84
main
3,376
# frozen_string_literal: true # Set env var to run with window: # HEADLESS=0 rails test:system, or for a specific test: # HEADLESS=0 rails t test/system/your_test.rb:234 (line number, optional) require("test_helper") require("database_cleaner/active_record") require("capybara/cuprite") require("test_helpers/system/cup...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/test_helper.rb
Ruby
mit
84
main
7,979
# frozen_string_literal: true # # = Base Test Case # # Does some basic site-wide configuration for all the tests. This is part of # the base class that all unit tests must derive from. # # *NOTE*: This must go directly in Test::Unit::TestCase because of how Rails # tests work. # #################################...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/query_extensions.rb
Ruby
mit
84
main
1,409
# frozen_string_literal: true require("test_helper") # helpers for QueryTest and subclass tests module QueryExtensions def assert_query(expects, *) test_ids = expects.first.is_a?(Integer) expects = [expects].flatten query = Query.lookup(*) actual = test_ids ? query.result_ids : query.results msg...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/flash_extensions.rb
Ruby
mit
84
main
3,008
# frozen_string_literal: true # # = Flash Test Helpers # # Methods in this class are available to all the functional and integration # tests. # # get_last_flash:: Retrieve current list of errors or last set rendered. # assert_flash:: Assert an error was rendered or is pending. # assert_no_flash:: ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/api2_extensions.rb
Ruby
mit
84
main
14,434
# frozen_string_literal: true require("test_helper") # helpers for API2Test and subclass tests module API2Extensions def setup @api_key = api_keys(:rolfs_api_key) super end # -------------------- # :section: Helpers # -------------------- def aor(*) API2::OrderedRange.new(*) end def da...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/capybara_integration_test_case.rb
Ruby
mit
84
main
4,331
# frozen_string_literal: true # = Capybara Integration Test Case # # The test case class that all Capybara integration tests currently derive # from. Includes: # # class YourTest < IntegrationTestCase # # # Most basic test doesn't even need to know about session: all session # # methods are automatical...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/controller_extensions.rb
Ruby
mit
84
main
29,260
# frozen_string_literal: true # # = Controller Test Helpers # # Methods in this class are available to all the functional tests. # # == Request helpers # reget:: Resets request and calls +get+. # login:: Login a user. # logout:: Logout current user. #...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/session_upload.rb
Ruby
mit
84
main
309
# frozen_string_literal: true class FileUpload attr_accessor :filename, :content_type def initialize(filename, content_type) self.filename = filename self.content_type = content_type end end class JpegUpload < FileUpload def initialize(filename) super(filename, "image/jpeg") end end
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/general_extensions.rb
Ruby
mit
84
main
20,403
# frozen_string_literal: true # = General Test Helpers # # Methods in this class are available to all the unit, functional and # integration tests. # # == Test unit helpers # rolf, mary, etc.:: Quick access to User instances. # setup_image_dirs:: Create test image dirs for tests that do image uploads....
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/language_extensions.rb
Ruby
mit
84
main
916
# frozen_string_literal: true # stop-gap fix for # TypeError: superclass mismatch for class Language # /vagrant/mushroom-observer/app/models/language.rb:27:in `<top (required)>' # when running rake require("language") class Language @@verbose_messages = [] def self.override_input_files @@localization_files...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/check_for_unsafe_html.rb
Ruby
mit
84
main
949
# frozen_string_literal: true # # = Check for Unsafe HTML # # This file adds a little bit of code at the end of every get/post request # to ensure that no unsafe HTML has slipped by. # ################################################################################ module CheckForUnsafeHtml def check_for_unsafe_...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/uploaded_string.rb
Ruby
mit
84
main
705
# frozen_string_literal: true module Rack module Test # Simple extension of Rack::Text::UploadedFile which works with StringIO # instead # of an actual file that has to be saved somewhere on the local # filesystem. # # post :upload, :file => Rack::Test::UploadedString( # "file contents"...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/session_form_extensions.rb
Ruby
mit
84
main
18,362
# frozen_string_literal: true # # = Session Form Helpers # # This class represents a single HTML form. It allows you to make assertions # about the kinds and values of input fields available, allows you to modify # them and then submit the result. # # == Attributes # context:: Instance of the session t...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/capybara_macros.rb
Ruby
mit
84
main
1,246
# frozen_string_literal: true # https://www.railsagency.com/blog/2020/03/11/how-to-configure-full-stack-integration-testing-with-selenium-and-ruby-on-rails/ module CapybaraMacros def scroll_to_bottom page.execute_script("window.scrollBy(0,10000)") end def wait_for_ajax Timeout.timeout(Capybara.default_m...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/bullet_helper.rb
Ruby
mit
84
main
529
# frozen_string_literal: true # helper to integrate bullet gem with minitest # from https://github.com/flyerhzm/bullet/issues/442 # Include this helper in any test file where you want to use the gem # Usage: # class <YourTest> < <YourTestCase> # include(BulletHelper) module BulletHelper def before_setup Bull...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/capybara_session_extensions.rb
Ruby
mit
84
main
8,842
# frozen_string_literal: true # # = Capybara Integration Test Helpers # # open_session:: Create a separate named session (for testing concurrent # sessions). Not necessary for single session tests. # Pass a driver arg to change drivers (default is :rack_test) # # = Session-specific m...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/integration_test_case.rb
Ruby
mit
84
main
2,621
# frozen_string_literal: true # = Integration Test Case # # The test case class that all integration tests currently derive from. # Includes: # # class YourTest < IntegrationTestCase # # # Most basic test doesn't even need to know about session: all session # # methods are automatically delegated to a ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/component_test_case.rb
Ruby
mit
84
main
11,858
# frozen_string_literal: true # Base class for component tests that provides common setup and helpers. # Based on https://www.phlex.fun/components/testing.html # # @example Usage # class MyComponentTest < ComponentTestCase # def test_renders_content # html = render(Components::MyComponent.new(title: "Test"...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/session_extensions.rb
Ruby
mit
84
main
14,119
# frozen_string_literal: true # # = Integration Session Test Helpers # # Methods in this class are available to integration tests that inherit from # MO's IntegrationTestCase (uses rails-dom-testing, not Capybara). # # ==== Sessions # login:: Create a session with a given user logged in. # login!:: Same thing...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/test_helpers/system/cuprite_helpers.rb
Ruby
mit
84
main
394
# frozen_string_literal: true module CupriteHelpers # Drop #pause anywhere in a test to stop the execution. # Useful when you want to checkout the contents of a web page in the middle # of a test running in a headful mode. def pause page.driver.pause end # Drop #debug anywhere in a test to open inspec...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/test_helpers/system/cuprite_setup.rb
Ruby
mit
84
main
1,018
# frozen_string_literal: true # First, load Cuprite Capybara integration require("capybara/cuprite") # Then, we need to register our driver to be able to use it later # with #driven_by method. # https://sowenjub.me/writes/replacing-selenium-with-cuprite-for-rails-system-tests/ # If we re-register `:cuprite`, we get a...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/system/observation_form_carousel_system_test.rb
Ruby
mit
84
main
3,095
# frozen_string_literal: true require("application_system_test_case") # Test that carousel images get src attributes populated with base64 data class ObservationFormCarouselSystemTest < ApplicationSystemTestCase def test_uploaded_images_get_base64_src_in_carousel_item_and_thumbnail setup_image_dirs login!(r...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
test/system/translations_system_test.rb
Ruby
mit
84
main
3,970
# frozen_string_literal: true require("application_system_test_case") class TranslationsSystemTest < ApplicationSystemTestCase def test_edit_translation_turbo_form # browser = page.driver.browser rolf = users("rolf") login!(rolf) visit(root_path) use_test_locales do old_one = :one.l ...