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 |
|---|---|---|---|---|---|---|---|---|
zombocom/wicked | https://github.com/zombocom/wicked/blob/2e7114d7027d71b9a10c7d8eee78717cc3e617d6/test/dummy/config/initializers/backtrace_silencers.rb | test/dummy/config/initializers/backtrace_silencers.rb | # Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying to debug a probl... | ruby | MIT | 2e7114d7027d71b9a10c7d8eee78717cc3e617d6 | 2026-01-04T15:52:45.989568Z | false |
zombocom/wicked | https://github.com/zombocom/wicked/blob/2e7114d7027d71b9a10c7d8eee78717cc3e617d6/test/dummy/config/initializers/mime_types.rb | test/dummy/config/initializers/mime_types.rb | # Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
| ruby | MIT | 2e7114d7027d71b9a10c7d8eee78717cc3e617d6 | 2026-01-04T15:52:45.989568Z | false |
zombocom/wicked | https://github.com/zombocom/wicked/blob/2e7114d7027d71b9a10c7d8eee78717cc3e617d6/test/dummy/config/initializers/secret_token.rb | test/dummy/config/initializers/secret_token.rb | # Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attac... | ruby | MIT | 2e7114d7027d71b9a10c7d8eee78717cc3e617d6 | 2026-01-04T15:52:45.989568Z | false |
zombocom/wicked | https://github.com/zombocom/wicked/blob/2e7114d7027d71b9a10c7d8eee78717cc3e617d6/test/dummy/config/environments/test.rb | test/dummy/config/environments/test.rb | Dummy::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test su... | ruby | MIT | 2e7114d7027d71b9a10c7d8eee78717cc3e617d6 | 2026-01-04T15:52:45.989568Z | false |
zombocom/wicked | https://github.com/zombocom/wicked/blob/2e7114d7027d71b9a10c7d8eee78717cc3e617d6/test/dummy/config/environments/development.rb | test/dummy/config/environments/development.rb | Dummy::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the webserv... | ruby | MIT | 2e7114d7027d71b9a10c7d8eee78717cc3e617d6 | 2026-01-04T15:52:45.989568Z | false |
zombocom/wicked | https://github.com/zombocom/wicked/blob/2e7114d7027d71b9a10c7d8eee78717cc3e617d6/test/dummy/config/environments/production.rb | test/dummy/config/environments/production.rb | Dummy::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
... | ruby | MIT | 2e7114d7027d71b9a10c7d8eee78717cc3e617d6 | 2026-01-04T15:52:45.989568Z | false |
zombocom/wicked | https://github.com/zombocom/wicked/blob/2e7114d7027d71b9a10c7d8eee78717cc3e617d6/lib/wicked.rb | lib/wicked.rb | require 'erb'
require 'active_support/concern'
require 'active_support/core_ext/object/blank'
module Wicked
FINISH_STEP = "wicked_finish"
FIRST_STEP = "wicked_first"
LAST_STEP = "wicked_last"
module Controller
module Concerns
end
end
module Wizard
end
autoload :WizardController, "wicked/wiz... | ruby | MIT | 2e7114d7027d71b9a10c7d8eee78717cc3e617d6 | 2026-01-04T15:52:45.989568Z | false |
zombocom/wicked | https://github.com/zombocom/wicked/blob/2e7114d7027d71b9a10c7d8eee78717cc3e617d6/lib/wicked/version.rb | lib/wicked/version.rb | module Wicked
VERSION = "2.0.0"
end
| ruby | MIT | 2e7114d7027d71b9a10c7d8eee78717cc3e617d6 | 2026-01-04T15:52:45.989568Z | false |
zombocom/wicked | https://github.com/zombocom/wicked/blob/2e7114d7027d71b9a10c7d8eee78717cc3e617d6/lib/wicked/wizard.rb | lib/wicked/wizard.rb | module Wicked
module Wizard
extend ActiveSupport::Concern
class InvalidStepError < RuntimeError
attr_accessor :step
def initialize(step = nil)
self.step = step
super "The requested step did not match any steps defined for this controller: #{step.inspect}"
end
end
... | ruby | MIT | 2e7114d7027d71b9a10c7d8eee78717cc3e617d6 | 2026-01-04T15:52:45.989568Z | false |
zombocom/wicked | https://github.com/zombocom/wicked/blob/2e7114d7027d71b9a10c7d8eee78717cc3e617d6/lib/wicked/engine.rb | lib/wicked/engine.rb | module Wicked
class Engine < Rails::Engine
end
end
| ruby | MIT | 2e7114d7027d71b9a10c7d8eee78717cc3e617d6 | 2026-01-04T15:52:45.989568Z | false |
zombocom/wicked | https://github.com/zombocom/wicked/blob/2e7114d7027d71b9a10c7d8eee78717cc3e617d6/lib/wicked/wizard_controller.rb | lib/wicked/wizard_controller.rb | # Please don't re-use any patterns found in this controller,
# they work, but are not very good practices.
# If you have a better way to do this, please let me know
class Wicked::WizardController < ApplicationController
include Wicked::Wizard
# def index
# # redirect_to_first_step
# end
# steps :confirm_... | ruby | MIT | 2e7114d7027d71b9a10c7d8eee78717cc3e617d6 | 2026-01-04T15:52:45.989568Z | false |
zombocom/wicked | https://github.com/zombocom/wicked/blob/2e7114d7027d71b9a10c7d8eee78717cc3e617d6/lib/wicked/controller/concerns/path.rb | lib/wicked/controller/concerns/path.rb | module Wicked::Controller::Concerns::Path
extend ActiveSupport::Concern
def next_wizard_path(options = {})
wizard_path(@next_step, options)
end
def next_wizard_url(options = {})
wizard_url(@next_step, options)
end
def previous_wizard_path(options = {})
wizard_path(@previous_step, options)
e... | ruby | MIT | 2e7114d7027d71b9a10c7d8eee78717cc3e617d6 | 2026-01-04T15:52:45.989568Z | false |
zombocom/wicked | https://github.com/zombocom/wicked/blob/2e7114d7027d71b9a10c7d8eee78717cc3e617d6/lib/wicked/controller/concerns/steps.rb | lib/wicked/controller/concerns/steps.rb | module Wicked::Controller::Concerns::Steps
PROTECTED_STEPS = [Wicked::FINISH_STEP, Wicked::FIRST_STEP, Wicked::LAST_STEP]
extend ActiveSupport::Concern
def jump_to(goto_step, options = {})
@skip_to = goto_step
@wicked_redirect_params = options
end
def skip_step(options = {})
@ski... | ruby | MIT | 2e7114d7027d71b9a10c7d8eee78717cc3e617d6 | 2026-01-04T15:52:45.989568Z | false |
zombocom/wicked | https://github.com/zombocom/wicked/blob/2e7114d7027d71b9a10c7d8eee78717cc3e617d6/lib/wicked/controller/concerns/render_redirect.rb | lib/wicked/controller/concerns/render_redirect.rb | module Wicked::Controller::Concerns::RenderRedirect
extend ActiveSupport::Concern
def render_wizard(resource = nil, options = {}, params = {})
process_resource!(resource, options)
if @skip_to
url_params = (@wicked_redirect_params || {}).merge(params)
redirect_to wizard_path(@skip_to, url_param... | ruby | MIT | 2e7114d7027d71b9a10c7d8eee78717cc3e617d6 | 2026-01-04T15:52:45.989568Z | false |
zombocom/wicked | https://github.com/zombocom/wicked/blob/2e7114d7027d71b9a10c7d8eee78717cc3e617d6/lib/wicked/controller/concerns/action.rb | lib/wicked/controller/concerns/action.rb | module Wicked::Controller::Concerns::Action
extend ActiveSupport::Concern
module ClassMethods
def self.extended(base)
%w{before skip_before prepend_before}.each do |action|
define_method "#{action}_action" do |*names, &blk|
send("#{action}_filter", *names, &blk)
end unless base.... | ruby | MIT | 2e7114d7027d71b9a10c7d8eee78717cc3e617d6 | 2026-01-04T15:52:45.989568Z | false |
zombocom/wicked | https://github.com/zombocom/wicked/blob/2e7114d7027d71b9a10c7d8eee78717cc3e617d6/lib/wicked/wizard/translated.rb | lib/wicked/wizard/translated.rb | module Wicked
module Wizard
module Translated
extend ActiveSupport::Concern
include Wicked::Wizard
included do
skip_before_action :setup_wizard
before_action :setup_wizard_translated
helper_method :wizard_translate, :wizard_value
end
# creates a hash w... | ruby | MIT | 2e7114d7027d71b9a10c7d8eee78717cc3e617d6 | 2026-01-04T15:52:45.989568Z | false |
minimagick/minimagick | https://github.com/minimagick/minimagick/blob/ddcbfe9632667876be10373e1e01252617e74057/spec/spec_helper.rb | spec/spec_helper.rb | require "bundler/setup"
require "mini_magick"
require_relative "support/helpers"
RSpec.configure do |config|
config.disable_monkey_patching!
config.formatter = "documentation"
config.color = true
config.fail_fast = true unless ENV["CI"]
config.mock_with :rspec do |mocks|
# Prevents you from mocking or ... | ruby | MIT | ddcbfe9632667876be10373e1e01252617e74057 | 2026-01-04T15:52:40.853753Z | false |
minimagick/minimagick | https://github.com/minimagick/minimagick/blob/ddcbfe9632667876be10373e1e01252617e74057/spec/support/helpers.rb | spec/support/helpers.rb | # encoding: utf-8
require "tempfile"
module Helpers
def image_path(type = :default)
if type != :jpg_without_extension
File.join("spec/fixtures",
case type
when :default, :jpg then "default.jpg"
when :png then "engine.png"
when :animation, :gif then... | ruby | MIT | ddcbfe9632667876be10373e1e01252617e74057 | 2026-01-04T15:52:40.853753Z | false |
minimagick/minimagick | https://github.com/minimagick/minimagick/blob/ddcbfe9632667876be10373e1e01252617e74057/spec/fixtures/not_an_image.rb | spec/fixtures/not_an_image.rb | expect(__FILE__).not_to be_an_image
| ruby | MIT | ddcbfe9632667876be10373e1e01252617e74057 | 2026-01-04T15:52:40.853753Z | false |
minimagick/minimagick | https://github.com/minimagick/minimagick/blob/ddcbfe9632667876be10373e1e01252617e74057/spec/lib/mini_magick_spec.rb | spec/lib/mini_magick_spec.rb | require "spec_helper"
RSpec.describe MiniMagick do
describe ".cli_version" do
it "returns ImageMagick's version" do
expect(described_class.cli_version).to match(/^\d+\.\d+\.\d+-\d+$/)
end
end
end
| ruby | MIT | ddcbfe9632667876be10373e1e01252617e74057 | 2026-01-04T15:52:40.853753Z | false |
minimagick/minimagick | https://github.com/minimagick/minimagick/blob/ddcbfe9632667876be10373e1e01252617e74057/spec/lib/mini_magick/tool_spec.rb | spec/lib/mini_magick/tool_spec.rb | require "spec_helper"
RSpec.describe MiniMagick::Tool do
subject { MiniMagick.identify }
describe "#call" do
it "calls the shell to run the command" do
subject << image_path(:gif)
output = subject.call
expect(output).to match("GIF")
end
it "strips the output" do
subject << ima... | ruby | MIT | ddcbfe9632667876be10373e1e01252617e74057 | 2026-01-04T15:52:40.853753Z | false |
minimagick/minimagick | https://github.com/minimagick/minimagick/blob/ddcbfe9632667876be10373e1e01252617e74057/spec/lib/mini_magick/shell_spec.rb | spec/lib/mini_magick/shell_spec.rb | require "spec_helper"
RSpec.describe MiniMagick::Shell do
subject { described_class.new }
describe "#run" do
it "calls #execute with the command" do
expect(subject).to receive(:execute).and_call_original
subject.run(%W[identify #{image_path}])
end
it "returns stdout, stderr and status" do... | ruby | MIT | ddcbfe9632667876be10373e1e01252617e74057 | 2026-01-04T15:52:40.853753Z | false |
minimagick/minimagick | https://github.com/minimagick/minimagick/blob/ddcbfe9632667876be10373e1e01252617e74057/spec/lib/mini_magick/utilities_spec.rb | spec/lib/mini_magick/utilities_spec.rb | require "spec_helper"
RSpec.describe MiniMagick::Utilities do
describe ".which" do
it "identifies when executable exists" do
expect(MiniMagick::Utilities.which('mogrify')).not_to be_nil
end
it "returns nil on nonexistent executables" do
expect(MiniMagick::Utilities.which('yogrify')).to be_ni... | ruby | MIT | ddcbfe9632667876be10373e1e01252617e74057 | 2026-01-04T15:52:40.853753Z | false |
minimagick/minimagick | https://github.com/minimagick/minimagick/blob/ddcbfe9632667876be10373e1e01252617e74057/spec/lib/mini_magick/image_spec.rb | spec/lib/mini_magick/image_spec.rb | require "spec_helper"
require "pathname"
require "tempfile"
require "fileutils"
require "stringio"
RSpec.describe MiniMagick::Image do
subject { described_class.open(image_path) }
describe ".read" do
it "reads image from String" do
string = File.binread(image_path)
image = described_class.read(str... | ruby | MIT | ddcbfe9632667876be10373e1e01252617e74057 | 2026-01-04T15:52:40.853753Z | false |
minimagick/minimagick | https://github.com/minimagick/minimagick/blob/ddcbfe9632667876be10373e1e01252617e74057/lib/mini_magick.rb | lib/mini_magick.rb | require 'mini_magick/version'
require 'mini_magick/configuration'
require 'mini_magick/utilities'
require 'mini_magick/tool'
require 'mini_magick/image'
module MiniMagick
Error = Class.new(RuntimeError)
Invalid = Class.new(StandardError)
TimeoutError = Class.new(Error)
extend MiniMagick::Configuration
##
... | ruby | MIT | ddcbfe9632667876be10373e1e01252617e74057 | 2026-01-04T15:52:40.853753Z | false |
minimagick/minimagick | https://github.com/minimagick/minimagick/blob/ddcbfe9632667876be10373e1e01252617e74057/lib/mini_magick/version.rb | lib/mini_magick/version.rb | module MiniMagick
##
# @return [Gem::Version]
#
def self.version
Gem::Version.new VERSION::STRING
end
module VERSION
MAJOR = 5
MINOR = 3
TINY = 1
PRE = nil
STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
end
end
| ruby | MIT | ddcbfe9632667876be10373e1e01252617e74057 | 2026-01-04T15:52:40.853753Z | false |
minimagick/minimagick | https://github.com/minimagick/minimagick/blob/ddcbfe9632667876be10373e1e01252617e74057/lib/mini_magick/utilities.rb | lib/mini_magick/utilities.rb | require "tempfile"
module MiniMagick
# @private
module Utilities
module_function
##
# Cross-platform way of finding an executable in the $PATH.
#
# @example
# MiniMagick::Utilities.which('ruby') #=> "/usr/bin/ruby"
#
def which(cmd)
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].sp... | ruby | MIT | ddcbfe9632667876be10373e1e01252617e74057 | 2026-01-04T15:52:40.853753Z | false |
minimagick/minimagick | https://github.com/minimagick/minimagick/blob/ddcbfe9632667876be10373e1e01252617e74057/lib/mini_magick/configuration.rb | lib/mini_magick/configuration.rb | require 'mini_magick/utilities'
require 'logger'
module MiniMagick
module Configuration
##
# Uses [GraphicsMagick](http://www.graphicsmagick.org/) instead of
# ImageMagick, by prefixing commands with `gm` instead of `magick`.
#
# @return [Boolean]
attr_accessor :graphicsmagick
##
# ... | ruby | MIT | ddcbfe9632667876be10373e1e01252617e74057 | 2026-01-04T15:52:40.853753Z | false |
minimagick/minimagick | https://github.com/minimagick/minimagick/blob/ddcbfe9632667876be10373e1e01252617e74057/lib/mini_magick/shell.rb | lib/mini_magick/shell.rb | require "open3"
module MiniMagick
##
# Sends commands to the shell (more precisely, it sends commands directly to
# the operating system).
#
# @private
#
class Shell
def run(command, errors: MiniMagick.errors, warnings: MiniMagick.warnings, **options)
stdout, stderr, status = execute(command, ... | ruby | MIT | ddcbfe9632667876be10373e1e01252617e74057 | 2026-01-04T15:52:40.853753Z | false |
minimagick/minimagick | https://github.com/minimagick/minimagick/blob/ddcbfe9632667876be10373e1e01252617e74057/lib/mini_magick/tool.rb | lib/mini_magick/tool.rb | require "mini_magick/shell"
module MiniMagick
##
# Class that wraps command-line tools directly, as opposed MiniMagick::Image
# which is more high-level.
#
# @example
# MiniMagick.mogrify do |mogrify|
# mogrify.resize "500x500"
# mogrify << "path/to/image.jpg"
# end
#
class Tool
... | ruby | MIT | ddcbfe9632667876be10373e1e01252617e74057 | 2026-01-04T15:52:40.853753Z | false |
minimagick/minimagick | https://github.com/minimagick/minimagick/blob/ddcbfe9632667876be10373e1e01252617e74057/lib/mini_magick/image.rb | lib/mini_magick/image.rb | require 'tempfile'
require 'stringio'
require 'pathname'
require 'uri'
require 'open-uri'
require 'mini_magick/image/info'
require 'mini_magick/utilities'
module MiniMagick
class Image
##
# This is the primary loading method used by all of the other class
# methods.
#
# Use this to pass in a st... | ruby | MIT | ddcbfe9632667876be10373e1e01252617e74057 | 2026-01-04T15:52:40.853753Z | false |
minimagick/minimagick | https://github.com/minimagick/minimagick/blob/ddcbfe9632667876be10373e1e01252617e74057/lib/mini_magick/image/info.rb | lib/mini_magick/image/info.rb | require "json"
module MiniMagick
class Image
# @private
class Info
ASCII_ENCODED_EXIF_KEYS = %w[ExifVersion FlashPixVersion]
def initialize(path)
@path = path
@info = {}
end
def [](value, *args)
case value
when "format", "width", "height", "dimensions... | ruby | MIT | ddcbfe9632667876be10373e1e01252617e74057 | 2026-01-04T15:52:40.853753Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/test/helper.rb | test/helper.rb | require "bundler/setup"
require "minitest/autorun"
require_relative "support/test"
Spring::Test.root = File.expand_path('..', __FILE__)
| ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/test/acceptance_test.rb | test/acceptance_test.rb | require_relative "helper"
class AcceptanceTest < Spring::Test::AcceptanceTest
end
| ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/test/support/test.rb | test/support/test.rb | require "active_support"
require "active_support/test_case"
ActiveSupport.test_order = :random
module Spring
module Test
class << self
attr_accessor :root
end
require_relative "application"
require_relative "application_generator"
require_relative "rails_version"
require_relative "wat... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/test/support/rails_version.rb | test/support/rails_version.rb | module Spring
module Test
class RailsVersion
attr_reader :version
def initialize(string)
@version = Gem::Version.new(string)
end
def major
version.segments[0]
end
def minor
version.segments[1]
end
def to_s
version.to_s
end
... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/test/support/application_generator.rb | test/support/application_generator.rb | module Spring
module Test
class ApplicationGenerator
attr_reader :version_constraint, :version, :application
def initialize(version_constraint)
@version_constraint = version_constraint
@version = RailsVersion.new(version_constraint.split(' ').last)
@application ... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/test/support/application.rb | test/support/application.rb | require "spring/env"
module Spring
module Test
class Application
DEFAULT_TIMEOUT = ENV['CI'] ? 300 : 10
attr_reader :root, :spring_env
def initialize(root)
@root = Pathname.new(root)
@spring_env = Spring::Env.new(root: root)
@times = nil
end
def... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/test/support/watcher_test.rb | test/support/watcher_test.rb | require "tmpdir"
require "fileutils"
require "timeout"
require "active_support/core_ext/numeric/time"
module Spring
module Test
class WatcherTest < ActiveSupport::TestCase
runnables.delete self # prevent Minitest running this class
LATENCY = 0.001
TIMEOUT = 1
attr_accessor :dir
d... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/test/support/acceptance_test.rb | test/support/acceptance_test.rb | require "io/wait"
require "timeout"
require "spring/client"
require "active_support/core_ext/string/strip"
module Spring
module Test
class AcceptanceTest < ActiveSupport::TestCase
runnables.delete self # prevent Minitest running this class
DEFAULT_SPEEDUP = 0.8
def rails_version
if EN... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/test/unit/commands_test.rb | test/unit/commands_test.rb | require_relative "../helper"
require "spring/commands"
class CommandsTest < ActiveSupport::TestCase
test 'console command sets rails environment from command-line option' do
command = Spring::Commands::RailsConsole.new
assert_equal 'test', command.env(['test'])
end
test 'console command sets rails envir... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/test/unit/watcher_test.rb | test/unit/watcher_test.rb | require_relative "../helper"
require_relative "../support/watcher_test"
require "spring/watcher/polling"
class PollingWatcherTest < Spring::Test::WatcherTest
def watcher_class
Spring::Watcher::Polling
end
test "skips staleness checks if already stale" do
class << watcher
attr_reader :checked_when_... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/test/unit/json_test.rb | test/unit/json_test.rb | require_relative "../helper"
require 'spring/json'
class JsonTest < ActiveSupport::TestCase
test 'can decode unicode characters' do
assert_equal({"unicode_example"=>"©"}, Spring::JSON.load('{"unicode_example": "\u00A9"}'))
end
test 'can decode binary strings with valid UTF8 characters' do
string = "{\"P... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/test/unit/process_title_updater_test.rb | test/unit/process_title_updater_test.rb | require_relative "../helper"
require "spring/process_title_updater"
require "active_support/time"
class ProcessTitleUpdaterTest < ActiveSupport::TestCase
setup do
@start = Time.local(2012, 2, 12, 4, 3, 12)
@updater = Spring::ProcessTitleUpdater.new(@start) { }
end
test "seconds" do
assert_equal "1... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/test/unit/client/help_test.rb | test/unit/client/help_test.rb | require_relative "../../helper"
require 'spring/client/command'
require 'spring/client/help'
require 'spring/client'
class HelpTest < ActiveSupport::TestCase
def spring_commands
{
'command' => Class.new {
def self.description
'Random Spring Command'
end
},
'rails' => ... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/test/unit/client/version_test.rb | test/unit/client/version_test.rb | require_relative "../../helper"
require 'spring/client'
class VersionTest < ActiveSupport::TestCase
test "outputs current version number" do
version = Spring::Client::Version.new 'version'
out, _ = capture_io do
version.call
end
assert_equal "Spring version #{Spring::VERSION}", out.chomp
en... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/lib/spring/watcher.rb | lib/spring/watcher.rb | require "spring/watcher/abstract"
require "spring/configuration"
module Spring
class << self
attr_accessor :watch_interval
attr_writer :watcher
attr_reader :watch_method
end
def self.watch_method=(method)
if method.is_a?(Class)
@watch_method = method
else
require "spring/watcher/... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/lib/spring/version.rb | lib/spring/version.rb | module Spring
VERSION = "4.4.0"
end
| ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/lib/spring/application.rb | lib/spring/application.rb | require "spring/boot"
require "pty"
module Spring
class Application
attr_reader :manager, :watcher, :spring_env, :original_env
def initialize(manager, original_env, spring_env = Env.new)
@manager = manager
@original_env = original_env
@spring_env = spring_env
@mutex = M... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/lib/spring/failsafe_thread.rb | lib/spring/failsafe_thread.rb | require 'thread'
module Spring
class << self
def failsafe_thread
Thread.new {
begin
yield
rescue
end
}
end
end
end
| ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/lib/spring/errors.rb | lib/spring/errors.rb | module Spring
class ClientError < StandardError; end
class UnknownProject < StandardError
attr_reader :current_dir
def initialize(current_dir)
@current_dir = current_dir
end
def message
"Spring was unable to locate the root of your project. There was no Gemfile " \
"present in... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/lib/spring/application_manager.rb | lib/spring/application_manager.rb | module Spring
class ApplicationManager
attr_reader :pid, :child, :app_env, :spawn_env, :spring_env, :status
def initialize(app_env, spawn_env, spring_env)
@app_env = app_env
@spawn_env = spawn_env
@spring_env = spring_env
@mutex = Mutex.new
@state = :running
... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/lib/spring/json.rb | lib/spring/json.rb | # frozen_string_literal: true
# ### WHY SPRING VENDORS A JSON LIBRARY ###
#
# Spring is designed to be able to run outside of bundler. Ruby has a
# built-in "json" library, which we could use. However if we require
# that, and somebody has a different (perhaps newer) version of the
# json *gem* in their Gemfile, it wi... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/lib/spring/env.rb | lib/spring/env.rb | require "pathname"
require "spring/version"
require "spring/configuration"
module Spring
IGNORE_SIGNALS = %w(INT QUIT)
STOP_TIMEOUT = 2 # seconds
class Env
attr_reader :log_file
def initialize(options = {})
@root = options[:root]
@project_root = options[:root]
@log_file =... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/lib/spring/binstub.rb | lib/spring/binstub.rb | command = File.basename($0)
bin_path = File.expand_path("../../../bin/spring", __FILE__)
if command == "spring"
load bin_path
else
disable = ENV["DISABLE_SPRING"]
if Process.respond_to?(:fork) && (disable.nil? || disable.empty? || disable == "0")
ARGV.unshift(command)
load bin_path
end
end
| ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/lib/spring/configuration.rb | lib/spring/configuration.rb | require "spring/errors"
module Spring
@connect_timeout = 5
@boot_timeout = 20
class << self
attr_accessor :application_root, :connect_timeout, :boot_timeout
attr_writer :quiet
def gemfile
require "bundler"
if /\s1.9.[0-9]/ === Bundler.ruby_scope.gsub(/[\/\s]+/,'')
Pathname.new... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/lib/spring/commands.rb | lib/spring/commands.rb | require "spring/watcher"
require "spring/command_wrapper"
module Spring
@commands = {}
class << self
attr_reader :commands
end
def self.register_command(name, command = nil)
commands[name] = CommandWrapper.new(name, command)
end
def self.command?(name)
commands.include? name
end
def sel... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/lib/spring/client.rb | lib/spring/client.rb | require "spring/errors"
require "spring/json"
require "spring/client/command"
require "spring/client/run"
require "spring/client/help"
require "spring/client/binstub"
require "spring/client/stop"
require "spring/client/status"
require "spring/client/rails"
require "spring/client/version"
require "spring/client/server"... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/lib/spring/server.rb | lib/spring/server.rb | module Spring
ORIGINAL_ENV = ENV.to_hash
end
require "spring/boot"
require "spring/application_manager"
# Must be last, as it requires bundler/setup, which alters the load path
require "spring/commands"
module Spring
class Server
def self.boot(options = {})
new(options).boot
end
attr_reader :e... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/lib/spring/process_title_updater.rb | lib/spring/process_title_updater.rb | module Spring
# Yes, I know this reimplements a bunch of stuff in Active Support, but
# I don't want the Spring client to depend on AS, in order to keep its
# load time down.
class ProcessTitleUpdater
SECOND = 1
MINUTE = 60
HOUR = 60*60
def self.run(&block)
updater = new(&block)
... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/lib/spring/command_wrapper.rb | lib/spring/command_wrapper.rb | require "spring/configuration"
module Spring
class CommandWrapper
attr_reader :name, :command
def initialize(name, command = nil)
@name = name
@command = command
@setup = false
end
def description
if command.respond_to?(:description)
command.description
el... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/lib/spring/boot.rb | lib/spring/boot.rb | require "socket"
require "thread"
require "spring/configuration"
require "spring/env"
require "spring/process_title_updater"
require "spring/json"
require "spring/watcher"
require "spring/failsafe_thread"
| ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/lib/spring/watcher/polling.rb | lib/spring/watcher/polling.rb | require "spring/watcher/abstract"
module Spring
module Watcher
class Polling < Abstract
attr_reader :mtime
def initialize(root, latency)
super
@mtime = 0
@poller = nil
end
def check_stale
@mutex.synchronize do
computed = compute_mtime
... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/lib/spring/watcher/abstract.rb | lib/spring/watcher/abstract.rb | require "pathname"
module Spring
module Watcher
# A user of a watcher can use IO.select to wait for changes:
#
# watcher = MyWatcher.new(root, latency)
# IO.select([watcher]) # watcher is running in background
# watcher.stale? # => true
class Abstract
attr_reader :files, :director... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/lib/spring/commands/rails.rb | lib/spring/commands/rails.rb | module Spring
module Commands
class Rails
def call
ARGV.unshift command_name
load Dir.glob(::Rails.root.join("{bin,script}/rails")).first
end
def description
nil
end
end
class RailsConsole < Rails
def env(args)
return args.first if args.first... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/lib/spring/commands/rake.rb | lib/spring/commands/rake.rb | module Spring
module Commands
class Rake
class << self
attr_accessor :environment_matchers
end
self.environment_matchers = {
:default => "test",
/^test($|:)/ => "test"
}
def env(args)
# This is an adaption of the matching that Rake itself does.
... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/lib/spring/application/boot.rb | lib/spring/application/boot.rb | # This is necessary for the terminal to work correctly when we reopen stdin.
Process.setsid
require "spring/application"
app = Spring::Application.new(
UNIXSocket.for_fd(3),
Spring::JSON.load(ENV.delete("SPRING_ORIGINAL_ENV").dup),
Spring::Env.new(log_file: IO.for_fd(4))
)
Signal.trap("TERM") { app.terminate }... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/lib/spring/client/command.rb | lib/spring/client/command.rb | require "spring/env"
module Spring
module Client
class Command
def self.call(args)
new(args).call
end
attr_reader :args, :env
def initialize(args)
@args = args
@env = Env.new
end
end
end
end
| ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/lib/spring/client/version.rb | lib/spring/client/version.rb | require "spring/version"
module Spring
module Client
class Version < Command
def call
puts "Spring version #{Spring::VERSION}"
end
end
end
end
| ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/lib/spring/client/rails.rb | lib/spring/client/rails.rb | module Spring
module Client
class Rails < Command
COMMANDS = %w(console runner generate destroy test)
ALIASES = {
"c" => "console",
"r" => "runner",
"g" => "generate",
"d" => "destroy",
"t" => "test"
}
def self.description
"Run a rails comm... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/lib/spring/client/help.rb | lib/spring/client/help.rb | require "spring/version"
module Spring
module Client
class Help < Command
attr_reader :spring_commands, :application_commands
def self.description
"Print available commands."
end
def self.call(args)
require "spring/commands"
super
end
def initialize(... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/lib/spring/client/binstub.rb | lib/spring/client/binstub.rb | module Spring
module Client
class Binstub < Command
SHEBANG = /\#\!.*\n(\#.*\n)*/
# If loading the bin/spring file works, it'll run Spring which will
# eventually call Kernel.exit. This means that in the client process
# we will never execute the lines after this block. But if the Spring
... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/lib/spring/client/stop.rb | lib/spring/client/stop.rb | require "spring/version"
module Spring
module Client
class Stop < Command
def self.description
"Stop all Spring processes for this project."
end
def call
case env.stop
when :stopped
puts "Spring stopped."
when :killed
$stderr.puts "Spring did... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/lib/spring/client/server.rb | lib/spring/client/server.rb | module Spring
module Client
class Server < Command
def self.description
"Explicitly start a Spring server in the foreground"
end
def call
require "spring/server"
Spring::Server.boot(foreground: foreground?)
end
def foreground?
!args.include?("--backg... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/lib/spring/client/run.rb | lib/spring/client/run.rb | require "rbconfig"
require "socket"
require "bundler"
module Spring
module Client
class Run < Command
FORWARDED_SIGNALS = %w(INT QUIT USR1 USR2 INFO WINCH) & Signal.list.keys
attr_reader :server
def initialize(args)
super
@signal_queue = []
@server_booted = false
... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
rails/spring | https://github.com/rails/spring/blob/0b8dfae4ba95a635856b3dc32495ccce6b513241/lib/spring/client/status.rb | lib/spring/client/status.rb | module Spring
module Client
class Status < Command
def self.description
"Show current status."
end
def call
if env.server_running?
puts "Spring is running:"
puts
print_process env.pid
application_pids.each { |pid| print_process pid }
... | ruby | MIT | 0b8dfae4ba95a635856b3dc32495ccce6b513241 | 2026-01-04T15:52:51.371437Z | false |
roo-rb/roo | https://github.com/roo-rb/roo/blob/20d424f8bf96f20929a8bbf4184e059cfd029531/test/test_roo.rb | test/test_roo.rb | # encoding: utf-8
# Dump warnings that come from the test to open files
# with the wrong spreadsheet class
#STDERR.reopen "/dev/null","w"
require 'test_helper'
require 'stringio'
class TestRoo < Minitest::Test
include TestSheets
include TestAccesingFiles
include TestFormulas
include TestComments
include Te... | ruby | MIT | 20d424f8bf96f20929a8bbf4184e059cfd029531 | 2026-01-04T15:52:40.549208Z | false |
roo-rb/roo | https://github.com/roo-rb/roo/blob/20d424f8bf96f20929a8bbf4184e059cfd029531/test/test_helper.rb | test/test_helper.rb | # encoding: utf-8
require "simplecov"
require "tmpdir"
require "fileutils"
require "minitest/autorun"
require "shoulda"
require "timeout"
require "logger"
require "date"
# require gem files
require "roo"
require "minitest/reporters"
if ENV["USE_REPORTERS"]
Minitest::Reporters.use!(
[
Minitest::Reporters::D... | ruby | MIT | 20d424f8bf96f20929a8bbf4184e059cfd029531 | 2026-01-04T15:52:40.549208Z | false |
roo-rb/roo | https://github.com/roo-rb/roo/blob/20d424f8bf96f20929a8bbf4184e059cfd029531/test/all_ss.rb | test/all_ss.rb | require 'roo'
Dir.glob('test/files/*.ods').each do |fn|
begin
oo = Roo::OpenOffice.new fn
print "#{File.basename(fn)} "
puts oo.officeversion
rescue Zip::ZipError, Errno::ENOENT => e
# file is not a real .ods spreadsheet file
puts e.message
end
end
| ruby | MIT | 20d424f8bf96f20929a8bbf4184e059cfd029531 | 2026-01-04T15:52:40.549208Z | false |
roo-rb/roo | https://github.com/roo-rb/roo/blob/20d424f8bf96f20929a8bbf4184e059cfd029531/test/roo/test_base.rb | test/roo/test_base.rb | require "test_helper"
class TestRooBase < Minitest::Test
def test_info
# NOTE: unfortunately, the ods and xlsx versions of numbers1 are not
# identical, so this test fails for Open Office.
expected_templ = File.read("#{TESTDIR}/expected_results/numbers_info.yml")
with_each_spreadsheet(name: "nu... | ruby | MIT | 20d424f8bf96f20929a8bbf4184e059cfd029531 | 2026-01-04T15:52:40.549208Z | false |
roo-rb/roo | https://github.com/roo-rb/roo/blob/20d424f8bf96f20929a8bbf4184e059cfd029531/test/roo/test_csv.rb | test/roo/test_csv.rb | require "test_helper"
class TestRooCSV < Minitest::Test
def test_sheets
file = filename("numbers1")
workbook = roo_class.new(File.join(TESTDIR, file))
assert_equal ["default"], workbook.sheets
assert_raises(RangeError) { workbook.default_sheet = "no_sheet" }
assert_raises(TypeError) { workbook.d... | ruby | MIT | 20d424f8bf96f20929a8bbf4184e059cfd029531 | 2026-01-04T15:52:40.549208Z | false |
roo-rb/roo | https://github.com/roo-rb/roo/blob/20d424f8bf96f20929a8bbf4184e059cfd029531/test/roo/test_libre_office.rb | test/roo/test_libre_office.rb | require "test_helper"
class TestRooOpenOffice < Minitest::Test
def test_libre_office
oo = Roo::LibreOffice.new(File.join(TESTDIR, "numbers1.ods"))
oo.default_sheet = oo.sheets.first
assert_equal 41, oo.cell("a", 12)
end
end
| ruby | MIT | 20d424f8bf96f20929a8bbf4184e059cfd029531 | 2026-01-04T15:52:40.549208Z | false |
roo-rb/roo | https://github.com/roo-rb/roo/blob/20d424f8bf96f20929a8bbf4184e059cfd029531/test/roo/test_excelx.rb | test/roo/test_excelx.rb | require "test_helper"
class TestRworkbookExcelx < Minitest::Test
def test_download_uri_with_invalid_host
assert_raises(RuntimeError) do
Roo::Excelx.new("http://examples.com/file.xlsx")
end
end
def test_download_uri_with_query_string
file = filename("simple_spreadsheet")
port = 12_344
u... | ruby | MIT | 20d424f8bf96f20929a8bbf4184e059cfd029531 | 2026-01-04T15:52:40.549208Z | false |
roo-rb/roo | https://github.com/roo-rb/roo/blob/20d424f8bf96f20929a8bbf4184e059cfd029531/test/roo/test_open_office.rb | test/roo/test_open_office.rb | # encoding: utf-8
require "test_helper"
class TestRooOpenOffice < Minitest::Test
def test_openoffice_download_uri_and_zipped
port = 12_345
file = "rata.ods.zip"
start_local_server(file, port) do
url = "#{local_server(port)}/#{file}"
workbook = roo_class.new(url, packed: :zip)
assert_in... | ruby | MIT | 20d424f8bf96f20929a8bbf4184e059cfd029531 | 2026-01-04T15:52:40.549208Z | false |
roo-rb/roo | https://github.com/roo-rb/roo/blob/20d424f8bf96f20929a8bbf4184e059cfd029531/test/helpers/test_sheets.rb | test/helpers/test_sheets.rb | # NOTE: Putting these tests into modules in order to share them across different
# test classes, i.e. both TestRooExcelx and TestRooOpenOffice should run
# sheet related tests.
#
# This will allow me to reuse these test cases when I add new classes for
# Roo's future API.
# Sheet related tests
m... | ruby | MIT | 20d424f8bf96f20929a8bbf4184e059cfd029531 | 2026-01-04T15:52:40.549208Z | false |
roo-rb/roo | https://github.com/roo-rb/roo/blob/20d424f8bf96f20929a8bbf4184e059cfd029531/test/helpers/test_accessing_files.rb | test/helpers/test_accessing_files.rb | # Tests for "Accessing Files" which includes opening and closing files.
module TestAccesingFiles
def test_close
with_each_spreadsheet(name: "numbers1") do |oo|
next unless (tempdir = oo.instance_variable_get("@tmpdir"))
oo.close
refute File.exist?(tempdir), "Expected #{tempdir} to be cleaned up"... | ruby | MIT | 20d424f8bf96f20929a8bbf4184e059cfd029531 | 2026-01-04T15:52:40.549208Z | false |
roo-rb/roo | https://github.com/roo-rb/roo/blob/20d424f8bf96f20929a8bbf4184e059cfd029531/test/helpers/test_formulas.rb | test/helpers/test_formulas.rb | module TestFormulas
def test_empty_sheet_formulas
options = { name: "emptysheets", format: [:openoffice, :excelx] }
with_each_spreadsheet(options) do |oo|
oo.default_sheet = oo.sheets.first
assert_equal [], oo.formulas, "An empty sheet's formulas should be an empty array"
end
end
end
| ruby | MIT | 20d424f8bf96f20929a8bbf4184e059cfd029531 | 2026-01-04T15:52:40.549208Z | false |
roo-rb/roo | https://github.com/roo-rb/roo/blob/20d424f8bf96f20929a8bbf4184e059cfd029531/test/helpers/test_comments.rb | test/helpers/test_comments.rb | module TestComments
def test_comment
options = { name: "comments", format: [:openoffice, :libreoffice, :excelx] }
with_each_spreadsheet(options) do |oo|
assert_equal "Kommentar fuer B4", oo.comment("b", 4)
assert_equal "Kommentar fuer B5", oo.comment("b", 5)
end
end
def test_no_comment
... | ruby | MIT | 20d424f8bf96f20929a8bbf4184e059cfd029531 | 2026-01-04T15:52:40.549208Z | false |
roo-rb/roo | https://github.com/roo-rb/roo/blob/20d424f8bf96f20929a8bbf4184e059cfd029531/test/helpers/test_styles.rb | test/helpers/test_styles.rb | module TestStyles
def test_cell_styles
# styles only valid in excel spreadsheets?
# TODO: what todo with other spreadsheet types
with_each_spreadsheet(name: "style", format: [:excelx]) do |oo|
# bold
assert_equal true, oo.font(1, 1).bold?
assert_equal false, oo.font(1, 1).italic?
a... | ruby | MIT | 20d424f8bf96f20929a8bbf4184e059cfd029531 | 2026-01-04T15:52:40.549208Z | false |
roo-rb/roo | https://github.com/roo-rb/roo/blob/20d424f8bf96f20929a8bbf4184e059cfd029531/test/helpers/test_labels.rb | test/helpers/test_labels.rb | module TestLabels
def test_labels
options = { name: "named_cells", format: [:openoffice, :excelx, :libreoffice] }
expected_labels = [
["anton", [5, 3, "Sheet1"]],
["berta", [4, 2, "Sheet1"]],
["caesar", [7, 2, "Sheet1"]],
]
with_each_spreadsheet(options) do |oo|
assert_equal ex... | ruby | MIT | 20d424f8bf96f20929a8bbf4184e059cfd029531 | 2026-01-04T15:52:40.549208Z | false |
roo-rb/roo | https://github.com/roo-rb/roo/blob/20d424f8bf96f20929a8bbf4184e059cfd029531/test/excelx/test_coordinate.rb | test/excelx/test_coordinate.rb | # frozen_string_literal: true
require "test_helper"
class TestRooExcelxCoordinate < Minitest::Test
def row
10
end
def column
20
end
def coordinate
Roo::Excelx::Coordinate.new(row, column)
end
def array
[row, column]
end
def test_row
assert_same row, coordinate.row
end
d... | ruby | MIT | 20d424f8bf96f20929a8bbf4184e059cfd029531 | 2026-01-04T15:52:40.549208Z | false |
roo-rb/roo | https://github.com/roo-rb/roo/blob/20d424f8bf96f20929a8bbf4184e059cfd029531/test/excelx/cell/test_number.rb | test/excelx/cell/test_number.rb | require 'test_helper'
class TestRooExcelxCellNumber < Minitest::Test
def number
Roo::Excelx::Cell::Number
end
def test_float
cell = Roo::Excelx::Cell::Number.new '42.1', nil, ['General'], nil, nil, nil
assert_kind_of(Float, cell.value)
end
def test_integer
cell = Roo::Excelx::Cell::Number.n... | ruby | MIT | 20d424f8bf96f20929a8bbf4184e059cfd029531 | 2026-01-04T15:52:40.549208Z | false |
roo-rb/roo | https://github.com/roo-rb/roo/blob/20d424f8bf96f20929a8bbf4184e059cfd029531/test/excelx/cell/test_base.rb | test/excelx/cell/test_base.rb | require 'test_helper'
class TestRooExcelxCellBase < Minitest::Test
def base
Roo::Excelx::Cell::Base
end
def value
'Hello World'
end
def test_cell_type_is_base
cell = base.new(value, nil, [], nil, nil, nil)
assert_equal :base, cell.type
end
def test_cell_value
cell_value = value
... | ruby | MIT | 20d424f8bf96f20929a8bbf4184e059cfd029531 | 2026-01-04T15:52:40.549208Z | false |
roo-rb/roo | https://github.com/roo-rb/roo/blob/20d424f8bf96f20929a8bbf4184e059cfd029531/test/excelx/cell/test_time.rb | test/excelx/cell/test_time.rb | require 'test_helper'
class TestRooExcelxCellTime < Minitest::Test
def roo_time
Roo::Excelx::Cell::Time
end
def base_timestamp
DateTime.new(1899, 12, 30).to_time.to_i
end
def test_formatted_value
value = '0.0751' # 6488.64 seconds, or 1:48:08.64
[
['h:mm', '1:48'],
['h:mm:ss', '... | ruby | MIT | 20d424f8bf96f20929a8bbf4184e059cfd029531 | 2026-01-04T15:52:40.549208Z | false |
roo-rb/roo | https://github.com/roo-rb/roo/blob/20d424f8bf96f20929a8bbf4184e059cfd029531/test/excelx/cell/test_empty.rb | test/excelx/cell/test_empty.rb | require 'test_helper'
class TestRooExcelxCellEmpty < Minitest::Test
def empty
Roo::Excelx::Cell::Empty
end
def test_empty?
cell = empty.new(nil)
assert_same true, cell.empty?
end
def test_nil_presence
cell = empty.new(nil)
assert_nil cell.presence
end
end
| ruby | MIT | 20d424f8bf96f20929a8bbf4184e059cfd029531 | 2026-01-04T15:52:40.549208Z | false |
roo-rb/roo | https://github.com/roo-rb/roo/blob/20d424f8bf96f20929a8bbf4184e059cfd029531/test/excelx/cell/test_attr_reader_default.rb | test/excelx/cell/test_attr_reader_default.rb | require "test_helper"
class TestAttrReaderDefault < Minitest::Test
def base
Roo::Excelx::Cell::Base
end
def boolean
Roo::Excelx::Cell::Boolean
end
def class_date
Roo::Excelx::Cell::Date
end
def datetime
Roo::Excelx::Cell::DateTime
end
def empty
Roo::Excelx::Cell::Empty
end
... | ruby | MIT | 20d424f8bf96f20929a8bbf4184e059cfd029531 | 2026-01-04T15:52:40.549208Z | false |
roo-rb/roo | https://github.com/roo-rb/roo/blob/20d424f8bf96f20929a8bbf4184e059cfd029531/test/excelx/cell/test_boolean.rb | test/excelx/cell/test_boolean.rb | require 'test_helper'
class TestRooExcelxCellNumber < Minitest::Test
def boolean
Roo::Excelx::Cell::Boolean
end
def test_formatted_value
cell = boolean.new '1', nil, nil, nil, nil
assert_equal 'TRUE', cell.formatted_value
cell = boolean.new '0', nil, nil, nil, nil
assert_equal 'FALSE', cell... | ruby | MIT | 20d424f8bf96f20929a8bbf4184e059cfd029531 | 2026-01-04T15:52:40.549208Z | false |
roo-rb/roo | https://github.com/roo-rb/roo/blob/20d424f8bf96f20929a8bbf4184e059cfd029531/test/excelx/cell/test_datetime.rb | test/excelx/cell/test_datetime.rb | require 'test_helper'
class TestRooExcelxCellDateTime < Minitest::Test
def test_cell_value_is_datetime
cell = datetime.new('30000.323212', nil, ['mm-dd-yy'], nil, nil, base_timestamp, nil)
assert_kind_of ::DateTime, cell.value
end
def test_cell_type_is_datetime
cell = datetime.new('30000.323212', ni... | ruby | MIT | 20d424f8bf96f20929a8bbf4184e059cfd029531 | 2026-01-04T15:52:40.549208Z | false |
roo-rb/roo | https://github.com/roo-rb/roo/blob/20d424f8bf96f20929a8bbf4184e059cfd029531/test/excelx/cell/test_string.rb | test/excelx/cell/test_string.rb | require 'test_helper'
class TestRooExcelxCellString < Minitest::Test
def string
Roo::Excelx::Cell::String
end
def test_formatted_value
cell = string.new '1', nil, nil, nil, nil
assert_equal '1', cell.formatted_value
end
def test_to_s
cell = string.new '0', nil, nil, nil, nil
assert_equ... | ruby | MIT | 20d424f8bf96f20929a8bbf4184e059cfd029531 | 2026-01-04T15:52:40.549208Z | false |
roo-rb/roo | https://github.com/roo-rb/roo/blob/20d424f8bf96f20929a8bbf4184e059cfd029531/test/excelx/cell/test_date.rb | test/excelx/cell/test_date.rb | require 'test_helper'
class TestRooExcelxCellDate < Minitest::Test
def date_cell
Roo::Excelx::Cell::Date
end
def base_date
::Date.new(1899, 12, 30)
end
def base_date_1904
::Date.new(1904, 01, 01)
end
def test_handles_1904_base_date
cell = date_cell.new('41791', nil, [:numeric_or_formul... | ruby | MIT | 20d424f8bf96f20929a8bbf4184e059cfd029531 | 2026-01-04T15:52:40.549208Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.