hexsha stringlengths 40 40 | size int64 2 1.01M | content stringlengths 2 1.01M | avg_line_length float64 1.5 100 | max_line_length int64 2 1k | alphanum_fraction float64 0.25 1 |
|---|---|---|---|---|---|
287f8fee9bbd4a040bf1d4d96740dfd5b92518b7 | 2,393 | # Run Coverage report
require 'simplecov'
SimpleCov.start do
add_filter 'spec/dummy'
add_group 'Controllers', 'app/controllers'
add_group 'Helpers', 'app/helpers'
add_group 'Mailers', 'app/mailers'
add_group 'Models', 'app/models'
add_group 'Views', 'app/views'
add_group 'Libraries', 'lib/spree'
end
# Co... | 32.337838 | 104 | 0.75888 |
085d89820335ac2e52dad8bdd2a6c2e9ea86438b | 3,598 | #!/usr/bin/env ruby
# -*- coding: binary -*-
$:.unshift(File.join(File.dirname(__FILE__), '..', '..', '..'))
require 'test/unit'
require 'rex/proto/http'
class Rex::Proto::Http::Response::UnitTest < Test::Unit::TestCase
Klass = Rex::Proto::Http::Response
def test_deflate
h = Klass.new
h.body = 'hi mom'
h.c... | 23.827815 | 313 | 0.611451 |
e28000142d5da28f90d7b8e0ed168c2f64ac4e63 | 299 | module Buildable
def perform(payload_data)
payload = Payload.new(payload_data)
build_runner = BuildRunner.new(payload)
build_runner.run
rescue Resque::TermException
retry_job
rescue => exception
Raven.capture_exception(exception, payload: { data: payload_data })
end
end
| 24.916667 | 71 | 0.745819 |
f72f0db4edfa0ef243b0a93ebfe03bcff4c8c59b | 1,452 | # frozen_string_literal: true
# WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
require 'aws-sdk-core'
require 'aws-sigv4'
require_relative 'aws-sdk-licensemana... | 27.396226 | 87 | 0.758264 |
e8b9f25344bc79f57e763899cd507fd42c02dbf8 | 1,195 | class Swiftformat < Formula
desc "Formatting tool for reformatting Swift code"
homepage "https://github.com/nicklockwood/SwiftFormat"
url "https://github.com/nicklockwood/SwiftFormat/archive/0.40.4.tar.gz"
sha256 "0e11500bf82390b8ac3065c480ab561763adc4096e6f04d0c277d6df5b294b74"
head "https://github.com/nickl... | 33.194444 | 93 | 0.725523 |
385528d74df4a9910b0e28ff2cb0b5f6adb52ace | 1,869 | class UsersController < ApplicationController
before_action :logged_in_user, only: [:index, :edit, :update, :destroy,
:following, :followers]
before_action :correct_user, only: [:edit, :update]
before_action :admin_user, only: :destroy
def index
@users = User.w... | 22.792683 | 73 | 0.638844 |
1a29502892f159f5ed6cc65ea0a80a9bdb8a6a8c | 254 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure end
module Azure::CDN end
module Azure::CDN::Mgmt end
module Azure::CDN::Mgmt::V2017_10_12 end
| 28.222222 | 70 | 0.775591 |
6a142573aec1bc1d36b2595bdd44885cd4cd1d60 | 938 | require 'spec_helper'
describe 'vim::default' do
let(:chef_run) do
ChefSpec::SoloRunner.new(platform: 'ubuntu',
version: '12.04',
file_cache_path: '/var/chef/cache') do |node|
node.set['vim']['source']['version'] = 'foo_version_1'
end.converge(d... | 33.5 | 80 | 0.668443 |
03e3dd49feae7b18dc83816d32f5429fbcec3fca | 1,369 | Pod::Spec.new do |s|
s.name = "ZappCrashlogsPluginMsAppCenter"
s.version = '3.0.0'
s.summary = "ZappCrashlogsPluginMsAppCenter"
s.description = <<-DESC
ZappCrashlogsPluginMsAppCenter container.
DESC
s.homepage = "https:/... | 41.484848 | 126 | 0.595325 |
4ac6725b1703b4d5191caf1292c0de550d776506 | 9,628 | require 'spec_helper'
describe FactoryGirl::Factory do
before do
@name = :user
@class = define_class('User')
@factory = FactoryGirl::Factory.new(@name)
FactoryGirl.register_factory(@factory)
end
it "has a factory name" do
@factory.name.should == @name
end
it "has a build class" do
... | 34.141844 | 112 | 0.686955 |
21af2f684e9b763ed4abe5de45803314c38106b6 | 156 | require 'doogle/tft_diagonal_in_option'
class Doogle::OledDiagonalInOption < Doogle::TftDiagonalInOption
def self.type_key
'oled_displays'
end
end
| 19.5 | 64 | 0.801282 |
01dd9b25129aa494b950855fd71f131e41aa5192 | 159 | class AddRefToAssignmentSubmission < ActiveRecord::Migration[5.1]
def change
add_reference :assignment_submissions, :project, foreign_key:true
end
end
| 26.5 | 69 | 0.805031 |
f81f386c3eda49b8628b59b7577af3feea94a48f | 113 | ENV['RACK_ENV'] = 'test'
require 'rubygems'
require 'bundler'
Bundler.require :test
require_relative './base'
| 12.555556 | 25 | 0.725664 |
7aede6278927d1e3bf69b279251e780887dcb8d9 | 1,756 | require 'plugin_routes'
require 'camaleon_cms/engine'
Rails.application.routes.draw do
scope PluginRoutes.system_info["relative_url_root"] do
scope '(:locale)', locale: /#{PluginRoutes.all_locales}/, :defaults => { } do
# frontend
namespace :plugins do
namespace 'social_shortcode' do
... | 27.015385 | 93 | 0.620729 |
5d1d6aa53d09af0f029b8df8bc2fbf4044d55aaa | 212 | # frozen_string_literal: true
Rails.application.routes.draw do
devise_for :accounts
# TODO: Add root route as needed/necessary
# unauthenticated :user do
# root to: 'static_pages#landing'
# end
end
| 19.272727 | 44 | 0.735849 |
87323724abad7aa47f97c9ae1815eaa606950573 | 1,211 | require 'rb-inotify'
module Blimp
module Sources
class GitWatcher
def initialize
@notifier = INotify::Notifier.new
@watchers = {}
end
def watch(git_source, &block)
raise ArgumentError, "block must not be nil" if block.nil?
ws = []
begin
ws << n... | 24.714286 | 96 | 0.57308 |
62de5658e895cec90ad7e709fb9884a1f80caed4 | 3,819 | # Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | 46.573171 | 81 | 0.737628 |
1853efde3502e774f254fb83bc2012425092d663 | 17,090 | # frozen_string_literal: true
require 'spec_helper'
describe Gitlab::Ci::Config::Entry::Job do
let(:entry) { described_class.new(config, name: :rspec) }
describe '.nodes' do
context 'when filtering all the entry/node names' do
subject { described_class.nodes.keys }
let(:result) do
%i[bef... | 28.530885 | 102 | 0.548742 |
87232caeb2036a880d768c22fea61c8206776af1 | 3,939 | module Fastlane
module Actions
class UpdateAppIdentifierAction < Action
def self.run(params)
require 'plist'
require 'xcodeproj'
info_plist_key = 'INFOPLIST_FILE'
identifier_key = 'PRODUCT_BUNDLE_IDENTIFIER'
# Read existing plist file
info_plist_path = File.... | 43.285714 | 150 | 0.543031 |
b9b20da64c75685078c60f749632596477277e77 | 186 | Rails.application.routes.draw do
root "articles#index"
resources :articles
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
end
| 31 | 102 | 0.77957 |
1cb715534cc5e2a347eb54a130eed4754b7f133c | 928 | require 'bundler/setup'
require 'rspec'
require 'zxcvbnjs'
Dir[Pathname.new(File.expand_path('../', __FILE__)).join('support/**/*.rb')].each {|f| require f}
RSpec.configure do |config|
config.include JsHelpers
end
TEST_PASSWORDS = [
'zxcvbn',
'qwER43@!',
'Tr0ub4dour&3',
'correcthorsebatterystaple',
'coRr... | 16.280702 | 97 | 0.639009 |
1c736b5f824060d4cd234019c050e2f9061c34b8 | 288 | module AtoTk
module Common
WEIGHTS = {8 => [10, 7, 8, 4, 6, 3, 5, 1], 9 => [10, 7, 8, 4, 6, 3, 5, 2, 1], 11 => [10, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19]}
end
end
# Require everything from the atotk directory.
Dir[File.expand_path('../atotk/*.rb', __FILE__)].each{|f| require f }
| 26.181818 | 128 | 0.555556 |
f8fa376f833dbd9caff92e2220c4a57585157616 | 4,847 | # frozen_string_literal: true
module Integrations
class Github < Integration
include Gitlab::Routing
include ActionView::Helpers::UrlHelper
prop_accessor :token, :repository_url
boolean_accessor :static_context
delegate :api_url, :owner, :repository_name, to: :remote_project
validates :tok... | 32.313333 | 305 | 0.68104 |
6225f8d25a224c22c9b2fa2c9ceb3e50d3f46cf1 | 110,335 | # WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
module Aws::DirectoryService
# @api private
module ClientApi
include Seahorse::Model
AcceptSharedD... | 70.009518 | 220 | 0.764753 |
e2a57999c8df86b4b3945f42d6a8310e0cfa85c5 | 585 | # frozen_string_literal: true
if defined?(ChefSpec)
# matcher => [methods]
{
:logstash_config => %w[create delete],
:logstash_input => %w[create delete],
:logstash_filter => %w[create delete],
:logstash_output => %w[create delete],
:logstash_service => %w[start stop restart]
}.each_pair do |r... | 27.857143 | 87 | 0.678632 |
394271feef8c0d50095aa352d1e0d96f412ef785 | 1,137 | # typed: true
class PgSearchTest
include PgSearch::Model
multisearchable against: [:body], update_if: :body_changed?
multisearchable against: :body, update_if: :body_changed?
multisearchable against: [:title, :body],
additional_attributes: -> (article) { { author_id: article.author_id } }
pg_search_sco... | 25.840909 | 88 | 0.684257 |
e2a83aec91a5fe589af4e86449960d77d9781b1f | 4,450 | require 'pathname'
Puppet::Type.newtype(:dsc_xscspfstamp) do
require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc'
require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers'
@doc = %q{
The DSC xSCSPFStamp resource type.
Automatically generated from
'x... | 31.785714 | 147 | 0.674607 |
fffc98b65123b5d2d97b0082c36c8d9f29f2c026 | 7,828 | =begin
#Accounting API
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 2.0.0
Contact: api@xero.com
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.0.3
=end
require 'time'
require 'date'
module... | 30.341085 | 200 | 0.625703 |
ac110f4f4b3ce78d497e8abd935b27e69e0a32de | 330 | class Admin::CreateContactListService
attr_reader :contact_list
def initialize(district_id:)
@district_id = district_id
end
def perform
@contact_list = ContactList.create_for_district(@district_id, new_contacts)
end
private
def new_contacts
Customer.contactable.for_districts(@district_id)
... | 18.333333 | 79 | 0.772727 |
03b930c39f936e93eb2f67cdf7d0a5472498da2a | 20,363 | # frozen_string_literal: true
require 'rails_helper'
feature "early allocation", type: :feature do
let(:nomis_staff_id) { 485_926 }
# any date less than 3 months
let(:valid_date) { Time.zone.today - 2.months }
let(:prison) { 'LEI' }
let(:username) { 'MOIC_POM' }
let(:nomis_offender) { build(:nomis_offende... | 39.463178 | 159 | 0.622109 |
281feb5c3c2d81cc3170f253073a27480f8ed3fb | 606 | class I386JosElfGdb < Formula
desc "GNU debugger"
homepage "https://www.gnu.org/software/gdb/"
url "http://ftpmirror.gnu.org/gdb/gdb-8.2.1.tar.xz"
mirror "https://ftp.gnu.org/gnu/gdb/gdb-8.2.1.tar.xz"
sha256 "0a6a432907a03c5c8eaad3c3cffd50c00a40c3a5e3c4039440624bae703f2202"
def install
args = %W[
... | 22.444444 | 75 | 0.653465 |
268aca95ff94e17715fabac441f8b0afc369d81a | 4,820 | module ChildProcess
module Windows
class ProcessBuilder
attr_accessor :leader, :detach, :duplex, :environment, :stdout, :stderr, :cwd
attr_reader :stdin
def initialize(args)
@args = args
@detach = false
@duplex = false
@environment = ... | 27.386364 | 84 | 0.546266 |
e24214370448b51c2ade2f34ac47c886c71dd037 | 258 | # begin
# # Require the preresolved locked set of gems.
# require File.expand_path('../.bundle/environment', __FILE__)
# rescue LoadError
# # Fallback on doing the resolve at runtime.
# require "rubygems"
# require "bundler"
# Bundler.setup
# end | 28.666667 | 64 | 0.70155 |
6a89af2df207e88ec62416700fffb0826af21d85 | 727 | require 'spec_helper'
require 'core_ext/hash/deep_merge'
describe 'Hash#deep_merge' do
it 'deep merges a hash into a new one' do
lft = { :foo => { :bar => 'bar' } }
rgt = { :foo => { :baz => 'baz' } }
lft.deep_merge(rgt).should == { :foo => { :bar => 'bar', :baz => 'baz' } }
end
it 'does not change ... | 26.925926 | 78 | 0.513067 |
acbc8cd27d2b4707c5ae00911826e5e2775c3465 | 269 | class SnippetRevision < ActiveRecord::Base
belongs_to :snippet
before_save :increase_number
def increase_number
snippet = self.snippet
self.number = snippet && snippet.last_revision ? snippet.last_revision.number + 1 : 1
return true
end
end | 22.416667 | 89 | 0.728625 |
398e01d744813f1c92fcddefa82e8567701c282e | 1,160 | class ProcyonDecompiler < Formula
desc "Modern decompiler for Java 5 and beyond"
homepage "https://bitbucket.org/mstrobel/procyon/wiki/Java%20Decompiler"
url "https://bitbucket.org/mstrobel/procyon/downloads/procyon-decompiler-0.5.36.jar"
sha256 "74f9f1537113207521a075fafe64bd8265c47a9c73574bbf9fa8854bbf7126bc"... | 27.619048 | 91 | 0.669828 |
f7d1f7c08fe1ca26c3ca44236105c25ba1b7e3b8 | 933 | class ScopedEventFeed
attr_reader :root, :event_subjects, :page, :per
def initialize(root_type, root_id, page = 0, per = 20)
@root = root_type.classify.constantize.find(root_id)
@event_subjects = EventHierarchy.new(root).children
@page = page
@per = per
end
def events
if @events
@even... | 26.657143 | 80 | 0.631297 |
33e309106306d645a76740648d923224ef1c4777 | 7,894 | # Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
require 'date'
require 'logger'
# rubocop:disable Lint/UnneededCopDisableDirective, Metrics/LineLength
module OCI
# The properties that define a work request resource.
class ContainerEngine::Models::WorkRequestResource
ACTION_TYPE_... | 36.546296 | 140 | 0.67735 |
01ede673b39127d7e990452491aee0f590110401 | 3,590 | require 'spec_helper'
require 'cli/public_stemcells'
module Bosh::Cli
describe PublicStemcells, vcr: { cassette_name: 'promoted-stemcells' } do
subject(:public_stemcells) { PublicStemcells.new }
describe '#has_stemcell?' do
it { should have_stemcell('bosh-stemcell-1001-aws-xen-ubuntu.tgz') }
it ... | 44.320988 | 94 | 0.593036 |
7980b49c3958282bd2508f296bb92a4af36ce51e | 553 | require 'test_helper'
class LoggerTest < Test::Unit::TestCase
context "with connection that has logger" do
setup do
@output = StringIO.new
@logger = Logger.new(@output)
MongoMapper.connection = Mongo::Connection.new('127.0.0.1', 27017, :logger => @logger)
end
should "be able to get acc... | 27.65 | 92 | 0.665461 |
38767e1ae73e58ec72b54619f8e8df9f8606f8fa | 5,103 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# dat... | 32.922581 | 95 | 0.697825 |
e2d82f3d191388f73e4f5aee40661fbfe236dc52 | 1,619 | class GitPlus < Formula
include Language::Python::Virtualenv
desc "Git utilities: git multi, git relation, git old-branches, git recent"
homepage "https://github.com/tkrajina/git-plus"
url "https://files.pythonhosted.org/packages/73/b5/6cf7f0513fd1ef42b5a3ac0e342b3c4176551f60ad17fc5dbe52329f2b58/git-plus-v0.4.... | 35.195652 | 137 | 0.744287 |
1c73fe501a67e64137c2fadafb13ea205ecc2fea | 876 | $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
require 'waylon/version'
Gem::Specification.new do |s|
s.name = 'waylon'
s.version = Waylon::VERSION
s.date = '2015-05-11'
s.authors = ['Roger Ignazio']
s.email = ['me@rogerignazio.com']
s.homepage = 'https:... | 33.692308 | 89 | 0.610731 |
f74688a53c659bcfa83e9369d6a5bf781ddae257 | 537 | require 'rails_helper'
feature 'Reset Password' do
let!(:admin) { create(:user, :admin) }
scenario 'User exists' do
visit '/password_resets/new'
fill_in('email', with: admin.email)
click_button('Reset Password')
expect(page).to have_content('Email sent with password reset instructions')
end
s... | 26.85 | 79 | 0.702048 |
ababa7ea53fd6b9eb2a3b42c8229483c2fa8fe8d | 113 | class UserPagesController < ApplicationController
def signup
end
def login
end
def account
end
end
| 10.272727 | 49 | 0.743363 |
38d0e4086edbfc4f7ea44426388409ccb5d8585c | 1,843 | xml.h1("class" => "title") do
xml << "Posts"
end
xml.table do
xml.thead do
xml.tr do
xml.th do
xml << "\n Title\n "
end
xml.th do
xml << "\n Writer\n "
end
xml.th do
xml << "\n Actions\n "
end
end
end
xml.t... | 22.753086 | 127 | 0.537168 |
d5bb21c7f1cd8f85115c01c828a74a51aa1ff6d9 | 2,524 | class Composers::CLI
attr_accessor :url, :input
def call
puts "********************** WANT TO LEARN MORE ABOUT COMPOSERS? *******************"
start
end
def to_number(letter)
number = letter.tr("A-Z", "1-9a-q").to_i(25)
if number > 20
number -= 1
else
number
end
end
de... | 35.549296 | 115 | 0.540412 |
7a1247b6dd4134c33a2a4e0117be25080db99096 | 2,887 | require 'spec_helper'
describe 'murano::cfapi' do
let(:params) do {
:tenant => 'admin',
}
end
shared_examples_for 'murano-cfapi' do
it { is_expected.to contain_class('murano::cfapi') }
end
shared_examples_for 'with default parameters' do
it { is_expected.to contain_class('murano::deps') }
... | 34.783133 | 114 | 0.63353 |
edde1f755eca1ee4102bd6175cf0b9bc9614b9e3 | 1,639 | # frozen_string_literal: true
module ActiveEntity
module Type
class Serialized < DelegateClass(ActiveModel::Type::Value) # :nodoc:
undef to_yaml if method_defined?(:to_yaml)
include ActiveModel::Type::Helpers::Mutable
attr_reader :subtype, :coder
def initialize(subtype, coder)
... | 22.763889 | 75 | 0.605247 |
62b5b48489cca35b74124f540d1a9292ee515788 | 961 | require "logstash/namespace"
require "logstash/event"
require "logstash/plugin"
require "logstash/logging"
# This is the base class for logstash codecs.
module LogStash::Codecs
class Base < LogStash::Plugin
include LogStash::Config::Mixin
config_name "codec"
def initialize(params={})
super
c... | 20.891304 | 73 | 0.655567 |
e2fd51d2c295f46ec2ed3ae11eefb191f0f8be0b | 400 | # encoding: UTF-8
require_relative 'spec_helper'
describe 'openstack-compute::client' do
describe 'redhat' do
let(:runner) { ChefSpec::Runner.new(REDHAT_OPTS) }
let(:node) { runner.node }
let(:chef_run) do
runner.converge(described_recipe)
end
it 'upgrades python-novaclient package' do
... | 21.052632 | 62 | 0.695 |
d5f32885409dd7aa1afec4a4945f4aceb6bb5189 | 517 | module HealthSeven::V2_5_1
class MfnM15 < ::HealthSeven::Message
attribute :msh, Msh, position: "MSH", require: true
attribute :sfts, Array[Sft], position: "SFT", multiple: true
attribute :mfi, Mfi, position: "MFI", require: true
class MfInvItem < ::HealthSeven::SegmentGroup
attribute :mfe, Mfe, position: "... | 43.083333 | 107 | 0.723404 |
79ba45d728e6ca42d0be7bf9d081bea3feed4c98 | 809 | require 'bio-ucsc'
describe "Bio::Ucsc::Hg19::WgEncodeUwDnaseHconfPkRep1" do
describe "#find_by_interval" do
context "given range chr1:1-800,000" do
it "returns an array of records" do
Bio::Ucsc::Hg19::DBConnection.default
Bio::Ucsc::Hg19::DBConnection.connect
i = Bio::GenomicInter... | 32.36 | 79 | 0.648949 |
e289f4ce8fbb4078cbde4fe310ff0db7ac09dfe0 | 1,142 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'version'
Gem::Specification.new do |spec|
spec.name = 'idempotent-request'
spec.version = IdempotentRequest::VERSION
spec.authors = ['Dmytro Zakharov']
spec.email ... | 35.6875 | 97 | 0.651489 |
6ac5bb907061545040cf9bf8a8c50d7a3fd28623 | 4,399 | # frozen_string_literal: true
class Projects::MergeRequests::CreationsController < Projects::MergeRequests::ApplicationController
include DiffForPath
include DiffHelper
include RendersCommits
skip_before_action :merge_request
before_action :whitelist_query_limiting, only: [:create]
before_action :authoriz... | 29.92517 | 143 | 0.726983 |
26369487cca222c3185c5955f4f817b653a0cb2b | 529 | # Deploy related custom tasks
namespace :deploy do
desc 'Initial Deploy'
task :initial do
on roles(:app) do
before 'deploy:restart', 'puma:start'
invoke 'deploy'
end
end
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
invoke 'puma:restart'
... | 19.592593 | 76 | 0.648393 |
4af47cd8c1b902d9f6c1f4ea513cf7973a33f4ce | 280 | ITERATIONS = 5_000_000
def harness_input
f = FutureImplementation.new
f.fulfill 1
f
end
def harness_sample(input)
sum = 0
ITERATIONS.times do
sum += input.value
end
sum
end
def harness_verify(output)
output == ITERATIONS
end
require 'bench9000/harness'
| 11.2 | 30 | 0.721429 |
61a44cf95d52a5709abc0c73c6a1bed5a2072557 | 4,046 | $: << '.'
require File.dirname(__FILE__) + '/../test_helper'
class OrderAddressTest < ActiveSupport::TestCase
fixtures :users
fixtures :order_addresses, :order_users, :countries
# Test if a valid address can be created with success.
def test_should_create_address
an_address = OrderAddress.new
an... | 35.80531 | 139 | 0.737519 |
262a535aac2427a35796929c41fc620a18f42049 | 15,240 | #
# Cookbook:: ark
# Resource:: Ark
#
# Author:: Bryan W. Berry <bryan.berry@gmail.com>
# Copyright:: 2012-2017, Bryan W. Berry
# Copyright:: 2016-2017, Chef Software Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obt... | 28.118081 | 105 | 0.715157 |
111d6e32b324c6a3cc3d5e1a801c6238d8ace704 | 1,556 | class ConditionForeign < ConditionSimple
WORDLESS_LANGUAGES = %i[ct cs kr jp de].to_set
def initialize(lang, query)
@lang = lang.downcase
# Support both Gatherer and MCI naming conventions
@lang = "ct" if @lang == "tw"
@lang = "cs" if @lang == "cn"
@lang = @lang.to_sym
@lang_match_all = (@l... | 25.508197 | 77 | 0.633033 |
1ddb9cf8d36d27766fae7d2f6faa5a2a28b7a548 | 2,052 | require 'open-uri'
require 'json'
require 'fileutils'
module EyesUtils
EYES_ACCESS_KEY_ENV_NAME = 'EYES_ACCESS_KEY'.freeze
TMP_UTIL_DIR = File.expand_path('../../../.tmputils', __FILE__).freeze
MERGE_UTIL_PATH = "#{TMP_UTIL_DIR}/applitools-merge.jar".freeze
REMOTE_JAR_SOURCE = 'https://s3.amazonaws.com/cdo-ci... | 36.642857 | 139 | 0.72807 |
aba602e94a0d794f171db084afb8418b58b5b703 | 421 | FactoryBot.define do
factory :profile do
name { FFaker::Name.name }
title { FFaker::Lorem.word }
portfolio
trait :with_photo do
after :build do |portfolio|
image = File.open(Rails.root.join('features', 'factories', 'images', 'portfolio-photo.png'))
... | 30.071429 | 102 | 0.586698 |
7a2f2e5623422e2220092b7d3ba31e6a0627cbe5 | 574 | require 'spec_helper'
require 'adventofcode/day_11/part_1'
RSpec.describe(AdventOfCode::Day11::Part1) do
describe('#run') do
let(:challenge_input) { load_fixture('day_11.txt') }
it('returns the correct answer for example one') do
expect(subject.run('abcdefgh')).to eql('abcdffaa')
end
it('retu... | 27.333333 | 63 | 0.69338 |
01d6d1283a5385818645604404adbf09303ab988 | 1,892 | step "Install development build of PuppetDB on the PuppetDB server" do
os = test_config[:os_families][database.name]
case test_config[:install_type]
when :git
raise "No PUPPETDB_REPO_PUPPETDB set" unless test_config[:repo_puppetdb]
case os
when :redhat
on database, "yum install -y git-core rub... | 34.4 | 105 | 0.718816 |
3887c22b75327e8d627ffd497841f3444150e34b | 6,686 | RSpec.describe "Item management", type: :system do
before do
sign_in(@user)
end
let!(:url_prefix) { "/#{@organization.to_param}" }
it "can create a new item as a user" do
visit url_prefix + "/items/new"
item_traits = attributes_for(:item)
fill_in "Name", with: item_traits[:name]
select BaseI... | 40.277108 | 166 | 0.685761 |
abbdaf8e2027987c014d216fd8c30e6b30db5265 | 1,069 | $:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "workbook_rails/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "workbook_rails"
s.version = WorkbookRails::VERSION
s.authors = ["Noel Peden"]
s.email = ["... | 42.76 | 298 | 0.706268 |
5d1d4ffad70ab23a642527cd49a8da07c193f88c | 1,312 | # -*- encoding: utf-8 -*-
# stub: rb-inotify 0.9.8 ruby lib
Gem::Specification.new do |s|
s.name = "rb-inotify".freeze
s.version = "0.9.8"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["Nathan Weiz... | 35.459459 | 112 | 0.65625 |
bb4b8191216df0805177a3687ebaa9b2caebab10 | 45 | module StandardTasks
VERSION = "0.0.1"
end
| 11.25 | 20 | 0.711111 |
1d83caf05d95b15edf0180eb90a66d664be88132 | 1,152 | class Libreplaygain < Formula
desc "Library to implement ReplayGain standard for audio"
homepage "https://www.musepack.net/"
url "https://files.musepack.net/source/libreplaygain_r475.tar.gz"
version "r475"
sha256 "8258bf785547ac2cda43bb195e07522f0a3682f55abe97753c974609ec232482"
bottle do
cellar :any
... | 41.142857 | 95 | 0.802083 |
ac718d2e5089125a6b7c6ed1089746882109b516 | 1,166 | # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{eb_nested_set}
s.version = "0.3.5"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Jonas Nicklas"]
s.autorequire = %q{eb_nested_set}
s.date = %q{2009-02-16}
s.descrip... | 37.612903 | 223 | 0.700686 |
4a4cd093435ef1ab35fcc2050a9c01f96699ace5 | 8,113 | require 'spec_helper'
describe Issue, "Issuable" do
let(:issue) { create(:issue) }
let(:user) { create(:user) }
describe "Associations" do
it { is_expected.to belong_to(:project) }
it { is_expected.to belong_to(:author) }
it { is_expected.to belong_to(:assignee) }
it { is_expected.to have_many(:... | 32.979675 | 87 | 0.679034 |
6a0d1d4aa5a1fcbed780306c12d3d70bfe880728 | 5,494 | # Copyright 2016 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 27.888325 | 125 | 0.620677 |
d562f2e2665cbd75e75920aecd1897f5943db340 | 8,007 | describe ActiveModel::Errors do
before do
@klass = Class.new do
extend ActiveModel::Naming
def initialize
@errors = ActiveModel::Errors.new(self)
end
attr_accessor :name, :email
attr_reader :errors
def validate!
errors.add(:name, "can't be nil") if name.nil... | 26.779264 | 76 | 0.604471 |
21d72987422fc33b34763dc7b4a1a808eb84cd11 | 1,546 | require "opencode_theme/version"
require 'opencode_theme/base_service'
module OpencodeTheme
NOOPParser = Proc.new {|data, format| {} }
TIMER_RESET = 10
PERMIT_LOWER_LIMIT = 3
CONFIG_FILE = 'config.yml'
def self.test?
ENV['test']
end
def self.critical_permits?
@@total_api_calls.to_i - @@current... | 20.891892 | 112 | 0.655886 |
3305efd0f781555a46fa05ce6aff4aa6def7ac6b | 2,241 | require 'rails_helper'
describe Api::V1::MeasureTypesController do
render_views
before { login_as_api_user }
describe "GET to #index" do
let!(:national_measure_type) { create :measure_type, :national }
let!(:non_national_measure_type) { create :measure_type, :non_national }
let(:response_pattern)... | 28.367089 | 112 | 0.677376 |
f79ac3b1a9735f07a393b8202ed6e4785d05cc54 | 128 | FactoryBot.define do
factory :task do
title { "Brush teeth" }
icon { "toothbrush" }
color { "#00face" }
end
end
| 16 | 27 | 0.601563 |
0144ae0ce3f4dfd28ecc773b65834ab3144ded8a | 8,841 | require 'support/shared/integration/integration_helper'
require 'chef/mixin/shell_out'
describe "chef-client" do
include IntegrationSupport
include Chef::Mixin::ShellOut
let(:chef_dir) { File.join(File.dirname(__FILE__), "..", "..", "..", "bin") }
# Invoke `chef-client` as `ruby PATH/TO/chef-client`. This en... | 36.382716 | 155 | 0.706481 |
792d9c3c713b7914228f9b49c80971fee0310015 | 3,212 | RSpec.describe Webview::App do
let(:root_path) { Webview::ROOT_PATH }
let(:s_kill) { Signal.list['KILL'] }
let(:s_quit) { Signal.list[Webview::App::SIGNALS_MAPPING['QUIT'] || 'QUIT'] }
describe '#open/close' do
it 'should open app window by webview' do
r = Open3.popen3('sleep 1')
expect(Open3).... | 33.810526 | 94 | 0.643213 |
336750360cbfa9f20b1f758e2c3f1ed552b014ea | 1,763 | require_relative "boot"
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
# require "active_job/railtie"
# require "active_record/railtie"
# require "active_storage/engine"
require "action_controller/railtie"
# require "action_mailer/railtie"
# require "action_mailbox/engine"
# require "ac... | 29.881356 | 79 | 0.731707 |
e84d55f54ab687164720731166f9d16edc48b831 | 1,260 | module Schools
class CoursePolicy < ApplicationPolicy
def index?
# Can be shown to all school admins.
user&.school_admin.present? && user.school == current_school
end
def authors?
record.school == current_school && !record.archived? && index?
end
def show?
record.school =... | 24.705882 | 68 | 0.683333 |
edad049d71671cba81f71ef231d1914790d4432f | 611 | filename = ARGV.first
txt = open(filename)
poly = txt.read.chomp
def react(chain)
new_string = ""
chain.each_char do |current|
new_string+=current
new_string = new_string[0...-2] if new_string[-2]&.swapcase == current
end
new_string
end
current_lowest = poly.size
('a'..'z').each do |char_to_strip|... | 17.970588 | 72 | 0.707038 |
3987bebb124b504821cd3c24eb9a74598ce01090 | 7,962 | # frozen_string_literal: true
require 'spec_helper'
describe Projects::PagesDomainsController do
let(:user) { create(:user) }
let(:project) { create(:project) }
let!(:pages_domain) { create(:pages_domain, project: project) }
let(:request_params) do
{
namespace_id: project.namespace,
project_i... | 28.33452 | 114 | 0.67797 |
aca8ef45255b9d4a659849239b76fff0897a89ae | 1,077 | # http://www.collmex.de/cgi-bin/cgi.exe?1005,1,help,daten_importieren_abw
class Collmex::Api::Cmxepf < Collmex::Api::Line
SPECIFICATION =
[
{ name: :satzart, type: :string, const: "CMXEPF" },
{ name: :kundennummer, type: :integer },
{ name: :firma_nr, type: :integer },
{ name: :dokument_typ, type: :integer... | 33.65625 | 73 | 0.597029 |
edcf673eeae7ad5452719729d88593f901a95241 | 667 | node[:deploy].each do |app_name, deploy|
#Add proxypass entry for blog
ruby_block "add proxypass blog entry" do
Chef::Log.info("modifying #{node[:apache][:dir]}/sites-available/#{app_name}.conf")
block do
rc = Chef::Util::FileEdit.new("#{node[:apache][:dir]}/sites-available/#{app_name}.conf")
p... | 39.235294 | 142 | 0.64018 |
1c9cc8c3b4626ace09d830039f70cd95434291c7 | 31,297 | require "json"
require "timers"
require_relative "../src/rulesrb/rules"
module Engine
class MessageNotHandledError < StandardError
def initialize(message)
super("Could not handle message: #{JSON.generate(message)}")
end
end
class MessageObservedError < StandardError
def initialize(message)
... | 28.297468 | 166 | 0.558169 |
62bc70edfee77d9e7c6586c6dc11f9877a7b4f78 | 995 | require 'spec_helper'
describe Delayed::Worker do
describe "backend=" do
before do
@clazz = Class.new
Delayed::Worker.backend = @clazz
end
it "should set the Delayed::Job constant to the backend" do
Delayed::Job.should == @clazz
end
it "should set backend with a symbol" do
... | 26.184211 | 92 | 0.669347 |
87f48e87e5ead6aca53e4cdd80fea2353d5da436 | 1,034 | # frozen_string_literal: true
class ProGrammar
# @api private
# @since v0.13.0
module ControlDHandler
# Deal with the ^D key being pressed. Different behaviour in different
# cases:
# 1. In an expression behave like `!` command.
# 2. At top-level session behave like `exit` command.
# 3.... | 35.655172 | 78 | 0.690522 |
1cf581e5aa391a2819e3ebcf3a6c4dec9cc27e99 | 2,005 | Shindo.tests('Fog::Compute[:google] | image requests', ['google']) do
@google = Fog::Compute[:google]
@insert_image_format = {
'kind' => String,
'id' => String,
'selfLink' => String,
'name' => String,
'targetLink' => String,
'status' => String,
'user' => String,
'pr... | 23.869048 | 69 | 0.574564 |
b983d8b3ff3a97a39718c47708dc6517d406b701 | 304 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'glossy'
require 'minitest/autorun'
class LessThan5 < Glossy::Base
class << self
def check(id) #return true if row is broken
return id >= 5
end
def fix(id)
print "Sorry boss, no can do. "
end
end
end | 16 | 58 | 0.634868 |
1a7b609ae253e65a215663187e35355c612e7418 | 296 | # Allergy Information
module HL7
module Segment
class AL1 < Base
field :event_type_code
field :allergen_type_code
field :allergen_code
field :allergy_severity_code
field :allergy_reaction_code
field :identification_date, type: DateTime
end
end
end
| 21.142857 | 48 | 0.709459 |
b93272964b76de4c64214961022cd9e14a829824 | 3,014 | require "light_service_object/version"
require "dry/initializer"
require "dry/monads/result"
# frozen_string_literal: true
if defined?(Ensurance)
# Define a dispatcher for `:model` option
rails_dispatcher = ->(ensure: nil, **options) do
# NOTE: This is because 'ensure' is a reserved word in Ruby
klass = b... | 25.116667 | 99 | 0.617452 |
f814a039c9eb1880d7a06d6327587da734897dfd | 289 | require 'spec_helper'
describe "Real World integration" do
it "Lookup should work" do
lookup = MooMoo::Lookup.new
VCR.use_cassette("integration/lookup") do
lookup.api_lookup(:domain => "opensrs.net")
lookup.attributes["status"].should == "taken"
end
end
end | 20.642857 | 51 | 0.681661 |
e9a804fb21ce05457e2f80c640b4725effc6553b | 811 | require "spec_helper"
describe OpenXml::Docx::Properties::TextboxTightWrap do
include ValuePropertyTestMacros
it_should_use tag: :textboxTightWrap, name: "textbox_tight_wrap", value: :none
with_value(:allLines) do
it_should_work
it_should_output "<w:textboxTightWrap w:val=\"allLines\"/>"
end
with_... | 23.852941 | 80 | 0.736128 |
38c47a7ed9a700a43d991f527b10e06975d863cc | 1,242 | require './lib/tlspretense/version'
Gem::Specification.new do |s|
s.name = "tlspretense"
s.version = TLSPretense::VERSION
s.authors = ["William (B.J.) Snow Orvis"]
s.email = "bjorvis@isecpartners.com"
s.date = Time.now.utc.strftime("%Y-%m-%d")
s.homepage = "https://github.com/iSECPartners/tlspretense"
s.... | 35.485714 | 79 | 0.677134 |
ed7649ab0a874c6269cfcae5eed89032f9a5da20 | 76 | require 'final-api/helpers/error_handling'
require 'final-api/helpers/cors'
| 25.333333 | 42 | 0.815789 |
e9e736502844ba0e6dce1693aa6bfa7bba3ebac0 | 10,153 | # -*- coding: binary -*-
require 'msf/core'
module Msf
###
#
# The module base class is responsible for providing the common interface
# that is used to interact with modules at the most basic levels, such as
# by inspecting a given module's attributes (name, dsecription, version,
# authors, etc) and by managing the ... | 28.76204 | 119 | 0.694081 |
381c5e14d33f544f5b835d038caf1a3bcce09329 | 524 | require 'wait_for_solr'
task 'sunspot:solr:start_with_waiting' => :environment do
port = Sunspot::Rails.configuration.port
next puts 'Solr already running' if WaitForSolr.running_on?(port)
puts 'Starting Solr ...'
# is namespaced within app when invoked from the engine repo
task = Rake::Task.task_defined?... | 27.578947 | 109 | 0.723282 |
919786cbccd78bdbb5945dc5f5a98d44c253826d | 1,643 | require_relative '../../spec_helper'
require_relative 'shared/arithmetic_coerce'
describe "Integer#*" do
ruby_version_is "2.4"..."2.5" do
it_behaves_like :integer_arithmetic_coerce_rescue, :*
end
ruby_version_is "2.5" do
it_behaves_like :integer_arithmetic_coerce_not_rescue, :*
end
context "fixnum"... | 31.596154 | 85 | 0.651856 |
2633187690e9f05d774fb4dd115ef4f523cb9345 | 53,560 | #
# Author:: Adam Jacob (<adam@chef.io>)
# Author:: Christopher Walters (<cw@chef.io>)
# Author:: John Keiser (<jkeiser@chef.io)
# Copyright:: Copyright 2008-2016, Chef, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in... | 33.963221 | 184 | 0.649888 |
7a3377a48611cc9ef7fd377d737be60fcc10eb6c | 524 | # frozen_string_literal: true
module TestProf
module TagProf # :nodoc:
# Object holding all the stats for tags
class Result
attr_reader :tag, :data
def initialize(tag)
@tag = tag
@data = Hash.new { |h, k| h[k] = { value: k, count: 0, time: 0.0 } }
end
def track(tag, ... | 18.714286 | 76 | 0.515267 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.