conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Add logging for Slack's account_inactive errors\n" }, { "from": "human", "value": "class UpdateHackbotSlackUsernameJob < ApplicationJob\n queue_as :default\n\n def perform(*)\n Hackbot::Team.find_each do |team|\n info = ::SlackClient::Users.info(team.bot_u...
ruby
chosen
[ { "from": "system", "value": "Fix devise for method for new version\n" }, { "from": "human", "value": "class Users::RegistrationsController < ActiveAdmin::Devise::RegistrationsController\n layout 'application'\n\n before_action :permit_params\n\n def permit_params\n devise_parameter_saniti...
ruby
chosen
[ { "from": "system", "value": "Add missing test for /healthcheck/overdue endpoint\n" }, { "from": "human", "value": "require \"test_helper\"\n\nclass HealthcheckTest < ActionDispatch::IntegrationTest\n include SidekiqTestHelpers\n\n def json_response\n JSON.parse(response.body)\n end\n\n t...
ruby
chosen
[ { "from": "system", "value": "Replace rubocop with reevoocop to fix rubocop vulnerability\n\n- vulnerability: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8418\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unles...
ruby
chosen
[ { "from": "system", "value": "Fix should_receive call in AuthorizationHelpers\n" }, { "from": "human", "value": "module AuthorizationHelpers\n module Controller\n def stub_authorization!\n let(:ability_user) { stub_model(Spree::LegacyUser) }\n\n before do\n controller.stub(:...
ruby
chosen
[ { "from": "human", "value": "Check if a tree is bst - nonstupid way\n" }, { "from": "gpt", "value": "# check if a tree is a BST\n\nclass Node < Struct.new(:value, :left, :right)\n def inorder\n do_inorder(self)\n end\n\n def do_inorder(root)\n unless root.nil?\n ...
ruby
chosen
[ { "from": "system", "value": "Exit with error if CHECK_DIRECTORY is empty\n" }, { "from": "human", "value": "#!/usr/bin/env ruby\n\n# Checks a specific directory for the presence of a file with a created_at timestamp newer than CHECK_LIMIT\nclass NewFileChecker\n # The directory to be checked f...
ruby
chosen
[ { "from": "system", "value": "Use :text for the last_error field\n" }, { "from": "human", "value": "class CreateDelayedJobs < ActiveRecord::Migration\n def self.up\n create_table :delayed_jobs, :force => true do |table|\n table.integer :priority, :default => 0 # Allows some jobs t...
ruby
chosen
[ { "from": "system", "value": "Add link to docs to rate limit response\n" }, { "from": "human", "value": "class Rack::Attack\n\n ### Configure Cache ###\n # Throttle all requests by IP (60rpm)\n #\n # Key: \"rack::attack:#{Time.now.to_i/:period}:req/ip:#{req.ip}\"\n throttle('req/ip', limit:...
ruby
chosen
[ { "from": "system", "value": "Add verbose solution as well\n" }, { "from": "human", "value": "# Smallest Integer\n\n# I worked on this challenge [by myself, with: ].\n\n# smallest_integer is a method that takes an array of integers as its input\n# and returns the smallest integer in the array\n#...
ruby
chosen
[ { "from": "system", "value": "Add user scope to pie pieces\n" }, { "from": "human", "value": "class PiePiece < ActiveRecord::Base\n belongs_to :pie\nend\n" }, { "from": "gpt", "value": "class PiePiece < ActiveRecord::Base\n belongs_to :pie\n has_one :users, through: :pie\n scope ...
ruby
chosen
[ { "from": "human", "value": "Create a separate decorator for storage providers\n" }, { "from": "gpt", "value": "class ManageIQ::Providers::StorageManagerDecorator < MiqDecorator\n def self.fonticon\n 'pficon pficon-server'\n end\n\n def fonticon\n nil\n end\n\n def fileicon\n \"svg...
ruby
chosen
[ { "from": "system", "value": "Duplicate default_value field for close_default.\n" }, { "from": "human", "value": "class AddCustomFieldCloseDefaults < ActiveRecord::Migration\n def self.up\n add_column :custom_fields, :close_default, :string, {:null => \"\", :default => \"\"}\n end\n\n def ...
ruby
chosen
[ { "from": "system", "value": "Remove enables docker minitest from default tests\n" }, { "from": "human", "value": "require File.expand_path('../support/helpers', __FILE__)\n\ndescribe_recipe \"docker::default\" do\n include Helpers::Docker\n\n it 'starts docker' do\n service(\"docker\").mus...
ruby
chosen
[ { "from": "system", "value": "Fix error when used in namespaces other than admin" }, { "from": "human", "value": "module ActiveAdmin\n module Reorderable\n module TableMethods\n\n def reorder_column\n column '', :class => 'reorder-handle-col' do |resource|\n reorder_hand...
ruby
chosen
[ { "from": "system", "value": "CoursesBuilder: Access url_builder via attribute instead of variable\n" }, { "from": "human", "value": "module KOSapiClient\n module Resource\n class CoursesBuilder < RequestBuilder\n\n def detail(level = 1)\n @url_builder.set_query_param(:detail, le...
ruby
chosen
[ { "from": "system", "value": "Make the user available in TypingEvent\n" }, { "from": "human", "value": "require 'discordrb/events/generic'\n\nmodule Discordrb::Events\n class TypingEvent\n attr_reader :channel, :timestamp\n\n def initialize(data, bot)\n @user_id = data['user_id']\n ...
ruby
chosen
[ { "from": "system", "value": "Fix superficial error in test\n" }, { "from": "human", "value": "require 'helper'\nrequire 'peddler/xml_response_parser'\n\nclass TestPeddlerXMLResponseParser < MiniTest::Test\n def test_parses_responses\n body = '<Response><Result><Foo>Bar</Foo></Result></Respo...
ruby
chosen
[ { "from": "system", "value": "Use the new scope syntax\n" }, { "from": "human", "value": "class Reply < ActiveRecord::Base\n scope :base\n belongs_to :topic, :include => [:replies]\n belongs_to :developer\n\n validates_presence_of :content\nend\n" }, { "from": "gpt", "value": "cl...
ruby
chosen
[ { "from": "system", "value": "Copy the Gemfile.lock file instead of symlinking it\n\n- speeds rspec-rails' own cukes from 2m36s to 30s\n" }, { "from": "human", "value": "require \"aruba\"\nrequire \"rspec/expectations\"\n\nunless File.directory?('./tmp/example_app')\n system \"rake generate:app...
ruby
chosen
[ { "from": "system", "value": "Update to headers-more 0.19 and fix the checksum\n" }, { "from": "human", "value": "#\n# Cookbook Name:: nginx\n# Attributes:: headers_more\n#\n# Author:: Lucas Jandrew (<ljandrew@riotgames.com>)\n#\n# Copyright 2012, Riot Games\n#\n# Licensed under the Apache Licen...
ruby
chosen
[ { "from": "system", "value": "Remove another occurrence of setting a handle instead of proper object\n" }, { "from": "human", "value": "require 'economic/proxies/entity_proxy'\n\nmodule Economic\n class DebtorContactProxy < EntityProxy\n\n # Returns a new, unpersisted Economic::DebtorContact...
ruby
chosen
[ { "from": "system", "value": "Bring the mysql::server attributes into scope\nMinor documentation adjustment\n" }, { "from": "human", "value": "#\n# Cookbook Name:: lamp\n# Attributes:: default\n#\n# Copyright 2013, Mediacurrent\n#\n# All rights reserved - Do Not Redistribute\n\ninclude_attribute...
ruby
chosen
[ { "from": "system", "value": "Use rendering app from content model if available when generating preview links\n" }, { "from": "human", "value": "module Admin::PathsHelper\n def publication_front_end_path(publication)\n raise \"Publication without slug: #{publication.id}\" if publication.slug...
ruby
chosen
[ { "from": "human", "value": "Add missing Cane Google Chart Grapher\n" }, { "from": "gpt", "value": "MetricFu.metrics_require { 'cane/cane_grapher' }\nmodule MetricFu\n class CaneGchartGrapher < CaneGrapher\n def title\n 'Cane: code quality threshold violations'\n end\n def legen...
ruby
chosen
[ { "from": "system", "value": "Use bundle_cmd for Yard module\n" }, { "from": "human", "value": "Capistrano::Configuration.instance(:must_exist).load do\n\n after 'deploy:create_symlink', 'yard:generate'\n\n namespace :yard do\n\n desc \"Update the documentation alone before a release`\"\n ...
ruby
chosen
[ { "from": "system", "value": "Put request must contain body so that content length is specified.\n" }, { "from": "human", "value": "require 'api_entity'\n\nclass Commodity\n include ApiEntity\n\n attr_accessor :short_code, :code, :description, :substring, :hier_pos,\n :synonyms,...
ruby
chosen
[ { "from": "system", "value": "Add dependency: capistrano >= 2.0.\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'banzai-pipeline/version'\n\nGem::Specification.new do |spec|\n spec....
ruby
chosen
[ { "from": "system", "value": "Fix filename in polling response\n" }, { "from": "human", "value": "module Download::Poller\n def self.poll(params)\n json_response(params)\n end\n\n private\n\n def self.json_response(params)\n domain = params['domain']\n filters = get_filters(params)\...
ruby
chosen
[ { "from": "system", "value": "Move factory logic into service\n" }, { "from": "human", "value": "class CreateGameState\n def initialize(game)\n @game = game\n end\n\n def call\n GameState.for(game)\n end\n\n private\n\n attr_reader :game\nend\n" }, { "from": "gpt", "value...
ruby
chosen
[ { "from": "system", "value": "Define user and group methods explicitly in Serverspec::Type::Process\n\nBecause user and group methods are defined already in Serverspec::Helper::Type.\nSo method_missing is not called if these methods are not defined explicitly.\n" }, { "from": "human", "value": "...
ruby
chosen
[ { "from": "human", "value": "Remove new line in migration file\n" }, { "from": "gpt", "value": "class RenameRepoIdInLabHasGroups < ActiveRecord::Migration\n def up\n rename_column :lab_has_groups, :repo_id, :repository_id\n end\n\n def down\n rename_column :lab_has_groups, :repository_i...
ruby
chosen
[ { "from": "system", "value": "Replace letters with unicode symbol in verbose report output\n" }, { "from": "human", "value": "require 'minitest'\n\nusing Corefines::String::color\n\nmodule Asciidoctor\n module DocTest\n class TestReporter < Minitest::SummaryReporter\n\n RESULT_COLOR = ...
ruby
chosen
[ { "from": "system", "value": "Check if the tmp directory exists for sure\n" }, { "from": "human", "value": "require 'fileutils'\n\nrequire_relative 'command_base'\nrequire_relative '../dependencies_table'\nrequire_relative '../stats'\n\nmodule DeltaTest\n class CLI\n class StatsSaveCommand <...
ruby
chosen
[ { "from": "system", "value": "Use custom Erubis handler subclass for Erb filter\n\nThe Rails Erubis handler has added code to reduce the number of method\ncalls when adding newlines (see\nhttps://github.com/rails/rails/commit/bd308a0d02c4a6459c05770a564405986a663f47).\n\nThis uses a new instance variable, w...
ruby
chosen
[ { "from": "system", "value": "Test without the lazy loading.\n" }, { "from": "human", "value": "module PackRat\n module Extensions\n module ActiveRecord\n def included(base)\n base.extend(ClassMethods)\n end\n \n module ClassMethods\n def inherited(child_class)\...
ruby
chosen
[ { "from": "human", "value": "guests/pld: Add tests for network scripts dir\n" }, { "from": "gpt", "value": "require_relative \"../../../../base\"\n\ndescribe \"VagrantPlugins::GuestPld::Cap::NetworkScriptsDir\" do\n let(:caps) do\n VagrantPlugins::GuestPld::Plugin\n .components\n ....
ruby
chosen
[ { "from": "system", "value": "[Podspec] Fix to cached last version\n" }, { "from": "human", "value": "Pod::Spec.new do |s|\n s.name = \"SwiftCarousel\"\n s.version = \"0.7\"\n s.summary = \"Infinite carousel of options.\"\n s.description = \"SwiftCarousel i...
ruby
chosen
[ { "from": "system", "value": "Move code for set-folders for packing VirtualBox to general\n" }, { "from": "human", "value": "require \"fileutils\"\n\nrequire_relative \"../../../../lib/vagrant/action/general/package\"\n\nmodule VagrantPlugins\n module ProviderVirtualBox\n module Action\n ...
ruby
chosen
[ { "from": "system", "value": "Put allow_iframe_from check inside function\n" }, { "from": "human", "value": "module CMS\n class PagesController < RailsAdminCMS::Config.parent_controller\n after_action :allow_iframe, if: RailsAdminCMS::Config.allow_iframe_from\n\n def show\n @cms_view...
ruby
chosen
[ { "from": "system", "value": "Set current user id to mx_table\n" }, { "from": "human", "value": "class MxTablesController < ApplicationController\n include MxProjectFixation\n include MxDatabaseFixation\n unloadable\n\n before_filter :find_table, only: [:show, :edit, :update, :destroy]\n\n ...
ruby
chosen
[ { "from": "system", "value": "Add progress update 'update' route\n" }, { "from": "human", "value": "require \"pry\"\n\nclass ProgressUpdatesController < ApplicationController\n def show\n @update = ProgressUpdate.find(params[:id])\n @comment = Comment.new\n end\n\n def user_index\n @...
ruby
chosen
[ { "from": "human", "value": "Test that we define HABTM fast insert method\n" }, { "from": "gpt", "value": "require 'spec_helper'\n\ndescribe User do\n it { should respond_to(:fast_post_ids_insert) }\n it { should_not respond_to(:fast_friend_ids_insert) }\nend\n\ndescribe Post do\n it { should...
ruby
chosen
[ { "from": "system", "value": "Update React Native documentation (0.14.1)\n" }, { "from": "human", "value": "module Docs\n class ReactNative < React\n self.name = 'React Native'\n self.slug = 'react_native'\n self.type = 'react'\n self.version = '0.12.0'\n self.base_url = 'https:/...
ruby
chosen
[ { "from": "system", "value": "Change gmail connection to using oauth token\n" }, { "from": "human", "value": "class EmailRetrievalService\n def initialize(user)\n @user = user\n @gmail = Gmail.connect!(user.email, user.password)\n end\n\n def retrieve_emails(partner, relationship)\n ...
ruby
chosen
[ { "from": "system", "value": "Test that keys not deleted are still in keys file\n" }, { "from": "human", "value": "require 'tempfile'\nrequire 'spec_helper'\nrequire 'github/auth'\n\ndescribe Github::Auth::KeysFile do\n it 'writes and deletes keys from the keys file' do\n tempfile = Tempfil...
ruby
chosen
[ { "from": "system", "value": "Create AuditLog whenever SMS is sent\n" }, { "from": "human", "value": "namespace :notification do\n desc 'Sends SMS notifications to Employees ask them to log overtime'\n task sms: :environment do\n puts 'My First Rake Task!'\n # Schedule to run every Sunda...
ruby
chosen
[ { "from": "system", "value": "Fix to create in_forward directory.\n" }, { "from": "human", "value": "include_recipe 'fluentd_part::common'\n\ntemplate '/etc/td-agent/config.d/server.conf' do\n owner 'td-agent'\n group 'td-agent'\n source 'server.conf.erb'\n mode 0755\n notifies :restart, 's...
ruby
chosen
[ { "from": "system", "value": "Update orders totals on add to cart.\n\nWhen a gift card was added to the cart, there was a state which could\noccur in Spree 2.2 where the order total was not correct.\n\nCalling order.update_totals ensures that the total is correct.\n" }, { "from": "human", "value...
ruby
chosen
[ { "from": "system", "value": "Use a case statement to determine anchor\n" }, { "from": "human", "value": "class ChildBenefitTaxController < ApplicationController\n \n def landing\n end\n\n def process_form\n anchor = if params[:commit] == \"I don't know my adjusted net income\"\n \"a...
ruby
chosen
[ { "from": "system", "value": "Use oe instead of ø in author name\n" }, { "from": "human", "value": "# Encoding: UTF-8\nrequire 'rake'\nGem::Specification.new do |spec|\n spec.name = 'devise_dk_nemid'\n spec.version = '1.0.7'\n\n spec.authors = [ 'Morten Rønne' ]\n spec.required_ruby_version ...
ruby
chosen
[ { "from": "system", "value": "Remove pubchem_id from evidence item test mock object fabricator\n" }, { "from": "human", "value": "Fabricator(:evidence_item) do\n variant\n evidence_type { EvidenceItem.evidence_types.keys.sample }\n evidence_level{ EvidenceItem.evidence_levels.keys.sample }\n ...
ruby
chosen
[ { "from": "system", "value": "Add more argumnets to dependency resolution helper\n\nThis makes it possible to create editions with a `document_type` and/or\na `details` hash.\n" }, { "from": "human", "value": "module DependencyResolutionHelper\n def create_link_set(content_id = nil, links_hash:...
ruby
chosen
[ { "from": "system", "value": "Make `ConsultationUpdateTest` spec way more accurate\n" }, { "from": "human", "value": "require \"test_helper\"\n\nmodule GobiertoAdmin\n module GobiertoBudgetConsultations\n class ConsultationUpdateTest < ActionDispatch::IntegrationTest\n def setup\n ...
ruby
chosen
[ { "from": "system", "value": "Update Gemspec file to not use `git ls-files`\n\nThe gem is dependent on Git (factory_girl_rails.gemspec uses git ls-files).\nSome prod environments do not have git and if you try adding a gem through\ngit or path option in bundler, 'git ls-files' in the .gemspec fails.\nInstea...
ruby
chosen
[ { "from": "system", "value": "Add functions for the derivative of the sigmoid function.\n" }, { "from": "human", "value": "module NeuralNets\n class Math\n ##\n # The sigmoid function\n def self.sigmoid(x)\n 1.0/(1.0 + Math.exp(-x))\n end\n\n ##\n # NMatrix version of the...
ruby
chosen
[ { "from": "system", "value": "Update to display error message\n" }, { "from": "human", "value": "module ActiveAdminImportable\n module DSL\n\n def active_admin_importable\n action_item :only => :index do\n link_to \"Import #{active_admin_config.resource_name.to_s.pluralize.downca...
ruby
chosen
[ { "from": "system", "value": "Fix compatibility with newer carrierwave that calls the method method\n" }, { "from": "human", "value": "module CarrierWave\n module Storage\n class Cascade < Abstract\n attr_reader :primary_storage, :secondary_storage\n\n def initialize(*args)\n ...
ruby
chosen
[ { "from": "system", "value": "Add rake tasks for the new methods in AssetRemover\n" }, { "from": "human", "value": "namespace :asset_manager do\n desc \"Migrates Assets to Asset Manager.\"\n task :migrate_assets, [:target_dir] => :environment do |_, args|\n abort(usage_string) unless args[:...
ruby
chosen
[ { "from": "system", "value": "Add basic authorization spec for IepDocumentsController\n\n+ Stub out AWS response\n" }, { "from": "human", "value": "require 'rails_helper'\n\nRSpec.describe IepDocumentsController, type: :controller do\n\n describe '#show' do\n\n context 'educator has permissi...
ruby
chosen
[ { "from": "system", "value": "Add spec for PG&E namespace\n" }, { "from": "human", "value": "require \"spec_helper\"\n\ndescribe GreenButtonData::Parser::UsagePoint do\n context \"espi namespace\" do\n let(:feed) { GreenButtonData::Feed }\n let :usage_point do\n feed.parse(espi_usage...
ruby
chosen
[ { "from": "system", "value": "Add constraint for ruby version in gemspec\n\n- Limit to 1.9.2 and above\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nrequire File.expand_path('../lib/docusign_rest/version', __FILE__)\n\nGem::Specification.new do |gem|\n gem.authors = [\"Jon...
ruby
chosen
[ { "from": "system", "value": "spec/kanban: Create Backlog in setup block rather than test.\n" }, { "from": "human", "value": "require File.expand_path(File.dirname(__FILE__) + '/spec_helper')\n\ndescribe \"Backlog\" do\n it \"instantiates without error\" do\n Kanban::Backlog.new.should be_an...
ruby
chosen
[ { "from": "system", "value": "Remove double-start in Thin adapter.\n\nSigned-off-by: Michael S. Klishin <17b9e1c64588c7fa6419b4d29dc1f4426279ba01@novemberain.com>\n" }, { "from": "human", "value": "require \"thin\"\n\nmodule Merb\n\n module Rack\n\n class Thin\n # start a Thin server on...
ruby
chosen
[ { "from": "system", "value": "Remove including ROM in global namespace in specs\n" }, { "from": "human", "value": "# encoding: utf-8\n\nrequire \"codeclimate-test-reporter\"\nCodeClimate::TestReporter.start\n\nrequire 'rom'\n\nrequire 'rom/adapter/memory'\n\nrequire 'rom-sql'\nrequire 'rom/sql/s...
ruby
chosen
[ { "from": "system", "value": "Debug args to DateTime.parse that is causing build to fail on Travis\n" }, { "from": "human", "value": "ENV['RACK_ENV'] = 'test'\nRACK_ENV = 'test'\n\n$: << File.expand_path(\"../../\", __FILE__)\nrequire 'rack/test'\nrequire 'db'\nrequire 'pact_broker/api'\nrequire...
ruby
chosen
[ { "from": "system", "value": "Move rspec-puppet-facts to spec helper\n\nThis change updates the module to use the rspec-puppet-facts as defined\nin the puppet-openstack_spec_helper.\n\nChange-Id: I88265c5c39842c334fa0eaf219d73488fbb16acf\n" }, { "from": "human", "value": "require 'puppetlabs_spe...
ruby
chosen
[ { "from": "system", "value": "Use rspec --only-failures on welaika-suspenders too\n" }, { "from": "human", "value": "require 'bundler/setup'\n\nBundler.require(:default, :test)\n\nrequire (Pathname.new(__FILE__).dirname + '../lib/suspenders').expand_path\n\nDir['./spec/support/**/*.rb'].each { |...
ruby
chosen
[ { "from": "system", "value": "Configure tests to format coverage results locally\n\nThis should keep coveralls working, but also emit the output in\ncoverage/index.html so that you can see the effect of your change when\nwriting it.\n\nAlso use the rails profile so results are neatly grouped.\n" }, { ...
ruby
chosen
[ { "from": "system", "value": "Add a new validation to ensure at least one customer type is checked." }, { "from": "human", "value": "require 'active_model'\nrequire 'active_model/validations'\n\nrequire 'opscode/models/base'\n\nmodule Opscode\n module Models\n class OpcCustomer < Base\n ...
ruby
chosen
[ { "from": "system", "value": "Replace the file DB with shared cached memory DB\n" }, { "from": "human", "value": "TMP_DB_FILE = \"tmp/test_db.sqlite3\"\n\nrequire 'bundler/setup'\nBundler.setup\n\nrequire 'timecop'\nrequire 'byebug'\nrequire 'crono'\nrequire 'generators/crono/install/templates/m...
ruby
chosen
[ { "from": "system", "value": "Send report to codeclimate only from last AR version\n" }, { "from": "human", "value": "puts ENV.inspect\nif ENV['COVERAGE'] == '1'\n require 'simplecov'\n SimpleCov.start do\n load_profile 'test_frameworks'\n add_group 'Libraries\", \"lib'\n end\nend\n\nif...
ruby
chosen
[ { "from": "system", "value": "Check for instance methods, not respond_to?\n\nRespond_to? digs deeper into subject\n" }, { "from": "human", "value": "require 'delegate'\n\nmodule Puffery\n module Builder\n class DslBuilder < SimpleDelegator\n\n attr_accessor :_variations\n\n def sel...
ruby
chosen
[ { "from": "system", "value": "Make sure the tmp dir has been created\n" }, { "from": "human", "value": "# encoding: utf-8\nrequire 'bundler/setup'\nrequire 'active_record'\nrequire 'active_support'\n\ndb_engine = ENV['DB'] || 'mysql'\n\nActiveRecord::Base.establish_connection YAML.load_file(File...
ruby
chosen
[ { "from": "system", "value": "Configure focus flag for guard rspec\n" }, { "from": "human", "value": "require './lib/em-dextras'\n\nrequire 'em-dextras/spec'\n" }, { "from": "gpt", "value": "require './lib/em-dextras'\n\nrequire 'em-dextras/spec'\n\nRSpec.configure do |config|\n con...
ruby
chosen
[ { "from": "system", "value": "Remove spurious puts in test\n" }, { "from": "human", "value": "RSpec.describe \"vm_extensions\" do\n let(:manifest) { cloud_config_with_defaults }\n\n describe \"prometheus_lb\" do\n it \"Should add the prometheus lb config\" do\n expect(manifest['vm_exte...
ruby
chosen
[ { "from": "system", "value": "Change update method to update_attributes\n" }, { "from": "human", "value": "module Api\n module V1\n module MyCw\n class UsersController < MyCwController\n # Gets the current user\n def current\n render json: @current_user\n e...
ruby
chosen
[ { "from": "system", "value": "Change catalog to describe github repo service\n" }, { "from": "human", "value": "require 'sinatra'\nrequire 'json'\n\nclass ServiceBroker < Sinatra::Base\n get \"/v2/catalog\" do\n content_type :json\n\n description = {\n \"services\" => [{\n \"i...
ruby
chosen
[ { "from": "system", "value": "Update syntax to match client_side_validations" }, { "from": "human", "value": "require 'simple_form'\n\nrequire 'client_side_validations'\n\nrequire 'client_side_validations/simple_form/form_builder'\nrequire 'client_side_validations/simple_form/engine'\n\nrequire ...
ruby
chosen
[ { "from": "system", "value": "Fix offenses that were introduced by Performance/Count\n" }, { "from": "human", "value": "# encoding: utf-8\n\nmodule RuboCop\n module Cop\n module Metrics\n # This cop checks for methods with too many parameters.\n # The maximum number of parameters i...
ruby
chosen
[ { "from": "system", "value": "Fix frames command failing if no files are provided\n" }, { "from": "human", "value": "module YARD\n module Server\n module Commands\n class FramesCommand < DisplayObjectCommand\n include DocServerHelper\n \n def run\n main_url...
ruby
chosen
[ { "from": "system", "value": "Switch to UNIX line delimiters in system test truth files\n\n" }, { "from": "human", "value": "# This file was automatically generated by Trapeze, the safety-net generator for\r\n# Ruby. Visit http://trapeze.rubyforge.org/ for more information.\r\n\r\nrequire 'test/...
ruby
chosen
[ { "from": "system", "value": "Revert \"Remove append_view_path from api ControllerSetup\"\n\nSince Api::BaseController inherits from ActionController::Metal we do\nneed to use append_view_path for rendering views inside api/app/views\nand the main app views dir\n\nExtensions should probably also use append_...
ruby
chosen
[ { "from": "system", "value": "Revert back to nested arrays for mapping purposes\n" }, { "from": "human", "value": "class ResultsController < ApplicationController\n def index\n user = User.find(params[:id])\n\n render json: user.results_by_items_found.to_h.to_json\n\n end\n\n def by_low...
ruby
chosen
[ { "from": "system", "value": "Mark admin as updated when we are going to reboot it\n\nThis ensures that when the admin is back, the status of the minion on\nthe database will match the grains from the very beginning, without\nhaving to rely on the background task updating all minions (including\nthe admin) ...
ruby
chosen
[ { "from": "system", "value": "Add instance variable to index method to be used in view - a bit of a monkeypatch again\n" }, { "from": "human", "value": "class WelcomeController < ApplicationController\n\tdef index\n\t\t@locations = Location.all\n\tend\nend\n" }, { "from": "gpt", "val...
ruby
chosen
[ { "from": "system", "value": "Use Rspec syntax instead of Test::Unit in ActionDispatch::Request spec.\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe ActionDispatch::Request do\n it \"strips nils from arrays\" do\n assert_parses({ \"key\" => [\"value\"] }, 'key[]=value&k...
ruby
chosen
[ { "from": "system", "value": "Add blank lines for readability.\n" }, { "from": "human", "value": "#!/usr/bin/ruby -Ku\n# vim: set fileencoding=utf-8:\n\nif RUBY_VERSION >= '1.9'\n Encoding.default_external = Encoding::UTF_8\nend\n\nrequire 'em-websocket'\n\nEventMachine.run {\n @channel = Even...
ruby
chosen
[ { "from": "system", "value": "Fix for removal of Tracker.environment\n" }, { "from": "human", "value": "Spree::Tracker.class_eval do\n belongs_to :store\n\n def self.current(store_key)\n Spree::Tracker.where(active: true, environment: Rails.env).joins(:store).where(\"spree_stores.code = ? O...
ruby
chosen
[ { "from": "system", "value": "Fix typo and remove WebHelper\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nrequire 'spec_helper'\n\ndescribe \"Tax Categories\" do\n include AuthenticationHelper\n # include WebHelper\n\n context 'user adds a new shipping category with temp...
ruby
chosen
[ { "from": "system", "value": "Tidy up gemspec as per Railscasts\n\nhttp://asciicasts.com/episodes/245-new-gem-with-bundler" }, { "from": "human", "value": "Gem::Specification.new do |s|\n s.name = 'fistface'\n s.version = '1.0.0'\n s.email = 'support@thoughtbot.com'\n s.home...
ruby
chosen
[ { "from": "system", "value": "Return total_count not just count for @products\n" }, { "from": "human", "value": "object false\nnode(:count) { @products.count }\nnode(:current_page) { params[:page] ? params[:page].to_i : 1 }\nnode(:pages) { @products.num_pages }\nchild(@products) do\n extends \"...
ruby
chosen
[ { "from": "human", "value": "Add test example for after branch delete service\n" }, { "from": "gpt", "value": "require 'spec_helper'\n\ndescribe AfterBranchDeleteService, services: true do\n let(:project) { create(:project) }\n let(:user) { create(:user) }\n let(:service) { described_class.ne...
ruby
chosen
[ { "from": "human", "value": "Move ApplicationHelper shared examples to UI repo\n" }, { "from": "gpt", "value": "shared_examples_for 'will be skipped for this record' do |message|\n it message.to_s do\n view_context = setup_view_context_with_sandbox({})\n button = described_class.new(view_...
ruby
chosen
[ { "from": "system", "value": "Test multipart/form-data in booking import form.\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe \"booking_imports/edit.html.haml\" do\n before(:each) do\n @booking_import = assign(:booking_import, stub_model(BookingImport,\n :new_recor...
ruby
chosen
[ { "from": "system", "value": "Add Google Analytics to CSP allow list\n\n**Why**: So that requests to Google Analytics are not blocked.\n" }, { "from": "human", "value": "# Be sure to restart your server when you modify this file.\n\n# Define an application-wide content security policy\n# For fur...
ruby
chosen
[ { "from": "system", "value": "Use Spree.t instead of t helper" }, { "from": "human", "value": "Deface::Override.new(:virtual_path => \"spree/admin/shared/_configuration_menu\",\n :name => \"add_social_providers_link_configuration_menu\",\n :insert_bottom =...
ruby
chosen
[ { "from": "system", "value": "Use toplevel reference to ::StringIO since we're in a BasicObject.\n" }, { "from": "human", "value": "module ActionController\n class RewindableInput\n class RewindableIO < ActiveSupport::BasicObject\n def initialize(io)\n @io = io\n @rewindab...
ruby
chosen
[ { "from": "system", "value": "9689: Remove redundant serialization of refable_qings\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nmodule ConditionalLogicForm\n # Serializes Condition for use in condition form.\n class ConditionSerializer < ApplicationSerializer\n attri...
ruby
chosen
[ { "from": "system", "value": "Update JSON response for player under game\n" }, { "from": "human", "value": "json.array!(@players) do |player|\n json.extract! player, :name\n json.url player_url(player, format: :json)\nend" }, { "from": "gpt", "value": "json.array!(@players) do |pla...
ruby
chosen