conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Use RangeSentenceParser.invalid? instead of instance method\n" }, { "from": "human", "value": "class RangeSentenceValidator < ActiveModel::EachValidator\n # Validates whether the value of the specified attribute is of the correct form for RangeSentenceParser.\n #\...
ruby
chosen
[ { "from": "system", "value": "Make validations based on authentication keys.\n" }, { "from": "human", "value": "module Devise\n module Models\n\n # Validatable creates all needed validations for a user email and password.\n # It's optional, given you may want to create the validations by ...
ruby
chosen
[ { "from": "system", "value": "Add more data corrections for bad Siebel data" }, { "from": "human", "value": "module SiebelDonations\n class Address < Base\n\n attr_reader :id, :primary, :seasonal, :address1, :address2, :address3, :address4, :city,\n :state, :zip\n\n\n def t...
ruby
chosen
[ { "from": "system", "value": "Add slice/except to parameters class\n" }, { "from": "human", "value": "module SmartApi\n class ParamsHandler\n Converters = {\n integer: ->(v) { Integer(v, 10) },\n string: ->(v) { String(v) },\n float: ->(v) { Float(v) },\n date: ->(v...
ruby
chosen
[ { "from": "system", "value": "Add a test_configuration, temp_site_path and test_interview method, switch to JSON.parse.\n" }, { "from": "human", "value": "require 'simplecov'\nSimpleCov.start\n\nrequire 'minitest/autorun'\nrequire 'usesthis'\nrequire 'json'\n\ndef test_site\n @site ||= UsesThis...
ruby
chosen
[ { "from": "system", "value": "Remove rubygems require. Ohm supports Ruby >=1.9.\n" }, { "from": "human", "value": "# encoding: UTF-8\n\n$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + \"/../lib\"))\n\nbegin\n require \"ruby-debug\"\nrescue LoadError\nend\n\nrequire \"rubygems\"\nre...
ruby
chosen
[ { "from": "system", "value": "Remove automatic progress so 'turn' command line util will work\n" }, { "from": "human", "value": "require 'rubygems'\nrequire 'bundler'\nbegin\n Bundler.setup(:default, :development)\nrescue Bundler::BundlerError => e\n $stderr.puts e.message\n $stderr.puts \"Ru...
ruby
chosen
[ { "from": "system", "value": "Copy mongohq example conf on heroku\n" }, { "from": "human", "value": "require 'fileutils'\n\nnamespace :errbit do\n \n desc \"Copys of example config files\"\n task :copy_configs do\n configs = {\n 'config.example.yml' => 'config.yml',\n 'deploy.ex...
ruby
chosen
[ { "from": "system", "value": "Add a bit of explanation to FavorSprintf\n" }, { "from": "human", "value": "# encoding: utf-8\n\nmodule Rubocop\n module Cop\n class FavorSprintf < Cop\n ERROR_MESSAGE = 'Favor sprintf over String#%.'\n\n def inspect(file, source, tokens, sexp)\n ...
ruby
chosen
[ { "from": "system", "value": "Fix the same issue rack-throttle had\n" }, { "from": "human", "value": "module Tassadar\n module Server\n class Whitelist\n def initialize(app, addresses)\n @app = app\n @whitelist = addresses\n end\n\n def call(env)\n if whit...
ruby
chosen
[ { "from": "system", "value": "Fix case path = nil\n" }, { "from": "human", "value": "module YahooQuote\n class Configuration\n\n def self.cache_dir=(path)\n dir = path.to_s\n Dir.mkdir(dir) unless dir.empty? || File.directory?(dir)\n @@cache_dir = dir\n end\n\n def self....
ruby
chosen
[ { "from": "system", "value": "Remove an unnecessary dev dependency to pacify dependabot\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'parallel_rspec/version'\n\nGem::Specification....
ruby
chosen
[ { "from": "system", "value": "Reduce memory allocation by about 40%\n\nhttps://gist.github.com/yuki24/5025a7b8603c25dcdd89/d3c11b614c06aa0fc1193f252960ecfb8a0c368a\n" }, { "from": "human", "value": "class NameError\n attr_reader :frame_binding\n\n IGNORED_CALLERS = [\n /( |`)missing_name'/,...
ruby
chosen
[ { "from": "system", "value": "Revert \"Fix error in PerItem calculator\"\n\nThis reverts commit 5f270b7ad263859c2da75f72ff0405e4ab1e770b.\n" }, { "from": "human", "value": "class Calculator::PerItem < Calculator\n preference :amount, :decimal, :default => 0\n\n def self.description\n I18n.t...
ruby
chosen
[ { "from": "system", "value": "Update jemoji and jekyll-mentions dependencies to allow for Jekyll 1.5.0\n" }, { "from": "human", "value": "class GitHubPages\n VERSION = 16\n\n # Jekyll and related dependency versions as used by GitHub Pages.\n # For more information see:\n # https://help.gith...
ruby
chosen
[ { "from": "system", "value": "Document the type for the URL class' only attribute" }, { "from": "human", "value": "# A bit of a hack to support using an NSURL in MacRuby while still supporting\n# MRI by using the URI module.\n#\n# I suggest not thinking about it too much beyond this point: this ...
ruby
chosen
[ { "from": "system", "value": "Make custom_class optional in render_asset helper\n" }, { "from": "human", "value": "module AssetsHelper\n\n def render_asset(asset,custom_class)\n case(asset.mime.split('/').first)\n when 'image'\n content_tag(:img, nil, src: asset.url, alt: asset.alt, ...
ruby
chosen
[ { "from": "system", "value": "Verify the value based on which uniquing type is available\n" }, { "from": "human", "value": "module RSpec\n module Sidekiq\n module Matchers\n def be_unique\n BeUnique.new\n end\n\n class BeUnique\n def description\n 'be un...
ruby
chosen
[ { "from": "system", "value": "Update SalesforceError to parse XML response for CSV requests (plain XML format is used over SOAP in those cases).\n" }, { "from": "human", "value": "module SalesforceBulk\n # An exception raised when any non successful request is made through the Salesforce Bulk A...
ruby
chosen
[ { "from": "system", "value": "Fix failing specs due to missing secure random require\n" }, { "from": "human", "value": "module SnowplowRubyDuid\n # Generates a pseudo-unique ID to fingerprint the user\n # Deviates from this Snowplow Javascript: https://github.com/snowplow/snowplow-javascript-t...
ruby
chosen
[ { "from": "system", "value": "Adjust rspec model template to comment out boilerplate\n" }, { "from": "human", "value": "require 'rails_helper'\n\n<% module_namespacing do -%>\nRSpec.describe <%= class_name %>, :type => :model do\n subject { described_class }\n\n context 'initialized' do\n s...
ruby
chosen
[ { "from": "system", "value": "Fix determination of rating value\n" }, { "from": "human", "value": "class ConditionType < ActiveRecord::Base\n\n # Enable auditing of this model type\n has_paper_trail\n \n #attr_accessible :name, :description, :active, :rating\n \n # default scope\n d...
ruby
chosen
[ { "from": "system", "value": "Add from parameter on inbox messages\n" }, { "from": "human", "value": "require 'grape'\n\nrequire './models'\nrequire './entities'\n\nmodule Mailbooth\n class API < Grape::API\n format :json\n prefix :api\n\n resource :inboxes do\n desc 'Return all i...
ruby
chosen
[ { "from": "human", "value": "Add example minitest with rspec syntax\n" }, { "from": "gpt", "value": "require 'minitest/autorun'\n\nclass FakeCalculator\n def add(x, y)\n x + y\n end\n\n def mal(x, y)\n x * y\n end\nend\n\ndescribe FakeCalculator do\n before do\n @calc = FakeCalcula...
ruby
chosen
[ { "from": "system", "value": "Allow Roots to mount itself\n" }, { "from": "human", "value": "module Roots\n class Engine < ::Rails::Engine\n isolate_namespace Roots\n end\nend\n" }, { "from": "gpt", "value": "module Roots\n class Engine < ::Rails::Engine\n isolate_namespac...
ruby
chosen
[ { "from": "system", "value": "Simplify calling of prepare blocks.\n" }, { "from": "human", "value": "class Specter\n class Spec\n def description\n @_description\n end\n\n def block\n @_block\n end\n\n def scopes\n Specter.now.scopes\n end\n\n def prepares\n ...
ruby
chosen
[ { "from": "system", "value": "Raise minimum Ruby version to 1.8.7.\n\nminitest v5 is not compatible with Ruby 1.8.6.\n" }, { "from": "human", "value": "Gem::Specification.new do |s|\n s.name = 'tzinfo'\n s.version = '1.1.0' \n s.summary = 'Daylight savings aware timezone library'\n s.descri...
ruby
chosen
[ { "from": "system", "value": "Include wrap paramters for User controller\n" }, { "from": "human", "value": "# Be sure to restart your server when you modify this file.\n#\n# This file contains settings for ActionController::ParamsWrapper\n\n# Enable parameter wrapping for JSON.\n# ActiveSupport....
ruby
chosen
[ { "from": "system", "value": "Add https support for youtube and ustream" }, { "from": "human", "value": "\nmodule Jekyll\n class VideoEmbed < Liquid::Tag\n\n Syntax = /^\\s*([^\\s]+)(\\s+(\\d+)\\s+(\\d+)\\s*)?/\n\n Hosts = {\n \"ted\" => ->(id) { \"https://embed-ssl.ted.com/talks...
ruby
chosen
[ { "from": "system", "value": "Use released gir_ffi gem version\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n\nGem::Specification.new do |s|\n s.name = 'wait_up'\n s.version = '0.0.1'\n\n s.summary = 'Play sound files slowly so you can follow along'\n\n s.authors = ['Matijs v...
ruby
chosen
[ { "from": "system", "value": "Use most recent sdk by default\n" }, { "from": "human", "value": "require 'open3'\n\nmodule Bwoken\n class Build\n\n def scheme\n Bwoken.app_name\n end\n\n def configuration\n 'Debug'\n end\n\n def sdk\n 'iphonesimulator5.1'\n end\n...
ruby
chosen
[ { "from": "system", "value": "Switch to DateTime instead of Time\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nmodule Dimples\n # A class that models a single site post.\n class Post < Page\n attr_accessor :slug\n attr_accessor :summary\n attr_accessor :categorie...
ruby
chosen
[ { "from": "system", "value": "Add in ActionController::Live in class_eval\n" }, { "from": "human", "value": "module Ansible\n module Transmit\n def self.extended(base)\n base.class_eval do\n def self._beacons\n @_beacons ||= []\n end\n\n before_filter :aler...
ruby
chosen
[ { "from": "system", "value": "Add constraints for Hash type\n" }, { "from": "human", "value": "# encoding: utf-8\n\nmodule Axiom\n module Types\n\n # Represents a decimal type\n class Hash < Numeric\n primitive ::Hash\n coercion_method :to_hash\n accept_options :key_...
ruby
chosen
[ { "from": "system", "value": "Make the ApiError message optional\n\nFixes #9\n" }, { "from": "human", "value": "module Flickr\n\n class Error < StandardError\n end\n\n ##\n # This error is raised when there is an OAuth error (for example when the\n # access token is missing on requests whic...
ruby
chosen
[ { "from": "system", "value": "Remove reference to object cachign\n" }, { "from": "human", "value": "require \"contentful_rails/engine\"\nrequire \"contentful_rails/development_constraint\"\nrequire 'contentful_rails/caching/objects'\nrequire 'contentful_rails/caching/timestamps'\nrequire \"conte...
ruby
chosen
[ { "from": "system", "value": "Remove all instances of :replace_gem, they're no longer needed\n" }, { "from": "human", "value": "module Gemrat\n class Arguments\n class UnableToParse < StandardError; end\n\n ATTRIBUTES = [:gems, :gemfile, :replace_gem]\n\n ATTRIBUTES.each { |arg| attr_a...
ruby
chosen
[ { "from": "system", "value": "Use read_multi for the fetching stage\n" }, { "from": "human", "value": "module Knuckles\n module Fetcher\n extend self\n\n def name\n \"fetcher\".freeze\n end\n\n def call(objects, options)\n view = options.fetch(:view)\n\n objects.each ...
ruby
chosen
[ { "from": "system", "value": "Clean up ObjectMixin, update docs, don't print, define respond_to?.\n" }, { "from": "human", "value": "module Looksee\n module ObjectMixin\n #\n # Shortcut for Looksee[self, *args].\n #\n def method_missing(name, *args)\n case name.to_s\n when...
ruby
chosen
[ { "from": "system", "value": "Return response body for PUT and DELETE requests.\n" }, { "from": "human", "value": "require 'faraday_middleware'\n\nmodule PewPew\n module Resource\n include Relax::Resource\n\n class ResponseDecorator < Faraday::Response::Middleware\n def on_complete(e...
ruby
chosen
[ { "from": "system", "value": "Add attr_reader for args in Command.\n\nDetails:\n* We have the reader for the set request, but we also want it for\n the remaining args.\n" }, { "from": "human", "value": "require 'serf/util/with_options_extraction'\n\nmodule Serf\n\n ##\n # A base class for Ser...
ruby
chosen
[ { "from": "system", "value": "Remove redundant checks; add data point reference to processing errors\n" }, { "from": "human", "value": "namespace :feeder do\n desc 'Pull one specific feed: \"rake feeder:pull[feed_name]\"'\n task pull: :environment do |_task, args|\n # TODO: Move to a servic...
ruby
chosen
[ { "from": "system", "value": "Switch gem website to github repo.\n" }, { "from": "human", "value": "lib = File.expand_path('../lib/', __FILE__)\n$:.unshift lib unless $:.include?(lib)\n\nrequire 'librato/metrics/version'\n\nGem::Specification.new do |s|\n s.specification_version = 2 if s.respon...
ruby
chosen
[ { "from": "human", "value": "Add a script to remove all ruby gems.\n" }, { "from": "gpt", "value": "#!/usr/bin/env ruby\n`gem list --no-versions`.split(\"\\n\").each do |gem|\n `gem list -d #{gem}`.gsub(/Installed at(.*):.*/).each do |dir|\n dir = dir.gsub(/Installed at(.*): /,'').gsub(\"\\n...
ruby
chosen
[ { "from": "system", "value": "Add additional edit view test not required in specification\n\n" }, { "from": "human", "value": "require 'rails_helper'\n\nRSpec.describe \"events/edit\", type: :view do\n before(:each) do\n @event = assign(:event, FactoryGirl.create(:event))\n end\n\n it \"re...
ruby
chosen
[ { "from": "system", "value": "Tower1: Add name and update license stanza" }, { "from": "human", "value": "cask :v1 => 'tower1' do\n version :latest\n sha256 :no_check\n\n url 'http://www.git-tower.com/download-v1'\n appcast 'https://macapps.fournova.com/tower1-1060/updates.xml',\n :...
ruby
chosen
[ { "from": "system", "value": "Install `rails` on executing `rbenv install`\n" }, { "from": "human", "value": "include_cookbook 'anyenv'\n\nexecute 'install rbenv' do\n command <<-\"EOF\"\n #{node[:proxy_config]}\n export PATH=#{node[:home]}/.anyenv/bin:$PATH\n eval \"$(anyenv init -)\"...
ruby
chosen
[ { "from": "system", "value": "Resolve the new FC118 foodcritic warning\n\nSigned-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>\n" }, { "from": "human", "value": "provides :slack_notify\n\nproperty :message, String, name_attribute: true\nproperty :channels, Array, default: ...
ruby
chosen
[ { "from": "system", "value": "Put a maximum of 7 calendars\n" }, { "from": "human", "value": "module ClockIndicator\n class CalendarWindow\n def initialize\n add_calendars\n end\n\n delegate :show_all, :destroy, :to => :window\n\n private\n\n CAL_WIDTH = 350\n\n def c...
ruby
chosen
[ { "from": "system", "value": "Update comment (WITH NEW KNOWLEDGE)\n" }, { "from": "human", "value": "module Opsicle\n class SSHCleanKeys\n attr_reader :client\n\n def initialize(environment)\n @client = Client.new(environment)\n end\n\n def execute(options={})\n instances....
ruby
chosen
[ { "from": "system", "value": "Fix DEPRECATION: Use new keyword style for POST in Integration Test\n" }, { "from": "human", "value": "require 'test_helper'\ninclude Scrivito::ControllerHelper\n\nclass UsersLoginTest < ActionDispatch::IntegrationTest\n def setup\n login = LoginPage.instance\n ...
ruby
chosen
[ { "from": "system", "value": "Install single files to prefix\n\nIt's a single .app file, our convention here is typically to just put it at the formula's prefix root.\n" }, { "from": "human", "value": "require 'formula'\n\nclass Exult <Formula\n # Use a specific revision that is known to compil...
ruby
chosen
[ { "from": "system", "value": "Fix handling of missing db / subdomain\n" }, { "from": "human", "value": "module Apartment\n module Elevators\n # Provides a rack based db switching solution based on subdomains\n # Assumes that database name should match subdomain\n class Subdomain\n\n ...
ruby
chosen
[ { "from": "system", "value": "Update pod spec for source files\n" }, { "from": "human", "value": "Pod::Spec.new do |s|\n s.name \t= \"MOAspects\"\n s.version \t= \"2.0.0\"\n s.summary \t= \"AOP Library.\"\n s.homepage \t= \"https://github.com/MO-AI/MOAspects\"\n s.lice...
ruby
chosen
[ { "from": "system", "value": "Refactor not to use should receive and check option value\n" }, { "from": "human", "value": "require \"spec_helper\"\n\nmodule Guideline\n describe CheckerFactory do\n describe \"#create\" do\n subject do\n described_class.new(\n {\n ...
ruby
chosen
[ { "from": "system", "value": "Use multi-lined do and end in ReviewSettingsController\n" }, { "from": "human", "value": "class Spree::Admin::ReviewSettingsController < Spree::Admin::BaseController\n def update\n # workaround for unset checkbox behaviour\n params[:preferences][:include_unap...
ruby
chosen
[ { "from": "system", "value": "Update bash-it sha to latest\n\nIncludes\n\n* chruby(-auto) plugin rename [306f7b1587](https://github.com/revans/bash-it/commit/306f7b1587486cd4ed20726f64ecc2bf96334d47)\n* system-ruby display in prompt [5ef3f817fe](https://github.com/revans/bash-it/commit/5ef3f817fef1aff10f348...
ruby
chosen
[ { "from": "system", "value": "Test Suite: enables the usage of context like describe\n" }, { "from": "human", "value": "require 'rubygems'\nrequire 'bundler/setup'\n\nif ENV['COVERAGE'] == 'true'\n require 'simplecov'\n require 'coveralls'\n\n SimpleCov.formatter = SimpleCov::Formatter::Multi...
ruby
chosen
[ { "from": "system", "value": "Revert \"Enforced simple_oauth ~> 0.2.0 as a dependency\"\n\nThis reverts commit 0f9a4b160540edf2397631ce956067f035cfe4b2.\n" }, { "from": "human", "value": "# encoding: utf-8\nrequire File.join(File.dirname(__FILE__), 'lib/tumblr/version')\n\nGem::Specification.new...
ruby
chosen
[ { "from": "system", "value": "Add an integration test for snapshots\n" }, { "from": "human", "value": "require \"helpers/integration_test_helper\"\nrequire \"integration/factories/disks_factory\"\n\nclass TestDisks < FogIntegrationTest\n include TestCollection\n\n def setup\n @subject = Fog...
ruby
chosen
[ { "from": "system", "value": "Add git submodule init to prepare_command.\n" }, { "from": "human", "value": "Pod::Spec.new do |s|\n s.name = \"TorchORM\"\n s.version = \"0.1.3\"\n s.summary = \"Torch - Boilerplate-free CoreData bridge.\"\n s.description = <<...
ruby
chosen
[ { "from": "system", "value": "Handle minor and patch version correctly as they may be multiple digits\n" }, { "from": "human", "value": "require 'test_helper'\n\ndescribe \"Redis::RedisVersion\" do\n def setup\n @store = Redis::Store.new\n end\n\n def teardown\n @store.quit\n end\n\n ...
ruby
chosen
[ { "from": "system", "value": "Upgrade rake to version 12.3.0" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'controller_validator/version'\n\nGem::Specification.new do |spec|\n spec.n...
ruby
chosen
[ { "from": "system", "value": "Fix for when nobody reacts\n" }, { "from": "human", "value": "class SlackEventFormatter\n attr_reader :event, :reactions\n\n def initialize(event, reactions)\n @event = event\n @reactions = reactions\n end\n\n def format\n if reactions\n \"#{base}\...
ruby
chosen
[ { "from": "system", "value": "Add options to get the categories\n" }, { "from": "human", "value": "# @see https://developers.podio.com/doc/app-store\nclass Podio::AppStoreCategory < ActivePodio::Base\n property :category_id, :integer\n property :name, :string\n property :type, :string\n\n al...
ruby
chosen
[ { "from": "system", "value": "Clarify explanation of how to set up fog mock mode\n\nWe are adding the test data to [our shared setup](https://github.gds/gds/vcloud-tools-testing-config/blob/master/vcloud_tools_testing_config.yaml) so this detail is for external users.\n" }, { "from": "human", "v...
ruby
chosen
[ { "from": "system", "value": "Allow net connect to codeclimate\n" }, { "from": "human", "value": "require \"simplecov\"\nSimpleCov.start\n\nif ENV[\"CI\"]\n require \"codeclimate-test-reporter\"\n CodeClimate::TestReporter.start\nend\n\nrequire \"syoboi_calendar\"\nrequire \"webmock/rspec\"\n\...
ruby
chosen
[ { "from": "system", "value": "Include element helpers in spec helper.\n" }, { "from": "human", "value": "require 'table_cloth'\nrequire 'awesome_print'\nrequire 'nokogiri'\nrequire 'factory_girl'\nrequire 'pry'\nrequire 'simplecov'\n\nif ENV[\"COVERAGE\"] == \"true\"\n SimpleCov.start do\n a...
ruby
chosen
[ { "from": "system", "value": "Allow focus: true to work\n" }, { "from": "human", "value": "require \"bundler/setup\"\nrequire \"symbolic_math\"\nrequire \"pry\"\n\nRSpec.configure do |config|\n # Enable flags like --only-failures and --next-failure\n config.example_status_persistence_file_path...
ruby
chosen
[ { "from": "system", "value": "Fix RSpec 3.4 deprecation warning\n\n> Deprecation Warnings:\n>\n> RSpec::Core::Configuration#treat_symbols_as_metadata_keys_with_true_values =\n> is deprecated, it is now set to true as default and setting it to false has\n> no effect.\n" }, { "from": "human", "val...
ruby
chosen
[ { "from": "system", "value": "Send coverage to CodeClimate. Maybe?\n" }, { "from": "human", "value": "if ENV[\"CODECLIMATE_REPO_TOKEN\"]\n require \"simplecov\"\n SimpleCov.start\nend\n\nrequire File.expand_path('../lib/dumb_delegator', File.dirname(__FILE__))\n\nRSpec.configure do |config|\n ...
ruby
chosen
[ { "from": "system", "value": "Test Event Stream Format compliance\n" }, { "from": "human", "value": "require_relative \"./spec_helper\"\n\ndescribe \"/stream\" do\n let(:exchange_name) { \"samples\" }\n let(:em) { mock_EventMachine }\n let(:stream) { mock_stream }\n\n before { mock_amqp }\n\...
ruby
chosen
[ { "from": "system", "value": "Change to only load necessary files\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'tty/command/version'\n\nGem::Specification.new do |spec|\n spec.nam...
ruby
chosen
[ { "from": "system", "value": "Update gemspec to point to new repository location\n" }, { "from": "human", "value": "lib = File.expand_path('../lib/', __FILE__)\n$:.unshift lib unless $:.include?(lib)\n\nrequire 'voight_kampff/version'\n\nspec = Gem::Specification.new do |s|\n s.name = 'voight_k...
ruby
chosen
[ { "from": "human", "value": "Add code wars (7) - complete the pattern 3\n" }, { "from": "gpt", "value": "# http://www.codewars.com/kata/557341907fbf439911000022\n# --- iteration 1 ---\ndef pattern(n)\n return \"\" unless n > 0\n nums = n.downto(1)\n (1.upto(n)).reduce([]){ |acc, i| acc << num...
ruby
chosen
[ { "from": "system", "value": "Clean up customer management spec\n" }, { "from": "human", "value": "# -*- encoding : utf-8 -*-\nrequire 'spec_helper'\n\n# Author:: jlopezn@neonline.cl\ndescribe BingAdsApi::CustomerManagement do\n\n\tbefore :all do\n\t\t@config = BingAdsApi::Config.instance\n\t\t@...
ruby
chosen
[ { "from": "human", "value": "Add test for finding issue by key or id\n" }, { "from": "gpt", "value": "require 'spec_helper'\n\ndescribe Jira::Resource::Issue do\n\n let(:client) { mock() }\n\n it \"should find an issue by key or id\" do\n response = mock()\n response.stub(:body).and_retu...
ruby
chosen
[ { "from": "system", "value": "Fix spec for routes to the GraphqlController\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe 'api', 'routing' do\n context 'when graphql is disabled' do\n before do\n stub_feature_flags(graphql: false)\n end\n\n it 'does not route...
ruby
chosen
[ { "from": "human", "value": "Add dom_id and dom_class selector helpers for constraining to areas of a page.\n" }, { "from": "gpt", "value": "def dom_id_selector(model)\n \"#\" + ActionController::RecordIdentifier.dom_id(model)\nend\n\ndef dom_class_selector(model)\n \".\" + ActionController::R...
ruby
chosen
[ { "from": "system", "value": "Update tests to use search endpoint\n" }, { "from": "human", "value": "require 'test_helper'\n\nclass CustomerSavedSearchTest < Test::Unit::TestCase\n def setup\n super\n load_customer_saved_search\n end\n\n def test_get_customers_from_customer_saved_search...
ruby
chosen
[ { "from": "system", "value": "Fix setting hostname on none cloud-init based providers\n" }, { "from": "human", "value": "Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|\n config.vm.provision \"shell\", inline: \"/root/change_hostname.sh #{HOSTNAME}\"\n config.vm.provision \"shell\", inl...
ruby
chosen
[ { "from": "human", "value": "Add functional spec for new apps.\n" }, { "from": "gpt", "value": "require 'functional_spec_helper'\n\ndescribe 'New app loading' do\n TIMEOUT = 10\n\n let(:app) { create_app }\n let(:notification) { create_notification }\n let(:tcp_socket) { double(TCPSocket, se...
ruby
chosen
[ { "from": "system", "value": "Reduce coverage to travis level\n" }, { "from": "human", "value": "MINIMUM_COVERAGE = 76.3\n\nunless ENV['COVERAGE'] == 'off'\n require 'simplecov'\n require 'simplecov-rcov'\n require 'coveralls'\n Coveralls.wear!\n\n SimpleCov.formatters = [\n SimpleCov::F...
ruby
chosen
[ { "from": "system", "value": "Add spec to document existing money behaviour\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe DataTable::DataTable do\n let(:row) { ['col1', 2] }\n\n before do\n subject << { body: [row] }\n end\n\n it 'should generate csv' do\n expect...
ruby
chosen
[ { "from": "system", "value": "Update must not fail silently\n" }, { "from": "human", "value": "class SessionsController < ApplicationController\n def callback\n user = User.omniauth(env['omniauth.auth'])\n user.update metadata: Mumukit::Auth::Token.from_env(env).metadata\n\n remember_m...
ruby
chosen
[ { "from": "system", "value": "Add check to make sure logins aren't empty\n" }, { "from": "human", "value": "class FetchDevelopersJob < ActiveJob::Base\n queue_as :urgent\n\n rescue_from ActiveRecord::RecordNotFound, &:message\n\n def perform(cache_key)\n logins = Rails.cache.read(cache_key...
ruby
chosen
[ { "from": "system", "value": "Add method find_by_slug_or_id to Sluggable module\n\nMake it easier to find by slug or id for sluggable models. Will return\nnil if resource is not found.\n" }, { "from": "human", "value": "module Sluggable\n extend ActiveSupport::Concern\n\n included do\n befo...
ruby
chosen
[ { "from": "system", "value": "Add spec for GET /cache\n" }, { "from": "human", "value": "require 'spec_helper'\nrequire 'travis/caching/app'\n\ndescribe Travis::Caching::App, :include_sinatra_helpers do\n\n before(:each) do\n set_app described_class.new\n ENV['TRAVIS_JWT_SECRET'] = 'super...
ruby
chosen
[ { "from": "system", "value": "Update author to prevent bundler warning" }, { "from": "human", "value": "# encoding: UTF-8\nGem::Specification.new do |s|\n s.platform = Gem::Platform::RUBY\n s.name = 'spree_robokassa'\n s.version = '2.2.1'\n s.summary = 'TODO: Add gem summar...
ruby
chosen
[ { "from": "system", "value": "Add formula check for crufy SourceForge URLs.\n" }, { "from": "human", "value": "#!/usr/bin/ruby\n# This software is in the public domain, furnished \"as is\", without technical\n# support, and with no warranty, express or implied, as to its usefulness for\n# any pu...
ruby
chosen
[ { "from": "human", "value": "Add codility training 8-2 equileader\n" }, { "from": "gpt", "value": "# 100/100\ndef solution(arr)\n # find the leader for the overall array\n stack = []\n arr.each do |el|\n stack.unshift(el)\n if stack.size > 1 && stack[0] != stack[1]\n stack.shift(2)...
ruby
chosen
[ { "from": "system", "value": "Add rdoc to gem dependencies for the sake of Ruby 1.9.2\n\nWithout this, attempting to run rake in 1.9.2 will raise a confusing\nerror message about changing 'rake/rdoctask' to 'rdoc/task' in Rakefile,\neven though this is already done in the Rakefile.\n" }, { "from": "...
ruby
chosen
[ { "from": "system", "value": "Edit session controller so that feature tests pass\n" }, { "from": "human", "value": "class SessionController < ApplicationController\n def new\n end\n\n def create\n email = params[:email]\n password = params[:password]\n @user = User.find_by email: em...
ruby
chosen
[ { "from": "system", "value": "Return stats when rendering a visualization to JSON\n" }, { "from": "human", "value": "# encoding: utf-8\n\nmodule CartoDB\n module Visualization\n class Presenter\n def initialize(visualization)\n @visualization = visualization\n end #initializ...
ruby
chosen
[ { "from": "system", "value": "Use html5 format for haml.\n" }, { "from": "human", "value": "require \"sinatra/base\"\nrequire \"sinatra/reloader\"\nrequire \"twitter\"\nrequire \"haml\"\nrequire \"sass\"\n\nclass Star < Sinatra::Base\n\n configure do\n @@config = YAML.load_file('config.yml')...
ruby
chosen
[ { "from": "system", "value": "Add screenshot helper for cucumber @javascript scenarios\n\nCall `screenshot` within a Cucumber step and Poltergeist (the capybara\ndriver) will create a tmp/capybara.png file containing a screenshot of\nthe current page. Pass an argument to give the screenshot a different\nnam...
ruby
chosen
[ { "from": "system", "value": "Add missing license entry in gemspec\n\nDisplay license information on rubygems.org when release new version." }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n$:.push File.expand_path(\"../lib\", __FILE__)\n\nGem::Specification.new do |s|\n s.name ...
ruby
chosen
[ { "from": "human", "value": "Add test to check component guide loads correctly\n" }, { "from": "gpt", "value": "require \"rails_helper\"\n\nRSpec.feature \"Visit Component Guide\" do\n scenario \"User views the component guide page\" do\n when_i_visit_the_component_guide_index_page\n then...
ruby
chosen
[ { "from": "human", "value": "Add spec tests for request\n" }, { "from": "gpt", "value": "require 'spec_helper'\n\ndescribe AngellistApi::Request do\n class DummyRequest; include AngellistApi::Request; end\n \n before(:each) do\n @dummy = DummyRequest.new\n @sample_path = \"/index\"\n ...
ruby
chosen
[ { "from": "system", "value": "Make the libdatrie compile command use a relative path.\n" }, { "from": "human", "value": "system('cd ext/libdatrie && ./configure && make')\n\nrequire 'mkmf'\ndir_config 'trie'\n\nunless find_library('datrie',nil,'ext/libdatrie')\n puts 'Need libdatrie.'\n exit\n...
ruby
chosen