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 |
|---|---|---|---|---|---|
bfeb5a2d097c2c13aa753cd0090b8f05f306522b | 5,955 | class Admin::UsersController < Admin::ApplicationController
before_action :user, except: [:index, :new, :create]
def index
@users = User.order_name_asc.filter(params[:filter])
@users = @users.search_with_secondary_emails(params[:search_query]) if params[:search_query].present?
@users = @users.sort_by_a... | 26.23348 | 112 | 0.665155 |
bf8bcea89246c245918b3f4d6ff75a74a2642b30 | 71 | # frozen_string_literal: true
module Parser
VERSION = '2.7.1.4'
end
| 11.833333 | 29 | 0.71831 |
1d592d22be6b7bed1214507d78e988a8b187b9af | 5,461 | # -------------------------------------------------------------------------- #
# Copyright 2010-2014, C12G Labs S.L. #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# no... | 34.783439 | 98 | 0.537264 |
084f1a7eb25eb51d064d427176fe3facd69ef951 | 2,819 | class Test::Unit::TestCase
def create_table(table_name, &block)
connection = ActiveRecord::Base.connection
begin
connection.execute("DROP TABLE IF EXISTS #{table_name}")
connection.create_table(table_name, &block)
@created_tables ||= []
@created_tables << table_name
connec... | 26.345794 | 77 | 0.686414 |
7a7d8817b58ecb2f51d1f3c842804228d430f6b9 | 3,490 | require_relative "../test_helper"
module SmartAnswer
class CheckboxQuestionTest < ActiveSupport::TestCase
context "specifying options" do
should "be able to specify options, and retreive them in the order specified" do
q = Question::Checkbox.new(nil, :something) do
option :red
o... | 27.698413 | 86 | 0.595702 |
61f3749be208ac5dbec9cc35f042f44e79b3ec9a | 239 | FactoryGirl.define do
factory :profile, class: Profile do
first_name { Faker::Name.first_name }
last_name { Faker::Name.last_name }
date_of_birth { Faker::Date.between(30.years.ago, 10.years.ago) }
user
end
end
| 26.555556 | 69 | 0.677824 |
e9a0d636645802c74af638b5ead48730019a8633 | 534 | Gem.loaded_specs['nyauth'].dependencies.each do |d|
begin
require d.name.gsub('-', '/')
rescue LoadError
require d.name
end
end
module Nyauth
class Engine < ::Rails::Engine
isolate_namespace Nyauth
config.generators do |g|
g.test_framework :rspec, fixture: false
g.fixtu... | 21.36 | 64 | 0.662921 |
e2a863fdb1cc53d361c83e304ba9ce7732b232e8 | 761 | ####################################
# ACTIONS #
####################################
When 'I navigate to home page' do
HomePage.open
end
When 'I force making screenshot and saving source page' do
HomePage.on do
Capybara::Screenshot.screenshot_and_save_page
end
end
#################... | 29.269231 | 78 | 0.545335 |
1ac4c37c779b45c43bbc1e831abc0cf87cc57c31 | 343 | require 'revs'
require_jar 'log4j', 'log4j'
java_import 'com.eventswarm.powerset.NewSetAction'
class AddSet
include Log4JLogger
include NewSetAction
def initialize(&block)
@handler = block
end
def execute(trigger, set, key)
logger.debug "Calling NewSetAction for key #{key}"
@handler.call trigg... | 18.052632 | 54 | 0.725948 |
33dd6bcb17ec2c991f70f18414fa598fdbd57387 | 699 | # frozen_string_literal: true
require 'application_system_test_case'
class Notification::AnswersTest < ApplicationSystemTestCase
setup do
@notice_text = 'komagataさんから回答がありました。'
end
test "recieve a notification when I got my question's answer" do
visit_with_auth "/questions/#{questions(:question2).id}",... | 24.964286 | 72 | 0.729614 |
bb494e8aa6a5a77957d40bbf4228c7e1587034a0 | 1,279 | require_relative 'service'
module AdyenOfficial
class Checkout < Service
DEFAULT_VERSION = 49
def initialize(client, version = DEFAULT_VERSION)
service = 'Checkout'
method_names = [
:payment_methods,
:payment_session
]
super(client, version, service, method_names)
... | 25.078431 | 67 | 0.653636 |
0383cddd5aa42a1b1e7fd145cba32918e68878a2 | 313 | class FixLengthOfTextFields < ActiveRecord::Migration[5.2]
def change
change_column :casino_proxy_tickets, :service, :text, :limit => nil
change_column :casino_service_tickets, :service, :text, :limit => nil
change_column :casino_ticket_granting_tickets, :user_agent, :text, :limit => nil
end
end
| 39.125 | 84 | 0.750799 |
019e43bfd70accb2bd1647874986481607b5bb10 | 112 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'define_private'
require 'minitest/autorun'
| 22.4 | 58 | 0.758929 |
18f63fdf7ae88efb9ddfe49ae6b9804afdd13d31 | 248 | require "openxml/drawingml/properties/paragraph_properties"
module OpenXml
module DrawingML
module Properties
class Level9ParagraphProperties < ParagraphProperties
namespace :a
tag :lvl9pPr
end
end
end
end
| 17.714286 | 59 | 0.717742 |
1ad701e784000dce5c7deaadb1588076a201b1a9 | 113 | class AddWikititleIndexToPages < ActiveRecord::Migration
def change
add_index :pages, :wikititle
end
end
| 18.833333 | 56 | 0.778761 |
6227075306ef3dab0754f8a5a0a5e006718851b9 | 551 | # frozen_string_literal: true
module AsciiDetector
class PatternMatcher
attr_reader :frame, :pattern
def initialize(frame, pattern)
@pattern = pattern
@frame = frame
@matched = 0
end
def call
frame.each_with_index { |item, row, col| match(item, pattern[row][col]) }
mat... | 17.774194 | 79 | 0.637024 |
f8da774764b0a2fad09a0a160a24d13392130ec7 | 707 | # frozen_string_literal: true
unless Rails.env.test?
require 'flamegraph'
require 'rack-mini-profiler'
Rack::MiniProfilerRails.initialize!(Rails.application)
Rack::MiniProfiler.config.position = 'right'
Rack::MiniProfiler.config.skip_schema_queries = true
# set MemoryStore
Rack::MiniProfiler.config.stora... | 35.35 | 113 | 0.759547 |
5d4eba3789ecf13577147bbfd2d4e1180cf71ac0 | 645 | module Telegram
module Bot
module Types
class Poll < Base
attribute :id, String
attribute :question, String
attribute :options, Array[PollOption]
attribute :total_voter_count, Integer
attribute :is_closed, Boolean
attribute :is_anonymous, Boolean
attri... | 29.318182 | 61 | 0.671318 |
abc261c528c40add19fb0a68d10e993e3f5afa3d | 1,833 | #! /usr/bin/env ruby
require 'spec_helper'
describe Puppet::Type.type(:compellent_volume) do
let :resource do
described_class.new(
:name => 'Test_Volume_spec',
:ensure => 'present',
:boot => false,
:volumefolder => '',
:purge => 'yes',
... | 30.04918 | 127 | 0.591926 |
385067b9660cf56830c24cc56026a4af1a924649 | 45 | module SwannViewTool
VERSION = "0.1.0"
end
| 11.25 | 20 | 0.711111 |
e2a8b4d4e379e0a31e566844fb129c7f32571a81 | 1,184 | module ActiveSupport
# This module provides an internal implementation to track descendants
# which is faster than iterating through ObjectSpace.
module DescendantsTracker
@@direct_descendants = Hash.new { |h, k| h[k] = [] }
def self.direct_descendants(klass)
@@direct_descendants[klass]
end
... | 25.73913 | 82 | 0.662162 |
91f6f33ef27dbfb464e323cecd257c601909ba43 | 443 | module MetrcService
module Plant
class Harvest < Base
def call
# allow for harvest of nursery crops - generates clones
return success! if barcodes.empty?
success!
end
private
def transaction
@transaction ||= get_transaction(:harvest_batch)
end
... | 19.26087 | 72 | 0.625282 |
263d3e46a2a85db82f5c6e0d36d96dc483f20acc | 61 | FactoryGirl.define do
factory :sentence do
end
end
| 8.714286 | 22 | 0.688525 |
01a6d3377e8224b52f2805a148367cec22012158 | 1,942 |
# This file is automatically generated by puppet-swagger-generator and
# any manual changes are likely to be clobbered when the files
# are regenerated.
require_relative '../../puppet_x/puppetlabs/swagger/fuzzy_compare'
Puppet::Type.newtype(:kubernetes_node_affinity) do
@doc = "Node affinity is a group of node ... | 39.632653 | 621 | 0.717302 |
e2097768d0a36043dc685bc32e543dc6f13228ee | 1,267 | # Copyright 2015 Google 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 obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | 34.243243 | 83 | 0.732439 |
9146bd12c58e15d6d943e009a72a23a1df4a0ce5 | 415 | module Api
module V1
class MakeAMoveController < ApplicationController
def make_a_move
if(params.has_key?(:board))
current_board = params[:board]
move = MakeAMoveHelper.generate_a_move(current_board)
updated_board = MakeAMoveHelper.update_board(current_board)
... | 25.9375 | 69 | 0.653012 |
01af73ec33f6a2177a5b87fb06c3a19e366bbbf9 | 103 | require 'fog/openstack/requests/volume/accept_transfer'
require 'fog/openstack/requests/volume_v1/real' | 51.5 | 55 | 0.854369 |
e84fcefd35b05bb53e4e8e88ba39d9ae62294212 | 96 | # frozen_string_literal: true
json.partial! 'technologies/technology', technology: @technology
| 24 | 64 | 0.8125 |
87cd5c231b7bebb06d745caa6e50044409a9bbf4 | 126 | module Shrine
class Base < ActiveRecord::Base
self.abstract_class = true
establish_connection SHRINE_DB
end
end
| 15.75 | 34 | 0.746032 |
d5007117c633fcb9f8e33bff9d111de61d90e326 | 836 | require 'test_helper'
class StaticPagesControllerTest < ActionDispatch::IntegrationTest
def setup
@base_title = "Ruby on Rails Tutorial Sample App"
end
test "should get root" do
get root_url
assert_response :success
end
test "should get home" do
get root_path
assert_response :success
... | 22 | 65 | 0.688995 |
26aeb44e5fe1685c93fa21ed4500bdf621f34f83 | 226 | # frozen_string_literal: true
module Computer
module OperatingSystems
module Linux
class ServiceManagementThrowdown < Base
CATEGORIES = %w(Systemd SystemV(init) Upstart).freeze
end
end
end
end
| 18.833333 | 61 | 0.712389 |
11146cdc9354dbd20388899f607a743840395a65 | 57 | module MatchPro
class General < Hashie::Mash
end
end
| 11.4 | 30 | 0.736842 |
286d9a2b2af2a2feffffbab6d790d30c6b08d243 | 304 | class CreateSettings < ActiveRecord::Migration[6.0]
def change
create_table :settings do |t|
t.string :name, null: false
t.string :description
t.string :level, null: false, default: 'site'
t.boolean :locked, null: false, default: true
t.timestamps
end
end
end
| 21.714286 | 51 | 0.651316 |
ed327a7dd000f985356b3157655e739c6fd8af70 | 1,899 | class GitHooks < Formula
desc "Manage project, user, and global Git hooks"
homepage "https://github.com/icefox/git-hooks"
url "https://github.com/icefox/git-hooks/archive/1.00.0.tar.gz"
sha256 "8197ca1de975ff1f795a2b9cfcac1a6f7ee24276750c757eecf3bcb49b74808e"
head "https://github.com/icefox/git-hooks.git"
... | 52.75 | 121 | 0.790943 |
ffe294ba4e3e370e7f3dbd60888078216d03ec07 | 2,199 | class CommitsController < ApplicationController
before_action :set_commit, only: [:show, :edit, :update, :destroy]
# GET /commits
# GET /commits.json
def index
Commit.load(search_params) if search_params.present?
@commits = Commit.all.page params[:page]
end
# GET /commits/1
# GET /commits/1.json... | 25.275862 | 120 | 0.6603 |
87df08ffc9c77b248dd8a4c970e4e2670a091f99 | 1,617 | require "rails_helper"
RSpec.describe Api::OrderDetail do
subject { Api::OrderDetail.new(order_detail) }
let(:expected_hash) { { account: account_hash, ordered_for: ordered_for_hash } }
let(:order) { double(Order, user: ordered_for) }
let(:order_detail) { double(OrderDetail, account: account, order: order, o... | 29.944444 | 98 | 0.588126 |
f87222e7f959bc825a11e03d43b7fc0a2f59d9a9 | 476 | cask 'eclipse-platform' do
version '4.6-201606061100'
sha256 'd8c0b7b970581bbfab047375c0bf44243f5f4e528e950be2313e275451d684b6'
url "http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops#{version.to_i}/R-#{version}/eclipse-SDK-#{version.sub(%r{-.*}, '')}-macosx-cocoa-x86_64.tar.gz&r=1"
na... | 31.733333 | 182 | 0.735294 |
7a5dd2519da7e7d170b0339d62a69a09bd416390 | 5,712 | describe :string_concat, :shared => true do
it "concatenates the given argument to self and returns self" do
str = 'hello '
str.send(@method, 'world').should equal(str)
str.should == "hello world"
end
it "converts the given argument to a String using to_str" do
obj = mock('world!')
obj.should... | 37.333333 | 135 | 0.658613 |
4ac6961eadcb35a51e4192e78ef1ed8adece7ce2 | 1,922 | # encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::Network::Mgmt::V2019_09_01
module Models
#
# Result of on demand test probe.
#
class ApplicationGatewayBackendHealthOnDemand... | 31 | 78 | 0.604579 |
6adfa19ec3eba95f10b0ada5f56b2b451a1f9e34 | 2,319 | # Issues to be mindful of when using this function
# It is coupled to the border styling
# All whitespace is discarded
# Rows containing entirely dashes and/or plusses will be interpretted as the
# beginning of a new row
def parse_text_table(text_table)
cells = parse_cells(text_table)
output_rows = [[]]
cells.ea... | 21.877358 | 77 | 0.661492 |
03986d313808eee9c768f3a52cea3b77dbc8b0d7 | 282 | module Admin::DynamicTemplatesHelper
def preview_of_dt(dt)
case dt.content_type
when "html"
content_tag(:div, dt.content.html_safe, :class => 'content-preview')
when "text"
content_tag(:pre, dt.content, :class => 'content-preview')
end
end
end
| 21.692308 | 74 | 0.663121 |
213e02d141ef0bacddff74e7c9d56c5a2e80b4b7 | 565 | # generated by 'rake generate'
require 'cocoa/bindings/NSObject'
module Cocoa
class CAMediaTimingFunction < Cocoa::NSObject
attach_singular_method :functionWithControlPoints, :args=>4, :names=>[], :types=>["f", "f", "f", "f"], :retval=>"@"
attach_singular_method :functionWithName, :args=>1, :names=>[], :types... | 51.363636 | 119 | 0.640708 |
79f56febb7cdbe5ca1baa7e036f3c54fccf0c6d5 | 627 | # frozen_string_literal: true
RSpec.describe Hyrax::MessengerService do
describe '#deliver' do
let(:sender) { create(:user) }
let(:recipients) { create(:user) }
let(:body) { 'Quite an excellent message' }
let(:subject) { 'IMPORTANT' }
let(:other_arg) { 'Did I make it?' }
it 'invokes Hyrax::Me... | 36.882353 | 89 | 0.701754 |
03511afe7a75c979521d2cf926123df00afe726e | 1,398 | describe Api::V1::AuthorizationScopeSerializer do
subject do
serializer_class.new(model, options).to_json
end
let(:serializer_class) { Api::V1::AuthorizationScopeSerializer }
let(:options) { {root: false} }
context "for expense account" do
let(:model) { build_stubbed :expense_account, name: "Materi... | 34.95 | 95 | 0.703863 |
e8f8dd592d369ce9a42cc711cafad6b9767a4057 | 695 | # frozen_string_literal: true
# Take a signed permanent reference for a variant and turn it into an expiring service URL for download.
# Note: These URLs are publicly accessible. If you need to enforce access protection beyond the
# security-through-obscurity factor of the signed blob and variation reference, you'll n... | 46.333333 | 130 | 0.808633 |
5d4f031cab9802c250fe95aad67778d6931aff6e | 188 | require_dependency 'support/application_record'
module Support
module Cms
class Nav < ApplicationRecord
self.table_name = 'extranet.cms_navs'
audited
end
end
end
| 15.666667 | 47 | 0.723404 |
f8a9ece0c4914d55ddc73082f7ac5c5487b4d6b2 | 181 | RSpec.describe BabyCare do
it "has a version number" do
expect(BabyCare::VERSION).not_to be nil
end
it "does something useful" do
expect(false).to eq(true)
end
end
| 18.1 | 43 | 0.701657 |
acf1e42c7a95ffc436bee4fc7888466d18fbcde7 | 3,298 | # frozen_string_literal: true
require 'hocon'
require 'bolt/error'
module BoltServer
class BaseConfig
def config_keys
%w[host port ssl-cert ssl-key ssl-ca-cert
ssl-cipher-suites loglevel logfile allowlist projects-dir]
end
def env_keys
%w[ssl-cert ssl-key ssl-ca-cert loglevel]
... | 29.711712 | 108 | 0.578836 |
f83da1277466e5b5760d00cfb4c26107fc647bb9 | 285 | # frozen_string_literal: true
require 'rails_helper'
require 'lib/saved_claims_spec_helper'
RSpec.describe SavedClaim::EducationBenefits::VA1990e do
let(:instance) { FactoryBot.build(:va1990e) }
it_should_behave_like 'saved_claim'
validate_inclusion(:form_id, '22-1990E')
end
| 23.75 | 56 | 0.796491 |
ab3de2178a8ff687437a16c59f39ef3160487eb9 | 3,329 | require 'active_support'
require 'active_support/testing/autorun'
require 'platform_agent'
class BasecampAgent < PlatformAgent
def ios_app?
match? /BC3 iOS/
end
def android_app?
match? /BC3 Android/
end
def mac_app?
match?(/Electron/) && match?(/basecamp3/) && match?(/Macintosh/)
end
def ... | 36.184783 | 226 | 0.717333 |
61317376931b1714dd00ae0677e63f560e458872 | 826 | Pod::Spec.new do |s|
s.name = "TBCacaoIOS"
s.version = "0.0.2"
s.summary = "Small and simple dependency injection framework for iOS"
s.description = <<-DESC
TBCacaoIOS is a small and simple dependency injection framework for Objective-C. It is the iOS version of TBCacao fo... | 39.333333 | 142 | 0.585956 |
abaf3c1cda7256d6c903355a5af96833204c8c81 | 172 | class CreateUsers < ActiveRecord::Migration[5.1]
def change
create_table :users do |t|
t.string :name
t.string :uid
t.timestamps
end
end
end
| 15.636364 | 48 | 0.633721 |
917fadbd7e095452e9a00c68096e81d580487613 | 1,285 | # -*- encoding: utf-8 -*-
# stub: jekyll-theme-dinky 0.1.0 ruby lib
Gem::Specification.new do |s|
s.name = "jekyll-theme-dinky".freeze
s.version = "0.1.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors... | 36.714286 | 112 | 0.661479 |
6a9dbc1ec36b20ae78efbaf5063988530aaafab2 | 5,132 | # frozen_string_literal: true
require 'psych/helper'
module Psych
module Visitors
class TestYAMLTree < TestCase
class TestDelegatorClass < Delegator
def initialize(obj); super; @obj = obj; end
def __setobj__(obj); @obj = obj; end
def __getobj__; @obj if defined?(@obj); end
end... | 25.919192 | 592 | 0.589049 |
f80731ccee515a3d0840ba91d52cd687a66aa75f | 324 | module Rasti
module Web
class ViewContext
attr_reader :request, :response
def initialize(request, response)
@request = request
@response = response
end
def render(template, locals={}, &block)
Template.render template, self, locals, &block
end
end
end... | 18 | 54 | 0.617284 |
bb913d8a0ee195fbc7c166c6a57010d75af8c4dc | 835 | cask "macpass" do
version "0.7.12"
sha256 "acde7f51fd0b6529553e1e4ad4a7cbc137096bd355987bb5f4fb869f578f33be"
# github.com/MacPass/MacPass/ was verified as official when first introduced to the cask
url "https://github.com/MacPass/MacPass/releases/download/#{version}/MacPass-#{version}.zip"
appcast "https://g... | 34.791667 | 94 | 0.752096 |
26dd91944fbe8afd8cafb75f08164c569283e93b | 253 | # frozen_string_literal: true
class AlterReplyKeyOnEmailLogs < ActiveRecord::Migration[5.2]
def up
change_column :email_logs, :reply_key, 'uuid USING reply_key::uuid'
end
def down
change_column :email_logs, :reply_key, :string
end
end
| 21.083333 | 71 | 0.750988 |
621f14c4d069cb3fd7d504471a1842f194c34363 | 2,023 | # frozen_string_literal: true
require 'rails_helper'
require "#{Rails.root}/spec/shared_contexts/eligibilities/magi_medicaid_application_data.rb"
RSpec.describe ::MitcService::CallMagiInTheCloud do
include Dry::Monads[:result, :do]
include_context 'setup magi_medicaid application with two applicants'
let(:mitc... | 32.111111 | 131 | 0.705388 |
217d55b5e861a48fa72766d3200c9cfd796a77f0 | 1,131 | require 'faraday'
module Smsc
# Custom error class for rescuing from all Smsc errors
class Error < StandardError; end
# Main class for client errors
class ClientError < Error; end
# Raised when Smsc return error with status code 1, 7
class BadRequest < ClientError; end
# Raised when Smsc return error ... | 28.275 | 56 | 0.753316 |
f84a1a8ba346d8800e4c539f9992542604c7db7c | 253 | module ApplicationHelper
# Returns the full title on a per-page basis.
def full_title(page_title = '')
base_title = "Budget Tracking App"
if page_title.empty?
base_title
else
page_title + " | " + base_title
end
end
end
| 21.083333 | 47 | 0.660079 |
4a64e64c55484564c3af20af11bbec381ee6cd37 | 952 | class SessionsController < ApplicationController
def create
@user = User.find_by(username: params[:userDetails][:username])
if @user && @user.authenticate(params[:userDetails][:password])
render json: @user, status: 200
else
render json: {message: "Unable to login with that username and passw... | 28.848485 | 104 | 0.668067 |
91a2d94dde8b2cde957e0f698fcebc191112f418 | 80 | class TopicSerializer
include FastJsonapi::ObjectSerializer
attributes
end
| 16 | 39 | 0.8375 |
1a6eea73c5656105e8bdcecf87cb582f63902cee | 1,236 | # frozen_string_literal: true
require 'forwardable'
require 'multi_json'
require 'rubycent/version'
require 'rubycent/client'
require 'rubycent/request'
require 'rubycent/error'
require 'rubycent/errors/network_error'
require 'rubycent/errors/request_error'
require 'rubycent/errors/response_error'
# Rubycent
#
# ... | 23.320755 | 77 | 0.661812 |
21c5df060c38c1e973bfa41e0d90510f7806f239 | 22,500 | require "open3"
require "optparse"
require "shellwords"
module RBS
class CLI
class LibraryOptions
attr_accessor :core_root
attr_reader :repos
attr_reader :libs
attr_reader :dirs
def initialize()
@core_root = EnvironmentLoader::DEFAULT_CORE_ROOT
@repos = []
... | 27.141134 | 129 | 0.594622 |
01bb04b92d7010d5d40423dfcd11f857d5da8425 | 945 | class UsersController < ApplicationController
get '/signup' do
erb :"/users/signup"
end
post '/signup' do
@user = User.create(:username => params[:username], :email => params[:email], :password => params[:password])
if @user.valid?
redirect '/login'
else
... | 21.477273 | 117 | 0.522751 |
d54ee6aaa91d0de31cecbc2dd925205933611c4f | 2,497 | require "test_helper"
require "fileutils"
require "time"
context "The file-based backend" do
setup do
@soup = Soup.new(Soup::Backends::FileBackend.new(@base_path))
end
should "parse attributes from lines starting with colon" do
write_snip "snip", %{
Here is the content
of the snip
:name: thing
:render_... | 28.701149 | 106 | 0.674009 |
91443edefcd86c7d1109c27280af70f355608c28 | 1,437 | # encoding: utf-8
describe ROM::Cassandra::Migrations::Migration do
let(:migration) { described_class.new session }
let(:session) { double :session, call: nil, freeze: nil }
describe "#session" do
subject { migration.session }
it { is_expected.to eql session }
end # describe #session
describe "... | 23.95 | 79 | 0.662491 |
4a70e6156f389933fc96b378b355ba93fd6cf628 | 116 | class AddAdminToUsers < ActiveRecord::Migration[5.2]
def change
add_column :users, :admin, :integer
end
end
| 19.333333 | 52 | 0.732759 |
26773aedeca72ecbc8eec939d29851f658ea0b3f | 1,485 | #-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2015 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of ... | 39.078947 | 91 | 0.777104 |
61db57cd9f8bdfb42b6dbdc5c8b554f4f6f1d0f9 | 127 | require 'rails_helper'
RSpec.describe MusicUser, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end
| 21.166667 | 56 | 0.748031 |
39d22b449006e476a5584667f28c71a5e7d51c7d | 2,968 | # This file is copied to spec/ when you run 'rails generate rspec:install'
require 'spec_helper'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../config/environment', __dir__)
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rails.en... | 43.647059 | 86 | 0.75438 |
bb1a3456a5bf737958eac3be430292abba5660e4 | 1,621 | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}VisibilityHandler" do
before(:all) { parse_file :visibility_handler_001, __FILE__ }
it "is able to set visibility to public" do
expect(Registry.at("Testing#pub"... | 36.022222 | 93 | 0.726712 |
f790c50dc317b7b07024411a1d2fcb2b29fc71af | 945 | require_relative '../bodies/body.rb'
require_relative '../bodies/fixture.rb'
class Contact
attr_reader :obj_1
attr_reader :obj_2
attr_accessor :first #boolean for first contact or not
def initialize(obj_1, obj_2)
raise ArgumentError.new("Objects passed to contact must be of the same type!") un... | 35 | 122 | 0.646561 |
331c9c0a42a70016bfc0b4de83dd40151134c2d3 | 179 | # name - string
# archive_number - string
# archived_at - datetime
class ArchivalTableName < ActiveRecord::Base
self.table_name = "legacy"
archival_record
end
| 16.272727 | 44 | 0.698324 |
1d23b3f7815e1339fd60922365d6ee128b8d0a00 | 8,815 | # encoding: utf-8
require_relative '../spec_helper'
include Warden::Test::Helpers
include Carto::Factories::Visualizations
def login(user)
login_as(user, scope: user.username)
host! "#{user.username}.localhost.lan"
end
def follow_redirects(limit = 10)
while response.redirect? && (limit -= 1) > 0
follow_red... | 34.433594 | 114 | 0.607714 |
26f48ef585146185ec9a016b6e5105805d98647e | 3,675 | require "language/perl"
class Kpcli < Formula
include Language::Perl::Shebang
desc "Command-line interface to KeePass database files"
homepage "https://kpcli.sourceforge.io/"
url "https://downloads.sourceforge.net/project/kpcli/kpcli-3.4.pl"
sha256 "403e5d73cc4685722a5e4207c5fcbdad8e30475434cfba151c095e13a2... | 33.715596 | 93 | 0.722721 |
ab9a0c778d239b118a72229dfeb3c26cef74c6ab | 6,678 | # frozen_string_literal: true
require "rails_helper"
RSpec.describe DelegatesController, type: :controller do
let(:delegate) { FactoryBot.create :staff_profile }
let(:valid_attributes) { { delegate_id: delegate.id } }
let(:invalid_attributes) { { delegate_id: "blah" } }
let(:valid_session) { {} }
let(:use... | 40.969325 | 93 | 0.697215 |
08254ce1f20aa69854917a6a224c73a7dcd7e3fa | 3,510 | #! /usr/bin/env ruby
require 'spec_helper'
require 'yaml'
require 'puppet/provider/vcenter'
require 'rbvmomi'
provider_path = Pathname.new(__FILE__).parent.parent.parent.parent
describe Puppet::Type.type(:esx_mem).provider(:esx_mem) do
integration_yml = File.join(provider_path, '/fixtures/integration/... | 39.438202 | 87 | 0.645014 |
214c985d58755496e18b63cffb795b2e8c00f85a | 319 | ######################
# Topology template file
##########
['topology.properties'].each do |file|
template "#{node['mso_config_path']}#{file}" do
source "mso-topology-config/#{file}"
owner "jboss"
group "jboss"
mode "0744"
variables(
:var => node["mso-config"]["topology"]
)
end
end
| 21.266667 | 49 | 0.548589 |
f7c32f952fd992cfd478a6a376b0d49907ed84ca | 1,379 | class CrossHatchHeuristic
def initialize(puzzle_cell_intelligence)
@candidates = puzzle_cell_intelligence
end
def execute(puzzle, cell)
find_naked_singles(cell, puzzle)
find_hidden_singles(cell, puzzle)
end
private
def find_naked_singles(cell, puzzle)
candidates = @candidates.cell(puzzle,... | 28.142857 | 89 | 0.683829 |
e91c0113004d8d779025aef2358cf3fa72ec6dd8 | 4,821 | module Runners
module Ruby
class InstallGemsFailure < UserError; end
def install_gems(default_specs, constraints:, optionals: [], &block)
original_default_specs = default_specs.dup
user_specs = config_gems
LockfileLoader.new(root_dir: root_dir, shell: shell).ensure_lockfile do |lockfile|
... | 31.509804 | 121 | 0.577681 |
11533ab780119a51f47e18993351cfd84f65f97f | 1,828 | #
# Cookbook Name:: universe_ubuntu
# Recipe:: essentials
#
# Copyright (c) 2017 The Authors, All Rights Reserved.
include_recipe 'apt::default'
apt_repository 'add golang latest repo' do
uri 'ppa:ubuntu-lxc/lxd-stable'
only_if { node['platform_version'] == '14.04' }
end
ruby_block 'Allow non root users start th... | 30.466667 | 95 | 0.624726 |
037a710e180b83e69ddb1ee45b4feabd75af2c90 | 68 | # frozen_string_literal: true
module Split
VERSION = "4.0.1"
end
| 11.333333 | 29 | 0.720588 |
4ab83b1326548528a00be5b2d5d203fb9a738f12 | 128 | module Workspace::EmployeesHelper
def full_name(employee)
"#{employee.first_name} #{employee.last_name}"
end
end
| 14.222222 | 52 | 0.710938 |
1c73325e1cf66c517d29eee951db91963c8bb493 | 802 | # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = "msgpack"
s.version = "0.4.6"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["FURUHASHI Sadayuki"]
s.date = "2011-08-08"
s.email = "frsyuki@users.sourceforge.jp"
s.exten... | 27.655172 | 105 | 0.667082 |
114b7cb3066a34f774da5b1c40b4c977f25fb8c8 | 2,107 | class AwscliAT1 < Formula
include Language::Python::Virtualenv
desc "Official Amazon AWS command-line interface"
homepage "https://aws.amazon.com/cli/"
# awscli should only be updated every 10 releases on multiples of 10
url "https://github.com/aws/aws-cli/archive/1.19.90.tar.gz"
sha256 "041a0c58dc8065284d... | 33.444444 | 122 | 0.705268 |
61b06b4df5bf78b04a9f7fe4557098c6b7c54526 | 1,891 | # CLI controller
class CLI
def call
Scraper.scrape_colleges if @colleges == nil
welcome
end
def welcome
input = nil
while input != "exit"
puts "Welcome, to see a list of colleges and universities in the state of Illinois type 'list', or type 'exit' to exit the program:"
input = gets... | 29.546875 | 156 | 0.634585 |
9146373dde33f440c9c1b428cac274300a401ea9 | 485 | # frozen_string_literal: true
require 'test_helper'
class Memberships::SwitchControllerTest < ActionController::TestCase
setup do
@membership = send 'public.memberships', :franco_default
login
end
test 'should create' do
post :create, params: { membership_id: @membership }
assert_redirected_t... | 24.25 | 71 | 0.760825 |
21f479026a8b0e47135efcd322b975ce7664865b | 886 | module MouseHole::Helpers
def rss( io )
feed = Builder::XmlMarkup.new( :target => io, :indent => 2 )
feed.instruct! :xml, :version => "1.0", :encoding => "UTF-8"
feed.rss( 'xmlns:admin' => 'http://webns.net/mvcb/',
'xmlns:sy' => 'http://purl.org/rss/1.0/modules/syndication/',
'xmlns:d... | 35.44 | 82 | 0.547404 |
1d0427ddae57ad94025ff4eb478f77224c89fe38 | 2,453 | module HealthSeven::V2_5
class Rxg < ::HealthSeven::Segment
# Give Sub-ID Counter
attribute :give_sub_id_counter, Nm, position: "RXG.1", require: true
# Dispense Sub-ID Counter
attribute :dispense_sub_id_counter, Nm, position: "RXG.2"
# Quantity/Timing
attribute :quantity_timing, Tq, position: "RXG.3"
# G... | 43.803571 | 125 | 0.747248 |
e2b928b9121e296a23dbd7e073ee06115f9db804 | 1,427 | # frozen_string_literal: true
module Node
class Command
class Serve < ShopifyCli::SubCommand
prerequisite_task ensure_project_type: :node
prerequisite_task :ensure_env, :ensure_dev_store
options do |parser, flags|
parser.on("--host=HOST") do |h|
flags[:host] = h.gsub('"', "")
... | 30.361702 | 100 | 0.599159 |
ed31740d22b4b56fbf0730d267bc8ed44ee23cf6 | 216 | class CreateSites < ActiveRecord::Migration
def change
create_table :sites do |t|
t.string :url
t.string :name
t.string :username
t.string :logo_url
t.timestamps
end
end
end
| 18 | 43 | 0.634259 |
e8356070f131858150e710001eb95c44fb620ed4 | 624 | require "spec_helper"
MetricFu.lib_require { "templates/report" }
describe MetricFu::Templates::Report do
# TODO: This test only shows how the code works and that it doesn't blow up.
# Perhaps it should test something more specific?
it "Reads in a source file, and produces an annotated HTML report" do
lines ... | 39 | 89 | 0.703526 |
b967174ddfd9b857af3fb6b30720a1c91256164d | 152 | # frozen_string_literal: true
class AddUserToEntries < ActiveRecord::Migration[4.2]
def change
add_column :entries, :user_id, :integer
end
end
| 19 | 53 | 0.756579 |
7af47c35013036b04a40a2d0eabc9f5d1b17a338 | 977 | module WechatAuthorize
class << self
attr_accessor :config
def configure
puts "= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = init configure"
yield self.config ||= Config.new
end
def weixin_redis
return nil if config.nil?
@redis ||= config.redis
end
... | 26.405405 | 155 | 0.646878 |
5d73fafd425e41fbb955b7bad98bf6645d9999c2 | 703 | # frozen_string_literal: true
require_relative 'test_helper'
class TestFakerSimpsons < Test::Unit::TestCase
def setup
Faker::Config.locale = nil
end
def test_characters
10.times { assert Faker::Simpsons.character.match(/[\w]+/) }
end
def test_locations
10.times { assert Faker::Simpsons.locatio... | 22.677419 | 64 | 0.672831 |
bf731e11d57dfc67b8df17227a68994509beba65 | 8,213 | # frozen_string_literal: true
require 'test_helper'
module Vedeu
module DSL
describe Wordwrap do
let(:described) { Vedeu::DSL::Wordwrap }
let(:instance) { described.new(text, options) }
let(:text) { '' }
let(:mode) { :default }
let(:_name) {}
let(:width) ... | 28.517361 | 79 | 0.505905 |
4af18b77677e0c5a37be96b7c05def4ec74fd758 | 212 | class ApplicationController < ActionController::Base
protect_from_forgery prepend: true, with: :exception
def ensure_admin
redirect_to projects_path if !current_user || !current_user.is_admin?
end
end
| 26.5 | 73 | 0.79717 |
28ac752f55029b1615ecc5e9c1022a18109623a6 | 6,922 | # frozen_string_literal: true
module Emails
module MergeRequests
def new_merge_request_email(recipient_id, merge_request_id, reason = nil)
setup_merge_request_mail(merge_request_id, recipient_id, present: true)
mail_new_thread(@merge_request, merge_request_thread_options(@merge_request.author_id, re... | 44.948052 | 140 | 0.775065 |
1c235c1d2fdd26725173cafe7667adf2eb9c03f7 | 1,794 | # typed: true
# frozen_string_literal: true
require "thor"
require_relative 'cli/helper'
require_relative "cli/bump"
require_relative "cli/config"
require_relative "cli/lsp"
require_relative "cli/coverage"
require_relative "cli/run"
module Spoom
module Cli
class Main < Thor
extend T::Sig
include H... | 26 | 104 | 0.632664 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.