diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/test/unit/code/builder/java/java_interface_model_builder_test.rb b/test/unit/code/builder/java/java_interface_model_builder_test.rb index abc1234..def5678 100644 --- a/test/unit/code/builder/java/java_interface_model_builder_test.rb +++ b/test/unit/code/builder/java/java_interface_model_builder_test.rb @@ -0,0 +1,23 @@+require 'test/unit' +require 'logging' +require File.expand_path '../../../../../test_helper.rb', __FILE__ +require File.expand_path '../../../../../../lib/configuration/app_logger.rb', __FILE__ +require File.expand_path '../../../../../../lib/model/class_meta.rb', __FILE__ +require File.expand_path '../../../../../../lib/code/builder/java/java_model_builder.rb', __FILE__ + +class JavaInterfaceModelBuilderTest < Test::Unit::TestCase + + include RamlPoliglota::Code::Builder + include RamlPoliglota::Model + + def test_build + builder = CodeBuilder.new SUPPORTED_PROGRAMMING_LANGUAGES[:java] + clazz = CLASS_META_FACTORY[:imodel][:object] + + expected = CLASS_META_FACTORY[:imodel][:text] + actual = builder.build_imodel clazz.namespace + + assert_equal expected, actual + end + +end
Create unit test to java interface model builder.
diff --git a/lib/docs/scrapers/phpunit.rb b/lib/docs/scrapers/phpunit.rb index abc1234..def5678 100644 --- a/lib/docs/scrapers/phpunit.rb +++ b/lib/docs/scrapers/phpunit.rb @@ -24,7 +24,7 @@ HTML version '5' do - self.release = '5.4' + self.release = '5.5' self.base_url = "https://phpunit.de/manual/#{release}/en/" end
Update PHPUnit documentation (5.5, 4.8)
diff --git a/lib/checkers.rb b/lib/checkers.rb index abc1234..def5678 100644 --- a/lib/checkers.rb +++ b/lib/checkers.rb @@ -1,2 +1,53 @@+require_relative "./board" + module Checkers + class Game + INPUT_MAP = { + "1" => 0, "2" => 1, "3" => 2, "4" => 3, + "5" => 4, "6" => 5, "7" => 6, "8" => 7, + "a" => 0, "b" => 1, "c" => 2, "d" => 3, + "e" => 4, "f" => 5, "g" => 6, "h" => 7 + } + + def play + players = [:red, :white] + current = 0 + + board = Board.new + until board.game_over? + print_board(board) + begin + move = get_move + start_pos = move.shift + + board.move(start_pos, *move) + rescue InvalidMoveError => ex + puts ex + next # skip alternation of turn + end + + # alternate each turn + current = (current == 0 ? 1 : 0) + end + end + + + private + + def get_move + puts "Enter a move (e.g., f3 h5 [f7...]): " + input = gets.chomp.split(" ") + + input.map do |str| + str.split("").map { |pos| INPUT_MAP[pos] }.reverse + end + end + + def print_board(board) + # for now... + board.pb + end + end end + +Checkers::Game.new.play
Add simple game loop with no error checking
diff --git a/app/views/course/video/videos/_video_lesson_plan_item.json.jbuilder b/app/views/course/video/videos/_video_lesson_plan_item.json.jbuilder index abc1234..def5678 100644 --- a/app/views/course/video/videos/_video_lesson_plan_item.json.jbuilder +++ b/app/views/course/video/videos/_video_lesson_plan_item.json.jbuilder @@ -4,5 +4,5 @@ json.description item.description json.edit_path edit_course_video_path(current_course, item) if can?(:update, item) json.delete_path course_video_path(current_course, item) if can?(:destroy, item) -type = current_component_host[:course_videos_component]&.title || t('components.video.name') +type = current_component_host[:course_videos_component]&.settings&.title || t('components.video.name') json.lesson_plan_item_type [type]
Fix the video settings title in lesson plan
diff --git a/lib/judopay.rb b/lib/judopay.rb index abc1234..def5678 100644 --- a/lib/judopay.rb +++ b/lib/judopay.rb @@ -1,8 +1,8 @@-require "judopay/version" -require File.expand_path('../judopay/api', __FILE__) -require File.expand_path('../judopay/payment', __FILE__) -require File.expand_path('../judopay/transaction', __FILE__) -require File.expand_path('../judopay/response', __FILE__) +require_relative 'judopay/version' +require_relative 'judopay/api' +require_relative 'judopay/payment' +require_relative 'judopay/transaction' +require_relative 'judopay/response' module Judopay class << self
Use require_relative instead of File.expand_path
diff --git a/lib/kenny_g.rb b/lib/kenny_g.rb index abc1234..def5678 100644 --- a/lib/kenny_g.rb +++ b/lib/kenny_g.rb @@ -10,6 +10,7 @@ def play_game(game_params = {}) QuickGameSetup.new(game_params).play_game end + alias_method :start_game, :play_game def details "Nothing to do yet! Kick things off by running `KennyG.game_setup` or `KennyG.play_game`."
Add alias method to start game * after testing in irb, the first thing I wrote was start game. So...
diff --git a/lib/todoist.rb b/lib/todoist.rb index abc1234..def5678 100644 --- a/lib/todoist.rb +++ b/lib/todoist.rb @@ -1,6 +1,16 @@ require 'uri' require 'json' require 'faraday' + +module Todoist + class InvalidURIError < StandardError; end + class InvalidJSONPathError < StandardError; end + class InvalidJSONError < StandardError; end + def configure + raise InvalidArgument.new unless block_given? + yield(Configuration) + end +end require 'todoist/http' require 'todoist/configuration' @@ -12,13 +22,3 @@ require 'todoist/project_items' require 'todoist/version' - -module Todoist - class InvalidURIError < StandardError; end - class InvalidJSONPathError < StandardError; end - class InvalidJSONError < StandardError; end - def configure - raise InvalidArgument.new unless block_given? - yield(Configuration) - end -end
Swap module definition and require lines.
diff --git a/deployment/puppet/osnailyfacter/modular/ssl/ssl_keys_saving_post.rb b/deployment/puppet/osnailyfacter/modular/ssl/ssl_keys_saving_post.rb index abc1234..def5678 100644 --- a/deployment/puppet/osnailyfacter/modular/ssl/ssl_keys_saving_post.rb +++ b/deployment/puppet/osnailyfacter/modular/ssl/ssl_keys_saving_post.rb @@ -2,13 +2,14 @@ class SslKeysSavingPostTest < Test::Unit::TestCase - def has_public_ssl? - TestCommon::Settings.lookup 'public_ssl' + def public_ssl + ssl_hash = TestCommon::Settings.lookup 'public_ssl' + ssl_hash['horizon'] or ssl_hash['services'] end def test_ssl_keys_availability - return unless has_public_ssl - assert File.file?('/var/lib/astute/haproxy/public_haproxy.pem'), 'No public keypair saved!' + assert File.file?('/var/lib/astute/haproxy/public_haproxy.pem'), 'No public keypair saved!' unless not public_ssl + assert !File.file?('/var/lib/astute/haproxy/public_haproxy.pem'), 'Keypair exist but should not!' unless public_ssl end end
Rewrite post test for ssl keys saving task Change-Id: I4fa25b87c4a5f31a92a266c3b31fba6698f13807 Closes-Bug: #1523465
diff --git a/db/data_migration/20170207113434_fix_html_attachments_nil_organisations.rb b/db/data_migration/20170207113434_fix_html_attachments_nil_organisations.rb index abc1234..def5678 100644 --- a/db/data_migration/20170207113434_fix_html_attachments_nil_organisations.rb +++ b/db/data_migration/20170207113434_fix_html_attachments_nil_organisations.rb @@ -0,0 +1,10 @@+#Fix the interested editions and add MOD to them +edition_ids = [421608, 421659, 421662, 421675, 421676, 421679, 423612, 464978] + +mod_organisation_id = 17 +mod = Organisation.find(mod_organisation_id) + +editions = Edition.find(edition_ids).each{|e| e.organisations << mod} +editions.map(&:document_id).each do |document_id| + PublishingApiDocumentRepublishingWorker.perform_async(document_id) +end
Fix nil organisations for HtmlPublicationPresenter Some HtmlPublication were provoking an error on government frontend due to nil organisations for the attachment attachable. We are fixing this adding an organisation to the attachable which has no one, selecting it from the previous editions.
diff --git a/db/data_migrations/20200203173115_add_entry_date_and_time_to_query_tool.rb b/db/data_migrations/20200203173115_add_entry_date_and_time_to_query_tool.rb index abc1234..def5678 100644 --- a/db/data_migrations/20200203173115_add_entry_date_and_time_to_query_tool.rb +++ b/db/data_migrations/20200203173115_add_entry_date_and_time_to_query_tool.rb @@ -0,0 +1,11 @@+class AddEntryDateAndTimeToQueryTool < ActiveRecord::DataMigration + def up + qf = QueryField.find_or_create_by( + name: 'updated_at', + label: 'Entry Date & Time', + query_category: QueryCategory.find_or_create_by(name: 'Life Cycle (History Log)'), + filter_type: 'date' + ) + qf.query_asset_classes << QueryAssetClass.find_by(table_name: 'most_recent_asset_events') + end +end
Move Entry Date & Time query tool field migration to core.
diff --git a/platforms/ios/framework/Tangram-es.podspec b/platforms/ios/framework/Tangram-es.podspec index abc1234..def5678 100644 --- a/platforms/ios/framework/Tangram-es.podspec +++ b/platforms/ios/framework/Tangram-es.podspec @@ -22,7 +22,7 @@ s.requires_arc = true - s.vendored_frameworks = 'TangramMap.framework' + s.vendored_frameworks = 'TangramMap.xcframework' s.module_name = 'TangramMap' end
Update framework file name in podspec
diff --git a/logr.gemspec b/logr.gemspec index abc1234..def5678 100644 --- a/logr.gemspec +++ b/logr.gemspec @@ -6,8 +6,8 @@ Gem::Specification.new do |spec| spec.name = "logr" spec.version = Logr::VERSION - spec.authors = ["Peter Marton"] - spec.email = ["martonpe@secretsaucepartners.com"] + spec.authors = ["Peter Marton", "Tamas Michelberger"] + spec.email = ["martonpe@secretsaucepartners.com", "tomi@secretsaucepartners.com"] spec.summary = "Structured logging with events and metrics" spec.description = "Structured logging with events and metrics" @@ -15,7 +15,8 @@ spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } - spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } + spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } + spec.bindir = "exe" spec.require_paths = ["lib"] spec.add_development_dependency "bundler", "~> 1.10"
Fix executables dir in gemspec and add new author
diff --git a/lib/rackspace-monitoring/monitoring/requests/update_entity.rb b/lib/rackspace-monitoring/monitoring/requests/update_entity.rb index abc1234..def5678 100644 --- a/lib/rackspace-monitoring/monitoring/requests/update_entity.rb +++ b/lib/rackspace-monitoring/monitoring/requests/update_entity.rb @@ -0,0 +1,22 @@+module Fog + module Monitoring + class Rackspace + class Real + + def update_entity(entity_id, options = {}) + data = {} + data['label'] = options['label'] + data['metadata'] = options['metadata'] + data['ip_addresses'] = options['ip_addresses'] + request( + :body => MultiJson.encode(data), + :expects => [201], + :method => 'PUT', + :path => "entities/#{entity_id}" + ) + end + end + end + end +end +
Add an update path for entities
diff --git a/test/test_serializer.rb b/test/test_serializer.rb index abc1234..def5678 100644 --- a/test/test_serializer.rb +++ b/test/test_serializer.rb @@ -19,7 +19,7 @@ begin assert_equal JSON, memcache.instance_variable_get('@ring').servers.first.serializer - memcached(19128) do |newdc| + memcached(21956) do |newdc| assert newdc.set("json_test", {"foo" => "bar"}) assert_equal({"foo" => "bar"}, newdc.get("json_test")) end
Change a port number in the specs to avoid a potential conflict
diff --git a/test/dummy/app/models/photo.rb b/test/dummy/app/models/photo.rb index abc1234..def5678 100644 --- a/test/dummy/app/models/photo.rb +++ b/test/dummy/app/models/photo.rb @@ -1,3 +1,4 @@ class Photo < ActiveRecord::Base has_dynamic_attached_file :image, styles: { thumb: '100x100#' } + do_not_validate_attachment_file_type :image end
Add do_not_validate_attachment_file_type to dummy Photo model to keep newer Paperclip from raising errors since we don't validate the attachment
diff --git a/models/device_oid_lookup.rb b/models/device_oid_lookup.rb index abc1234..def5678 100644 --- a/models/device_oid_lookup.rb +++ b/models/device_oid_lookup.rb @@ -1,14 +1,16 @@ class DeviceOidLookup include java.lang.Runnable - def initialize known_device, local_device + def initialize known_device, local_device, filters @device = known_device @local_device = local_device + @filters = filters end def run begin puts "starting to process #{@device.instance_number}" start = Time.now.to_i @device.discover_oids @local_device + @device.apply_oid_filters @filters puts "finished processing #{@device.instance_number} in #{Time.now.to_i - start} milliseconds" rescue Exception => e LoggerSingleton.logger.error "oid scan for device #{@device.instance_number} failed with error #{e.to_s}"
Move Oid filtering logic into KnownDevice.
diff --git a/gitnesse.gemspec b/gitnesse.gemspec index abc1234..def5678 100644 --- a/gitnesse.gemspec +++ b/gitnesse.gemspec @@ -18,5 +18,6 @@ gem.add_dependency("bundler","~> 1.2.1") gem.add_dependency("gollum","~> 2.3.4") gem.add_development_dependency("minitest-matchers") + gem.add_development_dependency("cucumber") gem.executables << 'gitnesse' end
Add cucumber as a development dependency.
diff --git a/db/migrate/20130403003950_add_last_activity_column_into_project.rb b/db/migrate/20130403003950_add_last_activity_column_into_project.rb index abc1234..def5678 100644 --- a/db/migrate/20130403003950_add_last_activity_column_into_project.rb +++ b/db/migrate/20130403003950_add_last_activity_column_into_project.rb @@ -3,14 +3,16 @@ add_column :projects, :last_activity_at, :datetime add_index :projects, :last_activity_at - Project.find_each do |project| - last_activity_date = if project.last_activity - project.last_activity.created_at - else - project.updated_at - end + select_all('SELECT id, updated_at FROM projects').each do |project| + project_id = project['id'] + update_date = project['updated_at'] + event = select_one("SELECT created_at FROM events WHERE project_id = #{project_id} ORDER BY created_at DESC LIMIT 1") - project.update_attribute(:last_activity_at, last_activity_date) + if event && event['created_at'] + update_date = event['created_at'] + end + + execute("UPDATE projects SET last_activity_at = '#{update_date}' WHERE id = #{project_id}") end end
Use raw SQL instead of Rails models in 20130403003950 migration Closes gitlab-org/gitlab-development-kit#109 Closes https://github.com/gitlabhq/gitlabhq/issues/10123
diff --git a/Casks/vivaldi.rb b/Casks/vivaldi.rb index abc1234..def5678 100644 --- a/Casks/vivaldi.rb +++ b/Casks/vivaldi.rb @@ -1,6 +1,6 @@ cask :v1 => 'vivaldi' do version '1.0.83.38' - sha256 '84153229b9d59561c9d6f570aa77875ed8b410ff43d2b4298167a0dc300b2a59' + sha256 '54682a12066ab6b446003d3c1735e7504136a043d0dc913e510f614370de15a9' url "http://vivaldi.com/download/Vivaldi_TP_#{version}.dmg" name 'Vivaldi'
Fix checksum in Vivaldi Cask
diff --git a/models/init.rb b/models/init.rb index abc1234..def5678 100644 --- a/models/init.rb +++ b/models/init.rb @@ -4,8 +4,4 @@ property :category, String property :packagename, String property :versions, String - property :keywords, String - property :descriptions, String - property :homepages, String - property :licenses, String end
Update db model to match build_db.rb
diff --git a/db/migrate/20150331194114_set_value_as_earnable_coins.rb b/db/migrate/20150331194114_set_value_as_earnable_coins.rb index abc1234..def5678 100644 --- a/db/migrate/20150331194114_set_value_as_earnable_coins.rb +++ b/db/migrate/20150331194114_set_value_as_earnable_coins.rb @@ -1,11 +1,5 @@ class SetValueAsEarnableCoins < ActiveRecord::Migration def change - Wip.find_each do |wip| - begin - wip.value = wip.respond_to?(:contracts) && wip.contracts.earnable_cents.to_i - wip.save! - rescue - end - end + Wip.update_all('value = earnable_coins_cache') end end
Set the value from the coins cache
diff --git a/db/migrate/20170302131100_rename_tracks_to_enclosures.rb b/db/migrate/20170302131100_rename_tracks_to_enclosures.rb index abc1234..def5678 100644 --- a/db/migrate/20170302131100_rename_tracks_to_enclosures.rb +++ b/db/migrate/20170302131100_rename_tracks_to_enclosures.rb @@ -0,0 +1,22 @@+class RenameTracksToEnclosures < ActiveRecord::Migration[5.0] + def change + rename_table :tracks , :enclosures + rename_table :track_likes , :enclosure_likes + rename_table :entry_tracks, :entry_enclosures + + add_column :enclosures , :type, :string, null: false, default: 'Track' + add_column :enclosure_likes , :enclosure_type, :string, null: false, default: 'Track' + add_column :entry_enclosures, :enclosure_type, :string, null: false, default: 'Track' + + add_index :enclosures , :type + add_index :enclosure_likes , :enclosure_type + add_index :entry_enclosures, :enclosure_type + + rename_column :enclosures, :like_count, :likes_count + remove_column :enclosures, :provider , :string + remove_column :enclosures, :identifier, :string + + rename_column :enclosure_likes , :track_id , :enclosure_id + rename_column :entry_enclosures, :track_id , :enclosure_id + end +end
Add migration that renames tracks -> enclosures, track_like -> enclosure_like, entry_track -> entry_enclosure
diff --git a/lib/dotopts/api.rb b/lib/dotopts/api.rb index abc1234..def5678 100644 --- a/lib/dotopts/api.rb +++ b/lib/dotopts/api.rb @@ -5,8 +5,13 @@ CONFIG_FILE = '.options' # Configure - def self.configure!(config_file) - if config_file = config_file || config_file() + # + # @param [String] configuraiton file + # + # @return nothing + def self.configure!(file=nil) + file = config_file unless file + if file text = File.read(config_file) parser = Parser.parse(text) ARGV.concat parser.arguments
Fix interface on configure method. [bug]
diff --git a/lib/email_trail.rb b/lib/email_trail.rb index abc1234..def5678 100644 --- a/lib/email_trail.rb +++ b/lib/email_trail.rb @@ -5,7 +5,7 @@ class Base def self.delivering_email(message) - EmailTrailMessage.create( + EmailTrail.create( to: message.to.to_s, cc: message.cc.to_s, bcc: message.bcc.to_s,
Use the correct table name
diff --git a/lib/erd/railtie.rb b/lib/erd/railtie.rb index abc1234..def5678 100644 --- a/lib/erd/railtie.rb +++ b/lib/erd/railtie.rb @@ -11,7 +11,7 @@ initializer 'erd' do ActiveSupport.on_load(:after_initialize) do if Rails.env.development? - Rails.application.routes.append do + Rails.application.routes.prepend do mount Erd::Engine, :at => '/erd' end end
Prepend the root route instead of appending it By prepending the /erd route instead of appending it we can simply give this route the highest priority. That way it won't get overridden by other, more generic route definitions. fix #25
diff --git a/lib/github/ldap.rb b/lib/github/ldap.rb index abc1234..def5678 100644 --- a/lib/github/ldap.rb +++ b/lib/github/ldap.rb @@ -13,17 +13,16 @@ @connection.authenticate(options[:admin_user], options[:admin_password]) - if encryption = check_encryption(options[:encryptation]) + if encryption = check_encryption(options[:encryption]) @connection.encryption(encryption) end end - # Check the legacy auth configuration options (before David's war with omniauth) - # to determine whether to use encryptation or not. + # Determine whether to use encryption or not. # - # encryptation: is the encryptation method, either 'ssl', 'tls', 'simple_tls' or 'start_tls'. + # encryption: is the encryption method, either 'ssl', 'tls', 'simple_tls' or 'start_tls'. # - # Returns the real encryptation type. + # Returns the real encryption type. def check_encryption(encryption) return unless encryption
Fix more typos about the encryption protocol.
diff --git a/sample/db/samples/payments.rb b/sample/db/samples/payments.rb index abc1234..def5678 100644 --- a/sample/db/samples/payments.rb +++ b/sample/db/samples/payments.rb @@ -12,7 +12,7 @@ # reference it as such. Make it explicit here that this table has been renamed. Spree::CreditCard.table_name = 'spree_credit_cards' -creditcard = Spree::CreditCard.create(:cc_type => 'visa', :month => 12, :year => 2014, :last_digits => '1111', +creditcard = Spree::CreditCard.create(:cc_type => 'visa', :month => 12, :year => 2.years.from_now.year, :last_digits => '1111', :name => 'Sean Schofield', :gateway_customer_profile_id => 'BGS-1234') Spree::Order.all.each_with_index do |order, index|
Fix payment sample card for 2015 Fixes #5845
diff --git a/pry-power_assert.gemspec b/pry-power_assert.gemspec index abc1234..def5678 100644 --- a/pry-power_assert.gemspec +++ b/pry-power_assert.gemspec @@ -8,9 +8,9 @@ spec.version = PryPowerAssert::VERSION spec.authors = ["yui-knk"] spec.email = ["spiketeika@gmail.com"] - spec.summary = %q{TODO: Write a short summary. Required.} - spec.description = %q{TODO: Write a longer description. Optional.} - spec.homepage = "" + spec.summary = "Provides power assert support for Pry" + spec.description = "Provides power assert support for Pry" + spec.homepage = "https://github.com/yui-knk/pry-power_assert" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0")
Add summary, description and homepage to gemspec
diff --git a/builder/test-integration/spec/hypriotos-image/kernel_modules_spec.rb b/builder/test-integration/spec/hypriotos-image/kernel_modules_spec.rb index abc1234..def5678 100644 --- a/builder/test-integration/spec/hypriotos-image/kernel_modules_spec.rb +++ b/builder/test-integration/spec/hypriotos-image/kernel_modules_spec.rb @@ -0,0 +1,10 @@+Specinfra::Runner.run_command('modprobe snd_bcm2835') +Specinfra::Runner.run_command('modprobe bcm2835_rng') + +describe kernel_module('snd_bcm2835') do + it { should be_loaded } +end + +describe kernel_module('bcm2835_rng') do + it { should be_loaded } +end
Add tests for kernel modules
diff --git a/base/db/migrate/20120109081509_update_notify_permissions.rb b/base/db/migrate/20120109081509_update_notify_permissions.rb index abc1234..def5678 100644 --- a/base/db/migrate/20120109081509_update_notify_permissions.rb +++ b/base/db/migrate/20120109081509_update_notify_permissions.rb @@ -6,15 +6,22 @@ r_ts = RelationPermission.record_timestamps RelationPermission.record_timestamps = false - # INSERT INTO permission_relation + # Make sure 'notify' exists perm_notify = Permission.where(:action => 'notify')[0] if perm_notify.nil? perm_notify = Permission.create(:action => 'notify') end - Relation.where(:sender_type => 'Group', :type => 'Relation::Custom').group('actor_id').each do |r| + + seen_actors=[] + Relation.where(:sender_type => 'Group', :type => 'Relation::Custom').each do |r| + next if seen_actors.include? r.actor + seen_actors << r.actor + # INSERT INTO permission_relations RelationPermission.create do |rp| rp.relation = r rp.permission = perm_notify + rp.created_at = r.created_at + rp.updated_at = r.updated_at end end
Fix postgres build after e2ba584 by fixing ilegal use of SQL's "GROUP BY"
diff --git a/lib/app/routes/metadata.rb b/lib/app/routes/metadata.rb index abc1234..def5678 100644 --- a/lib/app/routes/metadata.rb +++ b/lib/app/routes/metadata.rb @@ -6,7 +6,7 @@ exercise = JSON.parse(response)["assignments"].first language = exercise["track"] slug = exercise["slug"] - text = exercise["files"].find {|filename, code| filename =~ /test/i}.last + text = exercise["files"].find {|filename, code| filename =~ /test/i || filename =~ /\.t$/}.last erb :"exercises/test_suite", locals: {language: language, slug: slug, text: text} end
Add hack to recognize perl5 test suite
diff --git a/lib/postmon_cli.rb b/lib/postmon_cli.rb index abc1234..def5678 100644 --- a/lib/postmon_cli.rb +++ b/lib/postmon_cli.rb @@ -2,5 +2,4 @@ require "postmon_cli/wrapper" module PostmonCli - # Your code goes here... end
Remove espaços em branco e comentários
diff --git a/lib/psychic/cli.rb b/lib/psychic/cli.rb index abc1234..def5678 100644 --- a/lib/psychic/cli.rb +++ b/lib/psychic/cli.rb @@ -13,15 +13,20 @@ if given_args && (split_pos = given_args.index('--')) @extra_args = given_args.slice(split_pos + 1, given_args.length).map do | arg | # Restore quotes - next unless arg.match(/\=/) - lhs, rhs = arg.split('=') - lhs = "\"#{lhs}\"" if lhs.match(/\s/) - rhs = "\"#{rhs}\"" if rhs.match(/\s/) - [lhs, rhs].join('=') + arg.match(/\=/) ? restore_quotes(arg) : arg end given_args = given_args.slice(0, split_pos) end super given_args, config + end + + private + + def restore_quotes(arg) + lhs, rhs = arg.split('=') + lhs = "\"#{lhs}\"" if lhs.match(/\s/) + rhs = "\"#{rhs}\"" if rhs.match(/\s/) + [lhs, rhs].join('=') end end
Fix detecting extra args that don't have a left-hand/right-hand side
diff --git a/lib/redness/red.rb b/lib/redness/red.rb index abc1234..def5678 100644 --- a/lib/redness/red.rb +++ b/lib/redness/red.rb @@ -31,7 +31,13 @@ yield redis.exec rescue - redis.discard + begin + redis.discard + rescue Redis::CommandError + # It's possible the multi failed, but didn't raise an exception - + # perhaps due to write(2) not being reattempted in the redis client + # (likely a bug). + end fail_return end end
Handle occasional command error when discarding a transaction. There seems to be a bug in the Redis client, where a multi may return without successfully executing the call. Only appears to happen when redis is persisting.
diff --git a/lib/deep_cover/ast_root.rb b/lib/deep_cover/ast_root.rb index abc1234..def5678 100644 --- a/lib/deep_cover/ast_root.rb +++ b/lib/deep_cover/ast_root.rb @@ -1,20 +1,29 @@ require 'backports/2.1.0/enumerable/to_h' +require_relative 'has_tracker' module DeepCover class AstRoot + module FreezingIsPainful + def assign_properties + end + end + include FreezingIsPainful + include HasTracker + + has_tracker :root attr_reader :file_coverage, :nb def initialize(file_coverage) @file_coverage = file_coverage - @nb = file_coverage.create_node_nb + assign_properties end def child_flow_entry_count(_child) - file_coverage.cover.fetch(nb*2) + root_tracker_hits end def child_prefix(_child) - "(($_cov[#{file_coverage.nb}][#{nb*2}] += 1;" + "((#{root_tracker_source};" end def child_suffix(_child)
Use tracker code in Root
diff --git a/test/models/events/competitions/portland_short_track_series_test.rb b/test/models/events/competitions/portland_short_track_series_test.rb index abc1234..def5678 100644 --- a/test/models/events/competitions/portland_short_track_series_test.rb +++ b/test/models/events/competitions/portland_short_track_series_test.rb @@ -0,0 +1,11 @@+require "test_helper" + +module Competitions + # :stopdoc: + class PortlandShortTrackSeriesTest < ActiveSupport::TestCase + test "calculate" do + PortlandShortTrackSeries::Overall.calculate! + PortlandShortTrackSeries::MonthlyStandings.calculate! + end + end +end
Add basic test for short track
diff --git a/lib/stackdriver.rb b/lib/stackdriver.rb index abc1234..def5678 100644 --- a/lib/stackdriver.rb +++ b/lib/stackdriver.rb @@ -24,7 +24,10 @@ http.use_ssl = true http.start do |http| - http.post(uri.path, msg, headers) + response = http.post(uri.path, msg, headers) + if response.code != "201" + raise RuntimeError, "#{response.code} - #{response.body}" + end end end
Raise error unless we get a 201 - Created response
diff --git a/4-auth/structured_data/active_record/app/controllers/user_books_controller.rb b/4-auth/structured_data/active_record/app/controllers/user_books_controller.rb index abc1234..def5678 100644 --- a/4-auth/structured_data/active_record/app/controllers/user_books_controller.rb +++ b/4-auth/structured_data/active_record/app/controllers/user_books_controller.rb @@ -21,8 +21,10 @@ def index page = params[:more] ? params[:more].to_i : 0 + # [START books_by_creator] @books = Book.where(creator_id: current_user.id). limit(PER_PAGE).offset(PER_PAGE * page) + # [END books_by_creator] @more = page + 1 if @books.count == PER_PAGE
Add books_by_creator doc region for book querying in 4-auth
diff --git a/omnibus/config/software/more-ruby-cleanup-supermarket.rb b/omnibus/config/software/more-ruby-cleanup-supermarket.rb index abc1234..def5678 100644 --- a/omnibus/config/software/more-ruby-cleanup-supermarket.rb +++ b/omnibus/config/software/more-ruby-cleanup-supermarket.rb @@ -26,11 +26,13 @@ build do block "Delete bundler git cache, docs, and build info" do - vendor_dir = File.expand_path("#{install_dir}/embedded/service/supermarket/vendor/") + remove_directory "#{install_dir}/embedded/service/supermarket/vendor/cache" - remove_directory "#{vendor_dir}/bundle/ruby/*/build_info" - remove_directory "#{vendor_dir}/bundle/ruby/*/cache" - remove_directory "#{vendor_dir}/bundle/ruby/*/doc" - remove_directory "#{vendor_dir}/cache" + # this expands into the appropriate Ruby release number dir + vendor_ruby_dir = File.expand_path("#{install_dir}/embedded/service/supermarket/vendor/bundle/ruby/*/") + + remove_directory "#{vendor_ruby_dir}//build_info" + remove_directory "#{vendor_ruby_dir}/bundle/ruby/*/cache" + remove_directory "#{vendor_ruby_dir}/bundle/ruby/*/doc" end end
Fix the cleanup of cached gems Make sure we expand the path first so this works Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/test/models/crawler_test.rb b/test/models/crawler_test.rb index abc1234..def5678 100644 --- a/test/models/crawler_test.rb +++ b/test/models/crawler_test.rb @@ -0,0 +1,23 @@+require 'test_helper' + +class ProviderMock + include Celluloid + def load_events; end +end + +class CrawlerTest < ActiveSupport::TestCase + test '#initialize' do + mock = ProviderMock.new + crawler = Crawler.new([mock]) + assert_instance_of Array, crawler.instance_variable_get(:@providers) + assert_equal crawler.instance_variable_get(:@providers).first, mock + end + + test '#crawl' do + mock = ProviderMock.new + crawler = Crawler.new([mock]) + res = crawler.crawl + assert_instance_of Array, res + assert_instance_of Celluloid::Future, res.first + end +end
Create test for `Crawler` class
diff --git a/lib/sidekiq/limit_fetch.rb b/lib/sidekiq/limit_fetch.rb index abc1234..def5678 100644 --- a/lib/sidekiq/limit_fetch.rb +++ b/lib/sidekiq/limit_fetch.rb @@ -26,8 +26,14 @@ UnitOfWork.new(queue, job) if job end + # Backwards compatibility for sidekiq v6.1.0 + # @see https://github.com/mperham/sidekiq/pull/4602 def bulk_requeue(*args) - Sidekiq::BasicFetch.bulk_requeue(*args) + if Sidekiq::BasicFetch.respond_to?(:bulk_requeue) # < 6.1.0 + Sidekiq::BasicFetch.bulk_requeue(*args) + else # 6.1.0+ + Sidekiq::BasicFetch.new(Sidekiq.options).bulk_requeue(*args) + end end def redis_retryable
Fix compatibility issue for sidekiq v6.1.0+ Since v6.1.0 Sidekiq::BasicFetcher doesn't support class-level method bulk_requeue. See https://github.com/mperham/sidekiq/pull/4602 for details. For backwards compatibility we should support both interfaces depending on class method presence.
diff --git a/lib/smart_titles/helper.rb b/lib/smart_titles/helper.rb index abc1234..def5678 100644 --- a/lib/smart_titles/helper.rb +++ b/lib/smart_titles/helper.rb @@ -1,6 +1,6 @@ module SmartTitles module Helper - MISSING_TRANSLATION = 0 + MISSING_TRANSLATION = Object.new # <title><%= head_title %></title> # Will return title if it was set for the current page. @@ -27,7 +27,7 @@ content_for(:page_title) else translation = t('.title', default: MISSING_TRANSLATION) - translation unless translation == MISSING_TRANSLATION + translation unless translation.equal? MISSING_TRANSLATION end end
Use blank object as a missing translation so that it is unique.
diff --git a/lib/godmin/authorization.rb b/lib/godmin/authorization.rb index abc1234..def5678 100644 --- a/lib/godmin/authorization.rb +++ b/lib/godmin/authorization.rb @@ -9,7 +9,7 @@ helper_method :policy rescue_from NotAuthorizedError do - render text: "Forbidden", status: 403, layout: false + render text: "You are not authorized to do this", status: 403, layout: "godmin/login" end end
Use layout and better message for not authorized page
diff --git a/lib/looks/gravatar/image.rb b/lib/looks/gravatar/image.rb index abc1234..def5678 100644 --- a/lib/looks/gravatar/image.rb +++ b/lib/looks/gravatar/image.rb @@ -24,7 +24,7 @@ new(id, url, rating) end - attr_accessor :id, :url, :rating + attr_reader :id, :url, :rating def initialize(id, url, rating) @id = id
Use 'attr_reader' in Gravatar API
diff --git a/dynosaur.gemspec b/dynosaur.gemspec index abc1234..def5678 100644 --- a/dynosaur.gemspec +++ b/dynosaur.gemspec @@ -17,7 +17,7 @@ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ['lib'] - spec.add_runtime_dependency 'platform-api', '~> 2.0.0' + spec.add_runtime_dependency 'platform-api', '>= 2.0', '< 2.3' spec.add_runtime_dependency 'sys-proctable', '>= 0.9', '< 2.0' spec.add_development_dependency 'bundler', '~> 1.8'
Update platform-api requirement from ~> 2.0.0 to >= 2.0, < 2.3 Updates the requirements on [platform-api](https://github.com/heroku/platform-api) to permit the latest version. - [Release notes](https://github.com/heroku/platform-api/releases) - [Commits](https://github.com/heroku/platform-api/compare/v2.0.0...v2.2.0) Signed-off-by: dependabot-preview[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>
diff --git a/lib/protobuf/nats/runner.rb b/lib/protobuf/nats/runner.rb index abc1234..def5678 100644 --- a/lib/protobuf/nats/runner.rb +++ b/lib/protobuf/nats/runner.rb @@ -6,6 +6,7 @@ module Protobuf module Nats class Runner + include ::Protobuf::Logging def initialize(options) @options = case
Fix thread dump on TRAP signal
diff --git a/lib/simple_sqs/processor.rb b/lib/simple_sqs/processor.rb index abc1234..def5678 100644 --- a/lib/simple_sqs/processor.rb +++ b/lib/simple_sqs/processor.rb @@ -22,7 +22,7 @@ private def process event - logger.info "Processing SQS event #{event.inspect}" + logger.debug "Processing SQS event #{event.inspect}" Librato.timing("sqs.process", source: event['EventType']) do klass = SIMPLE_SQS_EVENTS_NAMESPACE.const_get(event['EventType']) sqs_event = klass.new(event.freeze)
Move event logging to debug
diff --git a/spec/acceptance/image_spec.rb b/spec/acceptance/image_spec.rb index abc1234..def5678 100644 --- a/spec/acceptance/image_spec.rb +++ b/spec/acceptance/image_spec.rb @@ -0,0 +1,33 @@+require 'spec_helper' + +describe 'image show page controls', :type => :feature do + before(:each) do + @you = create(:user) + login_as(@you, :scope => :user) + upload_test_file + logout(:user) + end + + it "does not show edit link if you don't own this image" do + @me = create(:user) + login_as(@me, :scope => :user) + + visit image_path(Image.first) + + page.should have_no_content('Edit') + end + + it 'shows edit link if you own this image' do + login_as(@you, :scope => :user) + + visit image_path(Image.first) + + click_link('Edit') + page.should have_content('Edit') + end + + after(:each) do + logout(:user) + Warden.test_reset! + end +end
Write up acceptance spec for image/show
diff --git a/spec/protocol/message_spec.rb b/spec/protocol/message_spec.rb index abc1234..def5678 100644 --- a/spec/protocol/message_spec.rb +++ b/spec/protocol/message_spec.rb @@ -0,0 +1,16 @@+describe Kafka::Protocol::Message do + it "encodes and decodes messages" do + message = Kafka::Protocol::Message.new( + value: "yolo", + key: "xx", + ) + + io = StringIO.new + encoder = Kafka::Protocol::Encoder.new(io) + message.encode(encoder) + data = StringIO.new(io.string) + decoder = Kafka::Protocol::Decoder.new(data) + + expect(Kafka::Protocol::Message.decode(decoder)).to eq message + end +end
Add a spec for encoding and decoding a message
diff --git a/spec/views/tags_views_spec.rb b/spec/views/tags_views_spec.rb index abc1234..def5678 100644 --- a/spec/views/tags_views_spec.rb +++ b/spec/views/tags_views_spec.rb @@ -32,11 +32,15 @@ it "has tag's ideas" do @tag = @tag1 + + user = create(:user) + user.confirm! + assign(:ideas, [ - create(:idea, :title => 'new title'), - create(:idea), - create(:idea), - create(:idea) + create(:idea, :title => 'new title', :owner => user), + create(:idea, :owner => user), + create(:idea, :owner => user), + create(:idea, :owner => user) ]) render :template => "tags/show.html.haml"
Create an idea owner for Tag view specs Create a user record to act as the owner of ideas belonging to the tag records.
diff --git a/spec/isolation/components/mailer_configuration/with_hanami_mailer_spec.rb b/spec/isolation/components/mailer_configuration/with_hanami_mailer_spec.rb index abc1234..def5678 100644 --- a/spec/isolation/components/mailer_configuration/with_hanami_mailer_spec.rb +++ b/spec/isolation/components/mailer_configuration/with_hanami_mailer_spec.rb @@ -12,11 +12,17 @@ it "resolves mailer configuration for current environment" do with_project do unshift "config/environment.rb", "ENV['HANAMI_ENV'] = 'production'" - require Pathname.new(Dir.pwd).join("config", "environment") - Hanami::Components.resolve('mailer.configuration') + write "script/components", <<-EOF +require "\#{__dir__}/../config/environment" +Hanami::Components.resolve('mailer.configuration') - configuration = Hanami::Components['mailer.configuration'] - expect(configuration.delivery_method.first).to eq(:smtp) +configuration = Hanami::Components['mailer.configuration'] +puts "mailer.configuration.delivery_method: \#{configuration.delivery_method.first.inspect}" +EOF + + bundle_exec "ruby script/components" + + expect(out).to include("mailer.configuration.delivery_method: :smtp") end end end
Isolate global state (env vars) for a mailer configuration test, by running it in a separated process
diff --git a/spec/features/deleting_a_challenge_spec.rb b/spec/features/deleting_a_challenge_spec.rb index abc1234..def5678 100644 --- a/spec/features/deleting_a_challenge_spec.rb +++ b/spec/features/deleting_a_challenge_spec.rb @@ -0,0 +1,60 @@+require "spec_helper" + +feature "Deleting a challenege" do + include OmniAuthHelper + + before(:each) do + mock_omni_auth + end + + scenario "as the owner of the challenge" do + user = User.create!( + nickname: ADMINS.first, + name: "foo", + uid: "123545", + image: "bar", + provider: "twitter" + ) + challenge = Challenge.create!( + title: "challenge1", + description: "a sample challenge", + input: "aa", + output: "bb", + diff: "aabb", + user_id: user.id + ) + + visit root_path + + click_link "Sign in with Twitter" + click_link "challenge1" + click_button "Delete Challenge" + + expect(Challenge.count).to eq(0) + end + + scenario "not as the owner of the challenge" do + user = User.create!( + nickname: "foo", + name: "bar", + uid: 545321, + image: "baz", + provider: "twitter" + ) + challenge = Challenge.create!( + title: "challenge1", + description: "a sample challenge", + input: "aa", + output: "bb", + diff: "aabb", + user_id: user.id + ) + + visit root_path + + click_link "challenge1" + + expect(page).not_to have_text("Delete Challenge") + expect(Challenge.count).to eq(1) + end +end
Add feature spec to cover deleting a challenge
diff --git a/spec/models/webhook/event_register_spec.rb b/spec/models/webhook/event_register_spec.rb index abc1234..def5678 100644 --- a/spec/models/webhook/event_register_spec.rb +++ b/spec/models/webhook/event_register_spec.rb @@ -25,19 +25,19 @@ end it 'serializes the record' do - expect_any_instance_of(Webhook::EventRegister).to receive(:serialized_record) + expect_any_instance_of(Webhook::EventRegister).to receive(:serialized_record).and_call_original described_class.new(record) end it 'calls the type method' do - expect_any_instance_of(Webhook::EventRegister).to receive(:type) + expect_any_instance_of(Webhook::EventRegister).to receive(:type).and_call_original described_class.new(record) end end describe '#serialized_record' do it 'uses EventRecordSerializer' do - expect(Webhook::EventRecordSerializer).to receive(:new).with(record, root: false) + expect(Webhook::EventRecordSerializer).to receive(:new).with(record, root: false).and_call_original described_class.new(record) end end
Call original on event_register spec
diff --git a/spec/requests/authentication_pages_spec.rb b/spec/requests/authentication_pages_spec.rb index abc1234..def5678 100644 --- a/spec/requests/authentication_pages_spec.rb +++ b/spec/requests/authentication_pages_spec.rb @@ -9,7 +9,33 @@ it { should have_content('Sign in')} it { should have_title('Sign in')} - + + end + + describe "signin" do + before { visit signin_path } + + describe "with invalid information" do + before { click_button "Sign in" } + + it { should have_title('Sign in')} + it { should have_selector('div.alert.alert-error')} + end + + describe "with valid information" do + let(:user) { FactoryGirl.create(:user) } + before do + fill_in "Email", with: user.email.upcase + fill_in "Password", with: user.password + click_button "Sign in" + end + + it { should have_title(user.name)} + it { should have_link('Profile', href: user_path(user))} + it { should have_link('Sign out', href: signout_path)} + it { should_not have_link('Sign in', href: signin_path)} + end + end
Create tests for valid and invalid authentication
diff --git a/spec/v3/services/preference/update_spec.rb b/spec/v3/services/preference/update_spec.rb index abc1234..def5678 100644 --- a/spec/v3/services/preference/update_spec.rb +++ b/spec/v3/services/preference/update_spec.rb @@ -1,6 +1,7 @@ describe Travis::API::V3::Services::Preference::Update, set_app: true do - let(:user) { Travis::API::V3::Models::User.create!(name: 'svenfuchs') } + let(:user) { Travis::API::V3::Models::User.create!(name: 'svenfuchs', github_oauth_token: github_oauth_token) } let(:token) { Travis::Api::App::AccessToken.create(user: user, app_id: 1) } + let(:github_oauth_token) { Travis::Settings::EncryptedValue.new('bar') } let(:headers) { { 'HTTP_AUTHORIZATION' => "token #{token}", 'CONTENT_TYPE' => 'application/json' } } let(:params) { JSON.dump('preference.value' => false) } @@ -25,5 +26,6 @@ "value" => false ) end + example { expect(user.github_oauth_token).to eq github_oauth_token } end end
Add assertion to confirm token presence
diff --git a/examples/hist.rb b/examples/hist.rb index abc1234..def5678 100644 --- a/examples/hist.rb +++ b/examples/hist.rb @@ -20,7 +20,7 @@ fig, ax = *plt.subplots -n, bins, patches = *ax.hist(x, num_bins, normed: 1) +n, bins, patches = *ax.hist(x, num_bins, density: 1) y = mlab.normpdf(bins, mu, sigma) ax.plot(bins, y, '--')
Use density instead of normed
diff --git a/week-6/gps2.rb b/week-6/gps2.rb index abc1234..def5678 100644 --- a/week-6/gps2.rb +++ b/week-6/gps2.rb @@ -0,0 +1,43 @@+# Your Names +# 1) +# 2) + +# We spent [#] hours on this challenge. + +# Bakery Serving Size portion calculator. + +def serving_size_calc(item_to_make, num_of_ingredients) + library = {"cookie" => 1, "cake" => 5, "pie" => 7} + error_counter = 3 + + library.each do |food| + if library[food] != library[item_to_make] + error_counter += -1 + end + end + + if error_counter > 0 + raise ArgumentError.new("#{item_to_make} is not a valid input") + end + + serving_size = library.values_at(item_to_make)[0] + remaining_ingredients = num_of_ingredients % serving_size + + case remaining_ingredients + when 0 + return "Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}" + else + return "Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}, you have #{remaining_ingredients} leftover ingredients. Suggested baking items: TODO: MAKE THIS FEATURE" + end +end + +p serving_size_calc("pie", 7) +p serving_size_calc("pie", 8) +p serving_size_calc("cake", 5) +p serving_size_calc("cake", 7) +p serving_size_calc("cookie", 1) +p serving_size_calc("cookie", 10) +p serving_size_calc("THIS IS AN ERROR", 5) + +# Reflection +
Add gps 2.3 - second go around
diff --git a/spec/features/report_html_spec.rb b/spec/features/report_html_spec.rb index abc1234..def5678 100644 --- a/spec/features/report_html_spec.rb +++ b/spec/features/report_html_spec.rb @@ -0,0 +1,64 @@+require 'spec_helper' +require './features/step_definitions/testing_dsl' + +describe "HTML report" do + # As a non-technical application product owner + # I want license finder to generate an easy-to-understand HTML report + # So that I can quickly review my application dependencies and licenses + + let(:user) { LicenseFinder::TestingDSL::User.new } + + specify "shows basic dependency data" do + gem_name = "a_gem" + gem_group = "test" + gem_attributes = { + license: "MIT", + summary: "gem is cool", + description: "seriously", + version: "0.0.1", + homepage: "http://a_gem.github.com" + } + + user.create_ruby_app + user.create_gem(gem_name, gem_attributes) + user.depend_on_local_gem(gem_name, groups: [gem_group]) + + user.in_dep_html(gem_name) do |section| + expect(section.find("a[href='#{gem_attributes[:homepage]}']", text: gem_name)).to be + expect(section).to have_content gem_attributes[:license] + expect(section).to have_content gem_attributes[:summary] + expect(section).to have_content gem_attributes[:description] + expect(section).to have_content gem_attributes[:version] + expect(section).to have_content gem_group + end + end + + specify "shows project name" do + user.create_empty_project + expect(user.html_title).to have_content 'my_app' + end + + specify "shows approval status of dependencies" do + user.create_empty_project + user.execute_command 'license_finder dependencies add gpl_dep GPL' + user.execute_command 'license_finder dependencies add mit_dep MIT' + user.execute_command 'license_finder whitelist add MIT' + + # TODO: Could we run `license_finder report` only once in this test? + + user.in_dep_html('gpl_dep') do |dep| + expect(dep[:class].split(' ')).to include "unapproved" + end + + user.in_dep_html('mit_dep') do |dep| + expect(dep[:class].split(' ')).to include "approved" + end + + user.in_html do |page| + expect(page).to have_content '1 GPL' + action_items = page.find('.action-items') + expect(action_items).to have_content '(GPL)' + expect(action_items).not_to have_content 'MIT' + end + end +end
Convert html report integration test to RSpec
diff --git a/lib/db_text_search/case_insensitive_string_finder/collate_nocase_adapter.rb b/lib/db_text_search/case_insensitive_string_finder/collate_nocase_adapter.rb index abc1234..def5678 100644 --- a/lib/db_text_search/case_insensitive_string_finder/collate_nocase_adapter.rb +++ b/lib/db_text_search/case_insensitive_string_finder/collate_nocase_adapter.rb @@ -19,7 +19,8 @@ # (see Adapter.add_index) def self.add_index(connection, table_name, column_name, options = {}) - # TODO: This requires the user to use an SQL schema dump format. Find another solution. + # TODO: Switch to the native Rails solution once it's landed, as the current one requires SQL dump format. + # https://github.com/rails/rails/pull/18499 connection.execute <<-SQL.strip CREATE INDEX #{options[:name] || "#{column_name}_nocase"} ON #{connection.quote_table_name(table_name)} (#{connection.quote_column_name(column_name)} COLLATE NOCASE);
Change TODO to point to the COLLATE NOCASE issue
diff --git a/search-engine/lib/ban_list/custom_standard.rb b/search-engine/lib/ban_list/custom_standard.rb index abc1234..def5678 100644 --- a/search-engine/lib/ban_list/custom_standard.rb +++ b/search-engine/lib/ban_list/custom_standard.rb @@ -27,7 +27,7 @@ change( "2018-10-05", - "https://discordapp.com/channels/205457071380889601/256560810237624320/500590574487732245", + "https://discordapp.com/channels/205457071380889601/256560810237624320/500592255153733632", "Dirty Work" => "banned", ) end
Fix Dirty Work B&R link
diff --git a/moby.gemspec b/moby.gemspec index abc1234..def5678 100644 --- a/moby.gemspec +++ b/moby.gemspec @@ -18,7 +18,5 @@ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.require_paths = ["lib"] - # specify any dependencies here; for example: - # s.add_development_dependency "rspec" - # s.add_runtime_dependency "rest-client" + s.add_development_dependency "rspec" end
Add rspec as a development dependency
diff --git a/spec/autotest/rails_rspec2_spec.rb b/spec/autotest/rails_rspec2_spec.rb index abc1234..def5678 100644 --- a/spec/autotest/rails_rspec2_spec.rb +++ b/spec/autotest/rails_rspec2_spec.rb @@ -26,16 +26,11 @@ end describe 'mappings' do - before do - rails_rspec2_autotest.find_order = %w( - spec/models/user_spec.rb - spec/support/blueprints.rb - ) - end - it 'runs model specs when support files change' do + rails_rspec2_autotest.find_order = %w(spec/models/user_spec.rb spec/support/blueprints.rb) rails_rspec2_autotest.test_files_for('spec/support/blueprints.rb').should( include('spec/models/user_spec.rb')) end end + end
Remove unncessary before hook from example. - Closes #348
diff --git a/spec/lib/checklists/action_spec.rb b/spec/lib/checklists/action_spec.rb index abc1234..def5678 100644 --- a/spec/lib/checklists/action_spec.rb +++ b/spec/lib/checklists/action_spec.rb @@ -33,12 +33,13 @@ describe ".load_all" do subject { described_class.load_all } - it "returns a list of actions with required keys" do + it "returns a list of actions with required fields" do subject.each do |action| expect(action.title).to be_present expect(action.description).to be_present expect(action.path).to be_present expect(action.applicable_criteria).to be_a Array + expect(%w[business citizen]).to include(action.section) end end
Add validation for action section field
diff --git a/spec/lib/pavlov_rss/reader_spec.rb b/spec/lib/pavlov_rss/reader_spec.rb index abc1234..def5678 100644 --- a/spec/lib/pavlov_rss/reader_spec.rb +++ b/spec/lib/pavlov_rss/reader_spec.rb @@ -3,6 +3,10 @@ require 'fake_web' describe PavlovRss::Reader do + after do + FakeWeb.clean_registry + end + describe "#fetch" do before :each do FakeWeb.register_uri(:get, "http://example.com/test1", :body => sample_feed)
Add FakeWeb.clean_registry for right use of FakeWeb
diff --git a/spec/lita/handlers/diceman_spec.rb b/spec/lita/handlers/diceman_spec.rb index abc1234..def5678 100644 --- a/spec/lita/handlers/diceman_spec.rb +++ b/spec/lita/handlers/diceman_spec.rb @@ -1,4 +1,5 @@ require "spec_helper" describe Lita::Handlers::Diceman, lita_handler: true do + it { routes_command("!dice answer one;answer two").to(:dice!) } end
Add basic test for !dice
diff --git a/spec/models/talk_spec.rb b/spec/models/talk_spec.rb index abc1234..def5678 100644 --- a/spec/models/talk_spec.rb +++ b/spec/models/talk_spec.rb @@ -6,7 +6,6 @@ describe "attributes validation" do it { is_expected.to validate_presence_of :title } - it { is_expected.to validate_presence_of :event } it { is_expected.to validate_presence_of :member } end end
Remove the test for my last commit
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index abc1234..def5678 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,6 +1,7 @@ require 'rails_helper' RSpec.describe User do + subject { create(:user) } it '#push works' do FakeWeb.register_uri( :post, @@ -9,7 +10,7 @@ body: { id: :id }.to_json ) - result = create(described_class).push( + result = subject.push( type: :note, title: 'title', body: 'body' @@ -18,6 +19,6 @@ end it '#sw_cert_setting works' do - expect(create(described_class).sw_cert_setting.size).to eq(5) + expect(subject.sw_cert_setting.size).to eq(5) end end
Remove deprecation messages on factory_girl
diff --git a/lib/tent-validator/response_expectation/header_validator.rb b/lib/tent-validator/response_expectation/header_validator.rb index abc1234..def5678 100644 --- a/lib/tent-validator/response_expectation/header_validator.rb +++ b/lib/tent-validator/response_expectation/header_validator.rb @@ -2,6 +2,14 @@ class ResponseExpectation class HeaderValidator < BaseValidator + def self.named_expectations + @named_expectations ||= {} + end + + def self.register(name, expected) + named_expectations[name] = expected + end + def validate(response) response_headers = response.env.response_headers _failed_assertions = failed_assertions(response_headers) @@ -14,7 +22,15 @@ private + NoSuchExpectationError = Class.new(StandardError) def initialize_assertions(expected) + unless Hash === expected + name = expected + unless expected = self.class.named_expectations[name] + raise NoSuchExpectationError.new("Expected #{name.inspect} to be registered with #{self.class.name}!") + end + end + @assertions = expected.inject([]) do |memo, (header, value)| memo << Assertion.new("/#{header}", value) end
Add support for named header expectations
diff --git a/spec/dummy/config/environments/development.rb b/spec/dummy/config/environments/development.rb index abc1234..def5678 100644 --- a/spec/dummy/config/environments/development.rb +++ b/spec/dummy/config/environments/development.rb @@ -22,19 +22,21 @@ # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load - # Debug mode disables concatenation and preprocessing of assets. - # This option may cause significant delays in view rendering with a large - # number of complex assets. - config.assets.debug = true + if config.respond_to?(:assets) + # Debug mode disables concatenation and preprocessing of assets. + # This option may cause significant delays in view rendering with a large + # number of complex assets. + config.assets.debug = true - # Asset digests allow you to set far-future HTTP expiration dates on all assets, - # yet still be able to expire them through the digest params. - config.assets.digest = true + # Asset digests allow you to set far-future HTTP expiration dates on all assets, + # yet still be able to expire them through the digest params. + config.assets.digest = true - # Adds additional error checking when serving assets at runtime. - # Checks for improperly declared sprockets dependencies. - # Raises helpful error messages. - config.assets.raise_runtime_errors = true + # Adds additional error checking when serving assets at runtime. + # Checks for improperly declared sprockets dependencies. + # Raises helpful error messages. + config.assets.raise_runtime_errors = true + end # Raises error for missing translations # config.action_view.raise_on_missing_translations = true
Fix error when running ./bin/setup with Rails 5.0.0.1 When trying to set up development environment via `./bin/setup` using a new RVM gemset with Ruby 2.3.0 and Rails 5.0.0.1, the following error occures: ``` Resolving dependencies... The Gemfile's dependencies are satisfied Database 'dummy_development' already exists Database 'logidze_test' already exists rake aborted! NoMethodError: undefined method `assets' for #<Rails::Application::Configuration:0x00000001de17e0> Did you mean? asset_host [ ... STACKTRACE ... ] ``` This patch fixes the error by checking if `Rails::Application::Configuration` responds to `#assets` first. An alternative solution is to uncomment the line `# require 'sprockets/railtie` in `spec/dummy/config/application.rb`
diff --git a/pingboard.gemspec b/pingboard.gemspec index abc1234..def5678 100644 --- a/pingboard.gemspec +++ b/pingboard.gemspec @@ -10,6 +10,9 @@ s.authors = ["Bryan B. Cabalo"] s.email = 'bcabalo@gmail.com' s.require_paths = %w(lib) + + s.required_ruby_version = ">= 2.0.0" + s.files = %w(lib/pingboard.rb README.md pingboard.gemspec) + Dir['lib/**/*.rb'] s.homepage = 'http://rubygems.org/gems/pingboard' s.license = 'MIT'
Add gem Ruby version requirement
diff --git a/spec/ruby-progressbar/format/molecule_spec.rb b/spec/ruby-progressbar/format/molecule_spec.rb index abc1234..def5678 100644 --- a/spec/ruby-progressbar/format/molecule_spec.rb +++ b/spec/ruby-progressbar/format/molecule_spec.rb @@ -1,22 +1,30 @@ require 'rspectacular' +require 'ruby-progressbar/format/molecule' -describe ProgressBar::Format::Molecule do - describe '#new' do - before { @molecule = ProgressBar::Format::Molecule.new('t') } +class ProgressBar +module Format +describe Molecule do + it 'sets the key when initialized' do + molecule = Molecule.new('t') - it 'sets the key when initialized' do - expect(@molecule.key).to eql 't' - end - - it 'sets the method name when initialized' do - expect(@molecule.method_name).to eql [:title_comp, :title] - end + expect(molecule.key).to eql 't' end - describe '#bar_molecule?' do - it "is true if the molecule's key is a representation of the progress bar graphic" do - molecule = ProgressBar::Format::Molecule.new('B') - expect(molecule).to be_bar_molecule - end + it 'sets the method name when initialized' do + molecule = Molecule.new('t') + + expect(molecule.method_name).to eql [:title_comp, :title] + end + + it 'can retrieve the full key for itself' do + molecule = Molecule.new('t') + + expect(molecule.full_key).to eql '%t' + end + + it 'can determine if it is a bar molecule' do + expect(Molecule.new('B')).to be_bar_molecule end end +end +end
Refactor: Update tests for 'Molecule' to the new format -------------------------------------------------------------------------------- Branch: refactor/massive-update Signed-off-by: Jeff Felchner <8a84c204e2d4c387d61d20f7892a2bbbf0bc8ae8@thekompanee.com>
diff --git a/spec/unit/brightbox/bb_config/account_spec.rb b/spec/unit/brightbox/bb_config/account_spec.rb index abc1234..def5678 100644 --- a/spec/unit/brightbox/bb_config/account_spec.rb +++ b/spec/unit/brightbox/bb_config/account_spec.rb @@ -16,12 +16,18 @@ context "when config has no default account", :vcr do before do - @config = Brightbox::BBConfig.new :directory => API_CLIENT_CONFIG_DIR + contents = File.read(API_CLIENT_CONFIG.config_filename) + @tmp_config = TmpConfig.new(contents) + @config = Brightbox::BBConfig.new :directory => @tmp_config.path end it "returns the configured default" do # Embedded in VCR recording expect(@config.account).to eql("acc-12345") + end + + after do + @tmp_config.close end end
Isolate another spec's config file Sharing configs across tests suffers from another shared state problem where the config incorporates access/refresh token caching so an access token is cached with sanitised values "<TOKEN>" and used to replay and failing. Seems the only safe way to test this code is to drop every spec inside a temporary dir for caching.
diff --git a/spree_postal_service.gemspec b/spree_postal_service.gemspec index abc1234..def5678 100644 --- a/spree_postal_service.gemspec +++ b/spree_postal_service.gemspec @@ -6,9 +6,9 @@ #s.description = 'Add (optional) gem description here' s.required_ruby_version = '>= 1.8.7' - # s.author = 'David Heinemeier Hansson' - # s.email = 'david@loudthinking.com' - # s.homepage = 'http://www.rubyonrails.org' + s.author = 'Torsten Rüger' + s.email = 'torsten@lightning.nu' + s.homepage = 'https://github.com/dancinglightning/spree-postal-service' # s.rubyforge_project = 'actionmailer' s.files = Dir['CHANGELOG', 'README.md', 'LICENSE', 'lib/**/*', 'app/**/*']
Fix for warning on install - The validation message from Rubygems was: authors may not be empty
diff --git a/app/models/manageiq/providers/hawkular/middleware_manager/middleware_server.rb b/app/models/manageiq/providers/hawkular/middleware_manager/middleware_server.rb index abc1234..def5678 100644 --- a/app/models/manageiq/providers/hawkular/middleware_manager/middleware_server.rb +++ b/app/models/manageiq/providers/hawkular/middleware_manager/middleware_server.rb @@ -18,6 +18,14 @@ ) end + def live_metrics_name + 'middleware_server' + end + + def chart_report_name + 'middleware_server' + end + def self.supported_models @supported_models ||= ['middleware_server'] end
Allow mw server reports work with mw_server_eap and mw_server_wildfly
diff --git a/methodbox/db/migrate/20100628110331_remove_links_through_has_many.rb b/methodbox/db/migrate/20100628110331_remove_links_through_has_many.rb index abc1234..def5678 100644 --- a/methodbox/db/migrate/20100628110331_remove_links_through_has_many.rb +++ b/methodbox/db/migrate/20100628110331_remove_links_through_has_many.rb @@ -0,0 +1,13 @@+class RemoveLinksThroughHasMany < ActiveRecord::Migration + def self.up + drop_table "script_lists" + drop_table "survey_lists" + drop_table "survey_to_script_lists" + drop_table "script_to_script_links" + drop_table "extract_to_extract_links" + drop_table "extract_to_extract_lists" + end + + def self.down + end +end
Remove all previous ways of linking things. part of OBE-105
diff --git a/example/campain_app_config.ru b/example/campain_app_config.ru index abc1234..def5678 100644 --- a/example/campain_app_config.ru +++ b/example/campain_app_config.ru @@ -3,9 +3,15 @@ use Aws::Xray::Rack, name: 'campain-app' +class DbConnectionError < StandardError + def initialize + super('Could not connect to DB') + end +end + run Proc.new {|env| - if rand(0..5) == 0 - ['500', {'Content-Type' => 'text/plain'}, ['-1']] + if rand(0..1) == 0 + raise DbConnectionError else ['200', {'Content-Type' => 'text/plain'}, ['0']] end
Increase error rate in example app
diff --git a/lib/formalist/rich_text/rendering/embedded_form_renderer.rb b/lib/formalist/rich_text/rendering/embedded_form_renderer.rb index abc1234..def5678 100644 --- a/lib/formalist/rich_text/rendering/embedded_form_renderer.rb +++ b/lib/formalist/rich_text/rendering/embedded_form_renderer.rb @@ -3,18 +3,18 @@ module Rendering class EmbeddedFormRenderer attr_reader :container - attr_reader :render_options + attr_reader :options - def initialize(container: {}, render_options: {}) + def initialize(container = {}, **options) @container = container - @render_options = render_options + @options = options end def call(form_data) type, data = form_data.values_at(:name, :data) if container.key?(type) - container[type].(data, render_options) + container[type].(data, options) else "" end
Tweak EmbeddedFormRenderer API a little Make the container a single, positional parameter, followed by a splat of options.
diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index abc1234..def5678 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -3,7 +3,7 @@ # Returns the Gravatar for the given user. def gravatar_for(user) gravatar_id = Digest::MD5.hexdigest(user.email.downcase) - gravatar_url = "https://secure.gravatar.com/avatar/#{gravatar_id}" + gravatar_url = "https://secure.gravatar.com/avatar/#{gravatar_id}?d=mm" image_tag(gravatar_url, alt: user.name, class: 'gravatar') end end
Use "mystery man" if there's no Gravatar image Use a simple (not distracting) "mystery man" image if there's no gravatar image for a given user. Signed-off-by: David A. Wheeler <9ae72d22d8b894b865a7a496af4fab6320e6abb2@dwheeler.com>
diff --git a/app/models/campaign_link.rb b/app/models/campaign_link.rb index abc1234..def5678 100644 --- a/app/models/campaign_link.rb +++ b/app/models/campaign_link.rb @@ -2,5 +2,4 @@ belongs_to :campaign validates :title, length: { maximum: 77 } - validates :campaign_id, presence: true end
Remove explicit requiring of campaign id for links
diff --git a/app/policies/user_policy.rb b/app/policies/user_policy.rb index abc1234..def5678 100644 --- a/app/policies/user_policy.rb +++ b/app/policies/user_policy.rb @@ -1,9 +1,9 @@ class UserPolicy < Struct.new(:current_user, :target_user) def update? - target_user == current_user || Role.user_is_at_least_a?(user, :admin) + target_user == current_user || Role.user_is_at_least_a?(current_user, :admin) end def destroy? - target_user == current_user || Role.user_is_at_least_a?(user, :admin) + target_user == current_user || Role.user_is_at_least_a?(current_user, :admin) end end
Fix error when trying to update user profile
diff --git a/Casks/avira-antivirus.rb b/Casks/avira-antivirus.rb index abc1234..def5678 100644 --- a/Casks/avira-antivirus.rb +++ b/Casks/avira-antivirus.rb @@ -2,6 +2,7 @@ version :latest sha256 :no_check + # avira-update.com was verified as official when first introduced to the cask url 'https://install.avira-update.com/package/wks_avira/osx/int/pecl/Avira_Free_Antivirus_for_Mac.pkg' name 'Avira Antivirus' homepage 'https://www.avira.com/en/free-antivirus-mac'
Fix `url` stanza comment for Avira Antivirus.
diff --git a/examples/chats/echo_server.rb b/examples/chats/echo_server.rb index abc1234..def5678 100644 --- a/examples/chats/echo_server.rb +++ b/examples/chats/echo_server.rb @@ -13,5 +13,4 @@ end end -Skype.attach -Skype.thread.join +Skype.attach.join
Simplify echo example once more
diff --git a/Casks/vagrant-manager.rb b/Casks/vagrant-manager.rb index abc1234..def5678 100644 --- a/Casks/vagrant-manager.rb +++ b/Casks/vagrant-manager.rb @@ -1,11 +1,11 @@ cask :v1 => 'vagrant-manager' do - version '2.1.2' - sha256 '8510664b4834c98ed9b72baa30aae611f640ca2292725a8cd6ae6d99d412dd4b' + version '2.2.1' + sha256 'c9d63396cb322c65573a3a0c54dd700db18cff736b0f8b21a7813ac51d6ea5dd' # github.com is the official download host per the vendor homepage url "https://github.com/lanayotech/vagrant-manager/releases/download/#{version}/vagrant-manager-#{version}.dmg" appcast 'http://api.lanayo.com/appcast/vagrant_manager.xml', - :sha256 => '3dbe30121d4f32c4d600e30d58d6cfea142d9510823be7a125952aa2e05ea3af' + :sha256 => '599d9d60e76b718094569353ddd31850cdd3efaed6de61d320f53e7bf83073fb' name 'Vagrant Manager' homepage 'http://vagrantmanager.com/' license :mit
Update Vagrant Manager to version 2.2.1
diff --git a/app.rb b/app.rb index abc1234..def5678 100644 --- a/app.rb +++ b/app.rb @@ -1,11 +1,16 @@ require 'sinatra' class Redirector < Sinatra::Base + not_found do + halt 404, 'Not found' + end + get '/' do 'homepage' end get '/:short_link' do - "i'm redirecting you to #{params[:short_link]}" + # Find shortlink in redis. + # Do `redirect "http://google.com"` end end
Add not_found and redirect overview
diff --git a/app.rb b/app.rb index abc1234..def5678 100644 --- a/app.rb +++ b/app.rb @@ -1,4 +1,4 @@-require 'sinatra' +require 'sinatra/base' require 'em-websocket' require 'pp'
Change to proper sinatra require for Sinatr::Base
diff --git a/app.rb b/app.rb index abc1234..def5678 100644 --- a/app.rb +++ b/app.rb @@ -46,3 +46,13 @@ end end + +get '/orders' do + orders_data = Order.all + if orders_data.empty? + return 'There are no orders in database' + else + orders = orders_data.as_json.to_json + end + +end
Return orders in RESTful way
diff --git a/ct_angular_js_rails.gemspec b/ct_angular_js_rails.gemspec index abc1234..def5678 100644 --- a/ct_angular_js_rails.gemspec +++ b/ct_angular_js_rails.gemspec @@ -17,7 +17,7 @@ s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"] s.test_files = Dir["test/**/*"] - s.add_dependency "rails", "~> 4.0.0" + s.add_dependency "rails", "~> 4.1.0" s.add_development_dependency "sqlite3" end
Change to rails version 4.1.0
diff --git a/rubygems-compile.gemspec b/rubygems-compile.gemspec index abc1234..def5678 100644 --- a/rubygems-compile.gemspec +++ b/rubygems-compile.gemspec @@ -5,7 +5,7 @@ s.summary = 'A set of rubygems commands that interface with the MacRuby compiler' s.description = <<-EOS -A set of rubygems commands that interface with the MacRuby compiler +A set of rubygems commands that interface with the MacRuby compiler. EOS s.post_install_message = <<-EOS
Include a full stop in the description
diff --git a/app/controllers/reports/contribution_reports_for_project_owners_controller.rb b/app/controllers/reports/contribution_reports_for_project_owners_controller.rb index abc1234..def5678 100644 --- a/app/controllers/reports/contribution_reports_for_project_owners_controller.rb +++ b/app/controllers/reports/contribution_reports_for_project_owners_controller.rb @@ -11,7 +11,7 @@ conditions.merge!(reward_id: params[:reward_id]) if params[:reward_id].present? conditions.merge!(state: (params[:state].present? ? params[:state] : 'confirmed')) - conditions.merge!(project_owner_id: current_user.id) unless current_user.try(:admin) + conditions.merge!(project_owner_id: current_user.id) unless (current_user.try(:admin) || (current_user.present? && channel.present? && channel.users.include?(current_user))) report_sql = "" I18n.t('contribution_report_to_project_owner').keys[0..-2].each{ |column| report_sql << "#{column} AS \"#{I18n.t("contribution_report_to_project_owner.#{column}")}\","
Fix the contributions report on the project for channel admins
diff --git a/lib/foreman_tasks/triggers.rb b/lib/foreman_tasks/triggers.rb index abc1234..def5678 100644 --- a/lib/foreman_tasks/triggers.rb +++ b/lib/foreman_tasks/triggers.rb @@ -7,7 +7,7 @@ end def trigger(action, *args, &block) - foreman_tasks.dynflow.world.trigger action, *args, &block + foreman_tasks.trigger action, *args, &block end def trigger_task(async, action, *args, &block)
Fix Triggers module to only delegate to ForemanTasks
diff --git a/lib/semvergen.rb b/lib/semvergen.rb index abc1234..def5678 100644 --- a/lib/semvergen.rb +++ b/lib/semvergen.rb @@ -3,6 +3,7 @@ require "semvergen/launcher" require "semvergen/interface" require "semvergen/bump" +require "semvergen/release" require "semvergen/change_log_file" require "semvergen/shell" require "semvergen/version_file"
Make sure this code actually works.
diff --git a/lib/skyed/git.rb b/lib/skyed/git.rb index abc1234..def5678 100644 --- a/lib/skyed/git.rb +++ b/lib/skyed/git.rb @@ -14,7 +14,7 @@ ENV['GIT_SSH'] = '/tmp/ssh-git' path = "/tmp/skyed.#{SecureRandom.hex}" r = ::Git.clone(stack[:custom_cookbooks_source][:url], path) - puts r.path + puts repo_path(r) path end end
INF-941: Add check if remore is cloned
diff --git a/lib/librarian/dsl/receiver.rb b/lib/librarian/dsl/receiver.rb index abc1234..def5678 100644 --- a/lib/librarian/dsl/receiver.rb +++ b/lib/librarian/dsl/receiver.rb @@ -26,15 +26,19 @@ else case specfile when Specfile - instance_eval(specfile.path.read, specfile.path.to_s, 1) + eval(specfile.path.read, instance_binding, specfile.path.to_s, 1) when String - instance_eval(specfile) + eval(specfile, instance_binding) when Proc instance_eval(&specfile) end end end + def instance_binding + binding + end + end end end
Use eval with a binding rather than instance_eval when evaluating a string.
diff --git a/lib/stack_master/parameter_resolver.rb b/lib/stack_master/parameter_resolver.rb index abc1234..def5678 100644 --- a/lib/stack_master/parameter_resolver.rb +++ b/lib/stack_master/parameter_resolver.rb @@ -19,8 +19,7 @@ begin parameters[key] = resolve_parameter_value(value) rescue InvalidParameter - StackMaster.stderr.puts "Unable to resolve parameter #{key.inspect} value causing error: #{$!.message}" - raise + raise InvalidParameter, "Unable to resolve parameter #{key.inspect} value causing error: #{$!.message}" end parameters end
Raise correct typed exception and also decorate it with something useful
diff --git a/lib/mongoid/extensions/set.rb b/lib/mongoid/extensions/set.rb index abc1234..def5678 100644 --- a/lib/mongoid/extensions/set.rb +++ b/lib/mongoid/extensions/set.rb @@ -9,7 +9,7 @@ # @example Mongoize the object. # set.mongoize # - # @return [ Hash ] The object mongoized. + # @return [ Array ] The object mongoized. # # @since 3.0.0 def mongoize @@ -21,9 +21,9 @@ # Convert the object from its mongo friendly ruby type to this type. # # @example Demongoize the object. - # Set.demongoize({ "min" => 1, "max" => 5 }) + # Set.demongoize([1, 2, 3]) # - # @param [ Hash ] object The object to demongoize. + # @param [ Array ] object The object to demongoize. # # @return [ Set ] The set. # @@ -36,11 +36,11 @@ # type. # # @example Mongoize the object. - # Set.mongoize(1..3) + # Set.mongoize(Set.new([1,2,3])) # # @param [ Set ] object The object to mongoize. # - # @return [ Hash ] The object mongoized. + # @return [ Array ] The object mongoized. # # @since 3.0.0 def mongoize(object)
Correct code documentation for Set extension It appears the code documentation for Set was copied incorrectly from Range. Set mongoizes/demongoizes to/from Array, not Hash.
diff --git a/roles/edgeuno.rb b/roles/edgeuno.rb index abc1234..def5678 100644 --- a/roles/edgeuno.rb +++ b/roles/edgeuno.rb @@ -5,6 +5,30 @@ :hosted_by => "EdgeUno", :location => "Bogotá, Colombia", :networking => { + :firewall => { + :inet => [ + { + :action => "ACCEPT", + :source => "net:200.25.3.8/31", + :dest => "fw", + :proto => "udp", + :dest_ports => "snmp", + :source_ports => "1024:", + :rate_limit => "-", + :connection_limit => "-" + }, + { + :action => "ACCEPT", + :source => "net:200.25.3.8/31", + :dest => "fw", + :proto => "tcp", + :dest_ports => "snmp", + :source_ports => "1024:", + :rate_limit => "-", + :connection_limit => "-" + } + ] + }, :nameservers => [ "8.8.8.8", "1.1.1.1"
Enable snmp monitoring for Edgeuno machines
diff --git a/spec/unit/ice_nine/freezer/numeric/class_methods/deep_freeze_spec.rb b/spec/unit/ice_nine/freezer/numeric/class_methods/deep_freeze_spec.rb index abc1234..def5678 100644 --- a/spec/unit/ice_nine/freezer/numeric/class_methods/deep_freeze_spec.rb +++ b/spec/unit/ice_nine/freezer/numeric/class_methods/deep_freeze_spec.rb @@ -4,13 +4,14 @@ require 'ice_nine/freezer' require 'ice_nine/freezer/no_freeze' require 'ice_nine/freezer/numeric' +require 'bigdecimal' describe IceNine::Freezer::Numeric, '.deep_freeze' do subject { object.deep_freeze(value) } let(:object) { described_class } - [0.0, 0, 0x7fffffffffffffff].each do |value| + [0.0, 0, 0x7fffffffffffffff, BigDecimal('0')].each do |value| context "with a #{value.class} object" do let(:value) { value }
Add bigdecimal specs for numeric freezer
diff --git a/lib/vagrant/util/safe_exec.rb b/lib/vagrant/util/safe_exec.rb index abc1234..def5678 100644 --- a/lib/vagrant/util/safe_exec.rb +++ b/lib/vagrant/util/safe_exec.rb @@ -8,13 +8,20 @@ # forking. module SafeExec def safe_exec(command) + # Create a list of things to rescue from. Since this is OS + # specific, we need to do some defined? checks here to make + # sure they exist. + rescue_from = [] + rescue_from << Errno::EOPNOTSUPP if defined?(Errno::EOPNOTSUPP) + rescue_from << Errno::E045 if defined?(Errno::E045) + fork_instead = false begin pid = nil pid = fork if fork_instead Kernel.exec(command) if pid.nil? Process.wait(pid) if pid - rescue Errno::E045 + rescue *rescue_from # We retried already, raise the issue and be done raise if fork_instead
Fix errno not defined [closes GH-465]
diff --git a/rticles.gemspec b/rticles.gemspec index abc1234..def5678 100644 --- a/rticles.gemspec +++ b/rticles.gemspec @@ -16,7 +16,7 @@ s.files = `git ls-files`.split($\) - s.add_dependency "rails", "~> 3.2.8", '<4.1' + s.add_dependency "rails", ">=3.2.8", '<4.1' s.add_dependency "acts_as_list", ">=0.1.8", "<0.3.0" s.add_dependency "roman-numerals", "~>0.3.0"
Fix that Rails version spec excluded Rails 4.0.
diff --git a/ruby_interop.rb b/ruby_interop.rb index abc1234..def5678 100644 --- a/ruby_interop.rb +++ b/ruby_interop.rb @@ -1,5 +1,6 @@ require_relative 'core' require_relative 'numbers' +require_relative 'testing' System_Print=->to_print{Kernel.print to_print} System_PrintLine=->to_print{System_Print[to_print+"\n"]} Raise=->to_raise{raise to_raise} @@ -17,7 +18,7 @@ PrintNumber=->number{puts ConvertToRubyNumber[number]} def assert(expected, actual, msg = "") if(expected==actual) - PrintTrue.(Noop) + Assert[True] else Raise["Fail! expected #{expected}, got #{actual}. #{msg}"] end
Print "T" instead of "True" for ruby interop