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 |
|---|---|---|---|---|---|
3838d573563187be9011bc067830ee04fee06ac8 | 6,102 | require 'spec_helper'
describe Puppet::Type.type(:st2_pack).provider(:default) do
let(:name) { 'rspec st2_pack test' }
let(:attributes) { {} }
let(:resource) do
Puppet::Type.type(:st2_pack).new(
{
name: name,
provider: :default,
user: 'st2_user',
password: 'st2_password'... | 35.894118 | 109 | 0.460013 |
d505a44e74ae7aebb46190b53373214a938d7dfe | 4,743 | # frozen_string_literal: true
module Spree
class TaxRate < Spree::Base
include Spree::SoftDeletable
# Need to deal with adjustments before calculator is destroyed.
before_destroy :remove_adjustments_from_incomplete_orders
before_discard :remove_adjustments_from_incomplete_orders
include Spree::... | 32.486301 | 135 | 0.664347 |
e825ef454f80c0dd1a9392795f66593ff7c4db03 | 301 | Rails.application.configure do
# http://guides.rubyonrails.org/active_job_basics.html#backends
config.active_job.queue_adapter =
if Rails.env.test?
:inline
elsif defined?(SuckerPunch)
:sucker_punch
else
:inline # no asynchronous background job processing
end
end
| 25.083333 | 65 | 0.72093 |
797fa39701bea41ee29773c630e275d551db1908 | 1,530 | #!/usr/bin/env ruby
# Copyright (c) 2009 Cory Ondrejka. All rights reserved.
# See License.txt for licensing details.
require "#{File.dirname(__FILE__)}/../../../lib/rubyflashbake/core"
require "#{File.dirname(__FILE__)}/../../../lib/rubyflashbake/plugins/weather"
describe RubyFlashbake do
it "should get wea... | 37.317073 | 111 | 0.647712 |
e20382dfc23b4dd4798ef46d5bc22dc0d2eb7c0e | 88 | require 'minitest/autorun'
require 'mocha/setup'
require 'pry'
require 'scout_realtime'
| 17.6 | 26 | 0.795455 |
6131c5530994a1fdfd7b61eaa755f769f4f189b7 | 427 | # Option combination generator.
# Copyright (c) 2019 AUTHORS, MIT License.
require "minitest"
require "minitest/autorun"
module Minitest
Minitest.module_eval do
class << self
def <<(klass)
Runnable.runnables << klass unless Runnable.runnables.include? klass
nil
end
end
end
R... | 20.333333 | 76 | 0.700234 |
38dfd8730d3b8988f491c1338d40e4be86935f70 | 1,515 | #
# Copyright:: Copyright 2013-2016, Chef Software 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 compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-... | 28.055556 | 90 | 0.711551 |
f7e86479a85e3b3af07ad7fad3323f161a808512 | 592 | #
# Cookbook Name:: bs-hardening::create_user
# Recipe:: default
#
# Copyright 2015, GSSC C.A
#
# All rights reserved - Do Not Redistribute
#
node['groups'].each do|d|
group d do
action :create
#gid group_id
end
end
node['users_admin'].each do|d|
group d do
action :create
#gid... | 14.095238 | 43 | 0.621622 |
1db9735391d6d0684b776e0251f7e6c6d5aa09b9 | 142 | require "test_helper"
class ActivitiesControllerTest < ActionDispatch::IntegrationTest
# test "the truth" do
# assert true
# end
end
| 17.75 | 64 | 0.746479 |
180a71eb0247630bbfe9e1f70a20e885d45ba237 | 3,485 | require 'test_helper'
class FollowJobTest < ActiveSupport::TestCase
def instagram_identity
instagram_identities :default
end
def global_rate_limit
instagram_identity.rate_limits.global.first
end
def hashtag
hashtag = hashtags :default
hashtag.update_attributes!(auto_follow_on: true)
has... | 32.570093 | 98 | 0.736585 |
ac8c8b2b3a59d75cbdc9e6323b9d7038fec2220c | 444 | cask "flying-carpet" do
version "3.0"
sha256 "a38cb60ee732412d03c0372f1b1b3cc46cb83e94f33961c6f677afb4f71d4aaf"
url "https://github.com/spieglt/FlyingCarpet/releases/download/#{version}/Flying.Carpet.Mac.zip"
appcast "https://github.com/spieglt/flyingcarpet/releases.atom"
name "Flying Carpet"
desc "Cross-p... | 34.153846 | 98 | 0.779279 |
1ab629dd724f46282cbee7763d2998c0865c3977 | 380 | cask 'intellij-idea-12-1' do
version '12.1.8,129.1561'
sha256 '94c2854635f6cfa077de4e3cc71b63242fb652e8c0ef8f6f999e9089eb83d33a'
url "https://download.jetbrains.com/idea/ideaIU-#{version.before_comma}.dmg"
name 'IntelliJ IDEA Ultimate'
homepage 'https://www.jetbrains.com/idea/'
auto_updates true
app 'I... | 27.142857 | 78 | 0.757895 |
b99361d82c08324b3485d1a43f7db444a3c45b26 | 998 | # 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.
#
# This file is the source Rails uses to define your schema when running `rails
#... | 36.962963 | 86 | 0.759519 |
6a545884f180c755c2365c54a0b5cf8a80b81cb8 | 67,938 | # frozen_string_literal: true
# encoding: utf-8
require "spec_helper"
class FieldWithSerializer
def evolve(object)
Integer.evolve(object)
end
def localized?
false
end
end
describe Mongoid::Criteria::Queryable::Selectable do
let(:query) do
Mongoid::Query.new("id" => "_id")
end
shared_exam... | 23.721369 | 105 | 0.517413 |
18413af9f25867dc7f9ac5e0a55f6101afbaa4fb | 983 | require 'test_helper'
class UsersControllerTest < ActionController::TestCase
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:users)
end
test "should get new" do
get :new
assert_response :success
end
test "should create user" do
assert_differenc... | 21.369565 | 58 | 0.672431 |
5dbd0817399e31906b64546f6125ab59046e6caa | 702 |
Pod::Spec.new do |s|
s.name = 'firstPod'
s.version = '0.1.0'
s.summary = 'This library gives you a blinking label . Subclass of UILabel.'
s.description = 'This CocoaPod provides the ability to use a UILabel that may be started and stopped blinking.'
s.homepage = 'ht... | 46.8 | 118 | 0.598291 |
f732236341cd2b0ec53ef4dd196045a3b28fc6a4 | 604 | class Export < ActiveRecord::Base
belongs_to :user
enum file_type: [:ttl, :nt, :xml]
validates_presence_of :default_namespace
before_destroy :delete_dump_file
def finish!(messages)
self.output = messages
self.success = true
self.finished_at = Time.now
save!
end
def fail!(exception)
... | 18.30303 | 74 | 0.688742 |
62a0818e0b50c31f4cf7e41be7d5f3bfd1e9152f | 996 | # 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.
#
# This file is the source Rails uses to define your schema when running `rails
#... | 36.888889 | 86 | 0.759036 |
18f0e12c5acf2d50275b1ff16819c294be7438b2 | 229 | class CreateArticles < ActiveRecord::Migration
def change
create_table :articles do |t|
t.string :title
t.string :body
t.belongs_to :group
t.belongs_to :customer
t.timestamps
end
end
end
| 19.083333 | 46 | 0.655022 |
5db3833b10be0e8e947fde6941c25d85073cea8d | 127 | require 'test_helper'
class EntrezSynonymTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| 15.875 | 49 | 0.716535 |
61475a9d1e117554d69e16e68d8d73bc49b28e79 | 1,386 | require "spec_helper"
describe ProjectsMailer do
it "should send project, with HTML-safe fields and converting new lines to <br>" do
how_much_you_need = "1000 <javascript>"
days = "12"
category = "art <javascript>"
about = "About the project\n<javascript>"
rewards = "Rewards of the project\n<java... | 47.793103 | 221 | 0.692641 |
f819037fac39a1135e6919641bdfed54a531bb27 | 2,457 | require 'test_helper'
class SearchTermsTest < ActiveSupport::TestCase
TEST_CASES = {
'simple' => ['foo', 'foo', {}],
'simple_field' => ['one:two', '', { 'one' => 'two' }],
'quotes' => [%(foo:"quoted value"), '', { 'foo' => 'quoted value' }],
'term_with_period' => ['1.5', '1.5', {}],
'multiple_fie... | 54.6 | 139 | 0.559626 |
28c7524de130e2a2f534817a9e07de1abf1db9ec | 2,077 | # encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
require 'helper'
require 'inspec/resource'
describe 'Inspec::Resources::AptRepo' do
it 'check apt on ubuntu' do
resource = MockLoader.new(:ubuntu1504).load_resource('apt', 'http://archive.ubuntu.com/ubuntu/')
_(resource.exists?).must_... | 31.953846 | 100 | 0.709677 |
7a4356fb18c8df64f18c9e11bc15f6b4aff5c635 | 662 | # encoding: UTF-8
require 'spec_helper'
require 'yt/collections/channels'
describe Yt::Collections::Channels, :device_app, :vcr do
subject(:channels) { Yt::Collections::Channels.new auth: test_account }
context 'with a list of parts' do
let(:part) { 'statistics' }
let(:channel) { channels.where(part: part... | 34.842105 | 86 | 0.729607 |
62906624a214969c278e92cae1297be7fc8db319 | 370 | class EnsurePlatformUniqueness < ActiveRecord::Migration
def up
add_index :supported_platforms, [:name, :version_constraint], unique: true
remove_column :supported_platforms, :cookbook_version_id
end
def down
add_column :supported_platforms, :cookbook_version_id, :integer
remove_index :supported_... | 30.833333 | 78 | 0.783784 |
1cd0e81f8d3e530fc242ab06e94a5ddcc3469960 | 1,005 | #Ruby Filter source for Combine value to One string
#06.08.21 zeraf29
#You can use this by calling on Logstash ruby filter
#example call ruby filter on logstash
#filter {
# ruby {
# path => "/etc/logstash/drop_percentage.rb"
# script_params => {
# "max_run" => 10
# "target_even... | 27.916667 | 96 | 0.618905 |
399aa94d1ac84f33478ef2674bc5b7ce31ec5762 | 2,771 | Rails.application.routes.draw do
root 'items#index'
defaults format: 'json' do
get 'health', to: 'health#index'
end
# Omniauth automatically handles requests to /auth/:provider. We need only
# implement the callback.
get '/login', to: 'sessions#new', as: :login
get '/logout', to: 'sessions#destroy',... | 48.614035 | 130 | 0.699747 |
6ab211d1995a0a0ebb7c12aeda770eeddf130e87 | 250 | class CreateConquestWarriorSpecialties < ActiveRecord::Migration[5.1]
def change
create_table :conquest_warrior_specialties do |t|
t.integer :warrior_id
t.integer :type_id
t.integer :slot
t.timestamps
end
end
end
| 20.833333 | 69 | 0.708 |
62cb93fe1ab5b9669ad7dc955bfdf05b719ffe41 | 64 | json.partial! "individuals/individual", individual: @individual
| 32 | 63 | 0.8125 |
872dd263499f02762c47b4622342670ebc7739d0 | 3,196 | # frozen_string_literal: true
RSpec.describe PriceHubble::ValuationRequest do
let(:instance) { build(:valuation_request) }
before { Timecop.freeze(2019, 10, 16, 12, 0, 0) }
after { Timecop.return }
describe 'attributes' do
context 'without sanitization' do
let(:expected) do
{
'de... | 28.535714 | 79 | 0.597309 |
6aeabd3da847cd860dde1d0262cf57a478b747fb | 196 | Rails.application.routes.draw do
get 'health_check', to: 'health_check#index'
root 'health_check#index'
post 'dns_records', to: 'records#create'
get 'dns_records', to: 'records#index'
end
| 28 | 46 | 0.734694 |
1dba7aa9b12a19875636a1b4857f8180677f02a1 | 2,524 | ##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# web site for more information on licensing and terms of use.
# http://metasploit.com/
##
require 'msf/core'
require 'rex'
require 'rexml/document'
class Metasploit3 < M... | 26.851064 | 84 | 0.597861 |
bb5d5575932d6f298278bf053923644c824568e6 | 1,181 | # these tests are a little concerning b/c they are hacking around the
# modulepath, so these tests will not catch issues that may eventually arise
# related to loading these plugins.
# I could not, for the life of me, figure out how to programatcally set the modulepath
$LOAD_PATH.push(
File.join(
File.dirname(__F... | 31.078947 | 86 | 0.685859 |
e22d14bdc397b27e3bd309d8d36cdf8f1290673f | 1,157 | require 'faraday'
require 'oga'
require 'logger'
module Iibee
class Broker
CONTEXT_PATH = "/apiv1/properties/"
attr_reader :AdminSecurity, :version, :name, :runMode, :shortDesc, :longDesc,
:platformName, :FixpackCapability, :platformArchitecture, :platformVersion, :operationMode, :buildLevel, :AdminAge... | 31.27027 | 139 | 0.675022 |
e95725c29120de159ed709b752b56b2fd64c5d10 | 155 | require 'spec_helper'
RSpec.describe ActiveRecordUpsert do
it 'has a version number' do
expect(ActiveRecordUpsert::VERSION).not_to be nil
end
end
| 19.375 | 53 | 0.774194 |
08e71fe95754fb4c2b2045547ddce0952d23d107 | 1,560 | require 'mongoid/cenit_extension'
module Setup
module CenitUnscoped
extend ActiveSupport::Concern
include Mongoid::CenitDocument
include Mongoid::Timestamps
include Mongoid::CenitExtension
include DateTimeCharts
included do
Setup::Models.regist(self)
end
def copy_hash
s... | 21.971831 | 84 | 0.639744 |
e8ceabaeba86398b40a1de8d0c577c7153ab8862 | 4,697 | module ActiveJob
# == Active Job adapters
#
# Active Job has adapters for the following queueing backends:
#
# * {Backburner}[https://github.com/nesquena/backburner]
# * {Delayed Job}[https://github.com/collectiveidea/delayed_job]
# * {Qu}[https://github.com/bkeepers/qu]
# * {Que}[https://github.com/cha... | 36.695313 | 90 | 0.592932 |
4ab6ba32b9f49e012a621c62d0a26d175795c124 | 1,935 | require 'rails_helper'
# So specs will run and not throw scary errors before SessionsController is implemented
begin
SessionsController
rescue
SessionsController = nil
end
RSpec.describe SessionsController, :type => :controller do
let!(:user) { User.create({username: "jack_bruce", password: "abcdef"}) }
desc... | 29.769231 | 87 | 0.669767 |
f8d84bd5e8617b20827bf9981b00f5be0fcbd4cf | 1,453 | desc 'Install project into INSTALL_DIR'
task :install => %i(compile
install:pre
install:main
install:post)
namespace :install do
task :pre
task :post
task :main
end
desc 'Create build artifacts, e.g., deployable archives & packages'
task :artifacts => ... | 31.586957 | 133 | 0.646249 |
62c9153f5750623fbcdac06ee61b55377421eb03 | 117 | class Material < ApplicationRecord
has_many :compositions
has_many :restored_objects, through: :compositions
end
| 23.4 | 52 | 0.820513 |
1acc000e03c5c4475c91013b8af7d6a353219d2d | 1,410 | Pod::Spec.new do |s|
s.name = "OptimizelySDKShared"
s.version = "1.3.1"
s.summary = "Optimizely server-side testing shared framework."
s.homepage = "http://developers.optimizely.com/server/reference/index.html?language=objectivec"
s.license ... | 54.230769 | 121 | 0.589362 |
337e71e49ac2b2a0b2d2a4f6fc8609024de2c7fd | 1,742 | class FbiServefiles < Formula
include Language::Python::Virtualenv
desc "Serve local files to Nintendo 3DS via FBI remote installer"
homepage "https://github.com/Steveice10/FBI"
url "https://github.com/Steveice10/FBI/archive/2.6.0.tar.gz"
sha256 "4948d4c53d754cc411b51edbf35c609ba514ae21d9d0e8f4b66a26d5c666be... | 28.557377 | 94 | 0.695178 |
b952648ffdb58073593477ba400b81819d03d47c | 3,431 | Rails.application.configure do
# Verifies that versions and hashed value of the package contents in the project's package.json
config.webpacker.check_yarn_integrity = false
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cach... | 41.337349 | 102 | 0.76042 |
e9271bc32f51022889ae966acd4b1831241656d8 | 2,944 | # 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... | 38.736842 | 96 | 0.692595 |
fff894a1b97b8e74115b54564e5753a8a7bf4e2c | 1,320 | require 'test_helper'
class UsersIndexTest < ActionDispatch::IntegrationTest
def setup
@user = users(:example)
@admin = users(:example)
@non_admin = users(:archer)
end
test "index including pagination" do
log_in_as(@user)
get users_path
assert_template 'users/index'
assert_select '... | 26.938776 | 84 | 0.683333 |
ed6c4989dcf8f46a9204a86ee92b8982f55609b0 | 517 | require "forwardable"
require "singleton"
module HTTP
module MimeType
# Base encode/decode MIME type adapter
class Adapter
include Singleton
class << self
extend Forwardable
def_delegators :instance, :encode, :decode
end
%w(encode decode).each do |operation|
... | 20.68 | 72 | 0.601547 |
21d58a474f8c556c25bdd08ed861f6463c7f54dd | 1,551 | #
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# 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 applica... | 41.918919 | 121 | 0.627982 |
9147a293968a553edec6b4cde9455b3c37bcd33c | 2,255 | Portfolio::Application.routes.draw do
root 'projects#index'
resources :blogs do
collection do
post 'markdown'
end
end
resources :projects do
collection do
post 'markdown'
end
end
get 'manage', to: 'manages#index'
get 'manage/projects', to: 'projects#manage'
get 'manage/... | 25.91954 | 84 | 0.651885 |
622d95c7052d881116b3639946c2c80e009de776 | 2,694 | # frozen_string_literal: true
module IncidentManagement
module OncallRotations
class EditService < OncallRotations::BaseService
include IncidentManagement::OncallRotations::SharedRotationLogic
# @param rotation [IncidentManagement::OncallRotation]
# @param user [User]
# @param params [Has... | 37.943662 | 129 | 0.694135 |
e93cdb007b36718b352c66dee61461aaedf4d5f7 | 711 | Pod::Spec.new do |s|
s.name = 'AWSConnect'
s.version = '2.12.6'
s.summary = 'Amazon Web Services SDK for iOS.'
s.description = 'The AWS SDK for iOS provides a library, code samples, and documentation for developers to build connected mobile applications using AWS.'
s.homepage = 'http:... | 39.5 | 157 | 0.611814 |
4a8b43872596502369984e9b3dba18fdd3952382 | 3,236 | require "topological_inventory/ansible_tower/operations/service_plan"
RSpec.describe TopologicalInventory::AnsibleTower::Operations::ServicePlan do
context "#order" do
let(:subject) { described_class.new(params, identity) }
let(:identity) { {"account_number" => "12345" } }
let(:service_plan) do
To... | 43.146667 | 135 | 0.541409 |
7aff5ed1b6d20a0415ae765f4c5a4cc58d797266 | 2,914 | require 'rex/parser/winscp'
INI_SECURITY = "[Configuration\\Security]\nUseMasterPassword=1\nMasterPasswordVerifier=\n"
USERNAME = 'username'
HOST = 'server.feralhosting.com'
PASSWORD='A35C7659654B2AB83C292F392E323D31392F392E2A392E723A392E3D3034332F2835323B723F33312F383A2F383A3B2F3B3B3B'
SAMPLE_INI = <<-END
[Sessions\... | 29.434343 | 113 | 0.684283 |
bb385049548bbd3ef1fd428823e8af7a10534a6e | 5,651 | # frozen_string_literal: true
# rubocop:disable Metrics/ClassLength
module WasteExemptionsEngine
class DataOverviewPresenter < BasePresenter
def initialize(transient_registration)
super(transient_registration, nil)
end
def company_rows
[
operator_rows,
contact_rows
].fl... | 24.253219 | 111 | 0.634401 |
61c8409dce4f017d3515d2ce4968f72740ff3af7 | 139 | # Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: '_logical_session'
| 34.75 | 77 | 0.805755 |
62c5a82cca8b042bf5f7bdd63a97dbe768983d9e | 338 | class Promocode < Sandbox::Script
def main
if @args[0].nil?
@logger.log('Specify promo code')
return
end
begin
code = @game.cmdRedeemPromoCode(@game.config['id'], @args[0])
rescue Trickster::Hackers::RequestError => e
@logger.log(e)
else
@logger.log(code['message'])
... | 19.882353 | 67 | 0.60355 |
1d4d298b748a4e6773fc122ee072374e58ef5c89 | 279 | require 'spec_helper.rb'
feature "Looking up recipes", js: true do
scenario "finding recipes" do
visit '/'
fill_in "keywords", with: "baked"
click_on "Search"
expect(page).to have_content("Baked Potato")
expect(page).to have_content("Baked Brussel Sprouts")
end
end | 23.25 | 55 | 0.724014 |
33a40e3b34236f4da11eb8eaaf1faaf404ef8540 | 3,565 | # frozen_string_literal: true
class TimelineEvent < ApplicationRecord
belongs_to :target
belongs_to :improved_timeline_event, class_name: 'TimelineEvent', optional: true
belongs_to :evaluator, class_name: 'Faculty', optional: true
has_many :target_evaluation_criteria, through: :target
has_many :evaluation_c... | 29.708333 | 156 | 0.731557 |
5d875c630a05a6bbf4a7bcc57cf52b8eb46ab95c | 1,448 | # frozen_string_literal: true
module DesignManagement
class DeleteDesignsService < DesignService
include RunsDesignActions
include OnSuccessCallbacks
def initialize(project, user, params = {})
super
@designs = params.fetch(:designs)
end
def execute
return error('Forbidden!') ... | 20.685714 | 98 | 0.674033 |
ace186a9366eae4e9857da12e6b1976b504284ff | 3,150 | class GtkMacIntegration < Formula
desc "Integrates GTK macOS applications with the Mac desktop"
homepage "https://wiki.gnome.org/Projects/GTK+/OSX/Integration"
url "https://download.gnome.org/sources/gtk-mac-integration/2.1/gtk-mac-integration-2.1.3.tar.xz"
sha256 "d5f72302daad1f517932194d72967a32e72ed8177cfa38... | 27.876106 | 99 | 0.637778 |
bf83ab91e453abe2787ac03369ae9ea1fe8739f6 | 1,905 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'fir/version'
Gem::Specification.new do |spec|
spec.name = 'fir-cli'
spec.version = FIR::VERSION
spec.authors = ['NaixSpirit', 'atpking']
spec.email = ['atpki... | 36.634615 | 74 | 0.607874 |
d50405281a089b3d516c007ea10a04fdb2a98a29 | 523 | require 'rails_helper'
RSpec.describe 'news_items/new', type: :view do
let(:news_item) do
NewsItem.new(
body: 'Body',
title: 'Title',
user_id: 1
)
end
before do
assign(:news_item, news_item)
render
end
it 'renders new news_item form' do
assert_select 'form[action=?][me... | 21.791667 | 75 | 0.65392 |
617ffb2f10cb3b053380befbe928c9db9f5a2791 | 142 | class AddUsernameIndexToCouncillors < ActiveRecord::Migration[5.0]
def change
add_index :councillors, :username, unique: true
end
end
| 23.666667 | 66 | 0.774648 |
e8d9e3d87785adc01a53606c6776599aa8b06ba1 | 29,076 | # encoding: utf-8
require "spec_helper"
def expect_window_with_content(content, window: windows.last)
page.within_window window do
expect(page).to have_content(content)
end
end
def expect_window_without_content(content, window: windows.last)
page.within_window window do
expect(page).not_to have_content(... | 33.96729 | 112 | 0.561253 |
876c71361b2da4b72dd2baffea26e8dad9ecdba3 | 1,630 | # frozen_string_literal: true
context = ChefDK::Generator.context
cookbook_dir = File.join(context.cookbook_root, context.cookbook_name)
recipe_path = File.join(cookbook_dir, 'recipes', "#{context.new_file_basename}.rb")
spec_helper_path = File.join(cookbook_dir, 'spec', 'spec_helper.rb')
spec_dir = File.join(cookbook... | 30.754717 | 96 | 0.77362 |
1dc636bce7f673022de3885e8c33b8679112ddef | 1,053 | require 'serverspec'
set :backend, :exec
puts "os: #{os}"
def mysql_bin
return '/opt/mysql50/bin/mysql' if os[:family] =~ /solaris/
return '/opt/local/bin/mysql' if os[:family] =~ /smartos/
'/usr/bin/mysql'
end
def mysqld_bin
return '/opt/mysql51/bin/mysqld' if os[:family] =~ /solaris/
return '/opt/local/... | 22.891304 | 91 | 0.662868 |
1de02b6811d35c19eb5e3e9398bdf6b54a9b0e6e | 2,379 | class ApplicationController < ActionController::Base
protect_from_forgery
after_action :store_location
helper_method :current_season, :current_student
before_action do
redirect_to = params[:redirect_to]
redirect_to ||= request.env['omniauth.params']['redirect_to'] if request.env['omniauth.params']
... | 31.72 | 125 | 0.711223 |
f814038bf5741fe86964fc6bdd3cfb37bda820af | 1,850 | # frozen_string_literal: true
module Spage
# Api Module
#
module Api
# Component resources in the statuspage.io API
#
class Component
include Api
def all(page_id:)
response = client.get("pages/#{page_id}/components")
handle_response(response) do
response.body.m... | 25 | 79 | 0.577838 |
b9b077ea099ed28c937ac5f517eb63f8a6fcd93d | 7,610 | require 'helper'
require 'populate_me/document'
class Band < PopulateMe::Document
attr_accessor :name, :awsome, :position
def members; @members ||= []; end
def validate
error_on(:name,"WTF") if self.name=='ZZ Top'
end
end
class Band::Member < PopulateMe::Document
attr_accessor :name
end
require 'populat... | 30.809717 | 83 | 0.652825 |
ac317cb2dfc621bb1f5c01868b2ebb2b0acf3d73 | 145 | class AddDeletedToAssessors < ActiveRecord::Migration[4.2]
def change
add_column :assessors, :deleted, :boolean, default: :false
end
end
| 24.166667 | 62 | 0.751724 |
5d4515ce72ef0606a255420fe9b7fff57e0972f5 | 29 | class Captivity < Event ;end
| 14.5 | 28 | 0.758621 |
f8b638b8e10d7a9f352f1f136e3e877d3fc822bf | 1,821 | ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
require 'test_keys'
class ActiveSupport::TestCase
# Transactional fixtures accelerate your tests by wrapping each test method
# in a transaction that's rolled back on completion. This ensures... | 44.414634 | 89 | 0.75508 |
18469da82543709d21509310501d367179dce736 | 240 | class ApiConstraints
def initialize(options)
@version = options[:version]
@default = options[:default]
end
def matches?(req)
@default || req.headers['Accept'].include?("application/vnd.marketplace.v#{@version}")
end
end | 24 | 90 | 0.691667 |
bf470ab56695820f84d50e33f4d77145a88aa5fd | 942 | require 'rails/generators'
require 'rails/generators/migration'
module IsPublished
module Generators
class InstallGenerator < ::Rails::Generators::Base
include Rails::Generators::Migration
source_root File.expand_path('../templates', __FILE__)
desc "Add the migrations for IsPublished"
arg... | 30.387097 | 84 | 0.703822 |
0116459d9149b0be0e767c2ff62976768c5b0d4e | 3,231 | require 'test_helper'
class UserTest < ActiveSupport::TestCase
def setup
@user = User.new(name: "Example User", email: "user@example.com",
password: "foobar", password_confirmation: "foobar")
end
test "should be valid" do
assert @user.valid?
end
test "name should be present" d... | 29.108108 | 78 | 0.67688 |
e9b7980b037dfd61a8ea63eaa6e9d8d0882e7fef | 337 | class DynamicWorker < Packet::Worker
set_worker_name :dynamic_worker
set_no_auto_load true
def worker_init
p "Starting dynamic worker"
p worker_options
end
def receive_data data_obj
eval_data = eval(data_obj[:data])
data_obj[:data] = eval_data
data_obj[:type] = :response
send_data(dat... | 21.0625 | 37 | 0.727003 |
ed3116f348b3ca128fd530a3df60ae620a6d361c | 7,849 | module StudiesHelper
def search_value(search_params, key)
if !search_params.nil? and search_params.has_key?(key)
return search_params[key]
end
end
def determine_contacts(trial)
contact_suffix = @system_info.contact_email_suffix
if !trial.contact_override.blank?
# Always use the overr... | 31.146825 | 202 | 0.639827 |
79c97a1b693a2336a819c2f83e46c79edbafce99 | 1,853 | #
# Copyright:: Copyright 2017, Chef Software, 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 compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
... | 26.471429 | 80 | 0.695629 |
1855d4c7b6ee64e6a1714eb9eab6bbbef5ddcd3e | 48 | json.partial! "sayings/saying", saying: @saying
| 24 | 47 | 0.75 |
398226a2312468485bc31aaea3b8d1a37394db60 | 43 | module FlickrOAuth
VERSION = "0.0.2"
end
| 10.75 | 19 | 0.697674 |
e2abd1238c57c50b3760a8b9c2f5bf3de0c70da3 | 2,907 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Projects::Pipelines::TestsController do
let(:user) { create(:user) }
let(:project) { create(:project, :public, :repository) }
let(:pipeline) { create(:ci_pipeline, project: project) }
before do
sign_in(user)
end
describe 'GET #summar... | 25.725664 | 85 | 0.651531 |
398af035216eb5639a8b25f65b0765cf8d571767 | 2,351 | # frozen_string_literal: true
# == Schema Information
#
# Table name: inboxes
#
# id :integer not null, primary key
# channel_type :string
# email_address :string
# enable_auto_assignment :boolean default(TRUE)
# greeting_enabled :boolean def... | 25.835165 | 74 | 0.668226 |
7a5374478e5572ad6f19cb7ae10c7afe24970932 | 574 | require 'test_helper'
class TalkTest < ActiveSupport::TestCase
def setup
@talk = Talk.create
10.times do |t|
user = users("user_#{t}".to_sym)
@talk.memberships.create(user: user)
@talk.messages.create(user: user, content: Faker::Lorem.sentence(5))
end
end
test "assosiated memb... | 22.076923 | 74 | 0.667247 |
f741b5c76a64280da877a98b4c1bade421a78996 | 1,338 | class Cowsay < Formula
desc "Configurable talking characters in ASCII art"
# Historical homepage: https://web.archive.org/web/20120225123719/www.nog.net/~tony/warez/cowsay.shtml
homepage "https://github.com/tnalpgge/rank-amateur-cowsay"
url "https://github.com/tnalpgge/rank-amateur-cowsay/archive/cowsay-3.04.ta... | 37.166667 | 104 | 0.760837 |
4a30398df795c0020494159423f33ab778f922a3 | 6,104 | # frozen_string_literal: true
# Copyright 2019 OpenTelemetry Authors
#
# SPDX-License-Identifier: Apache-2.0
require 'test_helper'
describe OpenTelemetry::SDK::Trace::Samplers do
Samplers = OpenTelemetry::SDK::Trace::Samplers
describe '.ALWAYS_ON' do
it 'samples' do
_(call_sampler(Samplers::ALWAYS_ON)... | 36.118343 | 128 | 0.70036 |
6af35510d19032807fcbbc1a95f5ac96229f9a0a | 23,372 | # -*- coding: utf-8 -*-
# Copyright (C) iWeb Technologies 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 requir... | 33.921626 | 107 | 0.535898 |
4abc1b74c937bc39e2c7aa083db91491577b8764 | 1,204 | cask 'wine-devel' do
version '3.12'
sha256 '46604a64f7651df883030ea578b1039cbabb7c93bf7e030de713967f17f455b1'
url "https://dl.winehq.org/wine-builds/macosx/pool/winehq-devel-#{version}.pkg"
appcast 'https://dl.winehq.org/wine-builds/macosx/download.html'
name 'WineHQ-devel'
homepage 'https://wiki.winehq.or... | 34.4 | 104 | 0.570598 |
1ac634ce1cdb07fcdb42196bfafb0fc67565923e | 627 | module Glysellin
class Property < ActiveRecord::Base
self.table_name = 'glysellin_properties'
has_many :variant_properties, class_name: 'Glysellin::VariantProperty',
dependent: :destroy, inverse_of: :variant
has_many :variants, class_name: 'Glysellin::Variant',
... | 29.857143 | 77 | 0.666667 |
21725bb0074149e21503af3079db5b0c25809e63 | 228 | # frozen_string_literal: true
class Speciality < ApplicationRecord
has_many :diseases, dependent: :destroy
belongs_to :user
has_many :doctors
validates :name, presence: true
validates :created_by, presence: true
end
| 20.727273 | 41 | 0.776316 |
62ed7fe69b06b3e625eb2246560616dfa14167af | 3,945 | require 'gisele'
module Gisele
#
# Gisele - A Process Analyzer Toolset
#
# SYNOPSIS
# gisele [--version] [--help]
# gisele [--ast | --graph] PROCESS_FILE
#
# OPTIONS
# #{summarized_options}
#
# DESCRIPTION
# The Gisele process analyzer toolset provides tools and technique to model and anal... | 32.875 | 94 | 0.619772 |
bf0de4bd98e4077bba69f8d66a0104cff860518c | 274 | class CreateApplicationTexts < ActiveRecord::Migration
def self.up
create_table :application_texts do |t|
t.integer :application_for_offering_id
t.string :title
t.timestamps
end
end
def self.down
drop_table :application_texts
end
end
| 18.266667 | 54 | 0.718978 |
911ced90650fcb339d2db7cbecaae58dddc1bba3 | 2,046 | class Libmagic < Formula
desc "Implementation of the file(1) command"
homepage "https://www.darwinsys.com/file/"
url "https://astron.com/pub/file/file-5.39.tar.gz"
sha256 "f05d286a76d9556243d0cb05814929c2ecf3a5ba07963f8f70bfaaa70517fad1"
livecheck do
url "https://astron.com/pub/file/"
regex(/href=.*?... | 35.894737 | 92 | 0.653959 |
bf0f5bbbd37ed2eac3fdb14d5d65a23c32be1cc0 | 3,999 | # frozen_string_literal: true
module DOTIW
class TimeHash
TIME_FRACTIONS = %i[seconds minutes hours days weeks months years].freeze
attr_reader :distance, :smallest, :largest, :from_time, :to_time
def initialize(distance, from_time, to_time = nil, options = {})
@output = {}
@options ... | 26.309211 | 96 | 0.593148 |
d51c65882526a9f580083e42b12ee7bc1c59a2c0 | 1,784 | #! /usr/bin/env ruby
require 'spec_helper'
require 'puppet/indirector/file_metadata/file'
describe Puppet::Indirector::FileMetadata::File do
it "should be registered with the file_metadata indirection" do
Puppet::Indirector::Terminus.terminus_class(:file_metadata, :file).should equal(Puppet::Indirector::FileMet... | 34.980392 | 123 | 0.695628 |
1cc1683322c87a4ce59221ff7bbf2f2bd19feea1 | 668 | desc 'capistrano COMMAND', 'Run a capistrano command on all deploy targets'
long_desc <<-LONGDESC
Example: `geordi capistrano deploy`
LONGDESC
def capistrano(*args)
targets = Dir['config/deploy/*.rb'].map { |file| File.basename(file, '.rb') }.sort
note 'Found the following deploy targets:'
puts targets
prompt... | 27.833333 | 84 | 0.676647 |
ab39b697c1201e57d4299d237e339f9b07872d08 | 2,816 | require 'set'
require 'benchmark'
require 'ostruct'
#require 'audit_data'
module CassandraAudits
module Adapters
module ActiveRecord
# Audit saves the changes to ActiveRecord models. It has the following attributes:
#
# * <tt>auditable</tt>: the ActiveRecord model that was changed
# * <t... | 31.288889 | 113 | 0.611151 |
338eaed47694ac4f2c7febff1a4e0a73989ff4bd | 303 | # encoding: utf-8
require_relative "../spec_helper"
describe Rango do
describe ".environment" do
it "should have environment" do
Rango.should respond_to(:environment)
end
it "should be development by default" do
Rango.environment.should eql("development")
end
end
end
| 18.9375 | 49 | 0.69967 |
39178193b3b1af822880596dca4448d045c0db1f | 1,163 | require './config/environment'
require 'sinatra/flash'
class ApplicationController < Sinatra::Base
register Sinatra::Flash
configure do
set :public_folder, 'public'
set :views, 'app/views'
enable :sessions
set :session_secret, "notsureyet"
end
get '/' do
if !logged_in?
erb :index
... | 21.943396 | 114 | 0.640585 |
e8246d940d8c800040828625f9a6ea72f1690536 | 559 | module RedisRateLimit
class Minute < Period
# Create an instance of Minute
# @param [String] name A unique namespace that identify the subject to track : users, emails, ip ...
# @param [Hash] options Options hash
# @option options [Integer] :limit (60) How many transactions to perform during the defin... | 39.928571 | 104 | 0.677996 |
bfee6e1352c86c8f888b2666fe25d781367f05dd | 1,807 | class LinkGrammar < Formula
desc "Carnegie Mellon University's link grammar parser"
homepage "https://www.abisource.com/projects/link-grammar/"
url "https://www.abisource.com/downloads/link-grammar/5.8.0/link-grammar-5.8.0.tar.gz"
sha256 "ad65a6b47ca0665b814430a5a8ff4de51f4805f7fb76642ced90297b4e7f16ed"
licen... | 36.14 | 92 | 0.693968 |
ed473d75b0eb55b7922882a92ea6a667cb2d858f | 1,977 | class Event < ActiveRecord::Base
geocoded_by :location # can also be an IP address
after_validation :geocode # auto-fetch coordinates
after_update :notify_system
before_save :check_over
belongs_to :user
belongs_to :category
has_many :donations, as: :donatable
has_many :votes, as: :votable
... | 25.675325 | 111 | 0.68083 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.