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 |
|---|---|---|---|---|---|
33f7e78bf7bad4c3f173b192a565d02b4a13e5d2 | 4,302 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Query.vulnerabilities.externalIssueLinks' do
include GraphqlHelpers
include ReactiveCachingHelpers
let_it_be(:project) { create(:project) }
let_it_be(:jira_integration) { create(:jira_integration, project: project, issues_enabled: true, proj... | 32.590909 | 155 | 0.595769 |
796fb1ae0c29ff517ea5713997dd4d20d54fc333 | 223 | # TODO: Write here Module presentation
module LatoSwpmanager
# include here external gems
# require 'gem'
# include engine and interface
require 'lato_swpmanager/engine'
require 'lato_swpmanager/interface'
end
| 18.583333 | 38 | 0.766816 |
bb019d5d091f77a9606bcfb26d589c1c219a032b | 306 | class SometimesSecret
include Mongoid::Document
include Mongoid::CachedJson
field :secret, default: 'Afraid of the dark'
field :should_tell_secret, type: Boolean
belongs_to :secret_parent
json_fields hide_as_child_json_when: lambda { |x| !x.should_tell_secret },
secret: {}
end
| 25.5 | 76 | 0.735294 |
ff63307755dc763f7f4dbe0786b4b50b37dc3d6b | 1,413 | # 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 Mailosaur
module Models
#
# Advanced use case content related to the message.
#
class Metadata
# @return [Array<MessageHeader... | 26.660377 | 70 | 0.485492 |
18399ccef1af0eb0d8396b5d50b65881267b48c9 | 693 | # -*- encoding: utf-8 -*-
# stub: turbolinks-source 5.2.0 ruby lib
Gem::Specification.new do |s|
s.name = "turbolinks-source".freeze
s.version = "5.2.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors =... | 34.65 | 112 | 0.704185 |
bf90d012bf0777e404789b286d83c3390490bd38 | 919 | module ActionView
# = Action View Log Subscriber
#
# Provides functionality so that Rails can output logs from Action View.
class LogSubscriber < ActiveSupport::LogSubscriber
def render_template(event)
message = " Rendered #{from_rails_root(event.payload[:identifier])}"
message << " within #{fr... | 31.689655 | 95 | 0.699674 |
1cbae86d721133ba9f50c7376202cd4d9885fe4b | 4,293 | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 31.8 | 81 | 0.607501 |
6a65a6ab33f7f129eb8645db6112d2eea5ef1b8a | 156 | require 'test_helper'
class StaffFileTest < ActiveSupport::TestCase
# Replace this with your real tests.
test "the truth" do
assert true
end
end
| 17.333333 | 45 | 0.737179 |
bfd4814afb3ea32c4df034beaeec31d8f437600f | 61 | class Attachment < ActiveRecord::Base
belongs_to :post
end
| 15.25 | 37 | 0.786885 |
f712eaaf777763a04755edd5b5fbc5e2445fd607 | 2,133 | class HardwareTypesController < ApplicationController
before_action :set_hardware_type, only: [:show, :edit, :update, :destroy]
# GET /hardware_types
# GET /hardware_types.json
def index
@hardware_types = HardwareType.all
end
# GET /hardware_types/1
# GET /hardware_types/1.json
def show
end
#... | 28.44 | 105 | 0.694327 |
1cfb99df8a52f007f5b05b0a2cf1c74b3ccf5f44 | 1,262 | class Fwup < Formula
desc "Configurable embedded Linux firmware update creator and runner"
homepage "https://github.com/fhunleth/fwup"
url "https://github.com/fhunleth/fwup/releases/download/v1.2.5/fwup-1.2.5.tar.gz"
sha256 "4b502902fbc653c2e3b74180bbcd27b437677f835a7b3d9bd7bfd3de5f1f294b"
bottle do
cell... | 39.4375 | 94 | 0.769414 |
bfd40aad16c970316eb8c90492f755aa6245669f | 239 | class CreateConcerts < ActiveRecord::Migration
def change
create_table :concerts do |t|
t.belongs_to :band, index: true
t.belongs_to :venue, index: true
t.datetime :concert_date
t.timestamps
end
end
end
| 21.727273 | 46 | 0.677824 |
ab67cd76ae76565dcc4b2482be5ffd1713ee712c | 642 | # frozen_string_literal: true
require 'rom'
require 'rom-sql'
module SpyAlleyApiMysql
module Relations
class SpyIdentities < ROM::Relation[:sql]
schema(:spy_identities) do
attribute :id, Dry::Types['strict.integer']
attribute :player_id, Dry::Types['strict.integer']
attribute :nati... | 24.692308 | 64 | 0.655763 |
e95153c149d36cb9e47fe0cedecb60f21c9c2c65 | 309 | module WorldPayApi
module Api
class CustomerPayment < Base
def create params = {}
@client.post("/Customers/Payments", params).body
end
def update customer_id, params = {}
@client.put("/customers/#{customer_id}/payments", params).body
end
end
end
end
| 22.071429 | 70 | 0.614887 |
bb5b953f51dbcc6d915e489a90806d6a03dbfd61 | 3,066 | # frozen_string_literal: true
RSpec.describe RuboCop::Cop::Style::EachForSimpleLoop, :config do
it 'does not register offense if range startpoint is not constant' do
expect_no_offenses('(a..10).each {}')
end
it 'does not register offense if range endpoint is not constant' do
expect_no_offenses('(0..b).e... | 25.764706 | 99 | 0.5985 |
21767cbb46a1f529287453134384cf444db849f7 | 4,100 | require 'rails_helper'
RSpec.describe Bootstrap4RailsComponents::Bootstrap::Components::Card do
let(:card) { described_class.new(options, ActionController::Base.new.view_context) }
let(:options) { {} }
it { expect(described_class).to be < Bootstrap4RailsComponents::Bootstrap::Components::Base }
it_behaves_lik... | 30.827068 | 103 | 0.627561 |
386d07e1c0ead18517611d610ac2314e6cf1c779 | 45,255 | # frozen_string_literal: true
require 'vmpooler/providers/base'
module Vmpooler
class PoolManager
class Provider
class VSphere < Vmpooler::PoolManager::Provider::Base
# The connection_pool method is normally used only for testing
attr_reader :connection_pool
def initialize(config,... | 41.140909 | 251 | 0.619534 |
6ad1655d156982e01d7cf00f8fda1d71b4e293c8 | 26,186 | RSpec.describe HrrRbRelaxedXML::Document do
describe "when instantiated with no args" do
let(:xml_doc){ described_class.new }
it "returns HrrRbRelaxedXML::Document instance" do
expect( xml_doc ).to be_instance_of described_class
end
it "returns REXML::Document kind instance" do
expect( x... | 41.172956 | 92 | 0.609753 |
018a74083f54390824dc7cf1adc44dde59f7db88 | 406 | # Sample code from Programing Ruby, page 106
@esmtp = true
begin
# First try an extended login. If it fails because the
# server doesn't support it, fall back to a normal login
if @esmtp then
@command.ehlo(helodom)
else
@command.helo(helodom)
end
rescue ProtocolError
... | 18.454545 | 60 | 0.610837 |
629e6f8d4854dc6b2eb023a9bfd3c37db20a3dba | 5,778 | # -------------------------------------------------------------------------- #
# Copyright 2002-2018, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# no... | 37.277419 | 104 | 0.536691 |
79cd034f875fa8dc7a12305c078e4b5b3a24ae23 | 128 | require 'test_helper'
class QuestionOptionTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| 16 | 50 | 0.71875 |
28d78bc9556ed108b3dda646b35ae0fc44c277e8 | 714 | $:.unshift File.join(File.dirname(__FILE__), 'lib')
require 'erb2rux/version'
Gem::Specification.new do |s|
s.name = 'erb2rux'
s.version = ::Erb2Rux::VERSION
s.authors = ['Cameron Dutro']
s.email = ['camertron@gmail.com']
s.homepage = 'http://github.com/camertron/erb2rux'
s.description = s.summary... | 31.043478 | 116 | 0.654062 |
03806111083302bde5e1380bf49d8873e85c5c63 | 31 | class Refund < Transaction
end
| 10.333333 | 26 | 0.806452 |
0841fca2e1e07610833d0ad17cb560c1d23d7a44 | 285 | module Aspellbee
module Middleware
# Check if the client has set-up configuration yet.
class InjectConfiguration < Base
def call(env)
config = Aspellbee::Configuration.instance
env['config'] = config
@app.call(env)
end
end
end
end
| 19 | 55 | 0.638596 |
1c94d9bf6eb328809b8d2da5e71dd339c53de7a5 | 76 | Mutest::Meta::Example.add :gvar do
source '$a'
singleton_mutations
end
| 12.666667 | 34 | 0.723684 |
395ebe209594cfe300d6a03feb46af2981e99255 | 916 | require 'rails_helper'
describe Level do
context '.validates' do
it { should validate_numericality_of(:required_score).only_integer }
it { should validate_uniqueness_of(:name) }
end
describe '.by_score(score)' do
before { create(:level) }
it 'should find level by pontution' do
expect(Lev... | 21.809524 | 72 | 0.668122 |
87513e18b25a7b31b304af56e26c7e7d398093a6 | 18,241 | require 'spec_helper'
describe Member do
describe "Associations" do
it { is_expected.to belong_to(:user) }
end
describe "Validation" do
subject { described_class.new(access_level: Member::GUEST) }
it { is_expected.to validate_presence_of(:user) }
it { is_expected.to validate_presence_of(:source... | 34.482042 | 123 | 0.642838 |
01aa44f5fc1c252ec92fdc8bf1fd969a1d7b7e12 | 124 | class AddGithubIdToIssues < ActiveRecord::Migration[6.0]
def change
add_column :issues, :github_id, :bigint
end
end
| 20.666667 | 56 | 0.75 |
e8983d6e6795b0853b397e54abe68d0a2e1f7855 | 773 | class DropTablesForActsAsTaggable < ActiveRecord::Migration[6.0]
def up
drop_table :taggings
drop_table :tags
end
def down
create_table "taggings" do |t|
t.integer "tag_id"
t.integer "taggable_id"
t.string "taggable_type"
t.integer "tagger_id"
t.string "tagger_typ... | 27.607143 | 158 | 0.640362 |
39d2a8ceed6729df0c24a0cfbe74ac7c08e84b7c | 69 | class Tag < ApplicationRecord
has_and_belongs_to_many :gossips
end
| 17.25 | 34 | 0.84058 |
b9d19246d9e87e2e4744340d9a9e525d2f3a637e | 180 | module Arelastic
module Aggregations
class Min < Arelastic::Aggregations::Aggregation
def as_elastic_aggregation
{'min' => options}
end
end
end
end
| 18 | 52 | 0.666667 |
18ff99f7bbc0154bc2a78d4ba17d46f2ff66d83e | 864 | class StripePayout < StripeModelCallbacks::ApplicationRecord
monetize :amount_cents, allow_nil: true
def self.stripe_class
Stripe::Payout
end
def assign_from_stripe(object)
check_object_is_stripe_class(object)
assign_attributes(
amount: Money.new(object.amount, object.currency),
arriva... | 30.857143 | 98 | 0.743056 |
2100ff5133a0257aa1c96a9c3ad6401fe4f5300d | 1,894 | require 'json'
module KegbotApi
# Encapsulates a REST response ({Net::HTTPResponse})
#
# @visibility private
class RestResponse
# HTTP status code returned
attr_accessor :status_code
# result (as a string)
attr_accessor :body
# result (parsed into a {Hash})
attr_accessor :body_hash
... | 24.921053 | 157 | 0.680042 |
abc3424ac5f35062433180ee490e308c2bc3796b | 670 | require 'test_helper'
class MicropostTest < ActiveSupport::TestCase
def setup
@user = users(:michael)
@micropost = @user.microposts.build(content: 'Lorem ipsum')
end
test "should be valid" do
assert @micropost.valid?
end
test "user id should be present" do
@micropost.user_id = nil
assert_not @micropo... | 20.30303 | 61 | 0.729851 |
edfd2870bfe7e8864973a9a74ee73d945f5b1a97 | 1,233 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'PS2Format/version'
Gem::Specification.new do |spec|
spec.name = "PS2Format"
spec.version = PS2Format::VERSION
spec.authors = ["Runtime Revolution"]
spec.summary ... | 39.774194 | 128 | 0.679643 |
f7e8eb5d3bac790c06585c79b3d7e96d6207f675 | 238 | # frozen_string_literal: true
i = 0
json.array! @article.revisions.each do |revision|
i += 1
json.index i
json.rev_id revision.mw_rev_id
json.wp10 revision.wp10
json.date revision.date
json.username revision.user.username
end
| 21.636364 | 49 | 0.756303 |
4ac59aa2dac1d2760261de117354f2917f319133 | 2,009 | require "rodauth/rails/version"
require "rodauth/rails/railtie"
module Rodauth
module Rails
class Error < StandardError
end
# This allows the developer to avoid loading Rodauth at boot time.
autoload :App, "rodauth/rails/app"
autoload :Auth, "rodauth/rails/auth"
@app = nil
@middleware =... | 23.916667 | 115 | 0.582379 |
01e90a4f0ddba459cb859ad54b78a5349b3ab16f | 106,230 | # frozen_string_literal: true
require "cgi"
require "action_view/helpers/date_helper"
require "action_view/helpers/tag_helper"
require "action_view/helpers/form_tag_helper"
require "action_view/helpers/active_model_helper"
require "action_view/model_naming"
require "action_view/record_identifier"
require "active_suppo... | 45.43627 | 194 | 0.605234 |
33cd6ff3d377018d982e97ac9b79bca7f77fd0e6 | 795 | require 'rails_helper'
RSpec.describe NicoApi::Mylist::Mylist, type: :model do
describe 'list' do
let(:session){ FactoryGirl.build :session }
let(:json){ File.read('spec/fixtures/nico_api_mylist/ok.json') }
before do
stub_request(:get, "http://www.nicovideo.jp/api/mylist/list?group_id=12")
... | 28.392857 | 79 | 0.63522 |
397b5f6e77678d6beca8d0d1bb11e68ee57c9785 | 3,114 | require "insta/version"
require 'net/http'
require 'uri'
require 'json'
module Insta
class Error < StandardError; end
class Client
attr_accessor :redirect_uri, :client_id, :client_secret, :scope
def initialize(options = {})
@redirect_uri = options[:redirect_uri]
@client_id = options[:clien... | 29.377358 | 176 | 0.634875 |
084419a1fc95e99b59d4d959d7fe34d66b793692 | 1,309 | $:.push File.expand_path("lib", __dir__)
# Maintain your gem's version:
require "quick_search/pamphlets/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |spec|
spec.name = "quick_search-pamphlets"
spec.version = QuickSearch::Pamphlets::VERSION
spec.authors = ["... | 40.90625 | 176 | 0.717341 |
5d450a03cbfc0acbe3e75f0d0bb048b9fd242406 | 1,235 | # This file is auto-generated by the code_generator (one-time action)
#
# Cookbook Name:: smbios
# Spec:: default
#
# Copyright:: 2018, The Authors, All Rights Reserved.
require 'spec_helper'
describe 'smbios::default' do
context 'When all attributes are default, on centos 6.9' do
let(:chef_run) do
runner... | 24.215686 | 69 | 0.646154 |
ab020e2d70424d902515ccac4e738b1c231045e2 | 352 | ENV["RAILS_ENV"] = 'test'
require File.expand_path("../dummy/config/environment.rb", __FILE__)
require 'rspec/rails'
require 'capybara/rspec'
require 'tempfile'
require 'pry'
Dir["#{File.dirname(__FILE__)}/factories/**/*.rb"].each { |f| require f }
RSpec.configure do |config|
config.mock_with :rspec
config.use_tr... | 25.142857 | 73 | 0.735795 |
116a2abb458f49a116886344f913019a9511e421 | 979 | module SUNAT
class Party
include Model
property :name, String
property :physical_location, PhysicalLocation # only for tacna and only for receipts. sunat dixit
property :party_legal_entity, PartyLegalEntity
property :postal_addresses, [PostalAddress]
... | 25.102564 | 106 | 0.592441 |
626bd83cf9e07a2fe2838e0735d2f9ef31bed6ce | 2,960 | # -*- ruby -*-
# encoding: utf-8
require_relative 'lib/introrb/foreignc/version'
Gem::Specification.new do |s|
gemfiles = gemfiles = (File.exist?('Manifest.txt') ? (File.read('Manifest.txt').split(/\r?\n\r?/) rescue nil) : Dir.glob('{lib/**/*,ext/**/*.i,resources/*}', File::FNM_DOTMATCH)) # + Dir.glob('{*.gemspec,.... | 44.848485 | 354 | 0.608784 |
d5328d15e7ca45ff89afc1dc055841d5007174bf | 4,295 | module RedisOrm
module Associations
module HasOne
# user.avatars => user:1:avatars => [1, 22, 234] => Avatar.find([1, 22, 234])
# *options* is a hash and can hold:
# *:as* key
# *:dependant* key: either *destroy* or *nullify* (default)
def has_one(foreign_model, options = {})
... | 46.684783 | 269 | 0.607916 |
3948e53bc177d55e8acb2cd064abd624c249562a | 5,890 | # frozen_string_literal: true
require 'spec_helper'
describe Gitlab::ProjectTemplate do
describe '.all' do
it 'returns a all templates' do
expected = [
described_class.new('rails', 'Ruby on Rails', 'Includes an MVC structure, .gitignore, Gemfile, and more great stuff', 'https://gitlab.com/gitlab-o... | 57.184466 | 297 | 0.701019 |
28f2fcdee1472cc6944539dd19af3892530e40ac | 86 | RSpec.describe "21" do
it do
sleep 21 / 100.0
expect(21).to eq 21
end
end
| 12.285714 | 23 | 0.604651 |
08a9213e00b0b2b33c668c66ea7df16a731489be | 2,395 | # frozen_string_literal: true
require "spec_helper"
require "rubygems/security"
# unfortunately, testing signed gems with a provided CA is extremely difficult
# as 'gem cert' is currently the only way to add CAs to the system.
describe "policies with unsigned gems" do
before do
build_security_repo
gemfile <... | 30.705128 | 120 | 0.709395 |
87c74f25060e31c43e2c1ab3f3e38e3bc27ea9e6 | 298 | desc "run JavaScriptLint on the source"
task :lint do
check 'eslint', 'JavaScript Lint', 'npm install eslint --global'
Dir.glob(File.join(File.expand_path("../../", __FILE__), 'lib', '**', '*.js')).each do |file|
print '%-75s ' % file
system("eslint -c .eslintrc #{file}")
end
end
| 29.8 | 95 | 0.620805 |
33f7129ab0a30051bd7892ec41f9cf4a7eaa3c99 | 283 | require 'securerandom'
module Amnesie
class Host
def initialize
@nb = rand(8..25)
@hostname = SecureRandom.alphanumeric(@ng)
Nito::Hostname.new(@hostname)
puts to_s
end
def to_s
"Your hostname will become #{@hostname}"
end
end
end
| 16.647059 | 48 | 0.625442 |
d580c49386050fa052105048862636c0e60dc2e7 | 637 | require 'spec_helper'
describe 'loader::load' do
let(:pre_condition) {[
'class my_class1() {}',
'class my_class2() {}',
'class my_class3() {}',
]}
let(:params) {{
:classes => {
'my_class1' => false,
'my_class2' => true,
}
}}
context 'exclude' do
let(:title) { 'my_class1' ... | 17.694444 | 48 | 0.582418 |
38b13de992127c09cd2f831acb3c4a2f735ec718 | 260 | require 'open3'
module Clipboard
module Mac
extend self
def paste(_ = nil)
`pbpaste`
end
def copy(data)
Open3.popen3( 'pbcopy' ){ |input, _, _| input << data }
paste
end
def clear
copy ''
end
end
end
| 12.380952 | 61 | 0.542308 |
62c70885ff0a4b568f5367764bb7d91c10e317be | 426 | class GuessLetterValidator < ActiveModel::Validator
ERROR_STRING = {
must_be_single_upper_alpha: "must be a single uppercase letter",
}
def validate(record)
must_be_single_upper_alpha(record)
end
private
def must_be_single_upper_alpha(record)
if record.letter.nil? || record.letter.match(/\A[A... | 23.666667 | 74 | 0.737089 |
5d2365bf7a6ca7d9e12f2e1f0ee3ae9f22ca86b7 | 4,833 | require 'docker'
require 'httparty'
class CoinContainer
def create(options = {})
default_options = {
image: "stronghands/base",
shutdown_at_exit: true,
delete_at_exit: false,
remove_addr_after_shutdown: true,
remove_wallet_after_shutdown: false,
}
options = default_options.... | 21.104803 | 121 | 0.576247 |
e2b587fee261e25a6fbe0cef659215db90c24f44 | 5,517 | class Cuboid
# Only allow observer to see vertices, as the other
# dimensions are found with arithmetic. It is important to only supply
# the user with the information they need.
attr_reader :vertices
# instantiates a cuboid with its origin and its dimensions
# origin = [length, height, width]
# length ... | 30.821229 | 92 | 0.598876 |
6ae5a97b3b431d7f8597a5674a1565125397d596 | 1,206 | object @order
extends 'spree/api/v1/orders/order'
if lookup_context.find_all("spree/api/v1/orders/#{root_object.state}").present?
extends "spree/api/v1/orders/#{root_object.state}"
end
child billing_address: :bill_address do
extends 'spree/api/v1/addresses/show'
end
child shipping_address: :ship_address do
ext... | 23.192308 | 105 | 0.768657 |
217aa185767969749fa384535fb9656046490dc7 | 2,100 | # frozen_string_literal: true
require 'spec_helper'
require_relative '../../../metrics_server/metrics_server'
# End-to-end tests for the metrics server process we use to serve metrics
# from forking applications (Sidekiq, Puma) to the Prometheus scraper.
RSpec.describe 'bin/metrics-server', :aggregate_failures do
... | 26.582278 | 125 | 0.571905 |
1dd4cbbb5419261135934a6dcd52989e4b03819e | 1,468 | require 'rails_helper'
include AuthHelper
describe QuestionsController do
describe 'POST create' do
let(:question_params) {
{ title: "foo", answer_type: "string" }
}
context "not logged in" do
before { post 'create', params: { question: question_params } }
it { should redirect_to new_s... | 28.784314 | 75 | 0.638283 |
1c053d3b700c60b24c6c15a3ccfdf3bc5283e1e7 | 1,191 | cask "synology-cloud-station-backup" do
version "4.3.3,4469"
sha256 "1759be61a09cacd976969f71b0c0f12f34684976de6ad98323c512aec8f3399d"
url "https://global.download.synology.com/download/Tools/CloudStationBackup/#{version.before_comma}-#{version.after_comma}/Mac/Installer/synology-cloud-station-backup-#{version.a... | 33.083333 | 196 | 0.689337 |
e80285869911f2de6b584da07bebede9086d480f | 456 | module VCAP::CloudController
module Jobs
module Runtime
class BlobstoreUpload < Struct.new(:local_path, :blobstore_key, :blobstore_name)
def perform
begin
blobstore = CloudController::DependencyLocator.instance.public_send(blobstore_name)
blobstore.cp_to_blobstore(l... | 26.823529 | 95 | 0.651316 |
1c918580a65a21c29237343067c0d3fd88150398 | 1,969 | ##
# Copyright 2017-2018 Bryan T. Meyers
#
# 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 w... | 33.372881 | 91 | 0.687151 |
e245a095fa7d75f9c4dc9dc3002b9d77159090b6 | 1,805 | class ApplicationController < ActionController::Base
before_filter :authenticate_user!
protect_from_forgery
## CanCan permisisons
## https://github.com/ryanb/cancan
##Automatically does the following:
##@product = Product.find(params[:id])
##authorize! :discontinue, @product
## -----------------------... | 27.348485 | 103 | 0.6759 |
330ddbc3333951f4250cf7a5e18d736a7dd742f9 | 4,985 | # Copyright (c) 2016, 2022, 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... | 34.143836 | 245 | 0.678034 |
1d29627c6470ca755532e79b79362f88c3fcd145 | 3,065 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe(Take2::Configuration) do
describe 'default configurations' do
let(:default) { described_class.new }
it 'has correct default value for retries' do
expect(default.retries).to(eql(3))
end
it 'has correct default retriable errors... | 31.597938 | 98 | 0.646982 |
081a94ab359ecc048efc3f1b388dd5b6fbea3350 | 1,039 | # coding: utf-8
$:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "herstory/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "herstory"
s.version = Herstory::VERSION
s.authors = ["Joachim Garth"]
s.email = ... | 35.827586 | 111 | 0.708373 |
aba630e87c82861f2702d130a6ac14ad34f38a3c | 2,707 | module Telegram
# Telegram-CLI Connection
#
# @note Don't make a connection directly to the telegram-cli
# @see Client
# @see ConnectionPool
# @version 0.1.0
class Connection < EM::Connection
# Initialize connection
#
# @version 0.1.0
def initialize
super
@connected = false
... | 24.609091 | 85 | 0.61655 |
ed45e77e8b8e32d6230acbd7bfc14e3a894319c1 | 982 | require 'spec_helper'
describe 'example' do
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) { facts }
context 'with defaults for all parameters' do
it { is_expected.to contain_class('example') }
it { is_expected.to contain_anchor('example::begin').that_comes_befo... | 44.636364 | 107 | 0.669043 |
28fc1fb21475acf23e87a40718a7a29dac48d22d | 1,470 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::OperationalInsights::Mgmt::V2020_03_01_preview
module Models
#
# The core summary of a search.
#
class CoreSummary
include MsRestAzure
... | 25.789474 | 70 | 0.527211 |
0317cc4edb0adb20b8420dfd826f9f15f6b238a0 | 3,198 | require 'travis/cli'
require 'travis/tools/github'
require 'json'
module Travis
module CLI
class Login < ApiCommand
skip :authenticate
description "authenticates against the API and stores the token"
on('-g', '--github-token TOKEN', 'identify by GitHub token')
on('-T', '--auto-token', ... | 42.078947 | 153 | 0.581301 |
28e60c3d1d569f5035f7d6e1d112124ccad62300 | 540 | module AlephExecutables
class SetupDemo
HOST = 'aleph-public.cdiwpivlvfxt.us-east-1.rds.amazonaws.com'.freeze
DB = 'aleph_public'.freeze
PORT = '5432'.freeze
USER = 'read_only'.freeze
PASSWORD = '@lephR3@d0nlee'.freeze
def initialize(o... | 28.421053 | 85 | 0.592593 |
6a0ed3b990f2c0cd0c4ab5549356bdf9fbefdb6d | 2,173 | # Copyright 2018 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, ... | 35.048387 | 80 | 0.71422 |
e22c0af64711a0d2d4bdf5176656af9a9fc04cad | 2,273 | require 'spec_helper'
resource "Notes" do
let(:user) { users(:owner) }
let(:note) { events(:note_on_hdfs_file) }
let(:hdfs_file) { HdfsEntry.files.first }
let(:attachment) { attachments(:sql) }
before do
log_in user
end
post "/notes" do
parameter :body, "Text body of the note"
parameter :en... | 23.43299 | 72 | 0.649362 |
5d9d7f61ae5f79b40ca53d75a44575fb1843ca26 | 974 | require 'test_helper'
class PostTest < ActiveSupport::TestCase
def setup
@user = users(:michael)
# This code is not idiomatically correct.
@post = Post.new(subject: "Macbook Pro on sale!", price: 200, city: "Fremont", state: "California", content: "Lorem ipsum", user_id: @user.id)
end
test "should b... | 22.651163 | 146 | 0.663244 |
bb2059c8acafcde4c4d26008cde548c8989f80e4 | 1,501 | # encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module MobileCenterApi
module Models
#
# Model object.
#
#
class XamarinSolution
# @return [String] Path to solution
... | 25.016667 | 70 | 0.465023 |
1c4734fa99e468c743b71cd194bd03b59139a6c9 | 81 | module Fastlane
module MergeJunitReport
VERSION = '0.5.0'.freeze
end
end
| 13.5 | 28 | 0.716049 |
3895e517a4f30cda05af47e4c6652186e3c95f5a | 862 | require File.dirname(__FILE__) + "/../test_helper"
class RadiantLayoutsTest < Test::Unit::TestCase
fixtures :layouts
class ControllerWithRadiantLayout < ApplicationController
radiant_layout 'main'
end
class ControllerWithRadiantLayoutBlock < ApplicationController
radiant_layout {|c| c.action_name =... | 35.916667 | 102 | 0.803944 |
117cbec26a4821280f2834ea92342ca5c0ac8314 | 335 | # Dependencies
require 'kss'
require 'redcarpet'
require 'pygments.rb'
require 'haml'
# Styleguide Engine
require "styleguide/engine"
module Styleguide
autoload :Configuration, 'styleguide/configuration'
def self.setup
@config = Styleguide::Configuration.new
yield @config
end
def self.config
@co... | 15.227273 | 53 | 0.740299 |
bf4c569cfc4001b965efd0c782ecb23fcf81faf9 | 1,740 | describe :hash_each, shared: true do
it "yields a [[key, value]] Array for each pair to a block expecting |*args|" do
all_args = []
{ 1 => 2, 3 => 4 }.send(@method) { |*args| all_args << args }
all_args.sort.should == [[[1, 2]], [[3, 4]]]
end
it "yields the key and value of each pair to a block expec... | 25.217391 | 85 | 0.482759 |
5de3e793d86b07ff1ae8a0f220ab9433663ecc3b | 268 | require 'spec_helper'
describe Spree::GiftCardTransaction do
it {should belong_to(:gift_card)}
it {should belong_to(:order)}
it {should validate_presence_of(:amount)}
it {should validate_presence_of(:gift_card)}
it {should validate_presence_of(:order)}
end
| 26.8 | 46 | 0.772388 |
911a7f5d3586787afc41efb191a2455c8a37f35f | 6,455 | # frozen_string_literal: true
module Gitlab
module Ci
module Reports
module Security
class Finding
include ::VulnerabilityFindingHelpers
attr_reader :compare_key
attr_reader :confidence
attr_reader :identifiers
attr_reader :flags
attr_rea... | 31.334951 | 362 | 0.577072 |
1872d6a0b8ee363caa368c44ad0c396a7e20357d | 1,624 | ##
## OkComputer provides customizable health check endpoints
## (https://github.com/sportngin/okcomputer).
## It is an important piece of the OpsCare stack.
## Don't edit this file unless you know what you are doing,
## it could result in an undeployable app.
##
require "securerandom"
# If the envvar is not set, gene... | 36.088889 | 85 | 0.739532 |
38ecef20133cd5940684937976843c5fdc3eb28a | 949 | class Github
def initialize(user)
@user = user
end
### would prefer to not pass in an argument of the user, but that's what allowed me to test for failure condition of api
def top_starred
begin
results = RestClient::Request.execute(method: :get, url: "https://api.github.com/search/repositories?q=... | 35.148148 | 213 | 0.696523 |
bf8e034aeeeb375a0e0ea9bdfe9f1150bf28602a | 22,335 | #! /usr/bin/env ruby
require 'spec_helper'
require 'oregano/pops'
require 'oregano_spec/pops'
require_relative '../parser/parser_rspec_helper'
describe "validating 4x" do
include ParserRspecHelper
include OreganoSpec::Pops
let(:acceptor) { Oregano::Pops::Validation::Acceptor.new() }
let(:validator) { Oregano:... | 38.442341 | 139 | 0.628565 |
180ef72321bdefbe7512695daea500b6440b3d44 | 82 | # frozen_string_literal: true
module ToSentenceExclusive
VERSION = "1.0.1"
end
| 13.666667 | 29 | 0.768293 |
0343f95fa0d5db09b77c171d79d598f5af58eaef | 329 | require File.expand_path("../lib/php_extension_formula", __dir__)
class PhpAT72Recode < PhpExtensionFormula
extension_dsl "GNU Recode Extension"
conflicts_with "php-imap", :because => "because both share the same internal symbols"
depends_on "recode"
configure_arg "--with-recode=#{Formula["recode"].opt_pref... | 27.416667 | 87 | 0.765957 |
1dba746e5466c38e0c769eeb8605082e68f6c9fe | 3,517 | require 'helper'
require 'inspec/resource'
require 'resources/aws/aws_iam_root_user'
require 'resource_support/aws'
require 'resources/aws/aws_iam_root_user'
class AwsIamRootUserTest < Minitest::Test
def setup
@mock_conn = Minitest::Mock.new
@mock_client = Minitest::Mock.new
@mock_conn.expect :iam_clie... | 34.480392 | 87 | 0.770543 |
f8f3b6d7f61c0deaffda3bd2568d76a50c9f5252 | 982 | #
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'flutter_facebook_login'
s.version = '0.0.1'
s.summary = 'A Flutter plugin for allowing users to authenticate with native Android & iOS Facebook login SDKs.'
s.... | 36.37037 | 127 | 0.617108 |
79168181e7a089dbe66ddfba6c6bfbcbaf16b04a | 275 | require 'spec_helper'
describe Qbrick::SitemapsController, type: :controller do
routes { Qbrick::Engine.routes }
describe '#index' do
it 'should be able to send a xml file' do
@page = FactoryGirl.create :page
get :index, format: 'xml'
end
end
end
| 21.153846 | 57 | 0.676364 |
e969f357b83ff06c156beb2598a7649e67e1565b | 4,822 | #
# Author:: Matheus Francisco Barra Mina (<mfbmina@gmail.com>)
# © Copyright IBM Corporation 2015.
#
# LICENSE: MIT (http://opensource.org/licenses/MIT)
#
module Fog
module Softlayer
class Compute
class Mock
# Gets all Bare Metal users
# @param [Integer] id
# @return [Excon::Respons... | 32.362416 | 90 | 0.454168 |
e8f19c7b55fc463186b3c6f65051cf61fe5232f0 | 1,169 | # encoding: utf-8
require 'spec_helper'
describe "SMTP Delivery Method" do
before(:each) do
Mail.defaults do
smtp = Net::SMTP.start('127.0.0.1', 25)
delivery_method :smtp_connection, :connection => smtp
end
end
after(:each) do
Mail.delivery_method.smtp.finish
end
it "should send ... | 24.354167 | 99 | 0.643285 |
4a635bb5a7231013ecb3a12a3694d8b4c453bc10 | 179 | json.source_id @contact_inbox.source_id
json.pubsub_token @contact_inbox.pubsub_token
json.partial! 'public/api/v1/models/contact.json.jbuilder', resource: @contact_inbox.contact
| 44.75 | 92 | 0.843575 |
aba3dce4ba80a36c59f3aa11ea6032740e5a3ced | 4,483 | require 'test_helper'
# Tests the ActsAsAuthentic::EmailToken::Confirmation module.
class Confirmation < Minitest::Test
def test_confirm_email
Authlogic::Random.expects(:friendly_token).returns('IMvEDB6NJIm5Z7cSe2a')
o = Confirmable.new email: 'a@example.com', new_email: 'b@example.com'
t = Time.now
... | 33.706767 | 99 | 0.740576 |
f82b9c2e5cbd13c65fb130aee4176a79b2032a54 | 2,887 | # 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.964706 | 86 | 0.650156 |
f839144cd1d8fdb53878c838ab3b955fb6218dd2 | 1,353 | class CargoLlvmLines < Formula
desc "Count lines of LLVM IR per generic function"
homepage "https://github.com/dtolnay/cargo-llvm-lines"
url "https://github.com/dtolnay/cargo-llvm-lines/archive/0.4.11.tar.gz"
sha256 "7bdbabf728b47e6312376bce694429ba397a3c991a8ee1cbf28179442980cca1"
license any_of: ["Apache-2.... | 43.645161 | 122 | 0.77014 |
617c90c190c722a555d481974ccbcc23df7b7ea0 | 3,914 | # 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... | 39.938776 | 126 | 0.721513 |
ff2bd7aefdf1c434a6a7a2554905efc027aabcca | 913 | module API
module V1
class Auth < Grape::API
include API::V1::Defaults
resource :auth do
desc "Creates and returns access_token if valid login"
params do
requires :username, type: String, desc: "Username or email address"
requires :password, type: String, desc: "Pa... | 26.085714 | 77 | 0.554217 |
ff0e04b0862254c3dda7ddffd8a306f74ca9e48f | 2,602 | class EntriesController < ApplicationController
get '/entries' do
if logged_in?
@entries = current_user.entries
# @user = User.find_by(email: params[:email])
erb :'entries/entries'
else
# If a user is not logged in, it will redirect to ... | 29.235955 | 106 | 0.461184 |
4a3a7e969202ad606f98bda38a54191a4cb110a8 | 413 | # frozen_string_literal: true
module OrangeData
class ReceiptStatus
def initialize(id:, inn: nil, config: OrangeData.configuration)
@config = config
@id = id
@inn = inn || @config.inn
end
def sync!
Client.request(payload, api_name: :get_receipt_status)
end
private
d... | 16.52 | 67 | 0.585956 |
873391eca80aba4e0156117ce7b0b61b7704c0aa | 137 | class MakeUserEmailsUnique < ActiveRecord::Migration[6.0]
def change
change_column :users, :email, :string, unique: true
end
end
| 22.833333 | 57 | 0.744526 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.