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
ab7c4363c062eb27c0805a24ffe55e76d351b50b
3,455
require 'rails_helper' RSpec.describe FormulationUploadController, type: :controller do let(:responsible_person) { create(:responsible_person) } let(:notification) { create(:notification, responsible_person: responsible_person) } let(:component) { create(:component, notification: notification) } let(:other_res...
36.368421
138
0.725904
2886b7797448a15f41b29f7798245cdef7aa4971
9,373
# -*- coding: utf-8 -*- =begin parser/ruby.rb - parser for ruby script Copyright (C) 2013 Kouhei Sutou <kou@clear-code.com> Copyright (C) 2003-2009 Masao Mutoh Copyright (C) 2005 speakillof Copyright (C) 2001,2002 Yasushi Shoji, Masao Mutoh You may redistribute it and/or modify it under the ...
28.317221
104
0.554465
f8f8483a74f29a854bf8926c39a4116cbbf01284
628
module Hbc::Options def self.included(base) base.extend(ClassMethods) end module ClassMethods def no_binaries @no_binaries ||= false end def no_binaries=(_no_binaries) @no_binaries = _no_binaries end def debug @debug ||= false end def debug=(_debug) @deb...
15.7
44
0.627389
1880ff1ddcdd960a7c2da6014be1644fb9520896
13,991
# frozen_string_literal: true require 'excon' require 'json' require 'jsonpath' module K8s # Excon-based HTTP transport handling request/response body JSON encoding class Transport include Logging quiet! # do not log warnings by default # Excon middlewares for requests EXCON_MIDDLEWARES = [ ...
36.34026
171
0.652134
e281475cf103dc93bc5eb709fbea30e4587a185d
8,286
=begin #The Plaid API #The Plaid REST API. Please see https://plaid.com/docs/api for more details. The version of the OpenAPI document: 2020-09-14_1.58.1 Generated by: https://openapi-generator.tech OpenAPI Generator version: 5.1.0 =end require 'date' require 'time' module Plaid # An object representing the rep...
31.033708
266
0.626478
d5b33dda3adf0df3fabcce6ea0d26cc51fff5685
1,161
=begin #Datadog API V1 Collection #Collection of all Datadog Public endpoints. The version of the OpenAPI document: 1.0 Contact: support@datadoghq.com Generated by: https://openapi-generator.tech Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. This product...
29.025
107
0.731266
1d880ac9027e8f50929589b5430d4dea0b5366ac
427
require_relative '../../automated_init' context "Handler" do context "Delete Command" do context "Ignored" do id = Controls::PrimaryKey::UUID.example command = Controls::Commands::Delete.example(primary_key: id) handler = ViewData::PG::Handler.build handler.(command) row = Contro...
20.333333
67
0.637002
1aca020a32e077d485b66ba7232f8aaec84343bd
479
# frozen_string_literal: true # Service gor logging params to file class LoggerService # @param controller [Karafka::BaseController instance] # @param path [String] path to file def write_to_file(controller, path) file = File.open(path, 'a+') file.write "Controller topic details: #{controller.topic.to_h}...
25.210526
69
0.701461
5d4bf036536f4577608a3770b1262342ffc5f898
1,077
# == Schema Information # # Table name: users # # id :integer not null, primary key # email :string default(""), not null # encrypted_password :string default(""), not null # reset_password_token :string # reset_password_sent_at :datetime # r...
29.916667
65
0.538533
26056f6f6304f7d301ecb573acbf31509335a1da
12,323
require "cases/helper" require "models/computer" require "models/developer" require "models/project" require "models/company" require "models/categorization" require "models/category" require "models/post" require "models/author" require "models/comment" require "models/tag" require "models/tagging" require "models/per...
34.518207
122
0.760529
f7dd10543b6152dbcee59c20f6e9c5e7d196e894
806
require "#{Vagrant::source_root}/plugins/providers/virtualbox/synced_folder" require_relative '../../../../helper' module VagrantPlugins module ProviderVirtualBox class SyncedFolder < Vagrant.plugin("2", :synced_folder) include VagrantWindows::Helper vagrant_prepare = instance_method(:pre...
29.851852
83
0.636476
4ab9eb58cf2a98db740dad434b43daf910040afe
3,811
require 'spec_helper' RSpec.describe GetResponseApi::Connection do let(:api_key) { 'api-key-123456' } let(:url) { 'https://api.getresponse.com/v3/' } let(:path) { 'accounts' } let(:headers) do { 'X-Auth-Token' => "api-key #{api_key}", 'Content-Type' => 'application/json', 'Accept' =...
31.237705
104
0.659669
f73cc776245b7120554e6fc7c624577fca7517b6
143
require 'spec_helper' describe 'confluence::windows_war' do let(:chef_run) do ChefSpec::Runner.new.converge(described_recipe) end end
17.875
51
0.762238
08f49e101c04e4a8dcf7316bbaa09468d304090f
1,728
require "test_helper" class UsersSignupTest < ActionDispatch::IntegrationTest def setup ActionMailer::Base.deliveries.clear end test "invalid sign up information" do get signup_path assert_no_difference "User.count" do post users_path, params: { user: { name: "", ...
34.56
78
0.631944
26bc9802ad5076adafae2b3495ccf59719987cde
768
SecureHeaders::Configuration.default do |config| config.x_frame_options = 'DENY' config.referrer_policy = 'strict-origin-when-cross-origin' asset_src = ["'self'", "'unsafe-inline'", ENV['AWS_S3_ASSET_HOST']].compact script_src = asset_src + ["'unsafe-eval'", 'https://www.google-analytics.com', 'https://cdnjs...
30.72
112
0.653646
389b0369eb2da09f4eab0f42af94f0f135fffae5
2,348
RSpec.describe TopologicalInventory::Openshift::Parser do let(:parser) { described_class.new(:openshift_host => "localhost") } context "#parse_base_item" do let(:entity) do Kubeclient::Resource.new( :metadata => { :name => "my-entity", :resourceVersion => "1", ...
31.72973
102
0.645656
385b4c8fc3d63a023357cb55aa6fa77273d2f4bc
315
class CreateNotifications < ActiveRecord::Migration[5.2] def change create_table :notifications do |t| t.integer :recipient_id t.integer :actor_id t.datetime :read_at t.string :action t.integer :notifiable_id t.string :notifiable_type t.timestamps end end end
21
56
0.673016
26b992ad79e12e31c29960ccdcf55fe69a8533dd
4,582
# 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 #...
39.162393
95
0.71017
d54de44c92e84f5027ae653d64f509fe323db300
7,061
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
48.034014
190
0.604305
f7e12cd3dee68d97c90ebd86dfb9d7e92b2f9ce0
366
require 'rails_helper' RSpec.describe 'todo_lists/new', type: :view do before(:each) do assign(:todo_list, TodoList.new(title: 'MyString')) end it 'renders new todo_list form' do render assert_select 'form[action=?][method=?]', todo_lists_path, 'post' do assert_select 'input#todo_list_title[n...
22.875
72
0.688525
91b2f35db3b14c7ad3acd4d2fc4b9ed276026525
341
module BrowsingServices depends_on :dragonfly_photos_app # prepares a photo as a jpeg file for download and returns it's path # Context: # * `session_id` (required) # * `user` # * `photo` (required) def download_photo(identity:, photo:) dragonfly_photos_app.fetch(photo.photo_uid).encode('jpg')...
24.357143
71
0.70088
e8fe320f2986143822fcfe62cb6ca39d28614125
640
# frozen_string_literal: true Gem::Specification.new do |spec| spec.name = "poole-for-jekyll" spec.version = "3.0.0" spec.authors = ["Mark Otto"] spec.email = ["markdotto@gmail.com"] spec.summary = "웹 프론트엔드 개발자." spec.homepage = "https://seolranlee.github.io/" spe...
32
132
0.620313
7aed3a2817a5ec32f120024651d297b35798f832
464
# # encoding: utf-8 # Inspec test for recipe variant_call_rna::data # The Inspec reference, with examples and extensive documentation, can be # found at https://docs.chef.io/inspec_reference.html unless os.windows? describe user('root') do it { should exist } skip 'This is an example test, replace with you...
24.421053
73
0.728448
f74691c7630a8cfa10a368a377c4505d01c82f08
1,880
class UsersController < ApplicationController # GET /users # GET /users.json def index @users = User.all respond_to do |format| format.html # index.html.erb format.json { render :json => @users } end end # GET /users/1 # GET /users/1.json def show @user = User.find(params[:id...
22.380952
86
0.593617
330a60f5f011db6d8e7a823beb25861129869511
2,922
require 'guard/rspec' require 'rspec/core/formatters/base_formatter' module Guard class RSpec class Formatter < ::RSpec::Core::Formatters::BaseFormatter TEMPORARY_FILE_PATH ||= File.expand_path('./tmp/rspec_guard_result') def self.rspec_3? ::RSpec::Core::Version::STRING.split('.').first == "...
29.22
127
0.602669
2661191bd7f067820f7b9d7283ef060807a21ad5
19,278
require File.expand_path('../mongo_mapper_spec_helper', __FILE__) describe Audited::Auditor, :adapter => :mongo_mapper do describe "configuration" do it "should include instance methods" do expect(Models::MongoMapper::User.new).to be_a_kind_of(Audited::Auditor::AuditedInstanceMethods) end it "sho...
34.672662
150
0.65318
912804d579c80ebc9fa0cb52727abf7b38062629
4,026
module Liquid # Profiler enables support for profiling template rendering to help track down performance issues. # # To enable profiling, pass the <tt>profile: true</tt> option to <tt>Liquid::Template.parse</tt>. Then, after # <tt>Liquid::Template#render</tt> is called, the template object makes available an i...
25.1625
113
0.638847
f8528f24335d10a335c158df1d665a59f0c87511
151
# frozen_string_literal: true class AddDayToMatch < ActiveRecord::Migration[4.2] def change add_reference :matches, :day, index: true end end
18.875
50
0.748344
338d1a5f93772e8883e7bec4e1330f88c5a53e55
305
module Voom module Presenters module DSL module Components module Actions class Remove < Actions::Base def initialize(**attribs_, &block) super(type: :remove, **attribs_, &block) end end end end end end end
19.0625
54
0.527869
26864aaf15dd08cd93dd059b820a3a8c095fd451
2,199
require_relative "test_helper" class RationalTest < StdlibTest target Rational def test_calc 10r % 10 10r % 1.3 10r % 2r 10r * 10 10r * 1.2 10r * 2r 10r * Complex.rect(1,2) 3r ** 2 3r ** 2.1 3r ** 2r 3r ** Complex.rect(1,2) 10r + 10 10r + 1.2 10r + 2r ...
12.082418
62
0.524329
bb997bf9f6317b053659327e5c77a1c3b672b9b3
93
# Resque::Server.use(Rack::Auth::Basic) do |user, password| # password == "cocoapods" # end
31
59
0.666667
912bbdc5314e14bcd4ab90aaf323328c1c06f53a
1,855
class YelpTools < Formula desc "Tools that help create and edit Mallard or DocBook documentation" homepage "https://github.com/GNOME/yelp-tools" url "https://download.gnome.org/sources/yelp-tools/3.28/yelp-tools-3.28.0.tar.xz" sha256 "82dbfeea2359dfef8ee92c7580c7f03768d12f9bf67d839f03a5e9b0686dc1ac" revision ...
35
93
0.679784
bfbdcb088c84bfc75dee41afce1e757099103c2e
3,443
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...
39.574713
104
0.757188
3842b05bc2c6afc31ac9ac84ca07674d54b96533
12,396
#!/usr/bin/env rspec require 'spec_helper' require 'puppet/file_serving/metadata' describe Puppet::FileServing::Metadata do it "should should be a subclass of Base" do Puppet::FileServing::Metadata.superclass.should equal(Puppet::FileServing::Base) end it "should indirect file_metadata" do Puppet::File...
34.722689
180
0.657147
33f35e62d05173b38a0f65e1e2ce119647f26e05
1,270
require_dependency 'spree/calculator' module Spree module Calculator::Shipping module Sendcloud class Base < Spree::Calculator::Shipping::ActiveShipping::Base preference :api_key, :string preference :api_secret, :string def carrier carrier_details = { api_ke...
30.97561
124
0.623622
917c927566d319eec9ea12b6410c61225cc2421d
633
require 'dotenv' module Dotenv class Stage attr_reader :stage def initialize(stage = nil) @stage = stage || default_stage end def self.load(stage = nil) new(stage).load end def load Dotenv.load(*dotenv_files) end private def default_stage ENV.fetch('ST...
18.085714
79
0.592417
6210da2fa6a86d0bd1b95802d4541712c1a73e2d
6,686
# frozen_string_literal: true class DomainStatus < ApplicationRecord include EppErrors belongs_to :domain SERVER_RELEASE_PROHIBITED = 'serverReleaseProhibited' # Requests to delete the object MUST be rejected. CLIENT_DELETE_PROHIBITED = 'clientDeleteProhibited' SERVER_DELETE_PROHIBITED = 'serverDeletePro...
36.736264
111
0.75845
ac96b024340d099b4307c387fd44dff5152ac495
4,518
# encoding: utf-8 require "logstash/outputs/base" require "logstash/namespace" class LogStash::Outputs::Blueflood < LogStash::Outputs::Base # This output lets you pull metrics from your logs and emit them # to your Blueflood endpoint. # # Blueflood (http://blueflood.io) is a distributed, multi-tenant # metr...
38.948276
153
0.681939
33e08c9cfd4f2f47bd013f7a122d5fc0596c9310
494
# # Cookbook Name:: flyway-cli # Recipe:: default # # Copyright (C) 2014 ClouDesire # # All rights reserved - Do Not Redistribute # if node['flyway']['include_java_recipe'] == true include_recipe "java" end directory node['flyway']['installation_path'] do recursive true end node['flyway']['confs'].each do |key, ...
18.296296
57
0.698381
61281c1e46e4700c1b02c53a58866db64518e8f1
4,598
# frozen_string_literal: true # See LICENSE.txt at root of repository # GENERATED FILE - DO NOT EDIT!! require 'ansible/ruby/modules/base' module Ansible module Ruby module Modules # Create or delete a Rackspace Cloud Monitoring check associated with an existing rax_mon_entity. A check is a specific test o...
83.6
973
0.696825
4ad4037176b2353e352cd25acbef4df825ea2dcd
1,458
class Elixir < Formula desc "Functional metaprogramming aware language built on Erlang VM" homepage "https://elixir-lang.org/" url "https://github.com/elixir-lang/elixir/archive/v1.13.0.tar.gz" sha256 "0ed0fb89a9b6428cd1537b7f9aab1d6ea64e0c5972589eeb46dff6f0324468ae" license "Apache-2.0" head "https://githu...
40.5
123
0.76406
edebf6fac10277c88311dd2385fc98f13b03ad46
1,164
# 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...
34.235294
86
0.737113
ac6d0fe4fbaab13449447f6ac9eb1e42b64633f2
75
require_relative '../config/environment.rb' run #
2.586207
43
0.506667
3836bd012c537853e0fb6be2e41e675393b6b3ab
22
require 'rom/factory'
11
21
0.772727
61857934ce2e3db220afbd1605cfcce29609cf1d
287
cask 'kubernetes-cli-1.11.3' do version '1.11.3' sha256 '8e4b0f9cc1918e22c44468c667b2a362d933216ae37cc4d9e770a3e5c8d0ea35' url "https://dl.k8s.io/v#{version}/kubernetes-client-darwin-amd64.tar.gz" name 'Kubernetes Client' homepage 'https://kubernetes.io/' end
31.888889
77
0.721254
08c29460822b71deba9513c02e617be4e00d8531
23,925
# Controller class handling all model-related requests. # Implements listing of resources, retrieval of the model # and creation/deletion of mixins. #first version require 'rubygems' require 'occi-api' #require 'pp' require "nokogiri" require "open-uri" require "open3" ## options use_os_temlate = true # use ...
26.233553
382
0.602842
283fa33036ef4abd0f6cd0bc6ecc1040e05e26cc
5,825
require "test_helper" class PostsControllerTest < ActionDispatch::IntegrationTest context "The posts controller" do setup do PopularSearchService.stubs(:enabled?).returns(false) @user = travel_to(1.month.ago) {create(:user)} as_user do @post = create(:post, :tag_string => "aaaa")...
30.984043
139
0.587639
087f5d814eafeef81c2097f7779a4d495e034268
785
require 'file_not_found_page' unless defined?(CustomFileNotFoundPage) class CustomFileNotFoundPage < FileNotFoundPage end end class FileNotFoundScenario < Scenario::Base uses :home_page def load create_page "Draft File Not Found", :class_name => "FileNotFoundPage", :status_id => Status[:draft].id c...
35.681818
115
0.722293
ed0cb780aa40bc4acb90e8208145775beae2b698
2,495
class Entrant include Mongoid::Document include Mongoid::Timestamps store_in collection: "results" field :bib, as: :bib, type: Integer field :secs, as: :secs, type: Float field :o, as: :overall, type: Placing field :gender, as: :gender, type: Placing field :group, as: :group, type: Placing default_...
26.827957
98
0.643287
265f22a255a6ac1e8992a726b0cee322fd621b9c
14,438
# 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::KMS module Errors extend Aws::Errors::DynamicErrors class AlreadyExistsException < Servi...
26.589319
83
0.633952
bf492a7c8ca1323c54dc18be8a68a28ba2a9b4eb
4,838
VERSION = "0.1.0" LICENSE_URL = "https://raw.github.com/bvanderveen/httpmachine/HEAD/LICENSE.txt" PROJECT_URL = "https://github.com/bvanderveen/httpmachine" PROJECT_FILES = FileList["**/*.csproj"] CONFIGURATION = "Release" BUILD_DIR = File.expand_path("build") OUTPUT_DIR = "#{BUILD_DIR}/out" BIN_DIR = "#{BUILD_DIR}/bi...
26.151351
86
0.710004
bbb27eb7c83081e367fb0015f2a1db41d5cd7926
153
class User < ActiveRecord::Base has_one :profile has_many :tasks accepts_nested_attributes_for :profile accepts_nested_attributes_for :tasks end
21.857143
40
0.816993
6156b9b17db4af14a9e737ecce6f9a6b0dc99c15
155
class CreateSections < ActiveRecord::Migration def change create_table :sections do |t| t.string :nombre t.timestamps end end end
15.5
46
0.677419
1a7214e5d59e41da8d4e65beada7f19e27f41405
331
# frozen_string_literal: true RSpec.describe Moleculer::Support::StringUtil do describe "#camelize" do it { expect(described_class.camelize("totez_test_string")).to eq("totezTestString") } end describe "#underscore" do it { expect(described_class.underscore("stuffAndThings")).to eq("stuff_and_things") }...
27.583333
89
0.746224
f77dd90b405893668098b034304a7ecaa126c6ec
994
# 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...
41.416667
86
0.765594
4a64821082acc261dc95795d31ac6bd61e99fd85
9,243
require 'spec_helper' require 'thing' describe Thing do context "creating an article from a page id" do before :each do @thing = Thing.new(52780) end it "should return an object of type Thing" do @thing.class.should == Thing end it "should have the correct URI" do @thing.uri....
30.707641
113
0.614195
2671507e8d6653bf926b1f1bebe786fe4b6b7c2b
938
require 'yaml' module Liquid class I18n DEFAULT_LOCALE = File.join(File.expand_path(__dir__), "locales", "en.yml") TranslationError = Class.new(StandardError) attr_reader :path def initialize(path = DEFAULT_LOCALE) @path = path end def translate(name, vars = {}) interpolate(de...
23.45
120
0.638593
1d71661f24837238f1f9a33caf5d4704b76b0b01
403
# frozen_string_literal: true require "cmd/shared_examples/args_parse" describe "Homebrew.command_args" do it_behaves_like "parseable arguments" end describe "brew command", :integration_test do it "returns the file for a given command" do expect { brew "command", "info" } .to output(%r{#{Regexp.escape...
25.1875
83
0.741935
08b33cdad4e3235bc153291571d9cc90418ae408
352
class Balance::DepositorController < ApplicationController def new @depositor = Depositor.new end def create @depositor = Depositor.new(params[:depositor]) @depositor.request = request if @depositor.deliver flash.now[:error] = nil else flash.now[:error] = 'cannot send message.' ...
20.705882
58
0.670455
21579ffa5fe361c0560c33c89c0dceea19e1aa9b
4,978
require_relative "./resource" # Wrapper for {https://m2x.att.com/developer/documentation/v2/device M2X Data Streams} API. class M2X::Client::Stream < M2X::Client::Resource class << self # # Method for {https://m2x.att.com/developer/documentation/v2/device#View-Data-Stream View Data Streams} endpoint. # ...
35.557143
132
0.682403
f8ed8df6d9977d89efc83f0b3254a86a7dd06e1e
339
require 'shared_user' require File.join(File.dirname(__FILE__), '../data_mapper/shim.rb') class User include DataMapper::Resource property :id, Serial property :username, String property :facebook_token, String property :confirmation_token, String, :writer => :private timestamps :at include SharedUser ...
21.1875
67
0.758112
1c06cc806331bf82608da1462e8e8bab599475e9
205
## tasks to get job details module Stax module Helm class Cmd < Base desc 'jobs', 'list jobs' def jobs kubectl_run(:get, :jobs, '-l', helm_selector) end end end end
14.642857
53
0.580488
ab44854d179b060992c4160f8e4b2045f6f6c353
529
require 'spec_helper' require 'sinkhole/commands/command' require 'sinkhole/commands/quit' describe Sinkhole::Commands::Quit do it_ensures_no_arguments_present let(:connection) do connection = mock() connection.stubs(:domain).returns("Fake") connection.stubs(:peer).returns("127.0.0.1") connection ...
23
60
0.731569
f7b080f55631e0d73a683bab64ab227ef6e209ce
330
module KubeDSL::DSL::V1 class NamespaceSpec < ::KubeDSL::DSLObject value_field :finalizers validates :finalizers, field: { format: :string }, presence: false def serialize {}.tap do |result| result[:finalizers] = finalizers end end def kind_sym :namespace_spec end ...
18.333333
70
0.639394
034f832f303ed844ee742d1d14ba8186deb37a6f
272
# frozen_string_literal: true require 'rails_helper' RSpec.describe User do describe "Associations" do it "should have a role" do test_user = User.reflect_on_association(:roles) expect(test_user.macro).to eq(:has_and_belongs_to_many) end end end
20.923077
61
0.735294
28241ee0d53de4722c4d011977333ea7d94c482a
3,912
module Avsh # Encapsulates parsed config details from VagrantfileEnvironment class ParsedConfig attr_reader :primary_machine # @param vagrantfile_dir [String] The directory containing the Vagrantfile # (used for synced folder path expansion with relative directories). # @param global_synced_folders...
36.222222
146
0.662321
39ef2f25b464ec54c70f2619cb7523085df0e1ed
1,052
module Nizicon class Member attr_accessor :id, :name, :position, :nickname, :birthday, :hometown, :twitter_id, :blog_uri, :head_shot_uri, :introduction, :pixiv_id, :preparatory def self.all Mapping.data['members'].map { |data| new(data) } end def self.find(id) if data = Mapping.data['mem...
27.684211
152
0.624525
01c782917dad32e546c0474d73135309e9451cac
837
# frozen_string_literal: true RSpec.describe Bookmark do let(:user) { User.create! email: 'xyz@example.com', password: 'xyz12345'} subject do b = Bookmark.new(user: user) b.document = SolrDocument.new(id: 'u001') b end it "is valid" do expect(subject).to be_valid end it "belongs to user" ...
22.621622
75
0.684588
088e061b882b35498af5ec1d10e4e889a8133ecc
959
require 'test_helper' require 'chart_j_s_service' # Test ChartJSService class ChartJSServiceTest < MockedTest def setup super('test/data/chart_j_s_service_test_data.json') end # Scatter graph data should be formatted like this: http://www.chartjs.org/docs/#line-chart-scatter-line-charts def test_balance_b...
38.36
113
0.760167
8780fa241945a54434b4fa8544980e115f5bb799
467
module Api module V2 class OutgoingMessagesController < ApiController def create first_responder = FirstResponder.find(params[:first_responder_id]) success, message = OutgoingMessageService.send_ad_hoc_text_message(first_responder, params[:message]) if success render json: ...
29.1875
109
0.674518
b936e09fc62914b0261e2055702fc384bc3b93cc
401
# frozen_string_literal: true require 'spec_helper' describe Sinclair::Exception::InvalidOptions do describe '#message' do let(:exception) { described_class.new(%i[invalid options]) } let(:expected_message) do 'Invalid keys on options initialization (invalid options)' end it 'shows invalid ke...
23.588235
64
0.720698
084bb05c52d5f6c962131b694d435ede3f0d8aa1
1,552
module EventStore module HTTP module Controls module Hostname module Cluster def self.example Available.example end module Leader def self.example 'leader.eventstore-cluster.local' end end module Fo...
22.823529
78
0.491624
ffb07dc727cacfa6f8ec4ca269088552172932dd
1,709
require 'spec_helper' require 'thor' require 'aggregator/movie_detail' RSpec.describe Aggregator::MovieDetail do describe '#initialize' do it 'sets instance variables' do movie_name = 'Life Of PIE' run_time = '2 hour 30 minutes' lang = 'English' actor = 'Irfan Khan' ge...
28.966102
74
0.544763
7a0ea5a84d1a47df85c95644b8dff93b36e00f99
2,885
require 'active_record/tasks/database_tasks' module ActiveRecord module Tasks module DatabaseTasks def migrate verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true version = ENV["VERSION"] ? ENV["VERSION"].to_i : nil scope = ENV['SCOPE'] migrations_paths.each do |m...
31.703297
99
0.614905
269a93a91270db928db06e64f60f41e04b1610da
523
class Helmfile < Formula version "v0.138.7" desc "Deploy Kubernetes Helm Charts." homepage "https://github.com/meltwater/homebrew-fks" url "https://github.com/meltwater/homebrew-fks/releases/download/helmfile-#{version}/helmfile-darwin-amd64.tar.gz" sha256 "a54743494f719e86aedc6ca990f2951fb13fe230ab2257c322e7...
30.764706
116
0.75717
ffbbac693083b965b0caa2d3a1a387b40942acfc
340
class Ar::Misc < ApplicationRecord extend Enumerize has_many :misc_belongings, dependent: :destroy has_many :misc_throughs, through: :misc_belongings has_and_belongs_to_many :misc_habtms has_one_attached :file enumerize :enumerized, in: [:A, :B, :C] def self.search_field :string end def label ...
18.888889
52
0.738235
ed8528e833cfacda758e0769c93e964c39c0cef9
189
class AddMomentIdToComment < ActiveRecord::Migration def self.up add_column :comments, :moment_id, :integer end def self.down remove_column :comments, :moment_id end end
15.75
52
0.73545
628ded484fdada51f0beb8c47f036d21dfa3730b
3,614
# ------------------------------------- # # Fast VM - Magento2 # # # # Author: zepgram # # Git: https://github.com/zepgram/ # # ------------------------------------- # require 'getoptlong' require 'fileutils' ## Get OS module OS d...
28.68254
116
0.610681
08a8690bcc597b2485d0f6faa68494493ef169af
515
# frozen_string_literal: true require_relative 'boot' require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module Spectre class Application < Rails::Application # Settings in config/environments/* t...
28.611111
82
0.765049
7923c6d0aacf5fb4d43d58ca468ce8a88e7f648a
569
Pod::Spec.new do |s| s.name = "ShortCode" s.version = "0.0.1" s.summary = "Short human-readable codes." s.description = <<-DESC A tool for creating human-readable shortcodes for identification. DESC s.homepage = "https://github.com/rchatham/ShortCode" s.license ...
37.933333
98
0.571178
38bdba270d08aa2a2676e5ea1a421f6f474402a8
1,881
# TODO: This formula isn't particularly idiomatic. It treats the release archive # as the source bundle and just copies the compiled files from the bundle to # their destinations. This is necessary at the moment because Mutagen has a # custom build script that (a) performs time-consuming cross-compilation of # agent bi...
41.8
141
0.765019
bfe284e645bdd292a5a8a98edaaa10bc76a31f71
154
class CreateUsers < ActiveRecord::Migration[5.0] def change create_table :users do |t| t.string :username t.timestamps end end end
15.4
48
0.668831
1d729f09fd6fa726bacd816c3a03e9ceffb6752d
6,288
class ProjectsController < ApplicationController before_action :authenticate_account! before_action :scope_project, except: [:index, :new, :create] before_action :scope_organization, except: [:index, :create, :update] before_action :scope_organizations, expect: [:index] before_action :enforce_existing_project...
31.757576
134
0.713581
26333b06fa2f53ca51905fa32f33e0f0b8234ff8
607
# Unified Ruby Code between Apache(mod_mruby) and nginx(ngx_mruby) # for Web server extensions. # # Apache httpd.conf by mod_mruby # # <Location /mruby> # mrubyHandlerMiddle "/path/to/unified_hello.rb" # </Location> # # nginx nginx.conf by ngx_mruby # # location /mruby { # mruby_content_handler "/path/to/unifi...
23.346154
77
0.705107
792f3e90945cb1538deffd0634198d30c723707f
5,303
# # Be sure to run `pod spec lint YMNetwork.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 https://guides.cocoapods.org/syntax/podspec.html # To see working Podspecs in the CocoaPods repo see https://gith...
37.878571
108
0.605318
bf77557db9969bc62e6907f113ca217ac95148f6
3,817
class OrganizationsController < ApplicationController before_action :set_organization, only: [:show, :edit, :update , :send_message] before_action :authenticate_user!, except: [:show, :index] def index if params[:type] @organizations =Organization.where("type_organization = 'groups'") else ...
43.375
388
0.645271
d545570e0d2adbe8c18e7268b0be8d2cb63dab81
518
class ApplicationController < ActionController::Base protect_from_forgery with: :exception include ConditionalCache private def current_user #Your current user. Temporarily setting current user to first user User.first end # add this method to support conditional caching at user level def condi...
27.263158
89
0.77027
7ad914bb1bfc3871dc1dd464df600da1f43fbca0
1,069
module BlacklightPagedItem module ControllerOverride extend ActiveSupport::Concern included do before_filter :generate_pagination, only: [:show] end private def generate_pagination response, @document = get_solr_response_for_doc_id return if @document.has_key? 'unpaged_display' ...
28.891892
64
0.572498
11043615dca1167b60e687d6d3003678303ba50a
301
# Benchmark module Benchmark def benchmark(message) Kochiku::Worker.logger.info("[#{message}] starting") start_time = Time.now begin yield ensure duration = Time.now - start_time Kochiku::Worker.logger.info("[#{message}] finished in #{duration}") end end end
21.5
73
0.651163
5d29432b99ab8c5efaa0b9044b9fc97fd03c309f
750
# -*- coding: utf-8 -*- module Bunny # Unit, integration and stress testing toolkit class TestKit class << self # @return [Integer] Random integer in the range of [a, b] # @api private def random_in_range(a, b) Range.new(a, b).to_a.sample end # @param [Integer] a Lower b...
26.785714
96
0.598667
bb84526ff0a00cd503ef8a3affdc1386ff7933f1
481
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel...
34.357143
103
0.702703
381bab1ba96a2b1e0021ddd9fb5001fc2f026bc3
271
require "feature_flagger/version" module FeatureFlagger class Error < StandardError; end # Your code goes here... # USAGE # # FeatureFlagger.feature active_if: true do # puts :hoge # end def self.feature(active_if:) yield if active_if end end
15.055556
45
0.693727
ac701877d99cd2640473f6121c794c971884f5e8
3,331
# frozen_string_literal: true require 'logger' module Lorekeeper # Very simple, very fast logger class FastLogger include ::Logger::Severity # contains the levels constants: DEBUG, ERROR, etc. attr_accessor :level # Current level, default: DEBUG attr_accessor :formatter # Just for compatibi...
26.023438
97
0.62864
11318413add9679d6c8b807ec90df70f7bcf235f
1,287
# Copyright 2017, Google Inc. All rights reserved. # # 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 ...
37.852941
97
0.722611
e9a325077a44f7f64230eb6722b93bf6d368e477
1,501
# frozen_string_literal: true require 'json' require 'time' require 'uri' module SlackNotifiee class Notification attr_reader :webhook_url, :username, :channel, :attachments, :blocks, :text, :icon_emoji, :icon_url, :datetime def self.build_from_json(json) attributes = ::JSON.parse(json) new( ...
27.796296
114
0.630913
6a63acace3606aeaf41e845fc42c95f4b3f7cec4
39
module ModelUN VERSION = "0.2.1" end
9.75
19
0.666667
ffd74e2de11f43bcd59791b782f93b5fd15f1cd2
3,305
RSpec.describe "the global update block" do let(:manifest) { manifest_with_defaults } describe "in order to run parallel deployment by default" do it "has serial false" do expect(manifest["update"]["serial"]).to be false end end end RSpec.describe "the instance_groups definitions block" do let(:...
33.72449
152
0.71528
7a64bb31279b4a909288477f3945d24e5ce93b70
138,884
# 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 module Aws::AppStream module Types # Describes an interface VPC endpoint (...
33.449904
287
0.625594
08c668ca410487d0c67227a9fa80d65d41c33ba7
5,847
# # Cookbook:: chef-arkserver # Attributes:: default # # Author:: Nick Gray (f0rkz@f0rkznet.net) # # Copyright:: 2017 f0rkznet.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...
31.26738
74
0.732512
ed75922810b749739ff54c648a394e493f5cb4f5
4,588
# This command needs a TONNE more tests for it, but i can't figure out # how to do them yet, and i really want to release. Sorry. Someone # come along and do a better job. require_relative '../helper' describe "play" do before do @o = Object.new @t = pry_tester(@o) end describe "with an argument" do ...
25.071038
122
0.537707