repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
arsduo/koala | https://github.com/arsduo/koala/blob/47d052063ef8b5644fb59e279da0b52687999f55/lib/koala/errors.rb | lib/koala/errors.rb | module Koala
class KoalaError < StandardError; end
module Facebook
# The OAuth signature is incomplete, invalid, or using an unsupported algorithm
class OAuthSignatureError < ::Koala::KoalaError; end
# Required for realtime updates validation
class AppSecretNotDefinedError < ::Koala::KoalaError;... | ruby | MIT | 47d052063ef8b5644fb59e279da0b52687999f55 | 2026-01-04T15:50:07.037818Z | false |
arsduo/koala | https://github.com/arsduo/koala/blob/47d052063ef8b5644fb59e279da0b52687999f55/lib/koala/utils.rb | lib/koala/utils.rb | module Koala
module Utils
# Utility methods used by Koala.
require 'logger'
require 'forwardable'
extend Forwardable
extend self
def_delegators :logger, :debug, :info, :warn, :error, :fatal, :level, :level=
# The Koala logger, an instance of the standard Ruby logger, pointing to STDOUT... | ruby | MIT | 47d052063ef8b5644fb59e279da0b52687999f55 | 2026-01-04T15:50:07.037818Z | false |
arsduo/koala | https://github.com/arsduo/koala/blob/47d052063ef8b5644fb59e279da0b52687999f55/lib/koala/realtime_updates.rb | lib/koala/realtime_updates.rb | module Koala
module Facebook
class RealtimeUpdates
# Manage realtime callbacks for changes to users' information.
# See http://developers.facebook.com/docs/reference/api/realtime.
#
# @note: to subscribe to real-time updates, you must have an application access token
# or prov... | ruby | MIT | 47d052063ef8b5644fb59e279da0b52687999f55 | 2026-01-04T15:50:07.037818Z | false |
arsduo/koala | https://github.com/arsduo/koala/blob/47d052063ef8b5644fb59e279da0b52687999f55/lib/koala/api.rb | lib/koala/api.rb | # graph_batch_api and legacy are required at the bottom, since they depend on API being defined
require 'koala/api/graph_api_methods'
require 'koala/api/graph_collection'
require 'openssl'
module Koala
module Facebook
class API
# Creates a new API client.
# @param [String] access_token access token
... | ruby | MIT | 47d052063ef8b5644fb59e279da0b52687999f55 | 2026-01-04T15:50:07.037818Z | false |
arsduo/koala | https://github.com/arsduo/koala/blob/47d052063ef8b5644fb59e279da0b52687999f55/lib/koala/configuration.rb | lib/koala/configuration.rb | # Global configuration for Koala.
class Koala::Configuration
# The default access token to be used if none is otherwise supplied.
attr_accessor :access_token
# The default app secret value to be used if none is otherwise supplied.
attr_accessor :app_secret
# The default application ID to use if none is othe... | ruby | MIT | 47d052063ef8b5644fb59e279da0b52687999f55 | 2026-01-04T15:50:07.037818Z | false |
arsduo/koala | https://github.com/arsduo/koala/blob/47d052063ef8b5644fb59e279da0b52687999f55/lib/koala/test_users.rb | lib/koala/test_users.rb | require 'koala'
module Koala
module Facebook
# Create and manage test users for your application.
# A test user is a user account associated with an app created for the purpose
# of testing the functionality of that app.
# You can use test users for manual or automated testing --
# Koala's live ... | ruby | MIT | 47d052063ef8b5644fb59e279da0b52687999f55 | 2026-01-04T15:50:07.037818Z | false |
arsduo/koala | https://github.com/arsduo/koala/blob/47d052063ef8b5644fb59e279da0b52687999f55/lib/koala/oauth.rb | lib/koala/oauth.rb | # OpenSSL and Base64 are required to support signed_request
require 'openssl'
require 'base64'
module Koala
module Facebook
class OAuth
attr_reader :app_id, :app_secret, :oauth_callback_url
# Creates a new OAuth client.
#
# @param app_id [String, Integer] a Facebook application ID
... | ruby | MIT | 47d052063ef8b5644fb59e279da0b52687999f55 | 2026-01-04T15:50:07.037818Z | false |
arsduo/koala | https://github.com/arsduo/koala/blob/47d052063ef8b5644fb59e279da0b52687999f55/lib/koala/api/graph_api_methods.rb | lib/koala/api/graph_api_methods.rb | require 'addressable/uri'
require 'koala/api/graph_collection'
require 'koala/http_service/uploadable_io'
require 'koala/api/graph_error_checker'
module Koala
module Facebook
# Methods used to interact with the Facebook Graph API.
#
# See https://github.com/arsduo/koala/wiki/Graph-API for a general intr... | ruby | MIT | 47d052063ef8b5644fb59e279da0b52687999f55 | 2026-01-04T15:50:07.037818Z | false |
arsduo/koala | https://github.com/arsduo/koala/blob/47d052063ef8b5644fb59e279da0b52687999f55/lib/koala/api/graph_collection.rb | lib/koala/api/graph_collection.rb | require 'addressable/uri'
require 'cgi'
module Koala
module Facebook
class API
# A light wrapper for collections returned from the Graph API.
# It extends Array to allow you to page backward and forward through
# result sets, and providing easy access to paging information.
class GraphCol... | ruby | MIT | 47d052063ef8b5644fb59e279da0b52687999f55 | 2026-01-04T15:50:07.037818Z | false |
arsduo/koala | https://github.com/arsduo/koala/blob/47d052063ef8b5644fb59e279da0b52687999f55/lib/koala/api/graph_error_checker.rb | lib/koala/api/graph_error_checker.rb | module Koala
module Facebook
# This class, given a Koala::HTTPService::Response object, will check for Graph API-specific
# errors. This returns an error of the appropriate type which can be immediately raised
# (non-batch) or added to the list of batch results (batch)
class GraphErrorChecker
at... | ruby | MIT | 47d052063ef8b5644fb59e279da0b52687999f55 | 2026-01-04T15:50:07.037818Z | false |
arsduo/koala | https://github.com/arsduo/koala/blob/47d052063ef8b5644fb59e279da0b52687999f55/lib/koala/api/graph_batch_api.rb | lib/koala/api/graph_batch_api.rb | require "koala/api"
require "koala/api/batch_operation"
module Koala
module Facebook
# @private
class GraphBatchAPI
# inside a batch call we can do anything a regular Graph API can do
include GraphAPIMethods
# Limits from @see https://developers.facebook.com/docs/marketing-api/batch-reques... | ruby | MIT | 47d052063ef8b5644fb59e279da0b52687999f55 | 2026-01-04T15:50:07.037818Z | false |
arsduo/koala | https://github.com/arsduo/koala/blob/47d052063ef8b5644fb59e279da0b52687999f55/lib/koala/api/batch_operation.rb | lib/koala/api/batch_operation.rb | require 'koala/api'
require 'koala/api/graph_batch_api'
module Koala
module Facebook
class GraphBatchAPI < API
# @private
class BatchOperation
attr_reader :access_token, :http_options, :post_processing, :files, :batch_api, :identifier
@identifier = 0
def self.next_identifier... | ruby | MIT | 47d052063ef8b5644fb59e279da0b52687999f55 | 2026-01-04T15:50:07.037818Z | false |
arsduo/koala | https://github.com/arsduo/koala/blob/47d052063ef8b5644fb59e279da0b52687999f55/lib/koala/http_service/uploadable_io.rb | lib/koala/http_service/uploadable_io.rb | require "tempfile"
module Koala
module HTTPService
class UploadableIO
attr_reader :io_or_path, :content_type, :filename
def initialize(io_or_path_or_mixed, content_type = nil, filename = nil)
# see if we got the right inputs
parse_init_mixed_param io_or_path_or_mixed, content_type
... | ruby | MIT | 47d052063ef8b5644fb59e279da0b52687999f55 | 2026-01-04T15:50:07.037818Z | false |
arsduo/koala | https://github.com/arsduo/koala/blob/47d052063ef8b5644fb59e279da0b52687999f55/lib/koala/http_service/response.rb | lib/koala/http_service/response.rb | module Koala
module HTTPService
class Response
attr_reader :status, :body, :headers
# Creates a new Response object, which standardizes the response received by Facebook for use within Koala.
def initialize(status, body, headers)
@status = status
@body = body
@headers = ... | ruby | MIT | 47d052063ef8b5644fb59e279da0b52687999f55 | 2026-01-04T15:50:07.037818Z | false |
arsduo/koala | https://github.com/arsduo/koala/blob/47d052063ef8b5644fb59e279da0b52687999f55/lib/koala/http_service/request.rb | lib/koala/http_service/request.rb | module Koala
module HTTPService
class Request
attr_reader :raw_path, :raw_args, :raw_verb, :raw_options
# @param path the server path for this request
# @param args (see Koala::Facebook::API#api)
# @param verb the HTTP method to use.
# If not get or post, this will be tu... | ruby | MIT | 47d052063ef8b5644fb59e279da0b52687999f55 | 2026-01-04T15:50:07.037818Z | false |
travisjeffery/timecop | https://github.com/travisjeffery/timecop/blob/d695c6f8e69c88d61bdb25d74867dc560860f019/test/timecop_date_parse_travel_test.rb | test/timecop_date_parse_travel_test.rb | require_relative "test_helper"
require 'timecop'
require_relative 'date_parse_scenarios'
require_relative 'date_time_parse_scenarios'
class TestTimecop < Minitest::Test
def setup
t = Time.local(2008, 9, 1, 10, 5, 0) # monday
Timecop.travel(t)
end
def teardown
Timecop.return
end
# Test for Date
... | ruby | MIT | d695c6f8e69c88d61bdb25d74867dc560860f019 | 2026-01-04T15:50:26.450338Z | false |
travisjeffery/timecop | https://github.com/travisjeffery/timecop/blob/d695c6f8e69c88d61bdb25d74867dc560860f019/test/timecop_date_parse_freeze_test.rb | test/timecop_date_parse_freeze_test.rb | require_relative "test_helper"
require 'timecop'
require_relative 'date_parse_scenarios'
require_relative 'date_time_parse_scenarios'
class TestTimecop < Minitest::Test
def setup
t = Time.local(2008, 9, 1, 10, 5, 0) # monday
Timecop.freeze(t)
end
def teardown
Timecop.return
end
# Test for Date
... | ruby | MIT | d695c6f8e69c88d61bdb25d74867dc560860f019 | 2026-01-04T15:50:26.450338Z | false |
travisjeffery/timecop | https://github.com/travisjeffery/timecop/blob/d695c6f8e69c88d61bdb25d74867dc560860f019/test/timecop_without_date_test.rb | test/timecop_without_date_test.rb | require_relative "test_helper"
require 'timecop'
class TestTimecopWithoutDate < Minitest::Test
def setup
Object.send(:remove_const, :Date) if Object.const_defined?(:Date)
Object.send(:remove_const, :DateTime) if Object.const_defined?(:DateTime)
end
# just in case...let's really make sure that Timecop i... | ruby | MIT | d695c6f8e69c88d61bdb25d74867dc560860f019 | 2026-01-04T15:50:26.450338Z | false |
travisjeffery/timecop | https://github.com/travisjeffery/timecop/blob/d695c6f8e69c88d61bdb25d74867dc560860f019/test/date_parse_scenarios.rb | test/date_parse_scenarios.rb | module DateParseScenarios
def test_date_parse_sunday_after_travel
assert_equal Date.parse("2008-08-31"), Date.parse('Sunday')
assert_equal Date.parse("2008-08-31"), Date.parse('Sun')
end
def test_date_parse_monday_after_travel
assert_equal Date.parse("2008-09-01"), Date.parse('Monday')
assert_eq... | ruby | MIT | d695c6f8e69c88d61bdb25d74867dc560860f019 | 2026-01-04T15:50:26.450338Z | false |
travisjeffery/timecop | https://github.com/travisjeffery/timecop/blob/d695c6f8e69c88d61bdb25d74867dc560860f019/test/timecop_with_process_clock_test.rb | test/timecop_with_process_clock_test.rb | require_relative "test_helper"
require 'timecop'
class TestTimecopWithProcessClock < Minitest::Test
TIME_EPSILON = 0.001 # seconds - represents enough time for Process.clock_gettime to have advanced if not frozen
def setup
Timecop.mock_process_clock = true
end
def teardown
Timecop.return
Timecop.... | ruby | MIT | d695c6f8e69c88d61bdb25d74867dc560860f019 | 2026-01-04T15:50:26.450338Z | false |
travisjeffery/timecop | https://github.com/travisjeffery/timecop/blob/d695c6f8e69c88d61bdb25d74867dc560860f019/test/timecop_date_strptime_travel_test.rb | test/timecop_date_strptime_travel_test.rb | require_relative "test_helper"
require 'timecop'
require_relative 'date_strptime_scenarios'
class TestTimecop < Minitest::Test
def setup
t = Time.local(1984,2,28)
Timecop.travel(t)
end
def teardown
Timecop.return
end
# Test for Date
include DateStrptimeScenarios
end
| ruby | MIT | d695c6f8e69c88d61bdb25d74867dc560860f019 | 2026-01-04T15:50:26.450338Z | false |
travisjeffery/timecop | https://github.com/travisjeffery/timecop/blob/d695c6f8e69c88d61bdb25d74867dc560860f019/test/timecop_test.rb | test/timecop_test.rb | require_relative "test_helper"
require 'timecop'
class TestTimecop < Minitest::Test
def teardown
Timecop.return
end
def test_freeze_changes_and_resets_time
outer_freeze_time = Time.local(2001, 01, 01)
inner_freeze_block = Time.local(2002, 02, 02)
inner_freeze_one = Time.local(2003, 03, 03)
i... | ruby | MIT | d695c6f8e69c88d61bdb25d74867dc560860f019 | 2026-01-04T15:50:26.450338Z | false |
travisjeffery/timecop | https://github.com/travisjeffery/timecop/blob/d695c6f8e69c88d61bdb25d74867dc560860f019/test/date_time_parse_scenarios.rb | test/date_time_parse_scenarios.rb | module DateTimeParseScenarios
def test_date_time_parse_sunday_after_travel
assert_equal DateTime.parse("2008-08-31"), DateTime.parse('Sunday')
assert_equal DateTime.parse("2008-08-31"), DateTime.parse('Sun')
end
def test_date_time_parse_monday_after_travel
assert_equal DateTime.parse("2008-09-01"), ... | ruby | MIT | d695c6f8e69c88d61bdb25d74867dc560860f019 | 2026-01-04T15:50:26.450338Z | false |
travisjeffery/timecop | https://github.com/travisjeffery/timecop/blob/d695c6f8e69c88d61bdb25d74867dc560860f019/test/timecop_with_active_support_test.rb | test/timecop_with_active_support_test.rb | require 'date'
require 'bundler/setup'
require 'active_support/all'
require_relative "test_helper"
require 'timecop'
class TestTimecopWithActiveSupport < Minitest::Test
def teardown
Timecop.return
end
def test_travel_does_not_reduce_precision_of_time
Timecop.travel(1)
long_ago = Time.now
sleep... | ruby | MIT | d695c6f8e69c88d61bdb25d74867dc560860f019 | 2026-01-04T15:50:26.450338Z | false |
travisjeffery/timecop | https://github.com/travisjeffery/timecop/blob/d695c6f8e69c88d61bdb25d74867dc560860f019/test/timecop_date_strptime_freeze_test.rb | test/timecop_date_strptime_freeze_test.rb | require_relative "test_helper"
require 'timecop'
require_relative 'date_strptime_scenarios'
class TestTimecop < Minitest::Test
def setup
t = Time.local(1984,2,28)
Timecop.freeze(t)
end
def teardown
Timecop.return
end
# Test for Date
include DateStrptimeScenarios
end
| ruby | MIT | d695c6f8e69c88d61bdb25d74867dc560860f019 | 2026-01-04T15:50:26.450338Z | false |
travisjeffery/timecop | https://github.com/travisjeffery/timecop/blob/d695c6f8e69c88d61bdb25d74867dc560860f019/test/test_helper.rb | test/test_helper.rb | require 'bundler/setup'
require 'minitest/autorun'
require 'pry'
$VERBOSE = true # enable ruby warnings
require 'mocha/minitest'
class Minitest::Test
private
# Tests to see that two times are within the given distance,
# in seconds, from each other.
def times_effectively_equal(time1, time2, seconds_int... | ruby | MIT | d695c6f8e69c88d61bdb25d74867dc560860f019 | 2026-01-04T15:50:26.450338Z | false |
travisjeffery/timecop | https://github.com/travisjeffery/timecop/blob/d695c6f8e69c88d61bdb25d74867dc560860f019/test/date_strptime_scenarios.rb | test/date_strptime_scenarios.rb | module DateStrptimeScenarios
#calling freeze and travel tests are making the date Time.local(1984,2,28)
def test_date_strptime_with_year
assert_equal Date.strptime('1999', '%Y'), Date.new(1999, 1, 1)
end
def test_date_strptime_without_year
assert_equal Date.strptime('04-14', '%m-%d'), Date.new(1984, ... | ruby | MIT | d695c6f8e69c88d61bdb25d74867dc560860f019 | 2026-01-04T15:50:26.450338Z | false |
travisjeffery/timecop | https://github.com/travisjeffery/timecop/blob/d695c6f8e69c88d61bdb25d74867dc560860f019/test/timecop_without_date_but_with_time_test.rb | test/timecop_without_date_but_with_time_test.rb | require_relative "test_helper"
require "time"
class TestTimecopWithoutDateButWithTime < Minitest::Test
def test_loads_properly_when_time_is_required_instead_of_date
require 'timecop'
end
end
| ruby | MIT | d695c6f8e69c88d61bdb25d74867dc560860f019 | 2026-01-04T15:50:26.450338Z | false |
travisjeffery/timecop | https://github.com/travisjeffery/timecop/blob/d695c6f8e69c88d61bdb25d74867dc560860f019/test/time_stack_item_test.rb | test/time_stack_item_test.rb | require 'date'
require_relative "test_helper"
require 'timecop'
require 'active_support/all'
class TestTimeStackItem < Minitest::Test
def teardown
Timecop.return
Time.zone = nil
end
def test_new_with_time
t = Time.now
y, m, d, h, min, s = t.year, t.month, t.day, t.hour, t.min, t.sec
stack_i... | ruby | MIT | d695c6f8e69c88d61bdb25d74867dc560860f019 | 2026-01-04T15:50:26.450338Z | false |
travisjeffery/timecop | https://github.com/travisjeffery/timecop/blob/d695c6f8e69c88d61bdb25d74867dc560860f019/lib/timecop.rb | lib/timecop.rb | require File.join(File.dirname(__FILE__), "timecop", "timecop")
require File.join(File.dirname(__FILE__), "timecop", "version")
| ruby | MIT | d695c6f8e69c88d61bdb25d74867dc560860f019 | 2026-01-04T15:50:26.450338Z | false |
travisjeffery/timecop | https://github.com/travisjeffery/timecop/blob/d695c6f8e69c88d61bdb25d74867dc560860f019/lib/timecop/version.rb | lib/timecop/version.rb | class Timecop
VERSION = "0.9.10"
end
| ruby | MIT | d695c6f8e69c88d61bdb25d74867dc560860f019 | 2026-01-04T15:50:26.450338Z | false |
travisjeffery/timecop | https://github.com/travisjeffery/timecop/blob/d695c6f8e69c88d61bdb25d74867dc560860f019/lib/timecop/timecop.rb | lib/timecop/timecop.rb | require 'singleton'
require File.join(File.dirname(__FILE__), "time_stack_item")
# Timecop
# * Wrapper class for manipulating the extensions to the Time, Date, and DateTime objects
# * Allows us to "freeze" time in our Ruby applications.
# * Optionally allows time travel to simulate a running clock, such time is not t... | ruby | MIT | d695c6f8e69c88d61bdb25d74867dc560860f019 | 2026-01-04T15:50:26.450338Z | false |
travisjeffery/timecop | https://github.com/travisjeffery/timecop/blob/d695c6f8e69c88d61bdb25d74867dc560860f019/lib/timecop/time_extensions.rb | lib/timecop/time_extensions.rb | require 'time'
require 'date'
class Time #:nodoc:
class << self
def mock_time
mocked_time_stack_item = Timecop.top_stack_item
mocked_time_stack_item.nil? ? nil : mocked_time_stack_item.time(self)
end
alias_method :now_without_mock_time, :now
def now_with_mock_time
mock_time || now... | ruby | MIT | d695c6f8e69c88d61bdb25d74867dc560860f019 | 2026-01-04T15:50:26.450338Z | false |
travisjeffery/timecop | https://github.com/travisjeffery/timecop/blob/d695c6f8e69c88d61bdb25d74867dc560860f019/lib/timecop/time_stack_item.rb | lib/timecop/time_stack_item.rb | class Timecop
# A data class for carrying around "time movement" objects. Makes it easy to keep track of the time
# movements on a simple stack.
class TimeStackItem #:nodoc:
attr_reader :mock_type
def initialize(mock_type, *args)
raise "Unknown mock_type #{mock_type}" unless [:freeze, :travel, :sc... | ruby | MIT | d695c6f8e69c88d61bdb25d74867dc560860f019 | 2026-01-04T15:50:26.450338Z | false |
ankane/pgsync | https://github.com/ankane/pgsync/blob/db602dae85993000d7fcfb4d490f4a48dd1c54a6/test/commands_test.rb | test/commands_test.rb | require_relative "test_helper"
class CommandsTest < Minitest::Test
def test_help
assert_prints "Usage:", "-h"
assert_prints "Usage:", "--help"
end
def test_version
assert_prints PgSync::VERSION, "-v"
assert_prints PgSync::VERSION, "--version"
end
def test_bad_option
assert_error "unknow... | ruby | MIT | db602dae85993000d7fcfb4d490f4a48dd1c54a6 | 2026-01-04T15:50:27.885575Z | false |
ankane/pgsync | https://github.com/ankane/pgsync/blob/db602dae85993000d7fcfb4d490f4a48dd1c54a6/test/tables_test.rb | test/tables_test.rb | require_relative "test_helper"
class TablesTest < Minitest::Test
def test_default
tables = list_tables
assert_includes tables, "posts"
refute_includes tables, "other.pets"
refute_includes tables, "excluded"
end
def test_wildcard
tables = list_tables("p*")
assert_includes tables, "posts"
... | ruby | MIT | db602dae85993000d7fcfb4d490f4a48dd1c54a6 | 2026-01-04T15:50:27.885575Z | false |
ankane/pgsync | https://github.com/ankane/pgsync/blob/db602dae85993000d7fcfb4d490f4a48dd1c54a6/test/init_test.rb | test/init_test.rb | require_relative "test_helper"
class InitTest < Minitest::Test
def test_works
new_dir do
assert_works "--init"
assert_match "?sslmode=require", File.read(".pgsync.yml")
end
end
def test_too_many_arguments
assert_error "Usage:", "--init arg1 arg2"
end
def test_db_argument
new_dir... | ruby | MIT | db602dae85993000d7fcfb4d490f4a48dd1c54a6 | 2026-01-04T15:50:27.885575Z | false |
ankane/pgsync | https://github.com/ankane/pgsync/blob/db602dae85993000d7fcfb4d490f4a48dd1c54a6/test/data_source_test.rb | test/data_source_test.rb | require_relative "test_helper"
class DataSourceTest < Minitest::Test
def test_no_source
assert_error "No source", ""
end
def test_no_destination
assert_error "No destination", "--from db1"
end
def test_source_command_error
# https://github.com/oracle/truffleruby/issues/2568
skip if RUBY_ENG... | ruby | MIT | db602dae85993000d7fcfb4d490f4a48dd1c54a6 | 2026-01-04T15:50:27.885575Z | false |
ankane/pgsync | https://github.com/ankane/pgsync/blob/db602dae85993000d7fcfb4d490f4a48dd1c54a6/test/variable_test.rb | test/variable_test.rb | require_relative "test_helper"
class VariableTest < Minitest::Test
def setup
truncate_tables ["posts"]
end
def test_number
source = 3.times.map { |i| {"id" => i + 1, "title" => "Post #{i + 1}"} }
expected = [source[1]]
insert(conn1, "posts", source)
assert_works "variable:2", config: true
... | ruby | MIT | db602dae85993000d7fcfb4d490f4a48dd1c54a6 | 2026-01-04T15:50:27.885575Z | false |
ankane/pgsync | https://github.com/ankane/pgsync/blob/db602dae85993000d7fcfb4d490f4a48dd1c54a6/test/in_batches_test.rb | test/in_batches_test.rb | require_relative "test_helper"
class InBatchesTest < Minitest::Test
def setup
truncate_tables ["posts"]
end
def test_works
source = 3.times.map { |i| {"id" => i + 1, "title" => "Post #{i + 1}"} }
dest = []
expected = source
assert_result("--in-batches --batch-size 1", source, dest, expected)... | ruby | MIT | db602dae85993000d7fcfb4d490f4a48dd1c54a6 | 2026-01-04T15:50:27.885575Z | false |
ankane/pgsync | https://github.com/ankane/pgsync/blob/db602dae85993000d7fcfb4d490f4a48dd1c54a6/test/test_helper.rb | test/test_helper.rb | require "bundler/setup"
Bundler.require(:default)
require "minitest/autorun"
require "shellwords"
require "tmpdir"
require "open3"
def connect(dbname)
conn = PG::Connection.open(dbname: dbname)
conn.exec("SET client_min_messages TO WARNING")
conn.type_map_for_results = PG::BasicTypeMapForResults.new(conn)
conn... | ruby | MIT | db602dae85993000d7fcfb4d490f4a48dd1c54a6 | 2026-01-04T15:50:27.885575Z | false |
ankane/pgsync | https://github.com/ankane/pgsync/blob/db602dae85993000d7fcfb4d490f4a48dd1c54a6/test/sync_test.rb | test/sync_test.rb | require_relative "test_helper"
class SyncTest < Minitest::Test
def setup
truncate_tables ["posts", "comments", "books", "robots"]
end
def test_truncate
source = 3.times.map { |i| {"id" => i + 1, "title" => "Post #{i + 1}"} }
dest = [{"id" => 1, "title" => "First Post"}, {"id" => 4, "title" => "Post ... | ruby | MIT | db602dae85993000d7fcfb4d490f4a48dd1c54a6 | 2026-01-04T15:50:27.885575Z | false |
ankane/pgsync | https://github.com/ankane/pgsync/blob/db602dae85993000d7fcfb4d490f4a48dd1c54a6/test/data_rules_test.rb | test/data_rules_test.rb | require_relative "test_helper"
class DataRulesTest < Minitest::Test
def setup
truncate_tables ["Users"]
2.times do
insert(conn1, "Users", [{
"email" => "hi@example.org",
"phone" => "555-555-5555",
"token" => "token123",
"attempts" => 1,
"created_on" => Date.toda... | ruby | MIT | db602dae85993000d7fcfb4d490f4a48dd1c54a6 | 2026-01-04T15:50:27.885575Z | false |
ankane/pgsync | https://github.com/ankane/pgsync/blob/db602dae85993000d7fcfb4d490f4a48dd1c54a6/test/schema_test.rb | test/schema_test.rb | require_relative "test_helper"
class SchemaTest < Minitest::Test
def setup
load_schema(conn3, "schema3")
truncate(conn1, "posts")
end
def test_schema_only
insert(conn1, "posts", [{"id" => 1}])
assert_equal [], tables(conn3)
assert_works "--from pgsync_test1 --to pgsync_test3 --schema-only --... | ruby | MIT | db602dae85993000d7fcfb4d490f4a48dd1c54a6 | 2026-01-04T15:50:27.885575Z | false |
ankane/pgsync | https://github.com/ankane/pgsync/blob/db602dae85993000d7fcfb4d490f4a48dd1c54a6/lib/pgsync.rb | lib/pgsync.rb | # dependencies
require "parallel"
require "pg"
require "slop"
require "tty-spinner"
# stdlib
require "open3"
require "set"
require "shellwords"
require "tempfile"
require "uri"
require "yaml"
# modules
require_relative "pgsync/utils"
require_relative "pgsync/client"
require_relative "pgsync/data_source"
require_relat... | ruby | MIT | db602dae85993000d7fcfb4d490f4a48dd1c54a6 | 2026-01-04T15:50:27.885575Z | false |
ankane/pgsync | https://github.com/ankane/pgsync/blob/db602dae85993000d7fcfb4d490f4a48dd1c54a6/lib/pgsync/task.rb | lib/pgsync/task.rb | module PgSync
class Task
include Utils
attr_reader :source, :destination, :config, :table, :opts
attr_accessor :from_columns, :to_columns, :from_sequences, :to_sequences, :to_primary_key
def initialize(source:, destination:, config:, table:, opts:)
@source = source
@destination = destina... | ruby | MIT | db602dae85993000d7fcfb4d490f4a48dd1c54a6 | 2026-01-04T15:50:27.885575Z | false |
ankane/pgsync | https://github.com/ankane/pgsync/blob/db602dae85993000d7fcfb4d490f4a48dd1c54a6/lib/pgsync/table.rb | lib/pgsync/table.rb | # minimal class to keep schema and table name separate
module PgSync
class Table
attr_reader :schema, :name
def initialize(schema, name)
@schema = schema
@name = name
end
def full_name
"#{schema}.#{name}"
end
def eql?(other)
other.schema == schema && other.name == na... | ruby | MIT | db602dae85993000d7fcfb4d490f4a48dd1c54a6 | 2026-01-04T15:50:27.885575Z | false |
ankane/pgsync | https://github.com/ankane/pgsync/blob/db602dae85993000d7fcfb4d490f4a48dd1c54a6/lib/pgsync/version.rb | lib/pgsync/version.rb | module PgSync
VERSION = "0.8.1"
end
| ruby | MIT | db602dae85993000d7fcfb4d490f4a48dd1c54a6 | 2026-01-04T15:50:27.885575Z | false |
ankane/pgsync | https://github.com/ankane/pgsync/blob/db602dae85993000d7fcfb4d490f4a48dd1c54a6/lib/pgsync/data_source.rb | lib/pgsync/data_source.rb | module PgSync
class DataSource
include Utils
attr_reader :url
def initialize(url, name:, debug:)
@url = url
@name = name
@debug = debug
end
def exists?
@url && @url.size > 0
end
def local?
socket? || %w(localhost 127.0.0.1).include?(host)
end
# ho... | ruby | MIT | db602dae85993000d7fcfb4d490f4a48dd1c54a6 | 2026-01-04T15:50:27.885575Z | false |
ankane/pgsync | https://github.com/ankane/pgsync/blob/db602dae85993000d7fcfb4d490f4a48dd1c54a6/lib/pgsync/sync.rb | lib/pgsync/sync.rb | module PgSync
class Sync
include Utils
def initialize(arguments, options)
@arguments = arguments
@options = options
end
def perform
started_at = monotonic_time
args = @arguments
opts = @options
# only resolve commands from config, not CLI arguments
[:to, :... | ruby | MIT | db602dae85993000d7fcfb4d490f4a48dd1c54a6 | 2026-01-04T15:50:27.885575Z | false |
ankane/pgsync | https://github.com/ankane/pgsync/blob/db602dae85993000d7fcfb4d490f4a48dd1c54a6/lib/pgsync/utils.rb | lib/pgsync/utils.rb | module PgSync
module Utils
COLOR_CODES = {
red: 31,
green: 32,
yellow: 33,
cyan: 36
}
def log(message = nil)
output.puts message
end
def colorize(message, color)
if output.tty?
"\e[#{COLOR_CODES[color]}m#{message}\e[0m"
else
message
... | ruby | MIT | db602dae85993000d7fcfb4d490f4a48dd1c54a6 | 2026-01-04T15:50:27.885575Z | false |
ankane/pgsync | https://github.com/ankane/pgsync/blob/db602dae85993000d7fcfb4d490f4a48dd1c54a6/lib/pgsync/task_resolver.rb | lib/pgsync/task_resolver.rb | module PgSync
class TaskResolver
include Utils
attr_reader :args, :opts, :source, :destination, :config, :first_schema, :notes
def initialize(args:, opts:, source:, destination:, config:, first_schema:)
@args = args
@opts = opts
@source = source
@destination = destination
@... | ruby | MIT | db602dae85993000d7fcfb4d490f4a48dd1c54a6 | 2026-01-04T15:50:27.885575Z | false |
ankane/pgsync | https://github.com/ankane/pgsync/blob/db602dae85993000d7fcfb4d490f4a48dd1c54a6/lib/pgsync/sequence.rb | lib/pgsync/sequence.rb | # minimal class to keep schema and sequence name separate
module PgSync
class Sequence
attr_reader :schema, :name, :column
def initialize(schema, name, column:)
@schema = schema
@name = name
@column = column
end
def full_name
"#{schema}.#{name}"
end
def eql?(other)
... | ruby | MIT | db602dae85993000d7fcfb4d490f4a48dd1c54a6 | 2026-01-04T15:50:27.885575Z | false |
ankane/pgsync | https://github.com/ankane/pgsync/blob/db602dae85993000d7fcfb4d490f4a48dd1c54a6/lib/pgsync/table_sync.rb | lib/pgsync/table_sync.rb | module PgSync
class TableSync
include Utils
attr_reader :source, :destination, :tasks, :opts, :resolver
def initialize(source:, destination:, tasks:, opts:, resolver:)
@source = source
@destination = destination
@tasks = tasks
@opts = opts
@resolver = resolver
end
... | ruby | MIT | db602dae85993000d7fcfb4d490f4a48dd1c54a6 | 2026-01-04T15:50:27.885575Z | false |
ankane/pgsync | https://github.com/ankane/pgsync/blob/db602dae85993000d7fcfb4d490f4a48dd1c54a6/lib/pgsync/client.rb | lib/pgsync/client.rb | module PgSync
class Client
include Utils
def initialize(args)
@args = args
output.sync = true
end
def perform
result = Slop::Parser.new(slop_options).parse(@args)
arguments = result.arguments
options = result.to_h
options[:defer_constraints_v2] ||= options[:defer_... | ruby | MIT | db602dae85993000d7fcfb4d490f4a48dd1c54a6 | 2026-01-04T15:50:27.885575Z | false |
ankane/pgsync | https://github.com/ankane/pgsync/blob/db602dae85993000d7fcfb4d490f4a48dd1c54a6/lib/pgsync/schema_sync.rb | lib/pgsync/schema_sync.rb | module PgSync
class SchemaSync
include Utils
attr_reader :args, :opts
def initialize(source:, destination:, tasks:, args:, opts:)
@source = source
@destination = destination
@tasks = tasks
@args = args
@opts = opts
end
def perform
if opts[:preserve]
r... | ruby | MIT | db602dae85993000d7fcfb4d490f4a48dd1c54a6 | 2026-01-04T15:50:27.885575Z | false |
ankane/pgsync | https://github.com/ankane/pgsync/blob/db602dae85993000d7fcfb4d490f4a48dd1c54a6/lib/pgsync/init.rb | lib/pgsync/init.rb | module PgSync
class Init
include Utils
def initialize(arguments, options)
@arguments = arguments
@options = options
end
def perform
if @arguments.size > 1
raise Error, "Usage:\n pgsync --init [db]"
end
file =
if @options[:config]
@options[:... | ruby | MIT | db602dae85993000d7fcfb4d490f4a48dd1c54a6 | 2026-01-04T15:50:27.885575Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/test_helper.rb | test/test_helper.rb | # frozen_string_literal: true
if ENV['COVERAGE'] == 'true'
require 'simplecov'
SimpleCov.start do
track_files '/lib/'
end
end
require 'minitest/autorun'
require 'minitest/around/spec'
require 'minitest/pride'
require 'mocha/minitest'
require 'ostruct'
require 'diff/lcs'
def context(...)
describe(...)
end... | ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/fakefs_helper.rb | test/fakefs_helper.rb | # frozen_string_literal: true
require 'etc'
require 'fakefs/safe'
module FakeFS
class File < StringIO
# $VERBOSE = nil to suppress warnings when we override flock.
original_verbose = $VERBOSE
$VERBOSE = nil
# rubocop:disable Naming/PredicateMethod
def flock(*)
true
end
# rubocop:e... | ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/analysers_test_helper.rb | test/analysers_test_helper.rb | # frozen_string_literal: true
require 'test_helper'
class AnalysedModuleDouble < OpenStruct; end
require_relative '../lib/rubycritic/core/analysed_modules_collection'
class AnalysedModulesCollectionDouble < RubyCritic::AnalysedModulesCollection
def initialize(module_doubles)
@modules = module_doubles
end
end... | ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/samples/empty.rb | test/samples/empty.rb | ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false | |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/samples/compare_file.rb | test/samples/compare_file.rb | ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false | |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/samples/methods_count.rb | test/samples/methods_count.rb | class Example
def self.one_class_method
end
def one_instance_method
end
end
| ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/samples/no_methods.rb | test/samples/no_methods.rb | module Foo
class NoMethods
end
end
| ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/samples/base_branch_file.rb | test/samples/base_branch_file.rb | class Signup
end | ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/samples/feature_branch_file.rb | test/samples/feature_branch_file.rb | class Signup
def flay(parts)
parts -= 1
parts -= 2
parts -= 3
parts -= 4
end
def method_missing(method, *args, &block)
message = "I"
eval "message = ' did not'"
eval "message << ' exist,'"
eval "message << ' but now'"
eval "message << ' I do.'"
self.class.send(:define_met... | ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/samples/dummy_formatter.rb | test/samples/dummy_formatter.rb | module Test
class DummyFormatter
def initialize(_analysed_modules); end
def generate_report; end
end
end
| ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/samples/module_names.rb | test/samples/module_names.rb | module Foo
end
module Foo
class Bar
end
class Baz
end
end
class Foo::Qux
end
module Foo::Quux
class Corge
end
end
| ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/samples/flog/smelly.rb | test/samples/flog/smelly.rb | class AllTheMethods
def method_missing(method, *args, &block)
message = "I"
eval "message = ' did not'"
eval "message << ' exist,'"
eval "message << ' but now'"
eval "message << ' I do.'"
self.class.send(:define_method, method) { "I did not exist, but now I do." }
self.send(method)
end
e... | ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/samples/flog/complex.rb | test/samples/flog/complex.rb | class AllTheMethods
def method_missing(method, *args, &block)
message = "I"
eval "message = ' did not'"
eval "message << ' exist,'"
eval "message << ' but now'"
eval "message << ' I do.'"
self.class.send(:define_method, method) { "I did not exist, but now I do." }
self.send(method)
end
e... | ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/samples/location/file0_symlink.rb | test/samples/location/file0_symlink.rb | ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false | |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/samples/location/file0.rb | test/samples/location/file0.rb | ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false | |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/samples/location/dir1/file1.rb | test/samples/location/dir1/file1.rb | ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false | |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/samples/flay/smelly.rb | test/samples/flay/smelly.rb | class Ramsay
def flay(parts)
parts -= 1
parts -= 2
parts -= 3
parts -= 4
end
end
| ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/samples/flay/smelly2.rb | test/samples/flay/smelly2.rb | class Roose
def flay(parts)
parts -= 1
parts -= 2
parts -= 3
parts -= 4
end
def duplicate(parts)
parts -= 1
parts -= 2
parts -= 3
parts -= 4
end
end
| ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/samples/reek/not_smelly.rb | test/samples/reek/not_smelly.rb | class Perfume
attr_reader :perfumed
def ignoreRubyStyle(oneParameter)
oneVariable = oneParameter
end
def allow_nesting_iterators_two_levels_deep
loop do
loop do
end
end
end
def allow_many_statements
do_something
do_something
do_something
do_something
do_somethi... | ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/samples/reek/excluded.rb | test/samples/reek/excluded.rb | class Tyrion
def reeks?(reek = true)
reek
end
def flayed?(a)
a
end
end
# Reek should exclude this file entirely based on the .reek.yml configuration
| ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/samples/reek/smelly.rb | test/samples/reek/smelly.rb | class Theon
def reeks?(reek = true)
reek
end
def flayed?(a)
a
end
end
# Reek should report
# [1]:Theon has no descriptive comment (IrresponsibleModule)
# [2]:Theon#reeks? has boolean parameter 'reek' (BooleanParameter)
# This comment is below the module because otherwise Reek will interpret this
# as ... | ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/lib/rubycritic/version_test.rb | test/lib/rubycritic/version_test.rb | # frozen_string_literal: true
require 'test_helper'
require 'rubycritic/version'
describe 'RubyCritic version' do
it 'is defined' do
_(RubyCritic::VERSION).wont_be_nil
end
end
| ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/lib/rubycritic/revision_comparator_test.rb | test/lib/rubycritic/revision_comparator_test.rb | # frozen_string_literal: true
require 'test_helper'
require 'rubycritic/revision_comparator'
describe RubyCritic::RevisionComparator do
subject { RubyCritic::RevisionComparator.new([]) }
describe '#statuses=' do
context 'in a SCS with :revision? == false' do
before do
RubyCritic::Config.expects... | ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/lib/rubycritic/smells_status_setter_test.rb | test/lib/rubycritic/smells_status_setter_test.rb | # frozen_string_literal: true
require 'test_helper'
require 'rubycritic/core/smell'
require 'rubycritic/smells_status_setter'
describe RubyCritic::SmellsStatusSetter do
describe '::smells' do
before do
@smell = RubyCritic::Smell.new(context: '#bar')
@smells = [@smell]
end
it 'marks old smel... | ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/lib/rubycritic/configuration_test.rb | test/lib/rubycritic/configuration_test.rb | # frozen_string_literal: true
require 'test_helper'
require 'rubycritic/configuration'
describe RubyCritic::Configuration do
describe '#root' do
before do
RubyCritic::Config.set
@default = RubyCritic::Config.root
end
it 'has a default' do
_(RubyCritic::Config.root).must_be_instance_of... | ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/lib/rubycritic/browser_test.rb | test/lib/rubycritic/browser_test.rb | # frozen_string_literal: true
require 'test_helper'
require 'rubycritic/browser'
describe RubyCritic::Browser do
before do
@report_path = 'tmp/rubycritic/overview.html'
@browser = RubyCritic::Browser.new @report_path
end
describe '#open' do
it 'should be open report with launch browser' do
La... | ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/lib/rubycritic/source_locator_test.rb | test/lib/rubycritic/source_locator_test.rb | # frozen_string_literal: true
require 'test_helper'
require 'rubycritic/source_locator'
describe RubyCritic::SourceLocator do
before do
@original_dir = Dir.getwd
Dir.chdir('test/samples/location')
RubyCritic::Config.stubs(:ruby_extensions).returns(%w[.rb])
end
describe '#paths' do
it 'finds a s... | ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/lib/rubycritic/reporter_test.rb | test/lib/rubycritic/reporter_test.rb | # frozen_string_literal: true
require 'test_helper'
require 'rubycritic/reporter'
describe RubyCritic::Reporter do
before do
RubyCritic::Config.set({})
RubyCritic::Config.stubs(:no_browser).returns(true)
end
it 'creates multiple reports' do
RubyCritic::Config.stubs(:formats).returns(%i[json lint ht... | ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/lib/rubycritic/analysis_summary_test.rb | test/lib/rubycritic/analysis_summary_test.rb | # frozen_string_literal: true
require 'test_helper'
require 'rubycritic/analysis_summary'
module RubyCritic
describe AnalysisSummary do
before do
analysed_modules = AnalysedModulesCollectionDouble.new(
[
AnalysedModuleDouble.new(rating: 'A', churn: 2, smells: %i[a b c]),
Analys... | ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/lib/rubycritic/commands/compare_test.rb | test/lib/rubycritic/commands/compare_test.rb | # frozen_string_literal: true
require 'test_helper'
require 'minitest/mock'
require 'rubycritic/commands/compare'
require 'rubycritic/cli/options'
require 'rubycritic/configuration'
require 'rubycritic/source_control_systems/git'
module RubyCritic
module SourceControlSystem
class Git < Base
# $VERBOSE = n... | ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/lib/rubycritic/commands/status_reporter_test.rb | test/lib/rubycritic/commands/status_reporter_test.rb | # frozen_string_literal: true
require 'test_helper'
require 'rubycritic/commands/status_reporter'
require 'rubycritic/cli/options'
describe RubyCritic::Command::StatusReporter do
let(:success_status) { RubyCritic::Command::StatusReporter::SUCCESS }
let(:score_below_minimum) { RubyCritic::Command::StatusReporter::... | ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/lib/rubycritic/generators/lint_report_test.rb | test/lib/rubycritic/generators/lint_report_test.rb | # frozen_string_literal: true
require 'test_helper'
require 'rubycritic/analysers_runner'
require 'rubycritic/generators/lint_report'
describe RubyCritic::Generator::LintReport do
describe '#generate_report' do
before do
# Reset Reek configuration between tests
# Config is cached and can leak betwee... | ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/lib/rubycritic/generators/console_report_test.rb | test/lib/rubycritic/generators/console_report_test.rb | # frozen_string_literal: true
require 'test_helper'
require 'rubycritic/generators/console_report'
require 'rubycritic/core/rating'
require 'rubycritic/core/smell'
describe RubyCritic::Generator::ConsoleReport do
describe '#generate_report' do
before do
@mock_analysed_module = mock_analysed_module
c... | ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/lib/rubycritic/generators/json_report_test.rb | test/lib/rubycritic/generators/json_report_test.rb | # frozen_string_literal: true
require 'test_helper'
require 'rubycritic/analysers_runner'
require 'rubycritic/generators/json_report'
require 'json'
require 'fakefs_helper'
describe RubyCritic::Generator::JsonReport do
describe '#generate_report' do
around do |example|
capture_output_streams do
wi... | ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/lib/rubycritic/generators/turbulence_test.rb | test/lib/rubycritic/generators/turbulence_test.rb | # frozen_string_literal: true
require 'test_helper'
require 'rubycritic/generators/html/turbulence'
describe RubyCritic::Turbulence do
describe '::data' do
it 'returns json data that maps pathname, churn and complexity to name, x and y' do
files = [AnalysedModuleDouble.new(name: 'Foo', churn: 1, complexit... | ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/lib/rubycritic/generators/view_helpers_test.rb | test/lib/rubycritic/generators/view_helpers_test.rb | # frozen_string_literal: true
require 'test_helper'
require 'rubycritic/generators/html/view_helpers'
require 'pathname'
describe RubyCritic::ViewHelpers do
context 'when the file is in the root directory' do
let(:generator) { GeneratorDouble.new('foo.html') }
describe '#file_path' do
context 'when t... | ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/lib/rubycritic/generators/html_report_test.rb | test/lib/rubycritic/generators/html_report_test.rb | # frozen_string_literal: true
require 'test_helper'
require 'rubycritic/analysers_runner'
require 'rubycritic/generators/html_report'
require 'rubycritic/browser'
require 'fakefs_helper'
describe RubyCritic::Generator::HtmlReport do
describe '#generate_report' do
around do |example|
capture_output_streams... | ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/lib/rubycritic/source_control_systems/double_test.rb | test/lib/rubycritic/source_control_systems/double_test.rb | # frozen_string_literal: true
require 'test_helper'
require 'rubycritic/source_control_systems/base'
require_relative 'interfaces/basic'
class DoubleTest < Minitest::Test
include BasicInterface
def setup
@system = RubyCritic::SourceControlSystem::Double.new
end
end
| ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/lib/rubycritic/source_control_systems/mercurial_test.rb | test/lib/rubycritic/source_control_systems/mercurial_test.rb | # frozen_string_literal: true
require 'test_helper'
require 'rubycritic/source_control_systems/base'
require_relative 'interfaces/basic'
class MercurialTest < Minitest::Test
include BasicInterface
def setup
@system = RubyCritic::SourceControlSystem::Mercurial.new
end
end
| ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/lib/rubycritic/source_control_systems/git_test.rb | test/lib/rubycritic/source_control_systems/git_test.rb | # frozen_string_literal: true
require 'test_helper'
require 'rubycritic/source_control_systems/base'
describe RubyCritic::SourceControlSystem::Git do
describe '.switch_branch' do
it 'should not raise NoMethodError' do
RubyCritic::SourceControlSystem::Git.stubs(:uncommitted_changes).returns('')
RubyC... | ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/lib/rubycritic/source_control_systems/perforce_test.rb | test/lib/rubycritic/source_control_systems/perforce_test.rb | # frozen_string_literal: true
require 'test_helper'
require 'rubycritic/source_control_systems/base'
describe RubyCritic::SourceControlSystem::Perforce do
before do
@system = RubyCritic::SourceControlSystem::Perforce.new
end
describe RubyCritic::SourceControlSystem::Perforce do
describe '::supported?' ... | ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/lib/rubycritic/source_control_systems/base_test.rb | test/lib/rubycritic/source_control_systems/base_test.rb | # frozen_string_literal: true
require 'test_helper'
require 'rubycritic/source_control_systems/base'
describe RubyCritic::SourceControlSystem::Base do
before do
RubyCritic::SourceControlSystem::Base.systems.each do |system|
system.stubs(:supported?).returns(false)
end
end
describe '::create' do
... | ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
whitesmith/rubycritic | https://github.com/whitesmith/rubycritic/blob/e072f19a6721889575c471e15b15e63cff7a7276/test/lib/rubycritic/source_control_systems/interfaces/basic.rb | test/lib/rubycritic/source_control_systems/interfaces/basic.rb | # frozen_string_literal: true
module BasicInterface
def test_implements_basic_interface
assert_respond_to @system, :revisions_count
assert_respond_to @system, :date_of_last_commit
assert_respond_to @system, :revision?
end
end
| ruby | MIT | e072f19a6721889575c471e15b15e63cff7a7276 | 2026-01-04T15:50:21.177610Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.