diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/pdftk-heroku.rb b/lib/pdftk-heroku.rb index abc1234..def5678 100644 --- a/lib/pdftk-heroku.rb +++ b/lib/pdftk-heroku.rb @@ -5,12 +5,5 @@ PDFTK_PATH = File.expand_path "../../bin/pdftk", __FILE__ - begin - require 'docsplit' - - Docsplit.config[:exe_path] = PDFTK_PATH - rescue LoadError - end - end end
Remove pre-config settings for gem [#44932215] I don't know what this will actually be yet
diff --git a/lib/sinatra/main.rb b/lib/sinatra/main.rb index abc1234..def5678 100644 --- a/lib/sinatra/main.rb +++ b/lib/sinatra/main.rb @@ -13,7 +13,7 @@ if run? && ARGV.any? require 'optparse' OptionParser.new { |op| - op.on('-x') { set :mutex, true } + op.on('-x') { set :lock, true } op.on('-e env') { |val| set :environment, val.to_sym } op.on('-s server') { |val| set :server, val } op.on('-p port') { |val| set :port, val.to_i }
Fix -x command line option (it's :lock, not :mutex)
diff --git a/spec/keeper_spec.rb b/spec/keeper_spec.rb index abc1234..def5678 100644 --- a/spec/keeper_spec.rb +++ b/spec/keeper_spec.rb @@ -6,30 +6,52 @@ ConditionVariable.stub(:new => @condvar = mock) end - describe "#wait_for" do - context "new event" do + context "non-existing event" do + before :each do + @keeper.waiting.should == [] + end + + describe "#wait_for" do it "should create the event and wait for it" do - @condvar.should_receive(:wait) - @keeper.waiting.should == [] + ConditionVariable.should_receive(:new).once + @condvar.should_receive(:wait).once + @keeper.wait_for(:event) @keeper.waiting.should == [:event] end end - context "existing event" do - it "should re-use the existing signaller" - it "should not affect any other waiting threads" - it "should register the the calling thread as waiting" + describe "#fire" do + it "should not cause an error" do + expect { @keeper.fire(:bogus_event) }.to_not raise_error + end end end - describe "#fire" do - context "existing event" do - it "should release all listeners" + context "existing event" do + before :each do + @condvar.should_receive(:wait).once + @keeper.wait_for(:event) end - context "non-existing event" do - it "should not cause an error" + describe "#wait_for" do + it "should re-use the existing signaller" do + ConditionVariable.should_not_receive(:new) + @condvar.should_receive(:wait).once # to raise expectation + @keeper.wait_for(:event) + end + + it "should wait for the event" do + @condvar.should_receive(:wait).once + @keeper.wait_for(:event) + end + end + + describe "#fire" do + it "should release all listeners" do + @condvar.should_receive(:broadcast).once + @keeper.fire(@keeper.waiting.first) + end end end end
Refactor all specs, and finish them as well
diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb index abc1234..def5678 100644 --- a/config/initializers/mime_types.rb +++ b/config/initializers/mime_types.rb @@ -1,3 +1,4 @@ Mime::Type.register "application/vnd.geo+json", :geojson Mime::Type.register "application/vnd.mapbox-vector-tile", :mvt Mime::Type.register "application/vnd.google-earth.kml+xml", :kml +Mime::Type.register "application/vnd.google-earth.kmz", :kmz
Add missing kmz mime type
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,4 +1,4 @@-require 'rspec-expectations' +require 'rspec/expectations' require 'chefspec' require 'chefspec/berkshelf' require 'chefspec/server'
Fix deprecation warning in rspec
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 @@ -16,7 +16,7 @@ require 'fias' -WebMock.disable_net_connect! +WebMock.disable_net_connect!(allow: %w(codeclimate.com)) RSpec.configure do |config| config.order = :random
Allow spec test reporting to cc
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,29 +1,9 @@-require 'rubygems' +require 'dm-core/spec/setup' +require 'dm-core/spec/lib/adapter_helpers' -# Use local dm-core if running from a typical dev checkout. -lib = File.join('..', '..', 'dm-core', 'lib') -$LOAD_PATH.unshift(lib) if File.directory?(lib) +require 'dm-is-remixable' +require 'dm-migrations' -# Support running specs with 'rake spec' and 'spec' -$LOAD_PATH.unshift('lib') unless $LOAD_PATH.include?('lib') - -require 'dm-is-searchable' - -def load_driver(name, default_uri) - return false if ENV['ADAPTER'] != name.to_s - - begin - DataMapper.setup(name, ENV["#{name.to_s.upcase}_SPEC_URI"] || default_uri) - DataMapper::Repository.adapters[:default] = DataMapper::Repository.adapters[name] - true - rescue LoadError => e - warn "Could not load do_#{name}: #{e}" - false - end +Spec::Runner.configure do |config| + config.extend(DataMapper::Spec::Adapters::Helpers) end - -ENV['ADAPTER'] ||= 'sqlite3' - -HAS_SQLITE3 = load_driver(:sqlite3, 'sqlite3::memory:') -HAS_MYSQL = load_driver(:mysql, 'mysql://localhost/dm_core_test') -HAS_POSTGRES = load_driver(:postgres, 'postgres://postgres@localhost/dm_core_test')
Use dm-core/spec/setup in (non existent) specs
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 @@ -6,6 +6,6 @@ # class Mailer < ActionMailer::Base def test_mail - mail(from: 'from@test.com', to: 'to@test.com', subject: 'Test email') + mail(from: 'from@test.com', to: 'to@test.com', subject: 'Test email', body: 'Hello.') end end # Mailer
Set body to test mailer actionmailer 4 requires body otherwise it searches template for its body.
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,13 +1,9 @@-require 'rubygems' -require 'bundler' -Bundler.require :development, :default # Explicitly necessary here. - require 'reek/spec' require 'reek/source/tree_dresser' require 'matchers/smell_of_matcher' -SAMPLES_DIR = 'spec/samples' unless Object.const_defined?('SAMPLES_DIR') +SAMPLES_DIR = 'spec/samples' def ast(*args) result = Reek::Source::TreeDresser.new.dress(s(*args))
Remove superfluous spec setup code
diff --git a/fezzik.gemspec b/fezzik.gemspec index abc1234..def5678 100644 --- a/fezzik.gemspec +++ b/fezzik.gemspec @@ -18,15 +18,9 @@ s.rubyforge_project = "fezzik" s.executables = %w(fez fezify) - s.files = %w( - README.md - TODO.md - fezzik.gemspec - lib/fezzik.rb - bin/fez - bin/fezify - ) - #s.add_dependency("rake", "~>0.8.7") + s.files = `git ls-files`.split("\n") + + s.add_dependency("rake", "~>0.8.7") s.add_dependency("rake-remote_task", "~>2.0.2") s.add_dependency("colorize", ">=0.5.8") end
Fix gemspec dependencies and file list
diff --git a/app/controllers/user/accounts_controller.rb b/app/controllers/user/accounts_controller.rb index abc1234..def5678 100644 --- a/app/controllers/user/accounts_controller.rb +++ b/app/controllers/user/accounts_controller.rb @@ -1,6 +1,6 @@ class User::AccountsController < ApplicationController - skip_authorization_check, only: :switch_circle + skip_authorization_check only: :switch_circle before_action :ensure_logged_in before_action :ensure_circle
Fix skip_authorization_check gone missing for switch_circle.
diff --git a/test/test_suite.rb b/test/test_suite.rb index abc1234..def5678 100644 --- a/test/test_suite.rb +++ b/test/test_suite.rb @@ -18,7 +18,6 @@ require 'tc_xml_parser_context' require 'tc_xml_reader' require 'tc_xml_sax_parser' -require 'tc_xml_sax_parser2' require 'tc_xml_schema' require 'tc_xml_xinclude' require 'tc_xml_xpath'
Change check function to verify instead of do_simple_test (don't want Unit::Test to think that is a test method).
diff --git a/foundation-center.gemspec b/foundation-center.gemspec index abc1234..def5678 100644 --- a/foundation-center.gemspec +++ b/foundation-center.gemspec @@ -20,4 +20,5 @@ spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake" + spec.add_development_dependency "rspec" end
Add rspec as a development dependency
diff --git a/lib/ebay/responses/add_fixed_price_item.rb b/lib/ebay/responses/add_fixed_price_item.rb index abc1234..def5678 100644 --- a/lib/ebay/responses/add_fixed_price_item.rb +++ b/lib/ebay/responses/add_fixed_price_item.rb @@ -9,7 +9,7 @@ # array_node :fees, 'Fees', 'Fee', :class => Fee, :default_value => [] # text_node :category_id, 'CategoryID', :optional => true # text_node :category2_id, 'Category2ID', :optional => true - class AddItem < Abstract + class AddFixedPriceItem < Abstract include XML::Mapping include Initializer root_element_name 'AddFixedPriceItemResponse'
Fix Class definition for AddFixedPriceItem
diff --git a/lib/metrics-graphics-rails/view_helpers.rb b/lib/metrics-graphics-rails/view_helpers.rb index abc1234..def5678 100644 --- a/lib/metrics-graphics-rails/view_helpers.rb +++ b/lib/metrics-graphics-rails/view_helpers.rb @@ -12,11 +12,12 @@ description = options.fetch(:description) { '' } width = options.fetch(:width) { 600 } height = options.fetch(:height) { 250 } + time_format = options.fetch(:time_format) { '%Y-%m-%d' } javascript_tag <<-SCRIPT var data = #{json_data}; - MG.convert.date(data, 'date', '%Y-%m-%d'); + MG.convert.date(data, 'date', #{time_format}); MG.data_graphic({ title: "#{title}",
Add option for custom time format
diff --git a/lib/baustelle/jenkins/job_template.rb b/lib/baustelle/jenkins/job_template.rb index abc1234..def5678 100644 --- a/lib/baustelle/jenkins/job_template.rb +++ b/lib/baustelle/jenkins/job_template.rb @@ -35,6 +35,11 @@ private + def include(path) + template_dir = File.dirname(@template_path) + File.read(File.join(template_dir, path, '.groovy')) + end + def job_dsl_dir File.expand_path(File.join(__FILE__, '../../../../ext/jenkins_dsl')) end
Allow including scripts in jenkins job templates
diff --git a/lib/clever_tap/successful_response.rb b/lib/clever_tap/successful_response.rb index abc1234..def5678 100644 --- a/lib/clever_tap/successful_response.rb +++ b/lib/clever_tap/successful_response.rb @@ -29,7 +29,7 @@ end def success - errors.empty? + unprocessed.empty? end end end
Fix String from Nil error thrown when failed records
diff --git a/examples/temperature.rb b/examples/temperature.rb index abc1234..def5678 100644 --- a/examples/temperature.rb +++ b/examples/temperature.rb @@ -0,0 +1,15 @@+require "openweather2" + +Openweather2.configure do |config| + config.endpoint = 'http://api.openweathermap.org/data/2.5/weather' + config.apikey = 'dd7073d18e3085d0300b6678615d904d' +end + +if ARGV.empty? + puts 'put some city names on the command line' +end + +ARGV.each do |city| + weather = Openweather2.get_weather(city: city, units: 'metric') + puts "#{city}: #{weather.temperature} ℃" +end
Add a minimal example application.
diff --git a/lib/hpcloud/commands/securitygroups.rb b/lib/hpcloud/commands/securitygroups.rb index abc1234..def5678 100644 --- a/lib/hpcloud/commands/securitygroups.rb +++ b/lib/hpcloud/commands/securitygroups.rb @@ -23,7 +23,7 @@ if securitygroups.empty? display "You currently have no security groups." else - securitygroups.table([:name, :description, :owner_id]) + securitygroups.table([:name, :description]) end rescue Excon::Errors::Unauthorized, Excon::Errors::Forbidden => error display_error_message(error, :permission_denied)
Remove owner_id from security groups list.
diff --git a/spec/controllers/api/v4/runs/splits_controller_spec.rb b/spec/controllers/api/v4/runs/splits_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/api/v4/runs/splits_controller_spec.rb +++ b/spec/controllers/api/v4/runs/splits_controller_spec.rb @@ -0,0 +1,55 @@+require 'rails_helper' + +describe Api::V4::Runs::SplitsController do + describe '#index' do + context "for a nonexistent run" do + subject { get :index, params: {run_id: '0'} } + + it "returns a 404" do + expect(subject).to have_http_status 404 + end + + it "returns no body" do + expect(response.body).to be_blank + end + end + + context "for a bogus ID" do + subject { get :index, params: {run_id: '/@??$@;[1;?'} } + + it "returns a 404" do + expect(subject).to have_http_status 404 + end + + it "returns no body" do + expect(response.body).to be_blank + end + end + + context "for an existing run" do + let(:run) { create(:run) } + subject { get :index, params: {run_id: run.id36} } + let(:body) { JSON.parse(subject.body) } + + it "returns a 200" do + expect(subject).to have_http_status 200 + end + + it "returns a body with no root node" do + expect(body[0]['name']).to eq "Tron City" + end + + it "doesn't include history" do + expect(body[0]['history']).to be_nil + end + + context "with a slow=true parameter" do + subject { get :index, params: {run_id: run.id36, slow: true} } + + it "includes history" do + expect(body[0]['history']).to eq '6' + end + end + end + end +end
Add APIv4 splits controller tests
diff --git a/spec/controllers/auth/registrations_controller_spec.rb b/spec/controllers/auth/registrations_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/auth/registrations_controller_spec.rb +++ b/spec/controllers/auth/registrations_controller_spec.rb @@ -17,7 +17,7 @@ password: '12341234', 'password_confirmation': '12341234' } - assert !User.find_by!(username: 'portus').admin + expect(User.find_by!(username: 'portus')).not_to be_admin end it 'handles the admin column properly' do @@ -28,7 +28,7 @@ 'password_confirmation': '12341234', admin: true } - assert User.find_by!(username: 'portus').admin + expect(User.find_by!(username: 'portus')).to be_admin end it 'omits the value of admin if there is already another admin' do @@ -40,7 +40,7 @@ 'password_confirmation': '12341234', admin: true } - assert !User.find_by!(username: 'portus').admin + expect(User.find_by!(username: 'portus')).not_to be_admin end end
Write the registrations spec with rspec
diff --git a/lib/quickbooks/model/bill_line_item.rb b/lib/quickbooks/model/bill_line_item.rb index abc1234..def5678 100644 --- a/lib/quickbooks/model/bill_line_item.rb +++ b/lib/quickbooks/model/bill_line_item.rb @@ -24,6 +24,19 @@ detail_type.to_s == ITEM_BASED_EXPENSE_LINE_DETAIL end + def account_based_expense_item! + self.detail_type = ACCOUNT_BASED_EXPENSE_LINE_DETAIL + self.account_based_expense_line_detail = AccountBasedExpenseLineDetail.new + + yield self.account_based_expense_line_detail if block_given? + end + + def item_based_expense_item! + self.detail_type = ITEM_BASED_EXPENSE_LINE_DETAIL + self.item_based_expense_line_detail = ItemBasedExpenseLineDetail.new + + yield self.item_based_expense_line_detail if block_given? + end end end end
Add line item helpers to bill line item model.
diff --git a/server/app/controllers/files_controller.rb b/server/app/controllers/files_controller.rb index abc1234..def5678 100644 --- a/server/app/controllers/files_controller.rb +++ b/server/app/controllers/files_controller.rb @@ -13,8 +13,15 @@ # The client runs the filename through CGI.escape in case it contains # special characters. Older versions of Rails automatically decoded the # filename, but as of Rails 2.3 we need to do it ourself. - files = params[:files].inject({}) { |h, (file, value)| h[CGI.unescape(file)] = value; h } - response = etchserver.generate(files) + files = {} + if params[:files] + files = params[:files].inject({}) { |h, (file, value)| h[CGI.unescape(file)] = value; h } + end + commands = {} + if params[:commands] + commands = params[:commands].inject({}) { |h, (command, value)| h[CGI.unescape(command)] = value; h } + end + response = etchserver.generate(files, commands) render :text => response rescue Exception => e logger.error e.message
Add support for requesting specific commands. git-svn-id: 907a5e332d9df9b9d6ff346e9993373f8c03b4a0@128 59d7d9da-0ff4-4beb-9ab8-e480f87378b2
diff --git a/cookbooks/memcached/attributes/default.rb b/cookbooks/memcached/attributes/default.rb index abc1234..def5678 100644 --- a/cookbooks/memcached/attributes/default.rb +++ b/cookbooks/memcached/attributes/default.rb @@ -8,7 +8,6 @@ default['memcached']['user'] = 'memcached' when 'debian' default['memcached']['user'] = 'nobody' - end is_debian_ge_8 = platform?("debian") && node["platform_version"].to_i >= 8
SCALRCORE-11162: Fix memcached attributes for ubuntu1804
diff --git a/test/command_some_test.rb b/test/command_some_test.rb index abc1234..def5678 100644 --- a/test/command_some_test.rb +++ b/test/command_some_test.rb @@ -0,0 +1,16 @@+require 'minitest/autorun' +require 'runoff/commandline/some' +require 'colorize' +require 'fileutils' + +class CommandSomeTest < MiniTest::Unit::TestCase + def test_it_raises_a_ArgumentError_if_called_with_an_empty_list_of_arguments + command = Runoff::Commandline::Some.new( archive: true ) + + assert_raises ArgumentError do + assert_output 'Exporting...' do + command.execute [] + end + end + end +end
Add a test file for some command
diff --git a/config/initializers/omniauth_shibboleth.rb b/config/initializers/omniauth_shibboleth.rb index abc1234..def5678 100644 --- a/config/initializers/omniauth_shibboleth.rb +++ b/config/initializers/omniauth_shibboleth.rb @@ -1,5 +1,5 @@ Rails.application.config.middleware.use OmniAuth::Builder do - if Rails.env.production? + if true #Rails.env.production? opts = YAML.load_file(File.join(Rails.root, 'config', 'shibboleth.yml'))[Rails.env] provider :shibboleth, opts.symbolize_keys Dmptool2::Application.shibboleth_host = opts['host']
Fix up for testing - had wrong dns name.
diff --git a/cookbooks/passenger-gem/recipes/default.rb b/cookbooks/passenger-gem/recipes/default.rb index abc1234..def5678 100644 --- a/cookbooks/passenger-gem/recipes/default.rb +++ b/cookbooks/passenger-gem/recipes/default.rb @@ -22,16 +22,11 @@ version '3.0.9' end -#Fix the stupid path issues -link "/usr/bin/passenger-install-apache2-module" do - to "/var/lib/gems/1.9.1/bin/passenger-install-apache2-module" -end - script "install the passenger module" do interpreter "bash" cwd "/tmp" code <<-EOH - /usr/bin/passenger-install-apache2-module --auto + /usr/local/bin/passenger-install-apache2-module --auto EOH not_if "test -f /var/lib/gems/1.9.1/gems/passenger-3.0.9/ext/apache2/mod_passenger.so" end
Remove the gem binary path workaround, now that it's more sensible in ubuntu rubygems.
diff --git a/lib/filter/checkbox_field_builder.rb b/lib/filter/checkbox_field_builder.rb index abc1234..def5678 100644 --- a/lib/filter/checkbox_field_builder.rb +++ b/lib/filter/checkbox_field_builder.rb @@ -1,46 +1,34 @@ module Filter - class CheckboxFieldBuilder < Filter::BaseFieldBuilder + class CheckboxFieldBuilder < BaseFieldBuilder + def render object_class, attribute_name, options = {} - type = options[:type] || :single_line - values = options[:value] || [] + type = options.fetch :type , :single_line + title = options.fetch :title, attribute_name.to_s.humanize + name = options.fetch :scope, "#{attribute_name}_in" + values = options.fetch :value, nil - name = options[:scope] || "#{attribute_name}_in" - if type == :single_line - listing_type = "single-line form-inline" - else - listing_type = "multi-line" - end + values ||= [] + collection = options[:collection] + collection = collection.call if collection.respond_to?(:call) - haml_tag :div, class: "form-group #{listing_type}" do - haml_concat label(@@form_namespace, name, options[:title] || attribute_name.to_s.humanize) + haml_tag :div, class: 'form-group' do + haml_concat label(@@form_namespace, name, title) - classes = "checkbox-field #{listing_type}" - collection = options[:collection].is_a?(Proc) ? options[:collection].call : options[:collection] + haml_tag :div, class: (type == :single_line ? 'form-inline' : 'multi-line') do + collection.each do |item| + key, value = item - haml_tag :div, class: listing_type do - collection.each do |item| - if type == :single_line - # build single line multiple selection - haml_tag :div, class: 'checkbox' do - haml_tag :label, class: classes do - haml_concat check_box(@@form_namespace, name, { multiple: true, value: item.last, checked: values.include?(item.last.to_s) }, item.last, nil) - haml_concat item.first - end - end - else - # build multi line multiple selection - - haml_tag :div, class: 'checkbox' do - haml_tag :label, class: classes do - haml_concat check_box(@@form_namespace, name, { multiple: true, value: item.last, checked: values.include?(item.last.to_s) }, item.last, nil) - haml_concat item.first - end + haml_tag :div, class: 'checkbox' do + haml_tag :label, class: 'checkbox-field' do + haml_concat check_box(@@form_namespace, name, {multiple: true, value: value, checked: values.include?(value.to_s)}, value, nil) + haml_concat key end end - end end + end end + end end
Clean up the checkbox field builder
diff --git a/chef-berksfile-env.gemspec b/chef-berksfile-env.gemspec index abc1234..def5678 100644 --- a/chef-berksfile-env.gemspec +++ b/chef-berksfile-env.gemspec @@ -15,8 +15,8 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_dependency "berkshelf", ">= 4.0", "< 6.0" - spec.add_dependency "chef", ">= 11.0", "< 13.0" + spec.add_dependency "berkshelf", ">= 4.0", "< 8.0" + spec.add_dependency "chef", ">= 12.0", "< 15.0" spec.add_development_dependency "bundler", "~> 1.6" spec.add_development_dependency "rake", "~> 0.9"
Add bekshelf 6, 7 and chef 13, 14
diff --git a/RaaB.rb b/RaaB.rb index abc1234..def5678 100644 --- a/RaaB.rb +++ b/RaaB.rb @@ -0,0 +1,18 @@+require "thor" +require "./utils/authentication.rb" + +class RaaB < Thor + desc "encrypt TEXT", "Encrypt the given TEXT using aes-256-cbc." + def encrypt(text) + text = Encryption.encrypt(text) + puts [text].pack("m") + end + + desc "decrypt TEXT", "Decrypt the given TEXT using aes-256-cbc." + def decrypt(text) + text = Encryption.decrypt(text.unpack('m').first()) + puts text + end +end + +RaaB.start(ARGV)
Add authentication util and CLI
diff --git a/spec/classes/neutron_db_postgresql_spec.rb b/spec/classes/neutron_db_postgresql_spec.rb index abc1234..def5678 100644 --- a/spec/classes/neutron_db_postgresql_spec.rb +++ b/spec/classes/neutron_db_postgresql_spec.rb @@ -34,15 +34,13 @@ context "on #{os}" do let (:facts) do facts.merge(OSDefaults.get_facts({ - :processorcount => 8, - :concat_basedir => '/var/lib/puppet/concat' + # puppet-postgresql requires the service_provider fact provided by + # puppetlabs-postgresql. + :service_provider => 'systemd' })) end - # TODO(tkajinam): Remove this once puppet-postgresql supports CentOS 9 - unless facts[:osfamily] == 'RedHat' and facts[:operatingsystemmajrelease].to_i >= 9 - it_behaves_like 'neutron::db::postgresql' - end + it_behaves_like 'neutron::db::postgresql' end end end
Revert "CentOS 9: Disable unit tests dependent on puppet-postgresql" This reverts commit 589205c8a5f22f1ddd9b5db94d4e09336c2b666b. Reason for revert: puppet-postgresql 8.1.0 was released and now the module supports RHEL 9 (and CentOS 9 effectively). Note: This change adds the service_provider fact in test fact data because it is required by puppet-postgresql. Depends-on: https://review.opendev.org/850705 Change-Id: I8b110c5335c4fb0f69d25974228e12db0340222b
diff --git a/lib/solidus_volume_pricing/engine.rb b/lib/solidus_volume_pricing/engine.rb index abc1234..def5678 100644 --- a/lib/solidus_volume_pricing/engine.rb +++ b/lib/solidus_volume_pricing/engine.rb @@ -19,6 +19,7 @@ def self.activate Dir.glob(File.join(File.dirname(__FILE__), '../../app/**/*_decorator*.rb')) do |c| Rails.configuration.cache_classes ? require(c) : load(c) + Rails.autoloaders.main.ignore(c) if Rails.autoloaders.zeitwerk_enabled? end ::Spree::BackendConfiguration::CONFIGURATION_TABS << :volume_price_models end
Configure autoloader to ignore decorators This configures the autoloader to ignore decorators since they are already explicitly required by the engine.
diff --git a/config/initializers/ahoy_email.rb b/config/initializers/ahoy_email.rb index abc1234..def5678 100644 --- a/config/initializers/ahoy_email.rb +++ b/config/initializers/ahoy_email.rb @@ -5,6 +5,8 @@ AhoyEmail.track utm_params: false class EmailSubscriber + POCKET_READ_URL = 'https://getpocket.com/a/read/'.freeze + def click(event) user = event[:message].user url = event[:url] @@ -16,7 +18,7 @@ private def get_item_id(url) - url.gsub('https://getpocket.com/a/read/', '') + url.sub(POCKET_READ_URL, ''.freeze) end end
Use sub and constant string in EmailSubscriber
diff --git a/config/initializers/generators.rb b/config/initializers/generators.rb index abc1234..def5678 100644 --- a/config/initializers/generators.rb +++ b/config/initializers/generators.rb @@ -0,0 +1,6 @@+Rails.application.config.generators do |g| + g.test_framework :mini_test, :spec => true, :fixture => true + g.helper false + g.assets false + g.view_specs false +end
Change test generator to use minitest. Disable helpers, assets and view specs generation
diff --git a/test/unit/active_model/serializer/associations_test.rb b/test/unit/active_model/serializer/associations_test.rb index abc1234..def5678 100644 --- a/test/unit/active_model/serializer/associations_test.rb +++ b/test/unit/active_model/serializer/associations_test.rb @@ -0,0 +1,19 @@+require 'test_helper' + +module ActiveModel + class Serializer + class AssociationsTest < ActiveModel::TestCase + def test_associations_inheritance + inherited_serializer_klass = Class.new(PostSerializer) do + has_many :users + end + another_inherited_serializer_klass = Class.new(PostSerializer) + + assert_equal([:comments, :users], + inherited_serializer_klass._associations.keys) + assert_equal([:comments], + another_inherited_serializer_klass._associations.keys) + end + end + end +end
Test association inheritance in serializers
diff --git a/lib/dramaturg/command.rb b/lib/dramaturg/command.rb index abc1234..def5678 100644 --- a/lib/dramaturg/command.rb +++ b/lib/dramaturg/command.rb @@ -27,6 +27,7 @@ def run @script.execute(self) + self end def default(v)
Return self after run for code like c = script.cmd('echo foo').run if !c.aborted script.cmd('echo bar').run end
diff --git a/lib/rf/stylez/version.rb b/lib/rf/stylez/version.rb index abc1234..def5678 100644 --- a/lib/rf/stylez/version.rb +++ b/lib/rf/stylez/version.rb @@ -2,6 +2,6 @@ module Rf module Stylez - VERSION = '0.3.0' + VERSION = '0.4.0' end end
Update rubocop to support ruby 2.7.0
diff --git a/lib/specjour/db_scrub.rb b/lib/specjour/db_scrub.rb index abc1234..def5678 100644 --- a/lib/specjour/db_scrub.rb +++ b/lib/specjour/db_scrub.rb @@ -32,6 +32,7 @@ def connect_to_database ActiveRecord::Base.remove_connection + ActiveRecord::Base.establish_connection connection rescue # assume the database doesn't exist Rake::Task['db:create'].invoke
Set up DB config before connecting to DB
diff --git a/spec/higher_level_api/integration/publisher_confirms_spec.rb b/spec/higher_level_api/integration/publisher_confirms_spec.rb index abc1234..def5678 100644 --- a/spec/higher_level_api/integration/publisher_confirms_spec.rb +++ b/spec/higher_level_api/integration/publisher_confirms_spec.rb @@ -2,7 +2,7 @@ describe Bunny::Channel do let(:connection) do - c = Bunny.new(:user => "bunny_gem", :password => "bunny_password", :vhost => "bunny_testbed") + c = Bunny.new(:user => "bunny_gem", :password => "bunny_password", :vhost => "bunny_testbed", :continuation_timeout => 10000) c.start c end
Use higher continuation timeout here
diff --git a/view.rb b/view.rb index abc1234..def5678 100644 --- a/view.rb +++ b/view.rb @@ -27,6 +27,7 @@ @players.push @player_name end display_current_players + @players end def display_current_players @@ -38,8 +39,12 @@ puts "----------------------" end - def render_scores(player) - + def render_scores(player_scores) + #object with players scores + # What type of object is this ????????? + player_scores.each do |player| + puts player + end end def render_track @@ -61,7 +66,7 @@ end #Driver Test Code -# my_view = View.new -# my_view +my_view = View.new +my_view # puts my_view.render_wrong_answer('Driver test') # puts "#{my_view.render_wrong_answer('Driver test') == 'Sorry. The answer is Driver test. Try again.'} : Returns wrong answer message"
Complete change to passing players array to controller
diff --git a/db/migrate/20160225163054_create_shifts.rb b/db/migrate/20160225163054_create_shifts.rb index abc1234..def5678 100644 --- a/db/migrate/20160225163054_create_shifts.rb +++ b/db/migrate/20160225163054_create_shifts.rb @@ -5,7 +5,7 @@ t.datetime :starts_at t.datetime :ends_at t.integer :volunteers_needed - t.integer :volunteers_count + t.integer :volunteers_count, default: 0 t.timestamps end
Set volunteer count field's default to 0 Quick! Before anyone migrates!
diff --git a/db/migrate/20120307163615_create_links.rb b/db/migrate/20120307163615_create_links.rb index abc1234..def5678 100644 --- a/db/migrate/20120307163615_create_links.rb +++ b/db/migrate/20120307163615_create_links.rb @@ -1,7 +1,7 @@ class CreateLinks < ActiveRecord::Migration def change create_table :links do |t| - t.string iri, :default => nil + t.string :iri, :default => nil t.references :source, :null => false t.references :target, :null => false t.references :logic_mapping # for heterogeneous links. nil means identity = homogeneous link
Correct the symbol :iri in the migrations
diff --git a/features/support/env.rb b/features/support/env.rb index abc1234..def5678 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -31,6 +31,10 @@ c.default_cassette_options = { :record => :once } c.cassette_library_dir = 'fixtures/vcr_cassettes' c.hook_into :webmock + + if ENV['VCR_DEBUG'] + c.debug_logger = STDOUT + end end VCR.cucumber_tags do |t|
Add option to output debug info to STDOUT This can be toggled on using the environment variable `VCR_DEBUG`
diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -2,6 +2,12 @@ RSpec.describe UsersController, type: :controller do describe "GET #index" do + before do + user = double('user') + allow(request.env['warden']).to receive(:authenticate!).and_return(user) + allow(controller).to receive(:current_user).and_return(user) + end + it "returns http success" do get :index expect(response).to have_http_status(:success)
Fix rspec test in the userscontroller to work with devise
diff --git a/spec/docker_service_test/sysvinit_spec.rb b/spec/docker_service_test/sysvinit_spec.rb index abc1234..def5678 100644 --- a/spec/docker_service_test/sysvinit_spec.rb +++ b/spec/docker_service_test/sysvinit_spec.rb @@ -4,7 +4,8 @@ let(:chef_run) do ChefSpec::SoloRunner.new( platform: 'centos', - version: '7.0' + version: '7.0', + step_into: 'docker_service' ).converge('docker_service_test::sysvinit') end
Revert "Attempt to fix specs by removing step_into from chef_run" This reverts commit 9cb470d4995a3c1e341f0f5a759d3e9230ab3903. Removing step_into does not fix the bug
diff --git a/spec/performance/injection_helper_spec.rb b/spec/performance/injection_helper_spec.rb index abc1234..def5678 100644 --- a/spec/performance/injection_helper_spec.rb +++ b/spec/performance/injection_helper_spec.rb @@ -0,0 +1,29 @@+require 'spec_helper' + +describe InjectionHelper, type: :helper do + let(:oc) { create(:simple_order_cycle) } + let(:relative_supplier) { create(:supplier_enterprise) } + let(:relative_distributor) { create(:distributor_enterprise) } + + before do + 50.times do + e = create(:enterprise) + oc.distributors << e + create(:enterprise_relationship, parent: e, child: relative_supplier) + create(:enterprise_relationship, parent: e, child: relative_distributor) + end + end + + it "is performant in injecting enterprises" do + results = [] + 4.times do |i| + ActiveRecord::Base.connection.query_cache.clear + Rails.cache.clear + result = Benchmark.measure { helper.inject_enterprises } + results << result.total if i > 0 + puts result + end + + puts (results.sum / results.count * 1000).round 0 + end +end
Add benchmarking test for inject_enterprises
diff --git a/mote.gemspec b/mote.gemspec index abc1234..def5678 100644 --- a/mote.gemspec +++ b/mote.gemspec @@ -16,5 +16,5 @@ "*.gemspec", "test/**/*.rb" ] - s.add_development_dependency "cutest", "~> 0.1" + s.add_development_dependency "cutest" end
Remove version from cutest dependency.
diff --git a/config.rb b/config.rb index abc1234..def5678 100644 --- a/config.rb +++ b/config.rb @@ -1,5 +1,4 @@ # Require any additional compass plugins here. -require 'modular-scale' # Set this to the root of your project when deployed: http_path = "/"
Remove the require from modular-scales
diff --git a/config.ru b/config.ru index abc1234..def5678 100644 --- a/config.ru +++ b/config.ru @@ -1,4 +1,5 @@-require "#{File.dirname(__FILE__)}/lib/dolphy" +$LOAD_PATH.unshift(File.dirname(__FILE__)) +require "lib/dolphy" app = DolphyApplication.app do get '/hello' do @@ -6,7 +7,11 @@ end get '/wat' do - erb :what, :body => "WAT" + erb :what, :body => "wat" + end + + get '/' do + haml :index, :body => "index" end end
Set a page for the root.
diff --git a/db/seeds/demo/worryboard/seeds.rb b/db/seeds/demo/worryboard/seeds.rb index abc1234..def5678 100644 --- a/db/seeds/demo/worryboard/seeds.rb +++ b/db/seeds/demo/worryboard/seeds.rb @@ -1,17 +1,20 @@ module Renalware - # Set the current DB connection - connection = ActiveRecord::Base.connection(); + # add random patients plus RABBITs + users = User.all.to_a - log "SQL INSERT 3 sample Worryboard patients" do - - # Execute a sql statement - connection.execute("INSERT INTO patient_worries (id, patient_id, - updated_by_id, created_by_id, created_at, updated_at) VALUES - (1, 1, 9, 9, '2017-03-01 15:21:45.242479', '2017-03-01 15:21:45.242479'), - (2, 2, 9, 9, '2017-03-01 15:22:00.922088', '2017-03-01 15:22:00.922088'), - (3, 252, 9, 9, '2017-03-01 15:22:12.956671', '2017-03-01 15:22:12.956671');") - + log "Adding Patients to Worryboard" do + Patient.transaction do + patients = Patient.all + i = 0 + patients.each do |patient| + i += 1 + if i % 10 == 0 or patient.family_name == "RABBIT" + Renalware::Patients::Worry.new( + patient: patient, + by: users.sample).save! + end + end + end end - end
Add Rabbits plus every 10 patients to worryboard
diff --git a/mute.gemspec b/mute.gemspec index abc1234..def5678 100644 --- a/mute.gemspec +++ b/mute.gemspec @@ -21,6 +21,7 @@ spec.add_development_dependency 'bundler', '~> 1.5' spec.add_development_dependency 'cane', '~> 2.6.1' spec.add_development_dependency 'cane-hashcheck', '~> 1.2.0' + spec.add_development_dependency 'coveralls', '~> 0.7.0' spec.add_development_dependency 'pry', '~> 0.9.12' spec.add_development_dependency 'rake', '~> 10.1.1' spec.add_development_dependency 'rspec', '~> 2.14.1'
Add coveralls as development dependency
diff --git a/scripts/fix-birth_dates.rb b/scripts/fix-birth_dates.rb index abc1234..def5678 100644 --- a/scripts/fix-birth_dates.rb +++ b/scripts/fix-birth_dates.rb @@ -0,0 +1,52 @@+require "mongo" +require "date" + +client = Mongo::Client.new("mongodb://localhost/mongo") +db = client.database +collection = client[:characters] + +def fix_nil_birth_dates(collection) + query ={ + "b" => { + "$gt" => Date.parse("1969-01-01"), + "$lt" => Date.parse("1971-01-01") + } + } + + records = collection.find(query) + puts "Found #{records.count} records that matched" + + result = collection.update_many(query, { "$set" => { "b" => nil }}) + puts result.inspect +end + +def fix_centuryless_birth_dates(collection) + query ={ + "b" => { + "$lt" => Date.parse("1999-01-01") + } + } + + records = collection.find(query) + puts "Found #{records.count} records that matched" + + # Adjust each by 2000 years (0020 -> 2020) + adjustment = 2000 + + records.each do |record| + puts "#{record["s"]}-#{record["n"]} #{record["b"]}" + newval = record["b"].to_date.next_year(2000).to_time.utc + puts "Setting new birth of #{newval}" + + result = collection.update_one({ + "s" => record["s"], + "n" => record["n"] + }, { + "$set" => { + "b" => newval + } + }) + + puts result.inspect + end +end
Add script to fix birth dates
diff --git a/test/integration/default/default_spec.rb b/test/integration/default/default_spec.rb index abc1234..def5678 100644 --- a/test/integration/default/default_spec.rb +++ b/test/integration/default/default_spec.rb @@ -1,10 +1,15 @@+if os[:family] == 'debian' && os[:release].to_i == 9 + describe package('runit-systemd') do + it { should be_installed } + end +end + describe package('runit') do it { should be_installed } end -describe command('ps -ef | grep -v grep | grep "runsvdir"') do - its(:exit_status) { should eq 0 } - its(:stdout) { should match(/runsvdir/) } +describe processes('runsvdir') do + it { should exist } end describe file('/etc/service') do
Add a test for runit-systemd and use the process inspec resource Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/lib/active_enum/acts_as_enum.rb b/lib/active_enum/acts_as_enum.rb index abc1234..def5678 100644 --- a/lib/active_enum/acts_as_enum.rb +++ b/lib/active_enum/acts_as_enum.rb @@ -45,7 +45,7 @@ end def lookup_by_name(index) - enum_values.where("#{active_enum_options[:name_column]} like ?", index.to_s).first + enum_values.where("#{active_enum_options[:name_column]} like lower(?)", index.to_s).first end end
Use lower for enum name in sql looktup in ActAs
diff --git a/lib/bible_ref/languages/base.rb b/lib/bible_ref/languages/base.rb index abc1234..def5678 100644 --- a/lib/bible_ref/languages/base.rb +++ b/lib/bible_ref/languages/base.rb @@ -12,7 +12,7 @@ details = books[book] next if details.nil? if (match = details[:match]) - return book if book_name =~ match + return book if book_name.downcase =~ match else return book if book_name == details[:name] end
Fix bug with mixed case in book names Oops, I broke this in the last release.
diff --git a/lib/capistrano/tasks/jetty.rake b/lib/capistrano/tasks/jetty.rake index abc1234..def5678 100644 --- a/lib/capistrano/tasks/jetty.rake +++ b/lib/capistrano/tasks/jetty.rake @@ -13,7 +13,7 @@ execute :sudo, :service, 'jetty', 'restart' end end + + before :published, :update_webapps + after :published, :restart end - -before :published, :update_webapps -after :published, :restart
Revert "Move task hooks outside namespace so they hook properly" This reverts commit e2d8a6bc1e581abc220861a17aaed964563347a5.
diff --git a/lib/markovian/lambda/tweeter.rb b/lib/markovian/lambda/tweeter.rb index abc1234..def5678 100644 --- a/lib/markovian/lambda/tweeter.rb +++ b/lib/markovian/lambda/tweeter.rb @@ -2,19 +2,19 @@ module Markovian module Lambda - # This class, given a Markovian corpus object and a Twitter OAuth token, will tweet out a + # This class, given a Markovian chain object and a Twitter OAuth token, will tweet out a # randomly-generated tweet. class Tweeter # We shouldn't start our tweets with @usernames. In the unlikely event we find ourselves unable to find an # appropriate starter word, throw an error. class UnableToFindAppropriateStarterWordError < StandardError; end - attr_reader :corpus - def initialize(corpus) - @corpus = corpus + attr_reader :chain + def initialize(chain) + @chain = chain end - def markovian_text(seed = corpus.random_word) + def markovian_text(seed = chain.random_word) text_builder.construct(seed, length: 140, start_result_with_seed: true) end @@ -33,7 +33,7 @@ # In the future, we'll have the ability to answer people, but for now, let's be careful. def appropriate_random_word (0...50).times do - word = corpus.random_word + word = chain.random_word return word unless word =~ /^\@/ end raise UnableToFindAppropriateStarterWordError @@ -44,7 +44,7 @@ end def text_builder - TextBuilder.new(corpus) + TextBuilder.new(chain) end end end
Update to reflect Corpus => Chain
diff --git a/lib/method_found/interceptor.rb b/lib/method_found/interceptor.rb index abc1234..def5678 100644 --- a/lib/method_found/interceptor.rb +++ b/lib/method_found/interceptor.rb @@ -1,18 +1,18 @@ module MethodFound class Interceptor < Module - attr_reader :regex + attr_reader :matcher def initialize(regex = nil, &intercept_block) define_method_missing(regex, &intercept_block) unless regex.nil? end - def define_method_missing(regex, &intercept_block) - @regex = regex + def define_method_missing(matcher, &intercept_block) + @matcher = matcher intercept_method = assign_intercept_method(&intercept_block) method_cacher = method(:cache_method) define_method :method_missing do |method_name, *arguments, &method_block| - if matches = regex.match(method_name) + if matches = matcher.match(method_name) method_cacher.(method_name, matches) send(method_name, *arguments, &method_block) else @@ -21,14 +21,14 @@ end define_method :respond_to_missing? do |method_name, include_private = false| - (method_name =~ regex) || super(method_name, include_private) + matcher.match(method_name) || super(method_name, include_private) end end def inspect klass = self.class name = klass.name || klass.inspect - "#<#{name}: #{regex.inspect}>" + "#<#{name}: #{matcher.inspect}>" end private
Use abstract matcher rather than regex
diff --git a/lib/morph/docker_maintenance.rb b/lib/morph/docker_maintenance.rb index abc1234..def5678 100644 --- a/lib/morph/docker_maintenance.rb +++ b/lib/morph/docker_maintenance.rb @@ -2,12 +2,12 @@ class DockerMaintenance def self.delete_container_and_remove_image(container) delete_container(container) - remove_image(container_image(container)) + remove_image(container_image_id(container)) end - def self.remove_image(image) - Rails.logger.info "Removing image #{image.id}..." - image.remove + def self.remove_image(image_id) + Rails.logger.info "Removing image #{image_id}..." + Docker::Image.get(image_id).remove rescue Docker::Error::ConfictError Rails.logger.warn "Conflict removing image, skipping..." rescue Docker::Error::NotFoundError @@ -21,9 +21,8 @@ container.delete end - def self.container_image(container) - image_id = container.info["Image"].split(":").first - Docker::Image.get(image_id) + def self.container_image_id(container) + container.info["Image"].split(":").first end end end
Move logic around so that errors are caught in one place Prevents a Docker::Error::NotFoundError being raised in what was the container_image method.
diff --git a/db/migrate/20141121025443_create_schools.rb b/db/migrate/20141121025443_create_schools.rb index abc1234..def5678 100644 --- a/db/migrate/20141121025443_create_schools.rb +++ b/db/migrate/20141121025443_create_schools.rb @@ -1,17 +1,6 @@ class CreateSchools < ActiveRecord::Migration def change create_table :schools do |t| - # t.string :program_code - # t.string :program_name - # t.string :dbn - # t.string :printed_school_name - # t.string :interest_area - # t.string :selection_method - # t.string :selection_method_abbrevi - # t.string :directory_page_ - # t.string :borough - # t.string :urls - t.string :phone_number t.string :grade_span_min t.string :grade_span_max
Remove commented out fields, not using for schools table
diff --git a/ruby/clock/clock.rb b/ruby/clock/clock.rb index abc1234..def5678 100644 --- a/ruby/clock/clock.rb +++ b/ruby/clock/clock.rb @@ -4,13 +4,13 @@ class Clock attr_accessor :hour, :minute - def initialize(hour:, minute: 0) + def initialize(hour: 0, minute: 0) @hour = hour @minute = minute end def to_s - build_hour(hour) + ':' + break_down_minutes(minute) + build_hour(hour) + ':' + build_minute(minute) end def break_down_minutes(minute)
Fix mistake and get things green before switching everything to minutes
diff --git a/lib/rom/support/class_macros.rb b/lib/rom/support/class_macros.rb index abc1234..def5678 100644 --- a/lib/rom/support/class_macros.rb +++ b/lib/rom/support/class_macros.rb @@ -1,5 +1,31 @@ module ROM + # Internal support module for class-level settings + # + # @private module ClassMacros + # Specify what macros a class will use + # + # @example + # class MyClass + # extend ROM::ClassMacros + # + # defines :one, :two + # + # one 1 + # two 2 + # end + # + # class OtherClass < MyClass + # two 'two' + # end + # + # MyClass.one # => 1 + # MyClass.two # => 2 + # + # OtherClass.one # => 1 + # OtherClass.two # => 'two' + # + # @api private def defines(*args) mod = Module.new
Add YARD for ClassMacros support module
diff --git a/write_now/db/migrate/20141013213821_create_projects.rb b/write_now/db/migrate/20141013213821_create_projects.rb index abc1234..def5678 100644 --- a/write_now/db/migrate/20141013213821_create_projects.rb +++ b/write_now/db/migrate/20141013213821_create_projects.rb @@ -2,6 +2,8 @@ def change create_table :projects do |t| t.belongs_to :user + t.string :title + t.integer :wordcount_goal t.integer :goal_time_limit t.boolean :active t.boolean :archived
Update project migration with title and wordcount_goal fields.
diff --git a/spec/controllers/blogs_controller_spec.rb b/spec/controllers/blogs_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/blogs_controller_spec.rb +++ b/spec/controllers/blogs_controller_spec.rb @@ -0,0 +1,61 @@+require 'spec_helper' + +describe BlogsController do + let(:user) { FactoryGirl.create :user } + + before :each do + @request.env["devise.mapping"] = Devise.mappings[:users] + sign_in user + end + + describe "POST 'create'" do + before :each do + post 'create', :club_id => user.clubs.first.id + end + + it "returns http success" do + response.should be_success + end + + it "should render the edit view" do + response.should render_template("blogs/edit") + end + + it "returns the club" do + assigns(:club).should_not be_nil + end + + it "returns the course belonging to the club" do + assigns(:blog).should_not be_nil + assigns(:blog).club.should == assigns(:club) + end + + it "assigns the default title" do + assigns(:blog).title.should == Settings.blogs[:default_title] + end + + it "assigns the default content" do + assigns(:blog).content.should == Settings.blogs[:default_content] + end + end + + describe "GET 'edit'" do + let(:blog) { FactoryGirl.create :blog, :club_id => user.clubs.first.id } + + before :each do + get 'edit', :id => blog.id + end + + it "returns http success" do + response.should be_success + end + + it "returns the club" do + assigns(:club).should == blog.club + end + + it "returns the blog" do + assigns(:blog).should == blog + end + end +end
Add Spec for Blogs Controller edit and create Add spec tests for the Blogs controller create and edit actions.
diff --git a/spec/controllers/posts_controller_spec.rb b/spec/controllers/posts_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/posts_controller_spec.rb +++ b/spec/controllers/posts_controller_spec.rb @@ -2,6 +2,9 @@ describe PostsController do describe "GET #new" do + before :each do + session[:user_id] = true + end it "renders the posts new view" do get :new expect(response).to render_template :new
Edit Post Controller Test to account for logged in user
diff --git a/spec/lib/gitometer/github_helpers_spec.rb b/spec/lib/gitometer/github_helpers_spec.rb index abc1234..def5678 100644 --- a/spec/lib/gitometer/github_helpers_spec.rb +++ b/spec/lib/gitometer/github_helpers_spec.rb @@ -10,20 +10,44 @@ subject.endpoint.should == 'https://api.github.com' end - let(:user) { mock('user', :token => 1) } + context 'with a user' do + let(:user) { mock('user', :token => 1, :login => 'cmeik') } - it 'can parameterize the access token' do - subject.access_token_param_for_user(user).should == "access_token=1" + include_context 'a valid github repository response' + include_context 'a valid github commit response' + + it 'can parameterize the access token' do + subject.access_token_param_for_user(user).should == "access_token=1" + end + + it 'can paramterize the page' do + subject.param_for_page(1).should == "page=1" + end + + it 'retrieves the repositories for a user' do + stub_request(:get, "https://api.github.com/users/cmeik/repos?access_token=1"). + to_return(:status => 200, :body => repository_response_body, :headers => repository_response_headers) + stub_request(:get, "https://api.github.com/users/cmeik/repos?access_token=1&page=2"). + to_return(:status => 200, :body => "[]", :headers => {}) + + subject.repositories_for_user(user).should == JSON.parse(repository_response_body) + end + + context 'and a repository' do + let(:repository) { mock('repository', :[] => 'wine_dot_com_api_request' ) } + + it 'retrieves the commits for a users repository' do + stub_request(:get, "https://api.github.com/repos/cmeik/wine_dot_com_api_request/commits?access_token=1"). + to_return(:status => 200, :body => commit_response_body, :headers => {}) + + subject.commits_for_user_and_repository(user, repository).should == JSON.parse(commit_response_body) + end + + it 'can convert the commit list into a count by day hash' do + commit_by_date = { "2010-01-02" => 1 } + subject.commits_to_daily_count(JSON.parse(commit_response_body)).should == commit_by_date + end + end end - - it 'can paramterize the page' do - subject.param_for_page(1).should == "page=1" - end - - pending 'retrieves the repositories for a user' - - pending 'retrieves the commits for a users repository' - - pending 'can convert the commit list into a count by day hash' end end
Add missing spec for github helpers.
diff --git a/spec/unit/auom/inspection/inspect_spec.rb b/spec/unit/auom/inspection/inspect_spec.rb index abc1234..def5678 100644 --- a/spec/unit/auom/inspection/inspect_spec.rb +++ b/spec/unit/auom/inspection/inspect_spec.rb @@ -9,33 +9,33 @@ context 'when scalar is exact in decimal' do let(:scalar) { 1 } - it { should eql("<AUOM::Unit @scalar=1>") } + it { should eql('<AUOM::Unit @scalar=1>') } end context 'when scalar is NOT exact in decimal' do let(:scalar) { Rational(1, 2) } - it { should eql("<AUOM::Unit @scalar=~0.5000>") } + it { should eql('<AUOM::Unit @scalar=~0.5000>') } end context 'when has only numerator' do let(:scalar) { Rational(1, 3) } let(:unit) { [:meter] } - it { should eql("<AUOM::Unit @scalar=~0.3333 meter>") } + it { should eql('<AUOM::Unit @scalar=~0.3333 meter>') } end context 'when has only denominator' do let(:scalar) { Rational(1, 3) } let(:unit) { [[], :meter] } - it { should eql("<AUOM::Unit @scalar=~0.3333 1/meter>") } + it { should eql('<AUOM::Unit @scalar=~0.3333 1/meter>') } end context 'when has numerator and denominator' do let(:scalar) { Rational(1, 3) } let(:unit) { [:euro, :meter] } - it { should eql("<AUOM::Unit @scalar=~0.3333 euro/meter>") } + it { should eql('<AUOM::Unit @scalar=~0.3333 euro/meter>') } end end
Use single quotes for non interpolated string literals
diff --git a/spec/controllers/sitemap_controller_spec.rb b/spec/controllers/sitemap_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/sitemap_controller_spec.rb +++ b/spec/controllers/sitemap_controller_spec.rb @@ -0,0 +1,31 @@+require 'spec_helper' + +describe SitemapController do + + describe 'GET #index' do + + let :static_pages_urls do + [root_url, about_url, contact_url, faq_url, login_url, signup_url] + end + + it 'renders the sitemap template' do + get :index, format: :xml + expect(response).to render_template(:index) + end + + it 'assigns @static_pages' do + get :index, format: :xml + expect(assigns(:static_pages)).to eql(static_pages_urls) + end + + it 'assigns @courses' do + course = [FactoryGirl.create(:course)] + + get :index, format: :xml + + expect(assigns(:courses)).to eql(course) + end + + end + +end
Add unit tests for the sitemap controller
diff --git a/spec/dummy/app/helpers/styleguide_helper.rb b/spec/dummy/app/helpers/styleguide_helper.rb index abc1234..def5678 100644 --- a/spec/dummy/app/helpers/styleguide_helper.rb +++ b/spec/dummy/app/helpers/styleguide_helper.rb @@ -4,7 +4,7 @@ formatted_attributes = JSON.pretty_generate(example[:attributes]).gsub(/"([^"]+)":/, '\1:') "ui_component('#{name}', #{formatted_attributes})" else - example.values.first + example[:slim] end end
Use :slim key for non-attribute examples
diff --git a/spec/unit/recipes/module_http_geoip_spec.rb b/spec/unit/recipes/module_http_geoip_spec.rb index abc1234..def5678 100644 --- a/spec/unit/recipes/module_http_geoip_spec.rb +++ b/spec/unit/recipes/module_http_geoip_spec.rb @@ -1,9 +1,9 @@ # encoding: utf-8 -describe 'et_nginx::http_geoip_module' do +describe 'et_nginx::module_http_geoip' do cached(:chef_run) do ChefSpec::SoloRunner.new do |node| - node.set['nginx']['modules'] = ['et_nginx::http_geoip_module'] + node.set['nginx']['modules'] = ['et_nginx::module_http_geoip'] end.converge(described_recipe) end
Fix module recipe name in geoip spec test
diff --git a/resqued.gemspec b/resqued.gemspec index abc1234..def5678 100644 --- a/resqued.gemspec +++ b/resqued.gemspec @@ -3,7 +3,7 @@ s.name = 'resqued' s.version = Resqued::VERSION s.summary = s.description = 'Daemon of resque workers' - s.homepage = 'https://github.com' + s.homepage = 'https://github.com/spraints/resqued' s.authors = ["Matt Burke"] s.email = 'spraints@gmail.com' s.files = Dir['lib/**/*', 'README.md', 'docs/**/*']
Set the project home page.
diff --git a/app/decorators/spree/orders/finalize_creates_subscriptions.rb b/app/decorators/spree/orders/finalize_creates_subscriptions.rb index abc1234..def5678 100644 --- a/app/decorators/spree/orders/finalize_creates_subscriptions.rb +++ b/app/decorators/spree/orders/finalize_creates_subscriptions.rb @@ -6,7 +6,10 @@ module Orders module FinalizeCreatesSubscriptions def finalize! - SolidusSubscriptions::SubscriptionGenerator.activate(subscription_line_items) + SolidusSubscriptions::SubscriptionGenerator.group(subscription_line_items).each do |line_items| + SolidusSubscriptions::SubscriptionGenerator.activate(line_items) + end + super end end
Create a subscription per subscription_line_item group A separate subscription should be created for each group of similar subscription line items. ex. subscription line items with different fulfillment intervals cannot be fulfilled by the same subscription. But if the line items have all the same subscription configuration option, they can be fulfilled by the same subscription
diff --git a/SSFadingScrollView.podspec b/SSFadingScrollView.podspec index abc1234..def5678 100644 --- a/SSFadingScrollView.podspec +++ b/SSFadingScrollView.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "SSFadingScrollView" - s.version = "1.0" + s.version = "1.0.1" s.summary = "A UIScrollView subclass that fades the top and/or bottom of a scroll view to transparent" s.homepage = "https://github.com/stephsharp/SSFadingScrollView/" s.license = { :type => "MIT", :file => "LICENSE" }
Update podspec version to 1.0.1
diff --git a/app/controllers/email_alert_subscriptions_controller.rb b/app/controllers/email_alert_subscriptions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/email_alert_subscriptions_controller.rb +++ b/app/controllers/email_alert_subscriptions_controller.rb @@ -6,11 +6,8 @@ protect_from_forgery except: :create def new - # So using request.env["PATH_INFO"] has a leading slash which would need - # removing before asking the content api for the artefact. I don't like this - # either but I prefer it to string manip. - artefact = content_api.artefact("#{finder_slug}/email-signup") - @signup = SignupPresenter.new(artefact) + content = content_store.content_item(request.path) + @signup = SignupPresenter.new(content) end def create
Refactor Finders to pull from content_store This commit contains the work needed to pull Finders from the content_store and removes the ability for Finders to be retrieved from the content-api. Finders and email-alert-subs now pull their content_item and the relevant tests have been updated to stub the content_store.
diff --git a/db/migrate/20160418141210_add_read_only_to_miq_alert.rb b/db/migrate/20160418141210_add_read_only_to_miq_alert.rb index abc1234..def5678 100644 --- a/db/migrate/20160418141210_add_read_only_to_miq_alert.rb +++ b/db/migrate/20160418141210_add_read_only_to_miq_alert.rb @@ -0,0 +1,13 @@+class AddReadOnlyToMiqAlert < ActiveRecord::Migration[5.0] + def up + add_column :miq_alerts, :read_only, :boolean + say_with_time('Add read only parameter to MiqAlert with true for OOTB alerts') do + guids = YAML.load_file(Rails.root.join("db/fixtures/miq_alerts.yml")).map { |h| h["guid"] || h[:guid] } + MiqAlert.where(:guid => guids).update(:read_only => true) + end + end + + def down + remove_column :miq_alerts, :read_only + end +end
Add read_only column to the miq_alerts table Where the OOTB alerts will be all read_only
diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index abc1234..def5678 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -4,6 +4,7 @@ @repositories = %w{ git://github.com/datasets/population.git git://github.com/datasets/house-prices-uk.git + https://github.com/datasets/house-prices-us.git git://github.com/datasets/gdp-uk.git git://github.com/datasets/cofog.git https://github.com/theodi/github-viewer-test-data.git
Add US house prices example
diff --git a/test/test_mechanize_http_auth_challenge.rb b/test/test_mechanize_http_auth_challenge.rb index abc1234..def5678 100644 --- a/test/test_mechanize_http_auth_challenge.rb +++ b/test/test_mechanize_http_auth_challenge.rb @@ -25,6 +25,14 @@ assert_equal expected, @challenge.realm(@uri + '/foo') end + def test_realm_digest_case + challenge = @AC.new 'Digest', { 'realm' => 'R' }, 'Digest realm=R' + + expected = @AR.new 'Digest', @uri, 'R' + + assert_equal expected, challenge.realm(@uri + '/foo') + end + def test_realm_unknown @challenge.scheme = 'Unknown' @@ -39,6 +47,12 @@ assert_equal 'r', @challenge.realm_name end + def test_realm_name_case + challenge = @AC.new 'Digest', { 'realm' => 'R' }, 'Digest realm=R' + + assert_equal 'R', challenge.realm_name + end + def test_realm_name_ntlm challenge = @AC.new 'Negotiate, NTLM'
Add tests for realm case sensitivity in AuthChallenge As per RFC 1945 (section 11) and RFC 2617, the realm value is case sensitive. This commit adds tests for realm case sensitivity in Mechanize::HTTP::AuthChallenge.
diff --git a/ext/rake/mustache_task.rb b/ext/rake/mustache_task.rb index abc1234..def5678 100644 --- a/ext/rake/mustache_task.rb +++ b/ext/rake/mustache_task.rb @@ -21,13 +21,13 @@ end def template - @template ||= "#{@target}.mustache" + @template || "#{@target}.mustache" unless @target.nil? end def template=(template_file) - @base = @base.reject {|e| e == @template} unless @template.nil? + @deps and @deps.reject! {|e| e == self.template } @template = template_file - @base = @base.push(@template) + @deps |= [self.template] end end end
Build system: FIX template accessor in MustacheTask
diff --git a/spec/controllers/browser_sessions_routing_spec.rb b/spec/controllers/browser_sessions_routing_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/browser_sessions_routing_spec.rb +++ b/spec/controllers/browser_sessions_routing_spec.rb @@ -20,7 +20,7 @@ end it "should generate params { :controller => 'browser_sessions', action => 'create' } from GET /browser_session" do - {:get => "/browser_session"}.should route_to({:controller => "browser_sessions", :action => "create", :method => :get}) + {:get => "/browser_session"}.should route_to({:controller => "browser_sessions", :action => "create"}) end end
Fix browser sessions routing spec
diff --git a/spec/presenters/sufia/work_show_presenter_spec.rb b/spec/presenters/sufia/work_show_presenter_spec.rb index abc1234..def5678 100644 --- a/spec/presenters/sufia/work_show_presenter_spec.rb +++ b/spec/presenters/sufia/work_show_presenter_spec.rb @@ -1,7 +1,6 @@ require 'spec_helper' describe Sufia::WorkShowPresenter do - let(:solr_document) { SolrDocument.new(work.to_solr) } let(:ability) { double "Ability" } let(:presenter) { described_class.new(solr_document, ability) }
Remove empty lines around block body
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/dotiw.gemspec b/dotiw.gemspec index abc1234..def5678 100644 --- a/dotiw.gemspec +++ b/dotiw.gemspec @@ -9,7 +9,7 @@ s.version = DOTIW::VERSION s.authors = ["Ryan Bigg"] - s.date = %q{2010-12-23} + s.date = %q{2015-04-09} s.description = "Better distance_of_time_in_words for Rails" s.summary = "Better distance_of_time_in_words for Rails" s.email = "radarlistener@gmail.com"
Bump date in gemspec too. Because that's a thing.
diff --git a/lib/aws_agcod/authentication_credentials.rb b/lib/aws_agcod/authentication_credentials.rb index abc1234..def5678 100644 --- a/lib/aws_agcod/authentication_credentials.rb +++ b/lib/aws_agcod/authentication_credentials.rb @@ -5,7 +5,7 @@ attr_reader :access_key, :secret_key, :region, :country, :partner_id, :host_url - CURRENCIES = YAML.load_file('config/currencies.yml') + CURRENCIES = YAML.load_file(File.join(File.dirname(__FILE__),'../../config/currencies.yml')) def initialize(config) @access_key = config[:access_key] || config["access_key"]
Make the config file accessible
diff --git a/lib/chunky_png/canvas/data_url_exporting.rb b/lib/chunky_png/canvas/data_url_exporting.rb index abc1234..def5678 100644 --- a/lib/chunky_png/canvas/data_url_exporting.rb +++ b/lib/chunky_png/canvas/data_url_exporting.rb @@ -6,7 +6,7 @@ # easily be used inline in CSS or HTML. # @return [String] The canvas formatted as a data URL string. def to_data_url - ['data:image/png;base64,', to_blob].pack('A*m').gsub(/\n/, '') + ['data:image/png;base64,', to_blob].pack('A*m').delete("\n") end end end
standard.rb: Use `delete` rather then unneeded `gsub` to delete newlines.
diff --git a/lib/smart_answer/question/country_select.rb b/lib/smart_answer/question/country_select.rb index abc1234..def5678 100644 --- a/lib/smart_answer/question/country_select.rb +++ b/lib/smart_answer/question/country_select.rb @@ -14,10 +14,6 @@ def country_list @country_list ||= load_countries - end - - def country_in(countries) - ->(response) { countries.include?(response) } end def valid_option?(option)
Remove country_in method from CountrySelect The method is unused, removing to simplify the codebase.
diff --git a/lib/swagger_docs_generator/parser/parser.rb b/lib/swagger_docs_generator/parser/parser.rb index abc1234..def5678 100644 --- a/lib/swagger_docs_generator/parser/parser.rb +++ b/lib/swagger_docs_generator/parser/parser.rb @@ -32,8 +32,8 @@ end def create_file - puts "Create file : #{temporary_file}" - FileUtils.touch(temporary_file) + base_file = { paths: {}, tags: {}, definitions: {} } + File.open(temporary_file, 'a+') { |file| file.puts(base_file.to_json) } end end end
Create file with base if necessary
diff --git a/batdc/app/controllers/events_controller.rb b/batdc/app/controllers/events_controller.rb index abc1234..def5678 100644 --- a/batdc/app/controllers/events_controller.rb +++ b/batdc/app/controllers/events_controller.rb @@ -5,9 +5,8 @@ if params[:search] filt = "event_name like ?" srch = "%#{params[:search]}%" - @events = Event.where(filt, - srch).order(:start_date).paginate(page: params[:page], per_page: - 25) + pag = { page: params[:page], per_page: 25} + @events = Event.where(filt, srch).order(:start_date).paginate(pag) else @events = Event.order(start_date: :desc).paginate(page: params[:page], per_page: 25)
Clean up long code line in event controller
diff --git a/lib/acts_as_tenant/controller_extensions.rb b/lib/acts_as_tenant/controller_extensions.rb index abc1234..def5678 100644 --- a/lib/acts_as_tenant/controller_extensions.rb +++ b/lib/acts_as_tenant/controller_extensions.rb @@ -12,7 +12,7 @@ end self.tenant_class = tenant.to_s.capitalize.constantize - self.tenant_column = tenant_column.to_sym + self.tenant_column = column.to_sym self.class_eval do before_filter :find_tenant_by_subdomain
Fix to set_tenant_by_subdomain to fix nil.to_sym error
diff --git a/lib/project/ruby_motion_query/rmq/events.rb b/lib/project/ruby_motion_query/rmq/events.rb index abc1234..def5678 100644 --- a/lib/project/ruby_motion_query/rmq/events.rb +++ b/lib/project/ruby_motion_query/rmq/events.rb @@ -32,7 +32,7 @@ if view.respond_to? :setOnSeekBarChangeListener view.onSeekBarChangeListener = RMQSeekChange.new(args, &block) # Text change - elsif view.respond_to? :addTextChangeListener + elsif view.respond_to? :addTextChangedListener view.addTextChangedListener(RMQTextChange.new(&block)) end end
Fix for text changed event.
diff --git a/lib/pulse/resources/ministry_involvement.rb b/lib/pulse/resources/ministry_involvement.rb index abc1234..def5678 100644 --- a/lib/pulse/resources/ministry_involvement.rb +++ b/lib/pulse/resources/ministry_involvement.rb @@ -4,8 +4,21 @@ class << self def build_from(resp, request_params = {}) - resp = resp.is_a?(Array) ? resp.first['ministry_involvements']['ministry_involvement'] : resp - super(resp, request_params) + if resp.is_a?(Array) + new_resp = resp.first['ministry_involvements']['ministry_involvement'] + + # Include some user meta data for convenience + ['first_name', 'last_name', 'email', 'guid', 'civicrm_id'].each do |user_attribute| + new_resp.each do |mi| + mi['user'] ||= {} + mi['user'][user_attribute] = resp.first['ministry_involvements'][user_attribute] + end + end + else + new_resp = resp + end + + super(new_resp, request_params) end end
Return some user meta data for convenience
diff --git a/lib/specinfra/command/base/routing_table.rb b/lib/specinfra/command/base/routing_table.rb index abc1234..def5678 100644 --- a/lib/specinfra/command/base/routing_table.rb +++ b/lib/specinfra/command/base/routing_table.rb @@ -1,7 +1,7 @@ class Specinfra::Command::Base::RoutingTable < Specinfra::Command::Base class << self def check_has_entry(destination) - "ip route | grep -E '^#{destination} |^default '" + "ip route | grep -E '^#{destination} '" end alias :get_entry :check_has_entry
Fix check_has_entry for routing table - removed ^default from regex
diff --git a/spec/factories/application_drafts.rb b/spec/factories/application_drafts.rb index abc1234..def5678 100644 --- a/spec/factories/application_drafts.rb +++ b/spec/factories/application_drafts.rb @@ -8,6 +8,8 @@ association :project1, :accepted, factory: :project project_plan { FFaker::Lorem.paragraph } heard_about_it { FFaker::Lorem.paragraph } + why_selected_project { FFaker::Lorem.paragraph } + working_together { FFaker::Lorem.paragraph } misc_info { FFaker::Lorem.paragraph } # NOTE not a required field after(:create) do |draft|
Add values to the two new fields for a valid application draft
diff --git a/spec/fake_app/mongo_mapper/config.rb b/spec/fake_app/mongo_mapper/config.rb index abc1234..def5678 100644 --- a/spec/fake_app/mongo_mapper/config.rb +++ b/spec/fake_app/mongo_mapper/config.rb @@ -1,2 +1,2 @@-MongoMapper.connection = Mongo::Connection.new 'localhost', 27017 +MongoMapper.connection = Mongo::Connection.new '0.0.0.0', 27017 MongoMapper.database = 'kaminari_test'
Fix mongo mapper test suite https://travis-ci.org/amatsuda/kaminari/jobs/41827391#L98
diff --git a/lib/chef_fs/file_system/base_fs_object.rb b/lib/chef_fs/file_system/base_fs_object.rb index abc1234..def5678 100644 --- a/lib/chef_fs/file_system/base_fs_object.rb +++ b/lib/chef_fs/file_system/base_fs_object.rb @@ -9,6 +9,9 @@ @name = name @path = ChefFS::PathUtils::join(parent.path, name) else + if name != '' + raise ArgumentError, "Name of root object must be empty string: was '#{name}' instead" + end @path = '/' end end
Check assumption that name = '' for root
diff --git a/lib/embulk/guess/jsonl.rb b/lib/embulk/guess/jsonl.rb index abc1234..def5678 100644 --- a/lib/embulk/guess/jsonl.rb +++ b/lib/embulk/guess/jsonl.rb @@ -18,7 +18,8 @@ rows << JSON.parse(line) end - return {} if rows.size <= 3 + min_rows_for_guess = config.fetch("parser", {}).fetch("min_rows_for_guess", 4) + return {} if rows.size < min_rows_for_guess columns = Embulk::Guess::SchemaGuess.from_hash_records(rows).map do |c| column = {name: c.name, type: c.type}
Make the fixed value 3 of threshold for guess configurable
diff --git a/lib/elasticsearch/modules/query_plugin.rb b/lib/elasticsearch/modules/query_plugin.rb index abc1234..def5678 100644 --- a/lib/elasticsearch/modules/query_plugin.rb +++ b/lib/elasticsearch/modules/query_plugin.rb @@ -10,7 +10,7 @@ end def call(*args) - if query.respond_to?(:to_query_hash) && !self.q + if query.respond_to?(:to_query_hash) && (!self.respond_to?(:q) || !self.q) self.params = query.to_query_hash end @@ -27,7 +27,8 @@ def self.plugin_for(protocol) [protocol::Search, - protocol::Count] + protocol::Count, + protocol::Percolate] end end end
Allow QueryPlugin for Percolate request
diff --git a/lib/json-schema/attributes/formats/uri.rb b/lib/json-schema/attributes/formats/uri.rb index abc1234..def5678 100644 --- a/lib/json-schema/attributes/formats/uri.rb +++ b/lib/json-schema/attributes/formats/uri.rb @@ -5,8 +5,12 @@ class UriFormat < FormatAttribute def self.validate(current_schema, data, fragments, processor, validator, options = {}) return unless data.is_a?(String) + error_message = "The property '#{build_fragment(fragments)}' must be a valid URI" begin - Addressable::URI.parse(Addressable::URI.escape(data)) + # TODO + # Addressable only throws an exception on to_s for invalid URI strings, although it + # probably should throughout parse already - change this when there is news from Addressable + Addressable::URI.parse(data).to_s rescue Addressable::URI::InvalidURIError validation_error(processor, error_message, fragments, current_schema, self, options[:record_errors]) end
Use to_s to trigger URI validation
diff --git a/lib/tasks/temporary/factual_migration.rake b/lib/tasks/temporary/factual_migration.rake index abc1234..def5678 100644 --- a/lib/tasks/temporary/factual_migration.rake +++ b/lib/tasks/temporary/factual_migration.rake @@ -9,12 +9,13 @@ raw_inputs.each do |raw_input| data = raw_input.data - locations = Location - .where(latitude: data['latitude']) - .where(longitude: data['longitude']) - - locations.each do |location| - if data['locality'].present? && location.city.nil? + if data['locality'].present? + locations = Location + .where(latitude: data['latitude']) + .where(longitude: data['longitude']) + .where(city: nil) + + locations.each do |location| location.update_attribute(:city, data['locality']) puts "Updated Location(#{location.id}): City: #{data['locality']} from RawInput(#{raw_input.id})" end
:lipstick: Refactor to do less db calls
diff --git a/lib/atlas/fever_details.rb b/lib/atlas/fever_details.rb index abc1234..def5678 100644 --- a/lib/atlas/fever_details.rb +++ b/lib/atlas/fever_details.rb @@ -5,9 +5,10 @@ include ValueObject values do - attribute :type, Symbol - attribute :group, Symbol - attribute :curve, Symbol, default: nil + attribute :type, Symbol + attribute :group, Symbol + attribute :curve, Symbol, default: nil + attribute :defer_for, Integer, default: 0 end end end
Add "defer_for" attribute to Fever details Controls for how many hours load may be deferred by Fever before being dropped.
diff --git a/Casks/nmap.rb b/Casks/nmap.rb index abc1234..def5678 100644 --- a/Casks/nmap.rb +++ b/Casks/nmap.rb @@ -4,4 +4,5 @@ version '6.40-2' sha256 '3908c038bde3c6c5775021a3808835ea6297057747ff609d41fa89528d904582' install 'nmap-6.40-2.mpkg' + uninstall :pkgutil => 'org.insecure.nmap6402.*.pkg' end
Add uninstall stanza for NMap