diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/app/controllers/spree/amazon_controller.rb b/app/controllers/spree/amazon_controller.rb index abc1234..def5678 100644 --- a/app/controllers/spree/amazon_controller.rb +++ b/app/controllers/spree/amazon_controller.rb @@ -6,7 +6,7 @@ module Spree class AmazonController < Devise::SessionsController def login - + # Validate access token response = HTTParty.get("https://api.amazon.com/auth/o2/tokeninfo?access_token=#{Rack::Utils.escape(params[:access_token])}") @@ -16,6 +16,12 @@ # Lookup or create user user = User.find_by_email(profile["email"]) || User.create(email: profile["email"]) + + # Set the user's password to be their amazon profile id if we are creating new from an amazon profile + if user.password.nil? + user.password = profile["user_id"] + user.save! + end # Update access token for user session[:auth_source] = "amazon" @@ -23,7 +29,7 @@ # Login user sign_in user, :bypass => true - redirect_back_or_default(after_sign_in_path_for(spree_current_user)) + redirect_back_or_default(after_sign_in_path_for(user)) end def payment_success
Fix amazon login user creation
diff --git a/popularity_contest.gemspec b/popularity_contest.gemspec index abc1234..def5678 100644 --- a/popularity_contest.gemspec +++ b/popularity_contest.gemspec @@ -4,7 +4,7 @@ Gem::Specification.new do |spec| spec.name = "popularity_contest" - spec.version = "0.0.3" + spec.version = "0.0.4" spec.authors = ["Kasper Grubbe"] spec.email = ["kawsper@gmail.com"] spec.description = "A Rack application to count and sort popular content on our websites"
Add 0.0.4 version to Gemspec
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 @@ -14,6 +14,8 @@ let :params do req_params end + + it { is_expected.to contain_class('neutron::deps') } it { is_expected.to contain_openstacklib__db__postgresql('neutron').with( :user => 'neutron',
Include deps class in unit test for postgresql Change-Id: I33be0962bc8065adb2563fdd3df7be1cd32955f5
diff --git a/spec/features/reordering_topic_sections.rb b/spec/features/reordering_topic_sections.rb index abc1234..def5678 100644 --- a/spec/features/reordering_topic_sections.rb +++ b/spec/features/reordering_topic_sections.rb @@ -27,16 +27,14 @@ private + def handle_for_topic_section(section_title) + within_topic_section(section_title) { find('.js-topic-section-handle') } + end + def drag_topic_section_above(dragged_section_title, destination_section_title) - handle = within_topic_section dragged_section_title do - find('.js-topic-section-handle') - end - - destination = within_topic_section destination_section_title do - find('.js-topic-section-handle') - end - - handle.drag_to destination + handle_for_topic_section(dragged_section_title).drag_to( + handle_for_topic_section(destination_section_title) + ) end def sections_in_order
Tidy up reordering topic section feature spec helpers
diff --git a/spec/ruby/1.8/library/matrix/clone_spec.rb b/spec/ruby/1.8/library/matrix/clone_spec.rb index abc1234..def5678 100644 --- a/spec/ruby/1.8/library/matrix/clone_spec.rb +++ b/spec/ruby/1.8/library/matrix/clone_spec.rb @@ -14,8 +14,8 @@ b.class.should == Matrix b.should == @a b.should_not === @a - 0.upto(2) do |i| - 0.upto(1) do |j| + 0.upto(@a.row_size - 1) do |i| + 0.upto(@a.column_size - 1) do |j| b[i, j].should == @a[i, j] b[i, j].should_not === @a[i, j] end
Use size functions instead of constants.
diff --git a/spec/unit/view_helpers/form_helper_spec.rb b/spec/unit/view_helpers/form_helper_spec.rb index abc1234..def5678 100644 --- a/spec/unit/view_helpers/form_helper_spec.rb +++ b/spec/unit/view_helpers/form_helper_spec.rb @@ -10,7 +10,7 @@ end it "should filter out the field passed via the option :except" do - view.hidden_field_tags_for({:scope => "All", :filter => "None"}, except: :filter).should == + view.hidden_field_tags_for({:scope => "All", :filter => "None"}, :except => :filter).should == %{<input id="scope" name="scope" type="hidden" value="All" />} end end
Fix for Ruby 1.8.6 on recent pull request
diff --git a/spec/factories/place_message.rb b/spec/factories/place_message.rb index abc1234..def5678 100644 --- a/spec/factories/place_message.rb +++ b/spec/factories/place_message.rb @@ -1,10 +1,13 @@ FactoryGirl.define do factory :place_message, class: PlaceMessage do + recipient_name "Valid Recipent" recipient_email "valid-email@example.com" sender_name "John Doe" sender_email "valid-email@example.com" message "This is a valid place message." + mail_form_path "http://www.example.com/place/23/details" + place_name "My little Farm" end factory :valid_place_message, class: PlaceMessage do
Fix spec for place message model.
diff --git a/app/controllers/api/v1/rules_controller.rb b/app/controllers/api/v1/rules_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/v1/rules_controller.rb +++ b/app/controllers/api/v1/rules_controller.rb @@ -0,0 +1,24 @@+module Api + module V1 + class RulesController < ActionController::Base + # TODO: do this properly + skip_before_filter :verify_authenticity_token + + def create + transaction = Transaction.find_by(id: params.fetch('transaction_id', nil)) + args = rule_params + @rule = Rule.create( + public_id: args.fetch('id', nil), + version: args.fetch('version', nil), + transact: transaction) + render(json: @rule) + end + + private + + def rule_params + params.require(:rule).permit(:id, :version) + end + end + end +end
Add API RulesController with :create
diff --git a/app/services/boards/issues/move_service.rb b/app/services/boards/issues/move_service.rb index abc1234..def5678 100644 --- a/app/services/boards/issues/move_service.rb +++ b/app/services/boards/issues/move_service.rb @@ -9,6 +9,7 @@ def execute return false unless issue.present? + return false unless user.can?(:update_issue, issue) update_service.execute(issue) reopen_service.execute(issue) if moving_from.done?
Check if user can update the issue before moving it betweens lists
diff --git a/app/models/fluentd/setting_archive/note.rb b/app/models/fluentd/setting_archive/note.rb index abc1234..def5678 100644 --- a/app/models/fluentd/setting_archive/note.rb +++ b/app/models/fluentd/setting_archive/note.rb @@ -0,0 +1,17 @@+class Fluentd + module SettingArchive + class Note + include Archivable + + FILE_EXTENSION = ".note".freeze + + def self.find_by_file_id(backup_dir, file_id) + new(file_path_of(backup_dir, file_id)) + end + + def initialize(file_path) + @file_path = file_path + end + end + end +end
Add Note class to memo about backup files.
diff --git a/lib/eidolon/rgssx/table.rb b/lib/eidolon/rgssx/table.rb index abc1234..def5678 100644 --- a/lib/eidolon/rgssx/table.rb +++ b/lib/eidolon/rgssx/table.rb @@ -6,7 +6,6 @@ def self._load(array) # :nodoc: self.class.new.instance_eval do @size, @xsize, @ysize, @zsize, _, *@data = array.unpack('LLLLLS*') - self end end end
Remove unnecessary `self` return in `Table` RGSSx class.
diff --git a/spec/models/instance/announcement_spec.rb b/spec/models/instance/announcement_spec.rb index abc1234..def5678 100644 --- a/spec/models/instance/announcement_spec.rb +++ b/spec/models/instance/announcement_spec.rb @@ -1,5 +1,7 @@ require 'rails_helper' RSpec.describe Instance::Announcement, type: :model do + it { is_expected.to belong_to(:creator).class_name(User.name) } + it { is_expected.to belong_to(:instance).inverse_of(:announcements) } it { is_expected.to validate_presence_of(:title) } end
Add tests for Instance::Announcement's associations
diff --git a/spec/vorpal/integration/db_driver_spec.rb b/spec/vorpal/integration/db_driver_spec.rb index abc1234..def5678 100644 --- a/spec/vorpal/integration/db_driver_spec.rb +++ b/spec/vorpal/integration/db_driver_spec.rb @@ -3,7 +3,7 @@ describe Vorpal::DbDriver do describe '#build_db_class' do - let(:db_class) { subject.build_db_class('trees') } + let(:db_class) { subject.build_db_class('example') } it 'generates a vald class name so that rails auto-reloading works' do expect { Vorpal.const_defined?(db_class.name) }.to_not raise_error
Use more generic table name
diff --git a/lib/minty/objects/model.rb b/lib/minty/objects/model.rb index abc1234..def5678 100644 --- a/lib/minty/objects/model.rb +++ b/lib/minty/objects/model.rb @@ -4,7 +4,7 @@ def self.attribute(name, json_attr = nil) define_method(name) do - @json[(json_attr || name).to_s] + json[(json_attr || name).to_s] end end
Use attribute reader, not instance variable
diff --git a/jekyll-compass.gemspec b/jekyll-compass.gemspec index abc1234..def5678 100644 --- a/jekyll-compass.gemspec +++ b/jekyll-compass.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |s| s.name = 'jekyll-compass' - s.version = '1.1.0.pre' + s.version = '1.2.0.pre' s.summary = "Jekyll generator plugin to build Compass projects during site build" s.description = <<-EOF This project is a plugin for the Jekyll static website generator to allow for using Compass projects with your
Bump version for further development
diff --git a/lib/idology_test_helper.rb b/lib/idology_test_helper.rb index abc1234..def5678 100644 --- a/lib/idology_test_helper.rb +++ b/lib/idology_test_helper.rb @@ -10,7 +10,8 @@ end def idology_response_path(name) - File.dirname(__FILE__)+"/../spec/fixtures/#{name}.xml" + file = File.expand_path(File.dirname(__FILE__)+"/../spec/fixtures/#{name}.xml") + raise "Unknown File: #{file}" unless File.exist?(file) end def load_idology_response(name)
Update the test helper to error on unknown files.
diff --git a/ivapi.gemspec b/ivapi.gemspec index abc1234..def5678 100644 --- a/ivapi.gemspec +++ b/ivapi.gemspec @@ -22,7 +22,7 @@ gem.add_dependency 'faraday_middleware', '~> 0.9.1' gem.add_dependency 'hashie', '~> 3.3' gem.add_dependency 'multi_json', '~> 1.10' - gem.add_development_dependency 'bundler', '~> 1.7' + gem.add_development_dependency 'bundler', '~> 1.5' gem.add_development_dependency 'rake', '~> 10.0' gem.version = Ivapi::VERSION
Use lower bundler version in gemspec * Travis do not support latest version of bundler
diff --git a/lib/precious_cargo/data.rb b/lib/precious_cargo/data.rb index abc1234..def5678 100644 --- a/lib/precious_cargo/data.rb +++ b/lib/precious_cargo/data.rb @@ -13,11 +13,8 @@ # Returns the AES encrypted data. def encrypt!(data, options = {}) secret = options.delete(:secret) - - cipher = OpenSSL::Cipher::AES.new(256, :CBC) - cipher.encrypt - cipher.key = secret - Base64.encode64(cipher.update(data) + cipher.final) + cipher = Gibberish::AES.new(secret) + cipher.encrypt(data) end # Public: Decrypt the supplied data using a secret string. Currently only supports AES 256 encryption. @@ -28,12 +25,8 @@ # Returns the AES encrypted data. def decrypt!(encrypted_data, options = {}) secret = options.delete(:secret) - encrypted_data = Base64.decode64(encrypted_data) - - decipher = OpenSSL::Cipher::AES.new(256, :CBC) - decipher.decrypt - decipher.key = secret - decipher.update(encrypted_data) + decipher.final + cipher = Gibberish::AES.new(secret) + cipher.decrypt(encrypted_data).strip end end end
Switch encryption methods to use gibberish.
diff --git a/lib/preserves/selection.rb b/lib/preserves/selection.rb index abc1234..def5678 100644 --- a/lib/preserves/selection.rb +++ b/lib/preserves/selection.rb @@ -1,5 +1,7 @@ module Preserves class Selection + + include Enumerable attr_accessor :domain_objects
Make sure Preserves::Selection is Enumerable
diff --git a/lib/queue_it/api/client.rb b/lib/queue_it/api/client.rb index abc1234..def5678 100644 --- a/lib/queue_it/api/client.rb +++ b/lib/queue_it/api/client.rb @@ -8,7 +8,7 @@ module Api class Client JSON_FORMAT = "application/json".freeze - ENDPOINT_URL = URI("https://api.queue-it.net/1.2/event").freeze + ENDPOINT_URL = URI("https://api2.queue-it.net/2_0_beta/event").freeze def initialize(api_key) self.api_key = api_key
Use API in version 2 * https://api2.queue-it.net
diff --git a/lib/tasks/stateoscope.rake b/lib/tasks/stateoscope.rake index abc1234..def5678 100644 --- a/lib/tasks/stateoscope.rake +++ b/lib/tasks/stateoscope.rake @@ -4,7 +4,7 @@ namespace :stateoscope do desc 'visualize state machine for a given class' task :visualize, [:class, :state_machine_name] => :environment do |t, args| - fail ArgumentError 'missing required argument <class>' unless args[:class].present? + fail ArgumentError, 'missing required argument <class>' unless args[:class].present? klass = args[:class].classify.constantize Stateoscope.visualize(klass, state_machine_name: args[:state_machine_name]) end
Fix bug in rake task
diff --git a/lib/sorcery/controller/submodules/external/protocols/oauth2.rb b/lib/sorcery/controller/submodules/external/protocols/oauth2.rb index abc1234..def5678 100644 --- a/lib/sorcery/controller/submodules/external/protocols/oauth2.rb +++ b/lib/sorcery/controller/submodules/external/protocols/oauth2.rb @@ -10,15 +10,7 @@ end def authorize_url(options = {}) - defaults = { - :site => @site, - :ssl => { :ca_file => Config.ca_file } - } - client = ::OAuth2::Client.new( - @key, - @secret, - defaults.merge!(options) - ) + client = build_client(options) client.web_server.authorize_url( :redirect_uri => @callback_url, :scope => @scope @@ -26,18 +18,22 @@ end def get_access_token(args, options = {}) + client = build_client(options) + client.web_server.get_access_token( + args[:code], + :redirect_uri => @callback_url + ) + end + + def build_client(options = {}) defaults = { :site => @site, :ssl => { :ca_file => Config.ca_file } } - client = ::OAuth2::Client.new( + ::OAuth2::Client.new( @key, @secret, defaults.merge!(options) - ) - client.web_server.get_access_token( - args[:code], - :redirect_uri => @callback_url ) end end
Remove duplication in Oauth2 protocol code
diff --git a/spec/overcommit/default_configuration_spec.rb b/spec/overcommit/default_configuration_spec.rb index abc1234..def5678 100644 --- a/spec/overcommit/default_configuration_spec.rb +++ b/spec/overcommit/default_configuration_spec.rb @@ -4,17 +4,29 @@ default_config = YAML.load_file(Overcommit::ConfigurationLoader::DEFAULT_CONFIG_PATH).to_hash - Overcommit::Utils.supported_hook_type_classes.each do |hook_type| - context "within the #{hook_type} configuration section" do - default_config[hook_type].each do |hook_name, hook_config| - next if hook_name == 'ALL' + Overcommit::Utils.supported_hook_types.each do |hook_type| + hook_class = Overcommit::Utils.camel_case(hook_type) - it "explicitly sets the `enabled` option for #{hook_name}" do + Dir[File.join(Overcommit::HOOK_DIRECTORY, hook_type.gsub('-', '_'), '*')]. + map { |hook_file| Overcommit::Utils.camel_case(File.basename(hook_file, '.rb')) }. + each do |hook| + next if hook == 'Base' + + context "for the #{hook} #{hook_type} hook" do + it 'exists in config/default.yml' do + default_config[hook_class][hook].should_not be_nil + end + + it 'explicitly sets the enabled option' do # Use variable names so it reads nicer in the RSpec output - hook_enabled_option_set = !hook_config['enabled'].nil? - all_hook_enabled_option_set = !default_config[hook_type]['ALL']['enabled'].nil? + hook_enabled_option_set = !default_config[hook_class][hook]['enabled'].nil? + all_hook_enabled_option_set = !default_config[hook_class]['ALL']['enabled'].nil? (hook_enabled_option_set || all_hook_enabled_option_set).should == true + end + + it 'defines a description' do + default_config[hook_class][hook]['description'].should_not be_nil end end end
Add tests verifying configuration for hooks Building on top of a5e834b, we want to also verify that all hooks have a `description` specified, as well as a configuration in general. We change the implementation to work backwards from the file names so that if we create a hook file but forget to add a configuration for it we'll get a test failure.
diff --git a/redis-spawn.gemspec b/redis-spawn.gemspec index abc1234..def5678 100644 --- a/redis-spawn.gemspec +++ b/redis-spawn.gemspec @@ -17,6 +17,6 @@ "test/**/*.rb" ] - s.add_dependency "redis-rb", "~> 2.0" + s.add_dependency "redis", "~> 2.0" s.add_development_dependency "cutest", "~> 0.1" end
Fix broken dependancy in gemspec
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -9,7 +9,8 @@ def index @data = {} @actual_path = request.original_fullpath - @is_contained = @actual_path.include?('contained') + @is_contained = @actual_path.include?('contained') || + @actual_path.include?('embed') @is_production = Rails.env.production? response.headers['X-FRAME-OPTIONS'] = 'ALLOWALL' render 'index'
Expand is_contained to the embed route
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -17,6 +17,7 @@ include Blacklight::Controller # Adds Hydra behaviors into the application controller include Hydra::Controller::ControllerBehavior + include Hydra::PolicyAwareAccessControlsEnforcement include AccessControlsHelper layout 'avalon'
Add policy aware enforcement to controllers
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,5 +1,5 @@ class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. - protect_from_forgery with: :exception + #protect_from_forgery with: :exception end
Remove protect from forgery to allow Twilio POSTS
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,6 +1,8 @@ class ApplicationController < ActionController::Base protect_from_forgery with: :exception + + before_filter :configure_permitted_parameters, if: :devise_controller? def current_user current_admin || current_job_broker || current_job_provider || current_job_seeker @@ -28,4 +30,12 @@ end end + protected + + def configure_permitted_parameters + devise_parameter_sanitizer.for(:sign_up) do |u| + u.permit(:username, :password, :password_confirmation, :firstname, :lastname, :street, :zip, :city, :date_of_birth, :email, :phone, :mobile, :contact_preference, :contact_availability, :work_categories) + end + end + end
Configure new attributes on the Devise models.
diff --git a/app/controllers/retirements_controller.rb b/app/controllers/retirements_controller.rb index abc1234..def5678 100644 --- a/app/controllers/retirements_controller.rb +++ b/app/controllers/retirements_controller.rb @@ -4,4 +4,8 @@ def alternate_locales [] end + + def display_menu_button_in_header? + false + end end
Disable menu button in RetirementController. It's got nothing to show, and furthermore it did nothing and raised JS console errors.
diff --git a/test/integration/amazon_linux_2012_09_bootstrap_test.rb b/test/integration/amazon_linux_2012_09_bootstrap_test.rb index abc1234..def5678 100644 --- a/test/integration/amazon_linux_2012_09_bootstrap_test.rb +++ b/test/integration/amazon_linux_2012_09_bootstrap_test.rb @@ -0,0 +1,17 @@+require 'integration_helper' + +class AmazonLinux2012_09BootstrapTest < IntegrationTest + def user + "ec2-user" + end + + def image_id + "ami-1624987f" + end + + def prepare_server + # Do nothing as `solo bootstrap` will do everything + end + + include Apache2Bootstrap +end
Add integration test for Amazon Linux AMI
diff --git a/lib/enumerative/enumeration_sharedspec.rb b/lib/enumerative/enumeration_sharedspec.rb index abc1234..def5678 100644 --- a/lib/enumerative/enumeration_sharedspec.rb +++ b/lib/enumerative/enumeration_sharedspec.rb @@ -6,6 +6,12 @@ let :instance do described_class.new 'foo' + end + + let :immutable_error do + RUBY_VERSION > "1.9.2" ? + "can't modify frozen string" : + "can't modify frozen String" end it 'should have the expected #key' do @@ -17,7 +23,7 @@ expect { instance.key.gsub!( /./, 'x' ) - }.to raise_error( RuntimeError, "can't modify frozen string") + }.to raise_error( RuntimeError, immutable_error ) end it 'should equal an equivalent instance' do
Fix issue with frozen runtime error message in Ruby 1.9.3 vs. 1.9.2.
diff --git a/lib/catarse_stripe/engine.rb b/lib/catarse_stripe/engine.rb index abc1234..def5678 100644 --- a/lib/catarse_stripe/engine.rb +++ b/lib/catarse_stripe/engine.rb @@ -7,15 +7,13 @@ class Mapper def mount_catarse_stripe_at(mount_location) scope mount_location do - namespace :payment do - get '/stripe/:id/review' => 'stripe#review', :as => 'review_stripe' - post '/stripe/notifications' => 'stripe#ipn', :as => 'ipn_stripe' - match '/stripe/:id/notifications' => 'stripe#notifications', :as => 'notifications_stripe' - match '/stripe/:id/pay' => 'stripe#pay', :as => 'pay_stripe' - match '/stripe/:id/success' => 'stripe#success', :as => 'success_stripe' - match '/stripe/:id/cancel' => 'stripe#cancel', :as => 'cancel_stripe' - match '/stripe/:id/charge' => 'stripe#charge', :as => 'charge_stripe' - end + get 'payment/stripe/:id/review' => 'payment/stripe#review', :as => 'review_stripe' + post 'payment/stripe/notifications' => 'payment/stripe#ipn', :as => 'ipn_stripe' + match 'payment/stripe/:id/notifications' => 'payment/stripe#notifications', :as => 'notifications_stripe' + match 'payment/stripe/:id/pay' => 'payment/stripe#pay', :as => 'pay_stripe' + match 'payment/stripe/:id/success' => 'payment/stripe#success', :as => 'success_stripe' + match 'payment/stripe/:id/cancel' => 'paymentstripe#cancel', :as => 'cancel_stripe' + match 'payment/stripe/:id/charge' => 'paymentstripe#charge', :as => 'charge_stripe' end end end
Change route to share application
diff --git a/lib/mobility/plugins/attribute_methods.rb b/lib/mobility/plugins/attribute_methods.rb index abc1234..def5678 100644 --- a/lib/mobility/plugins/attribute_methods.rb +++ b/lib/mobility/plugins/attribute_methods.rb @@ -6,8 +6,9 @@ Also adds a method #translated_attributes with names and values of translated attributes only. -@note Adding translated attributes to #attributes can have unexpected - consequences, since these values are not true attribute values. +@note Adding translated attributes to +attributes+ can have unexpected + consequences, since these attributes do not have corresponding columns in the + model table. Using this plugin may lead to conflicts with other gems. =end module AttributeMethods
Modify note to mention gem conflicts [ci skip]
diff --git a/lib/puppet/type/f5_node.rb b/lib/puppet/type/f5_node.rb index abc1234..def5678 100644 --- a/lib/puppet/type/f5_node.rb +++ b/lib/puppet/type/f5_node.rb @@ -8,7 +8,10 @@ newparam(:name, :namevar=>true) do desc "The node name. v9.0 API uses IP addresses, v11.0 API uses names." - newvalues(/^[[:alpha:][:digit:]\/]+$/) + validate do |value| + fail ArgumentError, "#{name} must be a String" unless value.is_a?(String) + fail ArgumentError, "#{name} must match the pattern /Partition/name" unless value =~ /^\/\w+\/(\w|\d|\.)+$/ + end end newproperty(:connection_limit) do
Fix this validation to allow _'s and so forth.
diff --git a/lib/modules/wdpa/global_stats_importer.rb b/lib/modules/wdpa/global_stats_importer.rb index abc1234..def5678 100644 --- a/lib/modules/wdpa/global_stats_importer.rb +++ b/lib/modules/wdpa/global_stats_importer.rb @@ -11,12 +11,16 @@ attrs.merge!("#{field}": value) end - puts attrs GlobalStatistic.create(attrs) end private + # If it's a string, ensure to remove commas before casting to float. + # If it's a float this will basically return the value as it is in the csv. + # Even though strings in the csv are mostly integers, converting it to float here + # shouldn't cause issues with the database where the field is explicitly an integer. + # Postgres should take care of it. def self.parse_value(val) val.to_s.split(',').join('').to_f end
Remove print and add comment
diff --git a/lib/contao/tasks/assets.rake b/lib/contao/tasks/assets.rake index abc1234..def5678 100644 --- a/lib/contao/tasks/assets.rake +++ b/lib/contao/tasks/assets.rake @@ -1,7 +1,6 @@ namespace :assets do desc "Compile javascript" task :javascript do - TechnoGate::Contao::CoffeescriptCompiler.compile TechnoGate::Contao::CoffeescriptCompiler.compile TechnoGate::Contao::JavascriptCompiler.compile end
Revert "Compile CoffeeScript before compiling javascript" This reverts commit 11b143dde3f2b4b73d757a1b71daae0ffedca387.
diff --git a/lib/tchart/process/command_line_parser.rb b/lib/tchart/process/command_line_parser.rb index abc1234..def5678 100644 --- a/lib/tchart/process/command_line_parser.rb +++ b/lib/tchart/process/command_line_parser.rb @@ -9,7 +9,7 @@ private - def self.validate_args(argv, data_filename, tex_filename) + def self.validate_args(argv, data_filename, tex_filename) # => errors errors = [] if argv.length != 2 errors << "Usage: tchart input-data-filename output-tikz-filename"
Add comment about method return value.
diff --git a/config/initializers/exception_notifier.rb b/config/initializers/exception_notifier.rb index abc1234..def5678 100644 --- a/config/initializers/exception_notifier.rb +++ b/config/initializers/exception_notifier.rb @@ -2,5 +2,5 @@ :email => { :email_prefix => "[LARA Exception] ", :sender_address => %{"notifier" <authoring-help@concord.org>}, - :exception_recipients => %w{npaessel@concord.org} + :exception_recipients => %w{all-portal-errors@concord.org} }
Send notification to the correct list.
diff --git a/test/fixtures/sample-project/config/init.rb b/test/fixtures/sample-project/config/init.rb index abc1234..def5678 100644 --- a/test/fixtures/sample-project/config/init.rb +++ b/test/fixtures/sample-project/config/init.rb @@ -4,7 +4,7 @@ require "daimon_skycrawlers/queue" DaimonSkycrawlers.configure do |config| - config.logger = DaimonSkycrawlers::Logger.default + config.logger = ::Logger.new(nil) config.crawler_interval = 1 config.shutdown_interval = 300 end
Use null logger in test
diff --git a/lib/static_sync/storage.rb b/lib/static_sync/storage.rb index abc1234..def5678 100644 --- a/lib/static_sync/storage.rb +++ b/lib/static_sync/storage.rb @@ -43,7 +43,7 @@ end def remote_directory - @remote_directory ||= @config.storage.directories.new(:key => @config.storage_directory) + @config.storage.directories.new(:key => @config.storage_directory) end def log
Stop caching the remote directory since it seems to be problematic.
diff --git a/lib/tenon/tenon_content.rb b/lib/tenon/tenon_content.rb index abc1234..def5678 100644 --- a/lib/tenon/tenon_content.rb +++ b/lib/tenon/tenon_content.rb @@ -9,7 +9,7 @@ Tenon::TenonContentBuilder.add_assoc(self, content_field) define_method("#{content_field}_i18n?") { i18n } - if i18n + if i18n && Tenon.config.languages Tenon.config.languages.each do |title, lang| Tenon::TenonContentBuilder.add_assoc(self, "#{content_field}_#{lang}") end
Fix i18n Tenon Content call
diff --git a/test/unit/vagrant/plugin/v2/trigger_test.rb b/test/unit/vagrant/plugin/v2/trigger_test.rb index abc1234..def5678 100644 --- a/test/unit/vagrant/plugin/v2/trigger_test.rb +++ b/test/unit/vagrant/plugin/v2/trigger_test.rb @@ -0,0 +1,68 @@+require File.expand_path("../../../../base", __FILE__) + +describe Vagrant::Plugin::V2::Trigger do + include_context "unit" + + let(:iso_env) do + # We have to create a Vagrantfile so there is a root path + isolated_environment.tap do |env| + env.vagrantfile("") + end + end + let(:iso_vagrant_env) { iso_env.create_vagrant_env } + let(:machine) { iso_vagrant_env.machine(iso_vagrant_env.machine_names[0], :dummy) } + let(:config) { double("config") } # actually flush this out into a trigger config + let(:env) { { + machine: machine, + ui: Vagrant::UI::Silent.new, + } } + + + let(:subject) { described_class.new(env, config, machine) } + + context "firing before triggers" do + end + + context "firing after triggers" do + end + + context "filtering triggers" do + end + + context "firing triggers" do + end + + context "executing info" do + let(:message) { "Printing some info" } + + it "prints messages at INFO" do + output = "" + allow(machine.ui).to receive(:info) do |data| + output << data + end + + subject.send(:info, message) + expect(output).to include(message) + end + end + + context "executing warn" do + let(:message) { "Printing some warnings" } + + it "prints messages at WARN" do + output = "" + allow(machine.ui).to receive(:warn) do |data| + output << data + end + + subject.send(:warn, message) + expect(output).to include(message) + end + end + + context "executing run" do + end + + context "executing run_remote" do + end +end
Add basic spec test for trigger class
diff --git a/lib/gitlab/openssl_helper.rb b/lib/gitlab/openssl_helper.rb index abc1234..def5678 100644 --- a/lib/gitlab/openssl_helper.rb +++ b/lib/gitlab/openssl_helper.rb @@ -1,13 +1,15 @@ require_relative 'linker_helper' class OpenSSLHelper - @deps = %w[libssl libcrypto] + @base_libs = %w[libssl libcrypto] + @deps = [] @cursor = 2 class << self def allowed_libs - find_deps("libssl") - find_deps("libcrypto") + @base_libs.each do |lib| + find_deps(lib) + end @deps.map { |dep| File.basename(dep).split(".so").first }.uniq end @@ -29,6 +31,7 @@ def find_deps(name) puts "Libraries starting with '#{name}' and their dependencies" + @deps << name libs = find_libs(name) libs.each do |lib, path|
Store special libraries in separate array Signed-off-by: Balasankar "Balu" C <250a398eb3bfb9862062144cc742cc8f9bdd8d78@gitlab.com>
diff --git a/lib/helios/rainbow_effect.rb b/lib/helios/rainbow_effect.rb index abc1234..def5678 100644 --- a/lib/helios/rainbow_effect.rb +++ b/lib/helios/rainbow_effect.rb @@ -1,5 +1,5 @@ module Helios - class RainbowEffect + class RainbowEffect < Effect RED = [255,0,0] ORANGE = [255,127,0] YELLOW = [255,255,0]
Add base class Effect to RainbowEffect
diff --git a/lib/hexdump/core_ext/file.rb b/lib/hexdump/core_ext/file.rb index abc1234..def5678 100644 --- a/lib/hexdump/core_ext/file.rb +++ b/lib/hexdump/core_ext/file.rb @@ -1,4 +1,4 @@-require 'hexdump/hexdump' +require 'hexdump/core_ext/io' class File @@ -15,7 +15,7 @@ # def self.hexdump(path,**kwargs,&block) self.open(path,'rb') do |file| - Hexdump.dump(file,**kwargs,&block) + file.hexdump(**kwargs,&block) end end
Use the IO core_ext in the File core_ext.
diff --git a/lib/agave/builder/queryBuilder.rb b/lib/agave/builder/queryBuilder.rb index abc1234..def5678 100644 --- a/lib/agave/builder/queryBuilder.rb +++ b/lib/agave/builder/queryBuilder.rb @@ -16,7 +16,6 @@ if block then yield qryObject else - qryObject.selects = "*" qryObject.where_params(:id, id) if id end puts qryObject
Set default value for selects instance variable in Query
diff --git a/tests/spec/features/url_parameters_spec.rb b/tests/spec/features/url_parameters_spec.rb index abc1234..def5678 100644 --- a/tests/spec/features/url_parameters_spec.rb +++ b/tests/spec/features/url_parameters_spec.rb @@ -8,6 +8,13 @@ expect(editor).to have_line 'This source code came from a Gist' end + scenario "loading from a Gist preserves the links" do + visit '/?gist=20fb1e0475f890d0fdb7864e3ad0820c' + + within('.output') { click_on 'Gist' } + expect(page).to have_link("Permalink to the playground") + end + def editor Editor.new(page) end
Test that loading a gist keeps the gist links around
diff --git a/tests/spec/features/editions_spec.rb b/tests/spec/features/editions_spec.rb index abc1234..def5678 100644 --- a/tests/spec/features/editions_spec.rb +++ b/tests/spec/features/editions_spec.rb @@ -15,7 +15,8 @@ click_on("Run") within('.output-stderr') do - expect(page).to have_content '`crate` in paths is experimental' + expect(page).to have_content 'unused variable: `async`' + expect(page).to_not have_content 'expected pattern, found reserved keyword `async`' end end @@ -24,7 +25,8 @@ click_on("Run") within('.output-stderr') do - expect(page).to_not have_content '`crate` in paths is experimental' + expect(page).to have_content 'expected pattern, found reserved keyword `async`' + expect(page).to_not have_content 'unused variable: `async`' end end @@ -34,12 +36,8 @@ def rust_2018_code <<~EOF - mod foo { - pub fn bar() {} - } - fn main() { - crate::foo::bar(); + let async = 42; } EOF end
Update edition test for stabilization changes
diff --git a/app/commands/v2/previously_published_item.rb b/app/commands/v2/previously_published_item.rb index abc1234..def5678 100644 --- a/app/commands/v2/previously_published_item.rb +++ b/app/commands/v2/previously_published_item.rb @@ -49,8 +49,6 @@ previous_base_path != base_path end - private - class NoPreviousPublishedItem def lock_version_number 1
Remove useless private access modifier
diff --git a/lib/yard/server/commands/frames_command.rb b/lib/yard/server/commands/frames_command.rb index abc1234..def5678 100644 --- a/lib/yard/server/commands/frames_command.rb +++ b/lib/yard/server/commands/frames_command.rb @@ -5,7 +5,7 @@ include DocServerHelper def run - main_url = "#{base_path.gsub(/frames$/, '')}#{object_path}" + main_url = request.path.gsub(/^(.+)?\/frames\/(#{path})$/, '\1/\2') if path && !path.empty? page_title = "Object: #{object_path}" elsif options[:files] && options[:files].size > 0
Update frames command to support /frames/Path/To/Object URL mapping.
diff --git a/activemodel/lib/active_model/type/registry.rb b/activemodel/lib/active_model/type/registry.rb index abc1234..def5678 100644 --- a/activemodel/lib/active_model/type/registry.rb +++ b/activemodel/lib/active_model/type/registry.rb @@ -9,7 +9,7 @@ end def register(type_name, klass = nil, **options, &block) - block ||= proc { |_, *args, **kwargs| klass.new(*args, **kwargs) } + block ||= proc { |_, *args| klass.new(*args) } registrations << registration_klass.new(type_name, block, **options) end
Revert register proc takes keyword arguments Because Ruby 2.6 cannot ignore empty kwargs. https://buildkite.com/rails/rails/builds/63958#9932c536-b1df-4d2c-bda0-c59ed0e254c1/987-995
diff --git a/lib/geocoder/lookups/nominatim.rb b/lib/geocoder/lookups/nominatim.rb index abc1234..def5678 100644 --- a/lib/geocoder/lookups/nominatim.rb +++ b/lib/geocoder/lookups/nominatim.rb @@ -9,13 +9,17 @@ end def map_link_url(coordinates) - "http://www.openstreetmap.org/?lat=#{coordinates[0]}&lon=#{coordinates[1]}&zoom=15&layers=M" + "https://www.openstreetmap.org/?lat=#{coordinates[0]}&lon=#{coordinates[1]}&zoom=15&layers=M" end def query_url(query) method = query.reverse_geocode? ? "reverse" : "search" host = configuration[:host] || "nominatim.openstreetmap.org" "#{protocol}://#{host}/#{method}?" + url_query_string(query) + end + + def supported_protocols + [:https] end private # ---------------------------------------------------------------
Use HTTPS for all Nominatim requests. HTTP support will be discontinued according to this: https://lists.openstreetmap.org/pipermail/geocoding/2018-January/001918.html Fixes #1267
diff --git a/cookbooks/delivery_rust/recipes/default.rb b/cookbooks/delivery_rust/recipes/default.rb index abc1234..def5678 100644 --- a/cookbooks/delivery_rust/recipes/default.rb +++ b/cookbooks/delivery_rust/recipes/default.rb @@ -5,26 +5,12 @@ # Copyright (C) Chef Software, Inc. 2014 # -# Ensure the Omnibus cookbook and this build cookbook have their Ruby -# versions in sync. -node.set['omnibus']['ruby_version'] = node['delivery_rust']['ruby_version'] +######################################################################### +# Prepare builder with minimum Engineering Services standards like +# package signing. +######################################################################### -# The Omnibus build user should be `dbuild` -node.set['omnibus']['build_user'] = 'dbuild' -node.set['omnibus']['build_user_group'] = 'root' -node.set['omnibus']['build_user_home'] = delivery_workspace - -include_recipe 'chef-sugar::default' -include_recipe 'omnibus::default' -include_recipe "delivery_rust::_prep_builder" - -ruby_install node['delivery_rust']['ruby_version'] - -rust_install node['delivery_rust']['rust_version'] do - channel 'nightly' -end - -include_recipe "delivery_rust::_openssl" +include_recipe 'opscode-ci::delivery_builder' # Ensure `dbuild` can create new directories in `/opt`..namely the # `/opt/delivery-cli` directory. This is important because the @@ -33,3 +19,16 @@ directory '/opt' do owner 'dbuild' end + +include_recipe "delivery_rust::_prep_builder" + +######################################################################### +# Install Ruby and Rust for verify stage testing +######################################################################### +ruby_install node['delivery_rust']['ruby_version'] + +rust_install node['delivery_rust']['rust_version'] do + channel 'nightly' +end + +include_recipe "delivery_rust::_openssl"
Enable base Engineering Services standards Ensure we properly configure builders with things like package signing via the `opscode-ci::delivery_builder` recipe. This recipe configures a Delivery builder in almost the same way as a Jenkins build slave.
diff --git a/sensu-plugins-zfs.gemspec b/sensu-plugins-zfs.gemspec index abc1234..def5678 100644 --- a/sensu-plugins-zfs.gemspec +++ b/sensu-plugins-zfs.gemspec @@ -11,7 +11,7 @@ spec.summary = %q{Sensu plugin for zfs} spec.description = %q{Sensu plugin for zfs} - spec.homepage = "https://github.com/blacksails/sensu-plugins-zfs" + spec.homepage = "https://github.com/sensu-plugins/sensu-plugins-zfs" spec.license = "MIT" spec.files = Dir.glob('{bin,lib}/**/*') + %w(LICENSE README.md)
Correct spec.homepage to sensu-plugins org
diff --git a/reel.gemspec b/reel.gemspec index abc1234..def5678 100644 --- a/reel.gemspec +++ b/reel.gemspec @@ -22,5 +22,5 @@ gem.add_runtime_dependency 'websocket_parser', '>= 0.1.6' gem.add_development_dependency 'rake' - gem.add_development_dependency 'rspec' + gem.add_development_dependency 'rspec', '>= 2.11.0' end
Set rspec gem version which supports expect() syntax.
diff --git a/lib/tracker_api/resources/base.rb b/lib/tracker_api/resources/base.rb index abc1234..def5678 100644 --- a/lib/tracker_api/resources/base.rb +++ b/lib/tracker_api/resources/base.rb @@ -20,7 +20,7 @@ super # always reset dirty tracking on initialize - reset_changes + clear_changes_information end private @@ -68,4 +68,4 @@ end end end -end+end
Fix DEPRECATION WARNING for Rails5 > DECATION WARNING: `#reset_changes` is deprecated and will be removed on Rails 5. Please use `#clear_changes_information` instead.
diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index abc1234..def5678 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -7,7 +7,7 @@ @trip = trip mail( to: @trip.email, - subject: prefix_subject('Validation de votre annonce')) + subject: prefix_subject('Validation de votre annonce') ) end @@ -15,7 +15,7 @@ @trip = trip mail( to: @trip.email, - subject: prefix_subject('Gestion de votre annonce')) + subject: prefix_subject('Gestion de votre annonce') ) end @@ -25,7 +25,7 @@ mail( to: @trip.email, reply_to: @message.sender_email, - subject: prefix_subject('Vous avez reçu un message')) + subject: prefix_subject('Vous avez reçu un message') ) end @@ -35,7 +35,7 @@ mail( to: @message.sender_email, reply_to: @trip.email, - subject: prefix_subject('Vous avez envoyé un message')) + subject: prefix_subject('Vous avez envoyé un message') ) end
Fix typo during merging in UserMailer
diff --git a/db/migrate/20151029211234_create_groups.rb b/db/migrate/20151029211234_create_groups.rb index abc1234..def5678 100644 --- a/db/migrate/20151029211234_create_groups.rb +++ b/db/migrate/20151029211234_create_groups.rb @@ -3,7 +3,7 @@ create_table :groups do |t| t.string :primary_number, null: false t.string :street_name, null: false - t.string :street_suffix, null: false + t.string :street_suffix, t.string :city_name, null: false t.string :state_abbreviation, null: false t.string :zipcode, null: false
Remove null: false constraint on the groups table. SmartyStreets API will not always return this.
diff --git a/cookbooks/zookeeper/attributes/default.rb b/cookbooks/zookeeper/attributes/default.rb index abc1234..def5678 100644 --- a/cookbooks/zookeeper/attributes/default.rb +++ b/cookbooks/zookeeper/attributes/default.rb @@ -3,8 +3,6 @@ # Attributes:: default # # Copyright 2012, Webtrends Inc. -# -# All rights reserved - Do Not Redistribute # default[:zookeeper][:version] = "3.3.6"
Remove the do not redistribute clause in the zookeeper cookbook. There's nothing webtrends specific in this Former-commit-id: 4fad8f2232bb1447d361ea6a91a140d576bf84b8 [formerly 45f1a9aace9396eb81063db20753ac21fe3ddf21] [formerly 070a921e8f2dc5d4a26f810bbd10a8617981b1e8 [formerly 4b940ad47d6c4ea211a23095776650f9122993c7]] Former-commit-id: dddbe3b9b84b7128c09796f8936c8b05a6e051ed [formerly 5e9904fbbee0dcb37d7c94c48c3bd70bf9941451] Former-commit-id: ee6fd0a9866fc3c53d06456e37eb6dcbf4a208f8
diff --git a/libraries/rolling_restart.rb b/libraries/rolling_restart.rb index abc1234..def5678 100644 --- a/libraries/rolling_restart.rb +++ b/libraries/rolling_restart.rb @@ -0,0 +1,19 @@+module RollingRestart + module Helpers + def app_instances + node[:opsworks][:layers].map { |layer_name, layer_attrs| + layer_attrs[:instances] if layer_name.to_s.include?("app") + }.compact.flatten(1).reduce(&:merge) # Flatten down the list of instances to a hash of { hostname: instance_data } + end + + def instances + node[:opsworks][:layers].map { |layer_name, layer_attrs| layer_attrs[:instances] }.compact.flatten(1).reduce(&:merge) + end + + def load_balancer + instances.detect{|hostname, data| + data[:elastic_ip] && !data[:elastic_ip].empty? + }.last + end + end +end
Add library helper to use in recipes
diff --git a/test/integration/default/rspec/ie_spec.rb b/test/integration/default/rspec/ie_spec.rb index abc1234..def5678 100644 --- a/test/integration/default/rspec/ie_spec.rb +++ b/test/integration/default/rspec/ie_spec.rb @@ -9,11 +9,12 @@ @selenium.quit end - it 'Checks if Flash installed' do + it 'Checks if Flash installed/enabled' do @selenium.get('https://helpx.adobe.com/flash-player.html') element = @selenium.find_element(:id, 'displaybutton') element.click element = @selenium.find_element(:id, 'flashversioninfo') expect(element.text).to_not eq('Not installed') + expect(element.text).to_not eq('Flash Player disabled') end end
Check if Flash is enabled for IE
diff --git a/test/prx_auth/rails/configuration_test.rb b/test/prx_auth/rails/configuration_test.rb index abc1234..def5678 100644 --- a/test/prx_auth/rails/configuration_test.rb +++ b/test/prx_auth/rails/configuration_test.rb @@ -2,7 +2,6 @@ describe PrxAuth::Rails::Configuration do - after(:each) { PrxAuth::Rails.configuration = PrxAuth::Rails::Configuration.new } subject { PrxAuth::Rails::Configuration.new } it 'initializes with a namespace defined by rails app name' do @@ -10,21 +9,17 @@ end it 'can be reconfigured using the namespace attr' do - PrxAuth::Rails.configure do |config| - config.namespace = :new_test - end + subject.namespace = :new_test - assert PrxAuth::Rails.configuration.namespace == :new_test + assert subject.namespace == :new_test end it 'defaults to enabling the middleware' do - assert PrxAuth::Rails.configuration.install_middleware + assert subject.install_middleware end it 'allows overriding of the middleware automatic installation' do - PrxAuth::Rails.configure do |config| - config.install_middleware = false - end - assert !PrxAuth::Rails.configuration.install_middleware + subject.install_middleware = false + assert subject.install_middleware == false end end
Move from manipulating globals to locals
diff --git a/lib/bean_sprout/account.rb b/lib/bean_sprout/account.rb index abc1234..def5678 100644 --- a/lib/bean_sprout/account.rb +++ b/lib/bean_sprout/account.rb @@ -6,15 +6,18 @@ include StructFromHashMixin include StructArchiveMixin + class BalanceHolder < Struct.new(:value) + end + def initialize *fields super *fields @entries = [] - @balances = [0] + @balance = BalanceHolder.new(0) end def append_entry entry @entries.push entry - @balances.push balance + entry.accurate_amount + @balance.value += entry.accurate_amount end def entries @@ -22,7 +25,7 @@ end def balance - @balances.last + @balance.value end end end
Use balance holder instead of holding all balances.
diff --git a/lib/cable_ready/channel.rb b/lib/cable_ready/channel.rb index abc1234..def5678 100644 --- a/lib/cable_ready/channel.rb +++ b/lib/cable_ready/channel.rb @@ -16,14 +16,14 @@ def broadcast(clear) operations.select! { |_, list| list.present? } operations.deep_transform_keys! { |key| key.to_s.camelize(:lower) } - ActionCable.server.broadcast identifier, "cableReady" => true, "operations" => operations + ActionCable.server.broadcast identifier, {"cableReady" => true, "operations" => operations} reset if clear end def broadcast_to(model, clear) operations.select! { |_, list| list.present? } operations.deep_transform_keys! { |key| key.to_s.camelize(:lower) } - identifier.broadcast_to model, "cableReady" => true, "operations" => operations + identifier.broadcast_to model, {"cableReady" => true, "operations" => operations} reset if clear end
Add braces to hash parameter to remove warning
diff --git a/lib/lemonade_stand/game.rb b/lib/lemonade_stand/game.rb index abc1234..def5678 100644 --- a/lib/lemonade_stand/game.rb +++ b/lib/lemonade_stand/game.rb @@ -27,13 +27,11 @@ end def store_sales_results_for results, player, day - @sales_results ||= [] - @sales_results << { player: player, day: day, results: results } + sales_results << { player: player, day: day, results: results } end def sales_results_for player, day - @sales_results ||= [] - @sales_results.select do |record| + sales_results.select do |record| record[:player].object_id == player.object_id && record[:day].object_id == day.object_id end.first[:results] end @@ -47,6 +45,12 @@ end end + private + + def sales_results + @sales_results ||= [] + end + end end
Initialize the variable in one place.
diff --git a/test/helper.rb b/test/helper.rb index abc1234..def5678 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -5,6 +5,7 @@ require 'tmpdir' class Dbt::TestCase < Minitest::Test + def setup Dbt::Config.default_search_dirs = nil Dbt::Config.default_no_create = nil @@ -26,8 +27,16 @@ Dbt::Config.default_migrations_dir_name = nil Dbt::Config.default_database = nil Dbt::Config.task_prefix = nil + + @cwd = Dir.pwd + @base_temp_dir = ENV["TEST_TMP_DIR"] || File.expand_path("#{File.dirname(__FILE__)}/../tmp") + @temp_dir = "#{@base_temp_dir}/#{name}" + FileUtils.mkdir_p @temp_dir + Dir.chdir(@temp_dir) end def teardown + Dir.chdir(@cwd) + FileUtils.rm_rf @base_temp_dir if File.exist?(@base_temp_dir) end end
Create temp directory for tests
diff --git a/spec/acceptance/solutions_spec.rb b/spec/acceptance/solutions_spec.rb index abc1234..def5678 100644 --- a/spec/acceptance/solutions_spec.rb +++ b/spec/acceptance/solutions_spec.rb @@ -1,6 +1,18 @@ require 'spec_helper' describe "Solutions" do + + it "chooses the correct artifact for the demands" do + graph = Solve::Graph.new + graph.artifacts("mysql", "2.0.0") + graph.artifacts("mysql", "1.2.0") + graph.artifacts("nginx", "1.0.0").depends("mysql", "= 1.2.0") + + result = Solve.it!(graph, [['nginx', '= 1.0.0'], ['mysql']]) + + result.should eql("nginx" => "1.0.0", "mysql" => "1.2.0") + end + it "chooses the best artifact for the demands" do graph = Solve::Graph.new graph.artifacts("mysql", "2.0.0")
Add back the test for finding the correct version given multiple choices
diff --git a/spec/shared/searchable_essence.rb b/spec/shared/searchable_essence.rb index abc1234..def5678 100644 --- a/spec/shared/searchable_essence.rb +++ b/spec/shared/searchable_essence.rb @@ -2,7 +2,7 @@ shared_examples_for 'an searchable essence' do let(:essence_type) { essence_class.model_name.name.demodulize } - let(:content) { Alchemy::Content.new } + let(:content) { create(:alchemy_content) } before do allow(content).to receive(:essence_class).and_return(essence_class)
Fix content spec for recent Alchemy change Beginning with Alchemy 3.5 contents require it's essence via belongs_to element, :require: true Fixed by using the Alchemy content factory
diff --git a/teamspeak-ruby.gemspec b/teamspeak-ruby.gemspec index abc1234..def5678 100644 --- a/teamspeak-ruby.gemspec +++ b/teamspeak-ruby.gemspec @@ -11,4 +11,5 @@ s.require_paths = ['lib'] s.homepage = 'http://pyrohail.com' s.license = 'MIT' + s.add_development_dependency 'minitest', '~> 5.8' end
Fix tests on Ruby 2.3
diff --git a/lib/rack/policy/helpers.rb b/lib/rack/policy/helpers.rb index abc1234..def5678 100644 --- a/lib/rack/policy/helpers.rb +++ b/lib/rack/policy/helpers.rb @@ -0,0 +1,15 @@+# -*- encoding: utf-8 -*- + +module Rack + module Policy + module Helpers + + def cookies_accepted? + accepted = !request.env['rack-policy.consent'].nil? + yield if block_given? && accepted + accepted + end + + end # Helpers + end # Policy +end # Rack
Add view helper for toggling cookie notifications.
diff --git a/examples/log.rb b/examples/log.rb index abc1234..def5678 100644 --- a/examples/log.rb +++ b/examples/log.rb @@ -0,0 +1,29 @@+require 'varnish' + +class Log + def initialize + @vd = Varnish::VSM.VSM_New + Varnish::VSL.VSL_Setup(@vd) + Varnish::VSL.VSL_Open(@vd, 1) + + @count = 0 + @t = nil + end + + def run + Varnish::VSL.VSL_Dispatch(@vd, self.method(:callback).to_proc, FFI::MemoryPointer.new(:pointer)) + end + +private + def callback(*args) + @t = Time.now if @count == 0 + @count += 1 + + if (@count % 100000) == 0 + puts "received #{@count} messages in #{(Time.now - @t).to_s} seconds" + @t = Time.now + end + end +end + +Log.new.run
Add an example for the low-level API.
diff --git a/lib/spree/retail/engine.rb b/lib/spree/retail/engine.rb index abc1234..def5678 100644 --- a/lib/spree/retail/engine.rb +++ b/lib/spree/retail/engine.rb @@ -6,6 +6,10 @@ class Engine < Rails::Engine isolate_namespace Spree engine_name 'solidus_retail' + + initializer "spree.gateway.payment_methods", after: "spree.register.payment_methods" do |app| + app.config.spree.payment_methods << Spree::Gateway::ShopifyGateway + end # use rspec for tests config.generators do |g|
Add the ShopifyGateway as a Payment Method That way we can use it in Solidus
diff --git a/rspec-contracts.gemspec b/rspec-contracts.gemspec index abc1234..def5678 100644 --- a/rspec-contracts.gemspec +++ b/rspec-contracts.gemspec @@ -13,6 +13,6 @@ s.files = Dir.glob("lib/**/*") + ["README.md", "History.md", "License.txt"] s.require_path = "lib" s.add_dependency "rspec", "3.0.0.beta2" - s.add_development_dependency "guard-rspec" - s.add_development_dependency "rake" + s.add_development_dependency "guard-rspec", "~> 0" + s.add_development_dependency "rake", "~> 0" end
Remove open-ended dependencies from gemspec
diff --git a/tasks/check-for-new-rootfs-cves/run.rb b/tasks/check-for-new-rootfs-cves/run.rb index abc1234..def5678 100644 --- a/tasks/check-for-new-rootfs-cves/run.rb +++ b/tasks/check-for-new-rootfs-cves/run.rb @@ -11,16 +11,14 @@ cves_dir = File.expand_path(File.join(buildpacks_ci_dir, '..', 'output-new-cves', 'new-cve-notifications')) require "#{buildpacks_ci_dir}/lib/rootfs-cve-notifier" -require "#{buildpacks_ci_dir}/lib/notifiers/cve-slack-notifier" -notifiers = [CVESlackNotifier] cve_notifier = RootFSCVENotifier.new(cves_dir, stacks_dir) case stack when 'cflinuxfs2' cve_notifier.run!(stack, 'Ubuntu 14.04', 'ubuntu14.04', []) when 'cflinuxfs3' - cve_notifier.run!(stack, 'Ubuntu 18.04', 'ubuntu18.04', notifiers) + cve_notifier.run!(stack, 'Ubuntu 18.04', 'ubuntu18.04', []) when 'tiny' cve_notifier.run!(stack, 'Ubuntu 18.04', 'ubuntu18.04-tiny', []) else
Remove cflinuxfs3 CVE slack notifications
diff --git a/spec/views/layout_spec.rb b/spec/views/layout_spec.rb index abc1234..def5678 100644 --- a/spec/views/layout_spec.rb +++ b/spec/views/layout_spec.rb @@ -0,0 +1,68 @@+require 'spec_helper' + +describe Cyclid::UI::Views::Layout do + let :user do + u = double('current_user') + allow(u).to receive(:username).and_return('test') + allow(u).to receive(:email).and_return('test@example.com') + allow(u).to receive(:organizations).and_return(['a','b']) + return u + end + + subject do + l = Cyclid::UI::Views::Layout.new + l.instance_variable_set(:@current_user, user) + return l + end + + describe '#username' do + context 'when the username is set' do + it 'returns the username' do + expect(subject.username).to eq 'test' + end + end + + context 'when the username is not set' do + it 'returns a placeholder' do + # Over-ride the normal username + allow(user).to receive(:username).and_return(nil) + + expect(subject.username).to eq 'Nobody' + end + end + end + + describe '#organizations' do + it 'returns the users organizations' do + expect(subject.organizations).to eq ['a','b'] + end + end + + describe '#title' do + context 'with a title set' do + it 'returns the title' do + subject.instance_variable_set(:@title, 'test') + expect(subject.title).to eq('test') + end + end + + context 'without a title set' do + it 'returns the default title' do + expect(subject.title).to eq('Cyclid') + end + end + end + + describe '#breadcrumbs' do + it 'returns the breadcrumbs as JSON' do + subject.instance_variable_set(:@crumbs, {foo: 'bar'}) + expect(subject.breadcrumbs).to eq('{"foo":"bar"}') + end + end + + describe 'gravatar_url' do + it 'returns a valid Gravatar URL' do + expect(subject.gravatar_url).to eq('https://www.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?d=identicon&r=g') + end + end +end
Add tests for the Layout View
diff --git a/tzinfo.gemspec b/tzinfo.gemspec index abc1234..def5678 100644 --- a/tzinfo.gemspec +++ b/tzinfo.gemspec @@ -3,8 +3,8 @@ Gem::Specification.new do |s| s.name = 'tzinfo' s.version = TZInfo::VERSION - s.summary = 'Daylight savings aware timezone library' - s.description = 'TZInfo provides daylight savings aware transformations between times in different time zones.' + s.summary = 'Time Zone Library' + s.description = 'TZInfo provides access to time zone data and allows times to be converted using time zone rules.' s.author = 'Philip Ross' s.email = 'phil.ross@gmail.com' s.homepage = 'https://tzinfo.github.io'
Update the gem summary and description.
diff --git a/lib/yarrow.rb b/lib/yarrow.rb index abc1234..def5678 100644 --- a/lib/yarrow.rb +++ b/lib/yarrow.rb @@ -1,20 +1,22 @@-require "hashie" -require "yaml" +require 'hashie' +require 'yaml' -require_relative "yarrow/version" -require_relative "yarrow/logging" -require_relative "yarrow/configuration" -require_relative "yarrow/console_runner" -require_relative "yarrow/generator" -require_relative "yarrow/model/index" -require_relative "yarrow/model/base" -require_relative "yarrow/output/mapper" -require_relative "yarrow/output/generator" -require_relative "yarrow/content_map" -require_relative "yarrow/assets" -require_relative "yarrow/html" -require_relative "yarrow/tools/front_matter" +require 'yarrow/version' +require 'yarrow/logging' +require 'yarrow/configuration' +require 'yarrow/console_runner' +require 'yarrow/generator' +require 'yarrow/model/index' +require 'yarrow/model/base' +require 'yarrow/html/asset_tags' +require 'yarrow/output/mapper' +require 'yarrow/output/generator' +require 'yarrow/output/context' +require 'yarrow/content_map' +require 'yarrow/assets' +require 'yarrow/html' +require 'yarrow/tools/front_matter' -# Dir[File.dirname(__FILE__) + "/yarrow/generators/*.rb"].each do |generator| +# Dir[File.dirname(__FILE__) + '/yarrow/generators/*.rb'].each do |generator| # require generator # end
Remove require_relative as it's no longer needed
diff --git a/solutions/uri/1009/1009.rb b/solutions/uri/1009/1009.rb index abc1234..def5678 100644 --- a/solutions/uri/1009/1009.rb +++ b/solutions/uri/1009/1009.rb @@ -0,0 +1,5 @@+name = gets +salary = gets.to_f +value_sold = gets.to_f + +puts "TOTAL = R$ #{'%.2f' % (salary + value_sold * 0.15)}"
Solve Salary with Bonus in ruby
diff --git a/test/unit/test_channel.rb b/test/unit/test_channel.rb index abc1234..def5678 100644 --- a/test/unit/test_channel.rb +++ b/test/unit/test_channel.rb @@ -29,4 +29,22 @@ # TODO :categories: ['Technology', 'Gadgets'] assert_equal(@options[:explicit], @channel.explicit) end + + def test_raise_on_missing_title + assert_raises Dropcaster::MissingAttributeError do + Dropcaster::Channel.new(FIXTURES_DIR, {:url => 'bar', :description => 'foobar'}) + end + end + + def test_raise_on_missing_url + assert_raises Dropcaster::MissingAttributeError do + Dropcaster::Channel.new(FIXTURES_DIR, {:title => 'foo', :description => 'foobar'}) + end + end + + def test_raise_on_missing_description + assert_raises Dropcaster::MissingAttributeError do + Dropcaster::Channel.new(FIXTURES_DIR, {:title => 'foo', :url => 'bar'}) + end + end end
Add test for missing channel attributes
diff --git a/app/services/coronavirus/pages/timeline_entry_builder.rb b/app/services/coronavirus/pages/timeline_entry_builder.rb index abc1234..def5678 100644 --- a/app/services/coronavirus/pages/timeline_entry_builder.rb +++ b/app/services/coronavirus/pages/timeline_entry_builder.rb @@ -1,27 +1,29 @@-class Coronavirus::Pages::TimelineEntryBuilder - def create_timeline_entries - return if timeline_entries_from_yaml.empty? +module Coronavirus::Pages + class TimelineEntryBuilder + def create_timeline_entries + return if timeline_entries_from_yaml.empty? - Coronavirus::TimelineEntry.transaction do - coronavirus_page.timeline_entries.delete_all + Coronavirus::TimelineEntry.transaction do + coronavirus_page.timeline_entries.delete_all - timeline_entries_from_yaml.reverse.each do |entry| - coronavirus_page.timeline_entries.create!( - heading: entry["heading"], - content: entry["paragraph"], - ) + timeline_entries_from_yaml.reverse.each do |entry| + coronavirus_page.timeline_entries.create!( + heading: entry["heading"], + content: entry["paragraph"], + ) + end end end - end -private + private - def timeline_entries_from_yaml - @github_data ||= YamlFetcher.new(coronavirus_page.raw_content_url).body_as_hash - @github_data.dig("content", "timeline", "list") - end + def timeline_entries_from_yaml + @github_data ||= YamlFetcher.new(coronavirus_page.raw_content_url).body_as_hash + @github_data.dig("content", "timeline", "list") + end - def coronavirus_page - @coronavirus_page ||= Coronavirus::CoronavirusPage.find_by(slug: "landing") + def coronavirus_page + @coronavirus_page ||= Coronavirus::CoronavirusPage.find_by(slug: "landing") + end end end
Embed TimelineEntryBuilder within a module This class (which arrived from a rebase) is the only Coronavirus::Page service that is not defined within a module, so I've updated it for consistency.
diff --git a/source/sitemap.xml.builder b/source/sitemap.xml.builder index abc1234..def5678 100644 --- a/source/sitemap.xml.builder +++ b/source/sitemap.xml.builder @@ -10,4 +10,13 @@ end end end + # Temporary hack to get article sitemap working + blog.articles.each do |resource| + xml.url do + xml.loc URI.join(site_url, resource.url) + xml.lastmod File.mtime(resource.source_file).strftime('%Y-%m-%d') + xml.priority resource.data.sitemap_priority || (1.0 - resource.url.count('/') * 0.1).round(1).to_s + xml.changefreq resource.data.changefreq || 'weekly' + end + end end
Fix sitemap builder for articles
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 @@ -14,6 +14,7 @@ # Requires supporting files with custom matchers and macros, etc, # in ./support/ and its subdirectories. Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f} +Dir["#{File.join(Gem.loaded_specs['kaminari'].gem_dir, 'spec')}/support/**/*.rb"].each {|f| require f} RSpec.configure do |config| config.mock_with :rr
Load Kaminari gem's spec/support files
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,7 @@-#-- -# Copyright (c) 2015 Marius L. Jøhndal -# -# See LICENSE in the top-level source directory for licensing terms. -#++ -$LOAD_PATH.unshift File.expand_path('../lib', __dir__) - require 'simplecov' SimpleCov.start +$LOAD_PATH.unshift File.expand_path('../lib', __dir__) require 'proiel' def open_test_file(filename)
Change include order for simplecov
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -28,6 +28,9 @@ require f end +require 'rom/support/deprecations' +ROM::Deprecations.set_logger!(root.join('../log/deprecations.log')) + # Namespace holding all objects created during specs module Test def self.remove_constants
Configure rom deprecations logging for 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 @@ -14,4 +14,8 @@ USERNAME ||= ENV['ecm_username'] PASSWORD ||= ENV['evm_password'] -raise 'REQUIRED ENV variables: [ecm_username and ecm_password] in order to run the specs.' unless USERNAME and PASSWORD+raise 'REQUIRED ENV variables: [ecm_username and ecm_password] in order to run the specs.' unless USERNAME and PASSWORD + +def authenticate_with_valid_credentials + Cradlepointr.authenticate(USERNAME, PASSWORD) +end
Raise rspec error without ecm credentials.
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 @@ -13,6 +13,7 @@ RSpec.configure do |c| if c.filter_manager.inclusions.keys.include?(:live) + puts "Running **live** tests against Stripe..." StripeMock.set_test_strategy(:live) c.filter_run_excluding :mock_server => true
Add message when running live tests
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -if ENV['COVERAGE'] || ENV['TRAVIS'] - require 'simplecov' - require 'coveralls' +if ENV["COVERAGE"] || ENV["TRAVIS"] + require "simplecov" + require "coveralls" SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([ SimpleCov::Formatter::HTMLFormatter, @@ -10,13 +10,13 @@ ]) SimpleCov.start do - command_name 'spec' - add_filter 'spec' + command_name "spec" + add_filter "spec" end end -require 'tty-prompt' -require 'stringio' +require "tty-prompt" +require "stringio" class StringIO def wait_readable(*) @@ -24,17 +24,7 @@ end end -module Helpers - def diff_output(actual_output, expected_output) - puts "ACTUAL: #{actual_output.inspect}" - puts "--------------------------------\n" - puts "EXPECT: #{expected_output.inspect}" - end -end - RSpec.configure do |config| - config.include(Helpers) - config.expect_with :rspec do |expectations| expectations.include_chain_clauses_in_custom_matcher_descriptions = true expectations.max_formatted_output_length = nil @@ -52,7 +42,7 @@ config.warnings = true if config.files_to_run.one? - config.default_formatter = 'doc' + config.default_formatter = "doc" end config.profile_examples = 2
Change to remove strings comparison helper
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,5 +1,8 @@ require 'serverspec' require 'net/ssh' +require 'yaml' + +properties = YAML.load_file('properties.yml') set :backend, :ssh @@ -15,6 +18,7 @@ end host = ENV['TARGET_HOST'] +set_property properties[host] options = Net::SSH::Config.for(host)
Fix tests that use properties
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -4,7 +4,7 @@ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ SimpleCov::Formatter::HTMLFormatter ] -SimpleCov.start 'rails' +SimpleCov.start require 'agnostic_backend' require 'agnostic_backend/rspec/matchers'
Change simplecov Rails setting to default
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,14 +16,7 @@ end end -def fixture_path - File.expand_path("../fixtures", __FILE__) +def csstats_file + fixtures = File.expand_path("../fixtures", __FILE__) + File.new(fixtures + '/csstats.dat').path end - -def fixture(file) - File.new(fixture_path + '/' + file) -end - -def csstats_file - fixture('csstats.dat').path -end
Remove unused functions in spec helper.
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,3 +1,5 @@+# encoding: utf-8 + if ENV['COVERAGE'] == 'true' require 'simplecov' require 'coveralls'
Fix remaining errors from rubocop
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -4,7 +4,7 @@ $LOAD_PATH.include?(__LIB_DIR__) || $LOAD_PATH.include?(File.expand_path(__LIB_DIR__)) -require "bbcloud" +require "brightbox_cli" require "mocha" require "vcr" require "support/common_helpers"
Update spec helper for new path
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,5 +1,5 @@ require 'pry' -require 'inkling' +require 'inkling-rb' Dir["./spec/support/**/*.rb"].each {|f| require f }
Change require in spec helper
diff --git a/spec/pester/pester_spec.rb b/spec/pester/pester_spec.rb index abc1234..def5678 100644 --- a/spec/pester/pester_spec.rb +++ b/spec/pester/pester_spec.rb @@ -2,7 +2,7 @@ require "minitest/autorun" require "mocha/setup" -require_relative '..\..\lib\kitchen\verifier\pester' +require_relative "../../lib/kitchen/verifier/pester" class MockPester < Kitchen::Verifier::Pester def sandbox_path @@ -21,6 +21,6 @@ end it "should ignore case" do - sandboxifiedPath.must_equal "C:/users/jdoe/temp/kitchen-temp/test" + _(sandboxifiedPath).must_equal "C:/users/jdoe/temp/kitchen-temp/test" end end
:white_check_mark: Fix spec file errors on Unix - Use forward slashes for cross-platform paths - Use recommended _(obj).must_equal per minitest deprecation warning
diff --git a/spec/symbol_filter_spec.rb b/spec/symbol_filter_spec.rb index abc1234..def5678 100644 --- a/spec/symbol_filter_spec.rb +++ b/spec/symbol_filter_spec.rb @@ -1,47 +1,41 @@ require 'spec_helper' -describe Mutations::SymbolFilter do - let(:options){ {} } - let(:outcome){ Mutations::SymbolFilter.new(options).filter(input) } - let(:result){ outcome[0] } - let(:errors){ outcome[1] } +describe "Mutations::SymbolFilter" do - describe 'string input' do - let(:input){ 'foo' } - - it{ assert_equal(result, :foo) } - it{ assert_nil(errors) } + it "allows strings" do + sf = Mutations::SymbolFilter.new + filtered, errors = sf.filter("hello") + assert_equal :hello, filtered + assert_equal nil, errors end - describe 'symbol input' do - let(:input){ :foo } - - it{ assert_equal(result, :foo) } - it{ assert_nil(errors) } + it "allows symbols" do + sf = Mutations::SymbolFilter.new + filtered, errors = sf.filter(:hello) + assert_equal :hello, filtered + assert_equal nil, errors end - describe 'input not a symbol' do - let(:input){ 1 } - - it{ assert_nil(result) } - it{ assert_equal(errors, :symbol) } + it "doesn't allow non-symbols" do + sf = Mutations::SymbolFilter.new + [["foo"], {:a => "1"}, Object.new].each do |thing| + _filtered, errors = sf.filter(thing) + assert_equal :symbol, errors + end end - describe 'nil input' do - let(:input){ nil } + it "considers nil to be invalid" do + sf = Mutations::SymbolFilter.new(:nils => false) + filtered, errors = sf.filter(nil) + assert_equal nil, filtered + assert_equal :nils, errors + end - describe 'nils allowed' do - let(:options){ { nils: true } } + it "considers nil to be valid" do + sf = Mutations::SymbolFilter.new(:nils => true) + filtered, errors = sf.filter(nil) + assert_equal nil, filtered + assert_equal nil, errors + end - it{ assert_nil(result) } - it{ assert_nil(errors) } - end - - describe 'nils not allowed' do - let(:options){ { nils: false } } - - it{ assert_nil(result) } - it{ assert_equal(errors, :nils) } - end - end end
Rewrite symbol filter specs in the house style
diff --git a/bin/schedule_backup_job.rb b/bin/schedule_backup_job.rb index abc1234..def5678 100644 --- a/bin/schedule_backup_job.rb +++ b/bin/schedule_backup_job.rb @@ -8,11 +8,16 @@ include QueueStuff include DBStuff +include GHTorrent::Logging job_id = ARGV[0].to_i def settings YAML.load_file(ARGV[1]) +end + +def logger + Logger.new STDOUT end repos = db.from(:request_contents, :repos)\ @@ -35,7 +40,7 @@ backup_job[:hash] = u_details[:hash] puts backup_job.to_json -#amqp_exchange.publish(backup_job.to_json, -# {:timestamp => Time.now.to_i, -# :persistent => true, -# :routing_key => BACKUP_QUEUE_ROUTEKEY}) +amqp_exchange.publish(backup_job.to_json, + {:timestamp => Time.now.to_i, + :persistent => true, + :routing_key => BACKUP_QUEUE_ROUTEKEY})
Send backup job to the queue
diff --git a/travis-release.gemspec b/travis-release.gemspec index abc1234..def5678 100644 --- a/travis-release.gemspec +++ b/travis-release.gemspec @@ -26,6 +26,6 @@ spec.add_development_dependency 'codeclimate-test-reporter', '~> 0' spec.add_development_dependency 'yard', '~> 0' - spec.add_dependency 'rake', '~> 10.0' - spec.add_dependency 'bundler', '~> 1' + spec.add_dependency 'rake' + spec.add_dependency 'bundler' end
Fix issue with old rake versions
diff --git a/github-sync/reporting/db_report_wiki_on.rb b/github-sync/reporting/db_report_wiki_on.rb index abc1234..def5678 100644 --- a/github-sync/reporting/db_report_wiki_on.rb +++ b/github-sync/reporting/db_report_wiki_on.rb @@ -31,7 +31,7 @@ end def db_report(org, sync_db) - wikiOn=sync_db.execute("SELECT r.org || '/' || r.name FROM repository r WHERE has_wiki='1' AND r.org=?", [org]) + wikiOn=sync_db.execute("SELECT r.name FROM repository r WHERE has_wiki='1' AND r.org=?", [org]) text = '' wikiOn.each do |row| text << " <db-reporting type='WikiOnDbReporter'>#{org}/#{row[0]}</db-reporting>\n"
Fix bug in wiki report; had the org in their twice
diff --git a/ruby/lib/bson/registry.rb b/ruby/lib/bson/registry.rb index abc1234..def5678 100644 --- a/ruby/lib/bson/registry.rb +++ b/ruby/lib/bson/registry.rb @@ -42,7 +42,7 @@ # # @since 2.0.0 def register(byte, type) - MAPPINGS[byte] = type + MAPPINGS.store(byte, type) type.define_method(:bson_type) { byte } end end
Use store to match fetch nomenclature
diff --git a/spec/client_spec.rb b/spec/client_spec.rb index abc1234..def5678 100644 --- a/spec/client_spec.rb +++ b/spec/client_spec.rb @@ -2,6 +2,18 @@ describe 'nagios::client' do let(:chef_run) { runner.converge 'nagios::client' } + + it 'includes the client_package recipe' do + expect(chef_run).to include_recipe('nagios::client_package') + end + + it 'installs nagios-nrpe-server package' do + expect(chef_run).to install_package('nagios-nrpe-server') + end + + it 'starts nrpe service' do + expect(chef_run).to start_service('nagios-nrpe-server') + end it 'adds addresses to the allowed hosts when defined' do Chef::Recipe.any_instance.stub(:search)
Add additional chef spec tests for client installs