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 |
|---|---|---|---|---|---|
e28ae1b18e814eb4895ff6e1fd46d4b5658128c2 | 567 | # global_miles_e_commerce_api
#
# This file was automatically generated by APIMATIC v2.0
# ( https://apimatic.io ).
module GlobalMilesECommerceApi
# Represents an Http call in context.
class HttpContext
attr_accessor :request, :response
# The constructor.
# @param [HttpRequest] An HttpReque... | 27 | 80 | 0.698413 |
b95c75fd72b37ffc28a784f874dc74ffd9435ad4 | 1,274 | require 'rails_helper'
describe MmsResourcesController, type: :controller do
describe '#index' do
let(:files) { [ double(:files) ] }
before do
allow(MmsResource).to receive(:all) { files }
get :index
end
it 'assigns @files' do
expect(assigns(:files)).to eq(files)
end
it '... | 27.106383 | 85 | 0.654631 |
289994d17bca8f3a241b7845d8dc58eeb928cd19 | 6,366 | # frozen_string_literal: false
require_relative "utils"
if defined?(OpenSSL)
class OpenSSL::TestX509Certificate < OpenSSL::TestCase
def setup
super
@rsa1024 = Fixtures.pkey("rsa1024")
@rsa2048 = Fixtures.pkey("rsa2048")
@dsa256 = Fixtures.pkey("dsa256")
@dsa512 = Fixtures.pkey("dsa512")
@c... | 34.978022 | 88 | 0.669808 |
18d99d419e525fb607ce7d02d2839a5780e25012 | 5,426 | ##################################################################
# Licensing Information #
# #
# The following code is licensed, as standalone code, under #
# the Ruby License, unless otherwise directed withi... | 37.680556 | 90 | 0.570217 |
33d06f64902b29998505c6f950ee90ac34ca46ff | 105 | name "cucumber"
description "cucumber test environment"
default_attributes(
'ENV' => "production"
)
| 15 | 39 | 0.733333 |
d5e466d45f3a7ba5fa2189f85670410d3e3a9fae | 24,827 | # frozen_string_literal: true
# Copyright 2021 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 applicabl... | 49.654 | 144 | 0.530028 |
e2890385e37dbc77a73e04b9b5c11d4d8411abed | 1,699 | class CompactFormResponseChangesService < CivilService::Service
attr_reader :scope, :send_mail
def initialize(scope:)
@scope = scope.not_compacted
end
private
def inner_call
convention_ids_with_pending_changes.each do |convention_id|
all_pending_changes = scope.joins(:user_con_profile)
... | 32.056604 | 97 | 0.747499 |
38023e840442cd1b807d4da45d8dd61a41735275 | 82 | require 'multidiff/differ'
require 'multidiff/runner'
require 'multidiff/version'
| 20.5 | 27 | 0.817073 |
d54d86e8880a46e0de6d6353a4fbe2473db9509e | 109,467 | # 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 'seahorse/client/plugins/content_length.rb'
require 'aws-sdk-core/plugins... | 43.216344 | 362 | 0.662675 |
0161f8e6d21afd3fa769541735a201a58cc65f2d | 118 | class Object
def self.const_missing(c)
require Rulerss.to_underscore(c.to_s)
Object.const_get(c)
end
end
| 16.857143 | 41 | 0.728814 |
e29c2cd42fe761aa63f5cdd156b1d48105829d9a | 1,005 | class ApacheArchiva < Formula
desc "Build Artifact Repository Manager"
homepage "https://archiva.apache.org/"
url "https://www.apache.org/dyn/closer.lua?path=archiva/2.2.5/binaries/apache-archiva-2.2.5-bin.tar.gz"
mirror "https://archive.apache.org/dist/archiva/2.2.5/binaries/apache-archiva-2.2.5-bin.tar.gz"
... | 29.558824 | 105 | 0.720398 |
eda676262fc023c4a18939ada4157dd9e55170d0 | 495 | require 'test_helper'
class SubscriptionsHelperTest < ActionView::TestCase
include SubscriptionsHelper
test 'expiration_month_options' do
assert_not_nil expiration_month_options
end
test 'expiration_year_options' do
assert_not_nil expiration_year_options
end
test "format_monthly_amount" do
f... | 22.5 | 52 | 0.785859 |
ed66190bddbe7a0dd1f298c61b25ea48d2096fe4 | 1,282 | class ProposalsController < ApplicationController
expose(:talk) { build_talk }
expose(:speaker) { talk.speakers.first }
expose(:format) { params[:format] || params[:proposal][:format] }
expose(:proposal) { Proposal.new :format => format, :talk => talk }
expose(:tracks) { Track.current_year }
expose(:video_a... | 34.648649 | 98 | 0.687988 |
4a0752d70d411b3e7f8a58b443f18abfb78e407c | 884 | User.find(:all).each do |user|
user.plugins.create(:name => "campaigns",
:position => (user.plugins.maximum(:position) || -1) +1)
end
RefinerySetting.create :name => Refinery::Mailchimp::API::KeySetting[:name], :value => Refinery::Mailchimp::API::KeySetting[:default], ... | 80.363636 | 180 | 0.701357 |
b9e7d380b292909331d4c04db6a9bd41df4510e5 | 29,455 | # frozen_string_literal: true
require 'rails_helper'
require 'benchmark'
RSpec.describe Spree::Shipment, type: :model do
let(:order) { create(:order_ready_to_ship, line_items_count: 1) }
let(:shipping_method) { create(:shipping_method, name: "UPS") }
let(:stock_location) { create(:stock_location) }
let(:shipm... | 33.895282 | 158 | 0.679986 |
21d2579b9a41f50bbcacb0c3473685e64c5566e0 | 5,553 | ##
# This module requires Metasploit: http//metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
require 'rex'
class Metasploit3 < Msf::Post
include Msf::Post::File
include Msf::Auxiliary::Report
def initialize(info={})
super( update_info( info,
... | 30.179348 | 227 | 0.599496 |
4a24df37cd7e28df9990d7378ee55830510a3b86 | 143 | require 'rails_helper'
RSpec.describe "equipment/show.html.haml", type: :view do
pending "add some examples to (or delete) #{__FILE__}"
end
| 23.833333 | 57 | 0.741259 |
b9fed6e218ecbd3e115a7d3e6de883643a55c71d | 13,088 | require "helpers/test_helper"
test_name "confirm host object behave correctly"
step "#port_open? : can determine if a port is open on hosts"
hosts.each do |host|
logger.debug "port 22 (ssh) should be open on #{host}"
assert_equal(true, host.port_open?(22), "port 22 on #{host} should be open")
logger.debug "port... | 41.028213 | 141 | 0.697051 |
33aede2523981881811e7b320d49631d69730855 | 1,081 | module Byebug
#
# Implements the finish functionality.
#
# Allows the user to continue execution until certain frames are finished.
#
class FinishCommand < Command
self.allow_in_post_mortem = false
def regexp
/^\s* fin(?:ish)? (?:\s+(\S+))? \s*$/x
end
def execute
max_frames = C... | 24.568182 | 77 | 0.601295 |
e261f879966dab5fbebb4142b98c732883e0bdbb | 169 | class AddHasRequestedSwapToDayAssignments < ActiveRecord::Migration
def change
add_column :day_assignments, :has_requested_swap, :boolean, default: false
end
end
| 28.166667 | 77 | 0.816568 |
5db4453f4c736b5ae634eda088070efb250143fb | 801 | require 'minitest/autorun'
require 'string_calc/day08'
class StringCalcTest < Minitest::Test
def setup
@calc = StringCalc.new
end
def test_compute_negative_number
assert_equal -7, @calc.compute('-7')
end
def test_compute_addition
assert_equal 4 + 9, @calc.compute('4+9')
end
def test_comput... | 21.648649 | 80 | 0.685393 |
91b3b18146b0e01e9267790c2e0d6bc0069c0a1c | 236 | require 'u2i/ci_utils'
require 'rails'
module U2i
module CiUtils
class Railtie < Rails::Railtie
railtie_name :u2i_ci_rake_tasks
rake_tasks do
require 'u2i/ci_utils/rake_tasks/all'
end
end
end
end
| 15.733333 | 45 | 0.677966 |
ff1c42c0b54d8b02b71d47b126beb47584fd7c8f | 99,019 | # 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::ECS
# @api private
module ClientApi
include Seahorse::Model
AccessDeniedException = Sh... | 72.701175 | 175 | 0.768863 |
111ef0505b1f0ee13c13bef0f418b250cdcbef7a | 559 | require "json"
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
Pod::Spec.new do |s|
s.name = "selleo-toast"
s.version = package["version"]
s.summary = package["description"]
s.homepage = package["homepage"]
s.license = package["license"]
s.authors = pack... | 27.95 | 106 | 0.592129 |
623163c79b52d995c8234f2658dd056a4d806931 | 7,420 | # -*- encoding: utf-8 -*-
# stub: github-pages 215 ruby lib
Gem::Specification.new do |s|
s.name = "github-pages".freeze
s.version = "215"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["GitHub, Inc... | 58.888889 | 112 | 0.660108 |
87f0487378f0ec576495df9c1972666a64fbeb60 | 611 | ENV['SINATRA_ENV'] ||= "development"
require 'bundler/setup'
Bundler.require(:default, ENV['SINATRA_ENV'])
ActiveRecord::Base.establish_connection(
:adapter => "sqlite3",
:database => "db/#{ENV['SINATRA_ENV']}.sqlite"
)
configure :production do
db = URI.parse(ENV['DATABASE_URL'] || 'postgres://localhost/mydb')
... | 23.5 | 67 | 0.664484 |
7a534c90410e79852d4afadb9580b872a8cd440c | 914 | Gem::Specification.new do |s|
s.name = "rack-mini-profiler"
s.version = "0.1.22"
s.summary = "Profiles loading speed for rack applications."
s.authors = ["Sam Saffron", "Robin Ward","Aleks Totic"]
s.description = "Profiling toolkit for Rack applications with Rails integration. Client Side profiling, DB profiling a... | 33.851852 | 140 | 0.68709 |
3393e5a61936cd3f0ef205012bbb7d8f556484ee | 770 | require 'bio-ucsc'
describe "Bio::Ucsc::Hg19::NtSssSnps" do
describe "#find_by_interval" do
context "given range chr1:1-100,000" do
it "returns an array of results" do
Bio::Ucsc::Hg19::DBConnection.default
Bio::Ucsc::Hg19::DBConnection.connect
i = Bio::GenomicInterval.parse("chr1:1... | 30.8 | 63 | 0.637662 |
61ef52dc65d92a00c24be213da3c1e06267a4b91 | 13,566 | require 'test/helper.rb'
class IntegrationTest < Test::Unit::TestCase
context "Many models at once" do
setup do
rebuild_model
@file = File.new(File.join(FIXTURES_DIR, "5k.png"))
300.times do |i|
Dummy.create! :avatar => @file
end
end
should "not exceed the open f... | 34.431472 | 105 | 0.567153 |
010c94cb91b8730668f83c0e54dd1978976e56bc | 1,374 | #!/usr/bin/env ruby
# Copyright 2018 gRPC authors.
#
# 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... | 41.636364 | 99 | 0.767103 |
79767a5ec00a93ed61727a50a2b85d1a5bd96b70 | 279 | class ChildrenInHomeForm < Form
set_attributes_for :navigator, :children_in_home
def save
interview.navigator.update(attributes_for(:navigator))
end
def self.existing_attributes(interview)
HashWithIndifferentAccess.new(interview.navigator.attributes)
end
end
| 23.25 | 65 | 0.802867 |
e99fcea68d05ea0ed7a6cb4e15562bfa1e36f259 | 1,241 | require "spec_helper"
describe Slack::ModalPublisher do
before do
allow(STDOUT).to receive(:puts)
end
describe "publish_profile_modal_404" do
let(:subject) {
VCR.use_cassette("slack/publish_profile_modal_404") do
described_class.publish_profile_modal_404("trigger")
end
}
it... | 25.326531 | 76 | 0.614021 |
033a42a8176a824c00e54ee8b1c90f9031416c38 | 267 | class CreateProgramStudentAssignments < ActiveRecord::Migration[5.0]
def change
create_table :program_student_assignments do |t|
t.references :student, foreign_key: true
t.references :program, foreign_key: true
t.timestamps
end
end
end
| 24.272727 | 68 | 0.734082 |
e218ef35e483bd3ca69557d4ffd6e740d305cea1 | 12,723 | # frozen_string_literal: true
require "abstract_unit"
class Workshop
extend ActiveModel::Naming
include ActiveModel::Conversion
OUT_OF_SCOPE_BLOCK = proc do
raise "Not executed in controller's context" unless RedirectController === self
request.original_url
end
attr_accessor :id
def initialize(... | 26.672956 | 105 | 0.754303 |
7a8f1aa09609576a1deeb7ceb12212af414deefb | 2,334 | require 'singleton'
module Cohortly
class TagConfig
include Singleton
attr_accessor :_tags, :_groups, :lookup_table
def self.draw_tags(&block)
instance._tags = []
instance._groups = []
instance.lookup_table = {}
instance.instance_eval(&block)
instance.compile!
ins... | 24.568421 | 67 | 0.589117 |
0115d34c2abe602685919eba045b91b9719fd120 | 239 | class Paper < ApplicationRecord
validates :title, :venue, presence: true
validates :year, presence: true, numericality: true
has_and_belongs_to_many :authors
scope :filter_by_year, -> (year) { where('year = ?', year) }
end
| 34.142857 | 64 | 0.702929 |
e9c7e743af9892f528d874dd97d748eedb884e92 | 1,006 | require "carb"
require "carb/service/version"
# Basic interface for service objects. Use rspec shared example
# "Carb::Service" to check if you adhere to the interface correctly. Provides
# currying functionalities
module Carb::Service
# Invokes the service
# @param args [Hash{Symbol => Object}] arguments used in ... | 30.484848 | 80 | 0.72167 |
1125a57f156bbbd39f737752fc066f4f1e5b3d55 | 7,511 | #--
# Copyright (c) 2010-2013 Michael Berkovich, tr8nhub.com
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, cop... | 33.088106 | 128 | 0.624018 |
7a5b6f70ca86351a92a4465e00a6ead87f8b4214 | 278 | class CreateClickThroughs < ActiveRecord::Migration[4.2]
def up
create_table :click_throughs do |t|
t.string 'url'
t.string 'source_url'
t.string 'user_id', null: true
t.timestamps
end
end
def down
drop_table :click_throughs
end
end
| 18.533333 | 56 | 0.661871 |
616927446bf173e019c11bb35f727f69a1bcbc3a | 493 | module Jekyll
class PageTag < Liquid::Tag
def initialize(tag_name, text, tokens)
super
@text = text.strip.downcase
end
def render(context)
site = context.registers[:site]
page = site.collections['pages'].docs.select{|p|p.data['title'].gsub(/\"/,'').downcase == @text}.first
... | 25.947368 | 108 | 0.616633 |
081a4aadc54f0b3c3a28459bab8b3c1c72f3e4be | 4,720 | # These defaults are used in Geokit::Mappable.distance_to and acts_as_mappable
Geokit::default_units = :kms #:miles :kms, :nms, :meters
Geokit::default_formula = :sphere
# This is the timeout value in seconds to be used for calls to the geocoder web
# services. For no timeout at all, comment out the setting. The tim... | 46.732673 | 79 | 0.758686 |
ed90d10f6aabd453ca8aef1d1dd5f9fd122a7b60 | 1,136 | require 'tempfile'
Given /^I already have a Berkshelf config file$/ do
path = Tempfile.new('berkshelf').path
config = Berkshelf::Config.new(path)
config.save
Berkshelf.config = config
ENV['BERKSHELF_CONFIG'] = path
set_env 'BERKSHELF_CONFIG', path
end
Given /^I have a Berkshelf config file containing:... | 25.818182 | 85 | 0.711268 |
b95d2913915f48b579db807a5e8de9daa4b32967 | 902 | require 'sinatra/base'
require_relative 'feed'
class NowPlaying < Sinatra::Base
set :root, File.expand_path("#{File.dirname(__FILE__)}/../app")
set :public_folder, 'public'
before do
content_type :json
headers 'Access-Control-Allow-Origin' => '*',
'Access-Control-Allow-Methods' => %w[OPTIONS... | 18.791667 | 76 | 0.669623 |
e269d97f3f44e24f6c4901fe214f146ffd482ef8 | 723 | # frozen_string_literal: true
require 'rails/generators'
# Creates the Queues initializer file for Rails apps.
#
# @example Invokation from terminal
# rails generate queues_rabbit
#
class QueuesRabbitGenerator < Rails::Generators::Base
desc "Description:\n This prepares Rails for RabbitMQ Queues"
source_root ... | 26.777778 | 73 | 0.748271 |
ff0d4f2cedeac556a5377674eaad667f1a0eaa45 | 536 | # frozen_string_literal: true
# Synchronize political_force with main site
class NetworkPoliticalForceSyncJob < ApplicationJob
queue_as :default
# @param [Integer] entity_id
# @param [TrueClass|FalseClass] for_update
def perform(entity_id, for_update = false)
entity = PoliticalForce.find_by(id: entity_id)... | 25.52381 | 78 | 0.768657 |
e8721a736ba69050ac8cfcb646d928ec90cdda48 | 829 | Gem::Specification.new do |s|
s.name = 'acts_as_commentable_with_threading'
s.version = '2.0.1'
s.date = '2015-12-22'
s.summary = 'Polymorphic comments Rails gem - Rails 4+ only'
s.email = 'evan@tripledogdare.net'
s.homepage = 'http://github.com/elight/acts_as_commentable_with_threading'
s.de... | 39.47619 | 76 | 0.676719 |
abd40d525a298186156d72ad3ff6a4529ea54490 | 2,641 | # encoding: utf-8
module SamlIdp
require 'active_support/all'
require 'saml_idp/saml_response'
require 'saml_idp/xml_security'
require 'saml_idp/configurator'
require 'saml_idp/controller'
require 'saml_idp/default'
require 'saml_idp/metadata_builder'
require 'saml_idp/version'
require 'saml_idp/engin... | 26.94898 | 112 | 0.654676 |
7a7bb6886a372e21a122a0dde834820cb97e4cd7 | 1,601 | module Octokit
# Class to parse GitHub repository owner and name from
# URLs and to generate URLs
class Repository
attr_accessor :owner, :name, :id
# Instantiate from a GitHub repository URL
#
# @return [Repository]
def self.from_url(url)
Repository.new(URI.parse(url).path[1..-1])
... | 22.549296 | 74 | 0.598376 |
6a709a88f6baf790abcd11a766ae8f9bc81af517 | 2,890 | require File.expand_path(File.join(File.dirname(__FILE__), '..', "helper"))
require File.join(File.dirname(__FILE__),"load_files")
class TestPreserved < Nokogiri::TestCase
def assert_roundtrip str
doc = Nokogiri.Hpricot(str)
yield doc if block_given?
str2 = doc.to_original_html
[*str].zip([*str2]).ea... | 37.051282 | 201 | 0.658478 |
1d009d21ebe8fc150c676da5cf4bad7bcabe8eaa | 1,312 | # frozen_string_literal: true
module Types
class EveAncestryType < Types::BaseObject
description "Ancestry object"
field :id, ID,
method: :ancestry_id,
description: "Ancestry ID",
null: false
field :name, GraphQL::Types::JSON,
description: "Name",
null: true
field :de... | 20.825397 | 46 | 0.601372 |
61b13693010a4930a4784b0a2b0e77e2074f30f4 | 497 | require "spec_helper"
describe SpreeShopifyImporter::Importers::TaxonImporterJob, type: :job do
subject { described_class.new }
describe "#perfrom" do
let(:resource) { double("ShopifyCustomCollection") }
it "calls a importer service" do
expect(SpreeShopifyImporter::Importers::TaxonImporter).to rece... | 29.235294 | 97 | 0.752515 |
28061442e786f36c315d6624edb7c1d35b81d8d4 | 20,093 | # encoding: UTF-8
require 'cxxstdlib'
require 'exceptions'
require 'formula'
require 'keg'
require 'tab'
require 'bottles'
require 'caveats'
require 'cleaner'
require 'formula_cellar_checks'
require 'install_renamed'
require 'cmd/tap'
require 'hooks/bottles'
class FormulaInstaller
include FormulaCellarChecks
def... | 27.043069 | 124 | 0.661275 |
bf07ffe9c3653b1d77f1640f3b429fdad7e4ed8e | 358 | # frozen_string_literal: true
require_dependency "participant_profile/ecf"
class ParticipantProfile < ApplicationRecord
class ECT < ECF
belongs_to :mentor_profile, class_name: "Mentor", optional: true
has_one :mentor, through: :mentor_profile, source: :user
def ect?
true
end
def particip... | 18.842105 | 68 | 0.715084 |
39d34f353afef3ef2d6b8c012421dd00900a44a2 | 257 | class Review < ActiveRecord::Base
belongs_to :product
validates :author, presence: true
validates :content, presence: true
validates :rating, presence: true, numericality: true, inclusion: { in: 1..5, message: "Rating must be between 1 and 5" }
end
| 36.714286 | 123 | 0.735409 |
d516a7f56bdd418f86fee47e17ebbab5a4dad6f1 | 1,689 | require_relative 'piece'
require_relative '../chess_utils/chess_utils'
class Board
include ChessUtils::Renderable
SIZE = 8
def initialize
@rows = Array.new(SIZE) { Array.new(SIZE) }
end
def [](pos)
row, col = pos
rows[row][col]
end
def []=(pos, mark)
row, col = pos
rows[row][col] ... | 15.933962 | 55 | 0.586738 |
62cc45cb064c4a1df0817fa5cec343923289d562 | 5,950 | =begin
#Selling Partner API for Direct Fulfillment Shipping
#The Selling Partner API for Direct Fulfillment Shipping provides programmatic access to a direct fulfillment vendor's shipping data.
OpenAPI spec version: v1
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 3.0.33
=... | 29.899497 | 133 | 0.661176 |
edae7d9e62b91ff28718d09292c10142ac6d89b0 | 4,795 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... | 45.235849 | 114 | 0.763295 |
b9e63420120b45ff40396137cc4daa8b461c14e7 | 215 | $LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'sinatra-forms'
require 'spec'
require 'spec/autorun'
Spec::Runner.configure do |config|
end
| 21.5 | 66 | 0.739535 |
ab273739648c4e6ae88020d3e2011ec75ca8e26f | 1,425 | require 'htmlentities'
require 'json'
require_relative 'entry'
class DestinationFeed
def self.write_review_feed( app_name, entries, dest_file_path, dest_feed_url )
json_structure = Hash.new
json_structure['version'] = 'https://jsonfeed.org/version/1'
json_structure['title'] = "App Store Reviews of #{app_name}... | 35.625 | 243 | 0.710175 |
08b7f42b1dda49354b622c458b4076e365a1abe7 | 581 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'GET /staff/people/:id' do
let!(:person) { create :initial_person }
let(:current_account) { create :usual_account }
def make_request
get "/staff/people/#{person.id}"
end
before do
sign_in current_account.user if current_account&.u... | 19.366667 | 57 | 0.712565 |
4a0c12d81627aaa585b7e0b4dd6824a0e272661a | 597 | # Class for A-B testing variants. A variant is a set of changes
# to the same element on a page. For example, a variant can be used
# to change the button text, or images displayed, or even more
# complicated behavior
class Caboose::AbVariant < ActiveRecord::Base
self.table_name = "ab_variants"
has_many :ab_opti... | 33.166667 | 68 | 0.720268 |
28992d9f303bdedd1b670a35b1fee692e4bd290c | 41 | module ItunesCsv
VERSION = "0.0.3"
end
| 10.25 | 19 | 0.682927 |
acbbc919688a915f528cfd7c5235ee5942def447 | 3,718 | class NotificationGenerator < Rails::Generators::Base
source_root File.expand_path('templates', __dir__)
def create_notice
copy_file "notice.rb", "app/models/notice.rb"
end
def create_user_notice
copy_file "user_notice.rb", "app/models/user_notice.rb"
end
def create_notice_controller
copy_fil... | 31.777778 | 117 | 0.682087 |
1d0e1b320debef5ae5043b92e29ec5b6250c29b6 | 3,001 | # 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', __FILE__)
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rail... | 40.554054 | 86 | 0.746418 |
b9e009f8aadc395df87750926557b62a0cf990ee | 47 | module PivottableRails
VERSION = "0.1.1"
end
| 11.75 | 22 | 0.723404 |
62c9ff9b8b27cffb927557e74c0bc7bde09a37cc | 283 | class StaticPagesController < ApplicationController
def home
if logged_in?
@micropost = current_user.microposts.build
@feed_items = current_user.feed.paginate(page: params[:page])
end
end
def help
end
def about
end
def contact
end
end
| 14.15 | 67 | 0.678445 |
6a8f79745cf81b4ba5fec9482cceea4485dd5e37 | 2,201 | require 'openssl'
require 'jwt'
require 'net-http2'
module P8push
APPLE_PRODUCTION_JWT_URI = 'https://api.push.apple.com'
APPLE_DEVELOPMENT_JWT_URI = 'https://api.development.push.apple.com'
class Client
attr_accessor :jwt_uri
class << self
def development(apn_private_key, apn_team_id, apn_key_id... | 29.346667 | 98 | 0.646524 |
335e9fc7a462e1ef67924992de6f26c3dc61c183 | 1,216 | # Copyright 2014 Red Hat, Inc, and individual contributors.
#
# 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 applicabl... | 32 | 74 | 0.737664 |
6af24c741a1a7d3bd7537b884e1b582649929ac7 | 86 | module InspecPlugins
module InputTestFixture
VERSION = '0.1.0'.freeze
end
end
| 14.333333 | 28 | 0.732558 |
ab57787b4d05b783a11eb7712dbb4a335f03e6c8 | 1,273 | require_relative 'lib/cli_gif/version'
Gem::Specification.new do |spec|
spec.name = "cli_gif"
spec.version = CliGif::VERSION
spec.authors = ["Piotr Zientara"]
spec.email = ["314zientara@gmail.com"]
spec.summary = "A CLI client for Giphy"
spec.description = "Get your gi... | 42.433333 | 87 | 0.653574 |
edb5dfe01239e2e85497c5c49cc0222cb91fd85f | 280 | class CreateTaggings < ActiveRecord::Migration[5.1]
def change
create_table :taggings do |t|
t.integer :todo_id, null: false
t.integer :tag_id, null: false
t.timestamps
end
add_index :taggings, :todo_id
add_index :taggings, :tag_id
end
end
| 20 | 51 | 0.671429 |
111d72042030dc6264b862ed2f320989964bf786 | 12,123 | # encoding: utf-8
require File.join(File.dirname(__FILE__), "../spec_helper.rb")
describe Her::Model::Parse do
context "when include_root_in_json is set" do
before do
Her::API.setup url: "https://api.example.com" do |builder|
builder.use Her::Middleware::FirstLevelParseJSON
builder.use Fara... | 35.037572 | 124 | 0.601006 |
e917b47699289de0c62f3dbf4436b63905af9170 | 450 | require 'spec_helper'
describe CRDT::Between do
def assert_between(low, high, depth)
generated = CRDT::Between.string(low, high)
(generated > low).should be_true
(generated < high).should be_true
return if depth == 0
if rand(2) == 1
assert_between(low, generated, depth - 1)
else
a... | 23.684211 | 48 | 0.644444 |
089b987d681ae69fb071a6c5573bb0b714f05b35 | 2,047 | module Kitabu
class Exporter
def self.run(root_dir, options)
exporter = new(root_dir, options)
exporter.export!
end
attr_accessor :root_dir
attr_accessor :options
def initialize(root_dir, options)
@root_dir = root_dir
@options = options
end
def ui
@ui ||= T... | 29.242857 | 94 | 0.595506 |
5d4564c10a72ddb5c8e32f3ebafab5bb62b581c0 | 1,011 | namespace :oneoff do
task :fix_user_district, [:email] => :environment do |t,args|
require 'csv'
email = args[:email]
csv_user_list_file = "#{email}/users_districs.csv"
rows_from_csv = CSV.parse(S3Wrapper.read(filename: csv_user_list_file), headers: true)
rows_from_csv.each do |row|
user_... | 33.7 | 119 | 0.649852 |
bb9001fa0612dc5a7f38f28ef8ec7d680a32095f | 1,624 | # the graph
graph = {}
graph["start"] = {}
graph["start"]["a"] = 6
graph["start"]["b"] = 2
graph["a"] = {}
graph["a"]["fin"] = 1
graph["b"] = {}
graph["b"]["a"] = 3
graph["b"]["fin"] = 5
graph["fin"] = {}
# the costs table
costs = {}
costs["a"] = 6
costs["b"] = 2
costs["fin"] = Float::INFINITY
# the parents table
... | 23.2 | 75 | 0.641626 |
39de58090f8bf79a77446d49ddc18ad04433518a | 56 | require "ci_status/cruise_control"
module CiStatus
end
| 11.2 | 34 | 0.839286 |
620c39fbf1f77c0fd4567b4c266682be03d41178 | 387 | $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'rspec'
require 'rspec/matchers'
require 'cron2english'
# Requires supporting files with custom matchers and macros, etc.,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/support... | 25.8 | 69 | 0.731266 |
38ee04ec0014b827cc2bdefaa434f0d51fb15d39 | 4,336 | module TransactionService::Store::Transaction
TransactionModel = ::Transaction
module_function
# booking validation happens before SQL BEGIN-COMMIT block
def create(tx_data)
tx_model = TransactionModel.new(tx_data.except(:content, :video, :booking_fields, :starting_page))
build_conversation(tx_model... | 32.601504 | 115 | 0.712177 |
5d1de41c902c7756f5f90e6fd8504f7998a3698c | 815 | require 'rails_helper'
module Utilities
RSpec.describe MatterTypeFinder do
describe '.call' do
subject { described_class.call(code) }
context 'successful lookup' do
before { subject }
context 'passed as a symbol' do
let(:code) { :DA002 }
it 'returns domestic abus... | 23.285714 | 77 | 0.558282 |
03545b61d4a697f95c260c0abc15345d6d728e2e | 3,476 | #!/usr/bin/env ruby
# Encoding: utf-8
#
# Copyright:: Copyright 2011, Google Inc. All Rights Reserved.
#
# License:: 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
#
# ... | 33.747573 | 79 | 0.701381 |
eddb3fa42662c6c8bc3bb5f75b95f6dc7ccb5f97 | 10,485 | # 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,... | 33.498403 | 204 | 0.645875 |
915397f0f4f9fac2798fd38cf153ca313d0de04f | 1,840 | # frozen_string_literal: true
require 'spec_helper'
require Rails.root.join('db', 'post_migrate', '20180913142237_schedule_digest_personal_access_tokens.rb')
describe ScheduleDigestPersonalAccessTokens, :migration do
let(:personal_access_tokens) { table(:personal_access_tokens) }
let(:users) { table(:users) }
... | 37.55102 | 105 | 0.713043 |
e81aa9c72042af7a65b26fb754ef211c4a9dcd5e | 177 | class Message < ApplicationRecord
belongs_to :user
belongs_to :room
validates_presence_of :content
validates_presence_of :user_id
validates_presence_of :room_id
end | 17.7 | 33 | 0.813559 |
ac2d9ca289b481af55a17af0d9192145f700547e | 134 | require "classnames/version"
require "classnames/classnames"
def Classnames(*classes)
Classnames::Classnames.new(classes).to_s
end
| 19.142857 | 42 | 0.80597 |
ed4d261781e70f72f2f8909722dc949a089d8386 | 1,553 | class Buyers::DeliveriesController < ApplicationController
after_action :verify_authorized
layout 'buyers'
def index
authorize(current_rfp, :edit?)
@deliveries = current_rfp.deliveries
end
def new
authorize(current_rfp, :edit?)
@delivery = current_rfp.deliveries.build
end
def edit
a... | 25.459016 | 129 | 0.71217 |
28d655cd0597ce8158f268eb332081dec9d35c08 | 43 | module HideAndSeek
VERSION = "0.2.1"
end
| 10.75 | 19 | 0.697674 |
33a6ab959e570646e26ec5310f92b1da02b47894 | 1,967 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web serv... | 40.142857 | 85 | 0.788002 |
6292e3e4182a886953d80ee11c365a83dd76afcb | 1,990 | module ProMotion
module Table
module Refreshable
def make_refreshable(params={})
pull_message = params[:pull_message] || "Pull to refresh"
@refreshing = params[:refreshing] || "Refreshing data..."
@updated_format = params[:updated_format] || "Last updated at %s"
@updated_tim... | 39.8 | 164 | 0.705025 |
d59f6fda31dba4da327135a67fa8872f84897e6c | 5,512 | class PerconaServerAT55 < Formula
desc "Drop-in MySQL replacement"
homepage "https://www.percona.com/"
url "https://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-5.5.57-38.9/source/tarball/percona-server-5.5.57-38.9.tar.gz"
version "5.5.57-38.9"
sha256 "253f5c254b038c0622055dc8f0259a517be58736cf... | 32.423529 | 136 | 0.681422 |
e83d94d1a087b33069060e40c1fd620509da7c23 | 474 | module Bane
module Behaviors
module Responders
# Accepts a connection, pauses a fixed duration, then closes the connection.
#
# Options:
# - duration: The number of seconds to wait before disconnect. Default: 30
class CloseAfterPause
def initialize(options = {})
... | 22.571429 | 83 | 0.597046 |
1c857a6e09dfb8db94ac1970f09bfa414454c3fb | 1,075 | module Admin
class BaseController < ApplicationController
layout 'admin'
before_action :only_admin_or_moderator
def make_admin
@info = Info.find_by_id(params[:id])
@user = User.find(@info.user_id)
@user.update_attributes(role: 'admin', admin: 'true')
@user.save
redirect_to '... | 22.87234 | 96 | 0.615814 |
0196ddc1e2bef6eea1ce41f030c64efd9b9f344e | 385 | # frozen_string_literal: true
module Api
module Exceptions
class AuthenticationError < StandardError; end
class LocationNotFound < StandardError; end
class UnauthorizedError < AuthenticationError; end
class InvalidTokenError < AuthenticationError; end
class ExpiredTokenError < AuthenticationError... | 29.615385 | 54 | 0.787013 |
3815c26ddd328e090529a5b0561c2e271fa33413 | 1,341 | # DocumentCollection sync checks are throwing up some errors as follow:
# "documents shouldn't contain 'uuid'"
# Searching for these documents by uuid reveals a document in a strange state:
# The document will have only 1 edition and that edition state will be superseded
#
# To fix this we are going to manually set the... | 43.258065 | 121 | 0.788218 |
03054f5e96f3e32062ac6d656448edac8d21938a | 1,299 | # frozen_string_literal: true
class Reports::MonthlyProgressComponent < ViewComponent::Base
include AssetsHelper
include DashboardHelper
attr_reader :dimension
attr_reader :range
attr_reader :monthly_counts
attr_reader :total_counts
def initialize(dimension, service:)
@dimension = dimension
@mon... | 23.196429 | 85 | 0.712086 |
f7dcf1761cc5399cc4ce337624f4f365ef2ae168 | 143 | class AddSitemapStateToGnavMenuItems < ActiveRecord::Migration
def change
add_column :gnav_menu_items, :sitemap_state, :string
end
end
| 23.833333 | 62 | 0.804196 |
2192aa92668927c5c611b4b957236d8043903674 | 1,508 | #
# Be sure to run `pod spec lint ByteBackpacker.podspec' to ensure this is a
# valid spec and to remove all comments including this before submitting the spec.
#
# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
# To see working Podspecs in the CocoaPods repo see https://git... | 45.69697 | 265 | 0.685013 |
6ac3dc25c3ee8a450e526a11c7cc1f642babf5b2 | 2,107 | class Mtools < Formula
desc "Tools for manipulating MSDOS files"
homepage "https://www.gnu.org/software/mtools/"
url "https://ftp.gnu.org/gnu/mtools/mtools-4.0.37.tar.gz"
mirror "https://ftpmirror.gnu.org/mtools/mtools-4.0.37.tar.gz"
sha256 "426dc3d15017aae8daf68c9119c0f5f2eafb30deb4a4b417d7d763c4ab728c7b"
... | 34.540984 | 123 | 0.740864 |
f8783a647a9463ebe0750ecf71f361523e6bc1b5 | 6,279 | #-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2018 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 ... | 34.690608 | 94 | 0.587195 |
91019e888715ed5f8012fd3989a9559141d9fd8d | 380 | # typed: false
require "shared_examples_for_opcode"
RSpec.describe(AVR::Opcode) do
describe "elpm" do
include_examples "opcode", :elpm
it "is not implemented" do
expect do
cpu.instruction(:elpm, cpu.r0, AVR::RegisterWithModification.new(cpu.Z, :post_increment)).execute
end.to(raise_error... | 25.333333 | 105 | 0.715789 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.