source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | mattbrictson/bundleup | https://github.com/mattbrictson/bundleup | Rakefile | Ruby | mit | 195 | main | 2,912 | require "bundler/gem_tasks"
require "rake/testtask"
require "rubocop/rake_task"
Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib"
t.test_files = FileList["test/**/*_test.rb"]
end
RuboCop::RakeTask.new
task default: %i[test rubocop]
# == "rake release" enhancements =============================... |
github | mattbrictson/bundleup | https://github.com/mattbrictson/bundleup | test/bundleup/logger_test.rb | Ruby | mit | 195 | main | 692 | require "test_helper"
class Bundleup::LoggerTest < Minitest::Test
include OutputHelpers
def test_confirm_with_default_response
stdout = capturing_plain_output(stdin: "\n") do
confirmed = Bundleup.logger.confirm?("Are you sure?")
assert(confirmed)
end
assert_equal("Are you sure [Yn]? ", st... |
github | mattbrictson/bundleup | https://github.com/mattbrictson/bundleup | test/bundleup/gemfile_test.rb | Ruby | mit | 195 | main | 7,337 | require "test_helper"
require "tempfile"
class Bundleup::GemfileTest < Minitest::Test
def test_gem_comments
gemfile = with_copy_of_sample_gemfile { |path| Bundleup::Gemfile.new(path) }
assert_equal(
{
"rails" => "# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'",
"pg" =>... |
github | mattbrictson/bundleup | https://github.com/mattbrictson/bundleup | test/bundleup/version_spec_test.rb | Ruby | mit | 195 | main | 2,391 | require "test_helper"
class Bundleup::VersionSpecTest < Minitest::Test
def test_relax_doesnt_affect_greater_than_equal_specs
assert_equal(">= 1.0.1", parse(">= 1.0.1").relax.to_s)
end
def test_relax_doesnt_affect_not_equal_specs
assert_equal("!= 5.2.0", parse("!= 5.2.0").relax.to_s)
end
def test_re... |
github | mattbrictson/bundleup | https://github.com/mattbrictson/bundleup | test/bundleup/update_report_test.rb | Ruby | mit | 195 | main | 3,564 | require "test_helper"
class Bundleup::UpdateReportTest < Minitest::Test
include OutputHelpers
def test_singular_title_when_one_gem
report = Bundleup::UpdateReport.new(
old_versions: { "rubocop" => "0.89.0" },
new_versions: { "rubocop" => "0.89.1" }
)
assert_equal("This gem will be updated:... |
github | mattbrictson/bundleup | https://github.com/mattbrictson/bundleup | test/bundleup/cli_test.rb | Ruby | mit | 195 | main | 4,501 | require "test_helper"
require "fileutils"
require "tempfile"
class Bundleup::CLITest < Minitest::Test
include OutputHelpers
def test_it_works_with_a_sample_project # rubocop:disable Minitest/MultipleAssertions
stdout = within_copy_of_sample_project do
capturing_plain_output(stdin: "n\n") do
with... |
github | mattbrictson/bundleup | https://github.com/mattbrictson/bundleup | test/bundleup/pin_report_test.rb | Ruby | mit | 195 | main | 1,891 | require "test_helper"
class Bundleup::PinReportTest < Minitest::Test
include OutputHelpers
def test_singular_title_when_one_gem
report = Bundleup::PinReport.new(
gem_versions: { "rubocop" => "0.89.0" },
outdated_gems: { "rubocop" => { newest: "0.89.1", pin: "= 0.89.0" } },
gem_comments: {}
... |
github | mattbrictson/bundleup | https://github.com/mattbrictson/bundleup | test/bundleup/commands_test.rb | Ruby | mit | 195 | main | 2,051 | require "test_helper"
class Bundleup::CommandsTest < Minitest::Test
def test_check?
Bundleup.shell.expects(:run?).with(%w[bundle check]).returns(true)
assert_predicate(Bundleup::Commands.new, :check?)
end
def test_install
Bundleup.shell.expects(:run).with(%w[bundle install]).returns(true)
assert... |
github | mattbrictson/bundleup | https://github.com/mattbrictson/bundleup | test/bundleup/backup_test.rb | Ruby | mit | 195 | main | 1,067 | require "test_helper"
require "tempfile"
class Bundleup::BackupTest < Minitest::Test
def test_restore_on_error
original_contents = ["Hello, world!\n", "Another file\n"]
files = original_contents.map do |content|
file = Tempfile.new
file << content
file.close
file
end
assert_r... |
github | mattbrictson/bundleup | https://github.com/mattbrictson/bundleup | test/support/output_helpers.rb | Ruby | mit | 195 | main | 729 | module OutputHelpers
private
def capturing_plain_output(stdin: nil)
without_color do
original_logger = Bundleup.logger
stdout = StringIO.new
stdin = stdin.nil? ? $stdin : StringIO.new(stdin)
Bundleup.logger = Bundleup::Logger.new(stdout:, stdin:)
yield
stdout.string
ensu... |
github | mattbrictson/bundleup | https://github.com/mattbrictson/bundleup | lib/bundleup.rb | Ruby | mit | 195 | main | 537 | require "bundleup/version"
require "bundleup/backup"
require "bundleup/colors"
require "bundleup/cli"
require "bundleup/commands"
require "bundleup/gemfile"
require "bundleup/logger"
require "bundleup/report"
require "bundleup/shell"
require "bundleup/pin_report"
require "bundleup/update_report"
require "bundleup/versi... |
github | mattbrictson/bundleup | https://github.com/mattbrictson/bundleup | lib/bundleup/version_spec.rb | Ruby | mit | 195 | main | 1,420 | module Bundleup
class VersionSpec
def self.parse(version)
return version if version.is_a?(VersionSpec)
version = version.strip
_, operator, number = version.match(/^([^\d\s]*)\s*(.+)/).to_a
operator = nil if operator.empty?
new(parts: number.split("."), operator:)
end
attr... |
github | mattbrictson/bundleup | https://github.com/mattbrictson/bundleup | lib/bundleup/commands.rb | Ruby | mit | 195 | main | 1,053 | require "forwardable"
module Bundleup
class Commands
GEMFILE_ENTRY_REGEXP = /\* (\S+) \((\S+)(?: (\S+))?\)/
OUTDATED_2_1_REGEXP = /\* (\S+) \(newest (\S+),.* requested (.*)\)/
OUTDATED_2_2_REGEXP = /^(\S+)\s\s+\S+\s\s+(\d\S+)\s\s+(\S.*?)(?:$|\s\s)/
extend Forwardable
def_delegators :Bundleup, :... |
github | mattbrictson/bundleup | https://github.com/mattbrictson/bundleup | lib/bundleup/cli.rb | Ruby | mit | 195 | main | 5,779 | require "forwardable"
module Bundleup
class CLI
class Error < StandardError
end
include Colors
extend Forwardable
def_delegators :Bundleup, :commands, :logger
attr_reader :updated_gems, :pinned_gems
def initialize(args)
@args = args.dup
@update_gemfile = @args.delete("--up... |
github | mattbrictson/bundleup | https://github.com/mattbrictson/bundleup | lib/bundleup/report.rb | Ruby | mit | 195 | main | 764 | require "forwardable"
module Bundleup
class Report
extend Forwardable
def_delegators :rows, :empty?, :one?
def many?
rows.length > 1
end
def to_s
[
title,
tableize(rows).map { |row| row.join(" ").rstrip }.join("\n"),
""
].join("\n\n")
end
priv... |
github | mattbrictson/bundleup | https://github.com/mattbrictson/bundleup | lib/bundleup/pin_report.rb | Ruby | mit | 195 | main | 1,033 | module Bundleup
class PinReport < Report
def initialize(gem_versions:, outdated_gems:, gem_comments:)
super()
@gem_versions = gem_versions
@outdated_gems = outdated_gems
@gem_comments = gem_comments
end
def title
return "Note that this gem is being held back:" if rows.one?
... |
github | mattbrictson/bundleup | https://github.com/mattbrictson/bundleup | lib/bundleup/colors.rb | Ruby | mit | 195 | main | 981 | module Bundleup
module Colors
ANSI_CODES = {
red: 31,
green: 32,
yellow: 33,
blue: 34,
gray: 90
}.freeze
private_constant :ANSI_CODES
class << self
attr_writer :enabled
def enabled?
return @enabled if defined?(@enabled)
@enabled = determine_... |
github | mattbrictson/bundleup | https://github.com/mattbrictson/bundleup | lib/bundleup/logger.rb | Ruby | mit | 195 | main | 1,474 | require "io/console"
module Bundleup
class Logger
extend Forwardable
def_delegators :@stdout, :print, :puts, :tty?
def_delegators :@stdin, :gets
def initialize(stdin: $stdin, stdout: $stdout, stderr: $stderr)
@stdin = stdin
@stdout = stdout
@stderr = stderr
@spinner = %w[⠋ ⠙... |
github | mattbrictson/bundleup | https://github.com/mattbrictson/bundleup | lib/bundleup/backup.rb | Ruby | mit | 195 | main | 527 | module Bundleup
class Backup
def self.restore_on_error(*paths)
backup = new(*paths)
begin
yield(backup)
rescue StandardError, Interrupt
backup.restore
raise
end
end
def initialize(*paths)
@original_contents = paths.to_h do |path|
[path, File.r... |
github | mattbrictson/bundleup | https://github.com/mattbrictson/bundleup | lib/bundleup/update_report.rb | Ruby | mit | 195 | main | 1,564 | module Bundleup
class UpdateReport < Report
def initialize(old_versions:, new_versions:)
super()
@old_versions = old_versions
@new_versions = new_versions
end
def title
return "This gem will be updated:" if rows.one?
"The following gems will be updated:"
end
def ro... |
github | mattbrictson/bundleup | https://github.com/mattbrictson/bundleup | lib/bundleup/shell.rb | Ruby | mit | 195 | main | 721 | require "forwardable"
require "open3"
module Bundleup
class Shell
extend Forwardable
def_delegators :Bundleup, :logger
def capture(command, raise_on_error: true)
stdout, stderr, status = capture3(command)
raise ["Failed to execute: #{command}", stdout, stderr].compact.join("\n") if raise_on... |
github | mattbrictson/bundleup | https://github.com/mattbrictson/bundleup | lib/bundleup/gemfile.rb | Ruby | mit | 195 | main | 2,015 | module Bundleup
class Gemfile
attr_reader :path
def initialize(path="Gemfile")
@path = path
@contents = File.read(path)
end
def gem_comments
gem_names.each_with_object({}) do |gem_name, hash|
comment = inline_comment(gem_name) || prefix_comment(gem_name)
hash[gem_na... |
github | loopj/capistrano-node-deploy | https://github.com/loopj/capistrano-node-deploy | Gemfile | Ruby | mit | 195 | master | 223 | source "http://rubygems.org"
gem "railsless-deploy", ">= 1.1.0"
gem "multi_json", "~> 1.3.6"
group :development do
gem "shoulda", ">= 0"
gem "rdoc", "~> 3.12"
gem "bundler", "~> 1.1"
gem "jeweler", "~> 1.8.3"
end |
github | loopj/capistrano-node-deploy | https://github.com/loopj/capistrano-node-deploy | capistrano-node-deploy.gemspec | Ruby | mit | 195 | master | 2,178 | # Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = "capistrano-node-deploy"
s.version = "1.2.14"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :r... |
github | loopj/capistrano-node-deploy | https://github.com/loopj/capistrano-node-deploy | Rakefile | Ruby | mit | 195 | master | 1,251 | # encoding: utf-8
require 'rubygems'
require 'bundler'
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end
require 'rake'
require 'jeweler'
Jeweler::Tasks.new do |gem|
# gem is... |
github | loopj/capistrano-node-deploy | https://github.com/loopj/capistrano-node-deploy | lib/capistrano/node-deploy.rb | Ruby | mit | 195 | master | 3,873 | require "digest/md5"
require "railsless-deploy"
require "multi_json"
def remote_file_exists?(full_path)
results = []
invoke_command("if [ -e '#{full_path}' ]; then echo -n 'true'; fi") do |ch, stream, out|
results << (out == 'true')
end
results == [true]
end
def remote_file_content_same_as?(full_path, con... |
github | loopj/capistrano-node-deploy | https://github.com/loopj/capistrano-node-deploy | test/helper.rb | Ruby | mit | 195 | master | 443 | require 'rubygems'
require 'bundler'
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end
require 'test/unit'
require 'shoulda'
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__),... |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | Gemfile | Ruby | mit | 195 | master | 397 | source 'https://rubygems.org'
gemspec
gem 'ransack-mongoid', git: 'https://github.com/activerecord-hackery/ransack-mongoid'
gem 'rails', '>= 5.2', '< 6.1'
gem 'devise'
gem 'pry-rails'
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'jslint'
group :test do
gem 'capybara'
gem 'poltergeist'
gem 'launchy'
gem '... |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | activeadmin-mongoid.gemspec | Ruby | mit | 195 | master | 1,218 | lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'active_admin/mongoid/version'
Gem::Specification.new do |gem|
gem.authors = ['Elia Schito', 'Nic Boie', 'JD Guzman', 'Grzegorz Jakubiak']
gem.email = ['elia@schito.me']
gem.description = %q{Act... |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | lib/activeadmin-mongoid.rb | Ruby | mit | 195 | master | 962 | require 'active_admin/mongoid'
require "rails/generators/actions"
require "rails/generators/named_base"
# Considering the Rails::Generators::NamedBase is one of the nearest ancestor to
# ActiveAdmin::Generators::InstallGenerator, we can open the class and an empty create_migration
# to the class(which will overridden ... |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | lib/active_admin/mongoid.rb | Ruby | mit | 195 | master | 997 | require 'active_admin/mongoid/version'
require 'active_model'
require 'mongoid'
require 'ransack'
require 'kaminari/mongoid'
require 'active_admin'
require 'devise'
require 'rails'
require 'active_admin/mongoid/filter_form_builder'
require 'active_admin/mongoid/resource'
require 'active_admin/mongoid/document'
require... |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | lib/active_admin/mongoid/resource.rb | Ruby | mit | 195 | master | 732 | module ActiveAdmin
class Resource
# the commit: https://github.com/activeadmin/activeadmin/commit/1ef08af5044814c336917fa93aea607dce16dcb7
# adds in the _id field, which doesn't work with ransack for some reason or
# another. I'm not going to investigate any deeper, let's just remove the
# unders... |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | lib/active_admin/mongoid/document.rb | Ruby | mit | 195 | master | 1,372 | require 'delegate'
module ActiveAdmin::Mongoid::Document
extend ActiveSupport::Concern
# PROXY CLASSES
class ColumnWrapper < SimpleDelegator
def type
_super = super
case _super
when BSON::ObjectId, Object
:string
else
_super.name.underscore.to_sym
end
end
... |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | lib/active_admin/mongoid/order_clause.rb | Ruby | mit | 195 | master | 229 | module ActiveAdmin
class OrderClause
def to_sql
to_mongo_options
end
def to_mongo_options
{ @column => @order.downcase.to_sym }
end
def apply(chain)
chain.reorder(sql)
end
end
end |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | lib/active_admin/mongoid/filter_form_builder.rb | Ruby | mit | 195 | master | 1,106 | class ActiveAdmin::Filters::FormBuilder
def filter(method, options = {})
if method.present? && options[:as] ||= default_input_type(method)
template.concat input(method, options)
end
end
def default_input_type(method, options = {})
if column = column_for(method)
case column.type.name.down... |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | lib/active_admin/mongoid/csv_builder.rb | Ruby | mit | 195 | master | 925 | module ActiveAdmin
class CSVBuilder
def build(controller, csv)
@collection = controller.send :find_collection, except: :pagination
columns = exec_columns controller.view_context
options = ActiveAdmin.application.csv_options.merge self.options
bom = options.delete :byte_... |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | lib/active_admin/mongoid/criteria.rb | Ruby | mit | 195 | master | 274 | require 'delegate'
Mongoid::Criteria.class_eval do
def relation *args, &block
self
end
def base
klass
end
def table
CollectionTable.new(klass.collection)
end
class CollectionTable < SimpleDelegator
def from(*a)
self
end
end
end |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | lib/active_admin/mongoid/inputs/filters/check_boxes_input.rb | Ruby | mit | 195 | master | 304 | require 'active_admin/inputs/filters/check_boxes_input'
class ActiveAdmin::Inputs::Filters::CheckBoxesInput
def searchable_method_name
if searchable_has_many_through?
"#{reflection.through_reflection.name}_#{reflection.foreign_key}"
else
reflection.key || method
end
end
end |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | lib/active_admin/mongoid/association/relatable.rb | Ruby | mit | 195 | master | 274 | Mongoid::Association::Relatable.module_eval do
def macro
self.class.name.split('::').last.underscore.to_sym
end
def embeds?
[:embeds_one, :embeds_many].include?(macro)
end
def foreign_key
return if embeds?
foreign_key.to_sym rescue nil
end
end |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | lib/active_admin/mongoid/controllers/resource_controller.rb | Ruby | mit | 195 | master | 322 | require 'active_admin/engine'
ActiveAdmin::Engine.module_eval do
initializer 'active_admin.mongoid.resource_controller' do
class ActiveAdmin::ResourceController
def build_new_resource
scoped_collection.send(
method_for_build,
*resource_params
)
end
end
end
en... |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | lib/active_admin/mongoid/filters/resource_extension.rb | Ruby | mit | 195 | master | 524 | require 'active_admin/filters/resource_extension'
module ActiveAdmin::Filters::ResourceExtension
def default_association_filters
if resource_class.respond_to?(:reflect_on_all_associations)
without_embedded = resource_class.reflect_on_all_associations.reject { |e| e.embeds? }
poly, not_poly = without_... |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | lib/active_admin/mongoid/filters/active_filter.rb | Ruby | mit | 195 | master | 300 | require 'active_admin/filters/active_filter'
module ActiveAdmin
module Filters
class ActiveFilter
def related_primary_key
if predicate_association
predicate_association.key
elsif related_class
related_class.key
end
end
end
end
end |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | lib/active_admin/mongoid/helpers/collection.rb | Ruby | mit | 195 | master | 448 | module ActiveAdmin
module Helpers
module Collection
alias original_collection_size collection_size
original_collection_size = instance_method(:collection_size)
def collection_size(collection = nil)
collection ||= self.collection
if collection.is_a?(::Mongoid::Criteria)
... |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | lib/active_admin/mongoid/resource/attributes.rb | Ruby | mit | 195 | master | 435 | require 'active_admin/resource/attributes'
module ActiveAdmin
class Resource
module Attributes
def foreign_methods
@foreign_methods ||= resource_class.reflect_on_all_associations.
select { |r| r.macro == :belongs_to }.
index_by { |r| r.foreign_key.to_sym }
end
def ... |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | lib/meta_search/searches/mongoid.rb | Ruby | mit | 195 | master | 3,859 | require 'active_support/concern'
require 'meta_search/method'
require 'meta_search/builder'
module MetaSearch
module Searches
require 'delegate'
class MongoidSearchBuilder < SimpleDelegator
def initialize relation, params, options
super(relation)
@relation = relation
@params = ... |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | spec/spec_helper.rb | Ruby | mit | 195 | master | 1,765 | # This file is copied to spec/ when you run 'rails generate rspec:install'
ENV['RAILS_ENV'] ||= 'test'
require 'rubygems'
require 'bundler'
if %w(true 1).include?(ENV['COVERAGE'])
require 'simplecov'
SimpleCov.start do
add_filter '/test_app/'
add_filter '/spec/support'
end
end
require File.expand_path('... |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | spec/features/smoke_spec.rb | Ruby | mit | 195 | master | 10,652 | require 'spec_helper'
describe 'browse the test app' do
let(:password) { 'foobar•secret' }
let(:email) { 'john@doe.com' }
let(:admin_user) do
AdminUser.where(email: email).first || AdminUser.create!(email: email, password: password)
end
let(:other_email) { 'jane@doe.com' }
let(:other_user) do
Admin... |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | spec/support/mongoid.rb | Ruby | mit | 195 | master | 378 | require 'pathname'
require 'mongoid'
root = Pathname(File.expand_path('../../test_app', __dir__))
version = Mongoid::VERSION.to_i
current_config = root.join("config/mongoid.#{version}.yml").read
config_file = root.join('config/mongoid.yml')
config_file.open('w') { |c| c << current_config }
Mongoid.load!(config_... |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | spec/lib/active_admin/mongoid/filter_form_builder_spec.rb | Ruby | mit | 195 | master | 2,057 | require 'spec_helper'
describe ActiveAdmin::Filters::FormBuilder do
describe '#default_input_type' do
let(:instance) { described_class.new({}, {}, {}, {}) }
let(:column) { double(:column) }
subject { instance.default_input_type(nil) }
before do
allow(column).to receive_message_chain('type.name... |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | tasks/test.rake | Ruby | mit | 195 | master | 1,857 | desc "Creates a test rails app for the specs to run against"
task :setup do
require 'rails/version'
system("mkdir spec/rails") unless File.exists?("spec/rails")
system "bundle exec rails new spec/rails/rails-#{Rails::VERSION::STRING} -O -m spec/support/rails_template.rb"
end
# Run specs and cukes
desc "Run the f... |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | tasks/js.rake | Ruby | mit | 195 | master | 1,058 | namespace :js do
desc "Compile the JS for Rails apps without Asset Pipeline"
task :compile do
require 'sprockets'
require 'uglifier'
require 'fileutils'
root_dir = File.expand_path(File.join("..", ".."), __FILE__)
js_dir = File.join(root_dir, "app", "assets", "javascripts", "active_admin")
... |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | test_app/Rakefile | Ruby | mit | 195 | master | 268 | #!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('config/application', __dir__)
TestApp::Application.load_tasks |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | test_app/config/application.rb | Ruby | mit | 195 | master | 2,930 | require File.expand_path('boot', __dir__)
# Pick the frameworks you want:
# require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
# require "active_resource/railtie"
require "sprockets/railtie"
require "rails/test_unit/railtie"
Bundler.requir... |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | test_app/config/environments/production.rb | Ruby | mit | 195 | master | 2,308 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_co... |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | test_app/config/environments/test.rb | Ruby | mit | 195 | master | 1,446 | Rails.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 suite... |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | test_app/config/environments/development.rb | Ruby | mit | 195 | master | 1,068 | Rails.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 web serve... |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | test_app/config/initializers/secret_token.rb | Ruby | mit | 195 | master | 498 | # 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... |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | test_app/config/initializers/active_admin.rb | Ruby | mit | 195 | master | 6,012 | Rails.application.config.assets.precompile += ['active_admin.js']
ActiveAdmin.setup do |config|
config.load_paths = ["#{Rails.root}/app/admin"]
# == Site Title
#
# Set the title that is displayed on the main layout
# for each of the active admin pages.
#
config.site_title = "Test App"
# Set the link u... |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | test_app/config/initializers/session_store.rb | Ruby | mit | 195 | master | 411 | # Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: '_test_app_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rails gen... |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | test_app/config/initializers/devise.rb | Ruby | mit | 195 | master | 12,233 | # Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# ==> Mailer Configuration
# Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use yo... |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | test_app/app/models/post.rb | Ruby | mit | 195 | master | 277 | class Post
include Mongoid::Document
include Mongoid::Timestamps
field :title
field :body
field :view_count, type: ::Integer, default: 0
belongs_to :admin_user
belongs_to :other_user, class_name: 'AdminUser'
embeds_one :author
field :'author.city.name'
end |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | test_app/app/models/admin_user.rb | Ruby | mit | 195 | master | 884 | class AdminUser
include Mongoid::Document
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable,
# :lockable, :timeoutable and :omniauthable
devise :database_authenticatable,
:recoverable, :rememberable, :trackable, :validatable
## Database authenticatable
... |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | test_app/app/admin/posts.rb | Ruby | mit | 195 | master | 877 | ActiveAdmin.register Post do
config.per_page = 30
permit_params :title, :body
filter :title
filter :body
filter :created_at, as: :date_range
filter :view_count, as: :numeric
filter :admin_user, as: :select
filter :other_user, as: :check_boxes
index do
selectable_column
column :title
col... |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | test_app/app/admin/admin_users.rb | Ruby | mit | 195 | master | 360 | ActiveAdmin.register AdminUser do
index do
column :email
column :current_sign_in_at
column :last_sign_in_at
column :sign_in_count
actions
end
filter :email
filter :posts
form do |f|
f.inputs "Admin Details" do
f.input :email
f.input :password
f.input :password_confi... |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | test_app/db/migrate/20130514223108_move_admin_notes_to_comments.rb | Ruby | mit | 195 | master | 1,377 | class MoveAdminNotesToComments < ActiveRecord::Migration
def self.up
remove_index :admin_notes, [:admin_user_type, :admin_user_id]
rename_table :admin_notes, :active_admin_comments
rename_column :active_admin_comments, :admin_user_type, :author_type
rename_column :active_admin_comments, :admin_user_... |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | test_app/db/migrate/20130514223107_create_admin_notes.rb | Ruby | mit | 195 | master | 463 | class CreateAdminNotes < ActiveRecord::Migration
def self.up
create_table :admin_notes do |t|
t.string :resource_id, null: false
t.string :resource_type, null: false
t.references :admin_user, polymorphic: true
t.text :body
t.timestamps
end
add_index :admin_notes, [:resource_t... |
github | activeadmin/activeadmin-mongoid | https://github.com/activeadmin/activeadmin-mongoid | test_app/test/test_helper.rb | Ruby | mit | 195 | master | 206 | ENV["RAILS_ENV"] = "test"
require File.expand_path('../config/environment', __dir__)
require 'rails/test_help'
class ActiveSupport::TestCase
# Add more helper methods to be used by all tests here...
end |
github | socketry/sus | https://github.com/socketry/sus | gems.rb | Ruby | mit | 195 | main | 451 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2021-2025, by Samuel Williams.
source "https://rubygems.org"
gemspec
group :maintenance, optional: true do
gem "bake-modernize"
gem "bake-gem"
gem "bake-releases"
gem "agent-context"
gem "utopia-project"
end
group :test do
gem "... |
github | socketry/sus | https://github.com/socketry/sus | bake.rb | Ruby | mit | 195 | main | 364 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2024-2025, by Samuel Williams.
# Update the project documentation with the new version number.
#
# @parameter version [String] The new version number.
def after_gem_release_version_increment(version)
context["releases:update"].call(version)... |
github | socketry/sus | https://github.com/socketry/sus | sus.gemspec | Ruby | mit | 195 | main | 842 | # frozen_string_literal: true
require_relative "lib/sus/version"
Gem::Specification.new do |spec|
spec.name = "sus"
spec.version = Sus::VERSION
spec.summary = "A fast and scalable test runner."
spec.authors = ["Samuel Williams", "Brad Schrag"]
spec.license = "MIT"
spec.cert_chain = ["release.cert"]
spec.s... |
github | socketry/sus | https://github.com/socketry/sus | test/sus/assertions.rb | Ruby | mit | 195 | main | 3,496 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2021-2024, by Samuel Williams.
class Nested
def initialize(name)
@name = name
end
def print(output)
output.write("nested ", :variable, @name)
end
end
describe Sus::Assertions do
let(:inverted) {false}
let(:identity) {Sus::Identi... |
github | socketry/sus | https://github.com/socketry/sus | test/sus/registry.rb | Ruby | mit | 195 | main | 675 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2021-2023, by Samuel Williams.
# Copyright, 2022, by Brad Schrag.
describe Sus::Registry do
let(:registry) {subject.new}
it "can load a test file" do
registry.load(__FILE__)
expect(registry.base.children).to be(:any?)
end
let(... |
github | socketry/sus | https://github.com/socketry/sus | test/sus/have_duration.rb | Ruby | mit | 195 | main | 363 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2021-2022, by Samuel Williams.
describe Sus::HaveDuration do
it "can have a duration for a short sleep" do
expect{sleep 0.01}.to have_duration(be >= 0.01)
end
it "can have a duration within a given range" do
expect{sleep 0.01}.to ha... |
github | socketry/sus | https://github.com/socketry/sus | test/sus/mock.rb | Ruby | mit | 195 | main | 3,023 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2022-2025, by Samuel Williams.
class RealImplementation
def initialize(value = nil)
@value = value
end
attr :value
def call
"Real Implementation"
end
end
class FakeImplementation
def call
"Fake Implementation"
end
end
clas... |
github | socketry/sus | https://github.com/socketry/sus | test/sus/with.rb | Ruby | mit | 195 | main | 777 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2021-2024, by Samuel Williams.
describe Sus::With do
with "nested contexts" do
let(:context) do
Sus::With.build(self.class, "a test variable", {}){}
end
it "has a description" do
expect(context.description).to be == "a test v... |
github | socketry/sus | https://github.com/socketry/sus | test/sus/it_behaves_like.rb | Ruby | mit | 195 | main | 757 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2021-2022, by Samuel Williams.
ContextModule = Sus::Shared("context module") do
it "extends context" do
expect(subject.singleton_class.ancestors).to be(:include?, Sus::Context)
end
end
[Sus::Describe, Sus::File, Sus::With].each do |klas... |
github | socketry/sus | https://github.com/socketry/sus | test/sus/identity.rb | Ruby | mit | 195 | main | 1,527 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2021-2024, by Samuel Williams.
describe Sus::Identity do
with "basic identifier" do
def identifier
subject.new("file.rb", "file", 123)
end
it "can generate unique identifier" do
expect(identifier.key).to be == "file.rb:123"
... |
github | socketry/sus | https://github.com/socketry/sus | test/sus/describe.rb | Ruby | mit | 195 | main | 689 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2023-2024, by Samuel Williams.
describe Sus::Describe do
with "nested contexts" do
let(:context) do
Sus::Describe.build(self.class, "a test class"){}
end
it "has a description" do
expect(context.description).to be == "a test ... |
github | socketry/sus | https://github.com/socketry/sus | test/sus/clock.rb | Ruby | mit | 195 | main | 1,256 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2022-2024, by Samuel Williams.
describe Sus::Clock do
let(:clock) {subject.new}
it "should measure the time between start and stop" do
clock.start!
sleep 0.001
clock.stop!
expect(clock.duration).to be > 0.001
end
it "can f... |
github | socketry/sus | https://github.com/socketry/sus | test/sus/version.rb | Ruby | mit | 195 | main | 228 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2021-2022, by Samuel Williams.
describe Sus::VERSION do
it "has a major.minor.patch version" do
expect(subject).to be =~ /\d+\.\d+\.\d+/
end
end |
github | socketry/sus | https://github.com/socketry/sus | test/sus/be.rb | Ruby | mit | 195 | main | 2,861 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2021-2024, by Samuel Williams.
describe Sus::Be do
with "true" do
it "can expect equality" do
expect(true).to be == true
end
it "can expect inequality" do
expect(true).to be != false
end
it "can be truthy" do
expect... |
github | socketry/sus | https://github.com/socketry/sus | test/sus/it.rb | Ruby | mit | 195 | main | 1,498 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2021-2024, by Samuel Williams.
describe Sus::It do
let(:assertions) {Sus::Assertions.new(output: Sus::Output.buffered)}
with "hooks" do
attr_accessor :before_hook_invoked
attr_accessor :after_hook_invoked
def before
self.befo... |
github | socketry/sus | https://github.com/socketry/sus | test/sus/be_within.rb | Ruby | mit | 195 | main | 1,584 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2021-2024, by Samuel Williams.
describe Sus::BeWithin do
it "can expect number to be within a tolerance" do
expect(0).to be_within(10)
expect(5).to be_within(10)
end
it "can expect number to be outside of a tolerance" do
expect(10... |
github | socketry/sus | https://github.com/socketry/sus | test/sus/expect.rb | Ruby | mit | 195 | main | 702 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2022-2024, by Samuel Williams.
describe Sus::Expect do
with "a hash table" do
let(:target) {Hash.new}
it "can expect equality" do
expect(target).to be == {}
end
it "can expect to include" do
target[:key] = "value"
exp... |
github | socketry/sus | https://github.com/socketry/sus | test/sus/have.rb | Ruby | mit | 195 | main | 1,853 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2022-2024, by Samuel Williams.
User = Struct.new(:name, :age)
require "socket"
describe Sus::Have do
describe User do
let(:user) {subject.new("Sus", 20)}
it "has name and age" do
expect(user).to have_attributes(
name: be == ... |
github | socketry/sus | https://github.com/socketry/sus | test/sus/raise_exception.rb | Ruby | mit | 195 | main | 1,049 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2021-2024, by Samuel Williams.
class AgeError < StandardError
def initialize(age)
@age = age
super "Too old: #{age}"
end
attr :age
end
describe Sus::RaiseException do
it "can raise an exception with a matching message" do
expect... |
github | socketry/sus | https://github.com/socketry/sus | test/sus/context.rb | Ruby | mit | 195 | main | 1,513 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2021-2024, by Samuel Williams.
Context = Sus::Shared("context") do
it "can define a nested example" do
instance.it("has an example"){}
expect(instance.children).not.to be(:empty?)
end
it "does not include unnecessary variables" d... |
github | socketry/sus | https://github.com/socketry/sus | test/sus/config.rb | Ruby | mit | 195 | main | 2,031 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2022-2024, by Samuel Williams.
require "fixtures"
class Target
def print(output)
output.write("target")
end
end
describe Sus::Config do
include Fixtures
let(:root) {fixtures_path("sus/config/empty")}
let(:config) {subject.load(roo... |
github | socketry/sus | https://github.com/socketry/sus | test/sus/receive.rb | Ruby | mit | 195 | main | 2,418 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2022-2025, by Samuel Williams.
class RealImplementation
def call
"Real Implementation"
end
end
class FakeImplementation
def call
"Fake Implementation"
end
end
class Interface
def implementation(*arguments, **options)
RealImpleme... |
github | socketry/sus | https://github.com/socketry/sus | test/sus/file.rb | Ruby | mit | 195 | main | 290 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2023, by Samuel Williams.
FILE = self
describe Sus::File do
it "has a class name" do
skip_unless_method_defined(:set_temporary_name, Module)
expect(FILE.name).to be == "Sus::File[#{__FILE__}]"
end
end |
github | socketry/sus | https://github.com/socketry/sus | test/sus/respond_to.rb | Ruby | mit | 195 | main | 858 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2022-2024, by Samuel Williams.
class Interface
def method_with_options(x: 10, y:)
end
end
describe Sus::RespondTo do
let(:interface) {Interface.new}
it "can respond to a method" do
expect(interface).to respond_to(:method_with_option... |
github | socketry/sus | https://github.com/socketry/sus | test/sus/include_context.rb | Ruby | mit | 195 | main | 2,076 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2023-2024, by Samuel Williams.
AContextWithArguments = Sus::Shared("a context with arguments") do |key, value: 42|
let(:a_thing) {{key => value}}
end
AContextWithHooks = Sus::Shared("a context with hooks") do
before do
events << :contex... |
github | socketry/sus | https://github.com/socketry/sus | test/sus/.registry_directory/directory_test_file.rb | Ruby | mit | 195 | main | 206 | # Released under the MIT License.
# Copyright, 2022, by Brad Schrag.
# Copyright, 2023, by Samuel Williams.
# This file serves as a placeholder for testing registry logic for the loading of a folder path. |
github | socketry/sus | https://github.com/socketry/sus | test/sus/output/backtrace.rb | Ruby | mit | 195 | main | 1,248 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2023-2024, by Samuel Williams.
require "sus/output/status"
describe Sus::Output::Backtrace do
let(:identity) {Sus::Identity.current}
let(:backtrace) {subject.new(caller_locations)}
it "has several frames" do
expect(backtrace.stack).t... |
github | socketry/sus | https://github.com/socketry/sus | test/sus/output/status.rb | Ruby | mit | 195 | main | 734 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2022-2024, by Samuel Williams.
require "sus/output/status"
describe Sus::Output::Status do
let(:buffer) {StringIO.new}
let(:output) {Sus::Output.for(buffer)}
def before
Sus::Output::Status.register(output)
end
it "has registered ... |
github | socketry/sus | https://github.com/socketry/sus | test/sus/output/buffered.rb | Ruby | mit | 195 | main | 941 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2024, by Samuel Williams.
require "sus/output/buffered"
class StatefulThing
def initialize
@state = :initial
end
def inspect
"#<#{self.class.name} #{@state}>"
end
def close
@state = :closed
end
def closed?
@state == :cl... |
github | socketry/sus | https://github.com/socketry/sus | benchmark/test.rb | Ruby | mit | 195 | main | 396 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2024, by Samuel Williams.
ITERATIONS = ENV.fetch("ITERATIONS", 1000).to_i
TYPE = ENV.fetch("TYPE", "pos")
describe "sus" do
ITERATIONS.times do |n|
case TYPE
when "pos" then
it "pos #{n}" do
expect(1).to be == 1
end
when "n... |
github | socketry/sus | https://github.com/socketry/sus | lib/sus.rb | Ruby | mit | 195 | main | 584 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2021-2024, by Samuel Williams.
require_relative "sus/version"
require_relative "sus/config"
require_relative "sus/registry"
require_relative "sus/assertions"
require_relative "sus/tree"
require_relative "sus/expect"
require_relative "sus/be... |
github | socketry/sus | https://github.com/socketry/sus | lib/sus/clock.rb | Ruby | mit | 195 | main | 2,215 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2022-2023, by Samuel Williams.
module Sus
# Represents a clock for measuring elapsed time during test execution.
class Clock
include Comparable
# Create a new clock and start it immediately.
# @returns [Clock] A new started clock.... |
github | socketry/sus | https://github.com/socketry/sus | lib/sus/context.rb | Ruby | mit | 195 | main | 3,970 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2021-2024, by Samuel Williams.
require_relative "assertions"
require_relative "identity"
module Sus
# Represents a test context that can contain nested tests and other contexts.
module Context
# @attribute [Identity, nil] The identity o... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.