diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/spec/models/task_spec.rb b/spec/models/task_spec.rb index abc1234..def5678 100644 --- a/spec/models/task_spec.rb +++ b/spec/models/task_spec.rb @@ -0,0 +1,16 @@+require 'rails_helper' + +describe Task do + let(:user) { User.create(name: 'Eduardo', email: 'email@gmail.com', password: 'p@ssw0rd') } + let(:group) { Group.create(name: 'Group A', user: user) } + + subject { user.tasks.create(name: 'Task XYZ', group: group) } + + it 'belongs to a user' do + expect(subject.user).to eql user + end + + it 'belongs to a group' do + expect(subject.group).to eql group + end +end
Create tests for Task model
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index abc1234..def5678 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,5 +1,12 @@ require 'rails_helper' RSpec.describe User, type: :model do - pending "add some examples to (or delete) #{__FILE__}" + it "is invalid without name" do + name = User.new(name: "mech") + expect(name).to be_valid + end + it "is invalid without email" do + email = User.new(name: "mech@gmail.com") + expect(email).to be_valid + end end
Add test to user spec
diff --git a/spec/readline-ng_spec.rb b/spec/readline-ng_spec.rb index abc1234..def5678 100644 --- a/spec/readline-ng_spec.rb +++ b/spec/readline-ng_spec.rb @@ -1,5 +1,14 @@ require 'readline-ng' require 'mocha' + +# Hook to reset internal state between runs +module ReadlineNG + class Reader + def self.initialized=(v) + @@initialized = v + end + end +end describe ReadlineNG do @@ -10,6 +19,7 @@ after(:each) do @reader.send(:teardown) + ReadlineNG::Reader.initialized = false end it "should only return full lines of input" do
Reset initialization state between examples
diff --git a/library/etc/nprocessors_spec.rb b/library/etc/nprocessors_spec.rb index abc1234..def5678 100644 --- a/library/etc/nprocessors_spec.rb +++ b/library/etc/nprocessors_spec.rb @@ -1,9 +1,11 @@ require File.expand_path('../../../spec_helper', __FILE__) require 'etc' -describe "Etc.nprocessors" do - it "returns the number of online processors" do - Etc.nprocessors.should be_kind_of(Integer) - Etc.nprocessors.should >= 1 +ruby_version_is "2.2" do + describe "Etc.nprocessors" do + it "returns the number of online processors" do + Etc.nprocessors.should be_kind_of(Integer) + Etc.nprocessors.should >= 1 + end end end
Add 2.2 guard for Etc.nprocessors, 2.1 is not yet removed from CI
diff --git a/db/data_migration/20130913113845_fix_key_stage_assessment_reporting_redirect.rb b/db/data_migration/20130913113845_fix_key_stage_assessment_reporting_redirect.rb index abc1234..def5678 100644 --- a/db/data_migration/20130913113845_fix_key_stage_assessment_reporting_redirect.rb +++ b/db/data_migration/20130913113845_fix_key_stage_assessment_reporting_redirect.rb @@ -0,0 +1,3 @@+Unpublishing.from_slug('assessment-and-reporting-arrangements-key-stage-2-2014', Publication). + update_attributes({alternative_url: 'https://education.gov.uk/schools/teachingandlearning/assessment/keystage2/g00227867/ks2-assessment-reporting', + redirect: true})
Add data migration to fix bad unpublishing
diff --git a/lib/nehm/playlist_manager.rb b/lib/nehm/playlist_manager.rb index abc1234..def5678 100644 --- a/lib/nehm/playlist_manager.rb +++ b/lib/nehm/playlist_manager.rb @@ -6,7 +6,7 @@ def self.set_playlist loop do - playlist = HighLine.new.ask('Enter name of default iTunes playlist to which you want add tracks (press Enter to set it to default iTunes Music library)') + playlist = HighLine.new.ask('Enter name of default iTunes playlist to which you want add tracks (press Enter to set it to default iTunes Music library):') # If entered nothing, unset iTunes playlist if playlist == ''
Add colon for ask in Playlist.set_playlist
diff --git a/lib/rasti/app/interaction.rb b/lib/rasti/app/interaction.rb index abc1234..def5678 100644 --- a/lib/rasti/app/interaction.rb +++ b/lib/rasti/app/interaction.rb @@ -15,6 +15,7 @@ def initialize(environment, session) @environment = environment @session = session + @uuid = SecureRandom.uuid end def call(form) @@ -27,7 +28,7 @@ private - attr_reader :environment, :session + attr_reader :environment, :session, :uuid def form thread_cache[:form] @@ -38,7 +39,7 @@ end def thread_cache_key - "#{self.class.name}[#{self.object_id}]" + "#{self.class.name}[#{uuid}]" end end
Fix in thread cache. Now use unique id
diff --git a/lib/will_paginate/mongoid.rb b/lib/will_paginate/mongoid.rb index abc1234..def5678 100644 --- a/lib/will_paginate/mongoid.rb +++ b/lib/will_paginate/mongoid.rb @@ -8,6 +8,8 @@ extend CollectionMethods @current_page = WillPaginate::PageNumber(options[:page] || @current_page || 1) @page_multiplier = current_page - 1 + @total_entries = options.delete(:total_entries) + pp = (options[:per_page] || per_page || WillPaginate.per_page).to_i limit(pp).skip(@page_multiplier * pp) end
Add total_entries support for Mongoid
diff --git a/app/models/cocoa_pod.rb b/app/models/cocoa_pod.rb index abc1234..def5678 100644 --- a/app/models/cocoa_pod.rb +++ b/app/models/cocoa_pod.rb @@ -1,4 +1,6 @@ class CocoaPod < ActiveRecord::Base + default_scope { order('stars DESC') } + after_initialize :init_stars def init_stars
Order cocoa pod by stars.
diff --git a/spec/controllers/comments_controller_spec.rb b/spec/controllers/comments_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/comments_controller_spec.rb +++ b/spec/controllers/comments_controller_spec.rb @@ -14,21 +14,21 @@ describe "GET 'new'" do it "returns http success" do get 'new', { :idea_id => @idea.id } - response.should be_success + expect(response).to be_success end end describe "GET 'edit'" do it "returns http success" do get 'edit', { :idea_id => @idea.id, :id => @comment.id } - response.should be_success + expect(response).to be_success end end describe "GET 'show'" do it "returns http success" do get 'show', { :idea_id => @idea.id, :id => @comment.id } - response.should be_success + expect(response).to be_success end end
Fix Comments controller expectation syntax Spec should be standardized to use the 'expect(...).to' syntax in favor of the '....should' syntax.
diff --git a/spec/controllers/services_controller_spec.rb b/spec/controllers/services_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/services_controller_spec.rb +++ b/spec/controllers/services_controller_spec.rb @@ -2,8 +2,15 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe ServicesController, "when using web services" do + integrate_views - + + # store and restore the locale in the context of the test suite to isolate + # changes made in these tests + before do + @old_locale = FastGettext.locale() + end + it "should show no alaveteli message when in the deployed country" do config = MySociety::Config.load_default() config['ISO_COUNTRY_CODE'] = "DE" @@ -29,5 +36,8 @@ response.body.should match(/Puede hacer solicitudes de información en España/) end + after do + FastGettext.set_locale(@old_locale) + end -end +end
Add before and after methods to isolate any effect these tests have on locale.
diff --git a/spec/features/payments/payments_flow_spec.rb b/spec/features/payments/payments_flow_spec.rb index abc1234..def5678 100644 --- a/spec/features/payments/payments_flow_spec.rb +++ b/spec/features/payments/payments_flow_spec.rb @@ -28,4 +28,36 @@ end end end + + context 'when on accuracy page' do + before { visit accuracy_payment_path(id: payment.id) } + + it 'displays the title of the page' do + expect(page).to have_content 'Payment details' + end + + it 'displays the form label' do + expect(page).to have_content 'Is the payment correct?' + end + + scenario 'it re-renders the page when the page is submitted without anything filled in' do + click_button 'Next' + + expect(page).to have_content 'Is the payment correct?' + end + + scenario 'confirming the payment is correct redirects to the summary' do + choose 'payment_correct_true' + click_button 'Next' + expect(page).to have_content 'Check details' + end + + scenario 'rejecting the payment redirects to the summary page' do + choose 'payment_correct_false' + expect(page).to have_content 'What is incorrect about the payment?' + click_button 'Next' + expect(page).to have_content 'Check details' + end + end + end
Add feature test for payment accuracy
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,3 +9,20 @@ # Custom Matchers d = File.expand_path(File.join(File.dirname(__FILE__), 'support', '**', '*.rb')) Dir[d].each { |f| require f } + +# Ensures that stdout is directed into dev/null.txt during tests +RSpec.configure do |config| + original_stderr = $stderr + original_stdout = $stdout + + config.before(:all) do + dev = File.join(File.dirname(__FILE__), 'dev', 'log.txt') + $stderr = File.new(dev, 'w') + $stdout = File.new(dev, 'w') + end + + config.after(:all) do + $stderr = original_stderr + $stdout = original_stdout + end +end
Add Logic for Sending Stdout to Test Log File
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -7,7 +7,7 @@ require 'simplecov' SimpleCov.start do - add_group 'API', 'lib/evertrue/api' + add_group 'API', 'lib/linkedin/api' end VCR.configure do |c|
Fix issues from Pull Request 2
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -7,9 +7,7 @@ require 'droplet_kit' require 'webmock/rspec' -SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ - SimpleCov::Formatter::HTMLFormatter -] +SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(SimpleCov::Formatter::HTMLFormatter) Dir['./spec/support/**/*.rb'].each do |file| require file
Fix spec depreciation: [DEPRECATION] ::[] is deprecated. Use ::new instead
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -8,9 +8,6 @@ require 'bundler/setup' Bundler.require - -require 'vagrant' -require 'vagrant/test_helpers' require 'rspec-spies'
Remove vagrant requires - it seems that travis was installing an old version of vagrant that didnt include it which has been upgraded
diff --git a/Casks/bit-slicer.rb b/Casks/bit-slicer.rb index abc1234..def5678 100644 --- a/Casks/bit-slicer.rb +++ b/Casks/bit-slicer.rb @@ -1,12 +1,12 @@ cask :v1 => 'bit-slicer' do - version '1.7.5' - sha256 '1180666794b41ddba4895c6f90ba9e428f49c115f0eb260d76061c6c6aa9f1a9' + version '1.7.6' + sha256 '03e9125481bd4c6459e379b3b0df69a2eecbde80f7cb11d9be8dfc9c0f8d3a58' # bitbucket.org is the official download host per the vendor homepage url "https://bitbucket.org/zorgiepoo/bit-slicer/downloads/Bit%20Slicer%20#{version}.zip" name 'Bit Slicer' appcast 'https://zgcoder.net/bitslicer/update/appcast.xml', - :sha256 => '1deab6db866da60ea0c088b1d086039c8363f5c48fcb2bbdea62f52176395c33' + :sha256 => '3012f7d3d8b49f6d595d62e07f87525c0a225a59d44576ba46f0c67518fdf019' homepage 'https://github.com/zorgiepoo/bit-slicer/' license :bsd
Update Bit Slicer to 1.7.6
diff --git a/Casks/genymotion.rb b/Casks/genymotion.rb index abc1234..def5678 100644 --- a/Casks/genymotion.rb +++ b/Casks/genymotion.rb @@ -6,7 +6,7 @@ url "http://files2.genymotion.com/genymotion/genymotion-#{version}/genymotion-#{version}.dmg" name 'Genymotion' - homepage 'http://www.genymotion.com/' + homepage 'https://www.genymotion.com/' license :unknown # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder app 'Genymotion.app'
Fix homepage to use SSL in Genymotion Cask The HTTP URL is already getting redirected to HTTPS. Using the HTTPS URL directly makes it more secure and saves a HTTP round-trip.
diff --git a/lib/acfs/client.rb b/lib/acfs/client.rb index abc1234..def5678 100644 --- a/lib/acfs/client.rb +++ b/lib/acfs/client.rb @@ -3,7 +3,6 @@ module Acfs class Client - attr_reader :base_url cattr_accessor :base_url include Acfs::Resources @@ -18,5 +17,11 @@ @base_url = opts[:base_url] || self.class.base_url end + # Return runtime base URL. + # + def base_url + @base_url + end + end end
Fix bug for base_url in specific spec orders (seed 13698). At the end of #initialize @base_url was set to correct string, but #base_url still returned nil.
diff --git a/Casks/tower-beta.rb b/Casks/tower-beta.rb index abc1234..def5678 100644 --- a/Casks/tower-beta.rb +++ b/Casks/tower-beta.rb @@ -0,0 +1,24 @@+cask :v1 => 'tower-beta' do + version '2.2.2-281' + sha256 '83fdbb887c394ed0f76bf91c66972d28bc6d36f144c21dfd582ccb09d5e19864' + + # amazonaws.com is the official download host per the vendor homepage + url "https://fournova-app-updates.s3.amazonaws.com/apps/tower2-mac/281-3f2b7672/Tower-2-#{version}.zip" + appcast 'https://updates.fournova.com/updates/tower2-mac/beta' + name 'Tower' + homepage 'http://www.git-tower.com/' + license :commercial + + app 'Tower.app' + binary 'Tower.app/Contents/MacOS/gittower' + + zap :delete => [ + '~/Library/Application Support/com.fournova.Tower2', + '~/Library/Caches/com.fournova.Tower2', + '~/Library/Preferences/com.fournova.Tower2.plist', + ] + + caveats do + files_in_usr_local + end +end
Add Tower beta channel (currently v2.2.2) This commit adds the Tower beta channel to Versions. It is based on the main `tower.rb` in `homebrew-cask`, with updates for the beta appcast.
diff --git a/cookbooks/vagrant/recipes/windows.rb b/cookbooks/vagrant/recipes/windows.rb index abc1234..def5678 100644 --- a/cookbooks/vagrant/recipes/windows.rb +++ b/cookbooks/vagrant/recipes/windows.rb @@ -1,9 +1,5 @@ # Make the path Windows-style if we're on Windows package_name = node[:vagrant][:gem_path].gsub("/", "\\") - -# Make the environment paths windows style as well -env_vars["GEM_HOME"] = env_vars["GEM_HOME"].gsub("/", "\\") -env_vars["GEM_PATH"] = env_vars["GEM_PATH"].gsub("/", "\\") gem_package package_name do version "> 0"
Windows: Remove unused env_vars for gem install
diff --git a/core/lib/spree/core/current_store.rb b/core/lib/spree/core/current_store.rb index abc1234..def5678 100644 --- a/core/lib/spree/core/current_store.rb +++ b/core/lib/spree/core/current_store.rb @@ -7,7 +7,7 @@ def initialize(request) @request = request @current_store_selector = Spree::Config.current_store_selector_class.new(request) - Spree::Deprecation.warn "Using Spree::Core::CurrentStore is deprecated. Use Spree::CurrentStoreSelector instead", caller + Spree::Deprecation.warn "Using Spree::Core::CurrentStore is deprecated. Use Spree::Config.current_store_selector_class instead", caller end # Delegate store selection to Spree::Config.current_store_selector_class
Update deprecation message inside CurrentStore
diff --git a/lib/dino/components/led.rb b/lib/dino/components/led.rb index abc1234..def5678 100644 --- a/lib/dino/components/led.rb +++ b/lib/dino/components/led.rb @@ -5,7 +5,7 @@ super(options) set_pin_mode(:out) - digital_write(Board::LOW) + off end def on
Use the `off` method to set LED initial state to `off`.
diff --git a/lib/floorplanner/client.rb b/lib/floorplanner/client.rb index abc1234..def5678 100644 --- a/lib/floorplanner/client.rb +++ b/lib/floorplanner/client.rb @@ -5,6 +5,23 @@ @password = password @subdomain = subdomain @protocol = protocol + end + + # Returns an instance based + # on values from the following + # environment variables: + # + # FLOORPLANNER_API_KEY + # FLOORPLANNER_PASSWORD + # FLOORPLANNER_SUBDOMAIN + # + # The instance will use https. + def self.from_env + new( + api_key: ENV["FLOORPLANNER_API_KEY"], + password: ENV["FLOORPLANNER_PASSWORD"], + subdomain: ENV["FLOORPLANNER_SUBDOMAIN"] + ) end def get(resource_path)
Add factory method for setting up an instance based on env variables
diff --git a/lib/guard/spork.rb b/lib/guard/spork.rb index abc1234..def5678 100644 --- a/lib/guard/spork.rb +++ b/lib/guard/spork.rb @@ -21,23 +21,27 @@ end def reload - runner.kill_sporks - runner.launch_sporks("reload") + relaunch_sporks end def run_on_additions(paths) - runner.kill_sporks - runner.launch_sporks("reload") + relaunch_sporks end def run_on_modifications(paths) - runner.kill_sporks - runner.launch_sporks("reload") + relaunch_sporks end def stop runner.kill_sporks end + private + + def relaunch_sporks + runner.kill_sporks + runner.launch_sporks("reload") + end + end end
Refactor repeated runner calls into private method
diff --git a/roles/trogdor.rb b/roles/trogdor.rb index abc1234..def5678 100644 --- a/roles/trogdor.rb +++ b/roles/trogdor.rb @@ -11,6 +11,17 @@ :address => "134.90.146.26", :prefix => "30", :gateway => "134.90.146.25" + } + } + }, + :sysfs => { + :md_tune => { + :comment => "Tune the md sync performance so as not to kill system performance", + :parameters => { + "block/md0/md/sync_speed_min" => "10", + "block/md0/md/sync_speed_max" => "10000", + "block/md1/md/sync_speed_min" => "10", + "block/md1/md/sync_speed_max" => "10000" } } },
ridgeback: Set slower md resync/check speed as not to kill IOPs
diff --git a/lib/identity/heroku_api.rb b/lib/identity/heroku_api.rb index abc1234..def5678 100644 --- a/lib/identity/heroku_api.rb +++ b/lib/identity/heroku_api.rb @@ -6,7 +6,12 @@ options[:headers] ||= {} options[:request_ids] ||= [] headers = { - "Accept" => "application/vnd.heroku+json; version=3", + # + # Consumed OAuth APIs are V3, but signup/email change/password reset + # APIs are not. This is largely because these V3 APIs do not yet exist. + # Move Identity back to V3 after they're properly implemented. + # + #"Accept" => "application/vnd.heroku+json; version=3", "Request-ID" => options[:request_ids].join(", "), }.merge!(options[:headers]) if options[:user] || options[:pass]
Move Identity to be a V2 consumer :( :( :( We don't yet have V3 APIs to signup, password reset, or change email confirmation, so be honest about our consumed API version.
diff --git a/sane_postgresql/recipes/default.rb b/sane_postgresql/recipes/default.rb index abc1234..def5678 100644 --- a/sane_postgresql/recipes/default.rb +++ b/sane_postgresql/recipes/default.rb @@ -17,7 +17,7 @@ cp /tmp/pg_hba.conf /etc/postgresql/9.1/main/ cp /tmp/postgresql.conf /etc/postgresql/9.1/main/ /etc/init.d/postgresql restart - sudo -u postgres psql -c "CREATE USER vagrant CREATEDB" + sudo -u postgres psql -c "CREATE USER vagrant CREATEDB SUPERUSER" } not_if { File.exist?("/home/vagrant/.encoding-fixed") }
Make the vagrant user a superuser as well. He can't, for instance, add the hstore extension without that role.
diff --git a/core/app/helpers/comable/application_helper.rb b/core/app/helpers/comable/application_helper.rb index abc1234..def5678 100644 --- a/core/app/helpers/comable/application_helper.rb +++ b/core/app/helpers/comable/application_helper.rb @@ -6,6 +6,10 @@ def current_customer @current_customer || load_customer + end + + def current_order + current_customer.incomplete_order end def name_with_honorific(name)
Add a helper method for current order
diff --git a/bldr.gemspec b/bldr.gemspec index abc1234..def5678 100644 --- a/bldr.gemspec +++ b/bldr.gemspec @@ -9,8 +9,9 @@ s.add_dependency 'multi_json', '~> 1.0.3' - s.add_development_dependency 'sinatra', '~>1.2.6' - s.add_development_dependency 'tilt', '~>1.3.2' + s.add_development_dependency 'json_pure' + s.add_development_dependency 'sinatra', '~>1.2.6' + s.add_development_dependency 'tilt', '~>1.3.2' s.add_development_dependency 'yajl-ruby' end
Add json_pure to development deps
diff --git a/lib/mote/render.rb b/lib/mote/render.rb index abc1234..def5678 100644 --- a/lib/mote/render.rb +++ b/lib/mote/render.rb @@ -22,6 +22,8 @@ end def mote_path(template) - return File.join(settings[:mote][:views], "#{template}.mote") + return template if template.end_with?(".mote") + + File.join(settings[:mote][:views], "#{template}.mote") end end
Revert "Remove support for absolute paths." This reverts commit 00146e3f9407de874978b583dfd15bcde8eaa328.
diff --git a/lib/rb/spec/spec_helper.rb b/lib/rb/spec/spec_helper.rb index abc1234..def5678 100644 --- a/lib/rb/spec/spec_helper.rb +++ b/lib/rb/spec/spec_helper.rb @@ -2,6 +2,8 @@ # require at least 1.1.4 to fix a bug with describing Modules gem 'rspec', '>= 1.1.4' require 'spec' + +$:.unshift File.join(File.dirname(__FILE__), *%w[.. ext]) # pretend we already loaded fastthread, otherwise the nonblockingserver_spec # will get screwed up
rb: Add ext/ to loadpath so BinaryProtocolAccelerated specs pass git-svn-id: 8d8e29b1fb681c884914062b88f3633e3a187774@680539 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/nylas/event.rb b/lib/nylas/event.rb index abc1234..def5678 100644 --- a/lib/nylas/event.rb +++ b/lib/nylas/event.rb @@ -15,6 +15,7 @@ attribute :calendar_id, :string attribute :master_event_id, :string attribute :message_id, :string + attribute :ical_uid, :string attribute :busy, :boolean attribute :description, :string
Add support for iCal UID field While this SDK is supposed to not blow up on new field attributes, that is not currently true for Event creation. Without this patch, the following code (directly from our example code!) blows up with the stack trace below if the API is returning an `ical_uid` field: created_event = api.events.create( title: "A fun event!", location: "The Party Zone", calendar_id: calendar.id, # when: { date: "2020-01-10" }) when: { start_time: Time.now + 60, end_time: Time.now + 120 }) --- bundler: failed to load command: ./reproduce_bug.rb (./reproduce_bug.rb) Nylas::Registry::MissingKeyError: key ical_uid not in [:id, :object, :account_id, :calendar_id, :master_event_id, :message_id, :busy, :description, :location, :owner, :recurrence, :participants, :read_only, :status, :title, :when, :original_start_time] /home/spang/src/nylas/nylas-ruby/lib/nylas/registry.rb:30:in `rescue in []' /home/spang/src/nylas/nylas-ruby/lib/nylas/registry.rb:27:in `[]' /home/spang/src/nylas/nylas-ruby/lib/nylas/model/attributes.rb:48:in `cast' /home/spang/src/nylas/nylas-ruby/lib/nylas/model/attributes.rb:19:in `[]=' /home/spang/src/nylas/nylas-ruby/lib/nylas/model/attributes.rb:25:in `block in merge' /home/spang/src/nylas/nylas-ruby/lib/nylas/model/attributes.rb:24:in `each' /home/spang/src/nylas/nylas-ruby/lib/nylas/model/attributes.rb:24:in `merge' /home/spang/src/nylas/nylas-ruby/lib/nylas/model.rb:35:in `save' /home/spang/src/nylas/nylas-ruby/lib/nylas/collection.rb:26:in `create' /home/spang/src/nylas/nylas-ruby/reproduce_clio_error.rb:40:in `<top (required)>'
diff --git a/app/controllers/static_pages_controller.rb b/app/controllers/static_pages_controller.rb index abc1234..def5678 100644 --- a/app/controllers/static_pages_controller.rb +++ b/app/controllers/static_pages_controller.rb @@ -11,6 +11,7 @@ @dcc_news_feed = Feedzirra::Feed.fetch_and_parse(dcc_news_feed_url) respond_to do |format| format.rss { redirect_to dcc_news_feed_url } + format.html end end end
Fix for news page not displaying
diff --git a/app/lib/ehjob_authentication/api_client.rb b/app/lib/ehjob_authentication/api_client.rb index abc1234..def5678 100644 --- a/app/lib/ehjob_authentication/api_client.rb +++ b/app/lib/ehjob_authentication/api_client.rb @@ -13,7 +13,7 @@ headers 'Accept' => 'application/json' debug_output $stderr if Figaro.env.httparty_debug? - headers 'Authorization' => "Token token='#{Figaro.env.single_authentication_key}'" + headers 'HTTP_AUTHORIZATION' => "Token token='#{Figaro.env.single_authentication_key}'" delegate :base_url, to: 'EhjobAuthentication.config'
Rename the authorization key in request headers
diff --git a/jsRender-rails.gemspec b/jsRender-rails.gemspec index abc1234..def5678 100644 --- a/jsRender-rails.gemspec +++ b/jsRender-rails.gemspec @@ -5,7 +5,7 @@ s.version = "0.9" s.authors = ["Sebastian Pape"] s.email = ["email@sebastianpape.com"] - s.homepage = "" + s.homepage = "https://github.com/spape/jsRender-rails" s.summary = %q{jsRender templates added to the Rails asset pipeline automatically.} s.description = %q{This gem adds jsRender (next generation of jQuery Templates) and a corresponding Sprockets engine to the asset pipeline for Rails >= 3.1 applications.}
Update homepage. Link with github page.
diff --git a/lib/tasks/islay_tasks.rake b/lib/tasks/islay_tasks.rake index abc1234..def5678 100644 --- a/lib/tasks/islay_tasks.rake +++ b/lib/tasks/islay_tasks.rake @@ -1,9 +1,3 @@-require 'resque/tasks' - -task "resque:setup" => :environment do - Resque.before_fork = Proc.new { ActiveRecord::Base.establish_connection } -end - namespace :islay do namespace :db do desc "Loads in seed data for bootstrapping a fresh Islay app."
Remove the require for the resque tasks.
diff --git a/lib/tasks/log_archive.rake b/lib/tasks/log_archive.rake index abc1234..def5678 100644 --- a/lib/tasks/log_archive.rake +++ b/lib/tasks/log_archive.rake @@ -1,3 +1,5 @@+require 'shellwords' + desc "Move and compress logs to log/archive/" task "log:archive" do # Rails logging fails if you simply rename the logs because it'll keep trying @@ -14,9 +16,7 @@ target = File.join(archive_dir, "#{File.basename(source)}.#{timestamp}") target_archive = "#{target}.gz" - #puts "#{source} & #{target_archive}" # FIXME some requests will be lost due to a race condition between these two commands - sh("gzip -c #{source} > #{target_archive}") - sh("cat /dev/null > #{source}") + sh("gzip -c #{Shellwords.escape(source)} > #{Shellwords.escape(target_archive)} && cat /dev/null > #{Shellwords.escape(source)}") or raise "Bad return value from sh!" end end
Add escaping and error handling to `rake log:archive`.
diff --git a/lib/tasks/spitcast_v2.rake b/lib/tasks/spitcast_v2.rake index abc1234..def5678 100644 --- a/lib/tasks/spitcast_v2.rake +++ b/lib/tasks/spitcast_v2.rake @@ -8,7 +8,8 @@ start_time = Time.current Rails.logger.info 'Updating Spitcast v2 data...' - hydra = Typhoeus::Hydra.new(max_concurrency: @batch.concurrency) + # pipelining 2 means HTTP/2 multiplexing https://curl.haxx.se/libcurl/c/CURLMOPT_PIPELINING.html + hydra = Typhoeus::Hydra.new(max_concurrency: @batch.concurrency, pipelining: 2) Spot.where.not(spitcast_id: nil).each do |spot| ApiRequest.new(batch: @batch, requestable: spot, service: SpitcastV2, hydra: hydra).get
Enable HTTP/2 multiplexing for Spitcast v2 (CloudFront)
diff --git a/lib/citrus/web/poller.rb b/lib/citrus/web/poller.rb index abc1234..def5678 100644 --- a/lib/citrus/web/poller.rb +++ b/lib/citrus/web/poller.rb @@ -14,7 +14,7 @@ protected def setup_poller - if defined?(:Reel) + if defined?(Reel) require 'citrus/web/celluloid_io_poller' CelluloidIOPoller.new else
Fix if defined check with correct constant.
diff --git a/lib/user_agent/browsers.rb b/lib/user_agent/browsers.rb index abc1234..def5678 100644 --- a/lib/user_agent/browsers.rb +++ b/lib/user_agent/browsers.rb @@ -4,6 +4,7 @@ require 'user_agent/browsers/internet_explorer' require 'user_agent/browsers/opera' require 'user_agent/browsers/webkit' +require 'user_agent/browsers/windows_media_player' class UserAgent module Browsers @@ -14,7 +15,7 @@ }.freeze def self.all - [InternetExplorer, Chrome, Webkit, Opera, Gecko] + [InternetExplorer, Chrome, Webkit, Opera, Gecko, WindowsMediaPlayer] end def self.extend(array)
Add WindowsMediaPlayer as a valid browser to check
diff --git a/lib/van_helsing/bundler.rb b/lib/van_helsing/bundler.rb index abc1234..def5678 100644 --- a/lib/van_helsing/bundler.rb +++ b/lib/van_helsing/bundler.rb @@ -5,11 +5,10 @@ namespace :bundle do desc "Install gem dependencies using Bundler." task :install do - bundle_path = "./vendor/bundle" queue %{ echo "-----> Installing gem dependencies using Bundler" mkdir -p "#{shared_path}/bundle" - mkdir -p "./vendor" + mkdir -p "#{File.dirname bundle_path}" ln -s "#{shared_path}/bundle" "#{bundle_path}" bundle install #{bundle_options} }
Fix bundle:install to make bundle_path configurable.
diff --git a/lib/tasks/lpi.rake b/lib/tasks/lpi.rake index abc1234..def5678 100644 --- a/lib/tasks/lpi.rake +++ b/lib/tasks/lpi.rake @@ -1,5 +1,5 @@ namespace :lpi do - desc 'Import an LPI CSV file, attributing the import to the given user' + desc 'Import an LPI CSV file, attributing the import to the given user.' task :import, [:file, :user_email] => [:environment] do |t, args| user = User.find_by_email!(args[:user_email]) importer = LandAndPropertyInformationImporter.new(args[:file], user) @@ -9,4 +9,15 @@ importer.processed, importer.created, importer.updated, importer.errors ] end + + desc 'Process LPI CSV files in from_dir, moving them into to_dir. Attribute the import to the given user.' + task :process_dir, [:from_dir, :to_dir, :user_email] => [:environment] do |t, args| + Dir.foreach(args[:from_dir]) do |filename| + next unless filename =~ /\.csv$/ + full_filename = File.expand_path(filename, args[:from_dir]) + Rake::Task['lpi:import'].invoke(full_filename, args[:user_email]) + puts "Moving '%s' to '%s'" % [full_filename, args[:to_dir]] + FileUtils.mv(full_filename, args[:to_dir]) + end + end end
Add rake task to process all LPI files in a dir To be used in a cron job.
diff --git a/lib/tic_tac_toe.rb b/lib/tic_tac_toe.rb index abc1234..def5678 100644 --- a/lib/tic_tac_toe.rb +++ b/lib/tic_tac_toe.rb @@ -13,17 +13,17 @@ end class Board - @@win_places = [[0, 1, 2], - [3, 4, 5], - [6, 7, 8], - [0, 3, 6], - [1, 4, 7], - [2, 5, 8], - [0, 4, 8], - [2, 4, 6]] + WIN_PLACES = [[0, 1, 2], + [3, 4, 5], + [6, 7, 8], + [0, 3, 6], + [1, 4, 7], + [2, 5, 8], + [0, 4, 8], + [2, 4, 6]] def self.win_places - @@win_places + WIN_PLACES end def initialize @@ -39,7 +39,7 @@ end def who_won? - @@win_places.map do |places| + WIN_PLACES.map do |places| marks = places.map { |n| @_marks.at n } marks[0] if marks.all? { |m| m == marks[0] } and marks[0] != " " end.find(&:itself)
Change class variable to class constant
diff --git a/Casks/wch-ch34x-usb-serial-driver-unofficial.rb b/Casks/wch-ch34x-usb-serial-driver-unofficial.rb index abc1234..def5678 100644 --- a/Casks/wch-ch34x-usb-serial-driver-unofficial.rb +++ b/Casks/wch-ch34x-usb-serial-driver-unofficial.rb @@ -0,0 +1,23 @@+cask 'wch-ch34x-usb-serial-driver-unofficial' do + version '1.0' + sha256 '47eaff5aeaa70fdc507f0772f3b87fdd6348ada300de8a1ad7c38d53d185fc0b' + + url 'https://raw.githubusercontent.com/kiguino/kiguino.github.io/master/downloads/CH34x_Install.zip' + name 'WCH USB serial driver for CH340/CH341 (unofficial release)' + homepage '' + license :gratis + + caveats <<-EOS.undent + Warning: This driver was not officially published and its source is + unclear. Discussion: + https://github.com/caskroom/homebrew-unofficial/pull/55 + EOS + + container :type => :zip, + :nested => 'CH34x_Install.pkg' + + pkg 'CH34x_Install.pkg' + + uninstall :pkgutil => 'com.wch.usbserial.pkg', + :kext => 'com.wch.usbserial' +end
Add WCH CH34x USB Serial driver fixed as discussed
diff --git a/spec/models/photo_uploader_spec.rb b/spec/models/photo_uploader_spec.rb index abc1234..def5678 100644 --- a/spec/models/photo_uploader_spec.rb +++ b/spec/models/photo_uploader_spec.rb @@ -26,7 +26,7 @@ it "should scale down galley to be no larger than 600 by 600 pixels" do # It's 1x1 because of the placeholder.jpg fixture file - expect(@uploader.gallery).not_to be_larger_than(600, 600) + expect(@uploader.gallery).to be_no_larger_than(600, 600) end end end
Change back to old RSpec Syntax until Carrierwave 0.11.0 release
diff --git a/app/models/course/assessment/answer/programming_file_annotation.rb b/app/models/course/assessment/answer/programming_file_annotation.rb index abc1234..def5678 100644 --- a/app/models/course/assessment/answer/programming_file_annotation.rb +++ b/app/models/course/assessment/answer/programming_file_annotation.rb @@ -23,6 +23,6 @@ # Set the course as the same course of the answer. def set_course - self.course ||= file.answer.course if file && file.answer + self.course ||= file.answer.question.assessment.course if file && file.answer end end
Set course for programming file annotations through another route. Can no longer get course from answer.
diff --git a/app/controllers/api/mentor_requests_controller.rb b/app/controllers/api/mentor_requests_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/mentor_requests_controller.rb +++ b/app/controllers/api/mentor_requests_controller.rb @@ -8,12 +8,14 @@ req = MentorRequest.new(student: current_user) if req.save! render json: {result: "success"} + current_user.track_event("opened-request") end end def close MentorRequest.close_all_by_user(current_user) render json: {result: "success"} + current_user.track_event("closed-request") end end
Add Intercom tracking to request events
diff --git a/lib/api_mapper_http.rb b/lib/api_mapper_http.rb index abc1234..def5678 100644 --- a/lib/api_mapper_http.rb +++ b/lib/api_mapper_http.rb @@ -45,7 +45,11 @@ response = self.class.send(@method,@resource_uri,options) if response.headers['content-type'].start_with?('application/json') - resbody = JSON.parse(response.body) + if response.body.blank? + resbody = {} + else + resbody = JSON.parse(response.body) + end else resbody = response.body end
Check if response is empty in wrapper
diff --git a/plugins/orders/lib/controller_inheritance.rb b/plugins/orders/lib/controller_inheritance.rb index abc1234..def5678 100644 --- a/plugins/orders/lib/controller_inheritance.rb +++ b/plugins/orders/lib/controller_inheritance.rb @@ -3,7 +3,7 @@ module ClassMethods def hmvc context - cattr_accessor :hmvc_paths + class_attribute :hmvc_paths class_attribute :inherit_templates class_attribute :hmvc_inheritable class_attribute :hmvc_context
Make hmvc paths specific for each controller
diff --git a/rack-cas-rails.gemspec b/rack-cas-rails.gemspec index abc1234..def5678 100644 --- a/rack-cas-rails.gemspec +++ b/rack-cas-rails.gemspec @@ -19,11 +19,13 @@ spec.homepage = "https://github.com/bitaxis/rack-cas-rails.git" spec.license = "MIT" - spec.add_runtime_dependency "rack-cas", "~> 0.9.2" - spec.add_runtime_dependency "rails", "~> 4.2", ">= 4.2.0" + spec.add_runtime_dependency "byebug" + spec.add_runtime_dependency "rack-cas", "~> 0.15" + spec.add_runtime_dependency "rails", "~> 5.0", ">= 5.0.0" spec.add_development_dependency "byebug" spec.add_development_dependency "dotenv-rails" + spec.add_development_dependency "rails-controller-testing" spec.add_development_dependency "sqlite3" spec.add_development_dependency "yard"
Update to new versions of gems.
diff --git a/queue.rb b/queue.rb index abc1234..def5678 100644 --- a/queue.rb +++ b/queue.rb @@ -1,4 +1,4 @@-require_relative 'linked_list' +require_relative "linked_list" # Implement a Queue using a linked list # Note: # 1. All operations should take O(1) time @@ -22,6 +22,8 @@ class Queue class UnderflowError < StandardError; end + + attr_reader :list def initialize @list = LinkedList.new
Add attr_reader :list to Queue class
diff --git a/lib/dynflow/executors.rb b/lib/dynflow/executors.rb index abc1234..def5678 100644 --- a/lib/dynflow/executors.rb +++ b/lib/dynflow/executors.rb @@ -8,9 +8,10 @@ # we should wrap it with this method, and we can ensure here to do # necessary cleanup, such as cleaning ActiveRecord connections def self.run_user_code + clear_connections = defined?(::ActiveRecord) && ActiveRecord::Base.connected? && ActiveRecord::Base.connection.open_transactions.zero? yield ensure - ::ActiveRecord::Base.clear_active_connections! if defined? ::ActiveRecord + ::ActiveRecord::Base.clear_active_connections! if clear_connections end end
Clear AR connections only if there are no open transactions
diff --git a/lib/jekyll/minibundle.rb b/lib/jekyll/minibundle.rb index abc1234..def5678 100644 --- a/lib/jekyll/minibundle.rb +++ b/lib/jekyll/minibundle.rb @@ -1,5 +1,7 @@-if defined?(Jekyll::VERSION) && Jekyll::VERSION < '3' - raise 'Minibundle plugin requires Jekyll version 3 or above' +if defined?(Jekyll::VERSION) && + defined?(Gem::Version) && + (Gem::Version.create(Jekyll::VERSION) < Gem::Version.create('3.0.0')) + raise 'Minibundle plugin requires Jekyll version >= 3.0.0' end require 'jekyll/minibundle/version'
Fix Jekyll version requirement check to be more reliable
diff --git a/lib/lotus/validations.rb b/lib/lotus/validations.rb index abc1234..def5678 100644 --- a/lib/lotus/validations.rb +++ b/lib/lotus/validations.rb @@ -32,7 +32,7 @@ module ClassMethods def attribute(name, options = {}) - attributes << [name, options] + attributes[name] = options class_eval %{ def #{ name } @@ -43,7 +43,7 @@ # FIXME make this private def attributes - @attributes ||= Set.new + @attributes ||= Hash.new end end end
Use Hash over Set as attributes registry
diff --git a/lib/mulder/capistrano.rb b/lib/mulder/capistrano.rb index abc1234..def5678 100644 --- a/lib/mulder/capistrano.rb +++ b/lib/mulder/capistrano.rb @@ -11,7 +11,7 @@ end def client(role) - @client ||= ::Mulder::Client.new(@connection, @application, @environment, role) + @client = ::Mulder::Client.new(@connection, @application, @environment, role) end def ips(role, use_private = false)
Fix an issue with memoizing the client
diff --git a/spec/mongo/view/user_spec.rb b/spec/mongo/view/user_spec.rb index abc1234..def5678 100644 --- a/spec/mongo/view/user_spec.rb +++ b/spec/mongo/view/user_spec.rb @@ -58,10 +58,14 @@ context 'when removal was not successful' do - it 'raises an exception' do + it 'raises an exception', if: write_command_enabled? do expect { view.remove('notauser') }.to raise_error(Mongo::Operation::Write::Failure) + end + + it 'does not raise an exception', unless: write_command_enabled? do + expect(view.remove('notauser').n).to eq(0) end end end
Fix user spec for 2.4
diff --git a/lib/sidekiq-scheduler.rb b/lib/sidekiq-scheduler.rb index abc1234..def5678 100644 --- a/lib/sidekiq-scheduler.rb +++ b/lib/sidekiq-scheduler.rb @@ -18,7 +18,7 @@ config.options[:schedule_manager].start end - config.on(:shutdown) do + config.on(:quiet) do config.options[:schedule_manager].stop end
Stop scheduling jobs after receiving :quiet event
diff --git a/spec/usaidwat/client_spec.rb b/spec/usaidwat/client_spec.rb index abc1234..def5678 100644 --- a/spec/usaidwat/client_spec.rb +++ b/spec/usaidwat/client_spec.rb @@ -4,6 +4,8 @@ module Client describe Client do before(:each) do + WebMock.disable_net_connect! + WebMock.reset! root = File.expand_path("../../../test/responses", __FILE__) stub_request(:get, "http://www.reddit.com/user/mipadi/comments.json?after=&limit=100"). to_return(:body => IO.read(File.join(root, "comments.json")))
Reset WebMock before running RSpec tests
diff --git a/spec/features/search_forms_spec.rb b/spec/features/search_forms_spec.rb index abc1234..def5678 100644 --- a/spec/features/search_forms_spec.rb +++ b/spec/features/search_forms_spec.rb @@ -4,6 +4,6 @@ scenario "renders SearchForm component" do visit "/" expect(page).to have_css('form') - expect(page).to have_content('Genetic Markers') + expect(page).to have_content('Is chemotherapy your main form of treatment?') end end
Fix failing test on SearchForm feature test
diff --git a/spec/noir/command/new/note_spec.rb b/spec/noir/command/new/note_spec.rb index abc1234..def5678 100644 --- a/spec/noir/command/new/note_spec.rb +++ b/spec/noir/command/new/note_spec.rb @@ -11,4 +11,22 @@ expect(Noir::Command::New).to receive(:createFile) expect{Noir::Command::New::Note.execute}.to output.to_stdout end + + it 'is support empty directory' do + allow(Dir).to receive(:glob).with(anything).and_return([]) + expect(Noir::Command::New).to receive(:createFile) + expect{Noir::Command::New::Note.execute}.to output(/^01_.*txt$/).to_stdout + end + + it 'is support directory include few files' do + allow(Dir).to receive(:glob).with(anything).and_return(10.times.to_a) + expect(Noir::Command::New).to receive(:createFile) + expect{Noir::Command::New::Note.execute}.to output(/^11_.*txt$/).to_stdout + end + + it 'is support directory include over 100 files' do + allow(Dir).to receive(:glob).with(anything).and_return(120.times.to_a) + expect(Noir::Command::New).to receive(:createFile) + expect{Noir::Command::New::Note.execute}.to output(/^121_.*txt$/).to_stdout + end end
Add spec to new note command
diff --git a/rasn1.gemspec b/rasn1.gemspec index abc1234..def5678 100644 --- a/rasn1.gemspec +++ b/rasn1.gemspec @@ -21,8 +21,7 @@ spec.required_ruby_version = '>= 2.2.0' - spec.add_dependency 'yard', '~>0.9' - + spec.add_development_dependency 'yard', '~>0.9' spec.add_development_dependency 'bundler', '~> 1.13' spec.add_development_dependency 'rake', '~> 10.0' spec.add_development_dependency 'rspec', '~> 3.0'
Move yard as a development dependency
diff --git a/railties/lib/rails/generators/test_unit/integration/templates/integration_test.rb b/railties/lib/rails/generators/test_unit/integration/templates/integration_test.rb index abc1234..def5678 100644 --- a/railties/lib/rails/generators/test_unit/integration/templates/integration_test.rb +++ b/railties/lib/rails/generators/test_unit/integration/templates/integration_test.rb @@ -1,7 +1,9 @@ require 'test_helper' +<% module_namespacing do -%> class <%= class_name %>Test < ActionDispatch::IntegrationTest # test "the truth" do # assert true # end end +<% end -%>
Add missing module namespacing wrapper refs: #28011
diff --git a/core/app/models/spree/tax/item_adjuster.rb b/core/app/models/spree/tax/item_adjuster.rb index abc1234..def5678 100644 --- a/core/app/models/spree/tax/item_adjuster.rb +++ b/core/app/models/spree/tax/item_adjuster.rb @@ -20,9 +20,6 @@ # Deletes all existing tax adjustments and creates new adjustments for all # (geographically and category-wise) applicable tax rates. # - # Creating the adjustments will also run the ItemAdjustments class and - # persist all taxation and promotion totals on the item. - # # @return [Array<Spree::Adjustment>] newly created adjustments def adjust! return unless order_tax_zone(order)
Remove outdated comment in Tax::ItemAdjuster This was changed in 929cb02 and OrderUpdater must now be run to update item and order totals.
diff --git a/db/migrate/20170406105110_create_states.rb b/db/migrate/20170406105110_create_states.rb index abc1234..def5678 100644 --- a/db/migrate/20170406105110_create_states.rb +++ b/db/migrate/20170406105110_create_states.rb @@ -3,7 +3,6 @@ create_table :states do |t| t.string :name, null: false t.string :display_name, null: false - t.timestamps end end end
Remove timestamps from states migration
diff --git a/lib/sudoku/difficulty_analyzer.rb b/lib/sudoku/difficulty_analyzer.rb index abc1234..def5678 100644 --- a/lib/sudoku/difficulty_analyzer.rb +++ b/lib/sudoku/difficulty_analyzer.rb @@ -1,9 +1,8 @@ module Sudoku class DifficultyAnalyzer - attr_reader :grid - - def initialize(grid) + attr_accessor :grid + def initialize(grid = nil) @grid = grid end
Allow creating difficulty analyzer with no init grid
diff --git a/lib/rubuzz.rb b/lib/rubuzz.rb index abc1234..def5678 100644 --- a/lib/rubuzz.rb +++ b/lib/rubuzz.rb @@ -8,11 +8,11 @@ require 'yaml' -require 'rubuzz/buzz_feed' - module Rubuzz version = YAML.load_file(File.join(File.dirname(__FILE__), '..', 'VERSION.yml')) VERSION = "#{version[:major]}.#{version[:minor]}.#{version[:patch]}" end + +require 'rubuzz/buzz_feed'
Define VERSION before requiring other files
diff --git a/lib/fakeredis/rspec.rb b/lib/fakeredis/rspec.rb index abc1234..def5678 100644 --- a/lib/fakeredis/rspec.rb +++ b/lib/fakeredis/rspec.rb @@ -1,11 +1,11 @@-# Require this either in your Gemfile or in RSpec's -# support scripts. Examples: +# Require this either in your Gemfile or in RSpec's +# support scripts. Examples: # # # Gemfile # group :test do # gem "rspec" # gem "fakeredis", :require => "fakeredis/rspec" -# end +# end # # # spec/support/fakeredis.rb # require 'fakeredis/rspec' @@ -15,10 +15,9 @@ require 'fakeredis' RSpec.configure do |c| - + c.before do - redis = Redis.current - redis.flushdb if redis.client.connection.is_a?(Redis::Connection::Memory) + Redis::Connection::Memory.instances.values.each &:flushdb end - + end
Reset all instances we know of before each spec Because we know all the redis memory instances we've created, we can just flush just those from spec to spec.
diff --git a/lib/git_fame/result.rb b/lib/git_fame/result.rb index abc1234..def5678 100644 --- a/lib/git_fame/result.rb +++ b/lib/git_fame/result.rb @@ -1,7 +1,6 @@ module GitFame - class Result < Struct.new(:data, :success?) - def to_s - data - end + class Result < Struct.new(:data, :success) + def to_s; data; end + def success?; success; end end end
Remove ? in struct method for 1.9.2 compatibility
diff --git a/lib/graphite/render.rb b/lib/graphite/render.rb index abc1234..def5678 100644 --- a/lib/graphite/render.rb +++ b/lib/graphite/render.rb @@ -23,6 +23,8 @@ else @functions << function.first.to_sym end + + target end private
Add easier to understand return values
diff --git a/app/controllers/dashboard/todos_controller.rb b/app/controllers/dashboard/todos_controller.rb index abc1234..def5678 100644 --- a/app/controllers/dashboard/todos_controller.rb +++ b/app/controllers/dashboard/todos_controller.rb @@ -1,5 +1,5 @@ class Dashboard::TodosController < Dashboard::ApplicationController - before_filter :find_todos, only: [:index, :destroy_all] + before_action :find_todos, only: [:index, :destroy_all] def index @todos = @todos.page(params[:page]).per(PER_PAGE)
Use before_action instead of before_filter
diff --git a/app/controllers/groups/requests_controller.rb b/app/controllers/groups/requests_controller.rb index abc1234..def5678 100644 --- a/app/controllers/groups/requests_controller.rb +++ b/app/controllers/groups/requests_controller.rb @@ -35,7 +35,7 @@ end def request_path(*args) - me_request_path(@group, *args) + me_request_path(*args) end end
Change so group members can approve/reject/destroy requests to the group.
diff --git a/app/serializers/skirmish/player_serializer.rb b/app/serializers/skirmish/player_serializer.rb index abc1234..def5678 100644 --- a/app/serializers/skirmish/player_serializer.rb +++ b/app/serializers/skirmish/player_serializer.rb @@ -1,4 +1,4 @@ class Skirmish::PlayerSerializer < ActiveModel::Serializer - attributes :id, :name + attributes :id, :name, :user_id has_many :cities end
Include user_id in Players when serialized
diff --git a/lib/braintree-rails.rb b/lib/braintree-rails.rb index abc1234..def5678 100644 --- a/lib/braintree-rails.rb +++ b/lib/braintree-rails.rb @@ -1,10 +1,6 @@ require File.expand_path(File.join(File.dirname(__FILE__), 'env')) require 'active_model' -require 'active_support/core_ext/object' -require 'active_support/core_ext/hash/except' -require 'active_support/core_ext/hash/deep_dup' -require 'active_support/core_ext/enumerable' -require 'active_support/core_ext/module/delegation' +require 'active_support/core_ext' require 'active_support/dependencies' require 'active_support/inflector' require 'ostruct'
Make it Rails 4.0 compatible
diff --git a/spec/system/cars_endpoint_spec.rb b/spec/system/cars_endpoint_spec.rb index abc1234..def5678 100644 --- a/spec/system/cars_endpoint_spec.rb +++ b/spec/system/cars_endpoint_spec.rb @@ -2,7 +2,7 @@ RSpec.describe "System tests" do describe "/cars API endpoint" do - let!(:pipe) { open("|cars_api server") } + let!(:pipe) { open("|cars_api server --server=webrick") } after do Process.kill("INT", pipe.pid)
Use --server=webrick for system level tests, since default 'thin' is not available on every environment
diff --git a/lib/metamuse/artist.rb b/lib/metamuse/artist.rb index abc1234..def5678 100644 --- a/lib/metamuse/artist.rb +++ b/lib/metamuse/artist.rb @@ -34,7 +34,15 @@ self.albums = artist.albums end + def inspect + "#<#{self.class.inspect}:#{object_id.inspect}, name: #{name.inspect}, echonest_id: #{echonest_id.inspect}, freebase_guid: #{freebase_guid.inspect}, mbid: #{mbid.inspect}, albums: #{album_names.inspect}>" + end + private + + def album_names + @album_names ||= albums.map {|a| a.name} + end def lastfm_albums @lastfm_albums ||= Services::Lastfm.top_albums(name)
Make Artist inspect more readable
diff --git a/db/migrate/20171005204316_add_product_archive_to_checklist_test.rb b/db/migrate/20171005204316_add_product_archive_to_checklist_test.rb index abc1234..def5678 100644 --- a/db/migrate/20171005204316_add_product_archive_to_checklist_test.rb +++ b/db/migrate/20171005204316_add_product_archive_to_checklist_test.rb @@ -0,0 +1,10 @@+class AddProductArchiveToChecklistTest < Mongoid::Migration + def self.up + ChecklistTest.each do |checklist_test| + checklist_test.archive_records + end + end + + def self.down + end +end
Add migration to automatically generate patient_archives for checklist_tests
diff --git a/lib/ventriloquist/cap/debian/erlang_install.rb b/lib/ventriloquist/cap/debian/erlang_install.rb index abc1234..def5678 100644 --- a/lib/ventriloquist/cap/debian/erlang_install.rb +++ b/lib/ventriloquist/cap/debian/erlang_install.rb @@ -3,15 +3,33 @@ module Cap module Debian module ErlangInstall + ERLANG_SOLUTIONS_PKG = "https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb" + def self.erlang_install(machine) machine.communicate.tap do |comm| if ! comm.test('which erlang > /dev/null') machine.env.ui.info('Installing Erlang') - comm.execute('wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb') - comm.sudo('dpkg -i erlang-solutions_1.0_all.deb') + + path = download_path(comm) + unless comm.test("-f #{path}") + machine.capability(:download, ERLANG_SOLUTIONS_PKG, path) + end + comm.sudo("dpkg -i #{path}") + comm.sudo('apt-get update') comm.sudo('apt-get -y install erlang') end + end + end + + private + + def self.download_path(comm) + # If vagrant-cachier apt cache bucket is available, drop it there + if comm.test("test -d /tmp/vagrant-cache/apt") + "/tmp/vagrant-cache/apt/erlang-solutions_1.0_all.deb" + else + "/tmp/erlang-solutions_1.0_all.deb" end end end
erlang: Make use of `download` capability to download initial .deb and allow caching with vagrant-cachier
diff --git a/libraries/_autoload.rb b/libraries/_autoload.rb index abc1234..def5678 100644 --- a/libraries/_autoload.rb +++ b/libraries/_autoload.rb @@ -1,2 +1,6 @@-$LOAD_PATH.push *Dir[File.expand_path('../../files/default/vendor/gems/**/lib', __FILE__)] +# Set up rubygems to activate any gems we find herein. +ENV['GEM_PATH'] = ([ File.expand_path('../../files/default/vendor', __FILE__) ] + Gem.path).join(Gem.path_separator) +Gem.paths = ENV +gem 'docker-api', '~> 1.24' + $LOAD_PATH.unshift *Dir[File.expand_path('..', __FILE__)]
Allow distributed gems to be activated normally via Ruby Handles these cases better: 1. If docker-api is not loaded or installed on the system, the cookbook’s version will be used. 2. If docker-api is not loaded, and docker-api 1.30 is installed on the system, that will be loaded instead. 3. If docker-api is not loaded, and docker-api 1.23 is installed on the system, the cookbook's version (1.24) will be used. 4. If someone else loaded docker-api 1.23 already, we fail to load the cookbook since it's not an acceptable version. 5. If someone else loaded docker-api 1.30 already, we don't load anything because it is an acceptable version.
diff --git a/pear.gemspec b/pear.gemspec index abc1234..def5678 100644 --- a/pear.gemspec +++ b/pear.gemspec @@ -8,7 +8,7 @@ spec.version = Pear::VERSION spec.authors = ["Horacio Bertorello"] spec.email = ["syrii@msn.com"] - spec.summary = %q{Pear is a simple pair-programmint tool for teams.} + spec.summary = %q{Pear is a pair-programming command-line tool for Git.} spec.homepage = "https://github.com/svankmajer/pear" spec.license = "MIT"
Fix typo on gemspec summary.
diff --git a/middleman-patterns.gemspec b/middleman-patterns.gemspec index abc1234..def5678 100644 --- a/middleman-patterns.gemspec +++ b/middleman-patterns.gemspec @@ -17,6 +17,7 @@ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) } s.require_paths = ['lib'] - # The version of middleman-core your extension depends on + s.licenses = ['MIT'] + s.add_runtime_dependency('middleman-core', ['>= 3.3.7']) end
Add MIT license ref in gemspec
diff --git a/foodr-backend/app/controllers/users_controller.rb b/foodr-backend/app/controllers/users_controller.rb index abc1234..def5678 100644 --- a/foodr-backend/app/controllers/users_controller.rb +++ b/foodr-backend/app/controllers/users_controller.rb @@ -3,13 +3,16 @@ user = User.find_by(id: params[:id]) if user - searches = user.products + searches = user.searches + searched_products = user.products saved_product_ids = user.searches.where(is_saved: true).pluck(:product_id) saved_products = Product.find(saved_product_ids) + render json: { found: true, user: user, searches: searches, + searched_products: searched_products, saved_products: saved_products }.to_json else
Add searches to JSON output of user profile
diff --git a/tasks/boxes.rake b/tasks/boxes.rake index abc1234..def5678 100644 --- a/tasks/boxes.rake +++ b/tasks/boxes.rake @@ -1,13 +1,15 @@ namespace :boxes do - namespace :build do + namespace :quantal64 do desc 'Build Ubuntu Quantal 64 bits Vagrant LXC box' - task 'quantal64' do - unless File.exists?('./boxes/quantal64/rootfs-amd64') - sh 'cd boxes/quantal64 && ./download-ubuntu' + task :build do + if File.exists?('./boxes/output/lxc-quantal64.box') + puts 'Box has been built already!' + exit 1 end sh 'mkdir -p boxes/output' - sh 'sudo rm -f output/lxc-quantal64.box boxes/quantal64/rootfs.tar.gz' + sh 'cd boxes/quantal64 && sudo ./download-ubuntu' + sh 'rm -f boxes/quantal64/rootfs.tar.gz' sh 'cd boxes/quantal64 && sudo tar --numeric-owner -czf rootfs.tar.gz ./rootfs-amd64/*' sh "cd boxes/quantal64 && sudo chown #{ENV['USER']}:#{ENV['USER']} rootfs.tar.gz && tar -czf ../output/lxc-quantal64.box ./* --exclude=rootfs-amd64 --exclude=download-ubuntu" end
Rename rake task for building the base quantal64 box and prevent it from running when box has already been built.
diff --git a/spyme.gemspec b/spyme.gemspec index abc1234..def5678 100644 --- a/spyme.gemspec +++ b/spyme.gemspec @@ -17,7 +17,7 @@ s.files = Dir["{app,config,lib,vendor}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"] s.test_files = Dir["test/**/*"] - s.add_dependency "rails", "~> 4.1" + s.add_dependency "rails", "> 4.1" s.add_development_dependency "sqlite3", "~> 1.3" end
Fix issue dependency for rails 5 changed to "rails", "> 4.1" so it can support rails 5 too.
diff --git a/lib/pinboard/client.rb b/lib/pinboard/client.rb index abc1234..def5678 100644 --- a/lib/pinboard/client.rb +++ b/lib/pinboard/client.rb @@ -15,7 +15,7 @@ options[:basic_auth] = @auth options[:query] = params posts = self.class.get('/posts/all', options)['posts']['post'] - posts = Array.new(1, posts) if !posts.kind_of?(Array) + posts = Array.new(1, posts) if !posts.nil? && !posts.kind_of?(Array) if !posts.nil? posts.map { |p| Post.new(Util.symbolize_keys(p)) } end
Add check for nil to fix new issue if no results are returned
diff --git a/lib/puppet-profiler.rb b/lib/puppet-profiler.rb index abc1234..def5678 100644 --- a/lib/puppet-profiler.rb +++ b/lib/puppet-profiler.rb @@ -3,19 +3,13 @@ output = `puppet agent --test --evaltrace --color=false`.split("\n") times = [] - resources = output.select { |line| - line =~ /.+: E?valuated in [\d\.]+ seconds$/ - }.each { |line| - res_line, junk, eval_line = line.rpartition(':') - if eval_line =~ / E?valuated in ([\d\.]+) seconds$/ - time = $1.to_f - end - junk, junk, res_line = res_line.partition(':') - if res_line =~ /.*([A-Z][^\[]+)\[(.+?)\]$/ + output.each { |line| + if line =~ /info: .*([A-Z][^\[]+)\[(.+?)\]: Evaluated in ([\d\.]+) seconds$/ type = $1 title = $2 + time = $3.to_f + times << [type, title, time] end - times << [type, title, time] } puts "Top #{num_res} Puppet resources by runtime"
Use more complex regular expression instead of partititon and rpartition, which are not available in ruby 1.8.5.
diff --git a/cookbooks/elasticsearch/recipes/default.rb b/cookbooks/elasticsearch/recipes/default.rb index abc1234..def5678 100644 --- a/cookbooks/elasticsearch/recipes/default.rb +++ b/cookbooks/elasticsearch/recipes/default.rb @@ -17,7 +17,7 @@ # limitations under the License. # -package "openjdk-7-jre-headless" +package "default-jre-headless" package "elasticsearch" template "/etc/elasticsearch/elasticsearch.yml" do
Update elasticsearch cookbook for Ubuntu 16.04
diff --git a/media_concerns.gemspec b/media_concerns.gemspec index abc1234..def5678 100644 --- a/media_concerns.gemspec +++ b/media_concerns.gemspec @@ -16,6 +16,7 @@ s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"] s.add_dependency "rails", "~> 4.2.7" + s.add_dependency "curation_concerns", '~> 1.2.0' s.add_development_dependency "sqlite3" s.add_development_dependency "rspec-rails"
Add curation_concerns as gem dependency. Afterward, should be able to run: bundle exec rake engine_cart:generate
diff --git a/ruby/spec/adventofcode/day_13/part_2_spec.rb b/ruby/spec/adventofcode/day_13/part_2_spec.rb index abc1234..def5678 100644 --- a/ruby/spec/adventofcode/day_13/part_2_spec.rb +++ b/ruby/spec/adventofcode/day_13/part_2_spec.rb @@ -6,7 +6,7 @@ let(:challenge_input) { load_fixture('day_13.txt') } it('returns the correct answer for the challenge input') do - expect(subject.run(challenge_input)).to eql(0) + expect(subject.run(challenge_input)).to eql(725) end end end
Fix broken spec for Day 13.
diff --git a/recipes/_nginx.rb b/recipes/_nginx.rb index abc1234..def5678 100644 --- a/recipes/_nginx.rb +++ b/recipes/_nginx.rb @@ -9,11 +9,6 @@ node.default['oc-graphite']['uwsgi']['listen_ip'] = '127.0.0.1' node.default['oc-graphite']['uwsgi']['listen_port'] = '8081' include_recipe 'oc-graphite::_uwsgi' - -service 'nginx' do - action [:enable, :start] - supports :restart => true, :start => true, :stop => true, :reload => true -end template '/etc/nginx/sites-available/graphite' do source 'nginx-graphite.erb' @@ -34,3 +29,8 @@ notifies :reload, 'service[nginx]', :delayed only_if { node['oc-graphite']['nginx']['disable_default_vhost'] } end + +service 'nginx' do + action [:enable, :start] + supports :restart => true, :reload => true +end
Move nginx service to end of recipe Service resources generally should be at the end of recipes when they have configuration files that can modify their behavior. If a configuration file is broken, and the service fails to restart, it will always fail to start before Chef has a chance to configure the file/template that could fix whatever configuration was broken.
diff --git a/activerecord-safer_migrations.gemspec b/activerecord-safer_migrations.gemspec index abc1234..def5678 100644 --- a/activerecord-safer_migrations.gemspec +++ b/activerecord-safer_migrations.gemspec @@ -20,5 +20,5 @@ gem.add_development_dependency "pg", "~> 0.21.0" gem.add_development_dependency "rspec", "~> 3.7.0" - gem.add_development_dependency "rubocop", "~> 0.55.0" + gem.add_development_dependency "rubocop", "~> 0.56.0" end
Update rubocop requirement to ~> 0.56.0 Updates the requirements on [rubocop](https://github.com/bbatsov/rubocop) to permit the latest version. - [Release notes](https://github.com/bbatsov/rubocop/releases) - [Changelog](https://github.com/bbatsov/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/bbatsov/rubocop/commits/v0.56.0) Signed-off-by: dependabot[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>
diff --git a/t/services.rb b/t/services.rb index abc1234..def5678 100644 --- a/t/services.rb +++ b/t/services.rb @@ -0,0 +1,10 @@+require 'test_helper' + +describe 'data' do + around { |test| VCR.use_cassette('konstantinos', &test) } + subject { WikiData::Fetcher.new(id: 'Q312013').data } + + it 'knows Konstantinos id' do + subject[:id].must_equal 'Q312013' + end +end
Set up the initial tests for website classification implementation This tests is used to fetch the data we need for the VCR cassete and check that everything works.
diff --git a/validates_xml_of.gemspec b/validates_xml_of.gemspec index abc1234..def5678 100644 --- a/validates_xml_of.gemspec +++ b/validates_xml_of.gemspec @@ -11,7 +11,7 @@ spec.summary = %q{Validates if an attribute has a valid xml content or a xsd valid content.} spec.description = spec.summary - spec.homepage = "https://github.com/brunoarueira/validates_xml" + spec.homepage = "https://github.com/brunoarueira/validates_xml_of" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
Fix the homepage info on the gemspec
diff --git a/problem_2.rb b/problem_2.rb index abc1234..def5678 100644 --- a/problem_2.rb +++ b/problem_2.rb @@ -0,0 +1,12 @@+a = 1 +b = 2 +sum = 0 + +while b <= 4_000_000 + c = a + b + a = b + b = c + sum += a if a % 2 == 0 +end + +p sum
Add a solution for problem 2
diff --git a/routes/devices.rb b/routes/devices.rb index abc1234..def5678 100644 --- a/routes/devices.rb +++ b/routes/devices.rb @@ -20,7 +20,12 @@ get '.json' do content_type :json - json list_devices_with_details + devices = list_devices_with_details + if devices.empty? + session[:device_sn] = nil + session[:package_name] = nil + end + json devices end get '/:device_sn/packages.json' do |device_sn|
Clear session value for selected device and package when there is not device.
diff --git a/app/models/spree/address_decorator.rb b/app/models/spree/address_decorator.rb index abc1234..def5678 100644 --- a/app/models/spree/address_decorator.rb +++ b/app/models/spree/address_decorator.rb @@ -29,7 +29,7 @@ if can_be_deleted? destroy_without_saving_used else - update_attribute(:deleted_at, Time.now) + update_attribute(:user_id, nil) end end alias_method_chain :destroy, :saving_used
Remove user association from address instead of setting deleted at flag
diff --git a/dropbox-archive.gemspec b/dropbox-archive.gemspec index abc1234..def5678 100644 --- a/dropbox-archive.gemspec +++ b/dropbox-archive.gemspec @@ -22,5 +22,5 @@ spec.add_development_dependency "rake" spec.add_dependency "dropbox-sdk" spec.add_dependency "thor" - spec.add_dependency "guard" + spec.add_dependency "listen" end
Remove dependency on guard, depend on listen instead
diff --git a/spec/lib/task_helpers/exports/alerts_spec.rb b/spec/lib/task_helpers/exports/alerts_spec.rb index abc1234..def5678 100644 --- a/spec/lib/task_helpers/exports/alerts_spec.rb +++ b/spec/lib/task_helpers/exports/alerts_spec.rb @@ -9,7 +9,8 @@ "description" => "Alert Export Test", "options" => nil, "db" => nil, - "expression" => nil, + "miq_expression" => nil, + "hash_expression" => nil, "responds_to_events" => nil, "enabled" => true, "read_only" => nil
Fix broken alert export spec failure Caused by https://github.com/ManageIQ/manageiq-schema/pull/49
diff --git a/prtg.gemspec b/prtg.gemspec index abc1234..def5678 100644 --- a/prtg.gemspec +++ b/prtg.gemspec @@ -3,9 +3,9 @@ s.name = 'prtg' s.version = '0.0.1' s.summary = 'Wrapper for the prtg network monitor api (http://www.paessler.com/prtg)' - s.description = 'Prtg is an network monitoring solution which provides a api throug http. This lib wrapps it for ruby.' + s.description = 'This gem is a wrapper around the prth http api.Prtg is an network monitoring solution which provides a api to retrieve several information about monitored devices.' - s.required_ruby_version = '>= 1.8.7' + s.required_ruby_version = '>= 1.9.2' s.required_rubygems_version = ">= 1.3.6" s.author = 'Konstantin Kanellopoulos'
Change required ruby and description
diff --git a/puppet-lint-no_cron_resources-check.gemspec b/puppet-lint-no_cron_resources-check.gemspec index abc1234..def5678 100644 --- a/puppet-lint-no_cron_resources-check.gemspec +++ b/puppet-lint-no_cron_resources-check.gemspec @@ -21,7 +21,7 @@ spec.add_development_dependency 'rspec', '~> 3.9.0' spec.add_development_dependency 'rspec-its', '~> 1.0' spec.add_development_dependency 'rspec-collection_matchers', '~> 1.0' - spec.add_development_dependency 'rubocop', '~> 0.84.0' + spec.add_development_dependency 'rubocop', '~> 0.85.0' spec.add_development_dependency 'rake', '~> 13.0.0' spec.add_development_dependency 'rspec-json_expectations', '~> 2.2' spec.add_development_dependency 'simplecov', '~> 0.18.0'
Update rubocop requirement from ~> 0.84.0 to ~> 0.85.0 Updates the requirements on [rubocop](https://github.com/rubocop-hq/rubocop) to permit the latest version. - [Release notes](https://github.com/rubocop-hq/rubocop/releases) - [Changelog](https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop-hq/rubocop/compare/v0.84.0...v0.85.0) Signed-off-by: dependabot-preview[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>