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
0844bec2fbcf6b8bd9170770cb0d2120ebe5ce02
241
class Hash def assert_required_keys(*required_keys) missing_keys = required_keys.select {|key| !keys.include?(key)} raise ArgumentError, "Missing required option(s): #{missing_keys.join(", ")}" unless missing_keys.empty? end end
34.428571
108
0.738589
1afd8a399999d1b1e4d555ae82faef2fb76cccb0
276
begin require 'simplecov' SimpleCov.start do add_filter '/spec/' end rescue LoadError warn 'warning: simplecov gem not found; skipping coverage' end require 'minitest/autorun' require 'minitest/pride' require 'minitest/spec' require_relative '../lib/foodcritic'
18.4
60
0.757246
62a36d44309f89fb50da3bfe2eaf3b4fa1a44e70
743
log "Creating #{node['tiger_common']['sec_tests_settings_path']}" [ node['tiger_common']['sec_tests_settings_path'] ].each do |dir_name| directory dir_name do action :create recursive true end end cookbook_file '/home/tiger/.ssh/known_hosts' do source 'known_hosts' owner 'tiger' group 'tiger' mod...
23.21875
84
0.732167
1127c385f0b923101a94ecfadef731a9d2b6739e
581
cask 'trickster' do if MacOS.release <= :lion version '2.1.1' sha256 'cddc4a27c3c2a016f86d1688ef9708d3e8c605cfe06302470471309ccdc241db' else version '2.4.2' sha256 'afe5fcf0de994e6a993bf259da564783ed7c0619ad635c665ecf5d3067ba5049' end url "http://dl.apparentsoft.com/Trickster_#{version}.zip" ...
30.578947
88
0.765921
b99d39f8d1b0e82bf6a07e2e7418a380bc20d3e0
812
class Kma < Formula desc "Align long and short reads to redundant sequence databases" homepage "https://bitbucket.org/genomicepidemiology/kma" url "https://bitbucket.org/genomicepidemiology/kma/get/1.3.6.zip" sha256 "b672b72103bc38977060c8e3f7f158bb7f06ffdc8eabfc4aa72985c250b57c26" bottle do root_url "ht...
33.833333
121
0.780788
28c3a0fc06b323bddd9b7c1c18d35e52a949b875
286
class UpdateForums < ActiveRecord::Migration def self.up add_column :forums, :forumable_type, :string add_column :forums, :forumable_id, :integer end def self.down remove_column :forums, :forumable_type remove_column :forums, :forumable_id end end
22
49
0.706294
4a66a4abd970c40b48e59cd7f77b8b60662bb42f
2,015
describe ManageIQ::Providers::EmbeddedAnsible::Provider do subject { FactoryGirl.create(:provider_embedded_ansible) } let(:miq_server) { FactoryGirl.create(:miq_server) } before do EvmSpecHelper.assign_embedded_ansible_role(miq_server) end it_behaves_like 'ansible provider' context "DefaultAnsibleOb...
35.350877
132
0.675931
18c14224aaa5c8868e27761ced23f1ab1b374662
1,802
# frozen_string_literal: true module EE module Projects module DestroyService extend ::Gitlab::Utils::Override override :execute def execute super.tap do # It's possible that some error occurred, but at the end of the day # if the project is destroyed from the datab...
25.742857
79
0.624306
bb34b536f5d5e7bd063f255ac663b4b0147e482e
1,381
Pod::Spec.new do |s| s.name = "MonkeyBaseWork" s.version = "1.1.1" s.summary = "MonkeyBaseWork Sample Task....." s.homepage = "https://github.com/junhaiyang/MonkeyBaseWork" s.license = "MIT" s.author = { "yangjunhai" => "junhaiyang@gmail.com" } s.ios.dep...
22.274194
93
0.583635
e907b9dad08553c4db44b78ae2d8517c03167b1e
1,383
RSpec.describe Event do describe 'Validations' do it { is_expected.to validate_presence_of(:action) } it do is_expected.to define_enum_for(:action) .with_values([:created, :updated]) end describe '#resource_presence validation' do let(:post) { Fabricate(:post) } let(:member)...
28.22449
59
0.651482
01d3e4d1045498c4fc2cf7749cb13ce07b158a28
787
require 'rails_helper' RSpec.describe 'runs/index' do context 'while logged out' do before { allow(view).to receive(:current_user).and_return(nil) } it 'renders the index template' do assign(:example_run, FactoryBot.create(:livesplit16_run, :parsed)) assign(:example_segment, FactoryBot.create(:s...
28.107143
88
0.700127
7910d00b4d1e5b8993a9dbdb8557544a465564e2
1,082
# frozen_string_literal: true require 'spec_helper' RSpec.describe Gitlab::Analytics::CycleAnalytics::StageEvents::IssueLabelAdded do it_behaves_like 'value stream analytics event' do let(:label_id) { 10 } let(:params) { { label: GroupLabel.new(id: label_id) } } let(:expected_hash_code) { Digest::SHA256...
37.310345
132
0.709797
62679f069b29a769f8f377961e309be6f9de66d0
286
FactoryBot.define do factory :user do sequence(:user_name) { |n| Faker::Internet.user_name + n.to_s } first_name { Faker::Name.first_name } last_name { Faker::Name.last_name } email { Faker::Internet.email } display_name { "#{first_name} #{last_name}" } end end
28.6
67
0.671329
28ebf85455d58ece777e4eb7de03581a7646a7ff
469
#!/opt/local/bin/ruby1.9 require 'common' zk = ZooKeeper.new(:host => "#{ZK_HOST}:#{ZK_PORT}") wait_until { zk.connected? } if zk.connected? cb = ZooKeeper::DataCallback.new do logit "------------------- data callback fired" logit "return_code #{cb.return_code}" logit "stat #{cb.stat.inspect}" slee...
21.318182
66
0.622601
87b07dda9f4257303a786744f210c9f298a6717e
579
cask "texmacs" do version "1.99.20" sha256 "5113622cc423263b01fe45afa07ef05210000f560cf34fd5247063c9838b5172" url "https://ftp.texmacs.org/TeXmacs/tmftp/macos/TeXmacs-#{version}.dmg" name "GNU TeXmacs" desc "Scientific editing platform" homepage "https://www.texmacs.org/" livecheck do url "http://ft...
25.173913
75
0.71848
612c7f88e46fff8a59df56855d3cf122c433ad52
4,103
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...
40.623762
102
0.744577
21fc49e6be95189e7a5baf238598009b44dff5cf
282
class CreateComments < ActiveRecord::Migration def change create_table :comments do |t| t.belongs_to :user, index: true, foreign_key: true t.belongs_to :post, index: true, foreign_key: true t.string :message t.timestamps null: false end end end
23.5
56
0.684397
03da97e047b1ce0fa5ca1444f1fe782c0dca9402
2,948
class Sip < Formula desc "Tool to create Python bindings for C and C++ libraries" homepage "https://www.riverbankcomputing.com/software/sip/intro" url "https://www.riverbankcomputing.com/static/Downloads/sip/4.19.24/sip-4.19.24.tar.gz" sha256 "edcd3790bb01938191eef0f6117de0bf56d1136626c0ddb678f3a558d62e41e5" ...
32.395604
94
0.608887
e202d800dabdc9241c4c83e3cf36321dc3747c74
35
module Rp1 VERSION = "0.1.0" end
8.75
19
0.628571
2855a596cc24a2cf2ced78cc98c131f88af8febc
1,089
require "./test/test_helper" class ApplicationRecordTest < ActiveSupport::TestCase setup do @class_methods = [ :configure_logging_options, :default_log_fields, :logging_options, :set_logging_callbacks!, ] @log_create = "PLEASE DO!" ApplicationRecord.configure_logging_options d...
31.114286
105
0.752984
f834f37df4cff7e2d6191008513b085625a583b1
2,152
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...
32.606061
85
0.761617
e95d3b1219b9b85ab6d41994e37cd4200502107d
2,156
require 'test_helper' require 'netzke/core_ext' class CoreExtTest < ActiveSupport::TestCase test "recursive delete if nil" do assert_equal({:a => 1, :b => {:c => 4, :d => 5}}, {:a => 1, :aa => nil, :b => {:c => 4, :d => 5, :cc => nil}}.recursive_delete_if_nil) assert_equal({:a => [{:e => 5}, {:f => 7}], :b ...
34.774194
292
0.481911
f850ad3138a031964312490eb18439cb264c7a41
250
class InvoiceBlurb < ActiveRecord::Base include SalorScope include SalorBase belongs_to :vendor belongs_to :company validates_uniqueness_of :is_header, :scope => [:vendor_id, :lang] validates_presence_of :vendor_id, :company_id end
22.727273
67
0.768
e924fbd7ad53e668ac869e0350a8eb18478be95d
480
class AddSelectorFieldsToFinishes < ActiveRecord::Migration def up Finish.all.each do |finish| finish.selected = false finish.save! end add_column :finishes, :selected_by_id, :integer add_foreign_key :finishes, :users, column: :selected_by_id add_column :finishes, :selected_at, :datet...
25.263158
62
0.727083
e8e5d64b81d9886b9e65b9a7278a9fcc3ec74e28
2,855
#!/usr/bin/env ruby # # test version inference $:.unshift File.join(File.dirname(__FILE__), '../..', 'lib') require 'libclimate' require 'xqsr3/extensions/test/unit' require 'test/unit' require 'stringio' class Test_Climate_parse_and_verify < Test::Unit::TestCase class VerifyException < RuntimeError; end cla...
18.06962
86
0.705429
03197947f099c577df70ca1f7dbe79723b234082
1,829
# # ==== Standalone <%= module_name %> configuration # # This configuration/environment file is only loaded by bin/slice, which can be # used during development of the slice. It has no effect on this slice being # loaded in a host application. To run your slice in standalone mode, just # run 'slice' from its director...
42.534884
89
0.739748
036b17f22c27163b87abc072732fd4643aeeb481
1,893
class UsersController < ApplicationController before_action :logged_in_user, only: [:index, :edit, :update, :destroy, :following, :followers] before_action :correct_user, only: [:edit, :update] before_action :admin_user, only: :destroy def index @users = User.p...
22.270588
73
0.618595
e2442d7256289b180fd1d5d5d4dd96b2d26d517d
511
# frozen_string_literal: true # Be sure to restart your server when you modify this file. # Avoid CORS issues when API is called from the frontend app. # Handle Cross-Origin Resource Sharing (CORS) in order to accept cross-origin AJAX requests. # Read more: https://github.com/cyu/rack-cors Rails.application.config....
26.894737
92
0.704501
911140313040bcb95c0fd98923cf050822477297
1,194
# == Schema Information # # Table name: users # # id :bigint(8) not null, primary key # email :string default(""), not null # encrypted_password :string default(""), not null # full_name :string # name :string # pas...
33.166667
131
0.639866
bf916ab908fe367b6fbb530747ca72aa200d6e90
410
require 'rubygems' require 'gruff' require File.join(File.dirname(__FILE__), 'new_image.rb') g = Gruff::Bar.new g.title = "Bar Graph With Manual Colors" g.labels = { 0 => '5/6', 1 => '5/15', 2 => '5/24', 3 => '5/30', } g.data(:Art, [0, 5, 8, 15], '#990000') g.data(:Philosophy, [10, 3, 2, 8], '#009900') g.d...
20.5
57
0.585366
792283f79b160a28d1cd975d213a5dacb1bd30c7
713
# # Copyright:: Copyright (c) 2016 Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
31
74
0.741935
910f4f33f3c54b56ae3314cbed22e83185bc52e9
18,672
=begin #NSX-T Manager API #VMware NSX-T Manager REST API OpenAPI spec version: 2.5.1.0.0 Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.4.7 =end require 'date' module NSXT # Registering a Service is the first step in the ServiceInsertion mechanism. A ServiceDefinitio...
36.683694
508
0.65301
082b28bca36d4feec1fd34b7539987bee5f86344
413
require 'spec_helper' class Factorial include Patme::PatternMatching def calculate(n=0) 1 end def calculate(n) n * calculate(n-1) end end describe Factorial do subject{ described_class.new } it 'calculates factorial of 0 correctly' do expect( subject.calculate(0) ).to eq 1 end it 'ca...
15.884615
45
0.699758
87b08903fedc00cb0ab2a85f478bc676c722124b
762
module PageObjects module Pages module Assignments class AssignToTeamMemberPage < PageObjects::Pages::Base set_url '/cases/{case_id}/assignments/assign_to_team_member' section :primary_navigation, PageObjects::Sections::PrimaryNavigationSection, '.global-nav' sectio...
29.307692
108
0.65748
61d1f08305f447981a9db27ebb489552611c0371
448
class MoveEditorAsString < ActiveRecord::Migration def self.up remove_column :users, :editor add_column :users, :editor, :string, :default => 'simple' unless $schema_generator users = User.find(:all) users.each do |user| user.editor = 'simple' user.save! end end ...
21.333333
61
0.625
03c4637d2f76fc013eb57ddae14b275a81512ff6
320
# Functions for outputting various types of messages to the user. module Output def self.put_success(text) $stdout.puts "\e[0;32m" + text + "\e[0m" end def self.put_error(text) $stderr.puts "\e[0;31m" + text + "\e[0m" end def self.put_info(text) $stdout.puts "\e[0m" + text + "\e[0m" end end
18.823529
65
0.63125
ff8df851ba7e9d8c8bfee2d947bdd1967dbabd7d
709
require "arena/cache/adaptor/generic" module Arena module Cache module Adaptor class Rails < Arena::Cache::Adaptor::Generic def self.method_missing(method, *args, &block) # Brittle/ugly but works for the time being # key = args.present? ? "arena_#{method}_#{args.first...
26.259259
88
0.564175
2852a42e6f22617c54be9e5e34af9eee5f059936
3,396
#encoding: utf-8 require 'redcarpet_extensions' module ApplicationHelper include Recaptcha::ClientHelper def sitename if current_region.present? "hacken.in/#{current_region.main_slug}" else "hacken.in" end end def truncate_html(html, length=30, opts={}) HTML_Truncator.truncate(htm...
29.789474
153
0.644287
d58fbd2d5b85b6ce0e8df97736f4bfcc0126cca1
7,988
require 'errata' require 'remote_table' require 'upsert' class DataMiner class Step # A step that imports data from a remote source. # # Create these by calling +import+ inside a +data_miner+ block. # # @see DataMiner::ActiveRecordClassMethods#data_miner Overview of how to define data miner scrip...
37.327103
213
0.618553
f7ccad4c74c7e53f07bff4f9988229c496b43517
1,024
class Configuration < ActiveRecord::Base validates_presence_of :name class << self # This method returns the values of the config simulating a Hash, like: # Configuration[:foo] # It can also bring Arrays of keys, like: # Configuration[:foo, :bar] # ... so you can pass it to a method using *....
22.755556
75
0.599609
38dbc2d3cf6689b6a3119cce1d50591d0105429c
281
# -*- encoding: us-ascii -*- class Exception def ==(other) other.kind_of?(Exception) && message == other.message && backtrace == other.backtrace end def to_s if @reason_message @reason_message.to_s else self.class.to_s end end end
15.611111
34
0.604982
e8d7798e295f1544dfed9a682ba14867ede887fd
40
module Ilovepdf VERSION = "1.2.0" end
10
19
0.675
1c14c2bd7a69851b3ca356d810a4875232d9cf44
3,785
shared_examples_for 'extending a given api template' do describe 'multiple times' do before(:each) do User.api_accessible :public do |t| t.add :first_name end User.api_accessible :for_buddies, extend: :public do |t| t.add :age end User.api_accessible :private, exten...
30.039683
145
0.672919
6189fb689e0d9b30a9b26b523338460530f6dbd2
267
class CreateInvitations < ActiveRecord::Migration def self.up create_table :invitations do |t| t.integer :organization_id t.string :email t.string :token t.timestamps end end def self.down drop_table :invitations end end
16.6875
49
0.674157
e23d4deba024cb498399db021b305325c3fdccb4
4,006
require 'hubspot/utils' module Hubspot # # HubSpot Deals API # # {http://developers.hubspot.com/docs/methods/deals/deals_overview} # class Deal CREATE_DEAL_PATH = "/deals/v1/deal" DEAL_PATH = "/deals/v1/deal/:deal_id" RECENT_UPDATED_PATH = "/deals/v1/deal/recent/modified" UPDATE_DEAL_PATH =...
37.439252
143
0.670245
ede8312e19e3b5d04d89f7044acb27e16c2aa2c5
5,815
=begin #convertapi #Convert API lets you effortlessly convert file formats and types. OpenAPI spec version: v1 Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.4.14 =end require 'date' module CloudmersiveConvertApiClient # Input to Create a new Spreadsheet request cl...
29.221106
132
0.624592
284f4dc14db4d0881f9fee12466450ea1739efaf
1,833
# global_miles_airline_api # # This file was automatically generated by APIMATIC v2.0 # ( https://apimatic.io ). module GlobalMilesAirlineApi # A complex object for representing a minimal passenger information. class PassengerMin < BaseModel # First name of the passenger. Maximum length is 40 character...
28.640625
74
0.592471
7a58bc4c4ad26ca50df089004a5b83463abf4180
1,036
require "spec_helper" describe Spree::LoyaltyPointsDebitTransaction do let(:loyalty_points_debit_transaction) { build(:loyalty_points_debit_transaction) } it "is valid with valid attributes" do expect(loyalty_points_debit_transaction).to be_valid end describe 'update_user_balance' do it "should dec...
28.777778
134
0.779923
b92c7b63816d6cc9b3a59704c2515874d1bda9fd
113
# frozen_string_literal: true class Paragraph < ActiveRecord::Base belongs_to :section has_paper_trail end
14.125
36
0.79646
2104477216a7793985238841f99ff03d4f5b99c8
353
module Universal module Concerns module Polymorphic extend ActiveSupport::Concern included do belongs_to :subject, polymorphic: true index subject_type: 1 index subject_id: 1 scope :for_subject, ->(subject){where(subject_type: subject.class.to_s, subject_id: subject....
20.764706
104
0.665722
62762da36209f1ff942b21ac653e91bf65753575
611
class BasePresenter include ERB::Util attr_reader :object, :view_context def self.presenter(object) "#{object.class}Presenter".constantize end def self.presents(name) define_method(name) { object } end def initialize(object, view_context) @object = object @view_context = view_context ...
18.515152
59
0.702128
084402e2c9dbc9e6994227de1968780b72867876
866
# (C) Copyright 2017 Hewlett Packard Enterprise Development LP # # 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...
45.578947
85
0.779446
87197dbc61761672a01071217cd9695d427b4e1d
92
Pushover.configure do |config| config.token = Lobsters::Config[:pushover][:api_token] end
23
56
0.76087
030ef244af7b6c991bdf9fcf1335e89d1a319cf3
906
os_version = node[:platform_version].split('.')[0].to_i case node[:platform] when "centos", "redhat" if os_version >= 7 execute "timedatectl --no-ask-password set-timezone #{node[:tz]}" else template '/etc/sysconfig/clock' do source 'clock.erb' owner 'root' group 'root' mode 0644 ...
23.842105
69
0.60596
abda2a32e7ebb71d99198d79f103aec6743083f8
4,628
# # Cookbook:: syslog_ng # Spec:: filter_helpers_spec # # Copyright:: Ben Hughes <bmhughes@bmhughes.co.uk> # # 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/licens...
29.666667
147
0.611711
bf12319fd0ba631f9702c76a1a058a79017ccb3c
11,178
class User < ActiveRecord::Base acts_as_authentic do |config| config.validates_uniqueness_of_email_field_options = {if: -> { false }} # Don't validate email uniqueness config.crypto_provider = Authlogic::CryptoProviders::Sha1 Authlogic::CryptoProviders::Sha1.join_token = '' Authlogic::CryptoProvi...
33.467066
170
0.656915
4a47e49867869c99c11e2d7a1f252468a9a98c2a
842
RSpec.describe HttpProxy do let(:machine) { double(:machine, vm_ip: '192.168.99.100', host_ip: '192.168.99.1') } let(:proxy) { described_class.new(machine, nil) } it 'defaults to `docker` as domain when no preference exists' do expect(proxy.dinghy_domain).to eq "docker" expect(proxy.resolver_file).to eq ...
38.272727
86
0.716152
f8b0e4ada79b0c62c59ed13f828886d9ce6b9409
408
Sequel.migration do change do drop_table(:rendered_templates_archives) create_table(:rendered_templates_archives) do primary_key :id foreign_key :instance_id, :instances, null: false String :blobstore_id, null: false String :sha1, null: false String :content_sha1, null:...
22.666667
55
0.676471
26bfb8dced623186d0e7be04cb2e3b846b44f3b1
1,148
# # Author:: Seth Chisamore (<schisamo@chef.io>) # Cookbook Name:: php-fpm # Recipe:: package # # Copyright 2011-2017, Chef Software, 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 # #...
26.090909
74
0.682056
f80f19368e807fe4ebb4e3636fe6b541b7636559
460
# Be sure to restart your server when you modify this file. require 'nucore' if NUCore::Database.oracle? ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.class_eval do self.emulate_integers_by_column_name = true self.default_sequence_start_value = 1 end # OCI8 does not realize that SafeBuffer is ...
32.857143
79
0.767391
ab812c1e33d151130b550058da0c045ce1fe0e29
88
# desc "Explaining what the task does" # task :meta_field do # # Task goes here # end
17.6
38
0.681818
6a7f0a558cf41215e3efdceb3f88cbb9f391bd44
1,126
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: grafeas/v1/intoto_statement.proto require 'google/protobuf' require 'grafeas/v1/intoto_provenance_pb' require 'grafeas/v1/slsa_provenance_pb' Google::Protobuf::DescriptorPool.generated_pool.build do add_file("grafeas/v1/intoto_statement.proto", :...
34.121212
117
0.726465
7a68a6af10331ff642ba4624c5ec735a7e0dfd0a
8,201
require 'rails_helper' module BenefitSponsors RSpec.describe Profiles::Employers::EmployerStaffRolesController, type: :controller, dbclean: :after_each do routes { BenefitSponsors::Engine.routes } let!(:security_question) { FactoryGirl.create_default :security_question } let(:staff_class) { BenefitSpo...
33.202429
183
0.643214
bbe11c1d7ab98ff034a01801a53fe09aefe23ba1
23,665
require 'libxml' class Publication < ApplicationRecord include Seek::Rdf::RdfGeneration include PublicationsHelper alias_attribute :description, :abstract # searchable must come before acts_as_asset is called if Seek::Config.solr_enabled searchable(auto_index: false) do text :journal, :pubmed_id,...
37.034429
173
0.666596
e88fc520455768cec2301a013bebb0ab293c164d
349
class RolloutStatusEntity < Grape::Entity include RequestAwareEntity expose :status, as: :status expose :instances, if: -> (rollout_status, _) { rollout_status.found? } expose :completion, if: -> (rollout_status, _) { rollout_status.found? } expose :complete?, as: :is_completed, if: -> (rollout_status, _) {...
34.9
92
0.716332
39a0e67c8e4990709d1cf2ae3f995c916d5d8649
1,062
class Datomic < Formula desc "Database that simplifies by separating transactions, storage and queries" homepage "http://www.datomic.com/" url "https://my.datomic.com/downloads/free/0.9.5198" sha256 "1d42979079bd62c2b4df9fbc3c18cdc15d49ac04905eceab4c75720e23ed8fc7" version "0.9.5198" depends_on :java de...
32.181818
98
0.710923
874bcacb75b81d670286a1d42def549a44823e43
1,184
require 'test_helper' class UserTest < ActiveSupport::TestCase def setup @user = User.new(name:"Example User", email:"user@example.com", password: "foobar", password_confirmation: "foobar") end test "should be valid" do assert @user.valid? end test "name should be present" do @user.name = "a...
27.534884
120
0.701858
33ca26b7e8e04d15bbfef3bc2254e6801b4b39d2
283
require 'wordfor/core_ext/array' require 'wordfor/core_ext/dir' require 'wordfor/version' require 'wordfor/configuration' require 'wordfor/plaintext' require 'wordfor/lookup' module Wordfor def self.logger @logger ||= Logger.new(Configuration.log_file, 1, 1024000) end end
20.214286
62
0.773852
bf1409a25bd025e016516ba71005455e7d0f18f0
1,353
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe "MongoMapper::Plugins::Sluggable" do describe "with SCI" do before do Animal = Class.new do include MongoMapper::Document key :name end Animal.collection.remove Dog = Class.new(Animal) end ...
22.55
65
0.579453
4a059dcc84f88200fdeab1e40f9a09f5905c6d4d
6,038
require 'spec_helper' module Spree class Promotion module Actions describe CreateItemAdjustments, :type => :model do let(:order) { create(:order) } let(:promotion) { create(:promotion) } let(:action) { CreateItemAdjustments.new } let!(:line_item) { create(:line_item, :order ...
36.373494
111
0.56045
919c8dc8f79fd918b78ca63fa37afe6de6818169
4,540
# frozen_string_literal: true # This file was generated by the `rails generate rspec:install` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # The generated `.rspec` file contains `--require spec_helper` which will cause # this file to always be loaded, without...
49.347826
96
0.713877
aba0c63d61aba8f492454448328c75238f231b6b
824
class Dir # visit dir, then all files in dir, then walk_dir each directory in dir def self.walk(dir, &block) yield dir all = Dir.entries(dir) partition = all.partition{|e| File.file?("#{dir}/#{e}")} files = partition[0] dirs = partition[1] files.each{|f| yield "#{dir}/#{f}" unless f.start_wi...
24.969697
73
0.540049
7acfb8c19af8aa9b66876bae9c6b92df0b52fcb4
645
# frozen_string_literal: true require 'spec_helper' RSpec.describe RawUsageData do describe 'validations' do it { is_expected.to validate_presence_of(:payload) } it { is_expected.to validate_presence_of(:recorded_at) } context 'uniqueness validation' do let!(:existing_record) { create(:raw_usage_...
23.888889
64
0.705426
d5ed2355e43a67afac101feff6a137ebe21ec4be
832
require "helper" class SomeRandomModel < ActiveRecord::Base; end class TestActiveSupportSpecType < Minitest::Test def assert_support actual assert_equal ActiveSupport::TestCase, actual end def refute_support actual refute_equal ActiveSupport::TestCase, actual end def test_spec_type_resolves_for_ac...
29.714286
79
0.800481
3368122d88af7c7f294f142025b4633006548d35
190
Rails.configuration.stripe = { :publishable_key => ENV['STRIPE_TEST_PUBLISHABLE_KEY'], :secret_key => ENV['STRIPE_TEST_SECRET_KEY'] } Stripe.api_key = Rails.configuration.stripe[:secret_key]
38
56
0.794737
f7b3215c736f5d35f11c0246c29a66d39f4ca2c8
4,477
# frozen_string_literal: true # == Schema Information # # Table name: campaigns # # id :bigint not null, primary key # name :string not null # created_at :datetime not null # updated_at :datetime not null # start_date :date not null # e...
32.442029
89
0.476212
79d9d2427e5282dc1fc073b433bf901c241f418f
1,055
# encoding: UTF-8 # This file contains data derived from the IANA Time Zone Database # (https://www.iana.org/time-zones). module TZInfo module Data module Definitions module Pacific module Majuro include TimezoneDefinition timezone 'Pacific/Majuro' do |tz| ...
31.969697
69
0.553555
38de92f5f54aa0f5bc220f3f4722d30e756cdbc7
664
class Vote < ApplicationRecord belongs_to :user belongs_to :article validates_presence_of :user, :article validate :vote_is_unique, on: :create def vote_is_unique vote = Vote.where(article_id: self[:article_id], user_id: self[:user_id]) errors.add(:vote_is_unique, 'you can only vote once') unless vo...
28.869565
77
0.736446
87db2f06d02c190b6e6c759e6c6a09d9a6ef5489
324
# frozen_string_literal: true require 'yaml' module Fakerjp class Helper class << self def fetcher(module_name, method_name) data = YAML.load_file("#{File.dirname(__FILE__)}/data/#{module_name}.yml")[method_name] index = rand(0..(data.length-1)) data[index] end end end ...
20.25
95
0.641975
7ae9d5a141fb3b6f7293788250a96cd335209b5f
641
require 'rails_helper' describe 'Tests mailer' do it 'should send email to required email address with proper content ' do # Send the email, then test that it got queued email = Mailer.sync_message( to: 'tluo@ncsu.edu', subject: "Test", body: { obj_name: 'assignment', ...
27.869565
74
0.614665
ff3f1d0072b03dbc81b715693a610dc8b89ca0fd
10,376
require 'spec_helper' describe Spree::Preferences::Preferable, type: :model do before :all do class A include Spree::Preferences::Preferable attr_reader :id def initialize @id = rand(999) end def preferences @preferences ||= default_preferences end pre...
29.816092
91
0.617965
08213a53a5da55b86b0fec75a7b389c563a57f99
1,984
Puppet::Type.newtype(:data_fragment) do @doc = "Create a data_fragment to be used by a data_file. the `data_fragment` type creates a file fragment to be collected based on the tag. The example is based on exported resources. Example: @@data_fragment { \"uniqe_name_${::fqdn}\": tag => 'unique_na...
30.523077
146
0.641633
08aa8cd34907cf710603c3cef9181239cf05f9a3
778
module GitlabCli module Util class Groups def self.get_all begin response = Array.new per_page = 100 page = 0 # If we get `per_page` results per page then we keep going. # If we get less than that we're done. while response.length == page ...
25.096774
75
0.517995
1c07de02f6a7603eafb07ba1dce87a6113b0ba45
1,176
# 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 #...
34.588235
86
0.742347
f77cbef83560985c59233b9d44866ed2755041d0
3,285
# ## Schema Information # Schema version: 20131205021701 # # Table name: `tags` # # ### Columns # # Name | Type | Attributes # ----------- | ------------------ | --------------------------- # **`id`** | `integer` | `not null, primary key` # **`name`** | `string(255)` | # class Ta...
61.981132
121
0.459361
21fa7a28871e114b4c30d71f6a04d775be2e8bcc
2,031
test_name 'Windows ACL Module - Remove Permissions from a File' confine(:to, :platform => 'windows') #Globals target_parent = 'c:/temp' target = 'c:/temp/rem_perm_file.txt' user_id = 'bob' file_content = 'I love puppet, puppet love puppet, puppet love!' verify_content_command = "cat /cygdrive/c/temp/rem_perm_file.tx...
25.3875
88
0.679468
115254bad9fc3d2954cefd2757392a961ba30461
39,557
# coding: utf-8 # These specs are a kind of integration spec. They're not unit testing small pieces # of code, it's just parsing a range of PDF files and ensuring the result is # consistent. An extra check to make sure parsing these files will continue # to work for our users. # # Where possible, specs that unit test ...
32.160163
126
0.628384
2137e35a9afff9db4fe4e3b12fa5f46665999e4a
404
module I18n module Alchemy module TimeParser include DateParser extend self private def build_object(parsed_date) Time.utc(*parsed_date.values_at(:year, :mon, :mday, :hour, :min, :sec)) end def i18n_scope :time end def valid_for_localization?(va...
17.565217
79
0.59901
7a0195605e563e028a45dbf81eb0f6145e4d8525
5,934
require 'everywhere/util' module ActiveRecord class PredicateBuilder if ActiveRecord::VERSION::STRING > '3.1' class << self include Everywhere::Util # >= 3.2.4, >= 3.1.5 if ActiveRecord::PredicateBuilder.method(:build_from_hash).arity == -4 def build_from_hash_with_not_an...
47.854839
158
0.583418
019d5fc3c5f4fa12ff0a0840f751aa412a7b2788
1,024
module Gitlab class License module Boundary BOUNDARY_START = /(\A|\r?\n)-*BEGIN .+? LICENSE-*\r?\n/.freeze BOUNDARY_END = /\r?\n-*END .+? LICENSE-*(\r?\n|\z)/.freeze class << self def add_boundary(data, product_name) data = remove_boundary(data) product_name.upc...
24.97561
69
0.510742
5d2b6b2d56a01ba277dbf5218fdaf7e23c749c1d
2,708
#-- copyright # OpenProject is a project management system. # Copyright (C) 2012-2014 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 ...
36.594595
116
0.692024
ffbb2e3a61b75d7b0ba185a9c2ee65b24dd36bec
3,273
# frozen_string_literal: true RSpec.describe "bundle install" do context "with duplicated gems" do it "will display a warning" do install_gemfile <<-G, :raise_on_error => false gem 'rails', '~> 4.0.0' gem 'rails', '~> 4.0.0' G expect(err).to include("more than once") end e...
29.486486
94
0.620837
03b04e9a3ba556815a6c3dae520ba8a7c6ec7acd
1,084
Pod::Spec.new do |s| s.name = 'iface' s.version = '3.4.3' s.summary = 'iface' s.homepage = 'https://goodrequest.com/' s.author = { 'Dominik Petho' => 'dominik.petho@goodrequest.com' } s.license = 'MIT' s.platform = :i...
40.148148
148
0.586716
d562d8b25ea4f8ed00a13e9ce866cab2afaae142
45,630
require 'spec_helper' module Ci describe GitlabCiYamlProcessor, lib: true do let(:path) { 'path' } describe "#builds_for_ref" do let(:type) { 'test' } it "returns builds if no branch specified" do config = YAML.dump({ before_script: ["pwd"], rspec: { script: "rspec" ...
37.679604
161
0.559106
5d8a836b3a8f4f92ffe326cad50b30c7f9c8da0c
3,918
# 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 `bin/rai...
44.022472
126
0.73124
1129c5db06080f2137b1f1d4f93d821616207d75
989
Pod::Spec.new do |s| s.name = "SwiftQueue" s.version = "5.0.0" s.summary = "SwiftQueue" s.description = "Job Scheduler for IOS with Concurrent run, failure/retry, persistence, repeat, delay and more" s.homepage = "https://github.com/lucas34/SwiftQueue" s.license ...
36.62963
118
0.623862
5d2634f089612ff335463e87d3133c38518be904
3,975
# frozen_string_literal: true module RuboCop module Cop module Rails # This cop is used to identify usages of http methods like `get`, `post`, # `put`, `patch` without the usage of keyword arguments in your tests and # change them to use keyword args. This cop only applies to Rails >= 5. ...
33.686441
80
0.544906
01f7d2c8f52855f340b8a72fa0319a143023d4db
3,124
=begin Copyright 2012-2013 inBloom, Inc. and its affiliates. 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...
48.8125
85
0.744558
1cc8a385649e7a3684afea4b347d9a2e87f9c68e
240
module Forms::Fields class RadioButtons < Field include OptionedField property :label, String, :required => true property :required, Boolean, :default => false self.renderer = Forms::RadioButtonsRenderer end end
21.818182
50
0.7
79d621b633cce536512dc62ec31e98a5b7b8d6f9
3,537
require 'test_helper' class TableRowTest < Test::Unit::TestCase include Liquid class ArrayDrop < Liquid::Drop include Enumerable def initialize(array) @array = array end def each(&block) @array.each(&block) end end def test_table_row assert_template_result("<tr class=\"...
55.265625
260
0.510319