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
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
Rakefile
Ruby
mit
83
master
1,432
require 'rspec/core/rake_task' require 'rubygems/package_task' RSpec::Core::RakeTask.new(:spec) task default: :spec # rubocop:disable Security/Eval def modify_base_gemspec(&block) eval(File.read('airbrake-ruby.gemspec')).tap(&block) end # rubocop:enable Security/Eval namespace :ruby do spec = modify_base_gemspec...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
Gemfile
Ruby
mit
83
master
322
source 'https://rubygems.org' gemspec gem 'rubocop', '~> 1.16', require: false gem 'rubocop-rake', '~> 0.5', require: false gem 'rubocop-rspec', '~> 2.3', require: false gem 'simplecov', '~> 0.16', require: false gem 'webrick', '~> 1.7' if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.0') gem 'yard', '0.9.28...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
airbrake-ruby.gemspec
Ruby
mit
83
master
1,681
require './lib/airbrake-ruby/version' Gem::Specification.new do |s| s.name = 'airbrake-ruby' s.version = Airbrake::AIRBRAKE_RUBY_VERSION.dup s.summary = 'Ruby notifier for https://airbrake.io' s.description = <<DESC Airbrake Ruby is a plain Ruby notifier for Airbrake (https://airbrake.io), the l...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/loggable_spec.rb
Ruby
mit
83
master
424
RSpec.describe Airbrake::Loggable do describe ".instance" do it "returns a logger" do expect(described_class.instance).to be_a(Logger) end end describe "#logger" do subject(:class_with_logger) do Class.new { include Airbrake::Loggable }.new end it "returns a logger that has Logge...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/backlog_spec.rb
Ruby
mit
83
master
2,126
RSpec.describe Airbrake::Backlog do subject(:backlog) { described_class.new(sync_sender, 0.1) } let(:sync_sender) { Airbrake::SyncSender.new } let(:error_endpoint) { '/error' } let(:event_endpoint) { '/event' } let(:promise) { an_instance_of(Airbrake::Promise) } before { allow(sync_sender).to receive(:sen...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/remote_settings_spec.rb
Ruby
mit
83
master
5,862
RSpec.describe Airbrake::RemoteSettings do let(:project_id) { 123 } let(:host) { 'https://v1-production-notifier-configs.s3.amazonaws.com' } let(:endpoint) do "#{host}/2020-06-18/config/#{project_id}/config.json" end let(:body) do { 'poll_sec' => 1, 'settings' => [ { 'n...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/helpers.rb
Ruby
mit
83
master
211
module Helpers def fixture_path(filename) File.expand_path(File.join('spec', 'fixtures', filename)) end def project_root_path(filename) fixture_path(File.join('project_root', filename)) end end
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/config_spec.rb
Ruby
mit
83
master
6,781
RSpec.describe Airbrake::Config do subject(:config) { described_class.new } let(:resolved_promise) { Airbrake::Promise.new.resolve } let(:rejected_promise) { Airbrake::Promise.new.reject } let(:valid_params) { { project_id: 1, project_key: '2' } } its(:project_id) { is_expected.to be_nil } its(:project_k...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/airbrake_spec.rb
Ruby
mit
83
master
15,599
RSpec.describe Airbrake do let(:remote_settings) { instance_double(Airbrake::RemoteSettings) } before do allow(Airbrake::RemoteSettings).to receive(:poll).and_return(remote_settings) allow(remote_settings).to receive(:stop_polling) end after { described_class.instance_variable_set(:@remote_settings, n...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/time_truncate_spec.rb
Ruby
mit
83
master
955
RSpec.describe Airbrake::TimeTruncate do time = Time.new(2018, 1, 1, 0, 0, 20, 0) time_with_zone = Time.new(2018, 1, 1, 0, 0, 20, '-05:00') describe "#utc_truncate_minutes" do shared_examples 'time conversion' do |t| it "truncates the time to the floor minute and returns an RFC3339 timestamp" do ...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/stashable_spec.rb
Ruby
mit
83
master
484
RSpec.describe Airbrake::Stashable do let(:klass) do mod = described_class Class.new { include(mod) } end describe "#stash" do subject(:instance) { klass.new } it "returns a hash" do expect(instance.stash).to be_a(Hash) end it "returns an empty hash" do expect(instance.stash...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/code_hunk_spec.rb
Ruby
mit
83
master
3,303
RSpec.describe Airbrake::CodeHunk do subject(:code_hunk) { described_class.new } after do %w[empty_file.rb code.rb banana.rb short_file.rb long_line.txt].each do |f| Airbrake::FileCache[project_root_path(f)] = nil end end describe "#to_h" do context "when file is empty" do subject do ...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/stat_spec.rb
Ruby
mit
83
master
887
RSpec.describe Airbrake::Stat do subject(:stat) { described_class.new } describe "#to_h" do it "converts to a hash" do expect(stat.to_h).to eq( 'count' => 0, 'sum' => 0.0, 'sumsq' => 0.0, 'tdigest' => 'AAAAAkA0AAAAAAAAAAAAAA==', ) end end describe "#incremen...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/performance_breakdown_spec.rb
Ruby
mit
83
master
252
RSpec.describe Airbrake::PerformanceBreakdown do describe "#stash" do subject do described_class.new( method: 'GET', route: '/', response_type: '', groups: {}, ) end it { is_expected.to respond_to(:stash) } end end
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/sync_sender_spec.rb
Ruby
mit
83
master
6,686
RSpec.describe Airbrake::SyncSender do subject(:sync_sender) { described_class.new } let(:mock_backlog) { instance_double(Airbrake::Backlog) } before do Airbrake::Config.instance = Airbrake::Config.new( project_id: 1, project_key: 'banana', ) allow(Airbrake::Backlog).to receive(:new).and_retur...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/monotonic_time_spec.rb
Ruby
mit
83
master
692
RSpec.describe Airbrake::MonotonicTime do subject(:monotonic_time) { described_class } describe ".time_in_ms" do it "returns monotonic time in milliseconds" do expect(monotonic_time.time_in_ms).to be_a(Float) end it "always returns time in the future" do old_time = monotonic_time.time_in_m...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/notice_spec.rb
Ruby
mit
83
master
9,601
RSpec.describe Airbrake::Notice do let(:notice) { described_class.new(AirbrakeTestError.new, bingo: '1') } describe "#to_json" do context "app_version" do context "when missing" do before { Airbrake::Config.instance.merge(app_version: nil) } it "doesn't include app_version" do ...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/context_spec.rb
Ruby
mit
83
master
1,345
RSpec.describe Airbrake::Context do subject(:context) { described_class.current } before { described_class.current.clear } after { described_class.current.clear } describe "#merge!" do it "merges the given context with the current one" do context.merge!(apples: 'oranges') expect(context.to_h)...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/promise_spec.rb
Ruby
mit
83
master
5,430
RSpec.describe Airbrake::Promise do subject(:promise) { described_class.new } describe ".then" do let(:resolved_with) { [] } let(:rejected_with) { [] } context "when it is not resolved" do it "returns self" do expect(promise.then { anything }).to eq(promise) end it "doesn't ...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/truncator_spec.rb
Ruby
mit
83
master
6,942
RSpec.describe Airbrake::Truncator do def multiply_by_2_max_len(chr) chr * 2 * max_len end describe "#truncate" do subject(:truncator) { described_class.new(max_size).truncate(object) } let(:max_size) { 3 } let(:truncated) { '[Truncated]' } let(:max_len) { max_size + truncated.length } ...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/spec_helper.rb
Ruby
mit
83
master
3,429
require 'simplecov' SimpleCov.start if ENV['COVERAGE'] require 'airbrake-ruby' require 'rspec/its' require 'webmock' require 'webmock/rspec' require 'pry' require 'pathname' require 'webrick' require 'English' require 'base64' require 'helpers' RSpec.configure do |c| c.order = 'random' c.color = true c.disa...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/ignorable_spec.rb
Ruby
mit
83
master
269
RSpec.describe Airbrake::Ignorable do let(:klass) do mod = subject Class.new { include(mod) } end it "ignores includee" do instance = klass.new expect(instance).not_to be_ignored instance.ignore! expect(instance).to be_ignored end end
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/performance_notifier_spec.rb
Ruby
mit
83
master
17,810
RSpec.describe Airbrake::PerformanceNotifier do subject(:perf_notifier) { described_class.new } let(:routes) { 'https://api.airbrake.io/api/v5/projects/1/routes-stats' } let(:queries) { 'https://api.airbrake.io/api/v5/projects/1/queries-stats' } let(:breakdowns) { 'https://api.airbrake.io/api/v5/projects/1/rou...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/deploy_notifier_spec.rb
Ruby
mit
83
master
1,675
RSpec.describe Airbrake::DeployNotifier do before do Airbrake::Config.instance = Airbrake::Config.new(project_id: 1, project_key: '123') end describe "#notify" do subject(:deploy_notifier) { described_class.new } it "returns a promise" do stub_request(:post, 'https://api.airbrake.io/api/v4/pro...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/filter_chain_spec.rb
Ruby
mit
83
master
2,999
RSpec.describe Airbrake::FilterChain do subject(:filter_chain) { described_class.new } let(:notice) { Airbrake::Notice.new(AirbrakeTestError.new) } describe "#refine" do let(:filter) do Class.new do attr_reader :weight def initialize(weight) @weight = weight end ...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/backtrace_spec.rb
Ruby
mit
83
master
19,968
RSpec.describe Airbrake::Backtrace do describe ".parse" do context "UNIX backtrace" do let(:parsed_backtrace) do # rubocop:disable Layout/LineLength, Style/HashSyntax, Layout/SpaceAroundOperators, Layout/SpaceInsideHashLiteralBraces [{:file=>"/home/kyrylo/code/airbrake/ruby/spec/spec_helper....
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/benchmark_spec.rb
Ruby
mit
83
master
783
RSpec.describe Airbrake::Benchmark do subject(:benchmark) { described_class.new } describe ".measure" do it "returns measured performance time" do expect(described_class.measure { '10' * 10 }).to be_a(Numeric) end end describe "#stop" do before { benchmark } context "when called one tim...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/notice_notifier_spec.rb
Ruby
mit
83
master
12,284
RSpec.describe Airbrake::NoticeNotifier do subject(:notice_notifier) { described_class.new } before do Airbrake::Config.instance = Airbrake::Config.new( project_id: 1, project_key: 'abc', logger: Logger.new('/dev/null'), performance_stats: true, ) end describe "#new" do des...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/file_cache_spec.rb
Ruby
mit
83
master
866
RSpec.describe Airbrake::FileCache do before { described_class.reset } after { described_class.reset } describe ".[]=" do context "when cache limit isn't reached" do before do stub_const("#{described_class.name}::MAX_SIZE", 10) end it "adds objects" do described_class[:ban...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/request_spec.rb
Ruby
mit
83
master
209
RSpec.describe Airbrake::Request do describe "#stash" do subject do described_class.new(method: 'GET', route: '/', status_code: 200) end it { is_expected.to respond_to(:stash) } end end
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/thread_pool_spec.rb
Ruby
mit
83
master
5,311
RSpec.describe Airbrake::ThreadPool do subject(:thread_pool) do described_class.new( worker_size: worker_size, queue_size: queue_size, block: proc { |message| tasks << message }, ) end let(:tasks) { [] } let(:worker_size) { 1 } let(:queue_size) { 2 } describe "#<<" do it "ret...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/timed_trace_spec.rb
Ruby
mit
83
master
3,512
RSpec.describe Airbrake::TimedTrace do subject(:timed_trace) { described_class.new } describe ".span" do it "returns a timed trace" do expect(described_class.span('operation') { anything }).to be_a(described_class) end it "returns a timed trace with a stopped span" do timed_trace = describ...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/nested_exception_spec.rb
Ruby
mit
83
master
3,904
RSpec.describe Airbrake::NestedException do describe "#as_json" do context "given exceptions with backtraces" do # rubocop:disable RSpec/MultipleExpectations it "unwinds nested exceptions" do begin raise AirbrakeTestError rescue AirbrakeTestError Ruby21Error.raise_e...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/inspectable_spec.rb
Ruby
mit
83
master
998
RSpec.describe Airbrake::Inspectable do let(:klass) do mod = subject Class.new do include(mod) def initialize @config = Airbrake::Config.new @filter_chain = nil end end end describe "#inspect" do it "displays object information" do instance = klass.new ...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/async_sender_spec.rb
Ruby
mit
83
master
1,805
RSpec.describe Airbrake::AsyncSender do let(:endpoint) { 'https://api.airbrake.io/api/v3/projects/1/notices' } let(:queue_size) { 10 } let(:notice) { Airbrake::Notice.new(AirbrakeTestError.new) } before do stub_request(:post, endpoint).to_return(status: 201, body: '{}') Airbrake::Config.instance = Airb...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/queue_spec.rb
Ruby
mit
83
master
439
RSpec.describe Airbrake::Queue do subject { described_class.new(queue: 'bananas', error_count: 0) } describe "#ignore" do it { is_expected.to respond_to(:ignore!) } end describe "#stash" do it { is_expected.to respond_to(:stash) } end describe "#route" do it "always returns an empty route" do...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/response_spec.rb
Ruby
mit
83
master
3,183
RSpec.describe Airbrake::Response do describe ".parse" do [200, 201, 204].each do |code| context "when response code is #{code}" do before do allow(Airbrake::Loggable.instance).to receive(:debug) end it "logs response body" do described_class.parse(OpenStruct.new...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/tdigest_spec.rb
Ruby
mit
83
master
5,824
RSpec.describe Airbrake::TDigest do subject(:tdigest) { described_class.new } describe "byte serialization" do it "loads serialized data" do tdigest.push(60, 100) 10.times { tdigest.push(rand * 100) } bytes = tdigest.as_bytes new_tdigest = described_class.from_bytes(bytes) expect(...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/query_spec.rb
Ruby
mit
83
master
217
RSpec.describe Airbrake::Query do describe "#stash" do subject do described_class.new( method: 'GET', route: '/', query: '', ) end it { is_expected.to respond_to(:stash) } end end
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/filters/git_last_checkout_filter_spec.rb
Ruby
mit
83
master
3,436
RSpec.describe Airbrake::Filters::GitLastCheckoutFilter do subject(:git_last_checkout_filter) { described_class.new('.') } let(:notice) { Airbrake::Notice.new(AirbrakeTestError.new) } let(:git_path) { subject.instance_variable_get(:@git_path) } let(:head_path) { "#{git_path}/logs/HEAD" } let(:git_info) do ...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/filters/system_exit_filter_spec.rb
Ruby
mit
83
master
574
RSpec.describe Airbrake::Filters::SystemExitFilter do subject(:system_exit_filter) { described_class.new } it "marks SystemExit exceptions as ignored" do notice = Airbrake::Notice.new(SystemExit.new) expect { system_exit_filter.call(notice) }.to( change { notice.ignored? }.from(false).to(true), )...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/filters/exception_attributes_filter_spec.rb
Ruby
mit
83
master
1,320
RSpec.describe Airbrake::Filters::ExceptionAttributesFilter do subject(:exception_attributes_filter) { described_class.new } describe "#call" do let(:notice) { Airbrake::Notice.new(ex) } context "when #to_airbrake returns a non-Hash object" do let(:ex) do Class.new(AirbrakeTestError) do ...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/filters/keys_allowlist_spec.rb
Ruby
mit
83
master
6,064
RSpec.describe Airbrake::Filters::KeysAllowlist do subject(:keys_allowlist_filter) { described_class.new(patterns) } let(:notice) { Airbrake::Notice.new(AirbrakeTestError.new) } shared_examples 'pattern matching' do |patts, params| let(:patterns) { patts } it "filters out the matching values" do ...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/filters/root_directory_filter_spec.rb
Ruby
mit
83
master
1,532
RSpec.describe Airbrake::Filters::RootDirectoryFilter do subject(:root_directory_filter) { described_class.new(root_directory) } let(:root_directory) { '/var/www/project' } let(:notice) { Airbrake::Notice.new(AirbrakeTestError.new) } it "replaces root directory in the backtrace with a label" do # rubocop:...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/filters/git_repository_filter_spec.rb
Ruby
mit
83
master
2,346
RSpec.describe Airbrake::Filters::GitRepositoryFilter do subject(:git_repository_filter) { described_class.new('.') } let(:notice) { Airbrake::Notice.new(AirbrakeTestError.new) } describe "#initialize" do it "parses standard git version" do allow_any_instance_of(Kernel) .to receive(:`).and_ret...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/filters/dependency_filter_spec.rb
Ruby
mit
83
master
461
RSpec.describe Airbrake::Filters::DependencyFilter do subject(:dependency_filter) { described_class.new } let(:notice) { Airbrake::Notice.new(AirbrakeTestError.new) } describe "#call" do it "attaches loaded dependencies to context/versions/dependencies" do dependency_filter.call(notice) expect(n...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/filters/git_revision_filter_spec.rb
Ruby
mit
83
master
4,127
RSpec.describe Airbrake::Filters::GitRevisionFilter do subject(:git_revision_filter) { described_class.new('root/dir') } # 'let!', not 'let' to make sure Notice doesn't call File.exist? with # unexpected arguments. let!(:notice) { Airbrake::Notice.new(AirbrakeTestError.new) } context "when context/revision ...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/filters/keys_blocklist_spec.rb
Ruby
mit
83
master
6,448
RSpec.describe Airbrake::Filters::KeysBlocklist do subject(:keys_blocklist_filter) { described_class.new(patterns) } let(:notice) { Airbrake::Notice.new(AirbrakeTestError.new) } shared_examples 'pattern matching' do |patts, params| let(:patterns) { patts } it "filters out the matching values" do ...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/filters/thread_filter_spec.rb
Ruby
mit
83
master
6,882
RSpec.describe Airbrake::Filters::ThreadFilter do subject(:thread_filter) { described_class.new } let(:notice) { Airbrake::Notice.new(AirbrakeTestError.new) } def new_thread Thread.new do th = Thread.current # Ensure a thread always has some variable to make sure the # :fiber_variables Ha...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/filters/gem_root_filter_spec.rb
Ruby
mit
83
master
1,563
RSpec.describe Airbrake::Filters::GemRootFilter do subject(:gem_root_filter) { described_class.new } let(:notice) { Airbrake::Notice.new(AirbrakeTestError.new) } let(:root1) { '/my/gem/root' } let(:root2) { '/my/other/gem/root' } before { Gem.path << root1 << root2 } after { 2.times { Gem.path.pop } } ...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/filters/sql_filter_spec.rb
Ruby
mit
83
master
11,369
RSpec.describe Airbrake::Filters::SqlFilter do shared_examples "query filtering" do |test| test[:dialects].each do |dialect| it "correctly filters SQL like `#{test[:input]}' (#{dialect} dialect)" do filter = described_class.new(dialect) q = OpenStruct.new(query: test[:input]) filter....
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/filters/context_filter_spec.rb
Ruby
mit
83
master
1,042
RSpec.describe Airbrake::Filters::ContextFilter do let(:notice) { Airbrake::Notice.new(AirbrakeTestError.new) } context "when the current context is empty" do it "doesn't merge anything with params" do described_class.new.call(notice) expect(notice[:params]).to be_empty end end context "wh...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/notice_notifier/options_spec.rb
Ruby
mit
83
master
8,267
RSpec.describe Airbrake::NoticeNotifier do subject(:notice_notifier) { described_class.new } let(:project_id) { 105138 } let(:project_key) { 'fd04e13d806a90f96614ad8e529b2822' } let(:localhost) { 'http://localhost:8080' } let(:endpoint) do "https://api.airbrake.io/api/v3/projects/#{project_id}/notices" ...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/config/validator_spec.rb
Ruby
mit
83
master
6,072
RSpec.describe Airbrake::Config::Validator do let(:valid_id) { 123 } let(:valid_key) { '123' } let(:config) { Airbrake::Config.new(config_params) } describe ".validate" do context "when project_id is numerical" do let(:config_params) { { project_id: valid_id, project_key: valid_key } } it "ret...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/config/processor_spec.rb
Ruby
mit
83
master
5,418
RSpec.describe Airbrake::Config::Processor do let(:notifier) { Airbrake::NoticeNotifier.new } describe "#process_blocklist" do let(:config) { Airbrake::Config.new(blocklist_keys: %w[a b c]) } context "when there ARE blocklist keys" do it "adds the blocklist filter" do described_class.new(con...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/remote_settings/settings_data_spec.rb
Ruby
mit
83
master
8,630
RSpec.describe Airbrake::RemoteSettings::SettingsData do let(:project_id) { 123 } describe "#merge!" do it "returns self" do settings_data = described_class.new(project_id, {}) expect(settings_data.merge!({})).to eql(settings_data) end it "merges the given hash with the data" do sett...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
spec/remote_settings/callback_spec.rb
Ruby
mit
83
master
4,968
RSpec.describe Airbrake::RemoteSettings::Callback do describe "#call" do let(:logger) { Logger.new(File::NULL) } let(:config) do Airbrake::Config.new( project_id: 123, logger: logger, ) end let(:data) do instance_double(Airbrake::RemoteSettings::SettingsData) en...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
benchmarks/truncator_string_encoding.rb
Ruby
mit
83
master
3,048
require_relative 'benchmark_helpers' require 'securerandom' require 'base64' # Generates various strings for the benchmark. module StringGenerator STRLEN = 32 class << self # @return [String] a UTF-8 string with valid encoding and characters def utf8 SecureRandom.hex(STRLEN).encode('utf-8') end...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
benchmarks/truncator.rb
Ruby
mit
83
master
641
require_relative 'benchmark_helpers' # Generates example errors that should be truncated. class Payload def self.generate Array.new(5000) do |i| { type: "Error#{i}", message: 'X' * 300, backtrace: Array.new(300) { 'Y' * 300 } } end end end # The maximum size of hashes, arrays and str...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
benchmarks/notify_async_workers.rb
Ruby
mit
83
master
1,253
require_relative 'benchmark_helpers' # The number of notices to process. NOTICES = 1200 cores = case RbConfig::CONFIG['host_os'] when /linux/ Dir.glob('/sys/devices/system/cpu/cpu[0-9]*').count when /darwin|bsd/ Integer(`sysctl -n hw.ncpu`) else 2 end double_cores = 2 * cores config_hash = { ...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
benchmarks/notify_async_vs_sync.rb
Ruby
mit
83
master
605
require_relative 'benchmark_helpers' # Silence logs. logger = Logger.new('/dev/null') # Setup Airbrake. Airbrake.configure do |c| c.project_id = 112261 c.project_key = 'c7aaceb2ccb579e6b710cea9da22c526' c.logger = logger c.host = 'http://localhost:8080' end # The number of notices to process. NOTICES = 1200 ...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
benchmarks/build_notice.rb
Ruby
mit
83
master
759
require_relative 'benchmark_helpers' Airbrake.configure do |c| c.project_id = 1 c.project_key = '213' c.logger = Logger.new('/dev/null') end puts "Calculating iterations/second..." Benchmark.ips do |ips| ips.config(time: 5, warmup: 5) ips.report("big Airbrake.build_notice") do Airbrake.build_notice(...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
benchmarks/benchmark_helpers.rb
Ruby
mit
83
master
8,978
require 'rbconfig' require 'benchmark' require 'benchmark/ips' require 'webmock' require 'airbrake-ruby' BIG_EXCEPTION = RuntimeError.new('App crashed!') # rubocop:disable Layout/LineLength BIG_EXCEPTION.set_backtrace( ["lib/arel/visitors/to_sql.rb:729:in `unsupported'", "lib/arel/visitors/reduce.rb:13:in `visit...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
benchmarks/performance.rb
Ruby
mit
83
master
890
require_relative 'benchmark_helpers' Airbrake.configure do |c| c.project_id = 1 c.project_key = '123' c.performance_stats = true c.performance_stats_flush_period = 0 c.host = 'http://localhost:8080' end query = { method: 'GET', route: '/things/1', query: 'SELECT * FROM foos', func: 'foo', file: 'f...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby.rb
Ruby
mit
83
master
20,274
require 'net/https' require 'logger' require 'json' require 'set' require 'socket' require 'time' require 'airbrake-ruby/version' require 'airbrake-ruby/loggable' require 'airbrake-ruby/stashable' require 'airbrake-ruby/mergeable' require 'airbrake-ruby/grouppable' require 'airbrake-ruby/config' require 'airbrake-ruby...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/monotonic_time.rb
Ruby
mit
83
master
1,149
module Airbrake # MonotonicTime is a helper for getting monotonic time suitable for # performance measurements. It guarantees that the time is strictly linearly # increasing (unlike realtime). # # @example # MonotonicTime.time_in_ms #=> 287138801.144576 # # @see http://pubs.opengroup.org/onlinepubs/96...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/version.rb
Ruby
mit
83
master
478
# We use Semantic Versioning v2.0.0 # More information: http://semver.org/ module Airbrake # @return [String] the library version # @api public AIRBRAKE_RUBY_VERSION = '6.2.2'.freeze # @return [Hash{Symbol=>String}] the information about the notifier library # @since v5.0.0 # @api public NOTIFIER_INFO = ...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/performance_notifier.rb
Ruby
mit
83
master
4,679
module Airbrake # PerformanceNotifier aggregates performance data and periodically sends it to # Airbrake. # # @api public # @since v3.2.0 # rubocop:disable Metrics/ClassLength class PerformanceNotifier include Inspectable include Loggable def initialize @config = Airbrake::Config.insta...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/stashable.rb
Ruby
mit
83
master
403
module Airbrake # Stashable should be included in any class that wants the ability to stash # arbitrary objects. It is mainly used by data objects that users can access # through filters. # # @since v4.4.0 # @api private module Stashable # @return [Hash{Symbol=>Object}] the hash with arbitrary objects...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/benchmark.rb
Ruby
mit
83
master
754
module Airbrake # Benchmark benchmarks Ruby code. # # @since v4.2.4 # @api public class Benchmark # Measures monotonic time for the given operation. # # @yieldreturn [void] def self.measure benchmark = new yield benchmark.stop benchmark.duration end # @return...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/thread_pool.rb
Ruby
mit
83
master
3,993
module Airbrake # ThreadPool implements a simple thread pool that can configure the number of # worker threads and the size of the queue to process. # # @example # # Initialize a new thread pool with 5 workers and a queue size of 100. Set # # the block to be run concurrently. # thread_pool = ThreadP...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/notice.rb
Ruby
mit
83
master
4,634
module Airbrake # Represents a chunk of information that is meant to be either sent to # Airbrake or ignored completely. # # @since v1.0.0 class Notice # @return [Hash{Symbol=>String,Hash}] the information to be displayed in the # Context tab in the dashboard CONTEXT = { os: RUBY_PLATFORM,...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/nested_exception.rb
Ruby
mit
83
master
1,765
module Airbrake # A class that is capable of unwinding nested exceptions and representing them # as JSON-like hash. # # @api private # @since v1.0.4 class NestedException # @return [Integer] the maximum number of nested exceptions that a notice # can unwrap. Exceptions that have a longer cause cha...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/deploy_notifier.rb
Ruby
mit
83
master
801
module Airbrake # DeployNotifier sends deploy information to Airbrake. The information # consists of: # - environment # - username # - repository # - revision # - version # # @api public # @since v3.2.0 class DeployNotifier include Inspectable def initialize @config = Airbrake::Conf...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/hash_keyable.rb
Ruby
mit
83
master
811
module Airbrake # HashKeyable allows instances of the class to be used as a Hash key in a # consistent manner. # # The class that includes it must implement *to_h*, which defines properties # that all of the instances must share in order to produce the same {#hash}. # # @example # class C # incl...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/request.rb
Ruby
mit
83
master
929
module Airbrake # Request holds request data that powers route stats. # # @see Airbrake.notify_request # @api public # @since v3.2.0 class Request include HashKeyable include Ignorable include Stashable include Mergeable include Grouppable attr_accessor :method, :route, :status_code...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/config.rb
Ruby
mit
83
master
8,334
module Airbrake # Represents the Airbrake config. A config contains all the options that you # can use to configure an Airbrake instance. # # @api public # @since v1.0.0 class Config # @return [Integer] the project identificator. This value *must* be set. # @api public attr_accessor :project_id ...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/loggable.rb
Ruby
mit
83
master
780
module Airbrake # Loggable is included into any class that wants to be able to log. # # By default, Loggable defines a null logger that doesn't do anything. You are # supposed to overwrite it via the {instance} method before calling {logger}. # # @example # class A # include Loggable # # d...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/queue.rb
Ruby
mit
83
master
1,253
module Airbrake # Queue represents a queue (worker). # # @see Airbrake.notify_queue # @api public # @since v4.9.0 class Queue include HashKeyable include Ignorable include Stashable attr_accessor :queue, :error_count, :groups, :timing, :time def initialize( queue:, error_co...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/promise.rb
Ruby
mit
83
master
2,881
module Airbrake # Represents a simplified promise object (similar to promises found in # JavaScript), which allows chaining callbacks that are executed when the # promise is either resolved or rejected. # # @see https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise # @see htt...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/async_sender.rb
Ruby
mit
83
master
1,347
module Airbrake # Responsible for sending notices to Airbrake asynchronously. # # @see SyncSender # @api private # @since v1.0.0 class AsyncSender def initialize(method = :post, name = 'async-sender') @config = Airbrake::Config.instance @sync_sender = SyncSender.new(method) @name = nam...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/performance_breakdown.rb
Ruby
mit
83
master
1,163
module Airbrake # PerformanceBreakdown holds data that shows how much time a request spent # doing certaing subtasks such as (DB querying, view rendering, etc). # # @see Airbrake.notify_breakdown # @api public # @since v4.2.0 # rubocop:disable Metrics/ParameterLists class PerformanceBreakdown includ...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/backlog.rb
Ruby
mit
83
master
2,939
module Airbrake # Backlog accepts notices and APM events and synchronously sends them in the # background at regular intervals. The backlog is a queue of data that failed # to be sent due to some error. In a nutshell, it's a retry mechanism. # # @api private # @since v6.2.0 class Backlog include Logga...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/filter_chain.rb
Ruby
mit
83
master
3,078
module Airbrake # FilterChain represents an ordered array of filters. # # A filter is an object that responds to <b>#call</b> (typically a Proc or a # class that implements the call method). The <b>#call</b> method must accept # exactly one argument: an object to be filtered. # # When you add a new filter...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/backtrace.rb
Ruby
mit
83
master
6,045
module Airbrake # Represents a cross-Ruby backtrace from exceptions (including JRuby Java # exceptions). Provides information about stack frames (such as line number, # file and method) in convenient for Airbrake format. # # @example # begin # raise 'Oops!' # rescue # Backtrace.parse($!) ...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/sync_sender.rb
Ruby
mit
83
master
3,934
module Airbrake # Responsible for sending data to Airbrake synchronously via PUT or POST # methods. Supports proxies. # # @see AsyncSender # @api private # @since v1.0.0 class SyncSender # @return [String] body for HTTP requests CONTENT_TYPE = 'application/json'.freeze # @return [Array<Intege...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/file_cache.rb
Ruby
mit
83
master
1,112
module Airbrake # Extremely simple global cache. # # @api private # @since v2.4.1 module FileCache # @return [Integer] MAX_SIZE = 50 # @return [Mutex] MUTEX = Mutex.new # Associates the value given by +value+ with the key given by +key+. Deletes # entries that exceed +MAX_SIZE+. ...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/grouppable.rb
Ruby
mit
83
master
269
module Airbrake # Grouppable adds the `#groups` method, so that we don't need to define it in # all of performance models every time we add a model without groups. # # @since v4.9.0 # @api private module Grouppable def groups {} end end end
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/ignorable.rb
Ruby
mit
83
master
890
module Airbrake # Ignorable contains methods that allow the includee to be ignored. # # @example # class A # include Airbrake::Ignorable # end # # a = A.new # a.ignore! # a.ignored? #=> true # # @since v3.2.0 # @api private module Ignorable attr_accessor :ignored # Che...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/remote_settings.rb
Ruby
mit
83
master
3,223
module Airbrake # RemoteSettings polls the remote config of the passed project at fixed # intervals. The fetched config is yielded as a callback parameter so that the # invoker can define read config values. Supports proxies. # # @example Disable/enable error notifications based on the remote value # Remo...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/context.rb
Ruby
mit
83
master
1,101
module Airbrake # Represents a thread-safe Airbrake context object, which carries arbitrary # information added via {Airbrake.merge_context} calls. # # @example # Airbrake::Context.current.merge!(foo: 'bar') # # @api private # @since v5.2.1 class Context # Returns current, thread-local, context....
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/inspectable.rb
Ruby
mit
83
master
1,295
module Airbrake # Inspectable provides custom inspect methods that reduce clutter printed in # REPLs for notifier objects. These custom methods display only essential # information such as project id/key and filters. # # @since v3.2.6 # @api private module Inspectable # @return [String] inspect output...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/mergeable.rb
Ruby
mit
83
master
259
module Airbrake # Mergeable adds the `#merge` method, so that we don't need to define it in # all of performance models every time we add a model. # # @since v4.9.0 # @api private module Mergeable def merge(_other) nil end end end
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/response.rb
Ruby
mit
83
master
4,135
module Airbrake # Parses responses coming from the Airbrake API. Handles HTTP errors by # logging them. # # @api private # @since v1.0.0 module Response # @return [Integer] the limit of the response body TRUNCATE_LIMIT = 100 # @return [Integer] HTTP code returned when the server cannot or will ...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/query.rb
Ruby
mit
83
master
1,193
module Airbrake # Query holds SQL query data that powers SQL query collection. # # @see Airbrake.notify_query # @api public # @since v3.2.0 # rubocop:disable Metrics/ParameterLists class Query include HashKeyable include Ignorable include Stashable include Mergeable include Grouppable ...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/stat.rb
Ruby
mit
83
master
1,915
require 'base64' module Airbrake # Stat is a data structure that allows accumulating performance data (route # performance, SQL query performance and such). It's powered by TDigests. # # Usually, one Stat corresponds to one metric (route or query, # etc.). Incrementing a stat means pushing new performance st...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/tdigest.rb
Ruby
mit
83
master
10,381
require 'rbtree' module Airbrake # Ruby implementation of Ted Dunning's t-digest data structure. # # This implementation is imported from https://github.com/castle/tdigest with # custom modifications. Huge thanks to Castle for the implementation :beer: # # The difference is that we pack with Big Endian (un...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/notice_notifier.rb
Ruby
mit
83
master
3,968
module Airbrake # NoticeNotifier is reponsible for sending notices to Airbrake. It supports # synchronous and asynchronous delivery. # # @see Airbrake::Config The list of options # @since v1.0.0 # @api public class NoticeNotifier # @return [Array<Class>] filters to be executed first DEFAULT_FILTER...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/time_truncate.rb
Ruby
mit
83
master
449
module Airbrake # TimeTruncate contains methods for truncating time. # # @api private # @since v3.2.0 module TimeTruncate # Truncate +time+ to floor minute and turn it into an RFC3339 timestamp. # # @param [Time, Integer, Float] time # @return [String] def self.utc_truncate_minutes(time) ...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/truncator.rb
Ruby
mit
83
master
3,799
module Airbrake # This class is responsible for truncation of too big objects. Mainly, you # should use it for simple objects such as strings, hashes, & arrays. # # @api private # @since v1.0.0 class Truncator # @return [Hash] the options for +String#encode+ ENCODING_OPTIONS = { invalid: :replace, u...