diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,10 +1,10 @@-10.times do { User.create!( username: Faker::Internet.user_name, email: Faker::Internet.email, password:"password" )} +10.times { User.create!( username: Faker::Internet.user_name, email: Faker::Internet.email, password:"password" )} users = User.all #Make Questions: users.each do |user| - user.create!() + 5.times { user.questions.create!( title: Faker::Book.title, content: Faker::Lorem.sentence ) } end #Make Best Answers
Create seed data for making questions
diff --git a/spec/integration/renalware/session_timeout/session_expiry_spec.rb b/spec/integration/renalware/session_timeout/session_expiry_spec.rb index abc1234..def5678 100644 --- a/spec/integration/renalware/session_timeout/session_expiry_spec.rb +++ b/spec/integration/renalware/session_timeout/session_expiry_spec.rb @@ -13,6 +13,7 @@ Devise.timeout_in = original_session_timeout end + # rubocop:disable Lint/HandleExceptions scenario "A user is redirected by JS to the login page when their session expires" do login_as_clinician @@ -25,8 +26,15 @@ sleep 0.3 # Because we don't want to wait for the default session timeout polling freq # to pass (could be 20 seconds), manually invoke the global sessionTimeoutCheck - # JavaScript function to force a check (and redirect if the session has expired) - page.execute_script(%Q(window.sessionTimeoutCheck();)) + # JavaScript function to force a check (and redirect if the session has expired). + # However we can expect an exception on the first and possibly second attempts + # as the JS has not loaded yet, with + # TypeError: undefined is not a constructor (evaluating 'window.sessionTimeoutCheck()') + begin + page.execute_script("window.sessionTimeoutCheck()") + rescue Capybara::Poltergeist::JavascriptError + # noop + end break if page.current_path == new_user_session_path end @@ -34,4 +42,5 @@ # to the login page expect(page).to have_current_path(new_user_session_path) end + # rubocop:enable Lint/HandleExceptions end
Handle js error in RSpec 3.7 Handle an issues ocurring with the introduction of RSpec 3.7 - presumably a timing issue - which means we can get an `TypeError: undefined is not a constructor (evaluating 'window.sessionTimeoutCheck()’)` as the js has not loaded yet.
diff --git a/lib/travis/worker/shell/buffer.rb b/lib/travis/worker/shell/buffer.rb index abc1234..def5678 100644 --- a/lib/travis/worker/shell/buffer.rb +++ b/lib/travis/worker/shell/buffer.rb @@ -15,7 +15,13 @@ def <<(other) super.tap do - limit_exeeded! if length > limit + # make sure limit is initialized and > 0. Appending here happens + # asynchronously and #initialize may or may not have finished running + # by then. In addition, #length here is a regular method which is not + # synchronized. All this leads to #limit_exeeded! being called + # too early (and this explains build logs w/o any output but this length limit + # system message). MK. + limit_exeeded! if @limit && (@limit > 0) && length > @limit end end
Check that limit is initialized and is > 0 before raising log length limit exceptions Buffer#<< is called asynchronously by a separate thread Net::SSH is using. Buffer#initialize may or may not happen by then. This causes build to be immediately terminated w/o log output some of the time, exactly what people have been reporting for the last day or so. As a side note, previous implementation used one condition and 2 methods in the output callback. Log length was initialized before SSH session was started. Now we have a String subclass, super.tap, lazy config initialization and exceptions. Maybe movign back to the previous approach will make things easier to reason about?
diff --git a/jekyll-commonmark.gemspec b/jekyll-commonmark.gemspec index abc1234..def5678 100644 --- a/jekyll-commonmark.gemspec +++ b/jekyll-commonmark.gemspec @@ -20,5 +20,5 @@ spec.add_development_dependency "bundler", "~> 1.6" spec.add_development_dependency "rake" spec.add_development_dependency "rspec", "~> 3.0" - spec.add_development_dependency "rubocop", "~> 0.49" + spec.add_development_dependency "rubocop", "~> 0.51" end
Use latest Rubocop like Jekyll
diff --git a/app/models/digest_history.rb b/app/models/digest_history.rb index abc1234..def5678 100644 --- a/app/models/digest_history.rb +++ b/app/models/digest_history.rb @@ -7,6 +7,7 @@ history.last_library_id = Library.last.id rescue 0 history.users_count = User.count history.save! + history end def discussions
Fix bug in return value of creating digest history
diff --git a/app/services/nomis/client.rb b/app/services/nomis/client.rb index abc1234..def5678 100644 --- a/app/services/nomis/client.rb +++ b/app/services/nomis/client.rb @@ -11,9 +11,9 @@ request(:get, route, params) end - def post(route, params) - request(:post, route, params) - end + # def post(route, params) + # request(:post, route, params) + # end private @@ -48,11 +48,11 @@ if method == :get || method == :delete { query: params } - else - { - body: params.to_json, - headers: { 'Content-Type' => 'application/json' } - } + # else + # { + # body: params.to_json, + # headers: { 'Content-Type' => 'application/json' } + # } end end end
Comment out (currently) unused code for RCov…
diff --git a/week-4/variables-methods.rb b/week-4/variables-methods.rb index abc1234..def5678 100644 --- a/week-4/variables-methods.rb +++ b/week-4/variables-methods.rb @@ -17,3 +17,24 @@ bigger_num = num.to_i + 1 puts "#{bigger_num} is better because it is bigger than #{num}." +=begin + +How do you define a local variable? + - A local variable is defined by assigning a value to a variable. There are four types of variables, instance, local ,class, and global variable. + +How do you define a method? + - A method is definded by a def commmand followed by method name and a code block below with an end at the end of the method. + +What is the difference between a local variable and a method? + - A local variable takes in a value, where a method can take in a code block and save a lot of time. + +How do you run a ruby program from the command line? + - To run a ruby program from the command line, you must be in the working directoy of the file and type ruby <filename> and hit enter. The file name must have the ruby extension (.rb) at the end. + +How do you run an RSpec file from the command line? + - and RSpec file is similar to runnning a ruby file however instead of ruby you must type rspec. + +What was confusing about this material? What made sense? + - The confusing part to me is the difference between puts, p and print. / return. I think the other pieces are fairly straight forward. + +end
Add reflection to MD file
diff --git a/execjs-xtrn.gemspec b/execjs-xtrn.gemspec index abc1234..def5678 100644 --- a/execjs-xtrn.gemspec +++ b/execjs-xtrn.gemspec @@ -23,5 +23,5 @@ spec.add_development_dependency "rake" spec.add_development_dependency "minitest" spec.add_development_dependency "coffee-script", '2.3.0' - spec.add_development_dependency "uglifier", '~> 2' + spec.add_development_dependency "uglifier" end
Revert "uglifier 3.0 uses globals too!" This reverts commit 2d8b0d2ae25fe04812d620fc6964195eab2e626e.
diff --git a/app/views/v1/talks/base.rabl b/app/views/v1/talks/base.rabl index abc1234..def5678 100644 --- a/app/views/v1/talks/base.rabl +++ b/app/views/v1/talks/base.rabl @@ -5,5 +5,5 @@ :discourse_url child :users do - attributes :first_name, :last_name, :email_md5, :job + attributes :name, :email_md5, :job end
Replace first+last name w/ name cc @robertdolca
diff --git a/spec/controllers/likes_controller_spec.rb b/spec/controllers/likes_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/likes_controller_spec.rb +++ b/spec/controllers/likes_controller_spec.rb @@ -15,11 +15,11 @@ describe "DELETE #destroy" do let(:user) { FactoryGirl.create :user } let(:checkin) { FactoryGirl.create :checkin } - # Create a like to remove + let(:like) { Like.create(liker_id: user.id, likeable_type: "Checkin", likeable_id: checkin.id)} it "deletes a like" do session[:user_id] = user.id post :create, checkin_id: checkin.id - delete :destroy + delete :destroy, id: Like.last.id, checkin_id: checkin.id, user_id: user.id expect(Like.find_by(liker_id: user.id)).to be nil end end
Fix test for destroying a like
diff --git a/spec/controllers/pages_controller_spec.rb b/spec/controllers/pages_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/pages_controller_spec.rb +++ b/spec/controllers/pages_controller_spec.rb @@ -1,4 +1,10 @@ require 'spec_helper' describe PagesController do + describe "#home" do + it "should be successful" do + get :home + response.should be_success + end + end end
Test that home page responses successfully.
diff --git a/filewatcher.gemspec b/filewatcher.gemspec index abc1234..def5678 100644 --- a/filewatcher.gemspec +++ b/filewatcher.gemspec @@ -21,7 +21,7 @@ s.add_development_dependency 'bundler', '~> 2.0' - s.add_development_dependency 'gem_toys', '~> 0.6.1' + s.add_development_dependency 'gem_toys', '~> 0.7.1' s.add_development_dependency 'toys', '~> 0.11.4' s.add_development_dependency 'codecov', '~> 0.5.1'
Update gem_toys to version 0.7.1
diff --git a/hiredis.gemspec b/hiredis.gemspec index abc1234..def5678 100644 --- a/hiredis.gemspec +++ b/hiredis.gemspec @@ -3,10 +3,10 @@ Gem::Specification.new do |s| s.name = "hiredis" s.version = Hiredis::VERSION - s.homepage = "http://github.com/pietern/hiredis-rb" + s.homepage = "http://github.com/redis/hiredis-rb" s.authors = ["Pieter Noordhuis"] s.email = ["pcnoordhuis@gmail.com"] - s.summary = "Ruby extension that wraps Hiredis (blocking connection and reply parsing)" + s.summary = "Ruby wrapper for hiredis (protocol serialization/deserialization and blocking I/O)" s.description = s.summary s.require_path = "lib"
Update URL and summary in gemspec
diff --git a/resources/config.rb b/resources/config.rb index abc1234..def5678 100644 --- a/resources/config.rb +++ b/resources/config.rb @@ -6,7 +6,7 @@ attribute :scope, equal_to: %w(local global system), default: 'global' attribute :path, kind_of: String attribute :user, kind_of: String -attribute :group, kind_of: String +attribute :group, kind_of: String attribute :options, kind_of: String attr_accessor :exists
Fix lint error from travis failure.
diff --git a/Casks/itouch-server.rb b/Casks/itouch-server.rb index abc1234..def5678 100644 --- a/Casks/itouch-server.rb +++ b/Casks/itouch-server.rb @@ -0,0 +1,10 @@+cask :v1 => 'itouch-server' do + version '1.0' + sha256 'e8aae0461ce7056adcc4940dda65d3ec8e4929092f0f2465b3e1dc5e353a362e' + + url "http://logitech.com/pub/techsupport/mouse/mac/touchmousev#{version}.dmg" + homepage 'http://support.logitech.com/en_us/product/6367' + license :unknown + + app 'iTouch-Server.app' +end
Add Logitech Touch Mouse Server Latest For everyone who sometimes do not want to use Mac's trackpad.
diff --git a/spec/services/creates_new_user_spec/sends_activation_needed_email_spec.rb b/spec/services/creates_new_user_spec/sends_activation_needed_email_spec.rb index abc1234..def5678 100644 --- a/spec/services/creates_new_user_spec/sends_activation_needed_email_spec.rb +++ b/spec/services/creates_new_user_spec/sends_activation_needed_email_spec.rb @@ -3,6 +3,7 @@ require "./app/services/creates_new_user/sends_activation_needed_email" describe Services::Actions::SendsActivationNeededEmail do + let(:email) { ActionMailer::Base.deliveries.last } let(:user) { create :user } it "expects a user to save" do @@ -10,11 +11,13 @@ raise_error LightService::ExpectedKeysNotInContextError end - it "sends the activation email" do + it "sends the activation email if the user is not activated" do user.activation_state = :pending user.activation_token = "BLAH" user.save + expect { described_class.execute user: user }.to \ change { ActionMailer::Base.deliveries.count }.by 1 + expect(email.subject).to eq "Welcome to GradeCraft! Please activate your account" end end
Improve the spec by checking the email that was sent
diff --git a/lib/motion_bindable/strategy.rb b/lib/motion_bindable/strategy.rb index abc1234..def5678 100644 --- a/lib/motion_bindable/strategy.rb +++ b/lib/motion_bindable/strategy.rb @@ -22,7 +22,7 @@ def initialize(object, attribute) @attribute = attribute.to_sym - self.object = WeakRef.new(object) + self.object = object end def bind(bound)
Remove the weak ref which is breaking KVO... for now.
diff --git a/Casks/hopper-disassembler.rb b/Casks/hopper-disassembler.rb index abc1234..def5678 100644 --- a/Casks/hopper-disassembler.rb +++ b/Casks/hopper-disassembler.rb @@ -1,8 +1,8 @@ cask :v1 => 'hopper-disassembler' do - version :latest - sha256 :no_check + version '3.8.0' + sha256 'e68b46aef94f8ac3296cd397758f9d3832409fe099bb35f847b10dbdf52157bb' - url 'http://www.hopperapp.com/HopperWeb/download_last_v3.php' + url "http://www.hopperapp.com/HopperWeb/downloads/Hopper-#{version}.zip" appcast 'http://www.hopperapp.com/HopperWeb/appcast.php' name 'Hopper' name 'Hopper Disassembler'
Update Hopper to use versioned downloads
diff --git a/db/migrate/20181207221258_add_has_attribution_to_content_collaborators.rb b/db/migrate/20181207221258_add_has_attribution_to_content_collaborators.rb index abc1234..def5678 100644 --- a/db/migrate/20181207221258_add_has_attribution_to_content_collaborators.rb +++ b/db/migrate/20181207221258_add_has_attribution_to_content_collaborators.rb @@ -4,6 +4,6 @@ end def down - remove_column, :content_collaborators, :has_attribution + remove_column :content_collaborators, :has_attribution end end
Remove comma in content_collaborators has_attribution down migration.
diff --git a/lib/memory_profiler/helpers.rb b/lib/memory_profiler/helpers.rb index abc1234..def5678 100644 --- a/lib/memory_profiler/helpers.rb +++ b/lib/memory_profiler/helpers.rb @@ -25,7 +25,7 @@ end def lookup_class_name(klass) - @class_name_cache[klass] ||= klass.name || '<<Unknown>>' + @class_name_cache[klass] ||= (klass && klass.name) || '<<Unknown>>' end end
Check for nil klass when looking up class names fixes #27
diff --git a/lib/config/wdtk-routes.rb b/lib/config/wdtk-routes.rb index abc1234..def5678 100644 --- a/lib/config/wdtk-routes.rb +++ b/lib/config/wdtk-routes.rb @@ -4,10 +4,10 @@ # Add a route for the survey scope '/profile/survey' do root :to => 'user#survey', :as => :survey - match '/reset' => 'user#survey_reset', :as => :survey_reset + get '/reset' => 'user#survey_reset', :as => :survey_reset end - match "/help/ico-guidance-for-authorities" => redirect("https://ico.org.uk/media/for-organisations/documents/how-to-disclose-information-safely-removing-personal-data-from-information-requests-and-datasets/1432979/how-to-disclose-information-safely.pdf + get "/help/ico-guidance-for-authorities" => redirect("https://ico.org.uk/media/for-organisations/documents/how-to-disclose-information-safely-removing-personal-data-from-information-requests-and-datasets/1432979/how-to-disclose-information-safely.pdf "), :as => :ico_guidance end
Add HTTP methods to custom routes The survey POSTs a non-alaveteli endpoint so shouldn't need POST.
diff --git a/lib/rspec/core/command_line.rb b/lib/rspec/core/command_line.rb index abc1234..def5678 100644 --- a/lib/rspec/core/command_line.rb +++ b/lib/rspec/core/command_line.rb @@ -14,7 +14,7 @@ def run(err, out) @options.configure(@configuration) @configuration.error_stream = err - @configuration.output_stream = out + @configuration.output_stream ||= out @configuration.require_files_to_run @configuration.configure_mock_framework @world.announce_inclusion_filter
Allow output_stream to be overridden in configuration
diff --git a/lib/time_series/time_series.rb b/lib/time_series/time_series.rb index abc1234..def5678 100644 --- a/lib/time_series/time_series.rb +++ b/lib/time_series/time_series.rb @@ -25,6 +25,7 @@ end class TimeSeriesCombination + class MismatchError < StandardError; end def initialize(*time_series) @time_series = time_series
Check for mismatched start_time before combining timeseries
diff --git a/ruby/example_code/s3/s3_ruby_bucket_website.rb b/ruby/example_code/s3/s3_ruby_bucket_website.rb index abc1234..def5678 100644 --- a/ruby/example_code/s3/s3_ruby_bucket_website.rb +++ b/ruby/example_code/s3/s3_ruby_bucket_website.rb @@ -0,0 +1,67 @@+# Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# This file is licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. A copy of the +# License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS +# OF ANY KIND, either express or implied. See the License for the specific +# language governing permissions and limitations under the License. + +require 'aws-sdk' + +# Using Random UUIDs to Avoid Collisions when Testing +require 'securerandom' +bucket = "example-test-bucket-#{SecureRandom.uuid}" + +# Setup +s3 = Aws::S3::Client.new(region: "us-west-2") +s3.create_bucket(bucket: bucket) + +# When Bucket Has No Website Configuration +begin + s3.get_bucket_website(bucket: bucket) +rescue Aws::S3::Errors::NoSuchWebsiteConfiguration + puts "No bucket website configuration present." +end + +# Adding Simple Pages & Website Configuration +s3.put_object( + bucket: bucket, + key: "index.html", + body: "Hello, Amazon S3!", + acl: "public-read" +) +s3.put_object( + bucket: bucket, + key: "error.html", + body: "Page not found!", + acl: "public-read" +) +s3.put_bucket_website( + bucket: bucket, + website_configuration: { + index_document: { + suffix: "index.html" + }, + error_document: { + key: "error.html" + } + } +) + +# Accessing as a Website +index_path = "http://#{bucket}.s3-website-us-west-2.amazonaws.com/" +error_path = "http://#{bucket}.s3-website-us-west-2.amazonaws.com/nonexistant.html" + +puts "Index Page Contents:\n#{Net::HTTP.get(URI(index_path))}\n\n" +puts "Error Page Contents:\n#{Net::HTTP.get(URI(error_path))}\n\n" + +# Removing Website Configuration +s3.delete_bucket_website(bucket: bucket) + +# Cleanup +b = Aws::S3::Resource.new(region: "us-west-2").bucket(bucket) +b.delete! # Recursively deletes objects as well.
Add S3 Bucket Website Example for Ruby
diff --git a/lib/trashed/newrelic/enable.rb b/lib/trashed/newrelic/enable.rb index abc1234..def5678 100644 --- a/lib/trashed/newrelic/enable.rb +++ b/lib/trashed/newrelic/enable.rb @@ -1,5 +1,7 @@ require 'trashed/newrelic/samplers' -[Trashed::LiveObjectsSampler, Trashed::AllocatedObjectsSampler].each do |sampler| - NewRelic::Agent.instance.add_sampler(sampler.new) if sampler.available? +if agent = NewRelic::Agent.instance && agent.respond_to?(:add_sampler) + [Trashed::LiveObjectsSampler, Trashed::AllocatedObjectsSampler].each do |sampler| + agent.add_sampler(sampler.new) if sampler.available? + end end
Add samplers only if newrelic is present and not shimmed
diff --git a/lib/travis/model/remote_log.rb b/lib/travis/model/remote_log.rb index abc1234..def5678 100644 --- a/lib/travis/model/remote_log.rb +++ b/lib/travis/model/remote_log.rb @@ -13,7 +13,7 @@ attribute :job_id, Integer attribute :purged_at, Time attribute :removed_at, Time - attribute :removed_by, Integer + attribute :removed_by_id, Integer attribute :updated_at, Time def job @@ -21,7 +21,7 @@ end def removed_by - @removed_by ||= User.find(attributes[:removed_by]) + @removed_by ||= User.find(removed_by_id) end def parts
Resolve remote log removed_by via removed_by_id instead
diff --git a/test/services/plus_one_test.rb b/test/services/plus_one_test.rb index abc1234..def5678 100644 --- a/test/services/plus_one_test.rb +++ b/test/services/plus_one_test.rb @@ -2,12 +2,16 @@ class PlusOneTest < ActiveSupport::TestCase - test "pluses someone with valid params" do + test "pluses someone and creates plus instance with valid params" do team = PrepareTeam.new.call(team_params) PlusOne.new(team).call(plus_params) result = GetStats.new.call(team_params) expected_result = "1: user_name2\n0: user_name1" + + plus = Plus.last + assert(plus, "Plus instance wasn't created") + assert_equal(result, expected_result) end
Add test to check if Plus instance was created
diff --git a/scripts/verhoeff_generator/bulk_generator.rb b/scripts/verhoeff_generator/bulk_generator.rb index abc1234..def5678 100644 --- a/scripts/verhoeff_generator/bulk_generator.rb +++ b/scripts/verhoeff_generator/bulk_generator.rb @@ -0,0 +1,21 @@+require './participant_verhoeff' + +ParticipantTypes = ['A', 'B', 'C'] +FacilityRange = 0..5 +ParticipantRange = 0..99 + +participants = [] + +ParticipantTypes.each do |type| + FacilityRange.each do |facility| + ParticipantRange.each do |participant| + padded_facility = facility.to_s.rjust(3,'0') + padded_participant = participant.to_s.rjust(2,'0') + pid = "#{type}-#{padded_facility}-#{padded_participant}" + pid_checked = ParticipantVerhoeff.generate_check(pid) + participants << [type, padded_facility, padded_participant, pid_checked[-1,1], pid_checked] + end + end +end + +p participants
Add bulk participant id generator
diff --git a/library/tempfile/_close_spec.rb b/library/tempfile/_close_spec.rb index abc1234..def5678 100644 --- a/library/tempfile/_close_spec.rb +++ b/library/tempfile/_close_spec.rb @@ -7,7 +7,7 @@ end it "is protected" do - @tempfile.protected_methods.should include("_close") + Tempfile.should have_protected_instance_method(:_close) end it "closes self" do
Use have_protected_instance_method for 1.9 compat
diff --git a/Formula/bartycrouch.rb b/Formula/bartycrouch.rb index abc1234..def5678 100644 --- a/Formula/bartycrouch.rb +++ b/Formula/bartycrouch.rb @@ -1,7 +1,7 @@ class Bartycrouch < Formula desc "Incrementally update/translate your Strings files" homepage "https://github.com/Flinesoft/BartyCrouch" - url "https://github.com/Flinesoft/BartyCrouch.git", :tag => "4.3.0", :revision => "42a6dd8305b72f7a9f89c1625803503adcef0350" + url "https://github.com/Flinesoft/BartyCrouch.git", :tag => "4.3.1", :revision => "fb18f5f6946a8ca87cde45e4ba4858a401ed968b" head "https://github.com/Flinesoft/BartyCrouch.git" depends_on :xcode => ["12.0", :build]
Update formula to version 4.3.1
diff --git a/Formula/codeclimate.rb b/Formula/codeclimate.rb index abc1234..def5678 100644 --- a/Formula/codeclimate.rb +++ b/Formula/codeclimate.rb @@ -8,6 +8,8 @@ # Alter PATH to ensure `docker' is available if Formula["docker"].linked_keg.exist? ENV.prepend_path "PATH", Formula["docker"].opt_bin + else + ENV.prepend_path "PATH", "/usr/local/bin" end ENV["PREFIX"] = prefix
Prepend /usr/local/bin if docker keg not installed This allows Homebrew users who prefer non-brew docker installations to continue using this formula.
diff --git a/gtm-oauth2-thekey.podspec b/gtm-oauth2-thekey.podspec index abc1234..def5678 100644 --- a/gtm-oauth2-thekey.podspec +++ b/gtm-oauth2-thekey.podspec @@ -1,11 +1,11 @@ Pod::Spec.new do |s| s.name = "gtm-oauth2-thekey" - s.version = "1.0.0" + s.version = "1.0.118" s.summary = "Google OAuth2 Framework modified for TheKey." s.homepage = "https://code.google.com/p/gtm-oauth2/" s.license = { :type => 'Apache License 2.0', :file => 'LICENSE.txt' } - s.author = { "Brian Zoetewey" => "brian.zoetewey@ccci.org" } - s.source = { :git => "git@git.gcx.org:ios/lib/gtm-oauth2-thekey.git", :tag => "v#{s.version}" } + s.authors = { "Greg Robbins" => "grobbi...@google.com", "Brian Zoetewey" => "brian.zoetewey@ccci.org" } + s.source = { :git => "git@git.gcx.org:ios/lib/gtm-oauth2-thekey.git", :tag => "v1.0.118" } s.source_files = 'Source/*.{h,m}', 'Source/Touch/*.{h,m}', 'HTTPFetcher/GTMHTTPFetcher.{h,m}' s.resources = 'Source/Touch/{*.xib}' s.framework = 'Security', 'SystemConfiguration'
Bump Version to 1.0.118, based on SVN r118
diff --git a/lib/electric_sheep/ssh.rb b/lib/electric_sheep/ssh.rb index abc1234..def5678 100644 --- a/lib/electric_sheep/ssh.rb +++ b/lib/electric_sheep/ssh.rb @@ -0,0 +1,13 @@+require 'net/ssh' + +module ElectricSheep + module SSH + def ssh_session(host, user, private_key, &block) + Net::SSH.start(host.hostname, user, + port: host.ssh_port, + key_data: Crypto.get_key(private_key, :private).export, + keys_only: true, + &block) + end + end +end
Add missing SSH module to git :bomb:
diff --git a/activesupport/lib/active_support/core_ext/hash/transform_values.rb b/activesupport/lib/active_support/core_ext/hash/transform_values.rb index abc1234..def5678 100644 --- a/activesupport/lib/active_support/core_ext/hash/transform_values.rb +++ b/activesupport/lib/active_support/core_ext/hash/transform_values.rb @@ -26,4 +26,5 @@ self[key] = yield(value) end end unless method_defined? :transform_values! + # TODO: Remove this file when supporting only Ruby 2.4+. end
Add comment to remove code when we are in Ruby 2.4
diff --git a/doc/test/table_test.rb b/doc/test/table_test.rb index abc1234..def5678 100644 --- a/doc/test/table_test.rb +++ b/doc/test/table_test.rb @@ -17,5 +17,8 @@ expected = "Hi a and b" actual = Main.new(:template=>"Hi <%= m %> and <%= n %>", :context=>{"m"=>"a", "n"=>"b"}).render assert_equal(actual, expected) + expected = "Hi a" + actual = Main.new(:template=>"Hi <%= inspect %>", :context=>{"inspect"=>"a"}).render + assert_equal(actual, expected) end end
Test rendering a shadowed method
diff --git a/spec/models/ontology_version/provers_spec.rb b/spec/models/ontology_version/provers_spec.rb index abc1234..def5678 100644 --- a/spec/models/ontology_version/provers_spec.rb +++ b/spec/models/ontology_version/provers_spec.rb @@ -0,0 +1,27 @@+require 'spec_helper' + +describe 'OntologyVersion - Provers' do + setup_hets + let(:user) { create :user } + let(:repository) { create :repository } + + before do + stub_hets_for('prove/Simple_Implications.casl') + @version = + version_for_file(repository, + ontology_file('prove/Simple_Implications', 'casl')) + @version.parse + end + + let(:ontology) { @version.ontology } + + it 'have fetched available provers' do + expect(@version.provers.count).to be > 0 + end + + it "all child ontologies' versions have fetched available provers" do + ontology.children.each do |child| + expect(child.current_version.provers.count).to be > 0 + end + end +end
Add spec for provers retrieval when parsing.
diff --git a/nacre.gemspec b/nacre.gemspec index abc1234..def5678 100644 --- a/nacre.gemspec +++ b/nacre.gemspec @@ -17,7 +17,7 @@ gem.add_dependency 'faraday' gem.add_dependency 'json' - gem.add_dependency 'active_support' + gem.add_dependency 'activesupport' gem.add_development_dependency 'rspec' gem.add_development_dependency 'rake' gem.add_development_dependency 'awesome_print'
Remove underscore for ActiveSupport gem which works only for Rails 3
diff --git a/guard-spork.gemspec b/guard-spork.gemspec index abc1234..def5678 100644 --- a/guard-spork.gemspec +++ b/guard-spork.gemspec @@ -16,12 +16,12 @@ s.required_rubygems_version = '>= 1.3.6' s.rubyforge_project = 'guard-spork' - s.add_dependency 'guard', '>= 1.1' + s.add_dependency 'guard', '~> 1.1' s.add_dependency 'spork', '>= 0.8.4' s.add_dependency 'childprocess', '>= 0.2.3' s.add_development_dependency 'bundler', '~> 1.0' - s.add_development_dependency 'rspec', '~> 2.10' + s.add_development_dependency 'rspec', '~> 2.99' s.add_development_dependency 'guard-rspec', '~> 1.0' s.files = Dir.glob('{lib}/**/*') + %w[LICENSE README.md]
Update guard and rspec versions in gemspec
diff --git a/api/app/views/mno_enterprise/jpi/v1/admin/users/show.json.jbuilder b/api/app/views/mno_enterprise/jpi/v1/admin/users/show.json.jbuilder index abc1234..def5678 100644 --- a/api/app/views/mno_enterprise/jpi/v1/admin/users/show.json.jbuilder +++ b/api/app/views/mno_enterprise/jpi/v1/admin/users/show.json.jbuilder @@ -1 +1 @@-json.user @user, :id, :uid, :email, :name, :surname, :admin_role+json.user @user, :id, :uid, :email, :phone, :name, :surname, :admin_role, :created_at, :confirmed_at, :last_sign_in_at
Add fields in user show view
diff --git a/lib/new_github_service.rb b/lib/new_github_service.rb index abc1234..def5678 100644 --- a/lib/new_github_service.rb +++ b/lib/new_github_service.rb @@ -0,0 +1,52 @@+module NewGithubService + ## + # GithubService is miq-bot's interface to the Github API. It acts as a + # wrapper around Octokit, delegating calls directly to the Octokit client as + # well as providing a space to keep useful augmentations of the interface for + # our own use cases. + # + # You can find the official Octokit documentation at http://octokit.github.io/octokit.rb + # + # Please check the documentation first before adding helper methods, as they + # may already be well handled by Octokit itself. + # + class << self + def service + @service ||= \ + begin + require 'octokit' + + unless Rails.env.test? + Octokit.configure do |c| + c.login = Settings.github_credentials.username + c.password = Settings.github_credentials.password + c.auto_paginate = true + + c.middleware = Faraday::RackBuilder.new do |builder| + builder.use GithubService::Response::RatelimitLogger + builder.use Octokit::Response::RaiseError + builder.use Octokit::Response::FeedParser + builder.adapter Faraday.default_adapter + end + end + end + + Octokit::Client.new + end + end + + private + + def respond_to_missing?(method_name, include_private=false) + service.respond_to?(method_name) + end + + def method_missing(method_name, *args, &block) + if service.respond_to?(method_name) + service.send(method_name, *args, &block) + else + super + end + end + end +end
Add new GithubService via Octokit This NewGithubService will eventually replace the current github_api GithubService class.
diff --git a/postgresql_lo_streamer.gemspec b/postgresql_lo_streamer.gemspec index abc1234..def5678 100644 --- a/postgresql_lo_streamer.gemspec +++ b/postgresql_lo_streamer.gemspec @@ -15,7 +15,7 @@ s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.md"] - s.add_dependency "rails", "~> 5.0" + s.add_dependency "rails", ">= 4.0" s.add_development_dependency "rspec-rails" s.add_development_dependency "rspec-its"
Change dependency on rails to 4.0 and up
diff --git a/lib/vagrant-env/config.rb b/lib/vagrant-env/config.rb index abc1234..def5678 100644 --- a/lib/vagrant-env/config.rb +++ b/lib/vagrant-env/config.rb @@ -8,7 +8,7 @@ # config.env.enable __FILE__ def enable(vagrantfile = nil) if vagrantfile - load File.dirname(vagrantfile) + '/.env' + load File.join File.dirname(vagrantfile), '.env' else # The default is .env in the current directory - but that may not be # the same directory that the Vagrantfile is in
Join the path with File.join Hardcoding '/' as a path separator will break on systems where '\' or some other path separator is used instead.
diff --git a/JSQSystemSoundPlayer.podspec b/JSQSystemSoundPlayer.podspec index abc1234..def5678 100644 --- a/JSQSystemSoundPlayer.podspec +++ b/JSQSystemSoundPlayer.podspec @@ -7,8 +7,10 @@ s.license = 'MIT' s.author = { 'Jesse Squires' => 'jesse.squires.developer@gmail.com' } s.source = { :git => 'https://github.com/jessesquires/JSQSystemSoundPlayer.git', :tag => s.version.to_s } - s.platform = :ios, '6.0' + s.ios.deployment_target = '6.0' + s.osx.deployment_target = '10.6' s.source_files = 'JSQSystemSoundPlayer/Classes/*' - s.frameworks = 'AudioToolbox', 'Foundation', 'UIKit' + s.ios.frameworks = 'AudioToolbox', 'Foundation', 'UIKit' + s.osx.frameworks = 'AudioToolbox', 'Foundation', s.requires_arc = true end
Update podspec for OS X
diff --git a/app/models/item.rb b/app/models/item.rb index abc1234..def5678 100644 --- a/app/models/item.rb +++ b/app/models/item.rb @@ -14,20 +14,24 @@ Item.where("id > ?", id).first end - def count_votes(vote) - user_votes.where(vote: vote).count + def get_user_votes_for(vote_type) + votes = Array.new(0) + + user_votes.each { |user_vote| votes << user_vote if user_vote.vote == vote_type } + + votes end def count_yes - count_votes "Yes" + get_user_votes_for("Yes").count end def count_no - count_votes "No" + get_user_votes_for("No").count end def count_skip - count_votes "Skip" + get_user_votes_for("Skip").count end def result
Change Method Name, Count Votes To Get User Votes Change the name and function of Count Votes from to Get User Votes because the count votes is doing too many select statements to the database. Get User Votes will find a participially vote type and return an array of objects for the vote.
diff --git a/app/models/item.rb b/app/models/item.rb index abc1234..def5678 100644 --- a/app/models/item.rb +++ b/app/models/item.rb @@ -2,6 +2,10 @@ belongs_to :user belongs_to :section has_attached_file :image, + :styles => { + :thumb => "100x100#", + :small => "150x150>", + :medium => "200x200" }, storage: :s3, s3_credentials: {access_key_id: ENV["AWS_KEY"], secret_access_key: ENV["AWS_SECRET"]}, bucket: "neverevernude"
Add sizes to image model
diff --git a/app/models/post.rb b/app/models/post.rb index abc1234..def5678 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -12,6 +12,7 @@ acts_as_taggable rescue nil # HACK: there is a known issue that acts_as_taggable breaks asset precompilation on Heroku. + default_scope ->{ order('posts.created_at DESC') } def to_s title
Add default order by latest first
diff --git a/app/models/user.rb b/app/models/user.rb index abc1234..def5678 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -22,7 +22,7 @@ private def friendly_token - ActiveSupport::SecureRandom.base64(15).tr('+/=', '-_ ').strip.delete("\n") + SecureRandom.base64(15).tr('+/=', '-_ ').strip.delete("\n") end end
Remove ActiveSupport:: to prevent deprecation warning
diff --git a/app/models/user.rb b/app/models/user.rb index abc1234..def5678 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -11,12 +11,15 @@ # Returns whether this user has access to (i.e. can edit/delete) given post # POST is a model object - def can_modify(post) - if post == nil + def can_modify(model) + if model == nil return false end - return post.posted_by == self.username || + # "User" model object does not have a "posted_by" field + owner = model.instance_of?(User) ? model.username : model.posted_by + + return owner == self.username || self.username == UsersController::ROOT end
Fix bug where exception is thrown when trying to edit User This is caused because User model objects do not have "posted_by" field, instead, they have "username". Thus, instance_of? method is used to determine the type of the argument, and get the "owner" of that object accordingly.
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index abc1234..def5678 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -45,4 +45,19 @@ expect(@third.previous(episode)).to eq(@first) end end + + describe 'active?' do + it "returns true for ideas" do + expect(FactoryGirl.create(:idea).active?).to eq(true) + end + + it "it returns true for projects" do + expect(FactoryGirl.create(:project).active?).to eq(true) + end + + it "returns false for anything that is not an idea or project" do + expect(FactoryGirl.create(:invention).active?).to eq(false) + expect(FactoryGirl.create(:record).active?).to eq(false) + end + end end
Add test for active? method of project model
diff --git a/spec/features/delayed/clear_all_jobs_spec.rb b/spec/features/delayed/clear_all_jobs_spec.rb index abc1234..def5678 100644 --- a/spec/features/delayed/clear_all_jobs_spec.rb +++ b/spec/features/delayed/clear_all_jobs_spec.rb @@ -0,0 +1,24 @@+require 'rails_helper' + +feature 'clearing all of the delayed jobs' do + + include SharedFunctionsForFeatures + + scenario 'clearing the jobs from the delayed index' do + given_there_are_two_delayed_jobs_enqueued_at_different_times + when_i_visit_the_delayed_jobs_page + and_i_click_the_clear_all_jobs_button + then_i_should_be_on_the_delayed_jobs_page + and_i_should_not_see_any_jobs_on_the_page + end + + def and_i_should_not_see_any_jobs_on_the_page + expect(page).to_not have_content 'SomeIvarJob' + expect(page).to_not have_content 'JobWithoutParams' + end + + def and_i_click_the_clear_all_jobs_button + click_button 'Clear Delayed Jobs' + end + +end
Test for clearing all delayed jobs
diff --git a/spec/command-t/scanner/find_spec.rb b/spec/command-t/scanner/find_spec.rb index abc1234..def5678 100644 --- a/spec/command-t/scanner/find_spec.rb +++ b/spec/command-t/scanner/find_spec.rb @@ -2,13 +2,8 @@ describe CommandT::Scanner::Find do before :all do - @pwd = Dir.pwd - Dir.chdir File.join(File.dirname(__FILE__), '..', '..', '..', 'fixtures') - @scanner = CommandT::Scanner::Find.new - end - - after :all do - Dir.chdir @pwd + dir = File.join(File.dirname(__FILE__), '..', '..', '..', 'fixtures') + @scanner = CommandT::Scanner::Find.new dir end describe 'paths method' do
Simplify Find scanner spec set-up Signed-off-by: Wincent Colaiuta <c76ac2e9cd86441713c7dfae92c451f3e6d17fdc@wincent.com>
diff --git a/spec/features/copying_files_spec.rb b/spec/features/copying_files_spec.rb index abc1234..def5678 100644 --- a/spec/features/copying_files_spec.rb +++ b/spec/features/copying_files_spec.rb @@ -19,7 +19,11 @@ copy_attributes = copy.file.attributes copy_attributes.reject! { |k,v| k == :last_modified } + copy_acl_grants = copy.file.file.acl.grants + original_acl_grants = original.file.file.acl.grants + expect(copy_attributes).to eq(original_attributes) + expect(copy_acl_grants).to eq(original_acl_grants) image.close original.file.delete
Test for matching ACL grants on copied file Until now we didn't ensure that the files generated with CarrierWave::Storage::AWSFile#copy_to were given the same ACL (Access Control List) as the original files. As explained in https://github.com/sorentwo/carrierwave-aws/issues/81#issue-154100161 the behavior of #copy_to in CarrierWave is use the `fog_public` configuration option and make files `public-read` (world-accessible) if it is true. carrierwave-aws uses a different configuration option (`aws_acl`) which explicitely defines the default ACL for all uploaded files (i.e. `public-read`) so it makes sense to compare the copied file with the originally uploaded one. An alternative test method would be to always check that copied files include an ACL that matches the `aws_acl` but I cannot for the life of me figure out a way to get aws-sdk-ruby to output the shorthand `acl` (i.e. `public-read` and not a list of grants) so for now I'm simply checking that the ACL grants for the copy are equal to those of the original.
diff --git a/features/support/command_helper.rb b/features/support/command_helper.rb index abc1234..def5678 100644 --- a/features/support/command_helper.rb +++ b/features/support/command_helper.rb @@ -52,7 +52,7 @@ end def delay_until - Timeout.timeout(2.5) do + Timeout.timeout(1) do while true sleep 0.01 begin
Use one second timeout in cukes
diff --git a/spec/henson/source/git_spec.rb b/spec/henson/source/git_spec.rb index abc1234..def5678 100644 --- a/spec/henson/source/git_spec.rb +++ b/spec/henson/source/git_spec.rb @@ -4,4 +4,37 @@ it "can be instantiated" do Henson::Source::Git.new('foo', :bar => :baz).should_not be_nil end + + describe "#fetched?" do + it "returns false if the repo is not cloned" + it "returns false if the repo does not have the correct revision" + it "returns true if cloned and the correct revision" + end + + describe "#fetch!" do + it "clones the repository and checks out the revision" + end + + describe "#install!" do + it "moves the repository tracked files from the tmp path to install path" + it "logs an info level install message" + it "logs a debug level install message" + end + + describe "#versions" do + it "returns the target revision as the only version available" + end + + describe "#valid?" do + it "returns true if the repo can be cloned" + it "returns false if the repo cannot be cloned" + it "returns false if the revision does not exist" + end + + describe "#target_revision" do + it "returns branch if options branch" + it "returns tag if options tag" + it "returns ref if options ref" + it "returns master otherwise" + end end
Add pending specs to describe expected behavior
diff --git a/spec/perpetuity/mapper_spec.rb b/spec/perpetuity/mapper_spec.rb index abc1234..def5678 100644 --- a/spec/perpetuity/mapper_spec.rb +++ b/spec/perpetuity/mapper_spec.rb @@ -27,22 +27,24 @@ its(:mapped_class) { should eq Object } context 'with unserializable attributes' do + let(:unserializable_object) { 1.to_c } let(:serialized_attrs) do - [ Marshal.dump(Comment.new) ] + [ Marshal.dump(unserializable_object) ] end it 'serializes attributes' do - article = Article.new - article.comments = [Comment.new] - mapper.attributes_for(article)[:comments].should eq serialized_attrs + object = Object.new + object.stub(sub_objects: [unserializable_object]) + mapper.attribute :sub_objects, Array, embedded: true + mapper.attributes_for(object)[:sub_objects].should eq serialized_attrs end describe 'unserializes attributes' do let(:comments) { mapper.unserialize(serialized_attrs) } subject { comments.first } - it { should be_a Comment } - its(:body) { should eq 'Body' } + it { should be_a Complex } + it { should eq unserializable_object } end end end
Fix specs broken by removing test_classes require
diff --git a/rails_admin_rollincode.gemspec b/rails_admin_rollincode.gemspec index abc1234..def5678 100644 --- a/rails_admin_rollincode.gemspec +++ b/rails_admin_rollincode.gemspec @@ -15,5 +15,5 @@ s.license = 'MIT' s.files = Dir['{lib,vendor}/**/*', 'MIT-LICENSE', 'Rakefile', 'README.rdoc'] - s.add_dependency 'rails', ['>= 4.0', '< 6'] + s.add_dependency 'rails', ['>= 4.0', '< 7'] end
Support Rails 6 by increasing max version constraint
diff --git a/spec/support/capture_helper.rb b/spec/support/capture_helper.rb index abc1234..def5678 100644 --- a/spec/support/capture_helper.rb +++ b/spec/support/capture_helper.rb @@ -1,15 +1,16 @@ module CaptureHelper # capture(iface, options) { 'ping -c 125 127.0.0.1 } - def capture(iface, options={}, &blk) + def capture(options={}, &blk) + iface = options[:iface] || Pcap.lookupdev timeout = options[:timeout] || 0 - - cap = PacketGen::Capture.new(iface, options) + filter = options[:filter] || false + opts = { iface: iface, timeout: timeout, filter: filter} + cap = PacketGen::Capture.new(opts) cap_thread = Thread.new { cap.start } sleep 0.1 blk.call sleep timeout + 2 cap.stop - cap end end
Update CaptureHelper to reflect the new capture method. May need to adjust this a little more.
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 @@ -32,4 +32,6 @@ end config.expose_dsl_globally = true + + config.warnings = true end
Enable Ruby warnings during test suite execution This will allow us to spot possible issues in advance.
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 @@ -1,6 +1,4 @@ # encoding: utf-8 - -require 'devtools/spec_helper' if ENV['COVERAGE'] == 'true' require 'simplecov' @@ -12,19 +10,18 @@ ] SimpleCov.start do - command_name 'spec:unit' - add_filter 'config' - add_filter 'spec' + command_name 'spec:unit' + + add_filter 'config' + add_filter 'spec' + add_filter 'vendor' + minimum_coverage 100 end end require 'ice_nine' - -# Require spec support files and shared behavior -Dir[File.expand_path('../{support,shared}/**/*.rb', __FILE__)].each do |file| - require file.chomp('.rb') -end +require 'devtools/spec_helper' RSpec.configure do |config| config.expect_with :rspec do |expect_with|
Update spec helper to be similar to other gems
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 @@ -1,11 +1,8 @@-# $: << File.join(File.dirname(__FILE__),"..", "lib") - require 'pry' require 'alephant/publisher' require 'alephant/publisher/models/writer' require 'alephant/publisher/models/queue' require 'alephant/publisher/models/render_mapper' -# require 'logger' require 'alephant/renderer' require 'alephant/support/parser'
Remove commented out lines [ci skip]
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 @@ -4,8 +4,12 @@ require 'spec' require 'spec/autorun' require 'rubygems' -require 'bundler' -Bundler.setup +begin + require 'bundler' + Bundler.setup +rescue LoadError + $stderr.puts "Bundler (or a dependency) not available." +end Spec::Runner.configure do |config|
Allow running the specs even if the Bundler gem is not installed. Since the gem may well be used without Bundler at all, don't force its presence during the spec running.
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 @@ -28,3 +28,9 @@ def schema_file spec_dir.join("../api/RAML/api-ja.raml") end + +RSpec.configure do |config| + config.before(:suite) do + raise "Not found '#{schema_file}'. Please run `git submodule update --init` at first" unless schema_file.exist? + end +end
Check whether submodule is initialized
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 @@ -2,7 +2,7 @@ require 'chefspec/berkshelf' RSpec.configure do |config| - config.color = true + config.color = true # Use color in STDOUT + config.formatter = :documentation # Use the specified formatter + config.log_level = :error # Avoid deprecation notice SPAM end - -at_exit { ChefSpec::Coverage.report! }
Use doc formatter in Chefspec and avoid deprecation warnings Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
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 @@ -20,6 +20,7 @@ RSpec.configure do |config| config.expect_with :rspec do |expectations| expectations.include_chain_clauses_in_custom_matcher_descriptions = true + expectations.max_formatted_output_length = nil end config.mock_with :rspec do |mocks|
Change rspec config to stop truncating output
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,6 +9,9 @@ config.order = 'random' + config.filter_run :focus => true + config.run_all_when_everything_filtered = true + # exclude neo4j tests for now (not working on Travis) config.filter_run_excluding :neo4j => true config.filter_run_excluding :neo4j_performance => true
Allow focus in rspec tests
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,6 +7,7 @@ add_group('Adapters') { |source| source.filename =~ /basquiat\/adapters/ } add_group('Interfaces') { |source| source.filename =~ /basquiat\/interfaces/ } + add_group('Support') { |source| source.filename =~ /basquiat\/support/ } add_group('Main Gem File') { |source| source.filename =~ %r{\/lib\/basquiat\.rb$} } end
Add the support group to SimpleCov
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 @@ -3,6 +3,7 @@ SimpleCov.start do add_filter "/spec" + add_filter "/example" end require "anodator"
Remove example codes on SimpleCov.
diff --git a/change-image/dell/barclamps/deployer/chef/cookbooks/ohai/recipes/default.rb b/change-image/dell/barclamps/deployer/chef/cookbooks/ohai/recipes/default.rb index abc1234..def5678 100644 --- a/change-image/dell/barclamps/deployer/chef/cookbooks/ohai/recipes/default.rb +++ b/change-image/dell/barclamps/deployer/chef/cookbooks/ohai/recipes/default.rb @@ -19,6 +19,11 @@ Ohai::Config[:plugin_path] << node.ohai.plugin_path Chef::Log.info("ohai plugins will be at: #{node.ohai.plugin_path}") + +p = package "lshw" do + action :nothing +end +p.run_action(:install) d = directory node.ohai.plugin_path do owner 'root'
Make sure that lshw is available on all system. This was making the switch_config variables empty and the UI having issues.
diff --git a/lib/notifier.rb b/lib/notifier.rb index abc1234..def5678 100644 --- a/lib/notifier.rb +++ b/lib/notifier.rb @@ -23,8 +23,8 @@ notify(message, "red") end - def debug(message) - notify(message, "yellow") + def info(message) + notify(message, "gray") end def notify(message, color) @@ -34,7 +34,7 @@ end client = HipChat::Client.new(configuration.api_key) - client[@configuration.room_name].send(@configuration.user_name, message, :color => color) + client[configuration.room_name].send(configuration.user_name, message, :color => color) end def configuration @@ -42,11 +42,11 @@ end def configured - not (@configuration.api_key.nil? || @configuration.room_name.nil? || @configuration.user_name.nil?) + not (configuration.api_key.nil? || configuration.room_name.nil? || configuration.user_name.nil?) end def env_ok - return @configuration.environments.include? Rails.env.to_sym + return configuration.environments.include? Rails.env.to_sym end end end
Change debug to info and make it grey
diff --git a/Zeeguu-API-iOS.podspec b/Zeeguu-API-iOS.podspec index abc1234..def5678 100644 --- a/Zeeguu-API-iOS.podspec +++ b/Zeeguu-API-iOS.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Zeeguu-API-iOS" - s.version = "1.0.8" + s.version = "1.0.9" s.summary = "An API for Zeeguu for iOS" s.description = <<-DESC The iOS Framework that acts as a layer in front of the Zeeguu server. @@ -9,8 +9,8 @@ s.license = "MIT" s.author = "Jorrit Oosterhof" s.platform = :ios, "9.0" - s.source = { :git => "https://github.com/mircealungu/Zeeguu-API-iOS.git", :tag => "1.0.8" } + s.source = { :git => "https://github.com/mircealungu/Zeeguu-API-iOS.git", :tag => "1.0.9" } s.source_files = "ZeeguuAPI/ZeeguuAPI/*.{swift,h}" - s.dependency 'SwiftyJSON', :git => "https://github.com/SwiftyJSON/SwiftyJSON.git" + s.dependency 'SwiftyJSON' s.resources = "ZeeguuAPI/ZeeguuAPI/*.lproj" end
Update pod spec to make sure it works again
diff --git a/lib/test_bed.rb b/lib/test_bed.rb index abc1234..def5678 100644 --- a/lib/test_bed.rb +++ b/lib/test_bed.rb @@ -5,5 +5,5 @@ require 'optparse' require 'fileutils' -require 'test_bed/config' +require 'test_bed/configuration' require 'test_bed/base'
Correct the name for configuration file
diff --git a/lib/grab.rb b/lib/grab.rb index abc1234..def5678 100644 --- a/lib/grab.rb +++ b/lib/grab.rb @@ -1,17 +1,23 @@ require "grab/version" -class Hash - alias_method :old_values, :values +module Grab + class ::Hash + alias_method :orig_values, :values - def grab(*keys) - keys.map { |k| self.fetch(k) } - end + def grab(*keys) + keys.map { |k| self.fetch(k) } + end - def values(*args) - if args.empty? - old_values - else - args.map { |k| self[k] } + def values(*args) + if args.empty? + orig_values + else + args.map { |k| self[k] } + end end end +end + +class Hash + include Grab end
Use a module to extend Hash
diff --git a/lib/main.rb b/lib/main.rb index abc1234..def5678 100644 --- a/lib/main.rb +++ b/lib/main.rb @@ -7,13 +7,21 @@ # Have questions or comments? email us at: contact@solvebio.com require 'logger' +require 'fileutils' module SolveBio VERSION = '1.6.1' @api_key = ENV['SOLVEBIO_API_KEY'] - @logger = Logger.new(ENV['SOLVEBIO_LOGFILE'] || - File::expand_path('~/.solvebio/solvebio.log')) + logfile = + if ENV['SOLVEBIO_LOGFILE'] + ENV['SOLVEBIO_LOGFILE'] + else + dir = File::expand_path '~/.solvebio' + mkdir_p(dir) unless File.exist? dir + File::expand_path File.join(dir, 'solvebio.log') + end + @logger = Logger.new(logfile) API_HOST = ENV['SOLVEBIO_API_HOST'] || 'https://api.solvebio.com' # Config info in reports and requests. Encapsulate more?
Create ~/.solvebio if its not there.
diff --git a/foodr-backend/app/controllers/searches_controller.rb b/foodr-backend/app/controllers/searches_controller.rb index abc1234..def5678 100644 --- a/foodr-backend/app/controllers/searches_controller.rb +++ b/foodr-backend/app/controllers/searches_controller.rb @@ -1,4 +1,8 @@ class SearchesController < ApplicationController + + def create + end + def save search = Search.find_by(id: params[:id]) if search
Remove create method from search controller
diff --git a/lib/artefact_retriever.rb b/lib/artefact_retriever.rb index abc1234..def5678 100644 --- a/lib/artefact_retriever.rb +++ b/lib/artefact_retriever.rb @@ -10,7 +10,7 @@ self.logger = logger self.statsd = statsd self.supported_formats = supported_formats || - %w{answer completed_transaction guide help_page licence + %w{answer completed_transaction guide licence local_transaction place simple_smart_answer transaction travel-advice} end
Remove help from the artefact retreiver
diff --git a/lib/casa/publisher/app.rb b/lib/casa/publisher/app.rb index abc1234..def5678 100644 --- a/lib/casa/publisher/app.rb +++ b/lib/casa/publisher/app.rb @@ -7,9 +7,18 @@ class App < Sinatra::Base @@storage_handler = false + @@postprocess_handler = false + + def self.set_postprocess_handler handler + @@postprocess_handler = handler + end def self.set_storage_handler handler @@storage_handler = handler + end + + def self.postprocess_handler + @@postprocess_handler end def self.storage_handler @@ -29,7 +38,11 @@ # NOTE: error 415 should be thrown if client processes body and unsupported request Content-Type # NOTE: error 400 should be thrown if client processes body and it is malformed per the Content-Type - json @@storage_handler.get_all + json @@storage_handler.get_all.map(){ |payload| + @@postprocess_handler ? @@postprocess_handler.execute(payload) : payload + }.select(){ |payload| + payload + } end
Add post-process handler that runs before SendOut
diff --git a/_plugins/custom_tag.rb b/_plugins/custom_tag.rb index abc1234..def5678 100644 --- a/_plugins/custom_tag.rb +++ b/_plugins/custom_tag.rb @@ -0,0 +1,13 @@+class LingualLink < Liquid::Tag + def initialize(tag_name, dest, _tokens) + super + @dest = dest + end + + def render(context) + lang = context.environments.first["page"]["lang"] + ( lang == "en" ) ? "/#{@dest.strip}/" : "/#{lang}/#{@dest.strip}/" + end +end + +Liquid::Template.register_tag('lingual_link', LingualLink)
Add custom tag for creating local links English pages are at /page while non-English pages are at /lang/page. This makes linking to translated pages a bit messy. The custom tag added in this commit makes local page links simpler: `{% lingual_link <page> %}` yields the correct relative link for <page>. The tag determines the language from the current page's front matter `lang` attribute.
diff --git a/db/migrate/20150122180848_add_image_to_piggybak_variants_option_values.rb b/db/migrate/20150122180848_add_image_to_piggybak_variants_option_values.rb index abc1234..def5678 100644 --- a/db/migrate/20150122180848_add_image_to_piggybak_variants_option_values.rb +++ b/db/migrate/20150122180848_add_image_to_piggybak_variants_option_values.rb @@ -0,0 +1,9 @@+class AddImageToPiggybakVariantsOptionValues < ActiveRecord::Migration + def self.up + add_attachment :piggybak_variants_option_values, :image + end + + def self.down + remove_attachment :piggybak_variants_option_values, :image + end +end
Add image to options value
diff --git a/lib/raceresult/decoder.rb b/lib/raceresult/decoder.rb index abc1234..def5678 100644 --- a/lib/raceresult/decoder.rb +++ b/lib/raceresult/decoder.rb @@ -18,6 +18,19 @@ get_status[:has_power] == "1" end + def antennas + get_status[:antennas] + end + + def datetime + if get_status[:date].start_with?('0') + date=Date.today.to_s + else + date=get_status[:date] + end + datetime=DateTime.parse(date+' '+get_status[:time]) + end + private def connect
Add methods antennas and datetime to Decoder
diff --git a/lib/tasks/hackernews.rake b/lib/tasks/hackernews.rake index abc1234..def5678 100644 --- a/lib/tasks/hackernews.rake +++ b/lib/tasks/hackernews.rake @@ -0,0 +1,27 @@+require 'open-uri' + +require_relative '../../config/environment' + +def save_the_children(parent, children) + children.each do |c| + next unless c["text"] + comment = Comment.create(parent: parent, body: Nokogiri::HTML(c["text"]).text) + save_the_children(comment, c["children"]) + end +end + +task :hackernews, :id do |t, args| + exit if args[:id].blank? + + url = "https://hn.algolia.com/api/v1/items/"+ args[:id] + + data = JSON.parse(open(url).read) + + article = Comment.create( + parent: nil, + body: data["title"], + source: "https://news.ycombinator.com/item?id="+args[:id] + ) + + save_the_children(article, data["children"]) +end
Implement hacker news collection task Motivation: -so that the top-notch chat over at HN can be collected and investigated Change Explanation -implement simple :hackernews task to collect the comment for a given ID -comment nesting is retained
diff --git a/lib/tasks/ow-console.rake b/lib/tasks/ow-console.rake index abc1234..def5678 100644 --- a/lib/tasks/ow-console.rake +++ b/lib/tasks/ow-console.rake @@ -10,9 +10,11 @@ name = stack_name(args[:to]) stack = Momentum::OpsWorks.get_stack(ow, name) layer = ow.describe_layers(stack_id: stack[:stack_id])[:layers].detect { |l| l[:shortname] == Momentum.config[:rails_console_layer] } + raise "No '#{Momentum.config[:rails_console_layer]}' layer found for #{name} stack!" unless layer instance = Momentum::OpsWorks.get_online_instances(ow, layer_id: layer[:layer_id]).sample + raise "No '#{Momentum.config[:rails_console_layer]}' instances found for #{name} stack!" unless instance endpoint = Momentum::OpsWorks.get_instance_endpoint(instance) - raise "No online #{Momentum.config[:rails_console_layer]} instances found for #{name} stack!" unless endpoint + raise "No online '#{Momentum.config[:rails_console_layer]}' instances found for #{name} stack!" unless endpoint $stderr.puts "Starting remote console... (use Ctrl-D to exit cleanly)" command = "'sudo su deploy -c \"cd /srv/www/#{Momentum.config[:app_base_name]}/current && RAILS_ENV=#{args[:env] || args[:to]} bundle exec rails console\"'"
Improve error handling in ow:console.
diff --git a/pipeline/config/routes.rb b/pipeline/config/routes.rb index abc1234..def5678 100644 --- a/pipeline/config/routes.rb +++ b/pipeline/config/routes.rb @@ -1,7 +1,7 @@ Rails.application.routes.draw do root 'application#index' # get '*path' => 'application#index' - devise_for :users, defaults: { format: :json } + devise_for :users, defaults: { format: :json }, controllers: { registrations: 'registrations' } devise_for :teams, defaults: { format: :json } namespace :api, defaults: { format: :json } do
Add controller to devise to accept extra fields
diff --git a/lib/vundle_cli/helpers.rb b/lib/vundle_cli/helpers.rb index abc1234..def5678 100644 --- a/lib/vundle_cli/helpers.rb +++ b/lib/vundle_cli/helpers.rb @@ -24,11 +24,8 @@ fpath end - # Get the bundle's main name. - # (the provided @bundle usually looks like baopham/trailertrash.vim, - # so we trim it down to get "trailertrash.vim" only). def bundle_base_name(bundle) - bundle.sub(/\S*\//, '') + File.basename(bundle) end # Get the trimmed name of the bundle,
Use File.basename instead of sub()
diff --git a/spec/support/mocks/observer.rb b/spec/support/mocks/observer.rb index abc1234..def5678 100644 --- a/spec/support/mocks/observer.rb +++ b/spec/support/mocks/observer.rb @@ -1,7 +1,6 @@ module Mocks class Observer def update(api_call) - # puts "hello I am observer for #{api_call.api_call_type.to_s} #{api_call.path}" end end end
Remove commented out line from mock
diff --git a/quickstart.rb b/quickstart.rb index abc1234..def5678 100644 --- a/quickstart.rb +++ b/quickstart.rb @@ -0,0 +1,60 @@+require 'google/apis/calendar_v3' +require 'googleauth' +require 'googleauth/stores/file_token_store' + +require 'fileutils' + +OOB_URI = 'urn:ietf:wg:oauth:2.0:oob' +APPLICATION_NAME = 'Google Calendar API Ruby Quickstart' +CLIENT_SECRETS_PATH = 'client_secret.json' +CREDENTIALS_PATH = File.join(Dir.home, '.credentials', + "calendar-ruby-quickstart.yaml") +SCOPE = Google::Apis::CalendarV3::AUTH_CALENDAR_READONLY + +## +# Ensure valid credentials, either by restoring from the saved credentials +# files or intitiating an OAuth2 authorization. If authorization is required, +# the user's default browser will be launched to approve the request. +# +# @return [Google::Auth::UserRefreshCredentials] OAuth2 credentials +def authorize + FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH)) + + client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH) + token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH) + authorizer = Google::Auth::UserAuthorizer.new( + client_id, SCOPE, token_store) + user_id = 'default' + credentials = authorizer.get_credentials(user_id) + if credentials.nil? + url = authorizer.get_authorization_url( + base_url: OOB_URI) + puts "Open the following URL in the browser and enter the " + + "resulting code after authorization" + puts url + code = gets + credentials = authorizer.get_and_store_credentials_from_code( + user_id: user_id, code: code, base_url: OOB_URI) + end + credentials +end + +# Initialize the API +service = Google::Apis::CalendarV3::CalendarService.new +service.client_options.application_name = APPLICATION_NAME +service.authorization = authorize + +# Fetch the next 10 events for the user +calendar_id = 'primary' +response = service.list_events(calendar_id, + max_results: 10, + single_events: true, + order_by: 'startTime', + time_min: Time.now.iso8601 ) + +puts "Upcoming events:" +puts "No upcoming events found" if response.items.empty? +response.items.each do |event| + start = event.start.date || event.start.date_time + puts "- #{event.summary} (#{start})" +end
Add Google API for cal. Works
diff --git a/app/models/saved_scenario.rb b/app/models/saved_scenario.rb index abc1234..def5678 100644 --- a/app/models/saved_scenario.rb +++ b/app/models/saved_scenario.rb @@ -14,6 +14,8 @@ belongs_to :user attr_accessor :title, :description, :api_session_id + + attr_accessible :scenario_id validates :user_id, :presence => true validates :scenario_id, :presence => true
Fix specs for saved scenario
diff --git a/app/helpers/materials_helper.rb b/app/helpers/materials_helper.rb index abc1234..def5678 100644 --- a/app/helpers/materials_helper.rb +++ b/app/helpers/materials_helper.rb @@ -13,7 +13,7 @@ end def get_materials_display_name - preferable = @course.student_sidebar_display.joins(:preferable_item). + preferable = @course.student_sidebar_items.joins(:preferable_item). where(preferable_items: {name: 'materials'}).first preferable.prefer_value end
Allow access to the customised materials component name even if it is disabled by the lecturer (e.g. by direct URL access)
diff --git a/app/uploaders/asset_uploader.rb b/app/uploaders/asset_uploader.rb index abc1234..def5678 100644 --- a/app/uploaders/asset_uploader.rb +++ b/app/uploaders/asset_uploader.rb @@ -5,7 +5,9 @@ storage :file def store_dir - "#{Rails.root}/uploads/assets/#{model.id}" + id = model.id + path = id.scan(/\d{2}/)[0..1].join("/") + "#{Rails.root}/uploads/assets/#{path}/#{id}" end def cache_dir
Use a nested path to prevent hitting the directory limitation EXT3 has a limit on the number of files that a directory can hold. To prevent us hitting this limit we'll distribute our files to a depth of two directories. e.g. If our BSON ID is '5124bd9a686c8228a9000005', then the asset path generated would be: /51/24/5124bd9a686c8228a9000005/
diff --git a/lib/doing_stream.rb b/lib/doing_stream.rb index abc1234..def5678 100644 --- a/lib/doing_stream.rb +++ b/lib/doing_stream.rb @@ -9,10 +9,10 @@ @streams = streams end - def latest n = 5 + def latest n = 5, m = 2 streams.map do |stream| - stream.entries.take(2) - end.flatten.sort_by(&:published).reverse.take(5) + stream.entries.take((m.respond_to? :call) ? m.call(stream) : m) + end.flatten.sort_by(&:published).reverse.take(n) end def entries
Allow specifying max number of entries to take from each stream
diff --git a/callcredit.gemspec b/callcredit.gemspec index abc1234..def5678 100644 --- a/callcredit.gemspec +++ b/callcredit.gemspec @@ -7,7 +7,7 @@ gem.add_runtime_dependency 'unicode_utils', '~> 1.4.0' gem.add_development_dependency 'rspec', '~> 3.7.0' - gem.add_development_dependency 'webmock', '~> 3.2.0' + gem.add_development_dependency 'webmock', '~> 3.3.0' gem.add_development_dependency 'rubocop' gem.authors = ['Grey Baker']
Update webmock requirement to ~> 3.3.0 Updates the requirements on [webmock](https://github.com/bblimke/webmock) to permit the latest version. - [Changelog](https://github.com/bblimke/webmock/blob/master/CHANGELOG.md) - [Commits](https://github.com/bblimke/webmock/commits/v3.3.0)
diff --git a/lib/thinking_sphinx/search/glaze.rb b/lib/thinking_sphinx/search/glaze.rb index abc1234..def5678 100644 --- a/lib/thinking_sphinx/search/glaze.rb +++ b/lib/thinking_sphinx/search/glaze.rb @@ -19,8 +19,6 @@ @object end - private - def method_missing(method, *args, &block) pane = @panes.detect { |pane| pane.respond_to?(method) } if @object.respond_to?(method) || pane.nil? @@ -29,4 +27,12 @@ pane.send(method, *args, &block) end end + + def respond_to?(method, include_private = false) + if @object.respond_to?(method) || @panes.any? { |pane| pane.respond_to?(method) } + true + else + super + end + end end
Add respond_to? method definition for search panes
diff --git a/spec/defines/proj_epsg_spec.rb b/spec/defines/proj_epsg_spec.rb index abc1234..def5678 100644 --- a/spec/defines/proj_epsg_spec.rb +++ b/spec/defines/proj_epsg_spec.rb @@ -0,0 +1,38 @@+require 'spec_helper' + +describe 'proj::epsg' do + let (:title) { '900913' } + + let (:pre_condition) { 'require ::augeas' } + + let (:facts) { { + :osfamily => 'Debian', + :rubyversion => RUBY_VERSION, + :path => '/foo/bar', + } } + + context 'with no options' do + it { should compile.with_all_deps } + end + + context 'when passing options' do + let (:params) { { + :file => '/foo/bar/epsg', + :options => { + "+proj" => "merc", + "+a" => "6378137", + "+b" => "6378137", + "+lat_ts" => "0.0", + "+lon_0" => "0.0", + "+x_0" => "0.0", + "+y_0" => "0", + "+k" => "1.0", + "+units" => "m", + "+nadgrids" => "@null", + }, + :flags => [ "+wktext", "+no_defs" ], + } } + + it { should compile.with_all_deps } + end +end
Add basic specs for proj::epsg
diff --git a/spec/lib/chatwork/task_spec.rb b/spec/lib/chatwork/task_spec.rb index abc1234..def5678 100644 --- a/spec/lib/chatwork/task_spec.rb +++ b/spec/lib/chatwork/task_spec.rb @@ -0,0 +1,45 @@+describe ChatWork::Task do + describe ".get", type: :api do + subject do + ChatWork::Task.get( + room_id: room_id, + account_id: account_id, + assigned_by_account_id: assigned_by_account_id, + status: status, + ) + end + + let(:room_id) { 123 } + let(:account_id) { 101 } + let(:assigned_by_account_id) { 78 } + let(:status) { "done" } + + before do + stub_chatwork_request(:get, "/rooms/#{room_id}/tasks", "/rooms/{room_id}/tasks") + end + + it_behaves_like :a_chatwork_api, :get, "/rooms/{room_id}/tasks" + end + + describe ".create", type: :api do + subject do + ChatWork::Task.create( + room_id: room_id, + body: body, + to_ids: to_ids, + limit: limit, + ) + end + + let(:room_id) { 123 } + let(:body) { "Buy milk" } + let(:to_ids) { "1,3,6" } + let(:limit) { "1385996399" } + + before do + stub_chatwork_request(:post, "/rooms/#{room_id}/tasks", "/rooms/{room_id}/tasks") + end + + it_behaves_like :a_chatwork_api, :post, "/rooms/{room_id}/tasks" + end +end
Add test for ChatWork::Task.get and ChatWork::Task.create
diff --git a/Casks/hopper-debugger-server.rb b/Casks/hopper-debugger-server.rb index abc1234..def5678 100644 --- a/Casks/hopper-debugger-server.rb +++ b/Casks/hopper-debugger-server.rb @@ -1,6 +1,6 @@ cask :v1 => 'hopper-debugger-server' do - version '2.3' - sha256 '291bcabcd84f395d9aba08532c1fff54101ec8d02aeb46e32c82a8a9b621c098' + version '2.4' + sha256 '32879ffedbe88d172aa59c1cdb32cdba024d842c20d705458ea4279f5bc18dab' url "http://www.hopperapp.com/HopperGDBServer/HopperDebuggerServer-#{version}.zip" name 'Hopper Debugger Server'
Upgrade Hopper Debugger Server.app to v2.4
diff --git a/spec/rspec_ssltls/util_spec.rb b/spec/rspec_ssltls/util_spec.rb index abc1234..def5678 100644 --- a/spec/rspec_ssltls/util_spec.rb +++ b/spec/rspec_ssltls/util_spec.rb @@ -0,0 +1,58 @@+require 'spec_helper' +require 'rspec_ssltls' + +describe RspecSsltls::Util do + describe '#self.open_socket' do + before :each do + proxy = double('proxy') + allow(proxy).to receive(:open).and_return(:proxy) + allow(Net::SSH::Proxy::HTTP).to receive(:new).and_return(proxy) + allow(TCPSocket).to receive(:open).and_return(:direct) + end + + context 'when options[:proxy] specified' do + let(:uri) { URI.parse('https://www.example.com/') } + let(:proxy_url) { 'http://proxy.example.com' } + + it 'should connect target via specified proxy server' do + socket = described_class.open_socket(uri, proxy: proxy_url) + expect(socket).to eq(:proxy) + end + end + + context 'when options[:proxy] is nil' do + let(:uri) { URI.parse('https://www.example.com/') } + let(:proxy_url) { nil } + + it 'should connect target directly' do + socket = described_class.open_socket(uri, proxy: proxy_url) + expect(socket).to eq(:direct) + end + end + end + + describe '#self.build_uri' do + context 'when String is given' do + let(:source) { 'http://proxy.example.com:3128/' } + it do + uri = described_class.send(:build_uri, source) + expect(uri).to eq URI.parse('http://proxy.example.com:3128/') + end + context 'when scheme is missing' do + let(:source) { 'proxy.example.com' } + it 'should complete http:// as default scheme' do + uri = described_class.send(:build_uri, source) + expect(uri).to eq URI.parse('http://proxy.example.com:80/') + end + end + end + + context 'when not String is given' do + let(:source) { URI.parse('http://proxy.example.com/') } + it 'should return same object as given' do + uri = described_class.send(:build_uri, source) + expect(uri) == source + end + end + end +end
Add spec for utils for adding proxy chain
diff --git a/puppet-lint-duplicate_class_parameters-check.gemspec b/puppet-lint-duplicate_class_parameters-check.gemspec index abc1234..def5678 100644 --- a/puppet-lint-duplicate_class_parameters-check.gemspec +++ b/puppet-lint-duplicate_class_parameters-check.gemspec @@ -22,7 +22,7 @@ spec.add_development_dependency 'rspec', '~> 3.8.0' spec.add_development_dependency 'rspec-its', '~> 1.0' spec.add_development_dependency 'rspec-collection_matchers', '~> 1.0' - spec.add_development_dependency 'rubocop', '~> 0.47.1' + spec.add_development_dependency 'rubocop', '~> 0.75.0' spec.add_development_dependency 'rake', '~> 11.2.0' spec.add_development_dependency 'rspec-json_expectations', '~> 2.2' spec.add_development_dependency 'simplecov', '~> 0.15.0'
Update rubocop requirement from ~> 0.47.1 to ~> 0.75.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.47.1...v0.75.0) Signed-off-by: dependabot-preview[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>
diff --git a/test/test_gem_install.rb b/test/test_gem_install.rb index abc1234..def5678 100644 --- a/test/test_gem_install.rb +++ b/test/test_gem_install.rb @@ -12,7 +12,9 @@ out = IO.popen("ruby -rtestgem -e \"puts Libguess.determine_encoding('abc', 'Greek')\"", &:read) assert_match(/UTF-8/, out) - out = IO.popen("ed --version", &:read) + out = RubyInstaller::Runtime.msys2_installation.with_msys_apps_enabled do + IO.popen("ed --version", &:read) + end assert_match(/GNU ed/, out) end end
Fix test for GNU ed when running without MSYS2 in the path.
diff --git a/events/db/migrate/20120208144948_add_events_foreign_key.rb b/events/db/migrate/20120208144948_add_events_foreign_key.rb index abc1234..def5678 100644 --- a/events/db/migrate/20120208144948_add_events_foreign_key.rb +++ b/events/db/migrate/20120208144948_add_events_foreign_key.rb @@ -0,0 +1,9 @@+class AddEventsForeignKey < ActiveRecord::Migration + def up + add_foreign_key "events", "activity_objects", :name => "events_on_activity_object_id" + end + + def down + remove_foreign_key "events", :name => "events_on_activity_object_id" + end +end
Add events table foreign key
diff --git a/log.gemspec b/log.gemspec index abc1234..def5678 100644 --- a/log.gemspec +++ b/log.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'evt-log' - s.version = '2.1.1.1' + s.version = '2.1.1.2' s.summary = 'Logging to STD IO with levels, tagging, and coloring' s.description = ' '
Package version is increased from 2.1.1.1 to 2.1.1.2
diff --git a/spec/issues/issue100_spec.rb b/spec/issues/issue100_spec.rb index abc1234..def5678 100644 --- a/spec/issues/issue100_spec.rb +++ b/spec/issues/issue100_spec.rb @@ -1,40 +1,42 @@ require "spec_helper" -describe Bunny::Channel, "#basic_publish" do - let(:connection) do - c = Bunny.new(:user => "bunny_gem", - :password => "bunny_password", - :vhost => "bunny_testbed", - :socket_timeout => 0) - c.start - c - end +unless ENV["CI"] + describe Bunny::Channel, "#basic_publish" do + let(:connection) do + c = Bunny.new(:user => "bunny_gem", + :password => "bunny_password", + :vhost => "bunny_testbed", + :socket_timeout => 0) + c.start + c + end - after :all do - connection.close if connection.open? - end + after :all do + connection.close if connection.open? + end - context "when publishing thousands of messages" do - let(:n) { 10_000 } - let(:m) { 10 } + context "when publishing thousands of messages" do + let(:n) { 10_000 } + let(:m) { 10 } - it "successfully publishers them all" do - ch = connection.create_channel + it "successfully publishers them all" do + ch = connection.create_channel - q = ch.queue("", :exclusive => true) - x = ch.default_exchange + q = ch.queue("", :exclusive => true) + x = ch.default_exchange - body = "x" * 1024 - m.times do |i| - n.times do - x.publish(body, :routing_key => q.name) + body = "x" * 1024 + m.times do |i| + n.times do + x.publish(body, :routing_key => q.name) + end + puts "Published #{i * n} messages so far..." end - puts "Published #{i * n} messages so far..." + + q.purge + ch.close end - - q.purge - ch.close end end end
Exclude more stress tests from CI runs