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 | pundit-community/pundit-matchers | https://github.com/pundit-community/pundit-matchers | lib/pundit/matchers/permit_all_actions_matcher.rb | Ruby | mit | 245 | main | 1,327 | # frozen_string_literal: true
require_relative 'base_matcher'
module Pundit
module Matchers
# This matcher tests whether a policy permits all actions.
class PermitAllActionsMatcher < BaseMatcher
# A description of the matcher.
#
# @return [String] A description of the matcher.
def de... |
github | pundit-community/pundit-matchers | https://github.com/pundit-community/pundit-matchers | lib/pundit/matchers/permit_actions_matcher.rb | Ruby | mit | 245 | main | 2,144 | # frozen_string_literal: true
require_relative 'actions_matcher'
module Pundit
module Matchers
# This matcher tests whether a policy permits or forbids the expected actions.
class PermitActionsMatcher < ActionsMatcher
# A description of the matcher.
#
# @return [String] Description of the ... |
github | pundit-community/pundit-matchers | https://github.com/pundit-community/pundit-matchers | lib/pundit/matchers/actions_matcher.rb | Ruby | mit | 245 | main | 1,924 | # frozen_string_literal: true
require_relative 'base_matcher'
module Pundit
module Matchers
# This is the base action matcher class. Matchers related to actions should inherit from this class.
class ActionsMatcher < BaseMatcher
# Error message when actions are not implemented in a policy.
ACTION... |
github | pundit-community/pundit-matchers | https://github.com/pundit-community/pundit-matchers | lib/pundit/matchers/attributes_matcher.rb | Ruby | mit | 245 | main | 2,974 | # frozen_string_literal: true
require_relative 'base_matcher'
module Pundit
module Matchers
# The AttributesMatcher class is used to test whether a Pundit policy allows or denies access to certain attributes.
class AttributesMatcher < BaseMatcher
# Error message to be raised when no attributes are spe... |
github | pundit-community/pundit-matchers | https://github.com/pundit-community/pundit-matchers | lib/pundit/matchers/forbid_only_actions_matcher.rb | Ruby | mit | 245 | main | 1,941 | # frozen_string_literal: true
require_relative 'actions_matcher'
module Pundit
module Matchers
# This matcher tests whether a policy forbids only the expected actions.
class ForbidOnlyActionsMatcher < ActionsMatcher
# A description of the matcher.
#
# @return [String] Description of the ma... |
github | pundit-community/pundit-matchers | https://github.com/pundit-community/pundit-matchers | lib/pundit/matchers/base_matcher.rb | Ruby | mit | 245 | main | 703 | # frozen_string_literal: true
require_relative 'utils/policy_info'
module Pundit
module Matchers
# This is the base class for all matchers in the Pundit Matchers library.
class BaseMatcher
include ::RSpec::Matchers::Composable
# Error message when an ambiguous negated matcher is used.
AMB... |
github | pundit-community/pundit-matchers | https://github.com/pundit-community/pundit-matchers | lib/pundit/matchers/forbid_all_actions_matcher.rb | Ruby | mit | 245 | main | 1,258 | # frozen_string_literal: true
require_relative 'base_matcher'
module Pundit
module Matchers
# This matcher tests whether a policy forbids all actions.
class ForbidAllActionsMatcher < BaseMatcher
# A description of the matcher.
#
# @return [String] Description of the matcher.
def desc... |
github | pundit-community/pundit-matchers | https://github.com/pundit-community/pundit-matchers | lib/pundit/matchers/permit_attributes_matcher.rb | Ruby | mit | 245 | main | 2,420 | # frozen_string_literal: true
require_relative 'attributes_matcher'
module Pundit
module Matchers
# This matcher tests whether a policy permits or forbids the mass assignment of the expected attributes.
class PermitAttributesMatcher < AttributesMatcher
# A description of the matcher.
#
# @... |
github | pundit-community/pundit-matchers | https://github.com/pundit-community/pundit-matchers | lib/pundit/matchers/permit_only_actions_matcher.rb | Ruby | mit | 245 | main | 1,941 | # frozen_string_literal: true
require_relative 'actions_matcher'
module Pundit
module Matchers
# This matcher tests whether a policy permits only the expected actions.
class PermitOnlyActionsMatcher < ActionsMatcher
# A description of the matcher.
#
# @return [String] A description of the ... |
github | pundit-community/pundit-matchers | https://github.com/pundit-community/pundit-matchers | lib/pundit/matchers/utils/policy_info.rb | Ruby | mit | 245 | main | 3,208 | # frozen_string_literal: true
module Pundit
module Matchers
module Utils
# This class provides methods to retrieve information about a policy class,
# such as the actions it defines and which of those actions are permitted
# or forbidden. It also provides a string representation of the policy c... |
github | pundit-community/pundit-matchers | https://github.com/pundit-community/pundit-matchers | spec/policy_factory.rb | Ruby | mit | 245 | main | 772 | # frozen_string_literal: true
class TestPolicy
class << self
def name
'TestPolicy'
end
alias to_s name
end
def user
'user'
end
end
class DynamicTestPolicy < TestPolicy
def method_missing(method, *args, &)
method_s = method.to_s
return super unless method_s.end_with?('?')
... |
github | pundit-community/pundit-matchers | https://github.com/pundit-community/pundit-matchers | spec/shared_examples.rb | Ruby | mit | 245 | main | 2,386 | # frozen_string_literal: true
RSpec.shared_examples_for 'a composable matcher' do
it 'is composable' do
expect(described_class).to include(RSpec::Matchers::Composable)
end
end
RSpec.shared_examples_for 'an actions matcher' do
it_behaves_like 'a composable matcher'
it 'initializes expected actions with a ... |
github | pundit-community/pundit-matchers | https://github.com/pundit-community/pundit-matchers | spec/spec_helper.rb | Ruby | mit | 245 | main | 4,895 | # frozen_string_literal: true
if ENV['COVERAGE']
require 'simplecov'
SimpleCov.start do
add_filter '/spec'
end
end
require 'rspec/matchers/fail_matchers'
require 'pundit/matchers'
require_relative 'policy_factory'
require_relative 'shared_examples'
# This file was generated by the `rspec --init` command.... |
github | pundit-community/pundit-matchers | https://github.com/pundit-community/pundit-matchers | spec/pundit/matchers/permit_only_actions_matcher_spec.rb | Ruby | mit | 245 | main | 3,034 | # frozen_string_literal: true
RSpec.describe Pundit::Matchers::PermitOnlyActionsMatcher do
it_behaves_like 'an ambiguous negated matcher', name: 'permit_only_actions', with_args: true
it_behaves_like 'an actions matcher'
describe '#description' do
subject { described_class.new(:test).description }
it {... |
github | pundit-community/pundit-matchers | https://github.com/pundit-community/pundit-matchers | spec/pundit/matchers/forbid_all_actions_matcher_spec.rb | Ruby | mit | 245 | main | 1,965 | # frozen_string_literal: true
RSpec.describe Pundit::Matchers::ForbidAllActionsMatcher do
it_behaves_like 'an ambiguous negated matcher', name: 'forbid_all_actions'
describe '#description' do
subject { described_class.new.description }
it { is_expected.to eq 'forbid all actions' }
end
describe '#mat... |
github | pundit-community/pundit-matchers | https://github.com/pundit-community/pundit-matchers | spec/pundit/matchers/permit_all_actions_matcher_spec.rb | Ruby | mit | 245 | main | 1,962 | # frozen_string_literal: true
RSpec.describe Pundit::Matchers::PermitAllActionsMatcher do
it_behaves_like 'an ambiguous negated matcher', name: 'permit_all_actions'
describe '#description' do
subject { described_class.new.description }
it { is_expected.to eq 'permit all actions' }
end
describe '#mat... |
github | pundit-community/pundit-matchers | https://github.com/pundit-community/pundit-matchers | spec/pundit/matchers/permit_attributes_matcher_spec.rb | Ruby | mit | 245 | main | 11,606 | # frozen_string_literal: true
RSpec.describe Pundit::Matchers::PermitAttributesMatcher do
it_behaves_like 'a composable matcher'
it 'initializes expected attributes with a single attribute' do
expect(described_class.new(:test).send(:expected_attributes)).to eq %i[test]
end
it 'initializes expected attrib... |
github | pundit-community/pundit-matchers | https://github.com/pundit-community/pundit-matchers | spec/pundit/matchers/configuration_spec.rb | Ruby | mit | 245 | main | 1,053 | # frozen_string_literal: true
RSpec.describe Pundit::Matchers, '.configuration' do
describe '#user_alias' do
subject { described_class.configuration.user_alias(policy) }
let(:policy) { policy_factory }
it { is_expected.to eq :user }
context 'with a different default' do
before do
des... |
github | pundit-community/pundit-matchers | https://github.com/pundit-community/pundit-matchers | spec/pundit/matchers/forbid_only_actions_matcher_spec.rb | Ruby | mit | 245 | main | 3,037 | # frozen_string_literal: true
RSpec.describe Pundit::Matchers::ForbidOnlyActionsMatcher do
it_behaves_like 'an ambiguous negated matcher', name: 'forbid_only_actions', with_args: true
it_behaves_like 'an actions matcher'
describe '#description' do
subject { described_class.new(:test).description }
it {... |
github | pundit-community/pundit-matchers | https://github.com/pundit-community/pundit-matchers | spec/pundit/matchers/permit_actions_matcher_spec.rb | Ruby | mit | 245 | main | 7,387 | # frozen_string_literal: true
RSpec.describe Pundit::Matchers::PermitActionsMatcher do
it_behaves_like 'an actions matcher'
describe '#description' do
subject { described_class.new(:test).description }
it { is_expected.to eq 'permit [:test]' }
end
describe '#matches?' do
subject { matcher.matche... |
github | pundit-community/pundit-matchers | https://github.com/pundit-community/pundit-matchers | spec/pundit/matchers/utils/policy_info_spec.rb | Ruby | mit | 245 | main | 1,813 | # frozen_string_literal: true
RSpec.describe Pundit::Matchers::Utils::PolicyInfo do
subject(:policy_info) { described_class.new(policy) }
let(:policy) do
policy_factory(update?: false, create?: true, new?: true,
user: 'Test User', custom_user: 'Custom Test User')
end
context 'when poli... |
github | adamcooke/authie | https://github.com/adamcooke/authie | Gemfile | Ruby | mit | 245 | main | 315 | # frozen_string_literal: true
source 'https://rubygems.org'
gemspec
gem 'appraisal', '2.5.0'
gem 'rails', '>= 5.0', '< 9.0'
gem 'rspec'
gem 'rspec-core'
gem 'rspec-expectations'
gem 'rspec-mocks'
gem 'rspec-rails'
gem 'rubocop'
gem 'simplecov'
gem 'simplecov-console'
gem 'solargraph'
gem 'sqlite3'
gem 'timecop' |
github | adamcooke/authie | https://github.com/adamcooke/authie | authie.gemspec | Ruby | mit | 245 | main | 669 | # frozen_string_literal: true
require File.expand_path('lib/authie/version', __dir__)
# rubocop:disable Gemspec/RequireMFA
Gem::Specification.new do |s|
s.name = 'authie'
s.description = 'A Rails library for storing user sessions in a backend database'
s.summary = s.description
s.homepage ... |
github | adamcooke/authie | https://github.com/adamcooke/authie | lib/authie/rack_controller.rb | Ruby | mit | 245 | main | 1,177 | # frozen_string_literal: true
# If you're dealing with your authentication in a middleware and you only have
# access to your rack environment, this will wrap around rack and make it look
# close enough to an ActionController to work with Authie
#
# Usage:
#
# controller = Authie::RackController.new(@env)
# controller... |
github | adamcooke/authie | https://github.com/adamcooke/authie | lib/authie/version.rb | Ruby | mit | 245 | main | 282 | # frozen_string_literal: true
module Authie
VERSION_FILE_ROOT = File.expand_path('../../VERSION', __dir__)
VERSION = if File.file?(VERSION_FILE_ROOT)
File.read(VERSION_FILE_ROOT).strip.sub(/\Av/, '')
else
'0.0.0.dev'
end
end |
github | adamcooke/authie | https://github.com/adamcooke/authie | lib/authie/controller_extension.rb | Ruby | mit | 245 | main | 1,176 | # frozen_string_literal: true
require 'authie/controller_delegate'
module Authie
module ControllerExtension
class << self
def included(base)
base.helper_method :logged_in?, :current_user, :auth_session if base.respond_to?(:helper_method)
base.before_action :set_browser_id, :validate_auth_... |
github | adamcooke/authie | https://github.com/adamcooke/authie | lib/authie/session_model.rb | Ruby | mit | 245 | main | 4,192 | # frozen_string_literal: true
require 'active_record'
require 'securerandom'
require 'authie/config'
module Authie
class SessionModel < ActiveRecord::Base
attr_accessor :temporary_token
self.table_name = 'authie_sessions'
belongs_to :parent, class_name: 'Authie::SessionModel', optional: true
scop... |
github | adamcooke/authie | https://github.com/adamcooke/authie | lib/authie/controller_delegate.rb | Ruby | mit | 245 | main | 3,676 | # frozen_string_literal: true
require 'securerandom'
require 'authie/session'
require 'authie/config'
require 'authie/session_model'
module Authie
# The controller delegate implements methods that can be used by a controller. These are then
# extended into controllers as needed (see ControllerExtension).
class ... |
github | adamcooke/authie | https://github.com/adamcooke/authie | lib/authie/session.rb | Ruby | mit | 245 | main | 11,028 | # frozen_string_literal: true
require 'authie/session_model'
require 'authie/error'
require 'authie/config'
require 'active_support/core_ext/module/delegation'
module Authie
class Session
# The underlying session model instance
#
# @return [Authie::SessionModel]
attr_reader :session
# A parent ... |
github | adamcooke/authie | https://github.com/adamcooke/authie | lib/authie/config.rb | Ruby | mit | 245 | main | 1,501 | # frozen_string_literal: true
module Authie
class Config
attr_accessor :session_inactivity_timeout
attr_accessor :persistent_session_length
attr_accessor :sudo_session_timeout
attr_accessor :browser_id_cookie_name
attr_accessor :session_token_length
attr_accessor :extend_session_expiry_on_tou... |
github | adamcooke/authie | https://github.com/adamcooke/authie | lib/authie/engine.rb | Ruby | mit | 245 | main | 408 | # frozen_string_literal: true
module Authie
class Engine < ::Rails::Engine
engine_name 'authie'
initializer 'authie.initialize' do |_app|
ActiveSupport.on_load :active_record do
require 'authie/session'
end
ActiveSupport.on_load :action_controller do
require 'authie/contro... |
github | adamcooke/authie | https://github.com/adamcooke/authie | lib/authie/user.rb | Ruby | mit | 245 | main | 211 | # frozen_string_literal: true
module Authie
module User
def self.included(base)
base.has_many :user_sessions, class_name: 'Authie::SessionModel', as: :user, dependent: :delete_all
end
end
end |
github | adamcooke/authie | https://github.com/adamcooke/authie | spec/spec_helper.rb | Ruby | mit | 245 | main | 1,453 | # frozen_string_literal: true
require 'logger'
require 'active_record'
require 'timecop'
ENV['RAILS_ENV'] = 'test'
if %w[yes true 1].include?(ENV['COVERAGE'])
require 'simplecov'
require 'simplecov-console'
require 'simplecov_json_formatter'
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
... |
github | adamcooke/authie | https://github.com/adamcooke/authie | spec/dummy/app/controllers/pages_controller.rb | Ruby | mit | 245 | main | 524 | # frozen_string_literal: true
class PagesController < ApplicationController
def index
render plain: 'Hello world!'
end
def authenticated
render plain: "Hello #{current_user.username}!"
end
def request_count
render plain: "Count: #{auth_session.requests}"
end
def logged_in
if logged_in?... |
github | adamcooke/authie | https://github.com/adamcooke/authie | spec/dummy/config/application.rb | Ruby | mit | 245 | main | 838 | # frozen_string_literal: true
require_relative 'boot'
require 'action_controller/railtie'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
require 'authie/engine'
module Dummy
class Application < Rails::Application
... |
github | adamcooke/authie | https://github.com/adamcooke/authie | spec/dummy/config/routes.rb | Ruby | mit | 245 | main | 319 | # frozen_string_literal: true
Rails.application.routes.draw do
get '/', to: 'pages#index'
get '/authenticated', to: 'pages#authenticated'
get '/logged_in', to: 'pages#logged_in'
get '/request_count', to: 'pages#request_count'
get '/error', to: 'pages#error'
get '/no_touching', to: 'pages#no_touching'
end |
github | adamcooke/authie | https://github.com/adamcooke/authie | spec/dummy/config/environments/test.rb | Ruby | mit | 245 | main | 2,410 | # frozen_string_literal: true
require 'active_support/core_ext/integer/time'
# 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 r... |
github | adamcooke/authie | https://github.com/adamcooke/authie | spec/support/controller_helpers.rb | Ruby | mit | 245 | main | 386 | # frozen_string_literal: true
require 'action_controller'
require 'action_controller/test_case'
module ControllerHelpers
def make_controller
controller_class = Class.new(ActionController::Base)
controller = controller_class.new
controller.set_request!(ActionController::TestRequest.create(controller_clas... |
github | adamcooke/authie | https://github.com/adamcooke/authie | spec/lib/session_spec.rb | Ruby | mit | 245 | main | 13,932 | # frozen_string_literal: true
require 'spec_helper'
require 'authie/session'
RSpec.describe Authie::Session do
subject(:browser_id) { SecureRandom.uuid }
subject(:user) { User.create!(username: 'adam') }
subject(:session_model) { Authie::SessionModel.create!(user: user, browser_id: browser_id) }
subject(:cont... |
github | adamcooke/authie | https://github.com/adamcooke/authie | spec/lib/config_spec.rb | Ruby | mit | 245 | main | 3,043 | # frozen_string_literal: true
require 'spec_helper'
require 'authie/config'
RSpec.describe Authie::Config do
subject(:config) { described_class.new }
after do
Authie.instance_variable_set('@config', nil)
end
describe Authie do
describe '.config' do
it 'returns a config instance' do
exp... |
github | adamcooke/authie | https://github.com/adamcooke/authie | spec/lib/user_spec.rb | Ruby | mit | 245 | main | 565 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Authie::User do
subject(:user) { User.create!(username: 'adam') }
describe '#user_sessions' do
it 'returns sessions belonging to the user' do
session = Authie::SessionModel.create!(user: user)
expect(user.user_sessions).to eq [ses... |
github | adamcooke/authie | https://github.com/adamcooke/authie | spec/lib/controller_delegate_spec.rb | Ruby | mit | 245 | main | 5,915 | # frozen_string_literal: true
require 'spec_helper'
require 'authie/controller_delegate'
require 'action_controller'
require 'action_controller/test_case'
RSpec.describe Authie::ControllerDelegate do
subject(:controller) { make_controller }
subject(:delegate) { described_class.new(controller) }
context 'when a... |
github | adamcooke/authie | https://github.com/adamcooke/authie | spec/lib/session_model_spec.rb | Ruby | mit | 245 | main | 11,932 | # frozen_string_literal: true
require 'spec_helper'
require 'authie/session_model'
RSpec.describe Authie::SessionModel do
subject(:user) { User.create!(username: 'adam') }
subject(:session_model) { described_class.new(user: user) }
context '#on creation' do
it 'limits the size of user agents to 255 charact... |
github | adamcooke/authie | https://github.com/adamcooke/authie | spec/integration/controller_extension_spec.rb | Ruby | mit | 245 | main | 2,912 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe PagesController, type: :controller do
it 'sets a browser ID is set on every page request' do
get :index
expect(cookies[:browser_id]).to match(/\A[a-f0-9-]{36}\z/)
expect(response.body).to eq 'Hello world!'
end
it 'can access the cur... |
github | adamcooke/authie | https://github.com/adamcooke/authie | db/migrate/20150305135400_add_two_factor_auth_fields_to_authie.rb | Ruby | mit | 245 | main | 369 | # frozen_string_literal: true
class AddTwoFactorAuthFieldsToAuthie < ActiveRecord::Migration[6.1]
def change
add_column :authie_sessions, :two_factored_at, :datetime
add_column :authie_sessions, :two_factored_ip, :string
add_column :authie_sessions, :requests, :integer, default: 0
add_column :authie_... |
github | adamcooke/authie | https://github.com/adamcooke/authie | db/migrate/20230627165500_add_countries_to_authie_sessions.rb | Ruby | mit | 245 | main | 315 | # frozen_string_literal: true
class AddCountriesToAuthieSessions < ActiveRecord::Migration[6.1]
def change
add_column :authie_sessions, :login_ip_country, :string
add_column :authie_sessions, :two_factored_ip_country, :string
add_column :authie_sessions, :last_activity_ip_country, :string
end
end |
github | adamcooke/authie | https://github.com/adamcooke/authie | db/migrate/20141012174250_create_authie_sessions.rb | Ruby | mit | 245 | main | 505 | # frozen_string_literal: true
class CreateAuthieSessions < ActiveRecord::Migration[6.1]
def change
create_table :authie_sessions do |t|
t.string :token, :browser_id
t.bigint :user_id
t.boolean :active, default: true
t.text :data
t.datetime :expires_at
t.datetime :login_at
... |
github | adamcooke/authie | https://github.com/adamcooke/authie | db/migrate/20141013115205_add_indexes_to_authie_sessions.rb | Ruby | mit | 245 | main | 319 | # frozen_string_literal: true
class AddIndexesToAuthieSessions < ActiveRecord::Migration[6.1]
def change
add_column :authie_sessions, :user_type, :string
add_index :authie_sessions, :token, length: 10
add_index :authie_sessions, :browser_id, length: 10
add_index :authie_sessions, :user_id
end
end |
github | tpope/fivemat | https://github.com/tpope/fivemat | fivemat.gemspec | Ruby | mit | 245 | master | 764 | # -*- encoding: utf-8 -*-
Gem::Specification.new do |gem|
gem.name = "fivemat"
gem.version = "1.3.7"
gem.authors = ["Tim Pope"]
gem.email = ["code@tp" + 'ope.net']
gem.description = %q{MiniTest/RSpec/Cucumber formatter that gives each test file its own line of dots}
gem.summa... |
github | tpope/fivemat | https://github.com/tpope/fivemat | lib/fivemat.rb | Ruby | mit | 245 | master | 1,413 | require 'fivemat/elapsed_time'
module Fivemat
autoload :Cucumber, 'fivemat/cucumber'
autoload :Cucumber3, 'fivemat/cucumber3'
autoload :MiniTest, 'fivemat/minitest/unit'
autoload :RSpec, 'fivemat/rspec'
autoload :RSpec3, 'fivemat/rspec3'
autoload :Spec, 'fivemat/spec'
def cucumber3?
defined?(::Cucum... |
github | tpope/fivemat | https://github.com/tpope/fivemat | lib/fivemat/rspec3.rb | Ruby | mit | 245 | master | 1,706 | module Fivemat
class RSpec3
include ElapsedTime
# See fivemat.rb for formatter registration.
attr_reader :output, :failed_notifications
def initialize(output)
@output = output
@group_level = 0
@index_offset = 0
@failed_notifications = []
end
def color
unless de... |
github | tpope/fivemat | https://github.com/tpope/fivemat | lib/fivemat/cucumber3.rb | Ruby | mit | 245 | master | 1,118 | require 'cucumber/formatter/progress'
module Fivemat
class Cucumber3 < ::Cucumber::Formatter::Progress
include ElapsedTime
def on_test_case_started(event)
super
feature = event.test_case.feature
unless same_feature_as_previous_test_case?(feature)
after_feature unless @current_feat... |
github | tpope/fivemat | https://github.com/tpope/fivemat | lib/fivemat/elapsed_time.rb | Ruby | mit | 245 | master | 214 | module ElapsedTime
def print_elapsed_time(io, start_time)
if ENV['FIVEMAT_PROFILE']
elapsed_time = (((Time.now - start_time) * 100).to_i / 100.0)
io.print " (#{elapsed_time}s)"
end
end
end |
github | tpope/fivemat | https://github.com/tpope/fivemat | lib/fivemat/rspec.rb | Ruby | mit | 245 | master | 2,156 | require 'rspec/core/formatters/progress_formatter'
module Fivemat
class RSpec < ::RSpec::Core::Formatters::ProgressFormatter
include ElapsedTime
def initialize(*)
super
@group_level = 0
@index_offset = 0
@cumulative_failed_examples = []
end
def example_group_started(group)
... |
github | tpope/fivemat | https://github.com/tpope/fivemat | lib/fivemat/spec.rb | Ruby | mit | 245 | master | 1,532 | require 'spec/runner/formatter/progress_bar_formatter'
module Fivemat
class Spec < ::Spec::Runner::Formatter::ProgressBarFormatter
include ElapsedTime
def initialize(*)
super
@dumping = false
@example_group_number = 0
@failed_examples = []
@failure_index_offset = 1
@last_... |
github | tpope/fivemat | https://github.com/tpope/fivemat | lib/fivemat/cucumber.rb | Ruby | mit | 245 | master | 856 | require 'cucumber/formatter/progress'
module Fivemat
class Cucumber < ::Cucumber::Formatter::Progress
include ElapsedTime
def feature_name(keyword, name)
@io.print "#{name.sub(/^\s*/, '').split("\n").first} "
@io.flush
end
def before_feature(feature)
@exceptions = []
@start_... |
github | tpope/fivemat | https://github.com/tpope/fivemat | lib/fivemat/minitest/unit.rb | Ruby | mit | 245 | master | 834 | require 'minitest/unit'
require 'fivemat/elapsed_time'
module Fivemat
module MiniTest
class Unit < ::MiniTest::Unit
include ElapsedTime
def _run_suites(suites, type)
offset = 0
suites.reject do |suite|
filter = options[:filter] || '/./'
filter = Regexp.new $1 if f... |
github | tpope/fivemat | https://github.com/tpope/fivemat | lib/minitest/fivemat_plugin.rb | Ruby | mit | 245 | master | 748 | require 'fivemat/elapsed_time'
module Minitest
class FivematReporter < Reporter
include ElapsedTime
def initialize(*args)
super
@class = nil
end
def record(result)
if @class != result.klass
if @class
print_elapsed_time(io, @class_start_time)
io.print "\... |
github | dv/redis-semaphore | https://github.com/dv/redis-semaphore | redis-semaphore.gemspec | Ruby | mit | 244 | master | 789 | Gem::Specification.new do |s|
s.name = 'redis-semaphore'
s.version = '0.3.1'
s.summary = 'Implements a distributed semaphore or mutex using Redis.'
s.authors = ['David Verhasselt']
s.email = 'david@crowdway.com'
s.homepage = 'http://github.com/dv/redis-semaphore'
s.license ... |
github | dv/redis-semaphore | https://github.com/dv/redis-semaphore | spec/spec_helper.rb | Ruby | mit | 244 | master | 271 | require 'rubygems'
require 'bundler/setup'
Bundler.require(:development)
$TESTING=true
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
require 'redis/semaphore'
RSpec.configure do |c|
c.filter_run focus: true
c.run_all_when_everything_filtered = true
end |
github | dv/redis-semaphore | https://github.com/dv/redis-semaphore | spec/semaphore_spec.rb | Ruby | mit | 244 | master | 8,616 | require File.dirname(__FILE__) + '/spec_helper'
describe "redis" do
before(:all) do
# use database 15 for testing so we dont accidentally step on your real data
@redis = Redis.new :db => 15
end
before(:each) do
@redis.flushdb
end
after(:all) do
@redis.quit
end
shared_examples_for "a se... |
github | dv/redis-semaphore | https://github.com/dv/redis-semaphore | lib/redis/semaphore.rb | Ruby | mit | 244 | master | 6,331 | require 'redis'
class Redis
class Semaphore
EXISTS_TOKEN = "1"
API_VERSION = "1"
# stale_client_timeout is the threshold of time before we assume
# that something has gone terribly wrong with a client and we
# invalidate it's lock.
# Default is nil for which we don't check for stale clients
... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | Rakefile | Ruby | mit | 244 | master | 258 | require "bundler/gem_tasks"
require "rake/testtask"
require "dotenv/load"
require "fileutils"
Rake::TestTask.new do |t|
t.libs << "test"
t.test_files = FileList['test/*.rb']
t.verbose = true
t.ruby_opts << "-rminitest/pride"
t.warning = false
end |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | plaid.gemspec | Ruby | mit | 244 | master | 1,464 | # -*- encoding: utf-8 -*-
=begin
#The Plaid API
#The Plaid REST API. Please see https://plaid.com/docs/api for more details.
The version of the OpenAPI document: 2020-09-14_1.688.6
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 6.3.0
=end
$:.push File.expand_path("../lib", __FILE__)
requi... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | test/test_statements.rb | Ruby | mit | 244 | master | 2,748 | require_relative "test_helper"
require "date"
# Internal: The test for Plaid::Statements.
class PlaidStatementsTest < PlaidTest
def test_full_flow # rubocop:disable Metrics/MethodLength
create_item initial_products: [:statements],
options: {
statements: {
... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | test/test_configuration.rb | Ruby | mit | 244 | master | 664 | require_relative "test_helper"
# Internal: The test for Plaid::Configuration.
class PlaidConfigurationTest < PlaidTest
def test_api_host
configuration = Plaid::Configuration.new
configuration.server_index = 0
assert_equal "https://production.plaid.com",
configuration.base_url
confi... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | test/test_liabilities.rb | Ruby | mit | 244 | master | 1,457 | require_relative "test_helper"
# Internal: The test for Plaid::Liabilities.
class PlaidLiabilitiesTest < PlaidTest
def test_get
create_item initial_products: [:liabilities], institution_id: "ins_109508"
liabilities_get_request = Plaid::LiabilitiesGetRequest.new
liabilities_get_request.access_token = acc... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | test/test_categories.rb | Ruby | mit | 244 | master | 280 | require_relative 'test_helper'
# Internal: The test for Plaid::CategoriesGet.
class PlaidCategoriesTest < PlaidTest
def test_get
response = client.categories_get({})
assert_instance_of(Plaid::CategoriesGetResponse, response)
refute_empty(response.to_hash)
end
end |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | test/test_webhooks.rb | Ruby | mit | 244 | master | 944 | require_relative "test_helper"
# Internal: The test for Plaid::Webhooks.
class PlaidWebhooksTest < PlaidTest
def test_get_verification_key
key_id = "6c5516e1-92dc-479e-a8ff-5a51992e0001"
webhook_verification_key_get_request = Plaid::WebhookVerificationKeyGetRequest.new
webhook_verification_key_get_reque... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | test/test_transactions.rb | Ruby | mit | 244 | master | 5,962 | require "date"
require_relative "test_helper"
# Internal: The test for Plaid::Transactions.
class PlaidTransactionsTest < PlaidTest # rubocop:disable Metrics/ClassLength
START_DATE = (Date.today - 365)
END_DATE = Date.today
def setup
create_item initial_products: [:transactions],
transactio... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | test/test_investments.rb | Ruby | mit | 244 | master | 8,105 | require "date"
require_relative "test_helper"
# Internal: The test for Plaid::Investments.
class PlaidInvestmentsTest < PlaidTest # rubocop:disable Metrics/ClassLength
START_DATE = (Date.today - 365)
END_DATE = Date.today
def setup
create_item initial_products: [:investments],
transactions_... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | test/test_sandbox.rb | Ruby | mit | 244 | master | 1,133 | require_relative 'test_helper'
class PlaidSandboxTest < PlaidTest
# rubocop:disable Metrics/MethodLength
def test_sandbox_income_verification
skip "TODO (czhou): unskip when tests are fixed"
# test sandbox public token for income verification
sandbox_public_token_create_request = Plaid:... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | test/test_bank_transfers.rb | Ruby | mit | 244 | master | 7,314 | require_relative "test_helper"
# Internal: The test for Plaid::BankTransfers.
class PlaidBankTransfersTest < PlaidTest
attr_reader :account
def setup
create_item initial_products: [:auth]
accounts_get_request = Plaid::AccountsGetRequest.new({
:access_token => access_token,
})
account_resp ... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | test/test_link_token.rb | Ruby | mit | 244 | master | 4,306 | require_relative "test_helper"
# Internal: The test for Plaid::Item.
class PlaidLinkTokenTest < PlaidTest
def test_create_required
link_token_create_request = Plaid::LinkTokenCreateRequest.new(
{
user: {
client_user_id: "user-id",
},
client_name: "Plaid Test",
p... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | test/test_institutions.rb | Ruby | mit | 244 | master | 5,183 | require_relative "test_helper"
# Internal: The test for Plaid::Institutions.
class PlaidInstitutionsTest < PlaidTest
def test_get
institutions_get_request = Plaid::InstitutionsGetRequest.new({
:count => 3,
:offset => 4,
:country_codes => ["US"],
})
response = client.institutions_get(in... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | test/test_helper.rb | Ruby | mit | 244 | master | 3,935 | require 'bundler'
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
warn e.message
warn 'Run `bundle install` to install missing gems'
exit e.status_code
end
require "plaid"
require "minitest/autorun"
require "minitest/around/unit"
require "json"
# Internal: Default read timeout f... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | test/test_enrich.rb | Ruby | mit | 244 | master | 1,977 | require_relative 'test_helper'
# Internal: The test for Plaid::Enrich.
class PlaidEnrichTest < PlaidTest
def test_get
sample_transactions_to_enrich = [
Plaid::ClientProvidedTransaction.new({
id: "1",
description: "TST *JETTIES BAGELS",
amount: 10.00,
direction: Plaid::Enrich... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | test/test_asset_report.rb | Ruby | mit | 244 | master | 5,790 | require_relative "test_helper"
# Internal: The test for Plaid::AssetReport.
class PlaidAssetReportTest < PlaidTest
def test_full_flow # rubocop:disable Metrics/MethodLength
# Create an item with the "assets" product.
create_item initial_products: [:assets]
# Create an asset report.
days_requested = ... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | test/test_auth.rb | Ruby | mit | 244 | master | 1,702 | require_relative 'test_helper'
# Internal: The test for Plaid::Auth.
class PlaidAuthTest < PlaidTest
def setup
create_item initial_products: [:auth]
end
def test_get
auth_get_request = Plaid::AuthGetRequest.new
auth_get_request.access_token = access_token
response = client.auth_get(auth_get_req... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | test/test_processor.rb | Ruby | mit | 244 | master | 2,100 | require_relative "test_helper"
# Internal: The test for Plaid::Processor.
class PlaidProcessorTest < PlaidTest
def setup
create_item initial_products: [:auth]
end
def test_stripe_bank_account_token_create_invalid_account_id
processor_token_create_request = Plaid::ProcessorStripeBankAccountTokenCreateReq... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | test/test_payment_initiation.rb | Ruby | mit | 244 | master | 3,924 | require_relative "test_helper"
# Internal: The test for Plaid::PaymentInitiation.
class PlaidPaymentInitiationTest < PlaidTest
# rubocop:disable Metrics/MethodLength
def test_all_routes
# create recipient
payment_initiation_recipient_create_request = Plaid::PaymentInitiationRecipientCreateRequest.new
p... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | test/test_api_client.rb | Ruby | mit | 244 | master | 1,533 | require 'faraday'
require 'faraday/multipart'
require_relative "test_helper"
# Internal: The test for API Client
class ApiClientTest < PlaidTest
def test_api_client_exposes_farday_connection
configuration = Plaid::Configuration.new
configuration.server_index = Plaid::Configuration::Environment["sandbox"]
... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | test/test_identity.rb | Ruby | mit | 244 | master | 1,110 | require_relative 'test_helper'
# Internal: The test for Plaid::Identity.
class PlaidIdentityTest < PlaidTest
def test_get
create_item initial_products: [:identity]
identity_get_request = Plaid::IdentityGetRequest.new
identity_get_request.access_token = access_token
response = client.identity_get(id... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | test/test_accounts.rb | Ruby | mit | 244 | master | 3,104 | require_relative "test_helper"
# Internal: The test for Plaid::AccountsGetRequest.
class PlaidAccountsTest < PlaidTest
def setup
create_item initial_products: [:transactions]
end
def test_get
accounts_get_request = Plaid::AccountsGetRequest.new
accounts_get_request.access_token = access_token
r... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | test/test_item.rb | Ruby | mit | 244 | master | 9,256 | require_relative "test_helper"
# Internal: The test for Plaid::Item.
class PlaidItemTest < PlaidTest # rubocop:disable Metrics/ClassLength
def test_create
create_item
refute_empty(@item.item.to_hash)
assert_equal(["transactions"], @item.item.billed_products)
assert_equal(SANDBOX_INSTITUTION, @item.i... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | test/test_monitor.rb | Ruby | mit | 244 | master | 2,514 | require "date"
require_relative 'test_helper'
# Internal: The test for Plaid::WatchlistScreening.
WATCHLIST_PROGRAM_ID = "prg_egdF5fGjY8fWqk"
LEGAL_NAME = "Domingo Huang"
CLIENT_USER_ID = "monitor-user-" + Time.now.to_i.to_s
DOCUMENT_NUMBER = "123456789"
class PlaidMonitorTest < PlaidTest
def test_screening_indivi... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | test/test_identity_verification.rb | Ruby | mit | 244 | master | 2,397 | require_relative 'test_helper'
# Internal: The test for Plaid::IdentityVerification.
TEMPLATE_ID = "flwtmp_aWogUuKsL6NEHU"
CLIENT_USER_ID = "idv-user-" + Time.now.to_i.to_s
EMAIL = CLIENT_USER_ID + "@example.com"
class PlaidIdentityVerificationTest < PlaidTest
def test_all_routes
user = Plaid::IdentityVerificat... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | lib/plaid.rb | Ruby | mit | 244 | master | 182,117 | =begin
#The Plaid API
#The Plaid REST API. Please see https://plaid.com/docs/api for more details.
The version of the OpenAPI document: 2020-09-14_1.688.6
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 6.3.0
=end
# Common files
require 'plaid/api_client'
require 'plaid/api_error'
require '... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | lib/plaid/version.rb | Ruby | mit | 244 | master | 281 | =begin
#The Plaid API
#The Plaid REST API. Please see https://plaid.com/docs/api for more details.
The version of the OpenAPI document: 2020-09-14_1.688.6
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 6.3.0
=end
module Plaid
VERSION = '46.2.0'
end |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | lib/plaid/api_client.rb | Ruby | mit | 244 | master | 14,704 | # Modified by Plaid
# Due to separate implementations of Faraday 2 and Faraday options support this file has extensive
# Diffs from the equivalent OpenAPI-generator template file
=begin
#The Plaid API
#The Plaid REST API. Please see https://plaid.com/docs/api for more details.
The version of the OpenAPI document: 20... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | lib/plaid/api_error.rb | Ruby | mit | 244 | master | 1,382 | =begin
#The Plaid API
#The Plaid REST API. Please see https://plaid.com/docs/api for more details.
The version of the OpenAPI document: 2020-09-14_1.688.6
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 6.3.0
=end
module Plaid
class ApiError < StandardError
attr_reader :code, :respons... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | lib/plaid/configuration.rb | Ruby | mit | 244 | master | 9,655 | # Modified by Plaid
# Due to separate implementations of Faraday 2 and Faraday options support this file has extensive
# Diffs from the equivalent OpenAPI-generator template file
=begin
#The Plaid API
#The Plaid REST API. Please see https://plaid.com/docs/api for more details.
The version of the OpenAPI document: 20... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | lib/plaid/models/credit_freddie_mac_party.rb | Ruby | mit | 244 | master | 7,859 | =begin
#The Plaid API
#The Plaid REST API. Please see https://plaid.com/docs/api for more details.
The version of the OpenAPI document: 2020-09-14_1.688.6
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 6.3.0
=end
require 'date'
require 'time'
module Plaid
# A collection of information a... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | lib/plaid/models/user_products_terminate_response.rb | Ruby | mit | 244 | master | 6,951 | =begin
#The Plaid API
#The Plaid REST API. Please see https://plaid.com/docs/api for more details.
The version of the OpenAPI document: 2020-09-14_1.688.6
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 6.3.0
=end
require 'date'
require 'time'
module Plaid
# UserProductsTerminateResponse... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | lib/plaid/models/base_report_account_balances.rb | Ruby | mit | 244 | master | 13,931 | =begin
#The Plaid API
#The Plaid REST API. Please see https://plaid.com/docs/api for more details.
The version of the OpenAPI document: 2020-09-14_1.688.6
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 6.3.0
=end
require 'date'
require 'time'
module Plaid
# Information about an account'... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | lib/plaid/models/role.rb | Ruby | mit | 244 | master | 6,743 | =begin
#The Plaid API
#The Plaid REST API. Please see https://plaid.com/docs/api for more details.
The version of the OpenAPI document: 2020-09-14_1.688.6
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 6.3.0
=end
require 'date'
require 'time'
module Plaid
# ADocumentation not found in t... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | lib/plaid/models/user_remove_request.rb | Ruby | mit | 244 | master | 8,169 | =begin
#The Plaid API
#The Plaid REST API. Please see https://plaid.com/docs/api for more details.
The version of the OpenAPI document: 2020-09-14_1.688.6
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 6.3.0
=end
require 'date'
require 'time'
module Plaid
# UserRemoveRequest defines the... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | lib/plaid/models/fdx_notification_type.rb | Ruby | mit | 244 | master | 1,679 | =begin
#The Plaid API
#The Plaid REST API. Please see https://plaid.com/docs/api for more details.
The version of the OpenAPI document: 2020-09-14_1.688.6
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 6.3.0
=end
require 'date'
require 'time'
module Plaid
class FDXNotificationType
A... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | lib/plaid/models/cra_credit_profile_report.rb | Ruby | mit | 244 | master | 10,806 | =begin
#The Plaid API
#The Plaid REST API. Please see https://plaid.com/docs/api for more details.
The version of the OpenAPI document: 2020-09-14_1.688.6
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 6.3.0
=end
require 'date'
require 'time'
module Plaid
# Contains data for the CRA Cre... |
github | plaid/plaid-ruby | https://github.com/plaid/plaid-ruby | lib/plaid/models/protect_user.rb | Ruby | mit | 244 | master | 7,202 | =begin
#The Plaid API
#The Plaid REST API. Please see https://plaid.com/docs/api for more details.
The version of the OpenAPI document: 2020-09-14_1.688.6
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 6.3.0
=end
require 'date'
require 'time'
module Plaid
# Represents an end user for /p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.