conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Update gemspec homepage and summary/desc\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n$:.push File.expand_path(\"../lib\", __FILE__)\nrequire \"schlep/version\"\n\nGem::Specification.new do |s|\n s.name = \"schlep\"\n s.version = Schlep...
ruby
chosen
[ { "from": "system", "value": "Add test for required fields\n" }, { "from": "human", "value": "require 'test_helper'\n\nmodule ActiveModel\n class Serializer\n class AttributesTest < Minitest::Test\n def setup\n @profile = Profile.new({ name: 'Name 1', description: 'Description 1'...
ruby
chosen
[ { "from": "system", "value": "Fix incorrect argument for update_with_password\n\nBy adding the `resource.extend` line in version 0.9.0, this caused a bug in the `update` method that resulted in `ActiveModel::ForbiddenAttributesError` when trying to update the password.\n\nThe solution is to pass in `resourc...
ruby
chosen
[ { "from": "system", "value": "Implement a special double method for command specs\n" }, { "from": "human", "value": "require 'discordrb'\n\ndescribe Discordrb::Commands do\n describe Discordrb::Commands::CommandBot do\n context 'no defined commands' do\n bot = Discordrb::Commands::Comma...
ruby
chosen
[ { "from": "human", "value": "Add simple spec for Metacrunch::Parallel.\n" }, { "from": "gpt", "value": "describe Metacrunch::Parallel do\n\n let(:testfile) { \"/tmp/metacrunch_spec_parallel\" }\n\n before do\n File.delete(testfile) if File.exists?(testfile)\n end\n\n it \"#each\" do\n ...
ruby
chosen
[ { "from": "system", "value": "Use 1.8 hash syntax in specs, too\n" }, { "from": "human", "value": "require 'wixy/vigenere'\nrequire 'example_helper'\n\nmodule ConfigHelpers\n def create_config(options)\n Wixy::Config.new do |config|\n options.each do |key, value|\n config.public_...
ruby
chosen
[ { "from": "human", "value": "Add spec test for tripleo::certmonger::httpd resource\n\nChange-Id: Ia002aced6de474022d4aa4e9e3d7d5ee7c31a2b0\n" }, { "from": "gpt", "value": "#\n# Copyright (C) 2017 Red Hat Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not ...
ruby
chosen
[ { "from": "system", "value": "Fix comments in count between\n" }, { "from": "human", "value": "# Longest String\n\n# I worked on this challenge [by myself, with: ].\n\n# longest_string is a method that takes an array of strings as its input\n# and returns the longest string\n#\n# +list_of_words+...
ruby
chosen
[ { "from": "system", "value": "Fix 'rake pg' task to work as expected again.\n" }, { "from": "human", "value": "require 'rspec/core/rake_task'\n\nRSpec::Core::RakeTask.new :default do |spec|\n spec.pattern = './spec/**/*_spec.rb'\nend\n\n# Shortcut to skip the adapter specs, and run only with th...
ruby
chosen
[ { "from": "system", "value": "Add root route to dummy app\n" }, { "from": "human", "value": "Rails.application.routes.draw do\n\n mount G5Authenticatable::Engine => '/g5_auth'\nend\n" }, { "from": "gpt", "value": "Rails.application.routes.draw do\n\n mount G5Authenticatable::Engine...
ruby
chosen
[ { "from": "human", "value": "Create capybara spec for admin/moderation features\n" }, { "from": "gpt", "value": "require 'rails_helper'\n\ndescribe 'the moderation system', type: :feature do\n\n before(:each) do\n FactoryGirl.create(:ip_cache, ip_address: '1.2.3.4')\n end\n\n let(:user) do...
ruby
chosen
[ { "from": "system", "value": "Remove testing on creating new channel\n" }, { "from": "human", "value": "require \"spec_helper\"\n\ndescribe Lita::Adapters::Slack::ChannelMapping do\n subject { described_class.new(channels) }\n\n let(:api) { instance_double('Lita::Adapters::Slack::API') }\n le...
ruby
chosen
[ { "from": "system", "value": "Define an example of RWS::Recipe::Category.large_categories\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe RakutenWebService::Recipe::Category do\n\nend\n" }, { "from": "gpt", "value": "require 'spec_helper'\n\ndescribe RakutenWebSe...
ruby
chosen
[ { "from": "system", "value": "Add user model to generated config.\n\nProvide some docs and a commented out user_model setting in config.\n" }, { "from": "human", "value": "Brightcontent.setup do |config|\n # The path where the admin interface should mount.\n config.path = \"admin\"\n\n # Name...
ruby
chosen
[ { "from": "system", "value": "Handle empty method calls better.\n" }, { "from": "human", "value": "module Api\n class ApiStatus\n ENDPOINT = '/status'\n\n attr_accessor :env, :params\n\n def initialize(env, params)\n self.env = env\n self.params = params\n end\n\n ...
ruby
chosen
[ { "from": "system", "value": "Create method for index path\n" }, { "from": "human", "value": "module EasyResource\n module Actions\n # GET /resources\n def index\n respond_with(collection)\n end\n\n # GET /resources/1\n def show\n respond_with(resource)\n end\n\n ...
ruby
chosen
[ { "from": "system", "value": "Remove unused method configuration in Dashboard\n" }, { "from": "human", "value": "module GooderData\n\n class Dashboard\n\n attr_accessor :project_id\n\n def initialize(dashboard_id, options = {})\n @dashboard_id = dashboard_id\n @options = GooderD...
ruby
chosen
[ { "from": "human", "value": "Add integration tests for GobiertoData module settings\n" }, { "from": "gpt", "value": "# frozen_string_literal: true\n\nrequire \"test_helper\"\n\nmodule GobiertoAdmin\n module GobiertoData\n module Configuration\n module Settings\n class UpdateSettg...
ruby
chosen
[ { "from": "system", "value": "Remove trailing slashes from request paths.\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nmodule Redd\n module Models\n # A model that can be commented on or replied to.\n module Replyable\n # Add a comment to a link, reply to a com...
ruby
chosen
[ { "from": "system", "value": "Swap rescue statement for all errors\n" }, { "from": "human", "value": "require 'thor'\n\nmodule Stevenson\n class Application < Thor\n desc 'stevenson new PROJECT_NAME', 'generates a Jekyll at PROJECT_NAME'\n\n method_option :template,\n ali...
ruby
chosen
[ { "from": "system", "value": "Delete cassandra-cql override, now that latest cassandra-cql supports empty bind_vars\n" }, { "from": "human", "value": "module CassandraCQL\n class Statement\n def self.sanitize(statement, bind_vars=[])\n return statement if bind_vars.empty?\n\n bind_...
ruby
chosen
[ { "from": "system", "value": "Make sure new stuff email only does out once a week.\n" }, { "from": "human", "value": "namespace :notifications do\n desc \"Let the admins know about all the new shit this week.\"\n task :new_stuff_admin, [:since] => :environment do |_t, args|\n args.with_defa...
ruby
chosen
[ { "from": "system", "value": "Add default value to tweet_count column in trends\n" }, { "from": "human", "value": "class AddColumnsToTrends < ActiveRecord::Migration\n def change\n add_column :trends, :tweet_count, :integer\n add_index :trends, :tweet_count\n end\nend\n" }, { "fr...
ruby
chosen
[ { "from": "system", "value": "Use ERB templates for all outcomes\n\nNow that all outcomes are using ERB templates, we can use the flow-wide\n`use_outcome_templates` statement to avoid having to set the\n`use_outcome_templates` option for each of the outcomes individually.\n" }, { "from": "human", ...
ruby
chosen
[ { "from": "system", "value": "Test script paths as well as stylesheets\n" }, { "from": "human", "value": "require 'test_helper'\nrequire 'emcee/node.rb'\n\nclass NodeTest < ActiveSupport::TestCase\n setup do\n @body = \"<link rel=\\\"stylesheet\\\" href=\\\"test.css\\\">\"\n @document = N...
ruby
chosen
[ { "from": "system", "value": "Fix ruby 3.2 keyword argument warning.\n\nBasically it means that we should pass hashes as hashes.\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nrequire 'spec_helper'\nrequire_relative 'test_messages'\n\ndescribe Sequent::Core::Helpers::Message...
ruby
chosen
[ { "from": "system", "value": "Check for valid enrollment type to conclude\nAdd concluding user enrollment as part of course completion API\n" }, { "from": "human", "value": "class Api::CourseCompletionsController < Api::ApiApplicationController\n include Concerns::CanvasSupport\n\n def create\...
ruby
chosen
[ { "from": "system", "value": "Set session guid and save to db. Just add lri and stir." }, { "from": "human", "value": "class TaggerController < ApplicationController\n def index\n end\n \n # Saves a string to a file named filename on a users machine\n def save_local\n send_data(\"#{para...
ruby
chosen
[ { "from": "system", "value": "Use supports_partial_index instead of adapter_name\n\nThis allows tests to run under sqlite versions below 3.8\n" }, { "from": "human", "value": "class AddStockItemUniqueIndex < ActiveRecord::Migration\n def change\n # Add a database-level uniqueness constraint ...
ruby
chosen
[ { "from": "system", "value": "Include price + variant in attributes assertion on variants\n" }, { "from": "human", "value": "require 'spec_helper'\n\nmodule Spree\n describe Api::V1::LineItemsController do\n let!(:order) { Factory(:order) }\n let(:product) { Factory(:product) }\n let(:...
ruby
chosen
[ { "from": "system", "value": "Remove legacy error-handling routes to flush out bugs: exception-handler gem should always handle.\n" }, { "from": "human", "value": "class BaseController < ApplicationController\n caches_page :index, :if => Proc.new { |c| c.instance_variable_get('@page_cache') }\n...
ruby
chosen
[ { "from": "system", "value": "Allow scale for numeric array to be zero\n" }, { "from": "human", "value": "# encoding: utf-8\n\nrequire 'dm-core'\nrequire 'dm-postgres-types/property/pg_array'\n\nmodule DataMapper\n class Property\n class PgNumericArray < PgArray\n accept_options :precis...
ruby
chosen
[ { "from": "system", "value": "Fix dibs_referrals scope on user\n" }, { "from": "human", "value": "module Spree\n User.class_eval do\n scope :dibs_referrers, lambda { includes(:roles).where(\"#{::Spree::Role.table_name}.name\" => \"dibs_referral\") }\n has_many :dibs_referrals, class_name:...
ruby
chosen
[ { "from": "system", "value": "Add test for weird filter\n" }, { "from": "human", "value": "# Filters added to this controller apply to all controllers in the application.\n# Likewise, all the methods added will be available for all controllers.\n\nclass ApplicationController < ActionController::...
ruby
chosen
[ { "from": "human", "value": "Fix directory for reverse-words challenge\n" }, { "from": "gpt", "value": "# Reverse Words\n\n\n# I worked on this challenge [by myself].\n# This challenge took me [#] hours.\n\n# Pseudocode\n=begin\nINPUT: (string) a sentence\nOUTPUT: (string) each word in sentence ...
ruby
chosen
[ { "from": "system", "value": "Index code for efficient querying\n" }, { "from": "human", "value": "require 'carto/db/migration_helper'\n\ninclude Carto::Db::MigrationHelper\n\nmigration(\n Proc.new do\n create_table :oauth_apps_users do\n Uuid :id, primary_key: true, default: 'uu...
ruby
chosen
[ { "from": "system", "value": "Fix Bundler require in Thor task.\n" }, { "from": "human", "value": "require 'rubygems'\nrequire 'bundler'\nBundler.require(:default)\n\nclass Data < Thor\n include Mongo\n DIRECTORY = \"NYPD\"\n\n desc \"load_from_xml PATH\", \"Load XML Datashare data from PATH\...
ruby
chosen
[ { "from": "system", "value": "Gem: Set minimum version of Ruby to 2.3.0\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\n$LOAD_PATH.unshift(File.expand_path(\"../lib\", __FILE__))\nrequire \"active_cleaner/version\"\n\nGem::Specification.new do |s|\n s.name = \"activecleaner\...
ruby
chosen
[ { "from": "system", "value": "Remove failed review validation code\n" }, { "from": "human", "value": "class Business < ActiveRecord::Base\n has_many :reviews\n validates :title, presence: true, length: { minimum: 5 }\nend\n" }, { "from": "gpt", "value": "class Business < Active...
ruby
chosen
[ { "from": "system", "value": "Fix ruby syntax in previous commit (sorry)\n" }, { "from": "human", "value": "if Rails.env.test\n require 'spec/support/redis.rb'\n CartoDB::RedisTest.up\nend\n\nif Cartodb.config[:redis].blank?\n raise <<-MESSAGE\nPlease, configure Redis in your config/app_confi...
ruby
chosen
[ { "from": "system", "value": "Use ActiveRecord relations for draft and live\n\nThis uses the ActiveRecord relations and associated caching for\naccessing draft and live items.\n\nThis doesn't have the check for duplicate items anymore as I wasn't sure\nhow it could be integrated and I'm expecting this not t...
ruby
chosen
[ { "from": "system", "value": "Add tests to ensure locale is selecting correct static file\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nrequire 'test_helper'\n\nclass StaticPagesControllerTest < ActionController::TestCase\n test 'should get home' do\n get :home\n ass...
ruby
chosen
[ { "from": "system", "value": "Revert \"set ShopifyAPI::Base.site to string\"\n\nThis reverts commit 651159fa6434c5b1fb9900ada8a0d57ffd34c561.\n\nCannot reproduce exception referred to in code comment. Apparently, there was nothing broken to fix.\n" }, { "from": "human", "value": "require_depende...
ruby
chosen
[ { "from": "system", "value": "Add test if options.location is set\n" }, { "from": "human", "value": "module VagrantPersistentStorage\n class AttachPersistentStorage\n def initialize(app, env)\n @app = app\n @env = env\n @vm = env[:vm]\n end\n\n def call(env)\n optio...
ruby
chosen
[ { "from": "system", "value": "Refactor: Use existing method to query git appliance\n" }, { "from": "human", "value": "module MiqAeToolsHelper\n def git_import_button_enabled?\n MiqRegion.my_region.role_active?(\"git_owner\")\n end\n\n def git_import_submit_help\n unless MiqRegion.my_reg...
ruby
chosen
[ { "from": "system", "value": "Refactor announcement mailer to use associations." }, { "from": "human", "value": "# Mailer to handle [Coursewareable::Classroom] announcement emails\nclass AnnouncementMailer < ActionMailer::Base\n default from: Courseware.config.default_email_address\n layout 'e...
ruby
chosen
[ { "from": "system", "value": "Add a test to ensure Grafana dashboards have the correct JSON\n" }, { "from": "human", "value": "require \"json\"\n\nRSpec.describe \"grafana dashboards\" do\n grafana_dashboards.each do |dashboard_name, dashboard_contents|\n it \"ends in .json\" do\n expec...
ruby
chosen
[ { "from": "system", "value": "Fix Capybara Readtimeout error on Travis\n\nStarting with chromedriver 80 switching between frames can cause\n`Timed out receiving message from renderer` errors. [1]\n\nDowngrade to 79 as a workaround.\n\n[1] https://bugs.chromium.org/p/chromedriver/issues/detail?id=3335&q=Time...
ruby
chosen
[ { "from": "system", "value": "Remove fist node creation after save\n\n\ngit-svn-id: ca470d9146711862cf4ac2dac85cf4a5bf568169@1299 67a09383-3dfa-4221-8551-890bac9c277c\n" }, { "from": "human", "value": "# == Schema Information\n#\n# Table name: listings\n#\n# comment :text \n# com...
ruby
chosen
[ { "from": "system", "value": "Add grouping to query for quantity sold per day\n" }, { "from": "human", "value": "class Product < ApplicationRecord\n has_many :order_products\n has_many :orders, through: :order_products\n has_many :category_products\n has_many :categories, through: :category_...
ruby
chosen
[ { "from": "system", "value": "Add git helper to container DSL\n" }, { "from": "human", "value": "class Indocker::ContainerMetadataFactory\n include SmartIoC::Iocify\n\n bean :container_metadata_factory\n\n inject :docker_api\n inject :container_evaluator\n inject :image_metadata_repository\...
ruby
chosen
[ { "from": "system", "value": "Add idempotency test to system tests\n" }, { "from": "human", "value": "require 'spec_helper_system'\n\ndescribe 'basic tests' do\n it 'class should work without errors' do\n pp = <<-EOS\n class { 'puppet': }\n EOS\n\n puppet_apply(pp) do |r|\n r...
ruby
chosen
[ { "from": "system", "value": "Make the ref for /v2/me be to itself.\n" }, { "from": "human", "value": "class MeSerializer < UserSerializer\n\n cached # Make sure to cache the user object.\n\n attributes :read_terms, :default_avatar, :email, :email_verified\n\n # Public: Checks if user is usin...
ruby
chosen
[ { "from": "system", "value": "Add jdbc postgres runtime dependency to gemspec.\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nGem::Specification.new do |s|\n s.name = 'postgresql_connector'\n s.summary = 'PostgreSQL Connector for Sequel'\n s.version = '0.0.0'\n s.authors = [''...
ruby
chosen
[ { "from": "system", "value": "Add :alert to flash message updater\n" }, { "from": "human", "value": "module Lail\n module ActionPackExtensions\n module FlashMessageUpdater\n \n \n \n def update_flash_message(key, options={})\n id, message = \"flash_#{key}\", flash[...
ruby
chosen
[ { "from": "system", "value": "Put back AppConfig defaults to fix some IssuesController specs.\n" }, { "from": "human", "value": "require 'ostruct'\nrequire 'yaml'\n\nunless Rails.env.test?\n AppConfig = YAML.load_file(Rails.root.join('config', 'cfme_bz.yml'))[Rails.env] rescue {\"bugzilla\"=>{}...
ruby
chosen
[ { "from": "system", "value": "ENHANCE: Include campus in serliaze object\n" }, { "from": "human", "value": "# Doubtfire will deprecate ActiveModelSerializer in the future.\n# Instead, write a serialize method on the model.\n\nrequire 'user_serializer'\n\nclass TutorialSerializer < ActiveModel::S...
ruby
chosen
[ { "from": "system", "value": "Use more meaningful method names for publishing\n\nRather than \"notifying listeners\" use more meaningful names to refer\nto calling the Exporter methods.\n" }, { "from": "human", "value": "class CreateSectionService\n def initialize(manual_repository:, context:)\...
ruby
chosen
[ { "from": "system", "value": "Fix method name for NetworkRouter\n" }, { "from": "human", "value": "class ApplicationHelper::Button::NetworkRouterNew < ApplicationHelper::Button::ButtonNewDiscover\n def calculate_properties\n super\n if disabled?\n self[:title] = _(\"No cloud provider...
ruby
chosen
[ { "from": "human", "value": "Add a shared examples folder to specs\n\nincluding some examples used in project contributions controller.\n" }, { "from": "gpt", "value": "RSpec.shared_examples 'when no hooks are triggered on new and create methods' do\n it 'should return a success response code o...
ruby
chosen
[ { "from": "system", "value": "9188: Fix fake data generation spec\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nrequire \"rails_helper\"\nrequire \"fileutils\"\n\ndescribe Utils::FakeData::MainGenerator do\n let(:community) { create(:community) }\n let(:cluster) { communi...
ruby
chosen
[ { "from": "system", "value": "Change to rails version 4.1.0\n" }, { "from": "human", "value": "$:.push File.expand_path(\"../lib\", __FILE__)\n\n# Maintain your gem's version:\nrequire \"ct_angular_ui_router_rails/version\"\n\n# Describe your gem and declare its dependencies:\nGem::Specification...
ruby
chosen
[ { "from": "system", "value": "Add dot '.' on .field spec.\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe ActiveForce::SObject do\n describe \".new\" do\n it \"create with valid values\" do\n @SObject = Whizbang.new\n expect(@SObject).to be_an_instance_of Whizb...
ruby
chosen
[ { "from": "system", "value": "Add spec over method calling on handler\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe Tarquinn::Handler do\n let(:controller) { double('controller') }\n let(:config) { Tarquinn::Config.new(:redirect_method) }\n let(:subject) { described_cla...
ruby
chosen
[ { "from": "system", "value": "Add empty line at end of file\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nrequire 'spec_helper'\n\ndescribe Vote do\n let!(:vote) { create(:vote) }\n\n describe 'validation' do\n it 'has a valid factory' do\n expect(build(:vote)).to...
ruby
chosen
[ { "from": "system", "value": "Test TicTacToe class to instantiate with an array of 9 strings assigned to the variable @board\n" }, { "from": "human", "value": "require_relative '../lib/tic_tac_toe.rb'" }, { "from": "gpt", "value": "require_relative '../lib/tic_tac_toe.rb'\n\ndescribe...
ruby
chosen
[ { "from": "system", "value": "Add summary and description to .gemspec" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'sphinxtrain/version'\n\nGem::Specification.new do |spec|\n spec.n...
ruby
chosen
[ { "from": "human", "value": "Add fgdc reader module 'range'\ninclude minitest\n" }, { "from": "gpt", "value": "# Reader - fgdc to internal data structure\n# unpack fgdc entity range domain\n\n# History:\n# Stan Smith 2017-09-06 original script\n\nrequire 'nokogiri'\nrequire 'adiwg/mdtranslator/...
ruby
chosen
[ { "from": "system", "value": "Increment to version 0.1.4 in gemspec\n" }, { "from": "human", "value": "Gem::Specification.new do |s|\n s.name = 'crudecumber'\n s.version = '0.1.3.dev'\n s.date = '2015-06-15'\n s.summary = 'Crudecumber 0.1.3'\n s.description = \"Manuall...
ruby
chosen
[ { "from": "system", "value": "Fix style for XdsTest output\n" }, { "from": "human", "value": "=begin rdoc\n=Description\nScaffolding for EdgeConfiguration Model\n=end\nclass EdgeConfigurationsController < ApplicationController\n before_filter :super_authenticate\n before_filter :get_cart\n\n ...
ruby
chosen
[ { "from": "system", "value": "Make sure our compressor is ran, the hooks are necessary.\n" }, { "from": "human", "value": "# Frozen-string-literal: true\n# Copyright: 2017 - 2018 - MIT License\n# Author: Jordon Bedwell\n# Encoding: utf-8\n\nmodule Jekyll\n module Assets\n module Compressors\...
ruby
chosen
[ { "from": "system", "value": "Add missing camel case method." }, { "from": "human", "value": "module Metaforce\n module CoreExtensions\n module String\n\n def lower_camelcase\n str = dup\n str.gsub!(/_[a-z]/) { |a| a.upcase }\n str.gsub!('_', '')\n str\n ...
ruby
chosen
[ { "from": "system", "value": "Fix pocket's word ages metric\n" }, { "from": "human", "value": "ProviderRepo.find!(:pocket).register_metric :article_word_days do |metric|\n metric.description = \"The sum of days since each word in an article has been added\"\n metric.title = \"Article words bac...
ruby
chosen
[ { "from": "system", "value": "Change the new admin account notification receiver" }, { "from": "human", "value": "class NewAdminMailer < ApplicationMailer\n def new_admin_email admin, password\n\n @admin = admin\n @password = password\n\n mail(to: 'tech@apientreprise.fr',\n sub...
ruby
chosen
[ { "from": "system", "value": "Add requires to pass smart-answers tests.\n" }, { "from": "human", "value": "require 'forwardable'\n\nmodule Smartdown\n module Model\n module Element\n module Question\n\n def self.create_question_answer elements, response=nil\n constants.f...
ruby
chosen
[ { "from": "system", "value": "Fix Ruby 3.0 deprecation warning: Using the last argument as keyword parameters is deprecated\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\n# Allows long running methods to be forked easily\nmodule Forkable\n extend ActiveSupport::Concern\n\n ...
ruby
chosen
[ { "from": "system", "value": "Allow save the user name on sign up and update account\n" }, { "from": "human", "value": "class ApplicationController < ActionController::API\n include DeviseTokenAuth::Concerns::SetUserByToken\n include Pundit\nend\n" }, { "from": "gpt", "value": "cla...
ruby
chosen
[ { "from": "system", "value": "Resolve undefined method parcel items\n" }, { "from": "human", "value": "class PurchaseItemDecorator < Draper::Decorator\n delegate_all\n\n def reception_number\n reception_id = object.parcels_purchase_invoice_items.first.parcel_id\n\n Reception.find(recepti...
ruby
chosen
[ { "from": "system", "value": "Improve naming of variables in VariantOverridesIndexed for readability\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nclass VariantOverridesIndexed\n def initialize(variant_ids, distributor_ids)\n @variant_ids = variant_ids\n @distributor...
ruby
chosen
[ { "from": "system", "value": "Add \"add\" command and add run_command to handling output when tty is false\n" }, { "from": "human", "value": "require \"git/si/version\"\nrequire \"thor\"\nrequire \"pager\"\n\nmodule Git\n\n module Si\n\n class SvnInterface < Thor\n include Thor::Actions...
ruby
chosen
[ { "from": "system", "value": "Read image dimensions with FastImage instead of MiniMagick\n" }, { "from": "human", "value": "class ImageUploader < ApplicationUploader\n def path\n \"/#{model.class.table_name}/#{model.token}\"\n end\n\n # Example with a 600x400 picture: thumb_size('x200') ->...
ruby
chosen
[ { "from": "system", "value": "Use Oj for JSON parsing\n" }, { "from": "human", "value": "require \"lentil/engine\"\nrequire 'lentil/instagram_harvester'\nrequire 'lentil/popularity_calculator'\nrequire 'devise'\nrequire 'activeadmin'\nrequire 'ransack'\nrequire 'formtastic'\nrequire 'instagram'\...
ruby
chosen
[ { "from": "system", "value": "Use ! instead of not\n" }, { "from": "human", "value": "#!/usr/bin/env ruby\r\n# encoding: UTF-8\r\n\r\nrequire 'rubygems'\r\nrequire 'bundler/setup'\r\n\r\nrequire_relative 'coordinate'\r\n\r\n# Class to represent a detour, which holds a start and end Coordinate.\r...
ruby
chosen
[ { "from": "system", "value": "Add validators for answer and serializer for guesses.\n" }, { "from": "human", "value": "require \"guessr/version\"\nrequire \"camping\"\n\nCamping.goes :Guessr\n\nmodule Guessr\n module Models\n class Player < Base\n validates :name, presence: true, unique...
ruby
chosen
[ { "from": "system", "value": "Correct registration error - 'every e-mail exists'\n" }, { "from": "human", "value": "module FluffyPaws\n module Interactions\n class Register\n def initialize(db)\n @db = db\n @session = nil\n @error = nil\n end\n\n attr_read...
ruby
chosen
[ { "from": "system", "value": "Use new client interface for persistent connections.\n" }, { "from": "human", "value": "# A simple job for flagging a specified Sphinx document in a given index as\n# 'deleted'.\n#\nclass FlyingSphinx::FlagAsDeletedJob\n attr_accessor :indices, :document_id\n\n # ...
ruby
chosen
[ { "from": "system", "value": "Add a set_finished! callback method.\n" }, { "from": "human", "value": "require \"guessr/version\"\nrequire \"set\"\nrequire \"camping\"\n\nCamping.goes :Guessr\n\nmodule Guessr\n module Models\n class Player < Base\n validates :name, presence: true, unique...
ruby
chosen
[ { "from": "system", "value": "Use body key not method\n" }, { "from": "human", "value": "# Send membership data to SportsBase\nclass RaceDayMailer < ActionMailer::Base\n helper :application\n\n def members_export(people)\n subject \"#{RacingAssociation.current.name} Members Export\"\n ...
ruby
chosen
[ { "from": "system", "value": "Move text_unique existing_data equality conditional into existing conditional\n" }, { "from": "human", "value": "class TextFieldType < FieldType\n attr_accessor :text\n jsonb_accessor :data, text: :string\n\n validates :text, presence: true, if: :validate_presenc...
ruby
chosen
[ { "from": "system", "value": "Controller: Use Memento.watch instead of shortcut\n" }, { "from": "human", "value": "module Memento\n module ActionControllerMethods\n\n def memento\n block_result = nil\n memento_session = Memento(current_user) do\n block_result = yield\n ...
ruby
chosen
[ { "from": "human", "value": "Add functional testing for log class\n" }, { "from": "gpt", "value": "require 'floss/log'\nrequire 'floss/log/simple'\n\nshared_examples 'a Log implementation' do\n\n before do\n @log = described_class.new {}\n @log.remove_starting_with(0)\n end\n\n it 'retu...
ruby
chosen
[ { "from": "system", "value": "Reduce verbosity of article spec output" }, { "from": "human", "value": "RSpec.describe Article, type: :model do\n subject(:article) { Article.new(id, source) }\n\n let(:id) { 'govspeak' }\n\n describe '#title' do\n subject(:title) { article.title }\n\n con...
ruby
chosen
[ { "from": "system", "value": "Drop bad tests for invoice balances.\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe Invoice do\n it { should belong_to(:customer) }\n it { should belong_to(:company) }\n\n it { should validate_presence_of(:customer) }\n it { should validate...
ruby
chosen
[ { "from": "system", "value": "Fix 1.8.7 variable scoping issue in spec\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe Zipstream::Body do\n it \"should stream as a body\" do\n stage = 1\n body = Zipstream::Body.new do |zip|\n stage = 2\n zip.write \"README\"...
ruby
chosen
[ { "from": "system", "value": "Update to Xcode beta 5\n" }, { "from": "human", "value": "Pod::Spec.new do |s|\n s.name = \"Cosmos\"\n s.version = \"3.0.0\"\n s.license = { :type => \"MIT\" }\n s.homepage = \"https://github.com/marketplacer/Cosmos\"\n s.summary = \"5-sta...
ruby
chosen
[ { "from": "system", "value": "Update amatch dependency to 0.3\n" }, { "from": "human", "value": "# encoding: utf-8\n\n$:.unshift File.expand_path('../lib', __FILE__)\nrequire 'twins/version'\n\nGem::Specification.new do |s|\n s.name = \"twins\"\n s.version = Twins::VERSION\n s....
ruby
chosen
[ { "from": "system", "value": "Clean up redundant copy and paste artefact\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe 'tdd_puppet_module' do\n context 'supported operating systems' do\n on_supported_os.each do |os, facts|\n context \"on #{os}\" do\n let(:f...
ruby
chosen
[ { "from": "system", "value": "Remove `halt_callback_chains_on_return_false` config from test app\n\nref: https://github.com/cookpad/kuroko2/pull/112\n\nThis option is no longer available on Rails 5.2 or newer.\nIt changes Active Record's callbacks behavior if a callback returns\nfalse. But I've confirmed th...
ruby
chosen
[ { "from": "system", "value": "Add User association to Character factory\n" }, { "from": "human", "value": "FactoryGirl.define do\n factory :character do\n name \"MyString\"\n age \"MyString\"\n end\nend" }, { "from": "gpt", "value": "FactoryGirl.define do\n factory :characte...
ruby
chosen
[ { "from": "system", "value": "Use buton value instead of type to nallow target\n" }, { "from": "human", "value": "require \"spec_helper\"\n\ndescribe \"users\" do\n describe \"visit edit page before login\" do\n let(:url) { user_path }\n it_should_behave_like \"login required\"\n end\n\n...
ruby
chosen