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 |
|---|---|---|---|---|---|
1adac0e2e3073ab232fbea8c4785802fdc6c0881 | 2,514 | module Teaspoon
def self.setup(&block)
Teaspoon.dep("Teaspoon.setup is deprecated, use Teaspoon.configure instead. The /initializer/teaspoon.rb file should be removed, and a new teaspoon_env.rb file should be created by running the install generator.")
configure(&block)
end
@dep_notified = {}
def self... | 38.090909 | 217 | 0.733095 |
213398407d52752708b51ad3d5d4d903a944838b | 1,027 | module Metrux
module Commands
class PeriodicGauge < Gauge
class Supervisor
include Loggable
include Sleeper
INTERVAL_CHECK = 10
def initialize(agent, config)
@agent = agent
@logger = config.logger
@thread = nil
end
def start
... | 19.018519 | 56 | 0.474197 |
611e19633bb5db2df874b14a7b814da1d3f38783 | 81 | module Arel
module Nodes
class False < Arel::Nodes::Node
end
end
end
| 11.571429 | 35 | 0.654321 |
e92ff3976f8cad03e9dec2c45eaf6ad532db99f6 | 176 | require 'irb/completion'
require 'irb/ext/save-history'
IRB.conf[:SAVE_HISTORY] = 10000
IRB.conf[:HISTORY_FILE] = File.expand_path('~/.irb_history')
require 'twitterscraper'
| 22 | 60 | 0.761364 |
79a4af0432fc99d29533f9c4b60d806f2c3b11c2 | 60 | json.partial! "attributes/attribute", attribute: @attribute
| 30 | 59 | 0.8 |
6a24e971d52041cc46ab17862ff2edc1a9de1d39 | 387 | maxNumber = 2
def findSolution(number)
return (2*number).downto(1).reduce(:*)/ (number.downto(1).reduce(:*)**2)
end
answer = findSolution(maxNumber)
puts "answer for #{maxNumber} is #{answer}."
maxNumber = 3
answer = findSolution(maxNumber)
puts "answer for #{maxNumber} is #{answer}."
maxNumber = 20
answer = fi... | 20.368421 | 74 | 0.702842 |
391eb0db199379f579d45e846cdcfd16546873a4 | 571 | cask :v1 => 'intellij-idea' do
version '15.0.2'
sha256 'b1c30d9416f46045856573709035e4ab2abf472284d2fd010b40387f91286812'
url "https://download.jetbrains.com/idea/ideaIU-#{version}-custom-jdk-bundled.dmg"
name 'IntelliJ IDEA'
homepage 'https://www.jetbrains.com/idea/'
license :commercial
app 'IntelliJ I... | 31.722222 | 84 | 0.658494 |
385eafe4574a1e62c4456f48b03cff7473b95de3 | 4,389 | class Forums::ForumsController < ApplicationController
load_and_authorize_resource :course
before_filter :load_general_course_data, except: [:destroy, :mark_read, :mark_all_read, :next_unread, :next_unanswered, :subscribe, :unsubscribe, :toggle_lock]
before_filter :load_forum, except: [:index, :mark_all_read, :n... | 28.5 | 161 | 0.660287 |
1de6ca3a62374401ac4dd3e009c3bad0a475d0a7 | 31 | require_relative 'bugsnag_jets' | 31 | 31 | 0.903226 |
08858b88f37c7b285615964f57cdfa87aa1eeb3d | 3,944 | require File.expand_path(File.dirname(__FILE__) + '/edgecase')
class AboutClasses < EdgeCase::Koan
class Dog
end
def test_instances_of_classes_can_be_created_with_new
fido = Dog.new
assert_equal __, fido.class
end
# ------------------------------------------------------------------
class Dog2
... | 20.649215 | 80 | 0.627789 |
1d660027ced6c39fb14d93f894d6e3220c01ae9a | 261 | class CreateBookings < ActiveRecord::Migration[5.1]
def change
create_table :bookings do |t|
t.references :journey #, foreign_key: true
t.references :user #, foreign_key: true
t.integer :seats_count
t.timestamps
end
end
end
| 21.75 | 51 | 0.67433 |
bf88bf9281bfb0faf5165008b8d3ec20a163af94 | 2,379 | # 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... | 36.6 | 103 | 0.728457 |
e92c660b156d39f9402a6e1e49bf10ad8bd399ce | 237 | # frozen_string_literal: true
source "https://rubygems.org"
gem "rack", "2.0.8"
gem "rack-test", "~> 1.1"
gem "artifice", "~> 0.6.0"
gem "compact_index", "~> 0.13.0"
gem "sinatra", "~> 2.0"
gem "rake", "13.0.1"
gem "builder", "~> 3.2"
| 19.75 | 32 | 0.586498 |
6a22064dd3992e41bd605df4d38525c0de35adb5 | 102 | # frozen_string_literal: true
require 'test_helper'
class UrlsHelperTest < ActionView::TestCase
end
| 14.571429 | 43 | 0.813725 |
6292203193c8bd2e1336cb96e4f8edbc658d0a9b | 255 | module SharedHelper
def credentials
$credentials ||= YAML.load_file(File.dirname(__FILE__) + "/../credentials.yml")
rescue Errno::ENOENT
warn "WARNING: Running w/o valid AuthorizeNet sandbox credentials. Create spec/credentials.yml."
end
end | 36.428571 | 100 | 0.74902 |
6a31ecde70cec57eeca242c37c6bdeb7d8985167 | 1,097 | # frozen_string_literal: true
require 'aws_backend'
class AWSStepFunctionsStateMachine < AwsResourceBase
name 'aws_stepfunctions_state_machine'
desc 'Describes a state machine.'
example "
describe aws_stepfunctions_state_machine(state_machine_arn: 'state_machine_arn_value') do
it { should exist }
... | 26.756098 | 152 | 0.721057 |
6acfddbb6f110f9b4faaf74fa9a95e80081bc0bd | 2,138 | require 'spec_helper'
module ParallelWorkforce::Job
describe SidekiqRails do
class SidekiqRailsTestActor
def initialize(value:)
@value = value
end
def perform
{
time_zone_name: Time.zone.name,
value: @value,
}
end
end
let(:time_zone_na... | 25.452381 | 102 | 0.62348 |
211410b71ffe9c12793cbfe23520dff1f7dc6465 | 1,748 | class CreateUsers < ActiveRecord::Migration[4.2]
def self.up
create_table :users do |t|
t.timestamps
t.column :name, :string, :null => false
t.column :password_hash, :string, :null => false
t.column :email, :string
t.column :email_verification_key, :string
t.column :inviter_id... | 40.651163 | 88 | 0.645309 |
7a676c5c4c83b08f2d8a12ff270c794ab741253f | 1,023 | module GPhoto2
shared_examples_for Camera::Event do
describe '#wait' do
let(:camera) { Camera.new(model, port) }
let(:event) { double('camera_event') }
before do
allow(camera).to receive(:wait_for_event).and_return(event)
end
it 'waits for a camera event' do
expect(... | 25.575 | 69 | 0.622678 |
4a4e0f2c13788ae39f3f7a9fbc83d342401822fe | 626 | maintainer "Opscode, Inc."
maintainer_email "cookbooks@opscode.com"
license "Apache 2.0"
description "Installs and configures chef client and server"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
version "0.16.2"
recipe "chef::client", "Sets up ... | 36.823529 | 86 | 0.693291 |
abe65564995ee2550f26cc76a5f0064efff09139 | 42 | class Artist < ActiveRecord::Base
end | 14 | 34 | 0.714286 |
5da5a6afd25e9ab5b06582c294afd7980e12d562 | 1,044 | # frozen_string_literal: true
module Consent
class DSL # :nodoc:
attr_reader :subject
def initialize(subject, defaults)
@subject = subject
@defaults = defaults
end
def with_defaults(new_defaults, &block)
DSL.build(@subject, @defaults.merge(new_defaults), &block)
end
# rub... | 26.769231 | 70 | 0.644636 |
f829a39e836aebf4a571567a01aa0e946c11b05c | 1,826 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/eventarc/publishing/v1/publisher.proto
require 'google/api/annotations_pb'
require 'google/api/client_pb'
require 'google/protobuf/any_pb'
require 'google/protobuf'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_file("go... | 45.65 | 194 | 0.77437 |
189fa32c961730cb766326a732e6bf4d28af7c5e | 1,214 | require 'mkmf'
def using_system_libraries?
arg_config('--use-system-libraries', !!ENV['DS9_USE_SYSTEM_LIBRARIES'])
end
dir_config('ds9')
if using_system_libraries?
if with_config("static")
ldflags = pkg_config 'libnghttp2', 'libs-only-L'
archive = File.join ldflags.sub(/^-L/, ''), 'libnghttp2.a'
if ... | 26.977778 | 94 | 0.691104 |
ac1e4a11ba4a318096716c693f2540bf81736d23 | 2,188 | class Podio::SpaceInvitation < ActivePodio::Base
include ActivePodio::Updatable
property :space_id, :integer
property :role, :string
property :subject, :string
property :message, :string
property :notify, :boolean
property :users, :array
property :mails, :array
property :profiles, :array
property :... | 26.361446 | 101 | 0.678245 |
1c358df94e824cffcca3de329f83438679605128 | 185 | class AddIsEditorToUsers < ActiveRecord::Migration
def up
add_column :users, :is_editor, :boolean, :default => false
end
def down
remove_column :users, :is_editor
end
end
| 20.555556 | 61 | 0.72973 |
612bba148aae248420df3c6fdfd15f3743dd19f3 | 27,408 | #-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2017 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 ... | 28.72956 | 92 | 0.619345 |
08b6b25318ea8a78b729eb06866e33138b1c2a0a | 1,166 | # frozen_string_literal: true
module Faker
class Movies
class LordOfTheRings < Base
class << self
##
# Produces a character from Lord of the Rings.
#
# @return [String]
#
# @example
# Faker::Movies::LordOfTheRings.character #=> "Legolas"
#
... | 23.32 | 91 | 0.509434 |
d5d0cd1c1fc188301d47ceefbbdef98aae30d74a | 205 | class CreateUsers < ActiveRecord::Migration[6.0]
def change
create_table :users do |t|
t.string :first_name
t.string :last_name
t.integer :age
t.timestamps
end
end
end
| 17.083333 | 48 | 0.643902 |
f7727d8806a660e4d9f606c11a0138e8db78d0eb | 2,212 | require 'spec_helper'
describe Spree::Admin::TaxonomiesController , :type => "controller" do
def mock_user(stubs={})
@mock_user ||= mock_model(Spree::User, stubs).as_null_object
end
before(:each) do
controller.stub!(:check_http_authorization).and_return(true)
@taxonomies_new = Spree::Taxonomy.n... | 33.014925 | 145 | 0.639241 |
334ef66b1dbc9b9bed740eb2a4727633a003236d | 6,276 | require "rails_helper"
RSpec.describe "users/edit", type: :system do
let(:organization) { create(:casa_org) }
let(:volunteer) do
create(
:volunteer,
last_sign_in_at: "2020-01-01 00:00:00",
current_sign_in_at: "2020-01-02 00:00:00"
)
end
let(:admin) { create(:casa_admin) }
let(:super... | 35.061453 | 115 | 0.692479 |
5d1d89f65f30cc97e3a884d0a11052466d95e89b | 1,478 | module Web
module Controllers
module User
module Password
class Update
include Web::Action
expose :data
def call(params)
@change_password = ChangePassword.new(config: current_config,
user: current_user,
... | 30.791667 | 73 | 0.374154 |
26811da98d3388c2e4a7c55f662bf00236c93a91 | 251 | require 'rails_helper'
RSpec.describe "Cities", type: :request do
#describe "GET /cities" do
# it "works! (now write some real specs)" do
# get admin_settings_cities_path
# expect(response).to have_http_status(200)
# end
#end
end
| 22.818182 | 48 | 0.689243 |
62f957aca54223a4a9f6befaa795dd3e34ce17a2 | 313 | require 'araignee/ai/core/fabricators/ai_interrogator_fabricator'
RSpec.describe 'AI InterrogatorFabricator' do
let(:interrogator) { Fabricate(:ai_interrogator) }
subject { interrogator }
describe '#initialize' do
it 'should have no child' do
expect(subject.child).to eq(nil)
end
end
end
| 22.357143 | 65 | 0.734824 |
e9bd08dad40ef65af361aac236c371c35bec2e7b | 3,629 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::DataFactory::Mgmt::V2017_09_01_preview
module Models
#
# Jira Service dataset.
#
class JiraObjectDataset < Dataset
include MsRestAzure
... | 29.266129 | 75 | 0.414439 |
ed81e51b9f9b0ed56a48e0daa5b4c9da1ea92413 | 1,187 | # frozen_string_literal: true
require_relative "boot"
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "active_storage/engine"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_mailbox/... | 29.675 | 79 | 0.768324 |
b9068c611063bd718ec7d9b8f5a755e8c282c875 | 3,242 | require 'spec_helper'
module VCAP::CloudController
module Jobs::Runtime
RSpec.describe PendingBuildCleanup do
subject(:cleanup_job) { described_class.new(staging_timeout) }
let(:staging_timeout) { 15.minutes.to_i }
it { is_expected.to be_a_valid_job }
it 'knows its job name' do
... | 34.860215 | 133 | 0.638803 |
337ded75883910d8216247a08d0e1a951c61c87a | 184 | module ImageInfo
class Configuration
attr_accessor :max_concurrency, :max_image_size
def initialize
@max_concurrency = 20
@max_image_size = -1
end
end
end
| 16.727273 | 51 | 0.701087 |
267cefcc964a0b7197c3dc14069f35e9c31025c5 | 10,498 | require 'test_helper'
class WikiPagesControllerTest < ActionDispatch::IntegrationTest
context "The wiki pages controller" do
setup do
@user = create(:user)
@mod = create(:moderator_user)
end
context "index action" do
setup do
as(@user) do
@tagme = create(:wiki_page, t... | 33.326984 | 116 | 0.636312 |
7a3c072e581b4a5a8a6fd547ba54393780c500d8 | 1,067 | #!/usr/bin/ruby
require "net/http"
require "uri"
MACS="/var/local/macs"
SERVER="api.hsmty.org"
PORT="80"
def get_macs()
macs = []
output = `arp-scan --localnet -q`
output.each_line do |line|
mac = filter_mac(line)
macs.push(mac) if mac.length > 0
end
return macs;
end
def filter_m... | 18.396552 | 52 | 0.638238 |
b9aa5b990ed9189b3218f21141e6ee5173bfa579 | 77 | class Float
def formated
self % 1 === 0 ? self.to_i : self
end
end
| 9.625 | 37 | 0.584416 |
1c7b2ecf4f169d6c0d64a2a66c84cd947959f0a0 | 1,026 | #
# Fluentd
#
# 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, so... | 29.314286 | 77 | 0.695906 |
01fbebd2cb021ac7f6eb7ed1c92919a4ce6ae043 | 1,121 | # encoding: utf-8
module Rubocop
module Cop
module Style
# Checks for uses of double quotes where single quotes would do.
class StringLiterals < Cop
MSG = "Prefer single-quoted strings when you don't need " +
'string interpolation or special symbols.'
def on_str(node)
... | 30.297297 | 77 | 0.568243 |
18e07f3a3f77219f4786076177d0ebcb61d125c6 | 1,528 | module HubEdos
module StudentApi
module V2
module StudentRecord
# An Institution describes a high school, college, or university that grants academic credit.
class Institution
def initialize(data)
@data = data
end
# a short string used to identify t... | 29.960784 | 143 | 0.590969 |
6118db7a2dee68621e9d0c7509d53e596451e54d | 185 | FactoryBot.define do
factory :sample_image do
data_file { Rack::Test::UploadedFile.new(File.open(File.expand_path('../../fixtures/files/sample_image.jpg', __FILE__))) }
end
end
| 30.833333 | 126 | 0.735135 |
391179ddf703fdf1b1cd3a0d1ab0f4048565d765 | 1,108 | module Nanoc::Helpers
# @see http://nanoc.ws/doc/reference/helpers/#filtering
module HTMLEscape
require 'nanoc/helpers/capturing'
include Nanoc::Helpers::Capturing
# @param [String] string
#
# @return [String]
def html_escape(string = nil, &block)
if block_given?
# Capture and... | 28.410256 | 88 | 0.583032 |
e2767f480a3275c3957434af3ac346a40a89250b | 1,562 | #
# Be sure to run `pod lib lint YXBase.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'YXBase'
s.... | 38.097561 | 103 | 0.642125 |
794948c02a275a927b66a48d48545024411a1c4a | 120 | class AddProjectRefToTasks < ActiveRecord::Migration
def change
add_column :tasks, :project, :reference
end
end
| 20 | 52 | 0.766667 |
5d3d5a92fb446bb265556e6bd9b150fd90a234ed | 176 | class Location < ActiveRecord::Base
belongs_to :region
has_many :people
def self.in_region(region)
Location.joins(:region).merge(Region.in_region(region))
end
end
| 19.555556 | 59 | 0.75 |
7ad418e940d98164a57b7d18e82fb463f44c05ef | 7,685 | require 'spec_helper'
module Omnibus
describe NetFetcher do
include_examples 'a software', 'zlib'
let(:source_url) { 'http://downloads.sourceforge.net/project/libpng/zlib/1.2.8/zlib-1.2.8.tar.gz' }
let(:source_md5) { '44d667c142d7cda120332623eab69f40' }
let(:source_sha1) { 'a4d316c404ff54ca545ea71a2... | 28.357934 | 158 | 0.602993 |
335dbad71518b41865689e5f07ee029a3ca8435d | 140 | require 'spec_helper'
describe 'rhsm' do
context 'with defaults for all parameters' do
it { should contain_class('rhsm') }
end
end
| 17.5 | 47 | 0.714286 |
ff58076f5b8acb69917e9911c17237c772867dd2 | 2,126 | class Kcov < Formula
desc "Code coverage tester for compiled programs, Python, and shell scripts"
homepage "https://simonkagstrom.github.io/kcov/"
url "https://github.com/SimonKagstrom/kcov/archive/38.tar.gz"
sha256 "b37af60d81a9b1e3b140f9473bdcb7975af12040feb24cc666f9bb2bb0be68b4"
license "GPL-2.0"
revisio... | 37.964286 | 123 | 0.714958 |
7a548df3ed4df6caf85a223073bb94b5c81d71f1 | 1,312 | # 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_07_01
module Models
#
# Parameters that define a resource to query flow log and traffic analytics
# (option... | 26.77551 | 79 | 0.585366 |
ab14b61678b6e0f4246cbe67d5e5b66c54ef9ddc | 462 | class Micropost < ApplicationRecord
belongs_to :user
validates :user_id, presence: true
validates :content, presence: true, length: {maximum:140}
default_scope -> { order(created_at: :desc) }
mount_uploader :picture, PictureUploader
validate :picture_size
private
# Validates the size of an uploaded p... | 27.176471 | 59 | 0.712121 |
1c3a142fe099371b4e4ce726249163d0e7e040d0 | 1,436 | require "language/node"
class Vite < Formula
desc "Next generation frontend tooling. It's fast!"
homepage "https://vitejs.dev/"
url "https://registry.npmjs.org/vite/-/vite-2.8.3.tgz"
sha256 "4ec974208f75765f844dc55ca37f82bf721c2674a57b2498731fa06b333af70d"
license "MIT"
bottle do
sha256 cellar: :any_s... | 39.888889 | 123 | 0.773677 |
4a1fc7ae7d501df5cd38422ad207c49274d31845 | 1,893 | class Bird
BIRD_COUNT_BOUND = 21
G = 9.8
VY = Math.sqrt(2*G*40)
attr_accessor :score
def initialize width, height
@font = Gosu::Font.new 30, name: './font/04B_19__.ttf'
@birds = [*0..2].map{|i| Gosu::Image.new "./img/bird_#{i}.png"}
@window_width = width
@window_height = height
@width = ... | 21.511364 | 88 | 0.565769 |
ff3d3358a89a4f537a39057b75bcc9a2392a3f5b | 1,932 | # This file is copied to ~/spec when you run 'ruby script/generate rspec'
# from the project root directory.
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path(File.join(File.dirname(__FILE__),'..','config','environment'))
require 'spec/autorun'
require 'spec/rails'
# Uncomment the next line to use webrat's matchers... | 35.127273 | 99 | 0.715839 |
6294c771a0793716bdd00a2b72bbcbbdeeb914a1 | 16,687 | # frozen_string_literal: true
RSpec.describe TTY::Prompt do
let(:symbols) { TTY::Prompt::Symbols.symbols }
subject(:prompt) { TTY::Prompt::Test.new }
def output_helper(prompt, choices, active, options = {})
enum = options.fetch(:enum, ")")
input = options[:input]
error = options[:error]
... | 30.959184 | 122 | 0.54899 |
03f62f5aa3c7d08269eb23c91d630ae38aae7d29 | 403 |
def should_have_window hash, nb: required
verify_window_opened hash[:name], number: nb
verify_sent_keys hash[:command], win_number: nb unless hash[:command].empty?
end
Then(/^it shall open the following windows:$/) do |table|
# table is a Cucumber::Ast::Table
# require 'pry'
# binding.pry
table.hashes.... | 26.866667 | 78 | 0.724566 |
212f7080e2af06ba6d8b9cb668edc12d57eaed73 | 1,370 | # encoding: UTF-8
# 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 sou... | 33.414634 | 86 | 0.725547 |
e971cdba238e2505c49f0bd325eaa62f5852c822 | 139 | # Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: '_scm_api_session'
| 34.75 | 77 | 0.805755 |
7aee182a73fd33e26f9bc61fea0db95eb83d9d9d | 3,446 | require 'puppet/provider'
require 'puppet/util/execution'
class Puppet::Provider::Exec < Puppet::Provider
include Puppet::Util::Execution
def run(command, check = false)
output = nil
status = nil
dir = nil
checkexe(command)
if dir = resource[:cwd]
unless File.directory?(dir)
if... | 35.525773 | 167 | 0.60621 |
266c9dcb47b4d74aab38b87300064e3cd4a23588 | 954 | require 'rubygems'
require 'pathname'
require Pathname(__FILE__).dirname.expand_path.parent + 'lib/dm-ar-finders'
def load_driver(name, default_uri)
return false if ENV['ADAPTER'] != name.to_s
lib = "do_#{name}"
begin
gem lib, '=0.9.5'
require lib
DataMapper.setup(name, ENV["#{name.to_s.upcase}_SPE... | 30.774194 | 86 | 0.702306 |
03a571c25b9fb7f436cb921c5ac86412de0af236 | 3,749 | require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
require 'general_model_logic'
describe 'Using publishing logic on models with all fields' do
describe "validations" do
it 'should NOT allow #published_until to be before #published_at' do
programme = make_programme(published_at: 3.d... | 36.398058 | 108 | 0.679648 |
6280807c68c89feeb7c3fed4bd2ed8d3a0554f8e | 471 | require 'rails_helper'
field_name = field_name_from __FILE__
type = type_from __FILE__
describe field_name do
it_behaves_like \
"#{type} partial", field_name,
value: 88.8888,
type: 'number' do
context 'when metadata options are given' do
let(:metadata) { { options: { step: 2 } } }
it 'se... | 23.55 | 66 | 0.649682 |
1cd74fc8f55fe0d81ecc721c3e2728de73241a40 | 1,047 | # frozen_string_literal: true
# Post Controller for Index
class PostsController < ApplicationController
# Memperlihatkan Semua post di View Index
def index
@post = Post.all
end
# Memperlihatkan Post Melalui id nya
def show
@post = Post.find(params[:id])
end
# Membuat Post baru
def new
@po... | 17.45 | 58 | 0.659026 |
bf89c979887a7896a24250c45d6e56efebf707f0 | 664 | Pod::Spec.new do |s|
s.name = 'XINGAPI'
s.version = '0.1.0'
s.license = 'MIT'
s.ios.deployment_target = '6.0'
s.osx.deployment_target = '10.7'
s.summary = 'The official Objective-C client for the XING API'
s.author = {
'XING iOS Team' => 'iphonedev@xing.com'
}
s.source = {
:git => 'https://gi... | 28.869565 | 64 | 0.620482 |
1c298ec39e06cb48d0673ca30a2ba7170d2848b7 | 9,418 | require 'spec_helper'
describe 'Auto Encryption' do
require_libmongocrypt
require_enterprise
min_server_fcv '4.2'
# Diagnostics of leaked background threads only, these tests do not
# actually require a clean slate. https://jira.mongodb.org/browse/RUBY-2138
clean_slate
include_context 'define shared FL... | 30.980263 | 89 | 0.689106 |
bb29078a0455763e49ceb031e2b6c4ef31336426 | 1,873 | #
# Cookbook:: ambari-chef
# Spec:: default
#
# The MIT License (MIT)
#
# Copyright:: 2018, Ryan Hansohn
#
# 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 witho... | 37.46 | 79 | 0.747464 |
1866cff09c49d03451c4db57b358748e43baf86d | 103,108 | # 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,... | 39.718028 | 124 | 0.607043 |
6a8a2f0fc8c6808ef08897549de06893cb70cfcf | 5,185 | # frozen_string_literal: true
require_relative "../../test_helper"
SingleCov.covered!
describe RollbarDashboards::Client do
let(:dashboard) do
RollbarDashboards::Setting.create!(
project: projects(:test),
base_url: 'https://bingbong.gov/api/1',
read_token: '12345'
)
end
describe "#to... | 31.047904 | 109 | 0.629315 |
87271b4ef2aa40bc4ef5cf500e5c36fbaf859e2f | 505 | class AccountActivationsController < ApplicationController
def edit
user = User.find_by(activation_digest: params[:activation_digest])
if user && !user.activated? && user.authenticated?(:activation, params[:id])
user.update_attribute(:activated, true)
user.update_attribute(:activated_at, Time.zone.n... | 31.5625 | 79 | 0.718812 |
ff9316b73d777c082ed0604e2ac14ddf48d0e5bb | 12,813 | # Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either lic... | 42.287129 | 245 | 0.685788 |
1abfe040a20294202a91d0f390b3e2f9826ec1b9 | 98 | Rails.application.routes.draw do
mount DeviseApiFrontend::Engine => "/devise_api_frontend"
end
| 19.6 | 59 | 0.795918 |
6af50f832b48bd1cb19d1b14faab576aa5620ea2 | 766 | class ManageIQ::Providers::IbmCloud::Inventory::Collector::PowerVirtualServers < ManageIQ::Providers::IbmCloud::Inventory::Collector
require_nested :CloudManager
require_nested :NetworkManager
require_nested :StorageManager
def connection
@power_iaas ||= manager.connect(:service => "PowerIaas")
end
de... | 18.238095 | 132 | 0.749347 |
bf2477c32db01c8b947a1e2a0f8a98839a1c8c26 | 1,173 | require 'umu/common'
require 'umu/lexical/position'
module Umu
module ConcreteSyntax
module Core
module Expression
module Nary # N-ary, where N >= 3
class Let < Expression::Abstract
attr_reader :decls, :expr
def initialize(pos, decls, expr)
ASSERT.kind_of decls, ::Array
ASSERT.kind_of expr, SCCE::Abstra... | 14.848101 | 49 | 0.683717 |
1af874cb3cda28ada0b818da29de595f9a9673aa | 1,609 | require 'helper'
class GogcomGameTest < Minitest::Test
def setup
VCR.use_cassette('game') do
@game = Gogcom.game(:name => "Faster Than Light")
end
end
def test_game
assert @game.is_a?(Struct)
end
def test_game_title
assert_equal @game.title, "FTL: Advanced Edition"
end
def test... | 20.628205 | 106 | 0.715973 |
abea8997e3f2ecf6f66997fdf7d14371a44f2307 | 1,811 | require 'rails_helper'
RSpec.describe 'MicropostsInterfaceTest', type: :system do
before do
FactoryBot.send(:user_with_posts, posts_count: 35)
@user = Micropost.first.user
@user.password = 'password'
visit login_path
fill_in 'Email', with: @user.email
fill_in 'Password', with: @user.password
... | 27.861538 | 89 | 0.664826 |
26ca021d10c06ac5af2ac694d189446ad5cae150 | 2,661 | # frozen_string_literal: true
module CommonwealthVlrEngine
module InstitutionsHelperBehavior
# link to view all items from an institution
def link_to_all_inst_items(link_class)
link_to(t('blacklight.institutions.browse.all'),
search_catalog_path(f: { blacklight_config.institution_field =>... | 47.517857 | 115 | 0.58136 |
21229d48e7336641dda13631bf776eff0ab27fa7 | 781 | class MicropostsController < ApplicationController
before_action :logged_in_user, only: [:create, :destroy]
before_action :correct_user, only: [:destroy]
def create
@micropost = current_user.microposts.build(micropost_params)
if @micropost.save
flash[:success] = "Micropost created!"
redirect_... | 23.666667 | 65 | 0.710627 |
e9b3367708efdcb3397b5f8c10a20a7b6f0c16ca | 4,220 | # encoding: utf-8
require File.join(File.dirname(__FILE__), 'helper')
class IpGeocoderTest < BaseGeocoderTest #:nodoc: all
IP_FAILURE=<<-EOF
Country: SWITZERLAND (CH)
City: (Unknown City)
Latitude:
Longitude:
EOF
IP_SUCCESS=<<-EOF
Country: UNITED STATES (US)
City: Sugar Grove, IL
... | 31.259259 | 92 | 0.707583 |
62eb85092b59382adb91a475aa68eb570b55c8e2 | 1,557 | #!/usr/bin/env ruby
require 'bacon'
require "#{File.expand_path(File.dirname(__FILE__))}/../lib/bitcask"
unless ARGV.first
puts "I need a bitcask directory."
exit 1
end
Bacon.summary_on_exit
describe 'Bitcask' do
before do
@b = Bitcask.new ARGV.first
end
should 'have DataFiles' do
@b.data_files.s... | 20.220779 | 76 | 0.642261 |
5df26c47106293fc45014c024f795ade8db3574c | 1,591 | class Blahtexml < Formula
desc "Converts equations into Math ML"
homepage "http://gva.noekeon.org/blahtexml/"
url "http://gva.noekeon.org/blahtexml/blahtexml-0.9-src.tar.gz"
sha256 "c5145b02bdf03cd95b7b136de63286819e696639824961d7408bec4591bc3737"
bottle do
cellar :any
sha256 "5865796763721f8e0fb50dc... | 38.804878 | 110 | 0.783784 |
ed3541286e017a168796b50bbe35e7ccf5fdf28d | 3,961 | #!/usr/bin/env ruby
# Encoding: utf-8
#
# Copyright 2020 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 ... | 33.285714 | 88 | 0.708659 |
387b7355c6c2a1d1e2ab3913de62cd56f5e13e93 | 48 | module Hicube
module ContentsHelper
end
end
| 9.6 | 23 | 0.791667 |
e830fac540444f994825301dcfa2e5ecb8ad4ec9 | 1,216 | module UI
module MiningGame
# Class that describes the Diggable_Sprite object
class Diggable_Sprite < ShaderedSprite
# Create the Diggable_Sprite
# @param viewport [Viewport] the viewport of the scene
# @param item [PFM::MiningGame::Diggable] the item/iron object
def initialize(viewpor... | 27.022222 | 73 | 0.583059 |
5dae8e96b5766129fb58d83f2b448af23fb9a898 | 598 | Pod::Spec.new do |s|
s.name = 'SwiftEventBus'
s.version = '5.0.0'
s.license = 'MIT'
s.summary = 'Publish/subscribe event bus optimized for iOS'
s.homepage = 'https://github.com/cesarferreira/SwiftEventBus'
s.social_media_url = 'http://twitter.com/cesarmcferreira'
s.authors = { 'César Ferreira' => 'cesar.m... | 39.866667 | 96 | 0.700669 |
08f9301d86f9573f3096329340d1572f63d40472 | 647 | Pod::Spec.new do |s|
s.name = "MMMWhatsAppActivity"
s.version = "1.0"
s.summary = "MMMWhatsAppActivity is a UIActivity subclass providing WhatsApp support for text (NSString) or image (UIImage)."
s.homepage = "https://github.com/mvarie/MMMWhatsAppActivity"
s.license = { :type => 'MI... | 43.133333 | 132 | 0.599691 |
e983026961aaac28fe518b2786780b52efe5c501 | 25,259 | require "active_support/core_ext/hash/except"
require "active_support/core_ext/object/try"
require "active_support/core_ext/hash/indifferent_access"
module ActiveRecord
module NestedAttributes #:nodoc:
class TooManyRecords < ActiveRecordError
end
extend ActiveSupport::Concern
included do
clas... | 42.88455 | 149 | 0.649511 |
8774db26ec8a93aaa8f8db58bb854b5690d779d0 | 1,276 | require_relative "lib/polyssh/version"
Gem::Specification.new do |spec|
spec.name = "polyssh"
spec.version = Polyssh::VERSION
spec.authors = ["labocho"]
spec.email = ["labocho@penguinlab.jp"]
spec.summary = "polyssh runs command on multiple remote servers via ssh with frie... | 44 | 99 | 0.682602 |
acb31fee555040ee0f26f45a4abac920b7755e9a | 409 | # frozen_string_literal: true
FactoryBot.modify do
factory :project_member do
trait :awaiting do
after(:create) do |member|
member.wait
end
end
trait :active do
after(:create) do |member|
member.activate
end
end
trait :created do
after(:create) do |... | 17.041667 | 52 | 0.608802 |
01a0821b7a42590fa5b1bc91bcf8adbbba7d219b | 42 | module Vorpal
VERSION = "0.1.0.rc3"
end
| 10.5 | 23 | 0.666667 |
26828734e35a375a700b1fe10693d34f4a26bb3a | 2,018 | # frozen_string_literal: true
module Miehisto
class Restorer
# TODO: dup
GREN_SV_PIDFILE_PATH = '/var/run/runmh-%d.pid'
GREN_RES_PIDFILE_PATH = '/var/run/runmh-tmp.%s.%d.pid'
def initialize(object_id:)
@object_id = object_id
end
def run
ENV['MIEHISTO_OBJECT_ID'] = @object_id
... | 28.422535 | 75 | 0.644202 |
87d2f0e7eb3f351e88910b4af29c0decc015d927 | 266 | require 'rails_helper'
describe 'destroy section path' do
it 'will destroy the section' do
section = Section.create(title: "Rails")
visit section_path(section)
click_on "Destroy #{section.title}"
expect(page).to have_content('sections')
end
end
| 24.181818 | 44 | 0.718045 |
1a7773146532396ad97efd5cd98181730d82ef10 | 117 | require_relative "../shared_example/tablelike"
RSpec.describe RpnUIA::Calculator do
it_behaves_like "a table"
end
| 19.5 | 46 | 0.803419 |
1cebdc973180eef55ad8b013ae5a48528e47ab6c | 240 | module SpiralForm
module ViewHelper
def spiral_form(token)
content_tag(:form, "", id: "spiral") do
concat content_tag(:input,"", name: "authenticity_token", type: "hidden", value: token)
end
end
end
end | 26.666667 | 97 | 0.633333 |
e92f4ca75ce78c63ef5d082114eb83e4a1abc9d8 | 2,251 | require 'rails_helper'
RSpec.describe 'User Accounts', type: :system do
let!(:user) do
create(
:user,
username: 'Jeremy Beagle',
email: 'jezza@beagle.com',
learning_goal: 'Javascript'
)
end
before do
sign_in(user)
visit edit_user_registration_path
end
describe 'editi... | 32.157143 | 102 | 0.661484 |
38fcfc3f8680f34e81ec1cb1afce824a70fd3ab5 | 22,900 | require "helper"
module Nokogiri
module XML
class TestNodeReparenting < Nokogiri::TestCase
describe "standard node reparenting behavior" do
# describe "namespace handling during reparenting" do
# describe "given a Node" do
# describe "with a Namespace" do
# it "... | 41.636364 | 183 | 0.503231 |
3977a7a5601b3cd8cbc575dbd0087e88225e7c9e | 97 | # desc "Explaining what the task does"
# task :decimal_comma_entry do
# # Task goes here
# end
| 19.4 | 38 | 0.71134 |
088c1350ad9947b81ca7b791632298bc8e5f565d | 3,256 | require 'rails_helper'
RSpec.describe Groups::PositionsController, vcr: true do
describe 'GET index' do
before(:each) do
get :index, params: { group_id: 'ziLwaBLc' }
end
it 'should have a response with http status ok (200)' do
expect(response).to have_http_status(:ok)
end
it 'assign... | 29.071429 | 95 | 0.614558 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.