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 | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | spec/support/time_diff_matchers.rb | Ruby | apache-2.0 | 45 | master | 1,556 | # frozen_string_literal: true
module TimeDiff
module Matchers
def remain_over_time
RemainOverTime.new
end
def increase_over_time
IncreaseOverTime.new
end
class RemainOverTime
def matches?(block)
@duration1 = block.call
@duration2 = block.call
@duration2... |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | spec/support/utilities.rb | Ruby | apache-2.0 | 45 | master | 616 | # frozen_string_literal: true
RSpec::Matchers.define :contain_event do |expected|
match do |events|
events.select { |event| event.name.to_s == expected.to_s }.any?
end
failure_message do |events|
"expected that #{event_names(events)} would contain an event with the name #{expected}"
end
failure_messa... |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | spec/requests/virtual_machine_instances_spec.rb | Ruby | apache-2.0 | 45 | master | 3,470 | # frozen_string_literal: true
require 'rails_helper'
describe VirtualMachineInstancesController do
let(:vm) { create(:virtual_machine_instance) }
let(:execution) { vm.benchmark_execution }
describe 'complete benchmark' do
context 'with success' do
let(:success_message) { 'Benchmark completed message'... |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | spec/requests/metric_observations_spec.rb | Ruby | apache-2.0 | 45 | master | 5,479 | # frozen_string_literal: true
require 'rails_helper'
describe MetricDefinitionsController do
let(:vm) { create(:virtual_machine_instance) }
let(:benchmark) { vm.benchmark_execution.benchmark_definition }
describe 'download metric observations as CSV' do
let(:ordered_observation) { create(:ordered_metric_ob... |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | db/schema.rb | Ruby | apache-2.0 | 45 | master | 5,473 | # frozen_string_literal: true
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the auth... |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | db/migrate/20140410101712_add_virtual_machine_instance_ref_to_nominal_metric_observation.rb | Ruby | apache-2.0 | 45 | master | 293 | # frozen_string_literal: true
class AddVirtualMachineInstanceRefToNominalMetricObservation < ActiveRecord::Migration[5.0]
def change
add_reference :nominal_metric_observations, :virtual_machine_instance, index: { name: 'index_nominal_metric_observations_on_vm_instance_id ' }
end
end |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | db/migrate/20181216145840_create_vagrant_config.rb | Ruby | apache-2.0 | 45 | master | 285 | # frozen_string_literal: true
class CreateVagrantConfig < ActiveRecord::Migration[5.2]
def change
create_table :vagrant_configs do |t|
t.integer :singleton_guard
t.string :base_file
end
add_index(:vagrant_configs, :singleton_guard, unique: true)
end
end |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | db/migrate/20140409171709_rename_metric_observations_to_nominal_metric_observations.rb | Ruby | apache-2.0 | 45 | master | 211 | # frozen_string_literal: true
class RenameMetricObservationsToNominalMetricObservations < ActiveRecord::Migration[5.0]
def change
rename_table :metric_observations, :nominal_metric_observations
end
end |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | db/migrate/20140325123215_add_virtual_machine_definition_ref_to_virtual_machine_instance.rb | Ruby | apache-2.0 | 45 | master | 279 | # frozen_string_literal: true
class AddVirtualMachineDefinitionRefToVirtualMachineInstance < ActiveRecord::Migration[5.0]
def change
add_reference :virtual_machine_instances, :virtual_machine_definition, index: { name: 'index_vm_instances_on_vm_definition_id' }
end
end |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | db/migrate/20140325111020_create_benchmark_executions.rb | Ruby | apache-2.0 | 45 | master | 270 | # frozen_string_literal: true
class CreateBenchmarkExecutions < ActiveRecord::Migration[5.0]
def change
create_table :benchmark_executions do |t|
t.string :status
t.datetime :start_time
t.datetime :end_time
t.timestamps
end
end
end |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | db/migrate/20140325111135_create_virtual_machine_instances.rb | Ruby | apache-2.0 | 45 | master | 223 | # frozen_string_literal: true
class CreateVirtualMachineInstances < ActiveRecord::Migration[5.0]
def change
create_table :virtual_machine_instances do |t|
t.string :status
t.timestamps
end
end
end |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | db/migrate/20140325121222_add_benchmark_definition_ref_to_virtual_machine_definition.rb | Ruby | apache-2.0 | 45 | master | 226 | # frozen_string_literal: true
class AddBenchmarkDefinitionRefToVirtualMachineDefinition < ActiveRecord::Migration[5.0]
def change
add_reference :virtual_machine_definitions, :benchmark_definition, index: true
end
end |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | db/migrate/20140325111440_create_virtual_machine_definitions.rb | Ruby | apache-2.0 | 45 | master | 300 | # frozen_string_literal: true
class CreateVirtualMachineDefinitions < ActiveRecord::Migration[5.0]
def change
create_table :virtual_machine_definitions do |t|
t.string :role
t.string :region
t.string :instance_type
t.string :image
t.timestamps
end
end
end |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | db/migrate/20140527194814_add_consecutive_failure_count_to_benchmark_schedule.rb | Ruby | apache-2.0 | 45 | master | 223 | # frozen_string_literal: true
class AddConsecutiveFailureCountToBenchmarkSchedule < ActiveRecord::Migration[5.0]
def change
add_column :benchmark_schedules, :consecutive_failure_count, :integer, default: 0
end
end |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | db/migrate/20140427195001_add_index_on_name_to_metric_definitions.rb | Ruby | apache-2.0 | 45 | master | 370 | # frozen_string_literal: true
class AddIndexOnNameToMetricDefinitions < ActiveRecord::Migration[5.0]
def change
# Ensure scoped uniqueness constraint of metrics_definitions:
# The name of a metric definition MUST be unique within the scope of a benchmark definition
add_index :metric_definitions, [:name, ... |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | db/migrate/20140410112859_drop_virtual_machine_definitions.rb | Ruby | apache-2.0 | 45 | master | 242 | # frozen_string_literal: true
class DropVirtualMachineDefinitions < ActiveRecord::Migration[5.0]
def change
drop_table :virtual_machine_definitions
remove_column :virtual_machine_instances, :virtual_machine_definition_id
end
end |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | db/migrate/20140409173349_create_ordered_metric_observations.rb | Ruby | apache-2.0 | 45 | master | 425 | # frozen_string_literal: true
class CreateOrderedMetricObservations < ActiveRecord::Migration[5.0]
def change
create_table :ordered_metric_observations do |t|
t.references :metric_definition, index: true
t.references :virtual_machine_instance, index: { name: 'index_ordered_metric_observations_on_vm_i... |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | db/migrate/20140527202817_add_keep_alive_to_benchmark_executions.rb | Ruby | apache-2.0 | 45 | master | 201 | # frozen_string_literal: true
class AddKeepAliveToBenchmarkExecutions < ActiveRecord::Migration[5.0]
def change
add_column :benchmark_executions, :keep_alive, :boolean, default: false
end
end |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | db/migrate/20140409170602_replace_column_key_with_time_to_metric_observations.rb | Ruby | apache-2.0 | 45 | master | 244 | # frozen_string_literal: true
class ReplaceColumnKeyWithTimeToMetricObservations < ActiveRecord::Migration[5.0]
def change
remove_column :metric_observations, :key
add_column :metric_observations, :time, :integer, limit: 8
end
end |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | db/migrate/20140325123732_add_cloud_provider_ref_to_virtual_machine_definition.rb | Ruby | apache-2.0 | 45 | master | 214 | # frozen_string_literal: true
class AddCloudProviderRefToVirtualMachineDefinition < ActiveRecord::Migration[5.0]
def change
add_reference :virtual_machine_definitions, :cloud_provider, index: true
end
end |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | db/migrate/20140325104843_create_benchmark_definitions.rb | Ruby | apache-2.0 | 45 | master | 214 | # frozen_string_literal: true
class CreateBenchmarkDefinitions < ActiveRecord::Migration[5.0]
def change
create_table :benchmark_definitions do |t|
t.string :name
t.timestamps
end
end
end |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | db/migrate/20140524232230_devise_create_users.rb | Ruby | apache-2.0 | 45 | master | 1,386 | # frozen_string_literal: true
class DeviseCreateUsers < ActiveRecord::Migration[5.0]
def change
create_table(:users) do |t|
## Database authenticatable
t.string :email, null: false, default: ''
t.string :encrypted_password, null: false, default: ''
## Recoverable
# t.s... |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | db/migrate/20140325105631_create_metric_definitions.rb | Ruby | apache-2.0 | 45 | master | 229 | # frozen_string_literal: true
class CreateMetricDefinitions < ActiveRecord::Migration[5.0]
def change
create_table :metric_definitions do |t|
t.string :name
t.string :unit
t.timestamps
end
end
end |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | db/migrate/20181216203332_add_timestamps_to_vagrant_config.rb | Ruby | apache-2.0 | 45 | master | 232 | # frozen_string_literal: true
class AddTimestampsToVagrantConfig < ActiveRecord::Migration[5.2]
def change
add_column :vagrant_configs, :created_at, :datetime
add_column :vagrant_configs, :updated_at, :datetime
end
end |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | db/migrate/20140325105957_create_metric_observations.rb | Ruby | apache-2.0 | 45 | master | 232 | # frozen_string_literal: true
class CreateMetricObservations < ActiveRecord::Migration[5.0]
def change
create_table :metric_observations do |t|
t.integer :key
t.string :value
t.timestamps
end
end
end |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | db/migrate/20140429183105_create_benchmark_schedules.rb | Ruby | apache-2.0 | 45 | master | 314 | # frozen_string_literal: true
class CreateBenchmarkSchedules < ActiveRecord::Migration[5.0]
def change
create_table :benchmark_schedules do |t|
t.string :cron_expression
t.boolean :active, default: true
t.references :benchmark_definition, index: true
t.timestamps
end
end
end |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | db/migrate/20140325122123_add_benchmark_definition_ref_to_benchmark_execution.rb | Ruby | apache-2.0 | 45 | master | 213 | # frozen_string_literal: true
class AddBenchmarkDefinitionRefToBenchmarkExecution < ActiveRecord::Migration[5.0]
def change
add_reference :benchmark_executions, :benchmark_definition, index: true
end
end |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | db/migrate/20140512195631_create_event.rb | Ruby | apache-2.0 | 45 | master | 264 | # frozen_string_literal: true
class CreateEvent < ActiveRecord::Migration[5.0]
def change
create_table :events do |t|
t.integer :name
t.datetime :happened_at
t.references :traceable, polymorphic: true
t.timestamps
end
end
end |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | db/migrate/20140325123409_add_benchmark_execution_ref_to_virtual_machine_instance.rb | Ruby | apache-2.0 | 45 | master | 220 | # frozen_string_literal: true
class AddBenchmarkExecutionRefToVirtualMachineInstance < ActiveRecord::Migration[5.0]
def change
add_reference :virtual_machine_instances, :benchmark_execution, index: true
end
end |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | db/migrate/20140513164840_remove_attributes_from_benchmark_executions.rb | Ruby | apache-2.0 | 45 | master | 284 | # frozen_string_literal: true
class RemoveAttributesFromBenchmarkExecutions < ActiveRecord::Migration[5.0]
def change
remove_column :benchmark_executions, :status
remove_column :benchmark_executions, :start_time
remove_column :benchmark_executions, :end_time
end
end |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | db/migrate/20140406140215_create_delayed_jobs.rb | Ruby | apache-2.0 | 45 | master | 1,374 | # frozen_string_literal: true
class CreateDelayedJobs < ActiveRecord::Migration[5.0]
def self.up
create_table :delayed_jobs, force: true do |table|
table.integer :priority, default: 0, null: false # Allows some jobs to jump to the front of the queue
table.integer :attempts, default: 0, null: false ... |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | db/migrate/20140411112914_add_vm_identifiers_to_virtual_machine_instances.rb | Ruby | apache-2.0 | 45 | master | 427 | # frozen_string_literal: true
class AddVmIdentifiersToVirtualMachineInstances < ActiveRecord::Migration[5.0]
def change
add_column :virtual_machine_instances, :provider_name, :string
add_column :virtual_machine_instances, :provider_instance_id, :string
add_index :virtual_machine_instances, [:provider_in... |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | db/migrate/20140410113800_add_metric_definition_ref_to_nominal_metric_observations.rb | Ruby | apache-2.0 | 45 | master | 221 | # frozen_string_literal: true
class AddMetricDefinitionRefToNominalMetricObservations < ActiveRecord::Migration[5.0]
def change
add_reference :nominal_metric_observations, :metric_definition, index: true
end
end |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | db/migrate/20140325114747_add_benchmark_definition_id_to_metric_definitions.rb | Ruby | apache-2.0 | 45 | master | 206 | # frozen_string_literal: true
class AddBenchmarkDefinitionIdToMetricDefinitions < ActiveRecord::Migration[5.0]
def change
add_column :metric_definitions, :benchmark_definition_id, :integer
end
end |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | db/migrate/20140325111531_create_cloud_providers.rb | Ruby | apache-2.0 | 45 | master | 264 | # frozen_string_literal: true
class CreateCloudProviders < ActiveRecord::Migration[5.0]
def change
create_table :cloud_providers do |t|
t.string :name
t.string :credentials_path
t.string :ssh_key_path
t.timestamps
end
end
end |
github | stve/airbrake-api | https://github.com/stve/airbrake-api | Gemfile | Ruby | mit | 45 | master | 259 | source "https://rubygems.org"
gem 'rake'
gem 'yard'
gem 'kramdown'
platforms :jruby do
gem 'jruby-openssl', '~> 0.7'
end
group :test do
gem 'rspec', '~> 3.0'
gem 'simplecov'
gem 'fakeweb'
gem 'nokogiri'
gem 'airbrake'
gem 'i18n'
end
gemspec |
github | stve/airbrake-api | https://github.com/stve/airbrake-api | airbrake-api.gemspec | Ruby | mit | 45 | master | 921 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "airbrake-api/version"
Gem::Specification.new do |s|
s.name = 'airbrake-api'
s.version = AirbrakeAPI::VERSION
s.platform = Gem::Platform::RUBY
s.summary = "A ruby wrapper for the ... |
github | stve/airbrake-api | https://github.com/stve/airbrake-api | Rakefile | Ruby | mit | 45 | master | 371 | require 'bundler'
Bundler::GemHelper.install_tasks
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
task :default => :spec
namespace :doc do
require 'yard'
YARD::Rake::YardocTask.new do |task|
task.files = ['lib/**/*.rb']
task.options = [
'--protected',
'--output-dir', 'doc/y... |
github | stve/airbrake-api | https://github.com/stve/airbrake-api | spec/airbrake_api_spec.rb | Ruby | mit | 45 | master | 2,596 | require 'spec_helper'
describe AirbrakeAPI do
context "configuration" do
before(:each) do
AirbrakeAPI.reset
end
it "should allow setting of the account" do
AirbrakeAPI.account = 'myapp'
expect(AirbrakeAPI.account).to eq('myapp')
expect(AirbrakeAPI.account_path).to eq('http://mya... |
github | stve/airbrake-api | https://github.com/stve/airbrake-api | spec/spec_helper.rb | Ruby | mit | 45 | master | 3,316 | unless ENV['CI']
require 'simplecov'
SimpleCov.start do
add_group 'Airbrake API', 'lib/airbrake-api'
add_group 'Specs', 'spec'
end
end
require 'rspec'
require 'fakeweb'
require 'i18n'
require 'airbrake'
require File.expand_path('../../lib/airbrake-api', __FILE__)
FakeWeb.allow_net_connect = false
DEF... |
github | stve/airbrake-api | https://github.com/stve/airbrake-api | spec/airbrake_api/error_spec.rb | Ruby | mit | 45 | master | 1,523 | require 'spec_helper'
describe AirbrakeAPI::Error do
before(:all) do
AirbrakeAPI.account = 'myapp'
AirbrakeAPI.auth_token = 'abcdefg123456'
AirbrakeAPI.secure = false
end
it "should have correct collection path" do
expect(AirbrakeAPI::Error.collection_path).to eq("/groups.xml")
end
it "shou... |
github | stve/airbrake-api | https://github.com/stve/airbrake-api | spec/airbrake_api/client_spec.rb | Ruby | mit | 45 | master | 7,995 | require 'spec_helper'
describe AirbrakeAPI::Client do
describe 'initialization' do
before do
@keys = AirbrakeAPI::Configuration::VALID_OPTIONS_KEYS
end
context "with module configuration" do
before do
AirbrakeAPI.configure do |config|
@keys.each do |key|
config.... |
github | stve/airbrake-api | https://github.com/stve/airbrake-api | spec/airbrake_api/notice_spec.rb | Ruby | mit | 45 | master | 1,656 | require 'spec_helper'
describe AirbrakeAPI::Notice do
before(:all) do
AirbrakeAPI.account = 'myapp'
AirbrakeAPI.auth_token = 'abcdefg123456'
AirbrakeAPI.secure = false
end
it "should find error notices" do
notices = AirbrakeAPI::Notice.find_by_error_id(1696170)
expect(notices.size).to eq(42)... |
github | stve/airbrake-api | https://github.com/stve/airbrake-api | spec/airbrake_api/project_spec.rb | Ruby | mit | 45 | master | 539 | require 'spec_helper'
describe AirbrakeAPI::Project do
before(:all) do
AirbrakeAPI.account = 'myapp'
AirbrakeAPI.auth_token = 'abcdefg123456'
AirbrakeAPI.secure = false
end
it "should have correct projects path" do
expect(AirbrakeAPI::Project.collection_path).to eq("/data_api/v1/projects.xml")
... |
github | stve/airbrake-api | https://github.com/stve/airbrake-api | lib/airbrake-api.rb | Ruby | mit | 45 | master | 724 | require 'airbrake-api/configuration'
module AirbrakeAPI
extend Configuration
class AirbrakeError < StandardError; end
# Alias for Instapaper::Client.new
#
# @return [Instapaper::Client]
def self.client(options={})
AirbrakeAPI::Client.new(options)
end
# Delegate to Instapaper::Client
def self.... |
github | stve/airbrake-api | https://github.com/stve/airbrake-api | lib/airbrake-api/error.rb | Ruby | mit | 45 | master | 1,520 | require 'airbrake-api/base'
module AirbrakeAPI
class Error < Base
# @deprecated Please use {AirbrakeAPI::Client::error} and {AirbrakeAPI::Client::errors} instead
def self.find(*args)
deprecate('Error.find has been deprecated; use AibrakeAPI::Client#error and AibrakeAPI::Client#errors instead')
... |
github | stve/airbrake-api | https://github.com/stve/airbrake-api | lib/airbrake-api/client.rb | Ruby | mit | 45 | master | 4,686 | require 'parallel'
require 'airbrake-api/core_ext/hash'
module AirbrakeAPI
class Client
PER_PAGE = 20
PARALLEL_WORKERS = 10
attr_accessor *AirbrakeAPI::Configuration::VALID_OPTIONS_KEYS
def initialize(options={})
attrs = AirbrakeAPI.options.merge(options)
AirbrakeAPI::Configuration::VA... |
github | stve/airbrake-api | https://github.com/stve/airbrake-api | lib/airbrake-api/configuration.rb | Ruby | mit | 45 | master | 1,827 | require 'airbrake-api/version'
require 'faraday_middleware'
require 'airbrake-api/middleware/scrub_response'
require 'airbrake-api/middleware/raise_server_error'
require 'airbrake-api/middleware/raise_response_error'
module AirbrakeAPI
module Configuration
VALID_OPTIONS_KEYS = [
:account,
:auth_token... |
github | stve/airbrake-api | https://github.com/stve/airbrake-api | lib/airbrake-api/notice.rb | Ruby | mit | 45 | master | 1,518 | require 'airbrake-api/base'
module AirbrakeAPI
class Notice < Base
# @deprecated Please use {AirbrakeAPI::Client::notice} instead
def self.find(id, error_id, options = {})
deprecate('Notice.find has been deprecated; use AibrakeAPI::Client#notice instead')
AirbrakeAPI::Client.new.notice(id, error... |
github | stve/airbrake-api | https://github.com/stve/airbrake-api | lib/airbrake-api/base.rb | Ruby | mit | 45 | master | 319 | # placeholder since pre-refactor classes used AirbrakeAPI::Base
module AirbrakeAPI
class Base
class << self
def setup
end
def fetch(path, options)
Client.new.get(path, options)
end
def deprecate(msg)
Kernel.warn("[Deprecation] - #{msg}")
end
end
end
end |
github | stve/airbrake-api | https://github.com/stve/airbrake-api | lib/airbrake-api/project.rb | Ruby | mit | 45 | master | 646 | require 'airbrake-api/base'
module AirbrakeAPI
class Project < Base
# @deprecated Please use {AirbrakeAPI::Client::projects} instead
def self.find(*args)
deprecate('Project.find has been deprecated; use AibrakeAPI::Client.projects instead')
options = args.last.is_a?(::Hash) ? args.pop : {}
... |
github | stve/airbrake-api | https://github.com/stve/airbrake-api | lib/airbrake-api/middleware/raise_response_error.rb | Ruby | mit | 45 | master | 375 | require 'faraday'
module AirbrakeAPI
module Middleware
class RaiseResponseError < Faraday::Response::Middleware
def on_complete(env)
raise AirbrakeError.new('No results found.') if env[:body].nil?
if env[:body].errors && env[:body].errors.error
raise AirbrakeError.new(env[:body]... |
github | stve/airbrake-api | https://github.com/stve/airbrake-api | lib/airbrake-api/middleware/scrub_response.rb | Ruby | mit | 45 | master | 280 | require 'faraday'
module AirbrakeAPI
module Middleware
class ScrubResponse < Faraday::Response::Middleware
def parse(body)
body.gsub!(/<__utmz>.*?<\/__utmz>/m,'')
body.gsub!(/<[0-9]+.*?>.*?<\/[0-9]+.*?>/m,'')
body
end
end
end
end |
github | stve/airbrake-api | https://github.com/stve/airbrake-api | lib/airbrake-api/middleware/raise_server_error.rb | Ruby | mit | 45 | master | 341 | require 'faraday'
module AirbrakeAPI
module Middleware
class RaiseServerError < Faraday::Response::Middleware
def on_complete(env)
case env[:status].to_i
when 403
raise AirbrakeError.new('SSL should be enabled - use AirbrakeAPI.secure = true in configuration')
end
e... |
github | stve/airbrake-api | https://github.com/stve/airbrake-api | lib/airbrake-api/core_ext/hash.rb | Ruby | mit | 45 | master | 376 | class Hash
def deep_merge(other_hash)
self.merge(other_hash) do |key, oldval, newval|
oldval = oldval.to_hash if oldval.respond_to?(:to_hash)
newval = newval.to_hash if newval.respond_to?(:to_hash)
oldval.class.to_s == 'Hash' && newval.class.to_s == 'Hash' ? oldval.deep_merge(newval) : newval... |
github | ActiveRecordLike/activerecord-like | https://github.com/ActiveRecordLike/activerecord-like | Rakefile | Ruby | mit | 45 | master | 409 | #!/usr/bin/env rake
require 'bundler/gem_tasks'
require 'rake/testtask'
require 'appraisal'
Rake::TestTask.new do |t|
t.libs = ["test"]
t.pattern = "test/**/*_test.rb"
# also warn about bad practices and such
t.ruby_opts = ['-w']
end
if !ENV["APPRAISAL_INITIALIZED"] && !ENV["TRAVIS"]
task :default do
s... |
github | ActiveRecordLike/activerecord-like | https://github.com/ActiveRecordLike/activerecord-like | activerecord-like.gemspec | Ruby | mit | 45 | master | 1,857 | # -*- encoding: utf-8 -*-
require File.expand_path('../lib/active_record/like/version', __FILE__)
gem_name = "activerecord-like"
Gem::Specification.new do |gem|
gem.name = gem_name
gem.version = ActiveRecord::Like::VERSION
gem.authors = [
"René van den Berg",
"PikachuEXE",
]
gem... |
github | ActiveRecordLike/activerecord-like | https://github.com/ActiveRecordLike/activerecord-like | Appraisals | Ruby | mit | 45 | master | 227 | [("7.0".."7.2"), ("8.0".."8.0")].flat_map(&:to_a).each do |version|
appraise "rails_#{version.tr('.', '_')}" do
gem "activerecord", "~> #{version}.0"
if version < "7.2"
gem "sqlite3", "~> 1.3"
end
end
end |
github | ActiveRecordLike/activerecord-like | https://github.com/ActiveRecordLike/activerecord-like | test/helper.rb | Ruby | mit | 45 | master | 2,886 | require 'bundler/setup'
if ENV["COVERALLS"]
require "simplecov"
require "simplecov-lcov"
SimpleCov::Formatter::LcovFormatter.config do |c|
c.report_with_single_file = true
c.single_report_path = "coverage/lcov.info"
end
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(
[SimpleCov... |
github | ActiveRecordLike/activerecord-like | https://github.com/ActiveRecordLike/activerecord-like | test/unit/not_like_test.rb | Ruby | mit | 45 | master | 1,188 | require File.expand_path('../../helper', __FILE__)
describe ActiveRecord::QueryMethods::WhereChain do
describe :not_like do
it "creates an Arel DoesNotMatch node in the relation" do
relation = Post.where.not_like(title: '')
_(relation.where_clause.send(:predicates).first).must_be_instance_of(Arel::N... |
github | ActiveRecordLike/activerecord-like | https://github.com/ActiveRecordLike/activerecord-like | test/unit/like_test.rb | Ruby | mit | 45 | master | 1,170 | require File.expand_path('../../helper', __FILE__)
describe ActiveRecord::QueryMethods::WhereChain do
describe :like do
it "creates an Arel Matches node in the relation" do
relation = Post.where.like(title: '')
_(relation.where_clause.send(:predicates).first).must_be_instance_of(Arel::Nodes::Matches... |
github | ActiveRecordLike/activerecord-like | https://github.com/ActiveRecordLike/activerecord-like | test/integration/like_test.rb | Ruby | mit | 45 | master | 2,350 | require File.expand_path('../../helper', __FILE__)
describe ActiveRecord::QueryMethods::WhereChain do
describe :like do
before do
Post.create(id: 1, title: 'We need some content to test with')
Post.create(id: 2, title: 'I really like DSLs - see what I did there?')
end
after do
Post.del... |
github | ActiveRecordLike/activerecord-like | https://github.com/ActiveRecordLike/activerecord-like | test/integration/not_like_test.rb | Ruby | mit | 45 | master | 2,399 | require File.expand_path('../../helper', __FILE__)
describe ActiveRecord::QueryMethods::WhereChain do
describe :not_like do
before do
Post.create(id: 1, title: 'We need some content to test with')
Post.create(id: 2, title: 'I really like DSLs - see what I did there?')
end
after do
Post... |
github | ActiveRecordLike/activerecord-like | https://github.com/ActiveRecordLike/activerecord-like | lib/active_record/like.rb | Ruby | mit | 45 | master | 579 | require "active_record"
require_relative "like/scope_spawner"
module ActiveRecord
module Like
module WhereChainExtensions
def like(opts, *rest)
ActiveRecord::Like::ScopeSpawners::LikeScopeSpawners.spawn(@scope, opts, rest)
end
def not_like(opts, *rest)
ActiveRecord::Like::Scope... |
github | ActiveRecordLike/activerecord-like | https://github.com/ActiveRecordLike/activerecord-like | lib/active_record/like/scope_spawner.rb | Ruby | mit | 45 | master | 7,166 | module ActiveRecord
module Like
module ScopeSpawners
module Shared
module Rails7AndBelowSpawner
private
def chain_node(node_type, &block)
@scope.tap do |s|
# Assuming `opts` to be `Hash`
opts.each_pair do |key, value|
# 1. ... |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | Rakefile | Ruby | mit | 45 | main | 220 | require 'bundler'
require 'bundler/gem_tasks'
require 'rake'
# load all rake tasks
Dir.glob(File.expand_path('lib/tasks/*.rake', __dir__)).each do |file|
import file
end
# require 'yard'
# YARD::Rake::YardocTask.new |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | devise-secure_password.gemspec | Ruby | mit | 45 | main | 2,642 | #
# devise-secure_password.gemspec
#
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'date'
require 'devise/secure_password/version'
Gem::Specification.new do |spec|
spec.name = 'devise-secure_password'
spec.version = Devise::SecurePassword::V... |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | app/controllers/devise/passwords_with_policy_controller.rb | Ruby | mit | 45 | main | 2,869 | module Devise
class PasswordsWithPolicyController < Devise::RegistrationsController
before_action :configure_permitted_parameters
def edit
self.resource = resource_class.new
resource.errors.add(:base, "#{error_string_for_password_expired}.")
render :edit
end
def update
if upd... |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | spec/spec_helper.rb | Ruby | mit | 45 | main | 3,731 | ENV['RAILS_ENV'] ||= 'test'
ENV['RAILS_TARGET'] ||= '7.0'
#
# Simplecov configuration (COVERAGE=true bundle exec rspec spec/)
#
if ENV['COVERAGE'] && Gem::Specification.find_all_by_name('simplecov').any?
require 'simplecov'
require 'simplecov-console'
SimpleCov.start
if ENV['CI'] == 'true'
require 'codeco... |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | spec/secure_password_spec.rb | Ruby | mit | 45 | main | 640 | RSpec.describe Devise::SecurePassword do
it 'has a version number' do
expect(Devise::SecurePassword::VERSION).not_to be nil
end
context 'configuration parameters' do
%w(password_required_uppercase_count
password_required_lowercase_count
password_required_number_count
password_require... |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | spec/libraries/support_string_spec.rb | Ruby | mit | 45 | main | 2,506 | require 'support/string/character_counter'
RSpec.describe Support::String::CharacterCounter do
let(:bad_string) { nil }
let(:good_string) { 'ABBabb12!#' }
let(:uppercase_chars) { ('A'..'Z').to_a }
let(:lowercase_chars) { ('a'..'z').to_a }
let(:number_chars) { ('0'..'9').to_a }
let(:special_chars) { [' ', ... |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | spec/orm/active_record.rb | Ruby | mit | 45 | main | 514 | #
# override ActiveRecord settings for testing
#
ActiveRecord::Migration.verbose = false
ActiveRecord::Base.logger = Logger.new(nil)
migrate_path = File.expand_path('../rails-app/db/migrate', __dir__)
if Rails.version.start_with?('6') || Rails.version.start_with?('7')
ActiveRecord::MigrationContext.new(migrate_path... |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | spec/rails-app-8_0/app/models/user.rb | Ruby | mit | 45 | main | 445 | class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
:password_has_required_content,
:passw... |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | spec/rails-app-8_0/app/models/isolated/user_frequent_reuse.rb | Ruby | mit | 45 | main | 303 | module Isolated
class User < ApplicationRecord; end
class UserFrequentReuse < User
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
:password_has_required_content,
:password_disallows_frequent_reuse
end
end |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | spec/rails-app-8_0/app/models/isolated/user_frequent_changes_bad.rb | Ruby | mit | 45 | main | 431 | module Isolated
class User < ApplicationRecord; end
class UserFrequentChangesBad < User
#
# Should trigger a ConfigurationError:
# - :password_disallows_frequent_changes enabled
# - :password_disallows_frequent_reuse missing
#
devise :database_authenticatable, :registerable,
:... |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | spec/rails-app-8_0/app/models/isolated/user_regular_updates.rb | Ruby | mit | 45 | main | 350 | module Isolated
class User < ApplicationRecord; end
class UserRegularUpdates < User
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
:password_has_required_content,
:password_disallows_frequent_reuse,
:password_requi... |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | spec/rails-app-8_0/app/models/isolated/user_regular_updates_bad.rb | Ruby | mit | 45 | main | 307 | module Isolated
class User < ApplicationRecord; end
class UserRegularUpdatesBad < User
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
:password_has_required_content,
:password_requires_regular_updates
end
end |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | spec/rails-app-8_0/app/models/isolated/user_regular_updates_bad_config.rb | Ruby | mit | 45 | main | 499 | module Isolated
class User < ApplicationRecord; end
class UserRegularUpdatesBadConfig < User
#
# Should trigger a ConfigurationError:
# - password_maximum_age is invalid type
#
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
... |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | spec/rails-app-8_0/app/models/isolated/user_content.rb | Ruby | mit | 45 | main | 375 | module Isolated
class User < ApplicationRecord; end
class UserContent < User
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatabl... |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | spec/rails-app-8_0/app/models/isolated/user_frequent_changes.rb | Ruby | mit | 45 | main | 353 | module Isolated
class User < ApplicationRecord; end
class UserFrequentChanges < User
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
:password_has_required_content,
:password_disallows_frequent_reuse,
:password_disa... |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | spec/rails-app-8_0/app/models/isolated/user_frequent_changes_bad_config.rb | Ruby | mit | 45 | main | 456 | module Isolated
class User < ApplicationRecord; end
class UserFrequentChangesBadConfig < User
#
# Should trigger a ConfigurationError:
# - password_minimum_age is invalid type
#
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
... |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | spec/rails-app-8_0/config/application.rb | Ruby | mit | 45 | main | 991 | require_relative "boot"
require "rails/all"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Rails80
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails v... |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | spec/rails-app-8_0/config/initializers/devise.rb | Ruby | mit | 45 | main | 13,642 | # Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render invalid all existing
# confirmat... |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | spec/rails-app-8_0/db/schema.rb | Ruby | mit | 45 | main | 2,044 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define your schema when running `bin/rai... |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | spec/rails-app-8_0/db/migrate/20171227042253_create_previous_passwords.rb | Ruby | mit | 45 | main | 438 | class CreatePreviousPasswords < ActiveRecord::Migration[8.0]
def change
create_table :previous_passwords do |t|
t.string :salt, null: false
t.string :encrypted_password, null: false
t.references :user, null: false, foreign_key: true, index: true, type: :bigint
t.timestamps
end
ad... |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | spec/rails-app-8_0/db/migrate/20171213225952_devise_create_users.rb | Ruby | mit | 45 | main | 1,372 | class DeviseCreateUsers < ActiveRecord::Migration[8.0]
def change
create_table :users, id: :bigint do |t|
## Database authenticatable
t.string :email, null: false, default: ""
t.string :encrypted_password, null: false, default: ""
## Recoverable
t.string :reset_passwo... |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | spec/benchmarks/character_counter.rb | Ruby | mit | 45 | main | 1,085 | require 'benchmark'
require 'support/string/character_counter'
require 'spec_helper'
character_counter = ::Support::String::CharacterCounter.new
categories = character_counter.count_hash.values.map(&:keys)
dictionary = categories.flatten
puts 'Setting up benchmark (character_counter)...'
puts '-> creating a long stri... |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | spec/benchmarks/validate_password_frequent_reuse.rb | Ruby | mit | 45 | main | 1,482 | require 'benchmark'
require 'spec_helper'
bcrypt_cost = 11 # devise default is 1 for tests, 11 for production
max_count = Isolated::UserFrequentReuse.password_previously_used_count
password = 'Bubb1234@#$!'
user = Isolated::UserFrequentReuse.new(
email: 'barney@rubble.com',
password: password,
password_confirma... |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | spec/support/matchers.rb | Ruby | mit | 45 | main | 306 | # :have_constant matcher
#
# Test whether a class or instance has a specified constant.
#
# syntax:
# it { is_expected.to have_constant(:MAX_LENGTH) }
#
RSpec::Matchers.define :have_constant do |const|
match do |object|
(object.is_a?(Class) ? object : object.class).const_defined?(const)
end
end |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | spec/rails-app-7_0/db/schema.rb | Ruby | mit | 45 | main | 2,044 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define your schema when running `bin/rai... |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | spec/rails-app-7_0/db/migrate/20171227042253_create_previous_passwords.rb | Ruby | mit | 45 | main | 393 | class CreatePreviousPasswords < ActiveRecord::Migration[7.0]
def up
create_table :previous_passwords do |t|
t.string :salt, null: false
t.string :encrypted_password, null: false
t.references :user, foreign_key: true
t.timestamps
end
add_index :previous_passwords, :encrypted_passw... |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | spec/rails-app-7_0/db/migrate/20171213225952_devise_create_users.rb | Ruby | mit | 45 | main | 1,356 | class DeviseCreateUsers < ActiveRecord::Migration[7.0]
def up
create_table :users do |t|
## Database authenticatable
t.string :email, null: false, default: ""
t.string :encrypted_password, null: false, default: ""
## Recoverable
t.string :reset_password_token
t.... |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | spec/rails-app-7_0/config/boot.rb | Ruby | mit | 45 | main | 209 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
require "bundler/setup" # Set up gems listed in the Gemfile.
# require "bootsnap/setup" # Speed up boot time by caching expensive operations. |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | spec/rails-app-7_0/config/application.rb | Ruby | mit | 45 | main | 994 | require_relative "boot"
require "rails/all"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module RailsApp70
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rail... |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | spec/rails-app-7_0/config/environments/production.rb | Ruby | mit | 45 | main | 4,298 | require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.enable_reloading = false
# Eager load code on boot. This eager loads most of Rails and
# your app... |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | spec/feature/user_logs_in_spec.rb | Ruby | mit | 45 | main | 3,817 | require 'spec_helper'
RSpec.describe 'User logs in', type: :feature do
let(:password) { 'Bubb1234%$#!' }
let(:new_password) { 'Dubb9874%$#!' }
let(:user) do
User.create(
email: 'betty@rubble.com',
password: password,
password_confirmation: password
)
end
def expire_user_password
... |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | spec/feature/user_changes_password_spec.rb | Ruby | mit | 45 | main | 6,554 | require 'spec_helper'
RSpec.describe 'User changes password', type: :feature do
let(:password) { 'Bubb1234%$#X' }
let(:current_password) { password }
let(:new_password) { 'Bubb1234%$#$' }
let(:new_password_confirmation) { new_password }
let(:user) do
User.new(
email: 'betty@rubble.com',
passw... |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | spec/models/previous_password_spec.rb | Ruby | mit | 45 | main | 2,760 | require 'spec_helper'
RSpec.describe Devise::Models::PreviousPassword, type: :model do
let(:password) { 'Bubb1234%$#!' }
let(:user) do
Isolated::UserFrequentReuse.new(
email: 'wilma@flintstone.com',
password: password,
password_confirmation: password
)
end
before do
Devise.setup ... |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | spec/models/password_disallows_frequent_reuse_spec.rb | Ruby | mit | 45 | main | 5,835 | require 'spec_helper'
RSpec.describe Devise::Models::PasswordDisallowsFrequentReuse, type: :model do
let(:password) { 'Bubb1234@#$!' }
let(:user) do
Isolated::UserFrequentReuse.new(
email: 'fred@flintstone.com',
password: password,
password_confirmation: password
)
end
describe 'conf... |
github | ValiMail/devise-secure_password | https://github.com/ValiMail/devise-secure_password | spec/models/password_has_required_content_spec.rb | Ruby | mit | 45 | main | 8,230 | require 'spec_helper'
RSpec.describe Devise::Models::PasswordHasRequiredContent, type: :model do
before do
Devise.setup do |config|
config.password_length = (8..128)
config.password_required_uppercase_count = 1
config.password_required_lowercase_count = 1
config.password_required_number_c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.