Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Add spec for restarting failed enumerator | require_relative '../../spec_helper'
describe "Enumerator#next" do
before :each do
@enum = 1.upto(3)
end
it "returns the next element of the enumeration" do
@enum.next.should == 1
@enum.next.should == 2
@enum.next.should == 3
end
it "raises a StopIteration exception at the end of the stream... | require_relative '../../spec_helper'
describe "Enumerator#next" do
before :each do
@enum = 1.upto(3)
end
it "returns the next element of the enumeration" do
@enum.next.should == 1
@enum.next.should == 2
@enum.next.should == 3
end
it "raises a StopIteration exception at the end of the stream... |
Add default for braintree gateway | module Pay
module Braintree
module Api
def self.set_api_keys
environment = get_key_for(:environment)
merchant_id = get_key_for(:merchant_id)
public_key = get_key_for(:public_key)
private_key = get_key_for(:private_key)
Pay.braintree_gateway = ::Braintree::Gateway.ne... | module Pay
module Braintree
module Api
def self.set_api_keys
environment = get_key_for(:environment, "sandbox")
merchant_id = get_key_for(:merchant_id)
public_key = get_key_for(:public_key)
private_key = get_key_for(:private_key)
Pay.braintree_gateway = ::Braintree:... |
Mark petitions as debated every midnight | # Use this file to easily define all of your cron jobs.
#
# It's helpful, but not entirely necessary to understand cron before proceeding.
# http://en.wikipedia.org/wiki/Cron
# Example:
#
# set :output, "/path/to/my/cron_log.log"
#
# every 2.hours do
# command "/usr/bin/some_great_command"
# runner "MyModel.some_m... | # Use this file to easily define all of your cron jobs.
#
# It's helpful, but not entirely necessary to understand cron before proceeding.
# http://en.wikipedia.org/wiki/Cron
# Example:
#
# set :output, "/path/to/my/cron_log.log"
#
# every 2.hours do
# command "/usr/bin/some_great_command"
# runner "MyModel.some_m... |
Fix a typo in IGM test class | require "helpers/integration_test_helper"
require "integration/factories/instance_group_manager_factory"
class TestInstanceGroupManager < FogIntegrationTest
include TestCollection
def setup
@subject = Fog::Compute[:google].instance_group_managers
@factory = InstanceGroupManagerFactory.new(namespaced_name)... | require "helpers/integration_test_helper"
require "integration/factories/instance_group_manager_factory"
class TestInstanceGroupManagers < FogIntegrationTest
include TestCollection
def setup
@subject = Fog::Compute[:google].instance_group_managers
@factory = InstanceGroupManagerFactory.new(namespaced_name... |
Move disable_net_connect outside of setup | ENV["RAILS_ENV"] = "test"
require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
require 'minitest/autorun'
require 'webmock/minitest'
module MiniTest
class Test
def setup
WebMock.reset!
WebMock.disable_net_connect!(allow_localhost: true)
ElasticRecord::Config.models.e... | ENV["RAILS_ENV"] = "test"
require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
require 'minitest/autorun'
require 'webmock/minitest'
WebMock.disable_net_connect!(allow_localhost: true)
module MiniTest
class Test
def setup
WebMock.reset!
ElasticRecord::Config.models.each do... |
Add back template handler registration | # Copyright 2008-2009 Wincent Colaiuta
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed i... | # Copyright 2008-2009 Wincent Colaiuta
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed i... |
Add OmniAuth config for mocking Facebook authentication. | FACEBOOK_INFO = {
"id" => "12345",
"link" => "http://facebook.com/john_doe",
"email" => "user@example.com",
"first_name" => "John",
"last_name" => "Doe",
"website" => "http://www.example.com"
}
Before("@omniauth_test") do
OmniAuth.config.test_mode = true
# the symbol passed to mock_auth is the same as... | |
Upgrade Mono MRE to 3.12.0 | cask :v1 => 'mono-mre' do
version '3.10.0'
sha256 'c9973d1206a36b71964a8b173d452780c19200cac2955723e0d48f969a3f6d28'
url "http://download.mono-project.com/archive/#{version}/macos-10-x86/MonoFramework-MRE-#{version}.macos10.xamarin.x86.pkg"
homepage 'http://mono-project.com'
license :oss
pkg "MonoFramewor... | cask :v1 => 'mono-mre' do
version '3.12.0'
sha256 'af104354a7445f5565aa438bd172824bd00088b6a737b371cce09a15b9ca0491'
url "http://download.mono-project.com/archive/#{version}/macos-10-x86/MonoFramework-MRE-#{version}.macos10.xamarin.x86.pkg"
homepage 'http://mono-project.com'
license :oss
pkg "MonoFramewor... |
Swap calls to Oboe with TraceView | $:.push File.expand_path("../lib", __FILE__)
require "oboe/version"
Gem::Specification.new do |s|
s.name = %q{oboe}
s.version = Oboe::Version::STRING
s.date = Time.now.strftime('%Y-%m-%d')
s.license = "AppNeta Open License, Version 1.0"
s.authors = ["Peter Giacomo Lombardo", "Spiros Eliopoulos"]
s.email ... | $:.push File.expand_path("../lib", __FILE__)
require "traceview/version"
Gem::Specification.new do |s|
s.name = %q{traceview}
s.version = TraceView::Version::STRING
s.date = Time.now.strftime('%Y-%m-%d')
s.license = "AppNeta Open License, Version 1.0"
s.authors = ["Peter Giacomo Lombardo", "Spiros Eliopoul... |
Simplify the platform check logic a bit | #
# Author:: Matt Ray <matt@chef.io>
# Cookbook:: drbd
# Recipe:: default
#
# Copyright:: 2009-2016, 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
#
# http://www.apa... | #
# Cookbook:: drbd
# Recipe:: default
#
# Copyright:: 2009-2016, 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Un... |
Add gems for fetching information from PT and git repository | # -*- encoding: utf-8 -*-
require File.expand_path('../lib/test_bed/version', __FILE__)
Gem::Specification.new do |gem|
gem.authors = ["TheHamon"]
gem.email = ["example@example.com"]
gem.description = %q{TODO: Write a gem description}
gem.summary = %q{TODO: Write a gem summary}
gem.home... | # -*- encoding: utf-8 -*-
require File.expand_path('../lib/test_bed/version', __FILE__)
Gem::Specification.new do |gem|
gem.authors = ["TheHamon"]
gem.email = ["example@example.com"]
gem.description = %q{ The gem is intended to simplify developer's live when dealing with pivotal tracker (PT) and ... |
Make aspect more readable by defining constants for all methods pattern | class A
def test input
input.upcase
end
end
##############################
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'aspector'
class LoggingAspect < Aspector::Base
around /.*/, :except => [:class], :context_arg => true do |context, *args, &block|
class_method = "#{... | class A
def test input
input.upcase
end
end
##############################
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'aspector'
class LoggingAspect < Aspector::Base
ALL_METHODS = /.*/
around ALL_METHODS, :except => :class, :context_arg => true do |context, *args, &blo... |
Fix possible bug with thin pid | require 'boxcar/helpers'
require 'boxcar/command/base'
# Manage Boxcar server
#
class Boxcar::Command::Server < Boxcar::Command::Base
include Boxcar::Helpers
def index
validate_arguments!
end
def start
`cd #{current_path}; thin -e production -d start`
puts "Boxcar started"
end
def stop
p... | require 'boxcar/helpers'
require 'boxcar/command/base'
# Manage Boxcar server
#
class Boxcar::Command::Server < Boxcar::Command::Base
include Boxcar::Helpers
def index
validate_arguments!
end
def start
`cd #{current_path}; thin -e production -d start`
puts "Boxcar started"
end
def stop
p... |
Fix GivenCourse spec. GivenCourse does no longer exists | describe GivenCourse do
describe "validation" do
it "requires a course" do
Factory.build(:given_course, course: nil).should_not be_valid
Factory.build(:given_course).should be_valid
end
it "requires a when" do
Factory.build(:given_course, :when => nil).should_not be_valid
Fact... | describe GivenCourse do
describe "validation" do
it "requires a course" do
Factory.build(:given_course, course: nil).should_not be_valid
Factory.build(:given_course).should be_valid
end
it "requires a when" do
Factory.build(:given_course, when: nil).should_not be_valid
Factory... |
Use SQL BETWEEN & remove unneeded .to_date | # coding: UTF-8
require 'active_support/concern'
module Kpi::EstadisticaKpi
include Kpi::Comun
extend ActiveSupport::Concern
included do
extend ComunScopes
scopes_comunes
belongs_to :usuario, class_name: ::Kpi::Clases.usuario_extern
scope :ultima_semana, -> { having("MIN(created_at) >= ? AND ... | require 'active_support/concern'
module Kpi::EstadisticaKpi
include Kpi::Comun
extend ActiveSupport::Concern
included do
extend ComunScopes
scopes_comunes
belongs_to :usuario, class_name: ::Kpi::Clases.usuario_extern
scope :ultima_semana, -> { having('MIN(created_at) BETWEEN ? AND ?', 1.week.a... |
Remove 'one' from default ranks | class Deck
DEFAULT_SUITS = %w(spades clubs diamonds hearts)
DEFAULT_RANKS = %w(ace one two three four five six seven eight nine ten jack queen king)
def initialize(suits, ranks)
@suits = suits
@ranks = ranks
@cards = Array.new
# Top of the deck is the last entry in the array
# Reversing so d... | class Deck
DEFAULT_SUITS = %w(spades clubs diamonds hearts)
DEFAULT_RANKS = %w(ace two three four five six seven eight nine ten jack queen king)
def initialize(suits, ranks)
@suits = suits
@ranks = ranks
@cards = Array.new
# Top of the deck is the last entry in the array
# Reversing so deck ... |
Add code wars (5) - memoized fibonacci | # http://www.codewars.com/kata/529adbf7533b761c560004e5/
# --- iteration 1 ---
def fibonacci(n)
a, b = 1, 1
(n - 1).times do |i|
a, b = b, a + b
end
a
end
# --- iteration 2 ---
def fibonacci(n, cache = [0,1])
cache[n] ||= fibonacci(n-1, cache) + fibonacci(n-2, cache)
end
| |
Move the test log to /tmp as most won't have permission for /mnt | # These ones take longer to run
require 'test/unit'
require File.join(File.dirname(__FILE__), "/../lib/simple_record")
require File.join(File.dirname(__FILE__), "./test_helpers")
require File.join(File.dirname(__FILE__), "./test_base")
require "yaml"
require 'aws'
require 'my_model'
require 'my_child_model'
require 'a... | # These ones take longer to run
require 'test/unit'
require File.join(File.dirname(__FILE__), "/../lib/simple_record")
require File.join(File.dirname(__FILE__), "./test_helpers")
require File.join(File.dirname(__FILE__), "./test_base")
require "yaml"
require 'aws'
require 'my_model'
require 'my_child_model'
require 'a... |
Fix on minitest to support 1.9.3 | require 'helper'
describe Arel do
before :all do
@table = Arel::Table.new(:people)
@attr = @table[:name]
@conn = FakeRecord::Base.new
end
def compile node
@visitor.accept(node, Arel::Collectors::SQLString.new).value
end
describe 'MySQL' do
before do
@visitor = Arel::Visitors::MySQ... | require 'helper'
describe Arel do
before do
@table = Arel::Table.new(:people)
@attr = @table[:name]
@conn = FakeRecord::Base.new
end
def compile node
@visitor.accept(node, Arel::Collectors::SQLString.new).value
end
describe 'MySQL' do
before do
@visitor = Arel::Visitors::MySQL.new... |
Fix homepage to use SSL in Dump Truck Cask | cask :v1 => 'dump-truck' do
version :latest
sha256 :no_check
url 'https://www.goldenfrog.com/downloads/dumptruck/dumptruck.dmg'
name 'Dump Truck'
homepage 'http://www.goldenfrog.com/dumptruck'
license :unknown # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder
... | cask :v1 => 'dump-truck' do
version :latest
sha256 :no_check
url 'https://www.goldenfrog.com/downloads/dumptruck/dumptruck.dmg'
name 'Dump Truck'
homepage 'https://www.goldenfrog.com/dumptruck'
license :unknown # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder... |
Remove unhelpful comment from copy pasta | ActiveAdmin.register_page 'Queue' do
content do
# Get runs that have a background worker
workers = Sidekiq::Workers.new
active_runs = workers.collect do |process_id, thread_id, work|
if work["queue"] == "scraper"
{
run: Run.find(work["payload"]["args"].first),
enqueued_at... | ActiveAdmin.register_page 'Queue' do
content do
workers = Sidekiq::Workers.new
active_runs = workers.collect do |process_id, thread_id, work|
if work["queue"] == "scraper"
{
run: Run.find(work["payload"]["args"].first),
enqueued_at: Time.at(work["payload"]["enqueued_at"]),
... |
Update dev mode url on nfedobrasil spec | require 'spec_helper'
describe NfedoBrasil do
describe '#client' do
subject { NfedoBrasil.client({ssl_plcs_file: File.dirname(__FILE__) + '/../support/certificate.p12', ssl_plcs_password: 'nughee1O'}) }
it 'returns a Savon client' do
expect(subject).to be_a Savon::Client
expect(subject.globals[:... | require 'spec_helper'
describe NfedoBrasil do
describe '#client' do
subject { NfedoBrasil.client({ssl_plcs_file: File.dirname(__FILE__) + '/../support/certificate.p12', ssl_plcs_password: 'nughee1O'}) }
it 'returns a Savon client' do
expect(subject).to be_a Savon::Client
expect(subject.globals[:... |
Remove vedeu from Menu class. | $LOAD_PATH.unshift(File.dirname(__FILE__))
require "too_dead/version"
require 'too_dead/init_db'
require 'too_dead/user'
require 'too_dead/todo_list'
require 'too_dead/todo_item'
require 'pry'
require 'vedeu'
module TooDead
class Menu
include Vedeu
end
end
| $LOAD_PATH.unshift(File.dirname(__FILE__))
require "too_dead/version"
require 'too_dead/init_db'
require 'too_dead/user'
require 'too_dead/todo_list'
require 'too_dead/todo_item'
require 'pry'
require 'vedeu'
module TooDead
class Menu
# include Vedeu
end
end
|
Remove oven from development dependency | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'pivnet_api/version'
Gem::Specification.new do |spec|
spec.name = "pivnet_api"
spec.version = PivnetApi::VERSION
spec.authors = ["Yuki Nishijima"]
spec.email =... | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'pivnet_api/version'
Gem::Specification.new do |spec|
spec.name = "pivnet_api"
spec.version = PivnetApi::VERSION
spec.authors = ["Yuki Nishijima"]
spec.email =... |
Add update_rubygems to reserve list | module Patterns
extend ActiveSupport::Concern
SPECIAL_CHARACTERS = ".-_".freeze
ALLOWED_CHARACTERS = "[A-Za-z0-9#{Regexp.escape(SPECIAL_CHARACTERS)}]+".freeze
ROUTE_PATTERN = /#{ALLOWED_CHARACTERS}/.freeze
LAZY_ROUTE_PATTERN = /#{ALLOWED_CHARACTERS}?/.freeze
NAME_PATTERN = /\A#{AL... | module Patterns
extend ActiveSupport::Concern
SPECIAL_CHARACTERS = ".-_".freeze
ALLOWED_CHARACTERS = "[A-Za-z0-9#{Regexp.escape(SPECIAL_CHARACTERS)}]+".freeze
ROUTE_PATTERN = /#{ALLOWED_CHARACTERS}/.freeze
LAZY_ROUTE_PATTERN = /#{ALLOWED_CHARACTERS}?/.freeze
NAME_PATTERN = /\A#{AL... |
Fix an offense reported by UnderscorePrefixedVariableName | # encoding: utf-8
module Rubocop
module Cop
module Style
# This cop checks for methods invoked via the :: operator instead
# of the . operator (like FileUtils::rmdir instead of FileUtils.rmdir).
class ColonMethodCall < Cop
MSG = 'Do not use `::` for method calls.'
def on_send(n... | # encoding: utf-8
module Rubocop
module Cop
module Style
# This cop checks for methods invoked via the :: operator instead
# of the . operator (like FileUtils::rmdir instead of FileUtils.rmdir).
class ColonMethodCall < Cop
MSG = 'Do not use `::` for method calls.'
def on_send(n... |
Update gemspec to use the latest version of loveseat | $:.push File.expand_path("../lib", __FILE__)
require 'comfy_blog/version'
Gem::Specification.new do |s|
s.name = 'comfy_blog'
s.version = ComfyBlog::VERSION
s.authors = ["Oleg Khabarov", "Demitry Toumilovich"]
s.email = ["oleg@khabarov.ca", "demitry.toumilovich@hitfoxgroupcom"]
s.homepa... | $:.push File.expand_path("../lib", __FILE__)
require 'comfy_blog/version'
Gem::Specification.new do |s|
s.name = 'comfy_blog'
s.version = ComfyBlog::VERSION
s.authors = ["Oleg Khabarov", "Demitry Toumilovich"]
s.email = ["oleg@khabarov.ca", "demitry.toumilovich@hitfoxgroupcom"]
s.homepa... |
Raise error when client is nil | require 'active_support/core_ext/hash/keys'
require 'erb'
require 'yaml'
module Mikoshi
class Plan
class Base
attr_reader :data, :client
def initialize(yaml_path: nil, client: nil)
raise ArgumentError, 'Yaml file path is required.' if yaml_path.nil?
@data = YAML.safe_load(ERB.new(Fi... | require 'active_support/core_ext/hash/keys'
require 'erb'
require 'yaml'
module Mikoshi
class Plan
class Base
attr_reader :data, :client
def initialize(yaml_path: nil, client: nil)
raise ArgumentError, 'Yaml file path is required.' if yaml_path.nil?
raise ArgumentError, 'client is re... |
Add cron job to refresh cache | # Use this file to easily define all of your cron jobs.
#
# It's helpful, but not entirely necessary to understand cron before proceeding.
# http://en.wikipedia.org/wiki/Cron
set :output, { error: 'log/cron.error.log', standard: 'log/cron.log' }
bundler_prefix = ENV.fetch('BUNDLER_PREFIX', '/usr/local/bin/govuk_seten... | |
Disable bitcode for pod spec target. | Pod::Spec.new do |s|
s.name = "KMSWebRTC"
s.version = "1.1.1"
s.summary = "Kurento Media Server iOS Web RTC Call."
s.homepage = "https://github.com/sdkdimon/kms-ios-webrtc-call"
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { "Dmitry L... | Pod::Spec.new do |s|
s.name = "KMSWebRTC"
s.version = "1.1.1"
s.summary = "Kurento Media Server iOS Web RTC Call."
s.homepage = "https://github.com/sdkdimon/kms-ios-webrtc-call"
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { "Dmitry L... |
Update responses_json method to return a timeline of data | class Topic < ActiveRecord::Base
has_many :charts
has_many :responses, through: :charts
validates_presence_of :name
include ResponsesHelper
# def responses_json
# self.charts.map { |c| { chart: c, responses: bucketize_responses(c.responses) } }
# end
def responses_json
keyed_json = {}
self... | class Topic < ActiveRecord::Base
has_many :charts
has_many :responses, through: :charts
validates_presence_of :name
include ResponsesHelper
def responses_json
timeline_array = Array.new(30) { Hash.new }
self.charts.each do |c|
response_chunks = bucketize_responses(c.responses)
response_... |
Remove deprecation warning, since scoped waas deprecated | class Reply < ActiveRecord::Base
scope :base, -> { scoped }
belongs_to :topic, -> { includes(:replies) }
belongs_to :developer
validates_presence_of :content
end
| class Reply < ActiveRecord::Base
scope :base, -> { all }
belongs_to :topic, -> { includes(:replies) }
belongs_to :developer
validates_presence_of :content
end
|
Add options support to link_to_profile helper. | module ApplicationHelper
def cancel_link(url = {action: :index})
content_tag("li", class: "cancel") do
link_to t("cancel"), url
end
end
def user_groups(user = nil)
user ||= current_user
return [] if user.nil?
user.groups
end
# Generate link to user or group profiles
def link_to_p... | module ApplicationHelper
def cancel_link(url = {action: :index})
content_tag("li", class: "cancel") do
link_to t("cancel"), url
end
end
def user_groups(user = nil)
user ||= current_user
return [] if user.nil?
user.groups
end
# Generate link to user or group profiles
def link_to_p... |
Remove pry as a runtime dependency. | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'less_secure_random/version'
Gem::Specification.new do |spec|
spec.name = "less_secure_random"
spec.version = LessSecureRandom::VERSION
spec.authors = ["Kale Worsley"]
... | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'less_secure_random/version'
Gem::Specification.new do |spec|
spec.name = "less_secure_random"
spec.version = LessSecureRandom::VERSION
spec.authors = ["Kale Worsley"]
... |
Fix case in Url tag | # frozen_string_literal: true
xml.instruct!
xml.OpenSearchDescription 'xmlns' => 'http://a9.com/-/spec/opensearch/1.1/',
'xmlns:moz' => 'http://www.mozilla.org/2006/browser/search/' do
xml.ShortName 'ASCIIwwdc'
xml.Image 'https://asciiwwdc.com/favicon.ico',
'type' => 'image/x-... | # frozen_string_literal: true
xml.instruct!
xml.OpenSearchDescription 'xmlns' => 'http://a9.com/-/spec/opensearch/1.1/',
'xmlns:moz' => 'http://www.mozilla.org/2006/browser/search/' do
xml.ShortName 'ASCIIwwdc'
xml.Image 'https://asciiwwdc.com/favicon.ico',
'type' => 'image/x-... |
Change settings for facebook conections | module Spree
module Admin
class SocialController < BaseController
def edit
end
def update
params[:social].each do |provider, value|
if value == '1'
Spree::Config["#{provider}_button"] = true
else
Spree::Config["#{provider}_button"] = false
... | module Spree
module Admin
class SocialController < BaseController
def edit
end
def update
params[:social].each do |provider, value|
if value == '1'
Spree::Config["#{provider}_button"] = true
else
Spree::Config["#{provider}_button"] = false
... |
Use special PPA only for Precise | #
# Cookbook Name:: zeromq
# Recipe:: ppa
#
# Copyright 2011-2013, Travis CI Development Team <contact@travis-ci.org>
#
# 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... | #
# Cookbook Name:: zeromq
# Recipe:: ppa
#
# Copyright 2011-2013, Travis CI Development Team <contact@travis-ci.org>
#
# 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... |
Update React Native documentation (0.27) | module Docs
class ReactNative < React
self.name = 'React Native'
self.slug = 'react_native'
self.type = 'react'
self.release = '0.26'
self.base_url = 'https://facebook.github.io/react-native/docs/'
self.root_path = 'getting-started.html'
self.links = {
home: 'https://facebook.github.... | module Docs
class ReactNative < React
self.name = 'React Native'
self.slug = 'react_native'
self.type = 'react'
self.release = '0.27'
self.base_url = 'https://facebook.github.io/react-native/docs/'
self.root_path = 'getting-started.html'
self.links = {
home: 'https://facebook.github.... |
Move bar out of the way when hovering | require "devbar/version"
module Rack
class DevBar
def initialize(app)
@app = app
end
def call(env)
status, headers, body = @app.call(env)
body.each do |part|
if part =~ /<\/body>/
part.sub!(/<\/body>/, "#{bar}</body>")
if headers['Content-Length']
... | require "devbar/version"
module Rack
class DevBar
def initialize(app)
@app = app
end
def call(env)
status, headers, body = @app.call(env)
body.each do |part|
if part =~ /<\/body>/
part.sub!(/<\/body>/, "#{bar}</body>")
if headers['Content-Length']
... |
Update user_has_namespace_with_gold? to check for any plan instead of just gold plan | # frozen_string_literal: true
module EE
module UsersHelper
def users_sentence(users, link_class: nil)
users.map { |user| link_to(user.name, user, class: link_class) }.to_sentence.html_safe
end
def user_namespace_union(user = current_user, select = :id)
::Gitlab::SQL::Union.new([
::Na... | |
Add minitest as dev dependency | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'authoraise/version'
Gem::Specification.new do |spec|
spec.name = "authoraise"
spec.version = Authoraise::VERSION
spec.authors = ["Maxim Chernyak"]
spec.email ... | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'authoraise/version'
Gem::Specification.new do |spec|
spec.name = "authoraise"
spec.version = Authoraise::VERSION
spec.authors = ["Maxim Chernyak"]
spec.email ... |
Add a CORS header for the Space API endpoint | class SpaceApiController < ApplicationController
def status
@space_api = SpaceApi.new
end
end
| class SpaceApiController < ApplicationController
before_action :set_access_control_headers, only: :status
def status
@space_api = SpaceApi.new
end
private
def set_access_control_headers
if request.format.json?
response.headers['Access-Control-Allow-Origin'] = '*'
response.heade... |
Remove iframe styles for embed field in compact mode | class Field::EmbedPresenter < FieldPresenter
COMPACT_WIDTH = 300
COMPACT_HEIGHT = 150
def input(form, method, options={})
if field.iframe?
form.text_area(method, input_defaults(options))
elsif field.url?
form.url_field(method, input_defaults(options).reverse_merge(help: help))
end
end
... | class Field::EmbedPresenter < FieldPresenter
COMPACT_WIDTH = 300
COMPACT_HEIGHT = 150
def input(form, method, options={})
if field.iframe?
form.text_area(method, input_defaults(options))
elsif field.url?
form.url_field(method, input_defaults(options).reverse_merge(help: help))
end
end
... |
Update relative_path and add documentation | class File
def self.relative_path(from, to)
from = File.expand_path(from).split('/')
to = File.expand_path(to).split('/')
from.length.times do
break if from[0] != to[0]
from.shift; to.shift
end
fname = from.pop
join *(from.map { '..' } + to)
end
end | class File
RELATIVE_PARENTDIR = '..'
# Turns a path +to+ into a relative path from starting
# point +from+. The argument +from+ is assumed to be
# a filename. To treat it as a directory, make sure it
# ends in {File::SEPARATOR} ('/' on UNIX filesystems).
#
# @param [String] from the starting filename ... |
Define a step to verify lockfile with regexp | Given 'a lockfile with:' do |content|
steps %Q{
Given a file named "#{'.'.to_lockfile_path}" with:
"""
#{expand(content)}
"""
}
end
Given 'I copy a new lockfile from another machine with:' do |content|
steps %Q{
Given a lockfile with:
"""
#{content}
"""
}
end
Given ... | Given 'a lockfile with:' do |content|
steps %Q{
Given a file named "#{'.'.to_lockfile_path}" with:
"""
#{expand(content)}
"""
}
end
Given 'I copy a new lockfile from another machine with:' do |content|
steps %Q{
Given a lockfile with:
"""
#{content}
"""
}
end
Given ... |
Clean up root parser specs | require 'raml/parser/root'
require 'yaml'
describe Raml::Parser::Root do
describe '#parse' do
let(:raml) { YAML.load File.read('spec/fixtures/basic.raml') }
subject { Raml::Parser::Root.new.parse(raml) }
it { should be_kind_of Raml::Root }
its('resources.count') { should == 2 }
its('documentati... | require 'raml/parser/root'
require 'yaml'
describe Raml::Parser::Root do
describe '#parse' do
let(:raml) { YAML.load File.read('spec/fixtures/basic.raml') }
subject { Raml::Parser::Root.new.parse(raml) }
it { should be_kind_of Raml::Root }
its(:uri) { should == 'http://example.api.com/v1' }
its... |
Add some accessors to event wrapper | require 'delegate'
module SandthornDriverSequel
class EventWrapper < SimpleDelegator
[:aggregate_version, :event_name, :event_data].each do |attribute|
define_method(attribute) do
fetch(attribute)
end
end
end
end | require 'delegate'
module SandthornDriverSequel
class EventWrapper < SimpleDelegator
[:aggregate_version, :event_name, :event_data, :timestamp, :aggregate_table_id].each do |attribute|
define_method(attribute) do
fetch(attribute)
end
end
end
end |
Update path or nssm call | require 'win32/service'
powershell_script 'install eventstore' do
code <<-EOH
Add-Type -assembly "system.io.compression.filesystem"
wget "#{node[:eventstore][:url]}" -OutFile "$env:TEMP\\eventstore.zip"
[io.compression.zipfile]::ExtractToDirectory("$env:TEMP\\eventstore.zip", "#{node[:eventstore][:destination_... | require 'win32/service'
powershell_script 'install eventstore' do
code <<-EOH
Add-Type -assembly "system.io.compression.filesystem"
wget "#{node[:eventstore][:url]}" -OutFile "$env:TEMP\\eventstore.zip"
[io.compression.zipfile]::ExtractToDirectory("$env:TEMP\\eventstore.zip", "#{node[:eventstore][:destination_... |
Add functional test for markov controller | require 'test_helper'
class HomeControllerTest < ActionDispatch::IntegrationTest
test "should get index" do
get root_url
assert_response :success
end
end
| require 'test_helper'
class HomeControllerTest < ActionDispatch::IntegrationTest
test "should get index" do
get root_url
assert_response :success
end
test "should create user and return sentence" do
post '/markov/fetch_twitter_chain.json', params: {:twitter_username => 'colinfike'}, xhr: true
as... |
Add a more thorough spec for init command. | require File.expand_path('../../../spec_helper', __FILE__)
module Pod
describe Command::Init do
it "runs with no parameters" do
lambda { run_command('init') }.should.not.raise CLAide::Help
end
it "complains when given parameters" do
lambda { run_command('init', 'create') }.should.raise CLAi... | require File.expand_path('../../../spec_helper', __FILE__)
require 'xcodeproj'
module Pod
describe Command::Init do
it "complains if project does not exist" do
lambda { run_command('init') }.should.raise CLAide::Help
lambda { run_command('init', 'foo.xcodeproj') }.should.raise CLAide::Help
end... |
Remove cucumber as a runtime dependency. | # encoding: utf-8
$:.unshift File.expand_path('../lib', __FILE__)
require 'dill/version'
Gem::Specification.new do |s|
s.name = "dill"
s.version = Dill::VERSION
s.authors = ["David Leal"]
s.email = ["dleal@mojotech.com"]
s.homepage = "https://github.com/mojotech/dill"
s.s... | # encoding: utf-8
$:.unshift File.expand_path('../lib', __FILE__)
require 'dill/version'
Gem::Specification.new do |s|
s.name = "dill"
s.version = Dill::VERSION
s.authors = ["David Leal"]
s.email = ["dleal@mojotech.com"]
s.homepage = "https://github.com/mojotech/dill"
s.s... |
Add store credit to list of payment_methods. | module SpreeStoreCredits
class Engine < Rails::Engine
require 'spree/core'
isolate_namespace Spree
engine_name 'spree_store_credits'
# use rspec for tests
config.generators do |g|
g.test_framework :rspec
end
def self.activate
Dir.glob(File.join(File.dirname(__FILE__), '../../... | module SpreeStoreCredits
class Engine < Rails::Engine
require 'spree/core'
isolate_namespace Spree
engine_name 'spree_store_credits'
# use rspec for tests
config.generators do |g|
g.test_framework :rspec
end
def self.activate
Dir.glob(File.join(File.dirname(__FILE__), '../../... |
Update the version spec to handle when the specs start in the day before that example is run | # frozen_string_literal: true
RSpec.describe "bundle version" do
context "with -v" do
it "outputs the version" do
bundle! "-v"
expect(out).to eq("Bundler version #{Bundler::VERSION}")
end
end
context "with --version" do
it "outputs the version" do
bundle! "--version"
expect(o... | # frozen_string_literal: true
RSpec.describe "bundle version" do
context "with -v" do
it "outputs the version" do
bundle! "-v"
expect(out).to eq("Bundler version #{Bundler::VERSION}")
end
end
context "with --version" do
it "outputs the version" do
bundle! "--version"
expect(o... |
Fix failing `pod spec lint` | Pod::Spec.new do |s|
s.name = 'JBSSettings'
s.version = '0.1.0'
s.summary = 'A settings object that is less annoying than NSUserDefaults'
s.description = ''
s.homepage = 'https://github.com/jsumners/JBSSettings'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.authors ... | Pod::Spec.new do |s|
s.name = 'JBSSettings'
s.version = '0.1.1'
s.summary = 'A settings object that is less annoying than NSUserDefaults'
s.description = ''
s.homepage = 'https://github.com/jsumners/JBSSettings'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.authors ... |
Revert "disable caching on server page for now" | class ServersController < ApplicationController
skip_before_filter :authenticate_user!
def index
SteamCondenser::Servers::Sockets::BaseSocket.timeout = 500
@servers = Server.active.order(:name)
end
end
| class ServersController < ApplicationController
skip_before_filter :authenticate_user!
caches_action :index, :unless => :current_user
def index
SteamCondenser::Servers::Sockets::BaseSocket.timeout = 500
@servers = Server.active.order(:name)
end
end
|
Add Webmock configure for Code Climate | require "codeclimate-test-reporter"
CodeClimate::TestReporter.start
Dir[File.join(File.dirname(__FILE__), "../lib/**/*.rb")].each { |f| require f }
require 'webmock/rspec'
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = ... | require "codeclimate-test-reporter"
CodeClimate::TestReporter.start
Dir[File.join(File.dirname(__FILE__), "../lib/**/*.rb")].each { |f| require f }
require 'webmock/rspec'
WebMock.disable_net_connect!(:allow => "codeclimate.com")
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectatio... |
Verify doubles when we get to that point | require 'bundler/setup'
require 'simplecov'
require 'coveralls'
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
]
SimpleCov.start do
add_filter "/spec/"
end
require 'pry' unless ENV["TRAVIS"]
require 'vcr'
require 'sermonaudio'
... | require 'bundler/setup'
require 'simplecov'
require 'coveralls'
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
]
SimpleCov.start do
add_filter "/spec/"
end
require 'pry' unless ENV["TRAVIS"]
require 'vcr'
require 'sermonaudio'
... |
Add comment to Buttocks class | require 'slatan/spirit'
require 'logger'
module Slatan
# Wrapper class of Logger
class Buttocks
@@use_log = Spirit.use_log
class << self
def init()
if @@use_log
path = Spirit.logfile_path
@@log = Logger.new(path)
@@log.level = (case Spirit.log_level
wh... | require 'slatan/spirit'
require 'logger'
module Slatan
## Wrapper class of Logger
class Buttocks
@@use_log = Spirit.use_log
class << self
def init()
if @@use_log
path = Spirit.logfile_path
@@log = Logger.new(path)
@@log.level = (case Spirit.log_level
w... |
Revert "Patch the change in, instead." | require 'redmine'
# Patches!
require 'dispatcher'
Dispatcher.to_prepare :overview_view_page_forward do
gem 'lockfile'
require_dependency 'projects_helper'
ProjectsHelper.send(:include, OverviewProjectsHelperPatch)
end
Redmine::Plugin.register :overview_view_page_forward do
name 'Overview->View page fo... | require 'redmine'
Redmine::Plugin.register :overview_view_page_forward do
name 'Overview->View page forward'
author 'Jon McManus'
url 'http://github.com/jmcb/overview-view-page-forward'
author_url 'http://githu.com/jmcb'
description 'Take a Redmine user directly to the Issues page when entering a project fro... |
Remove Land Registry Corporate Information Page | class RemoveLandRegistry < Mongoid::Migration
def self.up
content_items = ContentItem.where(content_id: "5fe3c59c-7631-11e4-a3cb-005056011aef")
content_items.destroy_all
end
def self.down
raise "non-reversible migration"
end
end
| |
Add missing require statements to RequestAuthenticator. | # https://services.tineye.com/developers/tineyeapi/authentication.html
module Tinplate
class RequestAuthenticator
def initialize(action, params = {}, image_name = "")
@action = action
@params = params
@image_name = image_name
@nonce = SecureRandom.hex
@date = Time.now.to_i
end... | # https://services.tineye.com/developers/tineyeapi/authentication.html
require "securerandom"
require "uri"
module Tinplate
class RequestAuthenticator
def initialize(action, params = {}, image_name = "")
@action = action
@params = params
@image_name = image_name
@nonce = SecureRandom.he... |
Disable Gradle daemon for user | module Travis
module Build
class Script
module Jdk
def configure
super
sh.cmd "jdk_switcher use #{config[:jdk]}", assert: true, echo: true, timing: false if uses_jdk?
end
def export
super
sh.export 'TRAVIS_JDK_VERSION', config[:jdk], echo: fal... | module Travis
module Build
class Script
module Jdk
def configure
super
sh.cmd "jdk_switcher use #{config[:jdk]}", assert: true, echo: true, timing: false if uses_jdk?
end
def export
super
sh.export 'TRAVIS_JDK_VERSION', config[:jdk], echo: fal... |
Define Application.config.secret_key_base for the test environment | # Be sure to restart your server when you modify this file.
# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to diction... | # Be sure to restart your server when you modify this file.
# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to diction... |
Revert part of authentication for explicit returns | module Authenticate
extend ActiveSupport::Concern
def self.getKeyUser(token)
ApiKey.where(access_token: token.split(" ")[2]).pluck('user_id')
end
def self.getKeyExpiration(token)
ApiKey.where(access_token: token.split(" ")[2]).pluck('expires_at')
end
private
def restrict_access
authenticate... | module Authenticate
extend ActiveSupport::Concern
def self.getKeyUser(token)
ApiKey.where(access_token: token.split(" ")[2]).pluck('user_id')
end
def self.getKeyExpiration(token)
ApiKey.where(access_token: token.split(" ")[2]).pluck('expires_at')
end
private
def restrict_access
authenticate... |
Update CicCode importer rake task | require 'csv'
desc "Import Business Codes from /app/assets/csv/cic_codes.csv"
namespace :import do
task :cic_codes => :environment do
counter = 0
CSV.foreach("#{Rails.root}/app/assets/csv/cic_codes.csv", :headers => false) do |row|
unless row[0].blank?
counter += 1
unless counter == 1
... | require 'csv'
desc "Import Business Codes from /app/assets/csv/cic_codes.csv"
namespace :import do
task :cic_codes => :environment do
counter = 0
CSV.foreach("#{Rails.root}/app/assets/csv/cic_codes.csv", :headers => false) do |row|
unless row[0].blank?
counter += 1
CicCode.create(:code =... |
Deploy hook can now get git user email | require 'net/http'
require 'uri'
unless Capistrano::Configuration.respond_to?(:instance)
abort "capistrano_deploy_webhook requires Capistrano 2"
end
Capistrano::Configuration.instance.load do
after :deploy, "notify:post_request"
namespace :notify do
task :post_request do
application_name = `pwd`.chom... | require 'net/http'
require 'uri'
unless Capistrano::Configuration.respond_to?(:instance)
abort "capistrano_deploy_webhook requires Capistrano 2"
end
Capistrano::Configuration.instance.load do
after :deploy, "notify:post_request"
namespace :notify do
task :post_request do
application_name = `pwd`.chom... |
Use Namespace for fetch a subset of translations | module Rack
module I18n
class Javascript
def initialize(app)
@app = app
end
def call(env)
if env['PATH_INFO'] =~ /\/javascripts\/locales\/(.*)\.js/
serve_translations($1)
else
@app.call(env)
end
end
def serve_translations(locale)
... | module Rack
module I18n
class Javascript
class_attribute :namespace
self.namespace = ''
def initialize(app)
@app = app
end
def call(env)
if env['PATH_INFO'] =~ /\/javascripts\/locales\/(.*)\.js/
serve_translations($1)
else
@app.call(env)
... |
Clear out the FG definitions if they are already defined so there is no duplicate definition error | require "base_spec_helper"
require "active_record"
require "factory_girl"
require "faker"
require "protected_attributes"
require "yaml"
connection_info = YAML.load_file("config/database.yml")["test"]
ActiveRecord::Base.establish_connection(connection_info)
RSpec.configure do |config|
config.include FactoryGirl::Syn... | require "base_spec_helper"
require "active_record"
require "factory_girl"
require "faker"
require "protected_attributes"
require "yaml"
connection_info = YAML.load_file("config/database.yml")["test"]
ActiveRecord::Base.establish_connection(connection_info)
RSpec.configure do |config|
config.include FactoryGirl::Syn... |
Load tasks from the constant file name | require "remindice/version"
require "thor"
module Remindice
class Commands < Thor
end
end
| require "remindice/version"
require "thor"
module Remindice
TASK_FILENAME = "~/.reamindice_tasks"
@@tasks = if File.exists?(TASK_FILENAME); File.readlines(TASK_FILENAME) else [] end
class Commands < Thor
end
end
|
Update the code that reloads plugin app directories to more robust code | # Settings specified here will take precedence over those in config/environment.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 webserver when you make code changes.
config.ca... | # Settings specified here will take precedence over those in config/environment.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 webserver when you make code changes.
config.ca... |
Add user create unsuccessful path test | require 'rails_helper'
describe UsersController do
describe 'GET#new' do
it 'creates a new user' do
get :new
expect(assigns(:user)).to be_a(User)
end
end
describe "GET#show" do
before(:each) {
@user = create(:user)
}
it "Shows a specific user page" do
get :show, id: @... | require 'rails_helper'
describe UsersController do
describe 'GET#new' do
it 'creates a new user' do
get :new
expect(assigns(:user)).to be_a(User)
end
end
describe "GET#show" do
before(:each) {
@user = create(:user)
}
it "Shows a specific user page" do
get :show, id: @... |
Add new assertions to Rutty::Consts test for new constants | require 'helper'
class TestConsts < Test::Unit::TestCase
context "The Rutty::Consts module" do
should "have all the constants set" do
assert_not_nil Rutty::Consts::CONF_DIR
assert_not_nil Rutty::Consts::GENERAL_CONF
assert_not_nil Rutty::Consts::NODES_CONF
end
should "have the cons... | require 'helper'
class TestConsts < Test::Unit::TestCase
context "The Rutty::Consts module" do
should "have all the constants set" do
assert_not_nil Rutty::Consts::CONF_DIR
assert_not_nil Rutty::Consts::GENERAL_CONF
assert_not_nil Rutty::Consts::NODES_CONF
end
should "have the cons... |
Delete test.db before the tests | require 'simplecov'
SimpleCov.start
base = __FILE__
$:.unshift(File.join(File.dirname(base), '../lib'))
require 'rails'
require 'rails/test_help'
require 'test/unit'
require 'active_record'
require 'active_record/fixtures'
require "active_support"
require 'risu'
config =
"report:
author: TEST
title: TEST
com... | require 'simplecov'
SimpleCov.start
base = __FILE__
$:.unshift(File.join(File.dirname(base), '../lib'))
require 'rails'
require 'rails/test_help'
require 'test/unit'
require 'active_record'
require 'active_record/fixtures'
require "active_support"
require 'risu'
config =
"report:
author: TEST
title: TEST
com... |
Add pride to minitest helper. | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'rex'
require 'minitest/autorun'
| $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'rex'
require 'minitest/autorun'
require 'minitest/pride'
|
Make the default door status manager URI a valid one | # Pesho instance for door status updates
Rails.application.config.door_status_manager = ActiveSupport::OrderedOptions.new
Rails.application.config.door_status_manager.host = '::1'
Rails.application.config.door_status_manager.url = "http://#{Rails.application.config.door_status_manager.host}"
Rails.application.config.do... | # Pesho instance for door status updates
Rails.application.config.door_status_manager = ActiveSupport::OrderedOptions.new
Rails.application.config.door_status_manager.host = '[::1]'
Rails.application.config.door_status_manager.url = "http://#{Rails.application.config.door_status_manager.host}"
Rails.application.config.... |
Add 9.6 to postgresql alternate versions | include_attribute 'travis_build_environment'
default['postgresql']['default_version'] = '9.1'
default['postgresql']['alternate_versions'] = %w(9.2 9.3 9.4 9.5)
default['postgresql']['enabled'] = true # is default instance started on machine boot?
default['postgresql']['port'] = 543... | include_attribute 'travis_build_environment'
default['postgresql']['default_version'] = '9.3'
default['postgresql']['alternate_versions'] = %w(9.1 9.2 9.4 9.5 9.6)
default['postgresql']['enabled'] = true # is default instance started on machine boot?
default['postgresql']['port'] =... |
Fix CI/CD bridge variables unit test | require 'spec_helper'
describe Ci::Bridge do
set(:project) { create(:project) }
set(:pipeline) { create(:ci_pipeline, project: project) }
let(:bridge) do
create(:ci_bridge, pipeline: pipeline)
end
describe '#tags' do
it 'only has a bridge tag' do
expect(bridge.tags).to eq [:bridge]
end
... | require 'spec_helper'
describe Ci::Bridge do
set(:project) { create(:project) }
set(:pipeline) { create(:ci_pipeline, project: project) }
let(:bridge) do
create(:ci_bridge, pipeline: pipeline)
end
describe '#tags' do
it 'only has a bridge tag' do
expect(bridge.tags).to eq [:bridge]
end
... |
Update FakeWeb URI to ChannelAdvisor V6 API | require 'rubygems'
require 'bundler/setup'
require 'channeladvisor'
require 'fakeweb'
Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|f| require f}
RSpec.configure do |config|
config.mock_with :rr
end
Savon.configure do |config|
config.log = false
end
HTTPI.log = false
FakeWeb.allow_net_connect = false
... | require 'rubygems'
require 'bundler/setup'
require 'channeladvisor'
require 'fakeweb'
Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|f| require f}
RSpec.configure do |config|
config.mock_with :rr
end
Savon.configure do |config|
config.log = false
end
HTTPI.log = false
FakeWeb.allow_net_connect = false
... |
Expand the list of valid tarball content types | class CookbookVersion < ActiveRecord::Base
# Associations
# --------------------
has_many :supported_platforms, dependent: :destroy
has_many :cookbook_dependencies, dependent: :destroy
belongs_to :cookbook
# Attachments
#
# If both a S3 bucket set in the application configuration use S3
# otherwise u... | class CookbookVersion < ActiveRecord::Base
# Associations
# --------------------
has_many :supported_platforms, dependent: :destroy
has_many :cookbook_dependencies, dependent: :destroy
belongs_to :cookbook
# Attachments
#
# If both a S3 bucket set in the application configuration use S3
# otherwise u... |
Revert "Fixed dependency (`@api.fetch_all` is available on google-api-client 0.9.4)" | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'acmesmith-google-cloud-storage/version'
Gem::Specification.new do |spec|
spec.name = "acmesmith-google-cloud-storage"
spec.version = AcmesmithGoogleCloudStorage::VERSION
spec... | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'acmesmith-google-cloud-storage/version'
Gem::Specification.new do |spec|
spec.name = "acmesmith-google-cloud-storage"
spec.version = AcmesmithGoogleCloudStorage::VERSION
spec... |
Remove use of deprecated `bypass` opt for sign_in | class Spree::UsersController < Spree::StoreController
skip_before_action :set_current_order, only: :show
prepend_before_action :load_object, only: [:show, :edit, :update]
prepend_before_action :authorize_actions, only: :new
include Spree::Core::ControllerHelpers
def show
@orders = @user.orders.complete.... | class Spree::UsersController < Spree::StoreController
skip_before_action :set_current_order, only: :show
prepend_before_action :load_object, only: [:show, :edit, :update]
prepend_before_action :authorize_actions, only: :new
include Spree::Core::ControllerHelpers
def show
@orders = @user.orders.complete.... |
Remove unnecessary configuration for test files | # encoding: utf-8
require File.expand_path('../lib/ice_nine/version', __FILE__)
Gem::Specification.new do |gem|
gem.name = 'ice_nine'
gem.version = IceNine::VERSION.dup
gem.authors = ['Dan Kubb']
gem.email = %w[dan.kubb@gmail.com]
gem.description = 'Deep Freeze Ruby Objects'
gem.summa... | # encoding: utf-8
require File.expand_path('../lib/ice_nine/version', __FILE__)
Gem::Specification.new do |gem|
gem.name = 'ice_nine'
gem.version = IceNine::VERSION.dup
gem.authors = ['Dan Kubb']
gem.email = %w[dan.kubb@gmail.com]
gem.description = 'Deep Freeze Ruby Objects'
gem.summa... |
Check that file is readable | module ElectricSheeps
module Sheepfile
class Evaluator
def initialize(path)
@path = File.expand_path(path)
end
def evaluate
raise "Unable to evaluate #{@path}" unless readable?
evaluate_file(Config.new)
end
protected
def evaluate_file(config)
... | module ElectricSheeps
module Sheepfile
class Evaluator
def initialize(path)
@path = File.expand_path(path)
end
def evaluate
raise "Unable to evaluate #{@path}" unless readable?
evaluate_file(Config.new)
end
protected
def evaluate_file(config)
... |
Convert dependencies to formulas for name matching | require 'formula'
# `brew uses foo bar` returns formulae that use both foo and bar
# If you want the union, run the command twice and concatenate the results.
# The intersection is harder to achieve with shell tools.
module Homebrew
def uses
raise FormulaUnspecifiedError if ARGV.named.empty?
used_formulae ... | require 'formula'
# `brew uses foo bar` returns formulae that use both foo and bar
# If you want the union, run the command twice and concatenate the results.
# The intersection is harder to achieve with shell tools.
module Homebrew
def uses
raise FormulaUnspecifiedError if ARGV.named.empty?
used_formulae ... |
Use explicit alignment for block-style formulas | # MathJax Block
# Roughly based on Jekyll's HighlightBlock
module Jekyll
class MathJaxBlock < Liquid::Block
include Liquid::StandardFilters
# Detect if we need to use block display style
SYNTAX = /(display)?/
def initialize(tag_name, markup,tokens)
super
if markup =~ SYNTAX
if d... | # MathJax Block
# Roughly based on Jekyll's HighlightBlock
module Jekyll
class MathJaxBlock < Liquid::Block
include Liquid::StandardFilters
# Detect if we need to use block display style
SYNTAX = /(display)?/
def initialize(tag_name, markup, tokens)
super
if markup =~ SYNTAX
if ... |
Fix tests for Rails 6 | require 'bundler/setup'
require 'minitest/autorun'
require 'mocha/setup'
require 'action_view'
require 'active_support/core_ext/kernel/reporting'
require 'active_model'
require 'record_tag_helper'
silence_warnings do
Encoding.default_internal = "UTF-8"
Encoding.default_external = "UTF-8"
end
module RenderERBUti... | require 'bundler/setup'
require 'minitest/autorun'
require 'mocha/setup'
require 'action_view'
require 'active_support/core_ext/kernel/reporting'
require 'active_model'
require 'record_tag_helper'
silence_warnings do
Encoding.default_internal = "UTF-8"
Encoding.default_external = "UTF-8"
end
module RenderERBUti... |
Remove unnecessary require that will be handled by Bundler | require 'cover_me'
require 'rubygems'
require 'bundler'
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end
require 'active_record'
require 'test/unit'
require 'rails'
require F... | require 'cover_me'
require 'rubygems'
require 'bundler'
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end
require 'active_record'
require 'test/unit'
require File.join(File.di... |
Fix a bug in FreeAgent configuration when user is not logged in | class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :authenticate_user!, :configure_freeagent
private
def configure_freeagent
FreeAgent.access_details(
Rails.application.secrets.freeagent_id,
Rails.application.secrets.freeagent_secret,
... | class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :authenticate_user!, :configure_freeagent
private
def configure_freeagent
FreeAgent.access_details(
Rails.application.secrets.freeagent_id,
Rails.application.secrets.freeagent_secret,
... |
Rename instance variable `document` -> `section` | require "forwardable"
class SectionViewAdapter < SimpleDelegator
extend ActiveModel::Naming
include ActiveModel::Conversion
def initialize(manual, document)
@manual = manual
@document = document
super(document)
end
def persisted?
document.updated_at || document.published?
end
def minor... | require "forwardable"
class SectionViewAdapter < SimpleDelegator
extend ActiveModel::Naming
include ActiveModel::Conversion
def initialize(manual, section)
@manual = manual
@section = section
super(section)
end
def persisted?
section.updated_at || section.published?
end
def minor_updat... |
Use variable size secure compare | module ShopifyApp
module WebhooksController
extend ActiveSupport::Concern
included do
skip_before_action :verify_authenticity_token
before_action :verify_request
end
private
def verify_request
request.body.rewind
data = request.body.read
return head :unauthorized ... | module ShopifyApp
module WebhooksController
extend ActiveSupport::Concern
included do
skip_before_action :verify_authenticity_token
before_action :verify_request
end
private
def verify_request
request.body.rewind
data = request.body.read
return head :unauthorized ... |
Update gemspec based off abstract_class gem | # -*- encoding: utf-8 -*-
lib = File.expand_path('../lib/', __FILE__)
$:.unshift lib unless $:.include?(lib)
require 'sub_diff/version'
require 'date'
Gem::Specification.new do |s|
s.name = 'sub_diff'
s.version = SubDiff::Version
s.date = Date.today
s.platform = Gem::Platform::RUBY
s.summary ... | require File.expand_path('../lib/sub_diff/version', __FILE__)
Gem::Specification.new do |s|
s.name = 'sub_diff'
s.version = SubDiff::Version
s.platform = Gem::Platform::RUBY
s.summary = 'Apply regular expression replacements to strings while presenting the result in a "diff" like format'
s.descript... |
Remove double shellout from a bad merge | property :name, String, regex: /^[\w-]+$/, name_property: true
property :options, String
action :install do
execute "installing cask #{new_resource.name}" do
command "/usr/local/bin/brew cask install #{new_resource.name} #{new_resource.options}"
user Homebrew.owner
environment lazy { { 'HOME' => ::Dir.ho... | property :name, String, regex: /^[\w-]+$/, name_property: true
property :options, String
action :install do
execute "installing cask #{new_resource.name}" do
command "/usr/local/bin/brew cask install #{new_resource.name} #{new_resource.options}"
user Homebrew.owner
environment lazy { { 'HOME' => ::Dir.ho... |
Update build scripts for Emscripten 1.38.19 | #!/usr/bin/false
NAME = "emscripten"
VERSION = "1.38.11"
RELEASE = "1"
FILES = [
[
"https://github.com/kripken/emscripten/archive/#{VERSION}.tar.gz",
"5521e8eefbee284b6a72797c7f63ce606d37647930cd8f4d48d45d02c4e1da95",
"emscripten-#{VERSION}.tgz"
],
[
"https://github.com/kri... | #!/usr/bin/false
NAME = "emscripten"
VERSION = "1.38.19"
RELEASE = "1"
FILES = [
[
"https://github.com/kripken/emscripten/archive/#{VERSION}.tar.gz",
"4bdb7932f084171e40b405b4ab5e60aa7adb36ae399ba88c967e66719fc2d1e2",
"emscripten-#{VERSION}.tgz"
],
[
"https://github.com/kri... |
Update tests to new test data | require 'spec_helper'
RSpec.describe CSV2Avro do
describe '#convert' do
let(:options) { { schema: './spec/support/schema.avsc' } }
before do
ARGV.replace ['./spec/support/data.csv']
end
subject(:converter) { CSV2Avro.new(options) }
it 'should write errors to STDERR' do
expect { conv... | require 'spec_helper'
RSpec.describe CSV2Avro do
describe '#convert' do
let(:options) { { schema: './spec/support/schema.avsc' } }
before do
ARGV.replace ['./spec/support/data.csv']
end
subject(:converter) { CSV2Avro.new(options) }
it 'should write errors to STDERR' do
expect { conv... |
Move instance method below class methods | module Drift
class StaticModel
def initialize(args)
args.each do |k, v|
instance_variable_set("@#{k.to_s.underscore}", v) unless v.nil?
end
end
class << self
attr_accessor :source
def all
source.present? ? fetch_all : []
end
def all_files
al... | module Drift
class StaticModel
class << self
attr_accessor :source
def all
source.present? ? fetch_all : []
end
def all_files
all_files = []
for_each_file do |file|
all_files.push file
end
all_files
end
def find_by_file(fil... |
Handle orphan commits in GithubSyncJob | module Shipit
class FirstParentCommitsIterator < OctokitIterator
def each
last_ancestor = nil
super do |commit|
unless last_ancestor
yield last_ancestor = commit
next
end
if last_ancestor.parents.first.sha == commit.sha
yield last_ancestor = commi... | module Shipit
class FirstParentCommitsIterator < OctokitIterator
def each
last_ancestor = nil
super do |commit|
unless last_ancestor
yield last_ancestor = commit
next
end
if last_ancestor.parents.empty? || last_ancestor.parents.first.sha == commit.sha
... |
Drop bundler gem install from example, lags on rubygems. | Citrus::Configuration.describe do |c|
c.build_script = 'gem ins bundler && bundle install && bundle exec rspec'
end
| Citrus::Configuration.describe do |c|
c.build_script = 'bundle install && bundle exec rspec'
end
|
Use standard ruby method for defining tests | require 'test_helper'
class DictionaryTest < Test::Unit::TestCase
include Spout::Tests
# You may add additional tests here
# test "the truth" do
# assert true
# end
end
| require 'test_helper'
class DictionaryTest < Test::Unit::TestCase
include Spout::Tests
# You may add additional tests here
# def test_truth
# assert true
# end
end
|
Remove empty slug pages. Fix /resources/ URL. | class RobotsController < ApplicationController
layout false
def index
if ENV['DYNAMIC_ROBOTS_TXT'] == 'true'
lines = []
lines = [
"#",
"# This file is dynamically generated.",
"#",
"User-Agent: *",
"Allow: /$",
"Allow:... | class RobotsController < ApplicationController
layout false
def index
if ENV['DYNAMIC_ROBOTS_TXT'] == 'true'
lines = []
lines = [
"#",
"# This file is dynamically generated.",
"#",
"User-Agent: *",
"Allow: /$",
"Allow:... |
Fix to helper work with 3.* rails app | require 'event_calendar/calendar_helper'
module EventCalendar
module Rails
class Engine < ::Rails::Engine
initializer 'event_calendar.setup_view_helpers' do |app|
app.config.to_prepare do
ActionController::Base.send(:helper, ::EventCalendar::CalendarHelper)
end
end
end
... | require 'event_calendar/calendar_helper'
module EventCalendar
module Rails
class Engine < ::Rails::Engine
initializer 'event_calendar.setup_view_helpers' do |app|
app.config.to_prepare do
# after migrating to 3.2 a line below works
# ActionController::Base.send(:helper, ::EventC... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.