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 |
|---|---|---|---|---|---|---|---|---|
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/lib/cucumber/events/test_step_started.rb | lib/cucumber/events/test_step_started.rb | # frozen_string_literal: true
require 'cucumber/core/events'
module Cucumber
module Events
# Signals that a {Cucumber::Core::Test::Step} is about to be executed
class TestStepStarted < Core::Events::TestStepStarted
# @return [Cucumber::Core::Test::Step] the test step to be executed
attr_reader :... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/lib/cucumber/filters/gated_receiver.rb | lib/cucumber/filters/gated_receiver.rb | # frozen_string_literal: true
module Cucumber
module Filters
class GatedReceiver
def initialize(receiver)
@receiver = receiver
@test_cases = []
end
def test_case(test_case)
@test_cases << test_case
self
end
def done
@test_cases.map do |test_... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/lib/cucumber/filters/apply_after_hooks.rb | lib/cucumber/filters/apply_after_hooks.rb | # frozen_string_literal: true
module Cucumber
module Filters
class ApplyAfterHooks < Core::Filter.new(:hooks)
def test_case(test_case)
hooks.apply_after_hooks(test_case).describe_to(receiver)
end
end
end
end
| ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/lib/cucumber/filters/tag_limits.rb | lib/cucumber/filters/tag_limits.rb | # frozen_string_literal: true
require 'cucumber/filters/gated_receiver'
require 'cucumber/filters/tag_limits/test_case_index'
require 'cucumber/filters/tag_limits/verifier'
module Cucumber
module Filters
class TagLimitExceededError < StandardError
def initialize(*limit_breaches)
super(limit_breach... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/lib/cucumber/filters/activate_steps.rb | lib/cucumber/filters/activate_steps.rb | # frozen_string_literal: true
require 'cucumber/core/filter'
require 'cucumber/step_match'
require 'cucumber/events'
require 'cucumber/errors'
module Cucumber
module Filters
class ActivateSteps < Core::Filter.new(:step_match_search, :configuration)
def test_case(test_case)
CaseFilter.new(test_case... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/lib/cucumber/filters/randomizer.rb | lib/cucumber/filters/randomizer.rb | # frozen_string_literal: true
require 'digest/sha2'
module Cucumber
module Filters
# Batches up all test cases, randomizes them, and then sends them on
class Randomizer
def initialize(seed, receiver = nil)
@receiver = receiver
@test_cases = []
@seed = seed
end
def ... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/lib/cucumber/filters/apply_after_step_hooks.rb | lib/cucumber/filters/apply_after_step_hooks.rb | # frozen_string_literal: true
require 'cucumber/core/filter'
module Cucumber
module Filters
class ApplyAfterStepHooks < Core::Filter.new(:hooks)
def test_case(test_case)
test_steps = hooks.find_after_step_hooks(test_case).apply(test_case.test_steps)
test_case.with_steps(test_steps).describ... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/lib/cucumber/filters/quit.rb | lib/cucumber/filters/quit.rb | # frozen_string_literal: true
module Cucumber
module Filters
class Quit
def initialize(receiver = nil)
@receiver = receiver
end
def test_case(test_case)
test_case.describe_to @receiver unless Cucumber.wants_to_quit
self
end
def done
@receiver.done
... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/lib/cucumber/filters/broadcast_test_case_ready_event.rb | lib/cucumber/filters/broadcast_test_case_ready_event.rb | # frozen_string_literal: true
module Cucumber
module Filters
class BroadcastTestCaseReadyEvent < Core::Filter.new(:config)
def test_case(test_case)
config.notify(:test_case_ready, test_case)
test_case.describe_to(receiver)
end
end
end
end
| ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/lib/cucumber/filters/apply_around_hooks.rb | lib/cucumber/filters/apply_around_hooks.rb | # frozen_string_literal: true
require 'cucumber/core/filter'
module Cucumber
module Filters
class ApplyAroundHooks < Core::Filter.new(:hooks)
def test_case(test_case)
around_hooks = hooks.find_around_hooks(test_case)
test_case.with_around_hooks(around_hooks).describe_to(receiver)
end... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/lib/cucumber/filters/retry.rb | lib/cucumber/filters/retry.rb | # frozen_string_literal: true
require 'cucumber/core/filter'
require 'cucumber/running_test_case'
require 'cucumber/events'
module Cucumber
module Filters
class Retry < Core::Filter.new(:configuration)
def initialize(*_args)
super
@total_permanently_failed = 0
end
def test_cas... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/lib/cucumber/filters/prepare_world.rb | lib/cucumber/filters/prepare_world.rb | # frozen_string_literal: true
require 'cucumber/core/filter'
require 'cucumber/core/test/location'
require 'cucumber/running_test_case'
module Cucumber
module Filters
class PrepareWorld < Core::Filter.new(:runtime)
def test_case(test_case)
CaseFilter.new(runtime, test_case).test_case.describe_to r... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/lib/cucumber/filters/broadcast_test_run_started_event.rb | lib/cucumber/filters/broadcast_test_run_started_event.rb | # frozen_string_literal: true
module Cucumber
module Filters
# Added at the end of the filter chain to broadcast a list of
# all of the test cases that have made it through the filters.
class BroadcastTestRunStartedEvent < Core::Filter.new(:config)
def initialize(config, receiver = nil)
sup... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/lib/cucumber/filters/apply_before_hooks.rb | lib/cucumber/filters/apply_before_hooks.rb | # frozen_string_literal: true
module Cucumber
module Filters
class ApplyBeforeHooks < Core::Filter.new(:hooks)
def test_case(test_case)
hooks.apply_before_hooks(test_case).describe_to(receiver)
end
end
end
end
| ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/lib/cucumber/filters/tag_limits/test_case_index.rb | lib/cucumber/filters/tag_limits/test_case_index.rb | # frozen_string_literal: true
module Cucumber
module Filters
class TagLimits
class TestCaseIndex
def initialize
@index = Hash.new { |hash, key| hash[key] = [] }
end
def add(test_case)
test_case.tags.map(&:name).each do |tag_name|
index[tag_name] << t... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/lib/cucumber/filters/tag_limits/verifier.rb | lib/cucumber/filters/tag_limits/verifier.rb | # frozen_string_literal: true
module Cucumber
module Filters
class TagLimits
class Verifier
def initialize(tag_limits)
@tag_limits = tag_limits
end
def verify!(test_case_index)
breaches = collect_breaches(test_case_index)
raise TagLimitExceededError.ne... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/lib/cucumber/rake/task.rb | lib/cucumber/rake/task.rb | # frozen_string_literal: true
require 'cucumber/platform'
require 'cucumber/gherkin/formatter/ansi_escapes'
require 'rake/dsl_definition'
module Cucumber
module Rake
# Defines a Rake task for running features.
#
# The simplest use of it goes something like:
#
# Cucumber::Rake::Task.new
#
... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/lib/cucumber/cli/main.rb | lib/cucumber/cli/main.rb | # frozen_string_literal: true
require 'optparse'
require 'cucumber'
require 'logger'
require 'cucumber/cli/configuration'
module Cucumber
module Cli
class Main
class << self
def execute(args)
new(args).execute!
end
end
def initialize(args, out = $stdout, err = $stder... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/lib/cucumber/cli/options.rb | lib/cucumber/cli/options.rb | # frozen_string_literal: true
require 'cucumber/cli/profile_loader'
require 'cucumber/formatter/ansicolor'
require 'cucumber/glue/registry_and_more'
require 'cucumber/project_initializer'
require 'cucumber/core/test/result'
module Cucumber
module Cli
class Options
CUCUMBER_PUBLISH_URL = ENV['CUCUMBER_PUBL... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/lib/cucumber/cli/configuration.rb | lib/cucumber/cli/configuration.rb | # frozen_string_literal: true
require 'logger'
require 'cucumber/cli/options'
require 'cucumber/cli/rerun_file'
require 'cucumber/constantize'
require 'cucumber'
module Cucumber
module Cli
YmlLoadError = Class.new(StandardError)
ProfilesNotDefinedError = Class.new(YmlLoadError)
ProfileNotFound = Class.n... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/lib/cucumber/cli/rerun_file.rb | lib/cucumber/cli/rerun_file.rb | # frozen_string_literal: true
module Cucumber
module Cli
class RerunFile
attr_reader :path
def self.can_read?(path)
path[0] == '@' && File.file?(real_path(path))
end
def self.real_path(path)
path[1..]
end
def initialize(path)
@path = self.class.real_... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/lib/cucumber/cli/profile_loader.rb | lib/cucumber/cli/profile_loader.rb | # frozen_string_literal: true
require 'yaml'
require 'erb'
module Cucumber
module Cli
class ProfileLoader
def initialize
@cucumber_yml = nil
end
def args_from(profile)
unless cucumber_yml.key?(profile)
raise(ProfileNotFound, <<~ERROR_MESSAGE)
Could not fi... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/lib/cucumber/glue/snippet.rb | lib/cucumber/glue/snippet.rb | # frozen_string_literal: true
module Cucumber
module Glue
module Snippet
ARGUMENT_PATTERNS = ['"([^"]*)"', '(\d+)'].freeze
class Generator
def self.register_on(configuration)
configuration.snippet_generators << new
end
def initialize(cucumber_expression_generator)
... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/lib/cucumber/glue/proto_world.rb | lib/cucumber/glue/proto_world.rb | # frozen_string_literal: true
require 'cucumber/gherkin/formatter/ansi_escapes'
require 'cucumber/core/test/data_table'
require 'mini_mime'
module Cucumber
module Glue
# Defines the basic API methods available in all Cucumber step definitions.
#
# You can, and probably should, extend this API with your ... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/lib/cucumber/glue/world_factory.rb | lib/cucumber/glue/world_factory.rb | # frozen_string_literal: true
module Cucumber
module Glue
class WorldFactory
def initialize(proc)
@proc = proc || -> { Object.new }
end
def create_world
@proc.call || raise_nil_world
end
def raise_nil_world
raise NilWorld
rescue NilWorld => e
... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/lib/cucumber/glue/invoke_in_world.rb | lib/cucumber/glue/invoke_in_world.rb | # frozen_string_literal: true
require 'cucumber/platform'
module Cucumber
module Glue
# Utility methods for executing step definitions with nice backtraces etc.
# TODO: add unit tests
# TODO: refactor for readability
class InvokeInWorld
def self.replace_instance_exec_invocation_line!(backtrace,... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/lib/cucumber/glue/registry_wrapper.rb | lib/cucumber/glue/registry_wrapper.rb | # frozen_string_literal: true
module Cucumber
module Glue
##
# This class wraps some internals methods to expose them to external plugins.
class RegistryWrapper
def initialize(registry)
@registry = registry
end
##
# Creates a new CucumberExpression from the given +string_... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/lib/cucumber/glue/dsl.rb | lib/cucumber/glue/dsl.rb | # frozen_string_literal: true
require 'cucumber/cucumber_expressions/parameter_type'
module Cucumber
module Glue
# This module provides the methods the DSL you can use to define
# steps, hooks, transforms etc.
module Dsl
class << self
attr_writer :rb_language
def alias_adverb(adve... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/lib/cucumber/glue/registry_and_more.rb | lib/cucumber/glue/registry_and_more.rb | # frozen_string_literal: true
require 'cucumber/cucumber_expressions/parameter_type_registry'
require 'cucumber/cucumber_expressions/cucumber_expression'
require 'cucumber/cucumber_expressions/regular_expression'
require 'cucumber/cucumber_expressions/cucumber_expression_generator'
require 'cucumber/glue/dsl'
require ... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/lib/cucumber/glue/step_definition.rb | lib/cucumber/glue/step_definition.rb | # frozen_string_literal: true
require 'cucumber/step_match'
require 'cucumber/glue/invoke_in_world'
module Cucumber
module Glue
# A Step Definition holds a Regexp pattern and a Proc, and is
# typically created by calling {Dsl#register_rb_step_definition Given, When or Then}
# in the step_definitions Rub... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/lib/cucumber/glue/hook.rb | lib/cucumber/glue/hook.rb | # frozen_string_literal: true
require 'cucumber/glue/invoke_in_world'
module Cucumber
module Glue
# TODO: Kill pointless wrapper for Before, After and AfterStep hooks with fire
class Hook
attr_reader :id, :tag_expressions, :location, :name
def initialize(id, registry, tag_expressions, proc, nam... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/compatibility/cck_spec.rb | compatibility/cck_spec.rb | # frozen_string_literal: true
require_relative 'support/shared_examples'
require_relative 'support/cck/examples'
require 'cck/examples'
# This is the implementation of the CCK testing for cucumber-ruby
# It will run each example from the CCK that is of type "gherkin" (As "markdown" examples aren't implemented in rub... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/compatibility/support/shared_examples.rb | compatibility/support/shared_examples.rb | # frozen_string_literal: true
require 'json'
require 'rspec'
require 'cucumber/messages'
require_relative 'cck/helpers'
require_relative 'cck/messages_comparator'
RSpec.shared_examples 'cucumber compatibility kit' do
include CCK::Helpers
let(:cck_path) { CCK::Examples.feature_code_for(example) }
let(:parsed_... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/compatibility/support/cck/keys_checker.rb | compatibility/support/cck/keys_checker.rb | # frozen_string_literal: true
module CCK
class KeysChecker
def self.compare(detected, expected)
new(detected, expected).compare
end
attr_reader :detected, :expected
def initialize(detected, expected)
@detected = detected
@expected = expected
end
def compare
return i... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/compatibility/support/cck/helpers.rb | compatibility/support/cck/helpers.rb | # frozen_string_literal: true
module CCK
module Helpers
def message_type(message)
message.to_h.each do |key, value|
return key unless value.nil?
end
end
def parse_ndjson_file(path)
parse_ndjson(File.read(path))
end
def parse_ndjson(ndjson)
Cucumber::Messages::Hel... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/compatibility/support/cck/messages_comparator.rb | compatibility/support/cck/messages_comparator.rb | # frozen_string_literal: true
require_relative 'keys_checker'
require_relative 'helpers'
module CCK
class MessagesComparator
include Helpers
def initialize(detected, expected)
compare(detected, expected)
end
def errors
all_errors.compact
end
private
def compare(detected, ... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/compatibility/support/cck/examples.rb | compatibility/support/cck/examples.rb | # frozen_string_literal: true
module CCK
module Examples
class << self
def supporting_code_for(example_name)
path = File.join(local_features_folder_location, example_name)
return path if File.directory?(path)
raise ArgumentError, "No supporting code directory found locally for CCK... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/compatibility/features/empty/empty_steps.rb | compatibility/features/empty/empty_steps.rb | # frozen_string_literal: true
# The empty CCK scenario does not contain any executable steps. It contains just one scenario
# which will be "ran" and only produce a single pickle for the name of the scenario (No pickles for steps)
| ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/compatibility/features/undefined/undefined_steps.rb | compatibility/features/undefined/undefined_steps.rb | # frozen_string_literal: true
Given('an implemented step') do
# no-op
end
Given('a step that will be skipped') do
# no-op
end
| ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/compatibility/features/hooks-conditional/hooks-conditional_steps.rb | compatibility/features/hooks-conditional/hooks-conditional_steps.rb | # frozen_string_literal: true
Before('@passing-hook') do
# no-op
end
Before('@fail-before') do
raise 'Exception in conditional hook'
end
When('a step passes') do
# no-op
end
After('@passing-hook') do
# no-op
end
After('@fail-after') do
raise 'Exception in conditional hook'
end
| ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/compatibility/features/skipped/skipped_steps.rb | compatibility/features/skipped/skipped_steps.rb | # frozen_string_literal: true
Before('@skip') do
skip_this_scenario('')
end
Given('a step that does not skip') do
# no-op
end
Given('a step that is skipped') do
# no-op
end
Given('I skip a step') do
skip_this_scenario('')
end
| ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/compatibility/features/hooks-named/hooks-named_steps.rb | compatibility/features/hooks-named/hooks-named_steps.rb | # frozen_string_literal: true
Before(name: 'A named before hook') do
# no-op
end
When('a step passes') do
# no-op
end
After(name: 'A named after hook') do
# no-op
end
| ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/compatibility/features/examples-tables/examples-tables_steps.rb | compatibility/features/examples-tables/examples-tables_steps.rb | # frozen_string_literal: true
Given('there are {int} cucumbers') do |initial_count|
@count = initial_count
end
Given('there are {int} friends') do |initial_friends|
@friends = initial_friends
end
When('I eat {int} cucumbers') do |eat_count|
@count -= eat_count
end
Then('I should have {int} cucumbers') do |exp... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/compatibility/features/examples-tables-attachment/examples-tables-attachment_steps.rb | compatibility/features/examples-tables-attachment/examples-tables-attachment_steps.rb | # frozen_string_literal: true
def cck_asset_path
"#{Gem.loaded_specs['cucumber-compatibility-kit'].full_gem_path}/features/examples-tables-attachment"
end
When('a JPEG image is attached') do
attach(File.open("#{cck_asset_path}/cucumber.jpeg"), 'image/jpeg')
end
When('a PNG image is attached') do
attach(File.op... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/compatibility/features/parameter-types/parameter-types_steps.rb | compatibility/features/parameter-types/parameter-types_steps.rb | # frozen_string_literal: true
class Flight
attr_reader :from, :to
def initialize(from, to)
@from = from
@to = to
end
end
ParameterType(
name: 'flight',
regexp: /([A-Z]{3})-([A-Z]{3})/,
transformer: ->(from, to) { Flight.new(from, to) }
)
Given('{flight} has been delayed') do |flight|
expect(fl... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/compatibility/features/hooks-attachment/hooks-attachment_steps.rb | compatibility/features/hooks-attachment/hooks-attachment_steps.rb | # frozen_string_literal: true
def cck_asset_path
"#{Gem.loaded_specs['cucumber-compatibility-kit'].full_gem_path}/features/hooks-attachment"
end
Before do
attach(File.open("#{cck_asset_path}/cucumber.svg"), 'image/svg+xml')
end
After do
attach(File.open("#{cck_asset_path}/cucumber.svg"), 'image/svg+xml')
end
... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/compatibility/features/data-tables/data-tables_steps.rb | compatibility/features/data-tables/data-tables_steps.rb | # frozen_string_literal: true
When('the following table is transposed:') do |table|
@transposed = table.transpose
end
Then('it should be:') do |expected|
@transposed.diff!(expected)
end
| ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/compatibility/features/unknown-parameter-type/unknown-parameter-type_steps.rb | compatibility/features/unknown-parameter-type/unknown-parameter-type_steps.rb | # frozen_string_literal: true
Given('{airport} is closed because of a strike') do |_airport|
raise 'Should not be called because airport parameter type has not been defined'
end
| ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/compatibility/features/hooks/hooks_steps.rb | compatibility/features/hooks/hooks_steps.rb | # frozen_string_literal: true
Before do
# no-op
end
When('a step passes') do
# no-op
end
When('a step fails') do
raise 'Exception in step'
end
After do
# no-op
end
| ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/compatibility/features/rules/rules_steps.rb | compatibility/features/rules/rules_steps.rb | # frozen_string_literal: true
Given('the customer has {int} cents') do |money|
@money = money
end
Given('there are chocolate bars in stock') do
@stock = ['Mars']
end
Given('there are no chocolate bars in stock') do
@stock = []
end
When('the customer tries to buy a {int} cent chocolate bar') do |price|
@choc... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/compatibility/features/retry/retry_steps.rb | compatibility/features/retry/retry_steps.rb | # frozen_string_literal: true
Given('a step that always passes') do
# no-op
end
second_time_pass = 0
Given('a step that passes the second time') do
second_time_pass += 1
raise 'Exception in step' if second_time_pass < 2
end
third_time_pass = 0
Given('a step that passes the third time') do
third_time_pass += ... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/compatibility/features/minimal/minimal_steps.rb | compatibility/features/minimal/minimal_steps.rb | # frozen_string_literal: true
Given('I have {int} cukes in my belly') do |_cuke_count|
# no-op
end
| ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/compatibility/features/stack-traces/stack-traces_steps.rb | compatibility/features/stack-traces/stack-traces_steps.rb | # frozen_string_literal: true
When('a step throws an exception') do
raise 'BOOM'
end
| ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/compatibility/features/cdata/cdata_steps.rb | compatibility/features/cdata/cdata_steps.rb | # frozen_string_literal: true
Given('I have {int} <![CDATA[cukes]]> in my belly') do |_cuke_count|
# no-op
end
| ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/compatibility/features/pending/pending_steps.rb | compatibility/features/pending/pending_steps.rb | # frozen_string_literal: true
Given('an implemented non-pending step') do
# no-op
end
Given('an implemented step that is skipped') do
# no-op
end
Given('an unimplemented pending step') do
pending('')
end
| ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/compatibility/features/attachments/attachments_steps.rb | compatibility/features/attachments/attachments_steps.rb | # frozen_string_literal: true
def cck_asset_path
"#{Gem.loaded_specs['cucumber-compatibility-kit'].full_gem_path}/features/attachments"
end
When('the string {string} is attached as {string}') do |text, media_type|
attach(text, media_type)
end
When('the string {string} is logged') do |text|
log(text)
end
When(... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/compatibility/spec/cck/keys_checker_spec.rb | compatibility/spec/cck/keys_checker_spec.rb | # frozen_string_literal: true
require 'rspec'
require 'cucumber/messages'
require_relative '../../support/cck/keys_checker'
describe CCK::KeysChecker do
describe '#compare' do
let(:expected_kvps) { Cucumber::Messages::Attachment.new(url: 'https://foo.com', file_name: 'file.extension', test_step_id: 123_456) }
... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/compatibility/spec/cck/messages_comparator_spec.rb | compatibility/spec/cck/messages_comparator_spec.rb | # frozen_string_literal: true
require 'rspec'
require 'cucumber/messages'
require_relative '../../support/cck/messages_comparator'
describe CCK::MessagesComparator do
describe '#errors' do
context 'when executed as part of a CI' do
before { allow(ENV).to receive(:[]).with('CI').and_return(true) }
l... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
cucumber/cucumber-ruby | https://github.com/cucumber/cucumber-ruby/blob/50c37055b0e5e74de50a026756ca915f0f7b7820/compatibility/spec/cck/examples_spec.rb | compatibility/spec/cck/examples_spec.rb | # frozen_string_literal: true
require_relative '../../support/cck/examples'
describe CCK::Examples do
let(:features_path) { File.expand_path("#{File.dirname(__FILE__)}/../../features") }
describe '#supporting_code_for' do
context 'with an example that exists' do
it 'returns the path of the folder conta... | ruby | MIT | 50c37055b0e5e74de50a026756ca915f0f7b7820 | 2026-01-04T15:43:43.142161Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/spec/spec_helper.rb | spec/spec_helper.rb | require 'active_record'
require 'fast_jsonapi'
require 'rspec-benchmark'
require 'byebug'
require 'active_model_serializers'
require 'oj'
require 'jsonapi/serializable'
require 'jsonapi-serializers'
Dir[File.dirname(__FILE__) + '/shared/contexts/*.rb'].each {|file| require file }
Dir[File.dirname(__FILE__) + '/shared/... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/spec/lib/object_serializer_spec.rb | spec/lib/object_serializer_spec.rb | require 'spec_helper'
describe FastJsonapi::ObjectSerializer do
include_context 'movie class'
include_context 'group class'
context 'when testing instance methods of object serializer' do
it 'returns correct hash when serializable_hash is called' do
options = {}
options[:meta] = { total: 2 }
... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/spec/lib/object_serializer_attribute_param_spec.rb | spec/lib/object_serializer_attribute_param_spec.rb | require 'spec_helper'
describe FastJsonapi::ObjectSerializer do
include_context 'movie class'
context "params option" do
let(:hash) { serializer.serializable_hash }
before(:context) do
class Movie
def viewed?(user)
user.viewed.include?(id)
end
end
class MovieS... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/spec/lib/object_serializer_fields_spec.rb | spec/lib/object_serializer_fields_spec.rb | require 'spec_helper'
describe FastJsonapi::ObjectSerializer do
include_context 'movie class'
let(:fields) do
{
movie: %i[name actors advertising_campaign],
actor: %i[name agency]
}
end
it 'only returns specified fields' do
hash = MovieSerializer.new(movie, fields: fields).serializabl... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/spec/lib/object_serializer_caching_spec.rb | spec/lib/object_serializer_caching_spec.rb | require 'spec_helper'
describe FastJsonapi::ObjectSerializer do
include_context 'movie class'
context 'when caching has_many' do
before(:each) do
rails = OpenStruct.new
rails.cache = ActiveSupport::Cache::MemoryStore.new
stub_const('Rails', rails)
end
it 'returns correct hash when s... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/spec/lib/object_serializer_performance_spec.rb | spec/lib/object_serializer_performance_spec.rb | require 'spec_helper'
describe FastJsonapi::ObjectSerializer, performance: true do
include_context 'movie class'
include_context 'ams movie class'
include_context 'jsonapi movie class'
include_context 'jsonapi-serializers movie class'
include_context 'group class'
include_context 'ams group class'
inclu... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/spec/lib/serialization_core_spec.rb | spec/lib/serialization_core_spec.rb | require 'spec_helper'
describe FastJsonapi::ObjectSerializer do
include_context "movie class"
include_context 'group class'
context 'when testing class methods of serialization core' do
it 'returns correct hash when id_hash is called' do
inputs = [{id: 23, record_type: :movie}, {id: 'x', record_type: ... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/spec/lib/object_serializer_relationship_param_spec.rb | spec/lib/object_serializer_relationship_param_spec.rb | require 'spec_helper'
describe FastJsonapi::ObjectSerializer do
include_context 'movie class'
context "params option" do
let(:hash) { serializer.serializable_hash }
before(:context) do
class MovieSerializer
has_many :agencies do |movie, params|
movie.actors.map(&:agency) if params... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/spec/lib/object_serializer_inheritance_spec.rb | spec/lib/object_serializer_inheritance_spec.rb | require 'spec_helper'
describe FastJsonapi::ObjectSerializer do
after(:all) do
classes_to_remove = %i[
User
UserSerializer
Country
CountrySerializer
Employee
EmployeeSerializer
Photo
PhotoSerializer
EmployeeAccount
]
classes_to_remove.each do |klass_... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/spec/lib/object_serializer_class_methods_spec.rb | spec/lib/object_serializer_class_methods_spec.rb | require 'spec_helper'
describe FastJsonapi::ObjectSerializer do
include_context 'movie class'
describe '#has_many' do
subject(:relationship) { serializer.relationships_to_serialize[:roles] }
before do
serializer.has_many *children
end
after do
serializer.relationships_to_serialize =... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/spec/lib/object_serializer_polymorphic_spec.rb | spec/lib/object_serializer_polymorphic_spec.rb | require 'spec_helper'
describe FastJsonapi::ObjectSerializer do
class List
attr_accessor :id, :name, :items
end
class ChecklistItem
attr_accessor :id, :name
end
class Car
attr_accessor :id, :model, :year
end
class ListSerializer
include FastJsonapi::ObjectSerializer
set_type :list
... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/spec/lib/object_serializer_relationship_links_spec.rb | spec/lib/object_serializer_relationship_links_spec.rb | require 'spec_helper'
describe FastJsonapi::ObjectSerializer do
include_context 'movie class'
context "params option" do
let(:hash) { serializer.serializable_hash }
context "generating links for a serializer relationship" do
let(:params) { { } }
let(:options_with_params) { { params: params }... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/spec/lib/object_serializer_struct_spec.rb | spec/lib/object_serializer_struct_spec.rb | require 'spec_helper'
describe FastJsonapi::ObjectSerializer do
include_context 'movie class'
context 'when testing object serializer with ruby struct' do
it 'returns correct hash when serializable_hash is called' do
options = {}
options[:meta] = { total: 2 }
options[:links] = { self: 'self'... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/spec/lib/multi_to_json/result_spec.rb | spec/lib/multi_to_json/result_spec.rb | require 'spec_helper'
module FastJsonapi
module MultiToJson
describe Result do
it 'supports chaining of rescues' do
expect do
Result.new(LoadError) do
require '1'
end.rescue do
require '2'
end.rescue do
require '3'
end.resc... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/spec/lib/extensions/active_record_spec.rb | spec/lib/extensions/active_record_spec.rb | require 'spec_helper'
require 'active_record'
require 'sqlite3'
describe 'active record' do
# Setup DB
before(:all) do
@db_file = "test.db"
# Open a database
db = SQLite3::Database.new @db_file
# Create tables
db.execute_batch <<-SQL
create table suppliers (
name varchar(30),
... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/spec/lib/instrumentation/as_notifications_spec.rb | spec/lib/instrumentation/as_notifications_spec.rb | require 'spec_helper'
describe FastJsonapi::ObjectSerializer do
include_context 'movie class'
context 'instrument' do
before(:all) do
require 'fast_jsonapi/instrumentation'
end
after(:all) do
[ :serialized_json, :serializable_hash ].each do |m|
alias_command = "alias_method :#{m}... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/spec/lib/instrumentation/as_notifications_negative_spec.rb | spec/lib/instrumentation/as_notifications_negative_spec.rb | require 'spec_helper'
describe FastJsonapi::ObjectSerializer do
include_context 'movie class'
context 'instrument' do
before(:each) do
options = {}
options[:meta] = { total: 2 }
options[:include] = [:actors]
@serializer = MovieSerializer.new([movie, movie], options)
end
cont... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/spec/lib/instrumentation/skylight/normalizers_require_spec.rb | spec/lib/instrumentation/skylight/normalizers_require_spec.rb | require 'spec_helper'
describe FastJsonapi::ObjectSerializer do
context 'instrument' do
context 'skylight' do
# skip for normal runs because this could alter some
# other test by insterting the instrumentation
xit 'make sure requiring skylight normalizers works' do
require 'fast_jsonap... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/spec/shared/examples/object_serializer_class_methods_examples.rb | spec/shared/examples/object_serializer_class_methods_examples.rb | RSpec.shared_examples 'returning correct relationship hash' do |serializer, id_method_name, record_type|
it 'returns correct relationship hash' do
expect(relationship).to be_instance_of(FastJsonapi::Relationship)
# expect(relationship.keys).to all(be_instance_of(Symbol))
expect(relationship.serializer).to... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/spec/shared/contexts/jsonapi_context.rb | spec/shared/contexts/jsonapi_context.rb | RSpec.shared_context 'jsonapi movie class' do
before(:context) do
# models
class JSONAPIMovie
attr_accessor :id, :name, :release_year, :actors, :owner, :movie_type
end
class JSONAPIActor
attr_accessor :id, :name, :email
end
class JSONAPIUser
attr_accessor :id, :name
end... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/spec/shared/contexts/group_context.rb | spec/shared/contexts/group_context.rb | RSpec.shared_context 'group class' do
# Person, Group Classes and serializers
before(:context) do
# models
class Person
attr_accessor :id, :first_name, :last_name
end
class Group
attr_accessor :id, :name, :groupees # Let's assume groupees can be Person or Group objects
end
# s... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/spec/shared/contexts/js_context.rb | spec/shared/contexts/js_context.rb | RSpec.shared_context 'jsonapi-serializers movie class' do
before(:context) do
# models
class JSMovie
attr_accessor :id, :name, :release_year, :actors, :owner, :movie_type
end
class JSActor
attr_accessor :id, :name, :email
end
class JSUser
attr_accessor :id, :name
end
... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/spec/shared/contexts/jsonapi_group_context.rb | spec/shared/contexts/jsonapi_group_context.rb | RSpec.shared_context 'jsonapi group class' do
# Person, Group Classes and serializers
before(:context) do
# models
class JSONAPIPerson
attr_accessor :id, :first_name, :last_name
end
class JSONAPIGroup
attr_accessor :id, :name, :groupees # Let's assume groupees can be Person or Group ob... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/spec/shared/contexts/movie_context.rb | spec/shared/contexts/movie_context.rb | RSpec.shared_context 'movie class' do
# Movie, Actor Classes and serializers
before(:context) do
# models
class Movie
attr_accessor :id,
:name,
:release_year,
:director,
:actor_ids,
:owner_id,
... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/spec/shared/contexts/ams_group_context.rb | spec/shared/contexts/ams_group_context.rb | RSpec.shared_context 'ams group class' do
before(:context) do
# models
class AMSPerson < ActiveModelSerializers::Model
attr_accessor :id, :first_name, :last_name
end
class AMSGroup < ActiveModelSerializers::Model
attr_accessor :id, :name, :groupees
end
# serializers
class AMS... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/spec/shared/contexts/js_group_context.rb | spec/shared/contexts/js_group_context.rb | RSpec.shared_context 'jsonapi-serializers group class' do
# Person, Group Classes and serializers
before(:context) do
# models
class JSPerson
attr_accessor :id, :first_name, :last_name
end
class JSGroup
attr_accessor :id, :name, :groupees # Let's assume groupees can be Person or Group ... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/spec/shared/contexts/ams_context.rb | spec/shared/contexts/ams_context.rb | RSpec.shared_context 'ams movie class' do
before(:context) do
# models
class AMSModel < ActiveModelSerializers::Model
derive_attributes_from_names_and_fix_accessors
end
class AMSMovieType < AMSModel
attributes :id, :name, :movies
end
class AMSMovie < AMSModel
attributes :id,... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/lib/fast_jsonapi.rb | lib/fast_jsonapi.rb | # frozen_string_literal: true
module FastJsonapi
require 'fast_jsonapi/object_serializer'
if defined?(::Rails)
require 'fast_jsonapi/railtie'
elsif defined?(::ActiveRecord)
require 'extensions/has_one'
end
end
| ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/lib/fast_jsonapi/version.rb | lib/fast_jsonapi/version.rb | module FastJsonapi
VERSION = "1.5"
end
| ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/lib/fast_jsonapi/relationship.rb | lib/fast_jsonapi/relationship.rb | module FastJsonapi
class Relationship
attr_reader :key, :name, :id_method_name, :record_type, :object_method_name, :object_block, :serializer, :relationship_type, :cached, :polymorphic, :conditional_proc, :transform_method, :links, :lazy_load_data
def initialize(
key:,
name:,
id_method_name... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/lib/fast_jsonapi/attribute.rb | lib/fast_jsonapi/attribute.rb | module FastJsonapi
class Attribute
attr_reader :key, :method, :conditional_proc
def initialize(key:, method:, options: {})
@key = key
@method = method
@conditional_proc = options[:if]
end
def serialize(record, serialization_params, output_hash)
if include_attribute?(record, s... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/lib/fast_jsonapi/serialization_core.rb | lib/fast_jsonapi/serialization_core.rb | # frozen_string_literal: true
require 'active_support/concern'
require 'fast_jsonapi/multi_to_json'
module FastJsonapi
MandatoryField = Class.new(StandardError)
module SerializationCore
extend ActiveSupport::Concern
included do
class << self
attr_accessor :attributes_to_serialize,
... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/lib/fast_jsonapi/multi_to_json.rb | lib/fast_jsonapi/multi_to_json.rb | # frozen_string_literal: true
require 'logger'
# Usage:
# class Movie
# def to_json(payload)
# FastJsonapi::MultiToJson.to_json(payload)
# end
# end
module FastJsonapi
module MultiToJson
# Result object pattern is from https://johnnunemaker.com/resilience-in-ruby/
# e.g. https://github.com... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/lib/fast_jsonapi/link.rb | lib/fast_jsonapi/link.rb | module FastJsonapi
class Link
attr_reader :key, :method
def initialize(key:, method:)
@key = key
@method = method
end
def serialize(record, serialization_params, output_hash)
output_hash[key] = if method.is_a?(Proc)
method.arity == 1 ? method.call(record) : method.call(reco... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/lib/fast_jsonapi/railtie.rb | lib/fast_jsonapi/railtie.rb | # frozen_string_literal: true
require 'rails/railtie'
class Railtie < Rails::Railtie
initializer 'fast_jsonapi.active_record' do
ActiveSupport.on_load :active_record do
require 'extensions/has_one'
end
end
end
| ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/lib/fast_jsonapi/object_serializer.rb | lib/fast_jsonapi/object_serializer.rb | # frozen_string_literal: true
require 'active_support/time'
require 'active_support/json'
require 'active_support/concern'
require 'active_support/inflector'
require 'active_support/core_ext/numeric/time'
require 'fast_jsonapi/attribute'
require 'fast_jsonapi/relationship'
require 'fast_jsonapi/link'
require 'fast_jso... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/lib/fast_jsonapi/instrumentation.rb | lib/fast_jsonapi/instrumentation.rb | require 'fast_jsonapi/instrumentation/serializable_hash'
require 'fast_jsonapi/instrumentation/serialized_json'
| ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/lib/fast_jsonapi/instrumentation/skylight.rb | lib/fast_jsonapi/instrumentation/skylight.rb | require 'fast_jsonapi/instrumentation/skylight/normalizers/serializable_hash'
require 'fast_jsonapi/instrumentation/skylight/normalizers/serialized_json'
| ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/lib/fast_jsonapi/instrumentation/serialized_json.rb | lib/fast_jsonapi/instrumentation/serialized_json.rb | require 'active_support/notifications'
module FastJsonapi
module ObjectSerializer
alias_method :serialized_json_without_instrumentation, :serialized_json
def serialized_json
ActiveSupport::Notifications.instrument(SERIALIZED_JSON_NOTIFICATION, { name: self.class.name }) do
serialized_json_wit... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/lib/fast_jsonapi/instrumentation/serializable_hash.rb | lib/fast_jsonapi/instrumentation/serializable_hash.rb | require 'active_support/notifications'
module FastJsonapi
module ObjectSerializer
alias_method :serializable_hash_without_instrumentation, :serializable_hash
def serializable_hash
ActiveSupport::Notifications.instrument(SERIALIZABLE_HASH_NOTIFICATION, { name: self.class.name }) do
serializabl... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Netflix/fast_jsonapi | https://github.com/Netflix/fast_jsonapi/blob/68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7/lib/fast_jsonapi/instrumentation/skylight/normalizers/serialized_json.rb | lib/fast_jsonapi/instrumentation/skylight/normalizers/serialized_json.rb | require 'fast_jsonapi/instrumentation/skylight/normalizers/base'
require 'fast_jsonapi/instrumentation/serializable_hash'
module FastJsonapi
module Instrumentation
module Skylight
module Normalizers
class SerializedJson < SKYLIGHT_NORMALIZER_BASE_CLASS
register FastJsonapi::ObjectSeriali... | ruby | Apache-2.0 | 68a5515bb33c6ba4f1df4d4f7b51d33eb2bcf3a7 | 2026-01-04T15:44:27.122992Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.