diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/related.gemspec b/related.gemspec index abc1234..def5678 100644 --- a/related.gemspec +++ b/related.gemspec @@ -6,6 +6,7 @@ s.version = Related::Version s.summary = 'Related is a Redis-backed high performance distributed graph database.' s.description = 'Related is a Redis-backed high performance distributed graph database.' + s.license = 'MIT' s.author = 'Niklas Holmgren' s.email = 'niklas@sutajio.se' @@ -24,4 +25,4 @@ s.add_dependency('redis', '> 2.0.0') s.add_dependency('redis-namespace', '> 0.8.0') s.add_dependency('activemodel') -end+end
Add missing `license` property to gemspec
diff --git a/lib/rspec/contracts/interaction.rb b/lib/rspec/contracts/interaction.rb index abc1234..def5678 100644 --- a/lib/rspec/contracts/interaction.rb +++ b/lib/rspec/contracts/interaction.rb @@ -1,19 +1,25 @@ module RSpec module Contracts class Interaction - attr_reader :interface_name, :method_name, :arguments, :return_value + attr_reader :interface_name, :method_name, :arguments, :return_value, :specifications def initialize(interface_name, method_name, options = {}) @interface_name = interface_name @method_name = method_name @arguments = options[:arguments] || [] @return_value = options[:return_value] + @specifications = {} end def fully_described_by?(interaction) [:interface_name, :method_name, :arguments, :return_value].select do |attribute| return false if interaction.send(attribute) != send(attribute) end + @specifications.each do |name, specification| + unless specification.fully_described_by? interaction.specifications[name] + return false + end + end true end end
Add specification checking to interface comparison logic
diff --git a/lita-imgflip.gemspec b/lita-imgflip.gemspec index abc1234..def5678 100644 --- a/lita-imgflip.gemspec +++ b/lita-imgflip.gemspec @@ -17,7 +17,7 @@ spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake" - spec.add_development_dependency "rspec", "~> 2.14" + spec.add_development_dependency "rspec", ">= 3.0.0.beta1" spec.add_development_dependency "simplecov" spec.add_development_dependency "coveralls" end
Update rspec requirement to 3.0.0.beta1.
diff --git a/app/helpers/date_helper.rb b/app/helpers/date_helper.rb index abc1234..def5678 100644 --- a/app/helpers/date_helper.rb +++ b/app/helpers/date_helper.rb @@ -35,6 +35,6 @@ def zero_pad(value) return value unless value =~ /^\d$/ - format("%02d", value) + sprintf("%02d", value) # rubocop:disable Style/FormatString end end
Fix buggy auto-correct for 'format' method Previously we changed to use the Kernel 'format' method, but this conflicts with an app-specific 'format' method. This switches to using 'sprintf' and disables the associated Cop. Unfortantely the term 'format' is too prevalent in this app to rename the method.
diff --git a/app/helpers/yelp_helper.rb b/app/helpers/yelp_helper.rb index abc1234..def5678 100644 --- a/app/helpers/yelp_helper.rb +++ b/app/helpers/yelp_helper.rb @@ -34,15 +34,17 @@ # sort: '2' # } - p "PEEING OUT PARAMS" p params p location @response = Yelp.client.search(location, params) @chosen_restaurant = @response.businesses.sample - #TODO FIX PHONE NUMBER ISSUE + @response.businesses.each do |business| + p business.phone + end + @chosen_restaurant_details = { "name" => @chosen_restaurant.name, - # "phone" => @chosen_restaurant.phone, + "phone" => @chosen_restaurant.phone, "address" => @chosen_restaurant.location.address[0] } p "chosen restaurent details: #{@chosen_restaurant_details}"
Add debugging code for phone number
diff --git a/lib/frontend_server.rb b/lib/frontend_server.rb index abc1234..def5678 100644 --- a/lib/frontend_server.rb +++ b/lib/frontend_server.rb @@ -50,10 +50,10 @@ end def boot! - @config = OpenStruct.new(YAML.load(ERB.new(File.read("#{root}/config/application.yml")).result)[env]) + @config = OpenStruct.new(YAML.load(ERB.new(File.read("#{root}/config/settings.yml")).result)[env]) begin - require "#{root}/config/environment.rb" + require "#{root}/config/application.rb" # Now require the individual enviroment files # that can be used to add middleware and all the
Reorganize for heroku build pack
diff --git a/app/models/news_archive.rb b/app/models/news_archive.rb index abc1234..def5678 100644 --- a/app/models/news_archive.rb +++ b/app/models/news_archive.rb @@ -11,11 +11,12 @@ end def find_years - @years = @entries.map {|e| e.created_at.year }.uniq + @years = @entries.map {|e| e.created_at.year }.uniq.sort.reverse end def find_months_for_year(year) - @entries.select {|e| e.created_at.year == year }.map {|ey| ey.created_at.month }.uniq + @entries.select {|e| e.created_at.year == year }. + map {|e| e.created_at.month }.uniq.sort.reverse end def years_with_months
Fix sorting issues for months and years
diff --git a/app/models/select_facet.rb b/app/models/select_facet.rb index abc1234..def5678 100644 --- a/app/models/select_facet.rb +++ b/app/models/select_facet.rb @@ -12,6 +12,11 @@ value: allowed_value['value'], label: allowed_value['label'], id: allowed_value['value'], + data_attributes: { + track_category: "filterClicked", + track_action: name, + track_label: allowed_value['label'], + }, checked: selected_values.include?(allowed_value), } end
Add tracking to option select filters
diff --git a/app/models/select_facet.rb b/app/models/select_facet.rb index abc1234..def5678 100644 --- a/app/models/select_facet.rb +++ b/app/models/select_facet.rb @@ -4,10 +4,10 @@ def options allowed_values.map do | allowed_value | { - "value" => allowed_value.value, - "label" => allowed_value.label, - "id" => allowed_value.value, - "checked" => selected_values.include?(allowed_value), + value: allowed_value.value, + label: allowed_value.label, + id: allowed_value.value, + checked: selected_values.include?(allowed_value), } end end
Use symbols, not strings, for component object keys We should only use one style of keys for objects used in components, to avoid reduce confusion when using components. Consistency is good. After discussion with @edds we agreed to use symbols as this makes more sense in a ruby/rails environment. The first step was to support both, as clients of those components will still be sending string key'd objects and can't be updated at the time as this app, so we have to; 1. Support both kinds of keys on components that expect strings 2. Update clients sending string keys to use symbols instead 3. Remove support for string keys from those components This PR is step 2. for `options_select`, but also needs doing in `manuals-frontend` for `previous_and_next_navigation`. Step 1 is: https://github.com/alphagov/static/pull/601
diff --git a/lib/openlogi/client.rb b/lib/openlogi/client.rb index abc1234..def5678 100644 --- a/lib/openlogi/client.rb +++ b/lib/openlogi/client.rb @@ -30,6 +30,10 @@ @shipments ||= Api::Shipments.new(self) end + def validations + @validations ||= Api::Validations.new(self) + end + extend Forwardable def_delegators :configuration, :access_token, :test_mode end
Add validations method for shortcut
diff --git a/test/unit/basic_test.rb b/test/unit/basic_test.rb index abc1234..def5678 100644 --- a/test/unit/basic_test.rb +++ b/test/unit/basic_test.rb @@ -19,14 +19,14 @@ client.use_oauth2_auth = use_auth %i[get delete head].each do |method| stub = stub_request(method, /feed-test/).to_timeout - assert_raise RestClient::RequestTimeout do + assert_raise(RestClient::RequestTimeout, RestClient::Exceptions::OpenTimeout) do client.send(method, stubbed_path, format_headers) assert_requested stub end end %i[post put patch].each do |method| stub = stub_request(method, /feed-test/).to_timeout - assert_raise RestClient::RequestTimeout do + assert_raise(RestClient::RequestTimeout, RestClient::Exceptions::OpenTimeout) do client.send(method, stubbed_path, FHIR::Patient.new, format_headers) assert_requested stub end
Test handles multiple exception types depending on version of RestClient.
diff --git a/lib/ppcurses/Screen.rb b/lib/ppcurses/Screen.rb index abc1234..def5678 100644 --- a/lib/ppcurses/Screen.rb +++ b/lib/ppcurses/Screen.rb @@ -61,7 +61,7 @@ cbreak start_color - yield + return yield rescue SystemExit, Interrupt # Empty Catch block so ruby doesn't puke out
Return the response from yield
diff --git a/amakanize.gemspec b/amakanize.gemspec index abc1234..def5678 100644 --- a/amakanize.gemspec +++ b/amakanize.gemspec @@ -12,8 +12,6 @@ spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } - spec.bindir = "exe" - spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] spec.required_ruby_version = ">= 2.2.2"
Remove unused configuration about executables
diff --git a/lib/ethon/easy/mirror.rb b/lib/ethon/easy/mirror.rb index abc1234..def5678 100644 --- a/lib/ethon/easy/mirror.rb +++ b/lib/ethon/easy/mirror.rb @@ -10,7 +10,7 @@ end def self.informations_to_log - [:url, :response_code, :return_code, :total_time] + [:effective_url, :response_code, :return_code, :total_time] end def self.from_easy(easy)
Use effective_url instead of url for logging Whenever I look at logs from ethon, I get something like ```performed EASY url= response_code=200 return_code=ok total_time=0.28435``` . I'm on OSX, ethon version 0.7. This seems to fix it so that I can see the url in my logs ```EASY effective_url=http://www.example.com response_code=200 return_code=ok total_time=0.28435```- although I don't know whether there's a better solution.
diff --git a/lib/sweep/scheduler.rb b/lib/sweep/scheduler.rb index abc1234..def5678 100644 --- a/lib/sweep/scheduler.rb +++ b/lib/sweep/scheduler.rb @@ -10,18 +10,19 @@ @tasks.size end - def scheduleAlive(ip) + def scheduleAlive(host) end - def scheduleTcp(ip) + def scheduleTcp(host) end - def scheduleUdp(ip) + def scheduleUdp(host) end - def scheduleModule(ip, proto, port) + def scheduleCheck(host, proto, port) + add( { :host => host, :proto => proto, :port => port } ) end def seed(ips)
Clarify scheduling of different types of tasks.
diff --git a/lib/lifx/light_target.rb b/lib/lifx/light_target.rb index abc1234..def5678 100644 --- a/lib/lifx/light_target.rb +++ b/lib/lifx/light_target.rb @@ -1,7 +1,7 @@ module LIFX module LightTarget MSEC_PER_SEC = 1000 - def set_color(color, duration = LIFX::Config.default_duration) + def set_color(color, duration: LIFX::Config.default_duration) queue_write(payload: Protocol::Light::Set.new( color: color.to_hsbk, duration: (duration * MSEC_PER_SEC).to_i,
Use keyword arguments for set_color
diff --git a/lita-vkontakte.gemspec b/lita-vkontakte.gemspec index abc1234..def5678 100644 --- a/lita-vkontakte.gemspec +++ b/lita-vkontakte.gemspec @@ -22,6 +22,6 @@ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ['lib'] - spec.add_development_dependency 'bundler', '~> 1.9' + spec.add_development_dependency 'bundler', '~> 1.7' spec.add_development_dependency 'rake', '~> 10.0' end
Fix Bundler version (~> 1.7)
diff --git a/Casks/bettertouchtool.rb b/Casks/bettertouchtool.rb index abc1234..def5678 100644 --- a/Casks/bettertouchtool.rb +++ b/Casks/bettertouchtool.rb @@ -7,8 +7,8 @@ # bettertouchtool.com is the official download host per the vendor homepage url "http://bettertouchtool.net/btt#{version}.zip" else - version '1.19' - sha256 'a246cf37c0fe5142ebc52fb99c54ab3ed2e261dccbf45b486575139fe1184675' + version '1.20' + sha256 'd1e03b7f8210e5d36ea9ae1ce4afe0eecd29f5c768b8ab1245e6882bde3b98f2' url "http://boastr.net/releases/btt#{version}.zip" end
Update Better Touch Tool to 1.20
diff --git a/Casks/opera-developer.rb b/Casks/opera-developer.rb index abc1234..def5678 100644 --- a/Casks/opera-developer.rb +++ b/Casks/opera-developer.rb @@ -1,6 +1,6 @@ cask :v1 => 'opera-developer' do - version '30.0.1835.5' - sha256 'f4a8cd8860ac2836b420b9f0456b50629759465eba91bf472a30d529815ba0fa' + version '31.0.1857.0' + sha256 '5cc4e281b9eefa679640acdbc7cf1a928c5758c3a1e2984acb5a682bd591952b' url "http://get.geo.opera.com/pub/opera-developer/#{version}/mac/Opera_Developer_#{version}_Setup.dmg" homepage 'http://www.opera.com/developer'
Upgrade Opera Developer.app to v31.0.1857.0
diff --git a/lib/socializer/engine.rb b/lib/socializer/engine.rb index abc1234..def5678 100644 --- a/lib/socializer/engine.rb +++ b/lib/socializer/engine.rb @@ -24,7 +24,7 @@ initializer "webpacker.proxy" do |app| insert_middleware = begin - Socializer.webpacker.config.dev_server.present? + Socializer.webpacker.config.dev_server.present? rescue nil end
Layout/IndentationWidth: Use 2 (not 4) spaces for indentation.
diff --git a/Casks/remote-desktop-manager.rb b/Casks/remote-desktop-manager.rb index abc1234..def5678 100644 --- a/Casks/remote-desktop-manager.rb +++ b/Casks/remote-desktop-manager.rb @@ -1,9 +1,9 @@ cask :v1 => 'remote-desktop-manager' do - version '1.1.11.0' - sha256 'f5e9ec3d2a3bea912e1686ee167f4dcca5643d504fd1cac49381eaf446e5f82d' + version '2.0.4.0' + sha256 'd5ba2c9c7242fcc55245ba39558d30de24ed27c2bff9e11a78753e2ff5e90fce' # devolutions.net is the official download host per the vendor homepage - url "http://download.devolutions.net/Mac/Devolutions.RemoteDesktopManager.Mac.#{version}.dmg" + url "http://cdn.devolutions.net/download/Mac/Devolutions.RemoteDesktopManager.Mac.#{version}.dmg" name 'Remote Desktop Manager' homepage 'http://mac.remotedesktopmanager.com/' license :gratis
Upgrade Remote Desktop Manager to version 2.0.4.0 Fixed newline at end of file.
diff --git a/Library/Formula/oxygen-icons.rb b/Library/Formula/oxygen-icons.rb index abc1234..def5678 100644 --- a/Library/Formula/oxygen-icons.rb +++ b/Library/Formula/oxygen-icons.rb @@ -1,9 +1,9 @@ require 'formula' class OxygenIcons <Formula - url 'ftp://ftp.kde.org/pub/kde/stable/4.4.0/src/oxygen-icons-4.4.0.tar.bz2' + url 'ftp://ftp.kde.org/pub/kde/stable/4.4.1/src/oxygen-icons-4.4.1.tar.bz2' homepage 'http://www.oxygen-icons.org/' - md5 'fbcd429cc822cb88a815d97a4e66be4d' + md5 '9e91b94f2e743d5dc0bd740ed0acb025' depends_on 'cmake'
Update Oxygen icons to 4.4.1.
diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb index abc1234..def5678 100644 --- a/config/initializers/sidekiq.rb +++ b/config/initializers/sidekiq.rb @@ -1,5 +1,3 @@-require 'sidekiq/middleware/i18n' - host = ENV.fetch('REDIS_HOST') { 'localhost' } port = ENV.fetch('REDIS_PORT') { 6379 } password = ENV.fetch('REDIS_PASSWORD') { false }
Remove unnecessary library from configuration
diff --git a/config/initializers/statsd.rb b/config/initializers/statsd.rb index abc1234..def5678 100644 --- a/config/initializers/statsd.rb +++ b/config/initializers/statsd.rb @@ -3,7 +3,7 @@ require "datadog/statsd" class StubStatsd - def increment; end + def increment(stat, opts={}); end end module GitHubClassroom
Change increment method signature to match actual signature
diff --git a/app/models/promotion_spend_condition.rb b/app/models/promotion_spend_condition.rb index abc1234..def5678 100644 --- a/app/models/promotion_spend_condition.rb +++ b/app/models/promotion_spend_condition.rb @@ -6,6 +6,10 @@ metadata(:config) do float :amount, :required => true, :greater_than => 0, :default => 0 + end + + def amount_and_kind + SpookAndPuff::Money.new(amount.to_s) end def check(order)
Fix summarising mimimum spend condition.
diff --git a/Casks/navicat-for-sql-server.rb b/Casks/navicat-for-sql-server.rb index abc1234..def5678 100644 --- a/Casks/navicat-for-sql-server.rb +++ b/Casks/navicat-for-sql-server.rb @@ -1,6 +1,6 @@ cask :v1 => 'navicat-for-sql-server' do - version '11.1.7' - sha256 '6f3d7e13d929395f92ccf040867fa80b3cf29651070a6473ed574da76fbb461e' + version '11.1.9' + sha256 'e4024315d51ccd42aac5bf65754f9bb7b6bb11692e8013df744fe25db9cded40' url "http://download.navicat.com/download/navicat#{version.sub(%r{^(\d+)\.(\d+).*},'\1\2')}_sqlserver_en.dmg" name 'Navicat for SQL Server'
Update Navicat for SQL Server to 11.1.9
diff --git a/app/presenters/renalware/medications/treatable_presenter.rb b/app/presenters/renalware/medications/treatable_presenter.rb index abc1234..def5678 100644 --- a/app/presenters/renalware/medications/treatable_presenter.rb +++ b/app/presenters/renalware/medications/treatable_presenter.rb @@ -4,7 +4,7 @@ module Medications class TreatablePresenter < DumbDelegator def sortable? - __getobj__.class == Patient + is_a?(Patient) end end end
Use more intention revealing predicate
diff --git a/app/models/url.rb b/app/models/url.rb index abc1234..def5678 100644 --- a/app/models/url.rb +++ b/app/models/url.rb @@ -3,7 +3,7 @@ :address, :name - validates_format_of :address, with: %r[https?://.+] + validates_format_of :address, with: %r[\Ahttps?://.+] validates_uniqueness_of :address has_many :snapshots
Improve Url address format validation By anchoring our regex at the beginning of the string, we prevent possibly incorrect addresses from slipping through the cracks. Change-Id: Ied867410dcb37d99f0a7c5fe3d435b7b26bbded8
diff --git a/app/forms/search_form.rb b/app/forms/search_form.rb index abc1234..def5678 100644 --- a/app/forms/search_form.rb +++ b/app/forms/search_form.rb @@ -0,0 +1,11 @@+class SearchForm < Reform::Form + property :q + + def initialize + super(OpenStruct.new) + end + + def self.property(name, options={}) + super(name, options.merge(virtual: true)) + end +end
Use a form object for search form
diff --git a/app/jobs/push_job.rb b/app/jobs/push_job.rb index abc1234..def5678 100644 --- a/app/jobs/push_job.rb +++ b/app/jobs/push_job.rb @@ -9,6 +9,11 @@ end def perform(post) + unless post.present? + logger.error('the post does not exist') + return + end + if post.stale? logger.warn('post is stale; skipping') return
Check post existence before processing
diff --git a/db/migrate/20210312061725_add_replica_identity_for_roles.rb b/db/migrate/20210312061725_add_replica_identity_for_roles.rb index abc1234..def5678 100644 --- a/db/migrate/20210312061725_add_replica_identity_for_roles.rb +++ b/db/migrate/20210312061725_add_replica_identity_for_roles.rb @@ -0,0 +1,32 @@+# frozen_string_literal: true +# +# Copyright (C) 2021 - present Instructure, Inc. +# +# This file is part of Canvas. +# +# Canvas is free software: you can redistribute it and/or modify it under +# the terms of the GNU Affero General Public License as published by the Free +# Software Foundation, version 3 of the License. +# +# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more +# details. +# +# You should have received a copy of the GNU Affero General Public License along +# with this program. If not, see <http://www.gnu.org/licenses/>. + +class AddReplicaIdentityForRoles < ActiveRecord::Migration[6.0] + tag :postdeploy + disable_ddl_transaction! + + def up + add_replica_identity 'Role', :root_account_id, 0 + remove_index :roles, column: :root_account_id, if_exists: true + end + + def down + add_index :roles, :root_account_id, algorithm: :concurrently, if_not_exists: true + remove_replica_identity 'Role' + end +end
Set up replica identity index for Role refs FOO-1171 flag=none test plan: - migration works up and down - tests pass Change-Id: I3a45025a1b8f178de84d9511b0efe56546d701f1 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260530 Tested-by: Service Cloud Jenkins <9144042a601061f88f1e1d7a1753ea3e2972119d@instructure.com> Reviewed-by: Cody Cutrer <c4fe2b1d90ef8f2548c8aeabfa633434316f0305@instructure.com> QA-Review: Cody Cutrer <c4fe2b1d90ef8f2548c8aeabfa633434316f0305@instructure.com> Product-Review: Cody Cutrer <c4fe2b1d90ef8f2548c8aeabfa633434316f0305@instructure.com>
diff --git a/fixture_dependencies.gemspec b/fixture_dependencies.gemspec index abc1234..def5678 100644 --- a/fixture_dependencies.gemspec +++ b/fixture_dependencies.gemspec @@ -5,7 +5,7 @@ s.email = "code@jeremyevans.net" s.platform = Gem::Platform::RUBY s.summary = "Sequel/ActiveRecord fixture loader that handles dependency graphs" - s.files = ["README.md", "MIT-LICENSE", "lib/fixture_dependencies.rb", "lib/fixture_dependencies_test_help.rb", "lib/fixture_dependencies/sequel.rb", "lib/fixture_dependencies/active_record.rb", "lib/fixture_dependencies/minitest_spec.rb", "lib/fixture_dependencies/minitest_spec/sequel.rb", "lib/fixture_dependencies/test_unit.rb", "lib/fixture_dependencies/test_unit/rails.rb", "lib/fixture_dependencies/test_unit/sequel.rb", "lib/fixture_dependencies/rspec/sequel.rb"] + s.files = ["README.md", "MIT-LICENSE"] + Dir['lib/**/*.rb'] s.extra_rdoc_files = ["MIT-LICENSE"] s.require_paths = ["lib"] s.has_rdoc = true
Use a glob instead of specifically loading each lib file This should prevent future issues with missing lib files.
diff --git a/spec/use_cases/check_assignments/remind_pending_check_assignment_spec.rb b/spec/use_cases/check_assignments/remind_pending_check_assignment_spec.rb index abc1234..def5678 100644 --- a/spec/use_cases/check_assignments/remind_pending_check_assignment_spec.rb +++ b/spec/use_cases/check_assignments/remind_pending_check_assignment_spec.rb @@ -0,0 +1,83 @@+require "rails_helper" + +describe CheckAssignments::RemindPendingCheckAssignment do + include RepositoriesHelpers + + let(:service) { described_class.new(project_check) } + let(:user) { double(:user, id: 1, email: "john@doe.pl") } + let(:check_assignment) do + double(:check_assignment, + id: 1, user_id: 1, project_check_id: 1, completion_date: nil, + created_at: nil + ) + end + let(:users_repository) { create_repository(user) } + + let(:project_check) do + double(:project_check, id: 1, created_at: Time.current, reminder_id: 1) + end + + let(:reminders_repository) { create_repository(reminder) } + + describe "#perform" do + before do + check_assignments_repository.stub(:latest_assignment) do + check_assignments_repository.all.last + end + service.check_assignments_repository = check_assignments_repository + service.users_repository = users_repository + end + + after do + service.call + end + + context "when check has no one assigned" do + let(:check_assignments_repository) { create_repository } + + it "doesn't send any reminder" do + expect(UserReminderMailer).to_not receive(:check_assignment_remind) + end + end + + context "when check has assigned user today" do + let(:check_assignments_repository) { create_repository(check_assignment) } + + before do + check_assignment.stub(:created_at) { Time.current } + end + + it "doesn't send any reminder" do + expect(UserReminderMailer).to_not receive(:check_assignment_remind) + end + end + + context "when check has assigned user 15 days ago" do + let(:check_assignments_repository) { create_repository(check_assignment) } + + before do + check_assignment.stub(:created_at) { 15.days.ago } + UserReminderMailer.stub_chain(:check_assignment_remind, :deliver) + end + + it "sends reminder" do + expect(UserReminderMailer).to receive(:check_assignment_remind) + end + end + + context "when check has completion_date" do + let(:check_assignments_repository) { create_repository(check_assignment) } + + before do + check_assignment.stub(:created_at) { 15.days.ago } + check_assignment.stub(:completion_date) { Time.current } + + UserReminderMailer.stub_chain(:check_assignment_remind, :deliver) + end + + it "doesn't send any reminder" do + expect(UserReminderMailer).to_not receive(:check_assignment_remind) + end + end + end +end
Add specs for `RemindPendingCheckAssignment` service
diff --git a/spec/controllers/spree/products_controller_spec.rb b/spec/controllers/spree/products_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/spree/products_controller_spec.rb +++ b/spec/controllers/spree/products_controller_spec.rb @@ -16,13 +16,9 @@ allow(controller).to receive(:before_save_new_order) allow(controller).to receive(:spree_current_user) { user } allow(user).to receive(:has_spree_role?) { false } - if SolidusSupport.solidus_gem_version < Gem::Version.new('2.5.x') + + expect { get :show, params: { id: product.to_param } - expect(response.status).to eq(404) - else - expect { - get :show, params: { id: product.to_param } - }.to raise_error(ActiveRecord::RecordNotFound) - end + }.to raise_error(ActiveRecord::RecordNotFound) end end
Remove code for Soldius 2.5 is specs
diff --git a/lib/gearman.rb b/lib/gearman.rb index abc1234..def5678 100644 --- a/lib/gearman.rb +++ b/lib/gearman.rb @@ -16,23 +16,33 @@ data ].join - socket = TCPSocket.new('localhost', '4730') + begin + socket = TCPSocket.new('localhost', '4730') + rescue => e + abort 'Could not open connection to gearman server' + end + header = '' body = '' begin - Timeout::timeout(10) do - socket.write(echo_req_packet) + _, write_select = IO::select([], [socket]) + if write_socket = write_select[0] + write_socket.write(echo_req_packet) + end - while header.size < 12 do - IO::select([socket]) or break - header += socket.readpartial(12 - header.size) + while header.size < 12 do + read_select, _ = IO::select([socket]) + if read_socket = read_select[0] + header += read_socket.readpartial(12) end + end - magic, type, size = header.unpack(UNPACK) + magic, type, size = header.unpack(UNPACK) - while body.size < size do - IO::select([socket]) or break + while body.size < size do + read_select, _ = IO::select([socket]) + if read_socket = read_select[0] body += socket.readpartial(size - body.size) end end
Remove timeout, rescue socket connection failures.
diff --git a/lib/keyring.rb b/lib/keyring.rb index abc1234..def5678 100644 --- a/lib/keyring.rb +++ b/lib/keyring.rb @@ -5,7 +5,7 @@ attr_accessor :keys, :path, :name def initialize(name, path, keys = []) - @name = name + @name = name.to_s @path = path @keys = keys end @@ -28,13 +28,13 @@ def save(key, value) keychain = OSXKeychain.new - keychain[self.class.keychain_prefix + name.to_s, key] = value + keychain[self.class.keychain_prefix + name, key] = value end def keychain_data keychain = OSXKeychain.new Hash[ - @keys.map { |key| [key, keychain[self.class.keychain_prefix + name.to_s, key]] } + @keys.map { |key| [key, keychain[self.class.keychain_prefix + name, key]] } ] end end
[Keyring] Transform name to a string upon initialization
diff --git a/spec/scenario/config/initializers/session_store.rb b/spec/scenario/config/initializers/session_store.rb index abc1234..def5678 100644 --- a/spec/scenario/config/initializers/session_store.rb +++ b/spec/scenario/config/initializers/session_store.rb @@ -6,3 +6,4 @@ # which shouldn't be used to store highly confidential information # (create the session table with "rake db:sessions:create") Scenario::Application.config.session_store :active_record_store +Rails.logger.class.include ActiveSupport::LoggerSilence
Work around lack of logger silence
diff --git a/app/controllers/api/donations_controller.rb b/app/controllers/api/donations_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/donations_controller.rb +++ b/app/controllers/api/donations_controller.rb @@ -1,6 +1,9 @@ class Api::DonationsController < ApplicationController respond_to :json + # Fetches the sum of all donations (one off and recurring) for a given date range + # If a date range is not provided, it will default to donations in the current + # calendar month def total params.permit(:start, :end) start_date = params.fetch(:start, Date.today.beginning_of_month).to_date
[skip ci] Add documentation comment to donations controller
diff --git a/app/services/results/fill_event_template.rb b/app/services/results/fill_event_template.rb index abc1234..def5678 100644 --- a/app/services/results/fill_event_template.rb +++ b/app/services/results/fill_event_template.rb @@ -24,9 +24,9 @@ ranked_efforts = event.efforts.ranked_with_status if event.laps_unlimited? - ranked_efforts.select(&:overall_rank) + ranked_efforts.select(&:beyond_start?) else - ranked_efforts.select(&:finished) + ranked_efforts.select(&:finished?) end end
Fix N+1 query problem in FillEventTemplate class
diff --git a/lib/flavors/preferences/preferences.rb b/lib/flavors/preferences/preferences.rb index abc1234..def5678 100644 --- a/lib/flavors/preferences/preferences.rb +++ b/lib/flavors/preferences/preferences.rb @@ -9,6 +9,10 @@ has_many :preferences, :as => :prefered, :class_name => "::Flavors::Preference" define_method(name) do + read_preference(name, options[:default]) + end + + define_method("#{name}?") do read_preference(name, options[:default]) end
Support Ruby naming convention for boolean getter procedures
diff --git a/app/admin/photos.rb b/app/admin/photos.rb index abc1234..def5678 100644 --- a/app/admin/photos.rb +++ b/app/admin/photos.rb @@ -23,11 +23,15 @@ link_to(photo.user.id, admin_user_path(photo.user)) end column :poi do |photo| - span do - [ - link_to(photo.poi.headline, admin_poi_path(photo.poi)), - link_to('Map', node_path(photo.poi)) - ].join(',<br/>').html_safe + if photo.poi.present? + span do + [ + link_to(photo.poi.headline, admin_poi_path(photo.poi)), + link_to('Map', node_path(photo.poi)) + ].join(',<br/>').html_safe + end + else + "MISSING" end end column :taken_at
Fix list of fotos in admin backend.
diff --git a/lib/smartdown/api/previous_question.rb b/lib/smartdown/api/previous_question.rb index abc1234..def5678 100644 --- a/lib/smartdown/api/previous_question.rb +++ b/lib/smartdown/api/previous_question.rb @@ -5,7 +5,7 @@ def_delegators :@question, :title, :options - attr_reader :response + attr_reader :response, :question def initialize(elements, response) @response = response
Make question available on previousquestion
diff --git a/app/lib/services.rb b/app/lib/services.rb index abc1234..def5678 100644 --- a/app/lib/services.rb +++ b/app/lib/services.rb @@ -15,6 +15,9 @@ end def self.link_checker_api - @link_checker_api ||= GdsApi::LinkCheckerApi.new(Plek.new.find("link-checker-api")) + @link_checker_api ||= GdsApi::LinkCheckerApi.new( + Plek.new.find("link-checker-api"), + bearer_token: ENV['LINK_CHECKER_API_BEARER_TOKEN'], + ) end end
Add bearer tokens for link-checker-api authentication
diff --git a/lib/tasks/sample_data/group_factory.rb b/lib/tasks/sample_data/group_factory.rb index abc1234..def5678 100644 --- a/lib/tasks/sample_data/group_factory.rb +++ b/lib/tasks/sample_data/group_factory.rb @@ -10,19 +10,21 @@ return if EnterpriseGroup.where(name: "Producer group").exists? create_group( - name: "Producer group", - owner: enterprises.first.owner, - on_front_page: true, - description: "The seed producers", - address: "6 Rollings Road, Upper Ferntree Gully, 3156" + { + name: "Producer group", + owner: enterprises.first.owner, + on_front_page: true, + description: "The seed producers" + }, + "6 Rollings Road, Upper Ferntree Gully, 3156" ) end private - def create_group(params) + def create_group(params, group_address) group = EnterpriseGroup.new(params) - group.address = address(params[:address]) + group.address = address(group_address) group.enterprises = enterprises group.save! end
Fix group factory in rails 4 params[:address] was breaking the creation of the EnterpriseGroup
diff --git a/app/models/spree/license_key.rb b/app/models/spree/license_key.rb index abc1234..def5678 100644 --- a/app/models/spree/license_key.rb +++ b/app/models/spree/license_key.rb @@ -5,6 +5,8 @@ belongs_to :license_key_type, :class_name => "Spree::LicenseKeyType" attr_accessible :license_key, :inventory_unit_id, :variant_id + + scope :available, where(inventory_unit_id: nil) def self.assign_license_keys!(inventory_unit) transaction do
Add a scope for available Change-Id: I772a38d9b50dfbe763e3a5653512becc7ffaee1a
diff --git a/app/observers/cache_observer.rb b/app/observers/cache_observer.rb index abc1234..def5678 100644 --- a/app/observers/cache_observer.rb +++ b/app/observers/cache_observer.rb @@ -16,7 +16,7 @@ # Expires all cached data. def self.expire_all logit "invoked" - Rails.cache.delete_matched(//) + Rails.cache.clear end #---[ Triggers ]--------------------------------------------------------
Update cache clearing for Rails 3
diff --git a/app/validators/run_validator.rb b/app/validators/run_validator.rb index abc1234..def5678 100644 --- a/app/validators/run_validator.rb +++ b/app/validators/run_validator.rb @@ -24,7 +24,9 @@ # Embeds break for URLs like https://www.twitch.tv/videos/29447340?filter=highlights&sort=time, which is what Twitch # gives you when you copy the link given by the highlights page for a channel. - record.video_url = URI(record.video_url).tap { |u| u.query = nil }.to_s + if URI.parse(record.video_url).host.match?(/^(www\.)?(twitch\.tv)$/) + record.video_url = URI(record.video_url).tap { |u| u.query = nil }.to_s + end rescue URI::InvalidURIError record.errors[:base] << 'Your video URL must be a link to a Twitch or YouTube video.' end
Fix a bug where YouTube video URLs get cut off
diff --git a/lib/adsf/rack/index_file_finder.rb b/lib/adsf/rack/index_file_finder.rb index abc1234..def5678 100644 --- a/lib/adsf/rack/index_file_finder.rb +++ b/lib/adsf/rack/index_file_finder.rb @@ -1,9 +1,9 @@ module Adsf::Rack class IndexFileFinder - def initialize(app, options) + def initialize(app, root:, index_filenames: ['index.html']) @app = app - (@root = options[:root]) || raise(ArgumentError, ':root option is required but was not given') - @index_filenames = options[:index_filenames] || ['index.html'] + @root = root + @index_filenames = index_filenames end def call(env)
Refactor: Use keyword args in IndexFileFinder
diff --git a/lib/asciidoctor/doctest/version.rb b/lib/asciidoctor/doctest/version.rb index abc1234..def5678 100644 --- a/lib/asciidoctor/doctest/version.rb +++ b/lib/asciidoctor/doctest/version.rb @@ -1,5 +1,5 @@ module Asciidoctor module DocTest - VERSION = '1.5.1.2' + VERSION = '1.5.2.dev' end end
Prepare for next development iteration
diff --git a/lib/brightbox-cli/firewall_rule.rb b/lib/brightbox-cli/firewall_rule.rb index abc1234..def5678 100644 --- a/lib/brightbox-cli/firewall_rule.rb +++ b/lib/brightbox-cli/firewall_rule.rb @@ -21,12 +21,9 @@ def to_row attrs = attributes - attrs[:protocol] = attributes[:protocol] || '-' - attrs[:source] = attributes[:source] || '-' - attrs[:sport] = attributes[:sport] || '-' - attrs[:destination] = attributes[:destination] || '-' - attrs[:dport] = attributes[:dport] || '-' - attrs[:icmp_type] = attributes[:icmp_type] || '-' + [:protocol,:source,:sport, :destination, :dport, :icmp_type].each do |key| + attrs[key] = attributes[key] || '-' + end attrs end
Use loop rather than assigning defaults one by one
diff --git a/matrix.gemspec b/matrix.gemspec index abc1234..def5678 100644 --- a/matrix.gemspec +++ b/matrix.gemspec @@ -4,20 +4,21 @@ require 'matrix/version' Gem::Specification.new do |spec| - spec.name = "matrix" + spec.name = 'matrix' spec.version = Matrix::VERSION - spec.authors = ["Dane Guevara"] - spec.email = ["dane.guevara@cerner.com"] - spec.summary = %q{TODO: Write a short summary. Required.} - spec.description = %q{TODO: Write a longer description. Optional.} - spec.homepage = "" - spec.license = "MIT" + spec.authors = ['Dane Guevara'] + spec.email = ['rainerdane.guevara@gmail.com'] + spec.summary = %q{Solution to HackerRank matrix challenege.} + spec.description = %q{Classes used to build a network of cities, roads, and machines to find the minimum cost to isolate machines.} + spec.homepage = '' + spec.license = 'MIT' spec.files = `git ls-files -z`.split("\x0") spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) - spec.require_paths = ["lib"] + spec.require_paths = ['lib'] - spec.add_development_dependency "bundler", "~> 1.6" - spec.add_development_dependency "rake" + spec.add_development_dependency 'bundler', '~> 1.6' + spec.add_development_dependency 'rake' + spec.add_runtime_dependency 'activesupport', '~> 4.1.6' end
Update gemspec and add runtime dependency for activesupport.
diff --git a/proxy_fetcher.gemspec b/proxy_fetcher.gemspec index abc1234..def5678 100644 --- a/proxy_fetcher.gemspec +++ b/proxy_fetcher.gemspec @@ -18,7 +18,7 @@ gem.license = 'MIT' gem.required_ruby_version = '>= 2.0.0' - gem.add_runtime_dependency 'http', '~> 3.0' + gem.add_runtime_dependency 'http', '>= 3', '< 5' gem.add_development_dependency 'rake', '>= 12.0' gem.add_development_dependency 'rspec', '~> 3.5'
Update http requirement from ~> 3.0 to >= 3, < 5 Updates the requirements on [http](https://github.com/httprb/http) to permit the latest version. - [Release notes](https://github.com/httprb/http/releases) - [Changelog](https://github.com/httprb/http/blob/master/CHANGES.md) - [Commits](https://github.com/httprb/http/compare/v3.0.0...v4.1.1) Signed-off-by: dependabot[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>
diff --git a/lib/specinfra/command/freebsd10.rb b/lib/specinfra/command/freebsd10.rb index abc1234..def5678 100644 --- a/lib/specinfra/command/freebsd10.rb +++ b/lib/specinfra/command/freebsd10.rb @@ -8,6 +8,14 @@ "pkg info #{escape(package)}" end end + + def install(package) + "pkg install -y #{package}" + end + + def get_package_version(package, opts=nil) + "pkg query %v #{escape(package)}" + end end end end
Add install and get_package_version for FreeBSD10 like 34a45cf and 7c2a3da
diff --git a/lib/vault/rails/json_serializer.rb b/lib/vault/rails/json_serializer.rb index abc1234..def5678 100644 --- a/lib/vault/rails/json_serializer.rb +++ b/lib/vault/rails/json_serializer.rb @@ -7,13 +7,13 @@ }.freeze def self.encode(raw) - self._init! + _init! JSON.fast_generate(raw) end def self.decode(raw) - self._init! + _init! return nil if raw == nil || raw == ""
Remove superfluous self in JSONSerializer
diff --git a/lib/writer/overwrite_prevention.rb b/lib/writer/overwrite_prevention.rb index abc1234..def5678 100644 --- a/lib/writer/overwrite_prevention.rb +++ b/lib/writer/overwrite_prevention.rb @@ -1,6 +1,6 @@ module Writer class OverwritePrevention - def self.adjust_name(name) + def self.adjust(name) count = 1 while File.exists?(name)
Change name of adjust method
diff --git a/test/functional/admin/transactions_controller_test.rb b/test/functional/admin/transactions_controller_test.rb index abc1234..def5678 100644 --- a/test/functional/admin/transactions_controller_test.rb +++ b/test/functional/admin/transactions_controller_test.rb @@ -4,7 +4,10 @@ setup do stub_request(:delete, "#{Plek.current.find("arbiter")}/slugs/test").to_return(:status => 200) - stub_request(:get, "#{Plek.current.find("arbiter")}/artefacts/test.js").to_return(:status => 200, :body => '{"name":"FOOOO"}') + panopticon_has_metadata( + "id" => "test", + "name" => "FOOOO" + ) login_as_stub_user @transaction = Transaction.create!(:name => "test", :slug=>"test") end
Move one more test over to use panopticon_has_metadata
diff --git a/config/initializers/ruby_22_polyfill.rb b/config/initializers/ruby_22_polyfill.rb index abc1234..def5678 100644 --- a/config/initializers/ruby_22_polyfill.rb +++ b/config/initializers/ruby_22_polyfill.rb @@ -4,13 +4,17 @@ unless instance_methods.include? :slice_when def slice_when(&block) raise ArgumentError, "wrong number of arguments (0 for 1)" unless block_given? + + return [self] if one? + Enumerator.new do |enum| ary = nil last_after = nil each_cons(2) do |before, after| last_after = after match = block.call before, after - ary ||= [] + + ary ||= [] if match ary << before enum.yield ary @@ -19,10 +23,12 @@ ary << before end end - unless ary.nil? + + unless ary.nil? ary << last_after enum.yield ary end + end end end
Handle case of one item
diff --git a/bin/check-hardware-fail.rb b/bin/check-hardware-fail.rb index abc1234..def5678 100644 --- a/bin/check-hardware-fail.rb +++ b/bin/check-hardware-fail.rb @@ -30,12 +30,8 @@ class CheckHardwareFail < Sensu::Plugin::Check::CLI def run - errors = `dmesg`.lines.grep(/\[Hardware Error\]/) - # #YELLOW - unless errors.empty? - critical 'Hardware Error Detected' - end - + errors = `dmesg`.lines.select { |l| l['[Hardware Error]'] } + critical 'Hardware Error Detected' if errors.any? ok 'Hardware OK' end end
Fix ruby utf8 byte sequence error
diff --git a/raygun_client.gemspec b/raygun_client.gemspec index abc1234..def5678 100644 --- a/raygun_client.gemspec +++ b/raygun_client.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'raygun_client' - s.version = '0.5.2.0' + s.version = '0.6.0.0' s.summary = 'Client for the Raygun API using the Obsidian HTTP client' s.description = ' '
Package version is increased from 0.5.2.0 to 0.6.0.0
diff --git a/Casks/beyond-compare.rb b/Casks/beyond-compare.rb index abc1234..def5678 100644 --- a/Casks/beyond-compare.rb +++ b/Casks/beyond-compare.rb @@ -1,6 +1,6 @@ cask :v1 => 'beyond-compare' do - version '4.0.3.19420' - sha256 '2feb23098fa6fdc6885ef57fbea1a638a820f4eaeffbbd2e820ef7dc6272342f' + version '4.0.4.19477' + sha256 'f37569d5f116ac76607e4c0df6081cf93d8c16ac61c4350e8e9495cc89714ceb' url "http://www.scootersoftware.com/BCompareOSX-#{version}.zip" homepage 'http://www.scootersoftware.com/'
Update Beyond Compare.app to 4.0.4.19477
diff --git a/ttc_notices/app/controllers/application_controller.rb b/ttc_notices/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/ttc_notices/app/controllers/application_controller.rb +++ b/ttc_notices/app/controllers/application_controller.rb @@ -1,5 +1,7 @@ class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. - protect_from_forgery with: :exception + protect_from_forgery with: :null_session + + skip_before_action :verify_authenticity_token end
Allow HTTP Requests for JSON API-endpoints
diff --git a/config/initializers/settings.rb b/config/initializers/settings.rb index abc1234..def5678 100644 --- a/config/initializers/settings.rb +++ b/config/initializers/settings.rb @@ -23,8 +23,8 @@ # The configuration of shelves in the physical library. Only the first and last # book codes of each shelf need to be stored here. # - # TODO: Replace this with an Array of Ranges of Strings. Each Range should - # represent the first and last book codes for the given shelf. + # TODO: Replace this with an Array of Shelf Structs. Each Shelf should + # represent the first and last LCC codes for the given shelf. # # TODO: Start using this setting in the application. config.shelves = []
Update the comment for the shelves setting
diff --git a/lib/hightops/tasks/hightops.rake b/lib/hightops/tasks/hightops.rake index abc1234..def5678 100644 --- a/lib/hightops/tasks/hightops.rake +++ b/lib/hightops/tasks/hightops.rake @@ -12,7 +12,7 @@ desc 'Stop hightops' task :stop_hightops do on roles fetch(:hightops_role, :app) do - if test("[ -f #{fetch(:hightops_pid)} ]") && execute("kill -0 `cat #{fetch(:hightops_pid)}` > /dev/null 2>&1") + if test("[ -f #{fetch(:hightops_pid)} ]") && test("kill -0 `cat #{fetch(:hightops_pid)}` > /dev/null 2>&1") within current_path do execute 'echo Stopping Hightops' execute :kill, "-TERM `cat #{fetch(:hightops_pid)}`"
Fix error raised while checking pidfile
diff --git a/lib/ffi-glib/list_methods.rb b/lib/ffi-glib/list_methods.rb index abc1234..def5678 100644 --- a/lib/ffi-glib/list_methods.rb +++ b/lib/ffi-glib/list_methods.rb @@ -36,11 +36,11 @@ end def tail - self.class.wrap(element_type, @struct[:next]) + self.class.wrap(element_type, struct[:next]) end def head - GirFFI::ArgHelper.cast_from_pointer(element_type, @struct[:data]) + GirFFI::ArgHelper.cast_from_pointer(element_type, struct[:data]) end def reset_typespec(typespec)
Use struct accessor in List methods too
diff --git a/lib/sprockets/environment.rb b/lib/sprockets/environment.rb index abc1234..def5678 100644 --- a/lib/sprockets/environment.rb +++ b/lib/sprockets/environment.rb @@ -1,8 +1,14 @@ module Sprockets class Environment + class << self + attr_accessor :extensions + end + + self.extensions = %w( coffee erb less sass scss str ) + def initialize(root = ".") @trail = Hike::Trail.new(root) - @trail.extensions.push(".coffee", ".less", ".scss", ".erb") + @trail.extensions.replace(self.class.extensions) end def root
Expand extensions and move them to a class attr_accessor
diff --git a/lib/userbin/support/rails.rb b/lib/userbin/support/rails.rb index abc1234..def5678 100644 --- a/lib/userbin/support/rails.rb +++ b/lib/userbin/support/rails.rb @@ -1,7 +1,7 @@ module Userbin module UserbinClient def userbin - @userbin ||= Userbin::Client.new(request, response) + @userbin ||= env['userbin'] || Userbin::Client.new(request, response) end end
Use client from env if present
diff --git a/tasks/ci.rake b/tasks/ci.rake index abc1234..def5678 100644 --- a/tasks/ci.rake +++ b/tasks/ci.rake @@ -2,11 +2,10 @@ file "lib/libsodium.so" => :build_libsodium do cp $LIBSODIUM_PATH, "lib/libsodium.so" - system "nm lib/libsodium.so" end task "ci:sodium" => "lib/libsodium.so" task :ci => %w(ci:sodium spec) -CLEAN.add "lib/libsodium.*" +CLEAN.add "lib/libsodium.*"
Revert "Dump libsodium symbols in CI environment" This reverts commit f23acf9e5cc69a032afd3839dc2084a02a3c924c.
diff --git a/examples/socket.rb b/examples/socket.rb index abc1234..def5678 100644 --- a/examples/socket.rb +++ b/examples/socket.rb @@ -0,0 +1,35 @@+ +$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) + +require 'minx' +require 'minx/io' +require 'socket' + +include ::Socket::Constants + +sockaddr = Socket.sockaddr_in(80, 'www.eb.dk') + +Minx.debug = true + +p = Minx.spawn do + socket = Minx::Socket.new(AF_INET, SOCK_STREAM, 0) + + puts "Connecting..." + socket.connect(sockaddr) + + puts "Writing..." + str = 'GET / HTTP/1.0\r\n\r\n' + "XXX" * 5000 + + written = 0 + until written == str.length + written += socket.write(str[written..-1]) + puts "Wrote #{written} bytes" + end + + puts "Reading..." + puts socket.read(1024) + + puts "Done." +end + +Minx.join(p)
Add example of Socket usage
diff --git a/app/models/manageiq/providers/embedded_automation_manager.rb b/app/models/manageiq/providers/embedded_automation_manager.rb index abc1234..def5678 100644 --- a/app/models/manageiq/providers/embedded_automation_manager.rb +++ b/app/models/manageiq/providers/embedded_automation_manager.rb @@ -6,6 +6,10 @@ require_nested :ConfiguredSystem require_nested :OrchestrationStack + def supported_for_create? + false + end + def supported_catalog_types %w(generic_ansible_playbook) end
Disable creation of embedded automation managers
diff --git a/lib/gitlab/repository_cache.rb b/lib/gitlab/repository_cache.rb index abc1234..def5678 100644 --- a/lib/gitlab/repository_cache.rb +++ b/lib/gitlab/repository_cache.rb @@ -7,13 +7,13 @@ def initialize(repository, extra_namespace: nil, backend: Rails.cache) @repository = repository - @namespace = "#{repository.full_path}:#{repository.project.id}" + @namespace = "project:#{repository.project.id}" @namespace = "#{@namespace}:#{extra_namespace}" if extra_namespace @backend = backend end def cache_key(type) - "#{type}:#{namespace}" + "#{namespace}:#{type}" end def expire(key)
Change project cache key to depend on ID instead of full path Previously, project cache used as part of the namespace the `full_path`, which included namespace and project slug. That meant that anytime a project was renamed or transfered to a different namespace, we would lose the existing cache. This is not necessary, nor desired. I've prefixed cache key with `project:` to make it easy to find in redis if necessary as well as make it possible to purge all project related cache. I've also switched the cache key type to go after the initial namespace and not before.
diff --git a/lib/imap/backup/cli/restore.rb b/lib/imap/backup/cli/restore.rb index abc1234..def5678 100644 --- a/lib/imap/backup/cli/restore.rb +++ b/lib/imap/backup/cli/restore.rb @@ -7,6 +7,7 @@ attr_reader :account_names def initialize(email = nil, options) + super([]) @email = email @account_names = options[:accounts].split(",") if options.key?(:accounts) end
Add missing initializer for parent
diff --git a/lib/semi_auto/configuration.rb b/lib/semi_auto/configuration.rb index abc1234..def5678 100644 --- a/lib/semi_auto/configuration.rb +++ b/lib/semi_auto/configuration.rb @@ -15,7 +15,6 @@ def read @configurations = YAML.load(file.read) if file - puts @configurations.inspect load_with_defaults end
Remove puts added for debugging
diff --git a/lib/veritas/algebra/product.rb b/lib/veritas/algebra/product.rb index abc1234..def5678 100644 --- a/lib/veritas/algebra/product.rb +++ b/lib/veritas/algebra/product.rb @@ -16,12 +16,12 @@ end def body - @body ||= multiply_bodies + @body ||= join_bodies end private - def multiply_bodies + def join_bodies body = [] left.body.each do |left_tuple|
Rename method to match the intention better
diff --git a/core/app/finders/spree/line_item/find_by_variant.rb b/core/app/finders/spree/line_item/find_by_variant.rb index abc1234..def5678 100644 --- a/core/app/finders/spree/line_item/find_by_variant.rb +++ b/core/app/finders/spree/line_item/find_by_variant.rb @@ -1,5 +1,5 @@ module Spree - class LineItem + class LineItem < Spree::Base class FindByVariant def execute(order:, variant:, options: {}) order.line_items.detect do |line_item|
Add correct base class for LineItem class in FindByVariant finder
diff --git a/db/migrate/20130110042952_add_completed_to_talks.rb b/db/migrate/20130110042952_add_completed_to_talks.rb index abc1234..def5678 100644 --- a/db/migrate/20130110042952_add_completed_to_talks.rb +++ b/db/migrate/20130110042952_add_completed_to_talks.rb @@ -1,10 +1,5 @@ class AddCompletedToTalks < ActiveRecord::Migration def change add_column :talks, :completed, :boolean, :default => false - - Talk.all.each do |t| - t.completed = false - t.save - end end end
Remove completed talk migration update all to pass tests
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/application_controller_spec.rb +++ b/spec/controllers/application_controller_spec.rb @@ -0,0 +1,27 @@+require 'spec_helper' + +describe ApplicationController do + context "authenticated" do + login_user + describe "GET index" do + render_views + it "renders the application" do + get :index + expect(response.status).to eq 200 + expect(response.body).to match /Buy/m + expect(response.body).to match /Users/m + expect(response.body).to match /Products/m + end + end + end + + context "unauthenticated" do + describe "GET index" do + render_views + it "renders the application" do + get :index + expect(response.status).to redirect_to(new_user_session_path) + end + end + end +end
Add specs testing single page app rending and login redirect
diff --git a/spec/controllers/attachments_controller_spec.rb b/spec/controllers/attachments_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/attachments_controller_spec.rb +++ b/spec/controllers/attachments_controller_spec.rb @@ -13,6 +13,10 @@ get :download, :id => attachment.id response.status.should == 302 response.should redirect_to(login_path) + end + + it "should raise ActiveRecord::RecordNotFound for requesting not existing attachments" do + expect { get :download, id: 0 }.to raise_error(ActiveRecord::RecordNotFound) end it "should not be possible to see attachments from restricted pages" do
Throw 404 if attachment can not be found.
diff --git a/spec/controllers/test_emails_controller_spec.rb b/spec/controllers/test_emails_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/test_emails_controller_spec.rb +++ b/spec/controllers/test_emails_controller_spec.rb @@ -0,0 +1,10 @@+require 'spec_helper' + +describe TestEmailsController do + describe "#new" do + it "should give some default text" do + get :new + assigns(:text).should == "Hello folks. Hopefully this should have worked and you should\nbe reading this. So, all is good.\n\nLove,\nThe Awesome Cuttlefish\n" + end + end +end
Add simple (partial) test for TestEmailsController
diff --git a/Library/Homebrew/build_environment.rb b/Library/Homebrew/build_environment.rb index abc1234..def5678 100644 --- a/Library/Homebrew/build_environment.rb +++ b/Library/Homebrew/build_environment.rb @@ -29,11 +29,11 @@ end def _dump(*) - @settings.to_a.join(":") + Marshal.dump(@settings) end def self._load(s) - new(*s.split(":").map(&:to_sym)) + new(Marshal.load(s)) end end
Remove knowledge of serialization details by marshaling twice
diff --git a/omniauth-remote-user.gemspec b/omniauth-remote-user.gemspec index abc1234..def5678 100644 --- a/omniauth-remote-user.gemspec +++ b/omniauth-remote-user.gemspec @@ -10,8 +10,8 @@ gem.homepage = 'http://beta.softwarepublico.gov.br/gitlab/softwarepublico/omniauth-remote-user' gem.authors = ['Lucas Kanashiro', 'Thiago Ribeiro', 'Rodrigo Siqueira','Macartur Sousa', 'Antonio Terceiro'] gem.require_paths = %w(lib) - gem.files = `git ls-files -z`.split("\x0") - gem.test_files = `git ls-files -- {test,spec,feature}/*`.split("\n") + gem.files = %w{Rakefile LICENSE.md README.md config.ru Gemfile} + Dir.glob("*.gemspec") + + Dir.glob("{lib,spec}/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) } gem.license = "Expat" gem.required_rubygems_version = '>= 1.3.5' end
Apply correct gem.files with Dir - Removing gem.files with git - Removing unecessary gem.test_files
diff --git a/fluent-plugin-juniper-telemetry.gemspec b/fluent-plugin-juniper-telemetry.gemspec index abc1234..def5678 100644 --- a/fluent-plugin-juniper-telemetry.gemspec +++ b/fluent-plugin-juniper-telemetry.gemspec @@ -4,7 +4,7 @@ Gem::Specification.new do |s| s.name = "fluent-plugin-juniper-telemetry" - s.version = '0.2.0' + s.version = '0.2.5' s.authors = ["Damien Garros"] s.email = ["dgarros@gmail.com"] @@ -19,5 +19,6 @@ s.require_paths = %w(lib) s.add_runtime_dependency "fluentd", ">= 0.10.58" + s.add_runtime_dependency "protobuf" s.add_development_dependency "rake" end
Update gem spec to 2.5.0 and add protobof as requirement
diff --git a/plugins/providers/virtualbox/plugin.rb b/plugins/providers/virtualbox/plugin.rb index abc1234..def5678 100644 --- a/plugins/providers/virtualbox/plugin.rb +++ b/plugins/providers/virtualbox/plugin.rb @@ -14,7 +14,7 @@ Provider end - config(:virtualbox, :provider => :virtualbox) do + config(:virtualbox, :provider) do require File.expand_path("../config", __FILE__) Config end
Set the virtualbox config scope
diff --git a/script/import_ikiwiki.rb b/script/import_ikiwiki.rb index abc1234..def5678 100644 --- a/script/import_ikiwiki.rb +++ b/script/import_ikiwiki.rb @@ -1,6 +1,6 @@ require "nokogiri" -doc = Nokogiri::HTML(open(ARGV[0])) +doc = Nokogiri::HTML($stdin) doc.css('#content p').each do |p| begin quote = Quote.from_raw_quote(p.content)
Make import script read from stdin Using ARGV conflicts with passing an --environment argument to rails runner
diff --git a/lib/codelation/development/atom_packages.rb b/lib/codelation/development/atom_packages.rb index abc1234..def5678 100644 --- a/lib/codelation/development/atom_packages.rb +++ b/lib/codelation/development/atom_packages.rb @@ -18,7 +18,6 @@ # Install Atom.app Packages def install_atom_packages packages = %w( - color-picker erb-snippets linter linter-csslint
Remove color-picker from Atom packages to install
diff --git a/spec/ffi/fork_spec.rb b/spec/ffi/fork_spec.rb index abc1234..def5678 100644 --- a/spec/ffi/fork_spec.rb +++ b/spec/ffi/fork_spec.rb @@ -5,8 +5,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) -# Skip platforms that don't implement Process.fork -unless RUBY_ENGINE == "truffleruby" or FFI::Platform.windows? +if Process.respond_to?(:fork) describe "Callback in conjunction with fork()" do module LibTest
Improve check for whether fork is available
diff --git a/spec/language_spec.rb b/spec/language_spec.rb index abc1234..def5678 100644 --- a/spec/language_spec.rb +++ b/spec/language_spec.rb @@ -0,0 +1,57 @@+require 'Language' +Dir[File.dirname(__FILE__) + "/../lib/errors/*.rb"].each {|file| require file } + +RSpec.describe Language do + context "default" do + before do + @language = Language.new + end + it "should default to english" do + expect(@language.lang).to eq "en" + end + end + context "English" do + before do + @language = Language.new "en" + end + it "should return the correct phrase for entering a letter" do + expect(@language.get_string(:pleaseenteraletter)).to eq "Please enter a letter: " + end + it "should return the correct phrase for non lower case letters" do + expect(@language.get_string(:inputisnotlowercase)).to eq "Input is not lower case" + end + it "should return the correct phrase for already guessed letters" do + expect(@language.get_string(:inputhasalreadybeenguessed)).to eq "Input has already been guessed" + end + it "should return the correct phrase for invalid letters" do + expect(@language.get_string(:inputisinvalid)).to eq "Input is invalid" + end + it "should return the correct phrase for game over" do + expect(@language.get_string(:gameover)).to eq "GAME OVER!" + end + it "should return the correct phrase for winning" do + expect(@language.get_string(:youwon)).to eq "You won!" + end + it "should return the correct phrase for losing" do + expect(@language.get_string(:youlost)).to eq "You lost!" + end + it "should return the correct phrase for lives remaining in current game, with 4 lives left" do + expect(@language.get_string(:youhavelivesremaining, {:lives => 4})).to eq "You have 4 lives remaining" + end + it "should return the correct phrase for lives remaining in finished game, with 0 lives left" do + expect(@language.get_string(:youhadlivesremaining, {:lives => 0})).to eq "You had 0 lives remaining" + end + it "should return the correct phrase for the current guess, with a guess of h_ngm_n" do + expect(@language.get_string(:currentguessis, {:guess => "h_ngm_n"})).to eq "Current guess is: h_ngm_n" + end + it "should return the correct phrase for final guess, with a guess of hangman" do + expect(@language.get_string(:finalguesswas, {:guess => "hangman"})).to eq "Final guess was: hangman" + end + it "should return the correct phrase for current guess letters, with a e i o u" do + expect(@language.get_string(:youhaveguessed, {:guesses => "a e i o u"})).to eq "You have guessed: a e i o u" + end + it "should return the correct phrase for final guessed letters, with a b c z x y" do + expect(@language.get_string(:youhadguessed, {:guesses => "a b c z x y"})).to eq "You had guessed: a b c z x y" + end + end +end
Add some tests for english strings
diff --git a/spec/lib/base_spec.rb b/spec/lib/base_spec.rb index abc1234..def5678 100644 --- a/spec/lib/base_spec.rb +++ b/spec/lib/base_spec.rb @@ -41,4 +41,15 @@ subject.should respond_to :presenter end end + + context 'actions' do + it 'has an action method' do + subject.should respond_to :action + end + + it 'it adds an acion' do + subject.action :edit + subject.actions.length.should == 1 + end + end end
Add spec for actions on base spec.
diff --git a/lib/octokit/enterprise_admin_client/orgs.rb b/lib/octokit/enterprise_admin_client/orgs.rb index abc1234..def5678 100644 --- a/lib/octokit/enterprise_admin_client/orgs.rb +++ b/lib/octokit/enterprise_admin_client/orgs.rb @@ -17,6 +17,8 @@ # @example # @admin_client.create_organization('SuchAGreatOrg', 'gjtorikian') def create_organization(login, admin, options = {}) + options[:login] = login + options[:admin] = admin post "admin/organizations", options end
Fix org creation to include login and admin.
diff --git a/lib/serverkit/resources/homebrew_package.rb b/lib/serverkit/resources/homebrew_package.rb index abc1234..def5678 100644 --- a/lib/serverkit/resources/homebrew_package.rb +++ b/lib/serverkit/resources/homebrew_package.rb @@ -7,7 +7,7 @@ def apply run_command( ::Specinfra::Command::Darwin::Base::Package.install( - unnested_name, + name, version, options, ),
Fix bug on installation of nested package name
diff --git a/retryable.gemspec b/retryable.gemspec index abc1234..def5678 100644 --- a/retryable.gemspec +++ b/retryable.gemspec @@ -3,6 +3,7 @@ Gem::Specification.new do |gem| gem.add_development_dependency 'bundler', '~> 1.0' + gem.add_development_dependency 'pry', '~> 0.10' gem.authors = ["Nikita Fedyashev", "Carlo Zottmann", "Chu Yeow"] gem.description = %q{Retryable#retryable, allow for retrying of code blocks.} gem.email = %q{loci.master@gmail.com}
Add pry as development dependency so that debug is easier next time(and you don't need to temporarily add it again)
diff --git a/activerecord/lib/active_record/associations/builder/singular_association.rb b/activerecord/lib/active_record/associations/builder/singular_association.rb index abc1234..def5678 100644 --- a/activerecord/lib/active_record/associations/builder/singular_association.rb +++ b/activerecord/lib/active_record/associations/builder/singular_association.rb @@ -8,12 +8,11 @@ def define_accessors(model, reflection) super - define_constructors(model.generated_feature_methods) if reflection.constructable? + self.class.define_constructors(model.generated_feature_methods, name) if reflection.constructable? end # Defines the (build|create)_association methods for belongs_to or has_one association - - def define_constructors(mixin) + def self.define_constructors(mixin, name) mixin.class_eval <<-CODE, __FILE__, __LINE__ + 1 def build_#{name}(*args, &block) association(:#{name}).build(*args, &block)
Move define_constructors to class level
diff --git a/test/acts_as_approvable_ownership_test.rb b/test/acts_as_approvable_ownership_test.rb index abc1234..def5678 100644 --- a/test/acts_as_approvable_ownership_test.rb +++ b/test/acts_as_approvable_ownership_test.rb @@ -0,0 +1,41 @@+require 'test_helper' + +class ActsAsApprovableOwnershipTest < Test::Unit::TestCase + context 'with default configuration' do + setup { ActsAsApprovable::Ownership.configure } + + should 'respond to .owner_class' do + assert_respond_to Approval, :owner_class + end + + should 'respond to .available_owners' do + assert_respond_to Approval, :available_owners + end + + should 'respond to .options_for_available_owners' do + assert_respond_to Approval, :options_for_available_owners + end + + should 'respond to .assigned_owners' do + assert_respond_to Approval, :assigned_owners + end + + should 'respond to .options_for_assigned_owners' do + assert_respond_to Approval, :options_for_assigned_owners + end + end + + context 'given a block' do + setup do + ActsAsApprovable::Ownership.configure do + def self.available_owners + [1, 2, 3] + end + end + end + + should 'allow overriding methods' do + assert_equal [1, 2, 3], Approval.available_owners + end + end +end
Test that configuration of ownership works
diff --git a/test/fixtures/cookbooks/test/recipes/package.rb b/test/fixtures/cookbooks/test/recipes/package.rb index abc1234..def5678 100644 --- a/test/fixtures/cookbooks/test/recipes/package.rb +++ b/test/fixtures/cookbooks/test/recipes/package.rb @@ -13,5 +13,5 @@ end hab_package 'core/hab-sup' do - bldr_url 'http://acceptance.habitat.sh' + bldr_url 'http://bldr.acceptance.habitat.sh' end
Use the correct acceptance URL for builder Signed-off-by: Joshua Timberman <d6955d9721560531274cb8f50ff595a9bd39d66f@chef.io>
diff --git a/db/data_migrations/20200203221840_add_long_lat_query_tool.rb b/db/data_migrations/20200203221840_add_long_lat_query_tool.rb index abc1234..def5678 100644 --- a/db/data_migrations/20200203221840_add_long_lat_query_tool.rb +++ b/db/data_migrations/20200203221840_add_long_lat_query_tool.rb @@ -1,11 +1,18 @@ class AddLongLatQueryTool < ActiveRecord::DataMigration def up - - view_sql = <<-SQL - CREATE OR REPLACE VIEW geometry_transam_assets_view AS - SELECT transam_assets.id, X(geometry) as longitude, Y(geometry) as latitude - FROM transam_assets - SQL + if ActiveRecord::Base.configurations[Rails.env]['adapter'].include? 'mysql2' + view_sql = <<-SQL + CREATE OR REPLACE VIEW geometry_transam_assets_view AS + SELECT transam_assets.id, X(geometry) as longitude, Y(geometry) as latitude + FROM transam_assets + SQL + elsif ActiveRecord::Base.configurations[Rails.env]['adapter'].include? 'post' + view_sql = <<-SQL + CREATE OR REPLACE VIEW geometry_transam_assets_view AS + SELECT transam_assets.id, ST_X(geometry) as longitude, ST_Y(geometry) as latitude + FROM transam_assets + SQL + end ActiveRecord::Base.connection.execute view_sql
Add and change syntax of query tool migrations for postgres compatibility.
diff --git a/app/helpers/artifacts_helper.rb b/app/helpers/artifacts_helper.rb index abc1234..def5678 100644 --- a/app/helpers/artifacts_helper.rb +++ b/app/helpers/artifacts_helper.rb @@ -1,6 +1,6 @@ module ArtifactsHelper def temportal_facet_path(params, low, high) - artifacts_path(params.dup.update(low_date: low, high_date: high)) + artifacts_path(params.dup.update(low_date: low, high_date: high, page: 1)) end def temporal_facet_menu_item(params, low, high, text=nil)
Reset page to 0 when changing filter.
diff --git a/app/models/ci/build_metadata.rb b/app/models/ci/build_metadata.rb index abc1234..def5678 100644 --- a/app/models/ci/build_metadata.rb +++ b/app/models/ci/build_metadata.rb @@ -10,9 +10,7 @@ self.table_name = 'ci_builds_metadata' - belongs_to :build, class_name: 'CommitStatus', - polymorphic: true, # rubocop:disable Cop/PolymorphicAssociations - inverse_of: :metadata + belongs_to :build, class_name: 'CommitStatus' belongs_to :project before_create :set_build_project
Simplify relation between a build and metadata This removes erroneously defined polymorphic association, because specifying `belongs_to` relationship with a class that already supports polymorphic associations works out-of-the-box.
diff --git a/select2_helper.gemspec b/select2_helper.gemspec index abc1234..def5678 100644 --- a/select2_helper.gemspec +++ b/select2_helper.gemspec @@ -17,7 +17,7 @@ s.files = Dir['{app,config,db,lib}/**/*', 'MIT-LICENSE', 'Rakefile', 'README.rdoc'] s.test_files = Dir['test/**/*'] - s.add_dependency 'rails', '~> 4.1.1' + s.add_dependency 'rails', '>= 4.1.0' s.add_dependency 'kaminari' s.add_dependency 'jbuilder' s.add_dependency 'coffee-rails'
Set gemsspec to be compatible with 4.2
diff --git a/app/decorators/service_template_decorator.rb b/app/decorators/service_template_decorator.rb index abc1234..def5678 100644 --- a/app/decorators/service_template_decorator.rb +++ b/app/decorators/service_template_decorator.rb @@ -8,6 +8,10 @@ end def fileicon - try(:picture) ? "/pictures/#{picture.basename}" : "100/service_template.png" + try(:picture) ? "/pictures/#{picture.basename}" : nil + end + + def single_quad + fileicon ? {:fileicon => fileicon} : {:fonticon => fonticon} end end
Add single_quad definition for the ServiceTemplate model
diff --git a/examples/formats.rb b/examples/formats.rb index abc1234..def5678 100644 --- a/examples/formats.rb +++ b/examples/formats.rb @@ -2,10 +2,9 @@ require 'tty-spinner' -TTY::Formats::FORMATS.size.times do |i| - format = "spin_#{i+1}" - options = {format: format.to_sym, hide_cursor: true} - spinner = TTY::Spinner.new("#{format}: :spinner", options) +TTY::Formats::FORMATS.keys.each do |token| + options = {format: token, hide_cursor: true} + spinner = TTY::Spinner.new("#{token}: :spinner", options) 20.times do spinner.spin sleep(0.1)
Change to update to use new names.
diff --git a/spec/integration/connect/spec/with_capybara_spec.rb b/spec/integration/connect/spec/with_capybara_spec.rb index abc1234..def5678 100644 --- a/spec/integration/connect/spec/with_capybara_spec.rb +++ b/spec/integration/connect/spec/with_capybara_spec.rb @@ -2,9 +2,9 @@ describe "Capybara" do describe "Without :sauce tagging", :js => true, :type => :feature do - it "should connect using the port", :js => true do - visit "/" - expect(page).to have_content "Hello Sauce!" - end + # it "should connect using the port", :js => true do + # visit "/" + # expect(page).to have_content "Hello Sauce!" + # end end end
Remove content of connect capybara spec. Not sure what this was trying to achieve, but the current behaviour doesn't start a server unless started from rspec.