diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/weka/class_builder.rb b/lib/weka/class_builder.rb index abc1234..def5678 100644 --- a/lib/weka/class_builder.rb +++ b/lib/weka/class_builder.rb @@ -6,60 +6,59 @@ module ClassBuilder extend ActiveSupport::Concern - included do - class << self - def build_class(class_name) - java_import java_class_path(class_name) - include_utils_in(class_name) + module ClassMethods + + def build_class(class_name) + java_import java_class_path(class_name) + include_utils_in(class_name) + end + + def build_classes(*class_names) + class_names.each { |name| build_class(name) } + end + + private + + def java_class_path(class_name) + [*java_super_modules, java_including_module, class_name].join('.') + end + + def java_super_modules + super_modules.downcase.split('::') + end + + def super_modules + self.name.deconstantize + end + + def java_including_module + including_module.downcase + end + + def including_module + self.name.demodulize + end + + def include_utils_in(class_name) + return unless utils_defined? + + module_eval <<-CLASS_DEFINITION, __FILE__, __LINE__ + 1 + class #{class_name} + include #{utils} end + CLASS_DEFINITION + end - def build_classes(*class_names) - class_names.each { |name| build_class(name) } - end + def utils_defined? + utils_super_modules.constantize.const_defined?(:Utils) + end - private + def utils + "::#{utils_super_modules}::Utils" + end - def java_class_path(class_name) - [*java_super_modules, java_including_module, class_name].join('.') - end - - def java_super_modules - super_modules.downcase.split('::') - end - - def super_modules - self.name.deconstantize - end - - def java_including_module - including_module.downcase - end - - def including_module - self.name.demodulize - end - - def include_utils_in(class_name) - return unless utils_defined? - - module_eval <<-CLASS_DEFINITION, __FILE__, __LINE__ + 1 - class #{class_name} - include #{utils} - end - CLASS_DEFINITION - end - - def utils_defined? - utils_super_modules.constantize.const_defined?(:Utils) - end - - def utils - "::#{utils_super_modules}::Utils" - end - - def utils_super_modules - super_modules.split('::')[0...2].join('::') - end + def utils_super_modules + super_modules.split('::')[0...2].join('::') end end
Move ClassBuilder class methods from include to ClassMethods module
diff --git a/web/test/test_repoman_checks.rb b/web/test/test_repoman_checks.rb index abc1234..def5678 100644 --- a/web/test/test_repoman_checks.rb +++ b/web/test/test_repoman_checks.rb @@ -10,6 +10,6 @@ def test_heading get '/repoman_checks' assert last_response.ok? - assert last_response.body.include? '<h1>Build Status (CI)</h1>' + assert last_response.body.include? '<h1>Repoman Checks</h1>' end end
Fix repoman page check, it should never have passed
diff --git a/app/controllers/docker_manager/application_controller.rb b/app/controllers/docker_manager/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/docker_manager/application_controller.rb +++ b/app/controllers/docker_manager/application_controller.rb @@ -5,7 +5,7 @@ include CurrentUser - before_filter :ensure_admin + before_action :ensure_admin protect_from_forgery def handle_unverified_request
Use `before_action` for compatibility with Rails 5.
diff --git a/filter/calculator_bot.rb b/filter/calculator_bot.rb index abc1234..def5678 100644 --- a/filter/calculator_bot.rb +++ b/filter/calculator_bot.rb @@ -1,5 +1,6 @@ module Filter class CalculatorBot + include Math def update(p) t = p['text'] re = /^\:= / @@ -15,7 +16,10 @@ end def validate(exp) - !!(exp =~ /^(\d|\*|\+|\-|\/|\.|\ )+$/) + !!(exp =~ /^(\d|\*|\+|\-|\/|\.|\ |\(|\)|#{math_re})+$/) + end + def math_re + %w(acos acosh asin asinh atan atan2 atanh cbrt cos cosh erf erfc exp frexp gamma hypot ldexp lgamma log log10 log2 rsqrt sin sinh sqrt sqrt tan tanh PI E).join("|") end end end
Add math lib to calculator
diff --git a/spec/acceptance/motd_spec.rb b/spec/acceptance/motd_spec.rb index abc1234..def5678 100644 --- a/spec/acceptance/motd_spec.rb +++ b/spec/acceptance/motd_spec.rb @@ -0,0 +1,16 @@+require 'spec_helper_acceptance' + +describe 'motd and motd::entry should work' do + it 'should configure and work with no errors' do + pp = <<-EOS + include('motd') + motd::header {'welcome': message => "Welcome to box ${::fqdn}"} + motd::news {'It is christmas': date => '2013-12-25'} + # Test case , should no error is a : is in message. + motd::news{'Ternmination:': date => '2014-01-30'} + EOS + # Run it two times, it should be stable by then + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) + end +end
Add acceptance test for motd
diff --git a/spec/classes/rsyslog_spec.rb b/spec/classes/rsyslog_spec.rb index abc1234..def5678 100644 --- a/spec/classes/rsyslog_spec.rb +++ b/spec/classes/rsyslog_spec.rb @@ -15,9 +15,24 @@ require 'spec_helper' describe 'rsyslog', :type => :class do - let(:title) { 'rsyslog' } + context "On an Ubuntu install install rsyslog" do + let :facts do { + :operatingsystem => 'Debian' + } end + let(:title) { 'rsyslog' } - it { should contain_package('rsyslog').with_ensure('installed') } - it { should contain_service('rsyslog').with_ensure('running') } + it { should contain_package('rsyslog').with_ensure('installed') } + it { should contain_service('rsyslog').with_ensure('running') } + end + + context "On an RHEL install install rsyslog" do + let :facts do { + :operatingsystem => 'RedHat' + } end + let(:title) { 'rsyslog' } + + it { should contain_package('rsyslog').with_ensure('installed') } + it { should contain_service('rsyslog').with_ensure('running') } + end end
Fix test cases by introducing facts to rspec
diff --git a/test/controllers/kiitos/admin/administrators_controller_test.rb b/test/controllers/kiitos/admin/administrators_controller_test.rb index abc1234..def5678 100644 --- a/test/controllers/kiitos/admin/administrators_controller_test.rb +++ b/test/controllers/kiitos/admin/administrators_controller_test.rb @@ -19,19 +19,21 @@ end describe 'DELETE :destroy' do + + let(:user) { User.create name: 'User Name', email: 'test@example.com' } + before do - @user = User.create name: 'User Name', email: 'test@example.com' - Kiitos::Administrator.create user_id: @user.id + Kiitos::Administrator.create user_id: user.id end it 'turns an admin to a normal user' do Kiitos::Administrator.all.count.must_equal 1 - delete :destroy, id: @user.id + delete :destroy, id: user.id Kiitos::Administrator.all.count.must_equal 0 end it 'redirects to the users management panel' do - delete :destroy, id: @user.id + delete :destroy, id: user.id response.must_redirect_to admin_users_path end end
Use let instead of instance variable
diff --git a/buildserver/cookbooks/android-ndk/recipes/default.rb b/buildserver/cookbooks/android-ndk/recipes/default.rb index abc1234..def5678 100644 --- a/buildserver/cookbooks/android-ndk/recipes/default.rb +++ b/buildserver/cookbooks/android-ndk/recipes/default.rb @@ -25,9 +25,9 @@ else SUFFIX='' fi - tar jxvf /vagrant/cache/android-ndk-r9-linux-x86$SUFFIX.tar.bz2 - tar jxvf /vagrant/cache/android-ndk-r9-linux-x86$SUFFIX-legacy-toolchains.tar.bz2 - mv android-ndk-r9 #{ndk_loc} + tar jxvf /vagrant/cache/android-ndk-r9b-linux-x86$SUFFIX.tar.bz2 + tar jxvf /vagrant/cache/android-ndk-r9b-linux-x86$SUFFIX-legacy-toolchains.tar.bz2 + mv android-ndk-r9b #{ndk_loc} " not_if do File.exists?("#{ndk_loc}")
Fix incomplete ndk upgrade in d7f558ad
diff --git a/lib/arbetsformedlingen/codes/municipality_code.rb b/lib/arbetsformedlingen/codes/municipality_code.rb index abc1234..def5678 100644 --- a/lib/arbetsformedlingen/codes/municipality_code.rb +++ b/lib/arbetsformedlingen/codes/municipality_code.rb @@ -25,7 +25,7 @@ def self.to_form_array(name_only: false) return CODE_MAP.to_a unless name_only - CODE_MAP.to_a.map { |name| [name, name] } + CODE_MAP.map { |name, _code| [name, name] } end end end
Add Municipality::to_form_array method name_only option
diff --git a/micro-optparse.gemspec b/micro-optparse.gemspec index abc1234..def5678 100644 --- a/micro-optparse.gemspec +++ b/micro-optparse.gemspec @@ -9,8 +9,8 @@ s.authors = ["Florian Pilz"] s.email = ["fpilz87@googlemail.com"] s.homepage = "http://florianpilz.github.com/micro-optparse/" - s.summary = %q{An option parser which is 70 lines short.} - s.description = %q{This option parser is 70 lines short and is based on OptionParser. It has strong validations and a short, clear and easy to use syntax. Feel free to copy all 70 lines (45 lines without validations / empty lines) into your script rather installing the gem.} + s.summary = %q{An lightweight option parser, which is 80 lines short.} + s.description = %q{This is an lightweight option parser, which is less than 80 lines short. It has strong validations and a short, clear and easy to use syntax. Feel free to copy all 80 lines (55 lines without validations / empty lines) into your script rather installing the gem.} s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
Adjust description for rubygems and ruby toolbox
diff --git a/mixlib-config.gemspec b/mixlib-config.gemspec index abc1234..def5678 100644 --- a/mixlib-config.gemspec +++ b/mixlib-config.gemspec @@ -8,18 +8,19 @@ s.name = "mixlib-config" s.version = Mixlib::Config::VERSION - s.authors = ["Opscode, Inc."] - s.email = "info@opscode.com" + s.authors = ["Chef Software, Inc."] + s.email = "legal@chef.io" s.extra_rdoc_files = [ "LICENSE", "README.md" ] s.files = [ "LICENSE", "NOTICE", "README.md", "Rakefile" ] + Dir.glob("{lib,spec}/**/*") - s.homepage = "http://www.opscode.com" + s.homepage = "http://www.chef.io" s.require_paths = ["lib"] s.rubygems_version = "1.8.23" s.summary = "A class based configuration library" s.description = s.summary + s.license = "Apache-2.0" s.add_development_dependency 'rake' s.add_development_dependency 'rspec', '~> 2.99'
Add license to gemspec and update other fields for new company name.
diff --git a/lib/headlines/security_headers/security_header.rb b/lib/headlines/security_headers/security_header.rb index abc1234..def5678 100644 --- a/lib/headlines/security_headers/security_header.rb +++ b/lib/headlines/security_headers/security_header.rb @@ -1,9 +1,10 @@ module Headlines module SecurityHeaders class SecurityHeader - attr_reader :params + attr_reader :name, :params def initialize(header) + @name = header[0] @header = header[1] @params = { value: @header, enabled: true } end
Add name attribute to security header
diff --git a/lib/test_wrangler/cohort/matchers/base_matcher.rb b/lib/test_wrangler/cohort/matchers/base_matcher.rb index abc1234..def5678 100644 --- a/lib/test_wrangler/cohort/matchers/base_matcher.rb +++ b/lib/test_wrangler/cohort/matchers/base_matcher.rb @@ -0,0 +1,18 @@+module TestWrangler + class Cohort + module Matchers + class BaseMatcher + attr_reader :rules + + def initialize(*rules) + @rules = rules.flatten + end + + def self.deserialize(array) + array + end + + end + end + end +end
Add serialization and deserialization for cohorts Make all matchers inherit from base matcher. Implement serializer for Cohort. Implement basic serializer for base matcher class. Implement specific serializer for user agent matcher class. Spec out new functionality
diff --git a/app/controllers/one_more_rating/ratings_controller.rb b/app/controllers/one_more_rating/ratings_controller.rb index abc1234..def5678 100644 --- a/app/controllers/one_more_rating/ratings_controller.rb +++ b/app/controllers/one_more_rating/ratings_controller.rb @@ -1,7 +1,11 @@ module OneMoreRating class RatingsController < ApplicationController def create - @rateable = Object.const_get(params[:rateable_type]).find(params[:rateable_id]) + rateable_type = Object.const_get(params[:rateable_type]) + @rateable = rateable_type.find(params[:rateable_id]) + + raise SecurityError.new("An attempt to rate an object of type that is not rateable") if !@rateable.respond_to?(:rate) + scope = @rateable.class.rateable_scope.call @rateable.rate(params[:score], current_user.id, scope)
Check if entity is rateable before try to rate it
diff --git a/spec/event_value_spec.rb b/spec/event_value_spec.rb index abc1234..def5678 100644 --- a/spec/event_value_spec.rb +++ b/spec/event_value_spec.rb @@ -0,0 +1,24 @@+require 'graphite_client' +require File.expand_path(File.dirname(__FILE__) + '/spec_helper') + +require 'json' + +describe "GraphiteClient::EventReporter::EventValue" do + before do + @event_value_class = GraphiteClient::EventReporter::EventValue + end + + it "should accept a Hash and return JSON" do + JSON.parse(@event_value_class.from({:what => 'test', :tags => 'test', :data => 'test'})).should be_a(Hash) + end + + it "leaves a :tags String as a single value" do + event_hash = JSON.parse(@event_value_class.from({ :what => 'test', :tags => 'testStr1,testStr2', :data => 'test'})) + event_hash['tags'].should eq('testStr1,testStr2') + end + + it "converts a :tags Array into CSVs" do + event_hash = JSON.parse(@event_value_class.from({ :what => 'test', :tags => ['test1', 'test2'], :data => 'test'})) + event_hash['tags'].should eq('test1,test2') + end +end
Add specs to test events Hash normalizer
diff --git a/spec/lib/webhook_spec.rb b/spec/lib/webhook_spec.rb index abc1234..def5678 100644 --- a/spec/lib/webhook_spec.rb +++ b/spec/lib/webhook_spec.rb @@ -8,9 +8,9 @@ let(:resource) { client.webhooks } - include_examples 'list resource' - include_examples 'find resource' - include_examples 'create resource' - include_examples 'update resource' - include_examples 'delete resource' + include_examples 'lists resource' + include_examples 'finds resource' + include_examples 'creates resource' + include_examples 'updates resource' + include_examples 'deletes resource' end
Update example use in webhook spec
diff --git a/lib/envato/client.rb b/lib/envato/client.rb index abc1234..def5678 100644 --- a/lib/envato/client.rb +++ b/lib/envato/client.rb @@ -29,6 +29,17 @@ inspected end + # Public: Conceal a sensitive string. + # + # This conceals everything in a string except for the first and last 4 + # characters. Useful to hide sensitive data without removing it completely. + # + # Examples + # + # conceal('secretstring') + # # => 'secr****ring' + # + # Returns a String. def conceal(string) if string.length < 8 '****'
Test with some doc generation tomdoc
diff --git a/spec/support/helpers/view_component_example_group.rb b/spec/support/helpers/view_component_example_group.rb index abc1234..def5678 100644 --- a/spec/support/helpers/view_component_example_group.rb +++ b/spec/support/helpers/view_component_example_group.rb @@ -8,16 +8,21 @@ attr_reader :rendered end - def arbre - Arbre::Context.new({}, _view) + def arbre(&block) + Arbre::Context.new({}, _view, &block) end def helper _view end - def render(*args) - @rendered = arbre.send(described_class.builder_method_name, *args) + def render(*args, &block) + @rendered = + if block_given? + arbre(&block).to_s + else + arbre.send(described_class.builder_method_name, *args, &block) + end end end
Allow rendering an Arbre fragment in view component tests
diff --git a/divvy.gemspec b/divvy.gemspec index abc1234..def5678 100644 --- a/divvy.gemspec +++ b/divvy.gemspec @@ -0,0 +1,20 @@+# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = "divvy" + s.version = "1.0" + s.platform = Gem::Platform::RUBY + s.authors = %w[@rtomayko] + s.email = ["rtomayko@gmail.com"] + s.homepage = "https://github.com/rtomayko/divvy" + s.summary = "little ruby parallel script runner" + s.description = "..." + + s.add_development_dependency "rake" + s.add_development_dependency "minitest" + + s.files = `git ls-files`.split("\n") + s.test_files = `git ls-files -- test`.split("\n").select { |f| f =~ /_test.rb$/ } + s.executables = `git ls-files -- bin`.split("\n").map { |f| File.basename(f) } + s.require_paths = %w[lib] +end
Add a gemspec, this is v1.0
diff --git a/tests/serverlove/requests/compute/server_tests.rb b/tests/serverlove/requests/compute/server_tests.rb index abc1234..def5678 100644 --- a/tests/serverlove/requests/compute/server_tests.rb +++ b/tests/serverlove/requests/compute/server_tests.rb @@ -0,0 +1,11 @@+Shindo.tests('Fog::Compute[:serverlove] | server requests', ['serverlove']) do + + tests('success') do + + tests("#list_servers").succeeds do + Fog::Compute[:serverlove].servers + end + + end + +end
Test that we can view servers.
diff --git a/spec/attr_cleaner/model_spec.rb b/spec/attr_cleaner/model_spec.rb index abc1234..def5678 100644 --- a/spec/attr_cleaner/model_spec.rb +++ b/spec/attr_cleaner/model_spec.rb @@ -9,14 +9,6 @@ end let(:instance) { model.new } - - describe ".attr_cleaner" do - context "called with attributes" do - before { model.attr_cleaner :title, :body } - - specify { expect(model.attr_cleaners).to eq [:title, :body] } - end - end describe "#write_attribute_with_cleaner" do context "with no cleaners" do
Remove spec for class attribute
diff --git a/spec/futuroscope/future_spec.rb b/spec/futuroscope/future_spec.rb index abc1234..def5678 100644 --- a/spec/futuroscope/future_spec.rb +++ b/spec/futuroscope/future_spec.rb @@ -20,7 +20,7 @@ end end - it "delegates some important methods to the original object's" do + it "delegates some Object methods to the original object's" do object = [1, 2, 3] future = Future.new{object} @@ -30,5 +30,11 @@ expect(future.clone).to eq(object) expect(future.to_s).to eq(object.to_s) end + + it "delegates missing methods" do + object = [1, 2, 3] + future = Future.new{object} + expect(future).to_not be_empty + end end end
Add test case to test method_missing
diff --git a/lib/convection/model/template/resource/aws_events_rule.rb b/lib/convection/model/template/resource/aws_events_rule.rb index abc1234..def5678 100644 --- a/lib/convection/model/template/resource/aws_events_rule.rb +++ b/lib/convection/model/template/resource/aws_events_rule.rb @@ -11,6 +11,10 @@ type 'AWS::Events::Rule' property :description, 'Description' property :domain, 'Domain' + # Event patterns are documented as the type "JSON Object". + # We can define it here as a Hash. Example usage of the + # `event_pattern` method property being used can be found in + # the EventsRule spec. property :event_pattern, 'EventPattern', :type => :hash property :name, 'Name' property :role_arn, 'RoleArn'
Add a comment around EventsRule
diff --git a/spec/support/govuk_component.rb b/spec/support/govuk_component.rb index abc1234..def5678 100644 --- a/spec/support/govuk_component.rb +++ b/spec/support/govuk_component.rb @@ -3,7 +3,7 @@ module GovukComponent include Slimmer::TestHelpers::SharedTemplates - def expect_component(name, key = name, value) + def expect_component(name, value, key = name) within shared_component_selector(name) do expect(JSON.parse(page.text).fetch(key)).to eq(value) end @@ -18,7 +18,7 @@ end def expect_related_items(value) - expect_component("related_items", "sections", value) + expect_component("related_items", value, "sections") end def expect_analytics(key, value)
Put optional argument at end of `expect_component`
diff --git a/app/importers/file_importers/educators_importer.rb b/app/importers/file_importers/educators_importer.rb index abc1234..def5678 100644 --- a/app/importers/file_importers/educators_importer.rb +++ b/app/importers/file_importers/educators_importer.rb @@ -21,6 +21,7 @@ if educator.present? educator.save! + educator.save_student_searchbar_json homeroom = Homeroom.find_by_name(row[:homeroom]) if row[:homeroom] homeroom.update(educator: educator) if homeroom.present?
Revert "Remove student searchbar caching from educator import job"
diff --git a/app/queries/live_edition_blocking_draft_edition.rb b/app/queries/live_edition_blocking_draft_edition.rb index abc1234..def5678 100644 --- a/app/queries/live_edition_blocking_draft_edition.rb +++ b/app/queries/live_edition_blocking_draft_edition.rb @@ -12,10 +12,9 @@ conflicts = Edition.with_document .where(base_path: base_path, content_store: :live) - .where.not( - "documents.content_id": content_id, - document_type: SubstitutionHelper::SUBSTITUTABLE_DOCUMENT_TYPES, - ).pluck(:id) + .where.not("documents.content_id": content_id) + .where.not(document_type: SubstitutionHelper::SUBSTITUTABLE_DOCUMENT_TYPES) + .pluck(:id) conflicts.first unless conflicts.empty? end
Fix deprecation warning in query The upgrade has triggered this warning: `DEPRECATION WARNING: NOT conditions will no longer behave as NOR in Rails 6.1. To continue using NOR conditions, NOT each conditions manually`
diff --git a/lib/kubernetes-deploy/kubernetes_resource/cloudsql.rb b/lib/kubernetes-deploy/kubernetes_resource/cloudsql.rb index abc1234..def5678 100644 --- a/lib/kubernetes-deploy/kubernetes_resource/cloudsql.rb +++ b/lib/kubernetes-deploy/kubernetes_resource/cloudsql.rb @@ -9,9 +9,11 @@ def sync _, st = run_kubectl("get", type, @name) @found = st.success? - @status = true - - + @status = if cloudsql_proxy_deployment_exists? && mysql_service_exists? + "Provisioned" + else + "Unknown" + end log_status end
Set status to Provisioned if everything's up or Unknown otherwise
diff --git a/lib/rom/rails/model/validator/uniqueness_validator.rb b/lib/rom/rails/model/validator/uniqueness_validator.rb index abc1234..def5678 100644 --- a/lib/rom/rails/model/validator/uniqueness_validator.rb +++ b/lib/rom/rails/model/validator/uniqueness_validator.rb @@ -3,33 +3,69 @@ module ROM module Model module Validator + # Uniqueness validation + # + # @api public class UniquenessValidator < ActiveModel::EachValidator - attr_reader :klass, :message + # Relation validator class + # + # @api private + attr_reader :klass + # error message + # + # @return [String, Symbol] + # + # @api private + attr_reader :message + + # @api private def initialize(options) super @klass = options.fetch(:class) @message = options.fetch(:message) { :taken } end + # Hook called by ActiveModel internally + # + # @api private def validate_each(validator, name, value) validator.errors.add(name, message) unless unique?(name, value) end private + # Get relation object from the rom env + # + # @api private def relation rom.relations[relation_name] end + # Relation name defined on the validator class + # + # @api private def relation_name klass.relation end + # Shortcut to access global rom env + # + # @return [ROM::Env] + # + # @api private def rom ROM.env end + # Ask relation if a given attribute value is unique + # + # This uses `Relation#unique?` interface that not all adapters can + # implement. + # + # @return [TrueClass,FalseClass] + # + # @api private def unique?(name, value) relation.unique?(name => value) end
Add yard docs for uniqueness validator
diff --git a/dough.gemspec b/dough.gemspec index abc1234..def5678 100644 --- a/dough.gemspec +++ b/dough.gemspec @@ -13,7 +13,7 @@ s.summary = "Dough" s.description = "Dough" - s.files = Dir["{app,config,db,lib}/**/*"] + ["LICENSE", "Rakefile", "README.rdoc"] + s.files = Dir["{app,config,db,lib}/**/*"] + ["LICENSE", "Rakefile", "README.md"] s.test_files = Dir["spec/**/*"] s.add_dependency "rails", "~> 3.2.17"
Correct readme filename in gemspec
diff --git a/activesupport/lib/active_support/core_ext/hash/reverse_merge.rb b/activesupport/lib/active_support/core_ext/hash/reverse_merge.rb index abc1234..def5678 100644 --- a/activesupport/lib/active_support/core_ext/hash/reverse_merge.rb +++ b/activesupport/lib/active_support/core_ext/hash/reverse_merge.rb @@ -6,14 +6,14 @@ # options.reverse_merge! :size => 25, :velocity => 10 # end # - # Using <tt>merge</tt>, the above example would look as follows: + # The default <tt>:size</tt> and <tt>:velocity</tt> are only set if the +options+ hash passed in doesn't already + # have the respective key. + # + # As contrast, using Ruby's built in <tt>merge</tt> would require writing the following: # # def setup(options = {}) - # { :size => 25, :velocity => 10 }.merge(options) + # options = { :size => 25, :velocity => 10 }.merge(options) # end - # - # The default <tt>:size</tt> and <tt>:velocity</tt> are only set if the +options+ hash passed in doesn't already - # have the respective key. def reverse_merge(other_hash) other_hash.merge(self) end
Correct example that did not do what it claimed. Rework explanation.
diff --git a/kernel/common/module19.rb b/kernel/common/module19.rb index abc1234..def5678 100644 --- a/kernel/common/module19.rb +++ b/kernel/common/module19.rb @@ -28,7 +28,7 @@ Rubinius.add_writer name, self, vis if attributes.last else attributes.each do |name| - raise TypeError, "#{name.inspect} is not a symbol" if !name.respond_to?(:to_str) || !name.to_s.is_a?(String) || name.to_s.empty? + raise TypeError, "#{name.inspect} is not a symbol" unless name.respond_to?(:to_str) || name.to_s.is_a?(String) Rubinius.add_reader(name, self, vis) end end
Revert "raises TypeError if to_s returns empty string" This reverts commit e7057cafe7597b9ffc47e5dfeb7b1a0aaec18517.
diff --git a/lib/tty/cmd.rb b/lib/tty/cmd.rb index abc1234..def5678 100644 --- a/lib/tty/cmd.rb +++ b/lib/tty/cmd.rb @@ -23,6 +23,13 @@ ) end + # The root path for all the templates + # + # @api public + def templates_root_path + Pathname.new(::File.join(::File.dirname(__FILE__), 'templates')) + end + # The root path of the app running this command # # @return [Pathname] @@ -39,18 +46,22 @@ Dir.chdir(root_path, &block) end + # @api public def generator @generator ||= TTY::File end + # @api public def command @command ||= TTY::Command.new(printer: :null) end + # @api public def which(*args) TTY::Which.which(*args) end + # @api public def exec_exist?(*args) TTY::Which.exist?(*args) end
Add root path for all templates
diff --git a/database_transform.gemspec b/database_transform.gemspec index abc1234..def5678 100644 --- a/database_transform.gemspec +++ b/database_transform.gemspec @@ -19,6 +19,10 @@ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.require_paths = ['lib'] + spec.add_dependency 'activesupport' + spec.add_dependency 'activerecord' + spec.add_development_dependency 'bundler', '~> 1.9' spec.add_development_dependency 'rake', '~> 10.0' + spec.add_development_dependency 'rspec', '~> 3' end
Add dependencies on RSpec, ActiveSupport, and ActiveRecord.
diff --git a/Casks/intellij-idea-eap.rb b/Casks/intellij-idea-eap.rb index abc1234..def5678 100644 --- a/Casks/intellij-idea-eap.rb +++ b/Casks/intellij-idea-eap.rb @@ -1,6 +1,6 @@ cask :v1 => 'intellij-idea-eap' do - version '141.588.1' - sha256 '4748d0785eb9e7df24fe43524ee196db69ebde50125eb2d6879702eecc64a604' + version '141.1192.2' + sha256 '3a31b5883c6a0c10667cd896c99fec723d4f862e9378ce64ee4b8634ebed3c82' url "http://download-cf.jetbrains.com/idea/ideaIU-#{version}.dmg" homepage 'https://confluence.jetbrains.com/display/IDEADEV/IDEA+14.1+EAP'
Upgrade Intellij Idea EAP to 141.1192.2 Signed-off-by: Koichi Shiraishi <41a18128582fec5418c0a92661f7d4b13d21d912@gmail.com>
diff --git a/appium_tests/spec_helper.rb b/appium_tests/spec_helper.rb index abc1234..def5678 100644 --- a/appium_tests/spec_helper.rb +++ b/appium_tests/spec_helper.rb @@ -16,8 +16,8 @@ platformName: "iOS", deviceName: "iPhone 7", # deviceName: "iPad Pro (10.5-inch)", - # platformVersion: "11.2", - platformVersion: "10.3", + platformVersion: "11.2", + # platformVersion: "10.3", app: '../build/iPhoneSimulator-10.0-Development/Shuffle100.app', # fullReset: true, # Appium1.5+(試したのは1.5.3)で、シミュレータの2回起動を抑止する。 automationName: 'XCUITest' @@ -30,7 +30,7 @@ RSpec.configure { |c| c.before(:all) { - @driver = Appium::Driver.new(desired_caps).start_driver + @driver = Appium::Driver.new(desired_caps, true).start_driver @driver.manage.timeouts.implicit_wait = 2 Appium.promote_appium_methods Object }
Fix deprecated use of Appium::Driver.new()
diff --git a/lib/sinatra/jsonp.rb b/lib/sinatra/jsonp.rb index abc1234..def5678 100644 --- a/lib/sinatra/jsonp.rb +++ b/lib/sinatra/jsonp.rb @@ -18,6 +18,7 @@ content_type :js response = "#{callback}(#{data})" else + content_type :json response = data end response
Add missing "content_type :json" for pure JSON output
diff --git a/db/migrate/20190520142857_create_infrastructure_voltage_types.rb b/db/migrate/20190520142857_create_infrastructure_voltage_types.rb index abc1234..def5678 100644 --- a/db/migrate/20190520142857_create_infrastructure_voltage_types.rb +++ b/db/migrate/20190520142857_create_infrastructure_voltage_types.rb @@ -5,6 +5,6 @@ t.boolean :active end - add_reference :infrastructure_components, :infrastructure_voltage_type + add_reference :transit_components, :infrastructure_voltage_type end end
Fix transit components reference in db migration.
diff --git a/lib/t/collectable.rb b/lib/t/collectable.rb index abc1234..def5678 100644 --- a/lib/t/collectable.rb +++ b/lib/t/collectable.rb @@ -32,7 +32,7 @@ def collect_with_page(collection = ::Set.new, page = 1, previous = nil, &block) tweets = Retryable.retryable(tries: 3, on: Twitter::Error, sleep: 0) do - block.call(page) + yield page end return collection if tweets.nil? || tweets == previous || page >= MAX_PAGE collection += tweets
Use yield instead of block.call
diff --git a/lib/aqbanking.rb b/lib/aqbanking.rb index abc1234..def5678 100644 --- a/lib/aqbanking.rb +++ b/lib/aqbanking.rb @@ -2,11 +2,11 @@ require "aqbanking/account" module AqBanking - def config=(path) + def self.config=(path) @config = path end - def config + def self.config @config ||= '.' end @@ -27,7 +27,7 @@ options = { pinfile: nil, args: ['--acceptvalidcerts', '--noninteractive', - '--charset=utf-8', "--cfgfile=#{config}"] + '--charset=utf-8', "--cfgfile=#{AqBanking.config}"] }.merge(options) "aqhbci-tool4 #{options[:args].join(' ')} #{command}" end @@ -36,7 +36,7 @@ options = { pinfile: nil, args: ['--acceptvalidcerts', '--noninteractive', - '--charset=utf-8', "--cfgdir=#{config}"] + '--charset=utf-8', "--cfgdir=#{AqBanking.config}"] }.merge(options) "aqbanking-cli #{options[:args].join(' ')} #{command}" end
Use global AqBanking.config var to reference conf
diff --git a/spec/features/budget_polls/polls_spec.rb b/spec/features/budget_polls/polls_spec.rb index abc1234..def5678 100644 --- a/spec/features/budget_polls/polls_spec.rb +++ b/spec/features/budget_polls/polls_spec.rb @@ -3,7 +3,8 @@ feature "Polls" do context "Public index" do - it "Budget polls should not be listed" do + + scenario "Budget polls should not be listed" do poll = create(:poll) budget_poll = create(:poll, budget: create(:budget)) @@ -12,10 +13,12 @@ expect(page).to have_content(poll.name) expect(page).not_to have_content(budget_poll.name) end + end context "Admin index" do - it "Budget polls should not appear in the list" do + + scenario "Budget polls should not appear in the list" do login_as(create(:administrator).user) poll = create(:poll)
Use `scenario` instead of `it` in feature specs
diff --git a/spec/shared/request_failure_behaviour.rb b/spec/shared/request_failure_behaviour.rb index abc1234..def5678 100644 --- a/spec/shared/request_failure_behaviour.rb +++ b/spec/shared/request_failure_behaviour.rb @@ -0,0 +1,16 @@+# encoding: utf-8 + +shared_examples_for 'request failure' do + + context "resource not found" do + let(:body) { "" } + let(:status) { [404, "Not Found"] } + + it "should fail to retrive resource" do + expect { + requestable + }.to raise_error(Github::Error::NotFound) + end + end + +end
Add common request failure behaviour.
diff --git a/test/mathematical/fixtures_test.rb b/test/mathematical/fixtures_test.rb index abc1234..def5678 100644 --- a/test/mathematical/fixtures_test.rb +++ b/test/mathematical/fixtures_test.rb @@ -8,9 +8,13 @@ define_method "test_#{name}" do source = File.read(before) + actual = Mathematical::Render.new.render(source).rstrip + expected_file = before.sub(/before/, "after").sub(/text/, "html") + + File.open(expected_file, "w") { |file| file.write(actual) } unless ENV['DEBUG_MATHEMATICAL'].nil? + expected = File.read(expected_file).rstrip - actual = Mathematical::Render.new.render(source).rstrip if source != expected assert(source != actual, "#{name} did not render anything")
Add debug option to tests
diff --git a/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb b/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb index abc1234..def5678 100644 --- a/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +++ b/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb @@ -26,7 +26,7 @@ { 'name' => full_name, 'company' => nil, 'address1' => @params['street'], - 'address2' => @params['shiptostreet2'], + 'address2' => @params['shiptostreet2'] || @params['street2'], 'city' => @params['city'], 'state' => @params['state'], 'country' => @params['country'], @@ -36,4 +36,4 @@ end end end -end+end
Support 'street2' field for PayflowExpress UK
diff --git a/lib/algorithmia/errors.rb b/lib/algorithmia/errors.rb index abc1234..def5678 100644 --- a/lib/algorithmia/errors.rb +++ b/lib/algorithmia/errors.rb @@ -10,6 +10,8 @@ case @error[:message] when 'authorization required' raise AlgorithmiaApiKeyInvalid, "The API key you sent is invalid! Please set `Algorithmia::Client.api_key` with the key provided with your account." + when 'Failed to parse input, input did not parse as valid json' + raise AlgorithmiaJsonParseFailure, "Unable to parse the input. Please make sure it matches the expected input of the algorithm and can be parsed into JSON." else if @error[:stacktrace].nil? raise UnknownError, "Got an unknown error: #{@error[:message]}" @@ -39,5 +41,6 @@ class AlgorithmiaApiKeyEmpty < Exception; end class AlgorithmiaApiKeyInvalid < Exception; end + class AlgorithmiaJsonParseFailure < Exception; end class UnknownError < Exception; end end
Add json parse error handling
diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index abc1234..def5678 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -1,10 +1,6 @@ class CommentsController < ApplicationController before_action :set_submission before_action :set_comment, only: [:show, :edit, :update, :destroy] - - def index - @comments = Comment.all - end def show end @@ -18,7 +14,7 @@ def create @submission = Submission.find(params[:submission_id]) - @comment = @submission.comments.build({body: comment_params[:body], submission: @submission, user: current_user}) + @comment = @submission.comments.build({ body: comment_params[:body], submission: @submission, user: current_user }) if @comment.save redirect_to @submission, notice: 'Comment was successfully created.'
Remove index method from comments controller
diff --git a/SanFranciscoFontFeatures.podspec b/SanFranciscoFontFeatures.podspec index abc1234..def5678 100644 --- a/SanFranciscoFontFeatures.podspec +++ b/SanFranciscoFontFeatures.podspec @@ -0,0 +1,16 @@+Pod::Spec.new do |s| + s.name = 'SanFranciscoFontFeatures' + s.version = '1.0.0' + s.platform = :ios, "8.2" + s.license = 'MIT' + s.summary = 'SanFranciscoFontFeatures provides an easy way to use the font features specific to the Apple System font known as San Francisco.' + s.homepage = 'https://github.com/jpsim/JPSVolumeButtonHandler' + s.author = { 'Doug Hill' => 'doug@breaqz.com' } + s.source = { :git => 'https://github.com/djfitz/SFFontFeatures.git', :tag => '1.0.0' } + + s.description = 'A convenience extension to UIFont for enabling features specific to the San Francisco font. Many of the features of the San Francisco font are enabled by odd OpenType settings (e.g. Alternate Stylistic Features) which aren\'t named in the SDK headers. This class extension abstracts the specifics to enable these features. See here for more info about the San Francisco Font: https://developer.apple.com/fonts/' + + s.source_files = '*.{h,m}' + s.framework = 'UIKit' + s.requires_arc = true +end
Create a podspec file for Cocoapods support.
diff --git a/app/models/configuration.rb b/app/models/configuration.rb index abc1234..def5678 100644 --- a/app/models/configuration.rb +++ b/app/models/configuration.rb @@ -15,9 +15,11 @@ # This returns a shortened about for displaying on the settings screen, if the about is multiple lines def about_summary summary = self.about - summary = summary.gsub("\r\n", "\n") - summary = "#{summary[0..summary.index("\n") - 1]}..." if summary.index("\n") - summary + unless summary.nil? || summary.empty? + summary = summary.gsub("\r\n", "\n") + summary = "#{summary[0..summary.index("\n") - 1]}..." if summary.index("\n") + summary + end end ##
Put in nil check before gsubbing the about text
diff --git a/actioncable/lib/action_cable/connection/authorization.rb b/actioncable/lib/action_cable/connection/authorization.rb index abc1234..def5678 100644 --- a/actioncable/lib/action_cable/connection/authorization.rb +++ b/actioncable/lib/action_cable/connection/authorization.rb @@ -5,7 +5,7 @@ module Authorization class UnauthorizedError < StandardError; end - # Closes the WebSocket connection if it is open and returns a 404 "File not Found" response. + # Closes the WebSocket connection if it is open and returns an "unauthorized" reason. def reject_unauthorized_connection logger.error "An unauthorized connection attempt was rejected" raise UnauthorizedError
Correct the description for reject_unauthorized_connection
diff --git a/spec/coffeescript_spec.rb b/spec/coffeescript_spec.rb index abc1234..def5678 100644 --- a/spec/coffeescript_spec.rb +++ b/spec/coffeescript_spec.rb @@ -56,7 +56,7 @@ end context "converting CoffeeScript" do - it "produces CSS" do + it "produces JS" do expect(converter.convert(coffeescript_content)).to eql(js_content) end end
Change CSS to JS in spec Looks like it was a holdover from the jekyll/jekyll-sass-converter spec.
diff --git a/app/models/letter_opener_web/letter.rb b/app/models/letter_opener_web/letter.rb index abc1234..def5678 100644 --- a/app/models/letter_opener_web/letter.rb +++ b/app/models/letter_opener_web/letter.rb @@ -43,6 +43,10 @@ def read_file(style) contents = File.read("#{letters_location}/#{id}/#{style}.html") + # We cannot feed the whole file to an XML parser as some mails are + # "complete" (as in they have the whole <html> structure) and letter_opener + # prepends some information about the mail being sent, making REXML + # complain about it contents.scan(/<a[^>]+>.+<\/a>/).each do |link| xml = REXML::Document.new(link).root unless xml.attributes['href'] =~ /(plain|rich).html/
Add comment to explain why we cant feed the whole email file contents to an XML parser
diff --git a/lib/spatula/rake/tasks.rb b/lib/spatula/rake/tasks.rb index abc1234..def5678 100644 --- a/lib/spatula/rake/tasks.rb +++ b/lib/spatula/rake/tasks.rb @@ -2,12 +2,12 @@ desc 'Create database' task :crebas do - Spatula::create '.kitchen.yml' + Spatula::create '.kitchen.yml', 'attributes/default.rb' end desc 'Start local MySQL server' task :start_mysql do - if Spatula::any_dbs? '.kitchen.yml' + if Spatula::any_dbs? '.kitchen.yml', 'attributes/default.rb' Spatula::start_mysql end end
Change to reflect how the gem works now
diff --git a/lib/udongo/object_path.rb b/lib/udongo/object_path.rb index abc1234..def5678 100644 --- a/lib/udongo/object_path.rb +++ b/lib/udongo/object_path.rb @@ -1,11 +1,11 @@ class Udongo::ObjectPath def self.find(object) unless object.is_a?(Array) - return "#{object.class.name.underscore}_path".gsub('_decorator', '') + return cleanup("#{object.class.name.underscore}_path") end object.map do |item| - item.is_a?(Symbol) ? "#{item}" : "#{item.class.name.underscore}".gsub('_decorator', '') + item.is_a?(Symbol) ? "#{item}" : cleanup(item.class.name.underscore) end.join('_') << '_path' end @@ -13,4 +13,10 @@ return object unless object.is_a?(Array) object.select { |o| !o.is_a?(Symbol) } end + + private + + def self.cleanup(value) + value.to_s.gsub('_decorator', '') + end end
Refactor the object path class.
diff --git a/Library/Formula/soprano.rb b/Library/Formula/soprano.rb index abc1234..def5678 100644 --- a/Library/Formula/soprano.rb +++ b/Library/Formula/soprano.rb @@ -5,6 +5,7 @@ @homepage='http://soprano.sourceforge.net/' @md5='c9a2c008b80cd5d76599e9d48139dfe9' + depends_on 'cmake' depends_on 'qt' depends_on 'clucene' depends_on 'redland'
Add cmake as a build dependency for Soprano
diff --git a/app/models/land_and_property_information_record.rb b/app/models/land_and_property_information_record.rb index abc1234..def5678 100644 --- a/app/models/land_and_property_information_record.rb +++ b/app/models/land_and_property_information_record.rb @@ -1,5 +1,4 @@ class LandAndPropertyInformationRecord < ActiveRecord::Base - has_paper_trail attr_accessible :cadastre_id, :end_date, :last_update, :lga_name, :lot_number, :modified_date, :plan_label, :section_number, :start_date, :title_reference, :md5sum, :local_government_area_id
Remove has_paper_trail from LPIRecord class
diff --git a/app/models/metasploit/cache/module/architecture.rb b/app/models/metasploit/cache/module/architecture.rb index abc1234..def5678 100644 --- a/app/models/metasploit/cache/module/architecture.rb +++ b/app/models/metasploit/cache/module/architecture.rb @@ -34,21 +34,5 @@ validates :module_instance, presence: true - # - # Instance Methods - # - - # @!method architecture=(architecture) - # Sets {#architecture}. - # - # @param architecture [Metasploit::Cache::Architecture] the architecture supported by the {#module_instance}. - # @return [void] - - # @!method module_instance=(module_instance) - # Sets {#module_instance}. - # - # @param module_instance [MEtasploit::Cache::Module::Instance] the module instance that supports {#architecture}. - # @return [void] - Metasploit::Concern.run(self) end
Remove unneed docs for association writers MSP-12217 Replaced by use of yard-activerecord.
diff --git a/app/controllers/feedback_form_responses_controller.rb b/app/controllers/feedback_form_responses_controller.rb index abc1234..def5678 100644 --- a/app/controllers/feedback_form_responses_controller.rb +++ b/app/controllers/feedback_form_responses_controller.rb @@ -7,7 +7,7 @@ def index check_user_auth - @responses = FeedbackFormResponse.order(id: :desc).first(50) + @responses = FeedbackFormResponse.order(id: :desc).where.not(body: '').first(100) end def show
Hide empty FeedbackFormResponse records, show more
diff --git a/app/controllers/ok_computer/ok_computer_controller.rb b/app/controllers/ok_computer/ok_computer_controller.rb index abc1234..def5678 100644 --- a/app/controllers/ok_computer/ok_computer_controller.rb +++ b/app/controllers/ok_computer/ok_computer_controller.rb @@ -42,7 +42,7 @@ end def status_code(check) - check.success? ? :ok : :error + check.success? ? :ok : :internal_server_error end def authenticate
Update status code handling for compatibility with Rack 2.1 This commit in [Rack 2.1](https://github.com/rack/rack/commit/e6bdee4c16310e078093c0282f2f5449fdd130cd) has it validating status code symbols instead of defaulting to a 500 error on any unknown status.
diff --git a/db/migrate/20090514202305_drop_events_source_event_id.rb b/db/migrate/20090514202305_drop_events_source_event_id.rb index abc1234..def5678 100644 --- a/db/migrate/20090514202305_drop_events_source_event_id.rb +++ b/db/migrate/20090514202305_drop_events_source_event_id.rb @@ -0,0 +1,11 @@+class DropEventsSourceEventId < ActiveRecord::Migration + def self.up + execute "alter table events drop foreign key events_source_event_id_fk" + remove_column :events, :source_event_id + end + + def self.down + add_column :events, :source_event_id, :integer, :default => nil + execute "alter table events add constraint events_source_event_id_fk foreign key (source_event_id) references events (id) on delete cascade" + end +end
Drop source_event_id. Rationalize Competition to Event associations. Pull duplicate overall competition code into Overall.
diff --git a/db/migrate/20160413202128_sti_configuration_script.rb b/db/migrate/20160413202128_sti_configuration_script.rb index abc1234..def5678 100644 --- a/db/migrate/20160413202128_sti_configuration_script.rb +++ b/db/migrate/20160413202128_sti_configuration_script.rb @@ -1,5 +1,5 @@ class StiConfigurationScript < ActiveRecord::Migration[5.0] - class ConfigurationScript < ApplicationRecord + class ConfigurationScript < ActiveRecord::Base self.inheritance_column = :_type_disabled end
Remove dependency on class ApplicationRecord from app folder
diff --git a/db/migrate/20190221200640_change_user_id_to_bigint.rb b/db/migrate/20190221200640_change_user_id_to_bigint.rb index abc1234..def5678 100644 --- a/db/migrate/20190221200640_change_user_id_to_bigint.rb +++ b/db/migrate/20190221200640_change_user_id_to_bigint.rb @@ -0,0 +1,35 @@+class ChangeUserIdToBigint < ActiveRecord::Migration[6.0] + def up + change_column :users, :id, :bigint + + change_column :admin_exports, :user_id, :bigint + change_column :article_votes, :user_id, :bigint + change_column :broadcasts, :user_id, :bigint + change_column :images, :user_id, :bigint + change_column :notifications, :user_id, :bigint + change_column :projects, :user_id, :bigint + change_column :replies, :user_id, :bigint + change_column :reply_users, :user_id, :bigint + change_column :subjects, :user_id, :bigint + change_column :subscriptions, :user_id, :bigint + change_column :topic_users, :user_id, :bigint + change_column :topics, :user_id, :bigint + end + + def down + change_column :users, :id, :integer + + change_column :admin_exports, :user_id, :integer + change_column :article_votes, :user_id, :integer + change_column :broadcasts, :user_id, :integer + change_column :images, :user_id, :integer + change_column :notifications, :user_id, :integer + change_column :projects, :user_id, :integer + change_column :replies, :user_id, :integer + change_column :reply_users, :user_id, :integer + change_column :subjects, :user_id, :integer + change_column :subscriptions, :user_id, :integer + change_column :topic_users, :user_id, :integer + change_column :topics, :user_id, :integer + end +end
Update user_id primary and foreign keys to bigint
diff --git a/app/models/instrument_version.rb b/app/models/instrument_version.rb index abc1234..def5678 100644 --- a/app/models/instrument_version.rb +++ b/app/models/instrument_version.rb @@ -27,7 +27,7 @@ def questions return @instrument.questions unless @version questions = [] - @version.reify.questions.each do |question| + @version.reify.questions.with_deleted.each do |question| versioned_question = versioned(question) if versioned_question questions << versioned_question @@ -47,7 +47,7 @@ def options_for_question(question) return question.options unless @version options = [] - question.options.each do |option| + question.options.with_deleted.each do |option| options << versioned(option) if versioned(option) end options
Include deleted questions and options for instrument version
diff --git a/config/initializers/delayed_job_config.rb b/config/initializers/delayed_job_config.rb index abc1234..def5678 100644 --- a/config/initializers/delayed_job_config.rb +++ b/config/initializers/delayed_job_config.rb @@ -10,4 +10,29 @@ Delayed::Worker.read_ahead = 10 Delayed::Worker.default_queue_name = 'default' Delayed::Worker.raise_signal_exceptions = :term -Delayed::Worker.logger = Logger.new(File.join(Rails.root, 'log', 'delayed_job.log'))+Delayed::Worker.logger = Logger.new(File.join(Rails.root, 'log', 'delayed_job.log')) + + +# Custom script to launch delayed job on startup, if server is to reboot +# cf https://stackoverflow.com/questions/2580871/start-or-ensure-that-delayed-job-runs-when-an-application-server-restarts +DELAYED_JOB_PID_PATH = "#{Rails.root}/tmp/pids/delayed_job.pid" + +def start_delayed_job + Thread.new do + `ruby script/delayed_job start` + end +end + +def process_is_dead? + begin + pid = File.read(DELAYED_JOB_PID_PATH).strip + Process.kill(0, pid.to_i) + false + rescue + true + end +end + +if !File.exist?(DELAYED_JOB_PID_PATH) && process_is_dead? + start_delayed_job +end
Add delayed_job start on boot script
diff --git a/app/helpers/time_helper.rb b/app/helpers/time_helper.rb index abc1234..def5678 100644 --- a/app/helpers/time_helper.rb +++ b/app/helpers/time_helper.rb @@ -2,7 +2,7 @@ module TimeHelper def time_ago_in_words(time) - content_tag(:time, datetime: time.to_s(:db), title: time) do + content_tag(:time, datetime: time.to_s(:db), title: time.to_s(:db)) do t('time_ago_in_words', time: distance_of_time_in_words_to_now(time)) end end
Use a better date format for humans
diff --git a/app/substitution_helper.rb b/app/substitution_helper.rb index abc1234..def5678 100644 --- a/app/substitution_helper.rb +++ b/app/substitution_helper.rb @@ -39,7 +39,7 @@ private def substitute?(document_type) - %w(coming_soon gone redirect unpublishing).include?(document_type) + %w(coming_soon gone redirect unpublishing special_route).include?(document_type) end end
Allow special_routes to be substitutable.
diff --git a/spec/controllers/data/gqueries_controller_spec.rb b/spec/controllers/data/gqueries_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/data/gqueries_controller_spec.rb +++ b/spec/controllers/data/gqueries_controller_spec.rb @@ -1,10 +1,10 @@ require 'spec_helper' -describe Data::GqueriesController do +describe Data::GqueriesController, :etsource_fixture do render_views let!(:admin) { FactoryGirl.create :admin } - let!(:gquery) { Gquery.all.first } + let!(:gquery) { Gquery.get('bar_demand') } before do login_as(admin)
Use ETSource fixture in the GQL controller spec
diff --git a/core/spec/requests/admin/configuration/states_spec.rb b/core/spec/requests/admin/configuration/states_spec.rb index abc1234..def5678 100644 --- a/core/spec/requests/admin/configuration/states_spec.rb +++ b/core/spec/requests/admin/configuration/states_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "States", :js => true do +describe "States" do stub_authorization! let!(:country) { create(:country) } @@ -9,7 +9,6 @@ Spree::Config[:default_country_id] = country.id visit spree.admin_path - click_link "More" click_link "Configuration" end @@ -23,7 +22,7 @@ end context "creating and editing states" do - it "should allow an admin to edit existing states" do + it "should allow an admin to edit existing states", :js => true do click_link "States" select country.name, :from => "Country" click_link "new_state_link" @@ -34,7 +33,7 @@ page.should have_content("Calgary") end - it "should show validation errors" do + it "should show validation errors", :js => true do click_link "States" select country.name, :from => "country" click_link "new_state_link"
Revert "All tests inside states.js need to be JavaScript and click the 'More' link first" This reverts commit 2eb1a091eee2804cf217e2e88c07d8f785f718c0.
diff --git a/search-engine/lib/condition/condition_color_count_expr.rb b/search-engine/lib/condition/condition_color_count_expr.rb index abc1234..def5678 100644 --- a/search-engine/lib/condition/condition_color_count_expr.rb +++ b/search-engine/lib/condition/condition_color_count_expr.rb @@ -10,6 +10,7 @@ a = card.colors.size elsif @a == "in" a = card.color_indicator_set + return false unless a else a = card.color_identity.size end
Fix crash in color indicator count condition
diff --git a/db/migrate/20081110000150_add_user_time_zones.rb b/db/migrate/20081110000150_add_user_time_zones.rb index abc1234..def5678 100644 --- a/db/migrate/20081110000150_add_user_time_zones.rb +++ b/db/migrate/20081110000150_add_user_time_zones.rb @@ -1,6 +1,6 @@ class AddUserTimeZones < ActiveRecord::Migration def self.up - add_column :users, :time_zone, :string + add_column :users, :time_zone, :string, :default => "UTC" end def self.down
Fix migration (add default time zone)
diff --git a/spec/controllers/miq_report_controller/dashboards_spec.rb b/spec/controllers/miq_report_controller/dashboards_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/miq_report_controller/dashboards_spec.rb +++ b/spec/controllers/miq_report_controller/dashboards_spec.rb @@ -1,13 +1,14 @@ describe ReportController do context "::Dashboards" do + before :each do + login_as user + @db = FactoryGirl.create(:miq_widget_set, + :owner => user.current_group, + :set_data => {:col1 => [], :col2 => [], :col3 => []}) + end + context "#db_edit" do let(:user) { FactoryGirl.create(:user, :features => "db_edit") } - before :each do - login_as user - @db = FactoryGirl.create(:miq_widget_set, - :owner => user.current_group, - :set_data => {:col1 => [], :col2 => [], :col3 => []}) - end it "dashboard owner remains unchanged" do allow(controller).to receive(:db_fields_validation)
Generalize before block outside be able to reuse it in dashboard spec
diff --git a/spec/models/airbrake_expection_errors_unit_tests_spec.rb b/spec/models/airbrake_expection_errors_unit_tests_spec.rb index abc1234..def5678 100644 --- a/spec/models/airbrake_expection_errors_unit_tests_spec.rb +++ b/spec/models/airbrake_expection_errors_unit_tests_spec.rb @@ -0,0 +1,12 @@+require 'rails_helper' + +describe 'Airbrake-1781551925379466692' do + it 'can deal with comment is nil' do + questionnaire = Questionnaire.new + qs = VmQuestionResponse.new(questionnaire, 1, 2) + @list_of_reviews = [Response.new(id: 1)] + @list_of_rows = [VmQuestionResponseRow.new('', 1, 1, 5, 0)] + answer = Answer.new(id: 1, question_id: 1, response_id: 1, comments: nil) + expect(qs.get_number_of_comments_greater_than_10_words).to eq([]) + end +end
Add unit test for airbrake-1781551925379466692
diff --git a/spec/support/features/reportable_note_shared_examples.rb b/spec/support/features/reportable_note_shared_examples.rb index abc1234..def5678 100644 --- a/spec/support/features/reportable_note_shared_examples.rb +++ b/spec/support/features/reportable_note_shared_examples.rb @@ -16,7 +16,7 @@ open_dropdown(dropdown) expect(dropdown).to have_button('Edit comment') - expect(dropdown).to have_link('Delete comment') + expect(dropdown).to have_button('Delete comment') expect(dropdown).to have_link('Report as abuse', href: abuse_report_path) end
Fix specs - delete comment is now a button instead of simple link
diff --git a/db/migrate/20100506172553_add_fields_to_localities.rb b/db/migrate/20100506172553_add_fields_to_localities.rb index abc1234..def5678 100644 --- a/db/migrate/20100506172553_add_fields_to_localities.rb +++ b/db/migrate/20100506172553_add_fields_to_localities.rb @@ -25,7 +25,6 @@ remove_column :localities, :grid_type spatial_extensions = MySociety::Config.getbool('USE_SPATIAL_EXTENSIONS', false) if spatial_extensions - remove_index :localities, :coords remove_column :localities, :coords end end
Fix down migration - removing column removes index
diff --git a/db/migrate/20181109131337_align_schema_and_live_db.rb b/db/migrate/20181109131337_align_schema_and_live_db.rb index abc1234..def5678 100644 --- a/db/migrate/20181109131337_align_schema_and_live_db.rb +++ b/db/migrate/20181109131337_align_schema_and_live_db.rb @@ -4,6 +4,6 @@ change_column_null :sashes, :updated_at, false change_column_null :merit_actions, :created_at, false change_column_null :merit_actions, :updated_at, false - add_index :merit_score_points, :score_id + add_index :merit_score_points, :score_id unless index_exists?(:merit_score_points, :score_id) end end
Check for index before creation in merit points score
diff --git a/rticles.gemspec b/rticles.gemspec index abc1234..def5678 100644 --- a/rticles.gemspec +++ b/rticles.gemspec @@ -17,7 +17,8 @@ s.files = `git ls-files`.split($\) s.add_dependency "rails", ">=3.2.8", '<4.0' - s.add_dependency "acts_as_list", ">=0.1.8" + # acts_as_list 0.6.0 has a bug that causes invalid queries to be generated for lists scoped by multiple columns + s.add_dependency "acts_as_list", ">=0.1.8", '<0.6.0' s.add_dependency "roman-numerals", "~>0.3.0" s.add_development_dependency "sqlite3"
Exclude acts_as_list 0.6.0 because of a bug.
diff --git a/example/changes_monitor.rb b/example/changes_monitor.rb index abc1234..def5678 100644 --- a/example/changes_monitor.rb +++ b/example/changes_monitor.rb @@ -1,8 +1,11 @@ require_relative '../lib/wdm' monitor = WDM::Monitor.new -monitor.watch('C:\Users\Maher\Desktop\test') { puts "change 1!" } -monitor.watch('C:\Users\Maher\Desktop\psds') { puts "change 2!" } +monitor.watch_recursively('C:\Users\Maher\Desktop\test') do |change| + puts "#{change.type.to_s.upcase}: '#{change.path}'" +end + +puts "Running the monitor..." thread = Thread.new { monitor.run! @@ -10,4 +13,7 @@ sleep(10) -monitor.stop+puts "Stopping the monitor..." + +monitor.stop +thread.join
Update the example with the new features of WDM
diff --git a/app/helpers/copy_move_helper.rb b/app/helpers/copy_move_helper.rb index abc1234..def5678 100644 --- a/app/helpers/copy_move_helper.rb +++ b/app/helpers/copy_move_helper.rb @@ -1,7 +1,9 @@ module CopyMoveHelper def page_parent_select_tag - home = Page.find_by_parent_id nil - list = build_tree home, [] + homes = Page.find_all_by_parent_id nil + list = homes.inject([]) do |l, home| + l.concat build_tree(home, []) + end options = options_for_select list, (@page.parent ? @page.parent.id : nil) select_tag 'parent', options end
Allow copy/move to copy between sites when multi_site is installed.
diff --git a/app/lib/where_you_heard.rb b/app/lib/where_you_heard.rb index abc1234..def5678 100644 --- a/app/lib/where_you_heard.rb +++ b/app/lib/where_you_heard.rb @@ -1,5 +1,9 @@ class WhereYouHeard OPTIONS = { + '19' => 'Media - Pensions Awareness Day', + '20' => 'Media - Leaving planning retirement finances to two years before retirement', + '21' => 'Money and Pensions Service Webinar on Pensions Awareness Day website', + '22' => 'Virtual 121 sessions on Pensions Awareness Day website', '1' => 'An employer', '2' => 'A Pension Provider', '3' => 'Internet search',
Add Pension Awareness Week WDYH options
diff --git a/db/migrate/20160127002624_create_administrators.rb b/db/migrate/20160127002624_create_administrators.rb index abc1234..def5678 100644 --- a/db/migrate/20160127002624_create_administrators.rb +++ b/db/migrate/20160127002624_create_administrators.rb @@ -1,8 +1,13 @@ class CreateAdministrators < ActiveRecord::Migration def change create_table :administrators do |t| + t.string :email, null: false + t.string :email_for_index, null: false + t.string :hashed_password + t.boolean :suspended, null: false, default: false t.timestamps null: false end + add_index :administrators, :email_for_index, unique: true end end
Set migrate file in administrators table
diff --git a/spec/controllers/coursewareable/sessions/user_spec.rb b/spec/controllers/coursewareable/sessions/user_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/coursewareable/sessions/user_spec.rb +++ b/spec/controllers/coursewareable/sessions/user_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Coursewareable::SessionsController, :focus => true do +describe Coursewareable::SessionsController do let(:user) { Fabricate(:confirmed_user) } describe 'GET new' do
Remove focus from sessions controller.
diff --git a/wordpress_client.gemspec b/wordpress_client.gemspec index abc1234..def5678 100644 --- a/wordpress_client.gemspec +++ b/wordpress_client.gemspec @@ -23,6 +23,6 @@ spec.add_development_dependency "bundler", "~> 1.7" spec.add_development_dependency "rake", "~> 10.0" spec.add_development_dependency "rspec", "~> 3.3" - spec.add_development_dependency "webmock", "~> 1.22" + spec.add_development_dependency "webmock", "~> 2.0" spec.add_development_dependency "yard", "~> 0.8.7" end
Update webmock version in gemspec
diff --git a/spec/puppet-lint/plugins/world_writable_files_spec.rb b/spec/puppet-lint/plugins/world_writable_files_spec.rb index abc1234..def5678 100644 --- a/spec/puppet-lint/plugins/world_writable_files_spec.rb +++ b/spec/puppet-lint/plugins/world_writable_files_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe 'world_writable_files' do - context 'file with a mode of 640' do + context 'when file resource has a mode of 640' do let(:code) do <<-TEST_CLASS class locked_down_file { @@ -18,7 +18,7 @@ end end - context 'file with a mode of undef' do + context 'when file has a mode of undef' do let(:code) do <<-TEST_CLASS class undef_file_mode { @@ -35,7 +35,7 @@ end end - context 'file with a world writable octal mode of 666' do + context 'when file has a world writable octal mode of 666' do let(:msg) { 'files should not be created with world writable permissions' } let(:code) do <<-TEST_CLASS
Tidy the context wording to make the specs read better
diff --git a/lib/be_gateway/client.rb b/lib/be_gateway/client.rb index abc1234..def5678 100644 --- a/lib/be_gateway/client.rb +++ b/lib/be_gateway/client.rb @@ -4,7 +4,7 @@ TRANSACTIONS = %w(authorize capture void payment credit chargeback fraud_advice refund checkup) TRANSACTIONS.each do |tr_type| - define_method tr_type do |params| + define_method tr_type.to_sym do |params| response = post post_url(tr_type), { request: params } make_response(response) end
Change type of name for define_method to symbol.
diff --git a/test/acceptance/client_requests_info_from_server_test.rb b/test/acceptance/client_requests_info_from_server_test.rb index abc1234..def5678 100644 --- a/test/acceptance/client_requests_info_from_server_test.rb +++ b/test/acceptance/client_requests_info_from_server_test.rb @@ -20,4 +20,23 @@ end end + it "handles multiple requests in the proper order" do + response_count = 0 + @server.on(:client_info) do |message| + "Server responds #{response_count += 1}" + end + + message = Pantry::Communication::Message.new("client_info") + futures = [] + 10.times do + futures << @client1.send_request(message) + end + + Timeout::timeout(5) do + futures.each_with_index do |future, idx| + assert_equal ["Server responds #{idx + 1}"], future.value.body + end + end + end + end
Add test that client -> server requests are handled in order
diff --git a/lib/mobility/active_record/uniqueness_validator.rb b/lib/mobility/active_record/uniqueness_validator.rb index abc1234..def5678 100644 --- a/lib/mobility/active_record/uniqueness_validator.rb +++ b/lib/mobility/active_record/uniqueness_validator.rb @@ -4,7 +4,7 @@ def validate_each(record, attribute, value) klass = record.class if klass.translated_attribute_names.include?(attribute.to_s) || - (Array(options[:scope]).map(&:to_s) & klass.translated_attribute_names) + (Array(options[:scope]).map(&:to_s) & klass.translated_attribute_names).present? return unless value.present? relation = klass.send(Mobility.query_method).where(attribute => value) relation = relation.where.not(klass.primary_key => record.id) if record.persisted?
Use present? to handle empty array
diff --git a/claide.gemspec b/claide.gemspec index abc1234..def5678 100644 --- a/claide.gemspec +++ b/claide.gemspec @@ -12,7 +12,7 @@ s.summary = "A small command-line interface framework." - s.files = %w{ lib/claide.rb README.markdown LICENSE } + s.files = Dir["lib/**/*.rb"] + %w{ README.markdown LICENSE } s.require_paths = %w{ lib } ## Make sure you can build the gem on older versions of RubyGems too:
[Gemspec] Include all files in lib
diff --git a/spec/orderable_spec.rb b/spec/orderable_spec.rb index abc1234..def5678 100644 --- a/spec/orderable_spec.rb +++ b/spec/orderable_spec.rb @@ -7,9 +7,9 @@ it 'adds a product to the order when one is found' do product = Omniorder::Product.new(:code => 'CODE1') - expect(Omniorder::Product).to receive(:find_by_code). - with('CODE1'). - and_return(product) + expect(Omniorder::Product).to receive(:find_by_code) + .with('CODE1') + .and_return(product) order.add_product_by_code('CODE1')
Revert "Attempt to fix specs with Rubinius" This reverts commit f1e6798ad6c24fa3185141f6918be0169da2dc09.
diff --git a/lib/alephant/broker/models/response/batch_response.rb b/lib/alephant/broker/models/response/batch_response.rb index abc1234..def5678 100644 --- a/lib/alephant/broker/models/response/batch_response.rb +++ b/lib/alephant/broker/models/response/batch_response.rb @@ -23,13 +23,17 @@ def json get_components.each do |component| id = component['component'] - options = component.fetch(:options, {}) + options = set_keys_to_symbols component.fetch('options', {}) @request.set_component(id, options) component.store('body', AssetResponse.new(@request, @config).content) component.delete('options') end + end + + def set_keys_to_symbols(hash) + Hash[hash.map { |k,v| [k.to_sym, v] }] end def batch_id
Fix bug with fetching option hash key
diff --git a/lib/erforscher/runner.rb b/lib/erforscher/runner.rb index abc1234..def5678 100644 --- a/lib/erforscher/runner.rb +++ b/lib/erforscher/runner.rb @@ -12,8 +12,8 @@ def run explored = explorer.discover(@config['tags']) - entries = explored.sort.map { |ex| formatter.format(ex) } - hostsfile.write(entries) + entries = explored.map { |ex| formatter.format(ex) } + hostsfile.write(entries.sort) hostsfile.switchero end
Sort (new) entries before writing them Make that hostsfile look pretty.
diff --git a/capistrano-alchemy.gemspec b/capistrano-alchemy.gemspec index abc1234..def5678 100644 --- a/capistrano-alchemy.gemspec +++ b/capistrano-alchemy.gemspec @@ -6,8 +6,8 @@ Gem::Specification.new do |spec| spec.name = "capistrano-alchemy" spec.version = Capistrano::Alchemy::VERSION - spec.authors = ["Martin Meyerhoff"] - spec.email = ["mamhoff@googlemail.com"] + spec.authors = ["Martin Meyerhoff", "Thomas von Deyen"] + spec.email = ["mamhoff@googlemail.com", "thomas@vondeyen.com"] spec.summary = %q{Capistrano Tasks for AlchemyCMS.} spec.homepage = "https://alchemy-cms.com" spec.license = "MIT"
Add Thomas von Deyen to authors
diff --git a/recipes/mod_dav_fs.rb b/recipes/mod_dav_fs.rb index abc1234..def5678 100644 --- a/recipes/mod_dav_fs.rb +++ b/recipes/mod_dav_fs.rb @@ -0,0 +1,20 @@+# +# Cookbook Name:: apache2 +# Recipe:: dav_fs +# +# Copyright 2011, Atriso +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +apache_module "dav_fs"
Support for dav_fs apache module.
diff --git a/pages/spec/support/refinery/pages/caching_helpers.rb b/pages/spec/support/refinery/pages/caching_helpers.rb index abc1234..def5678 100644 --- a/pages/spec/support/refinery/pages/caching_helpers.rb +++ b/pages/spec/support/refinery/pages/caching_helpers.rb @@ -13,10 +13,10 @@ Refinery::PagesController.any_instance.unstub(:refinery_user?) end - RSpec::Matchers.define :be_cached do + RSpec::Matchers.define :be_cached do match do |page| - File.exists? (cached_file_path(page)) + File.exists?(cached_file_path(page)) end end -end+end
Fix warning regarding putting a space before parentheses.
diff --git a/config/deploy/production.rb b/config/deploy/production.rb index abc1234..def5678 100644 --- a/config/deploy/production.rb +++ b/config/deploy/production.rb @@ -3,4 +3,4 @@ role :db, %w(deploy@localhost) server 'localhost', user: 'deploy', roles: %w(web app) set :rails_env, 'production' -set :linked_files, %w{config/database.yml} +set :linked_files, %w{config/database.yml config/secrets.yml}
Add support for secrets deployment
diff --git a/lib/qbwc_workers/requests/sales_tax_item_import.rb b/lib/qbwc_workers/requests/sales_tax_item_import.rb index abc1234..def5678 100644 --- a/lib/qbwc_workers/requests/sales_tax_item_import.rb +++ b/lib/qbwc_workers/requests/sales_tax_item_import.rb @@ -1,6 +1,6 @@ class QbwcWorkers::Requests::SalesTaxItemImport < QbwcWorkers::Requests::BaseImport self.query ={ - :sales_tax_item_query_rq =>{ + :item_sales_tax_query_rq =>{ } }
Fix to pulling in sales tax items
diff --git a/Casks/lingo.rb b/Casks/lingo.rb index abc1234..def5678 100644 --- a/Casks/lingo.rb +++ b/Casks/lingo.rb @@ -2,7 +2,7 @@ version :latest sha256 :no_check - # nounproject.s3.amazonaws.com/lingo was verified as official when first introduced to the cask. + # nounproject.s3.amazonaws.com/lingo was verified as official when first introduced to the cask url 'https://nounproject.s3.amazonaws.com/lingo/Lingo.dmg' name 'Lingo' homepage 'https://lingoapp.com'
Fix `url` stanza comment for Lingo.
diff --git a/lib/rails_admin/config/fields/types/active_storage.rb b/lib/rails_admin/config/fields/types/active_storage.rb index abc1234..def5678 100644 --- a/lib/rails_admin/config/fields/types/active_storage.rb +++ b/lib/rails_admin/config/fields/types/active_storage.rb @@ -0,0 +1,43 @@+module RailsAdmin + module Config + module Fields + module Types + class ActiveStorage < RailsAdmin::Config::Fields::Types::FileUpload + RailsAdmin::Config::Fields::Types.register(self) + + register_instance_option :thumb_method do + { resize: '300x200>' } + end + + register_instance_option :delete_method do + "remove_#{name}" if bindings[:object].respond_to?("remove_#{name}") + end + + register_instance_option :presence_method do + # `attachment` returns Attachment instance or `nil` if not attached + :attachment + end + + register_instance_option :image? do + if value.attached? + value.filename.to_s.split('.').last =~ /jpg|jpeg|png|gif|svg/i + end + end + + def resource_url(thumb = false) + return nil unless value.attached? + v = bindings[:view] + if thumb && value.variable? + variant = value.variant(thumb) + Rails.application.routes.url_helpers.rails_blob_representation_path( + variant.blob.signed_id, variant.variation.key, variant.blob.filename, only_path: true + ) + else + Rails.application.routes.url_helpers.rails_blob_path(value, only_path: true) + end + end + end + end + end + end +end
Add Active Storage field type
diff --git a/lib/souschef/template.rb b/lib/souschef/template.rb index abc1234..def5678 100644 --- a/lib/souschef/template.rb +++ b/lib/souschef/template.rb @@ -5,6 +5,7 @@ require 'souschef/template/rubocop' require 'souschef/template/spec_helper' require 'souschef/template/serverspec' +require 'souschef/template/rakefile' module Souschef # Creates various files from predefined templates @@ -19,6 +20,7 @@ Souschef::Template::Metadata.new.create(cookbook) Souschef::Template::License.new.create(cookbook) Souschef::Template::Readme.new.create(cookbook) + Souschef::Template::Rakefile.new.create(cookbook) end end end
Add Rakefile creation to the list
diff --git a/lib/tasks/coveralls.rake b/lib/tasks/coveralls.rake index abc1234..def5678 100644 --- a/lib/tasks/coveralls.rake +++ b/lib/tasks/coveralls.rake @@ -1,5 +1,5 @@ if Rails.env.development? or Rails.env.test? require 'coveralls/rake/task' Coveralls::RakeTask.new - task :test_with_coveralls => ['spec', :cucumber, 'coveralls:push'] + task :test_with_coveralls => ['db:setup', 'spec', :cucumber, 'coveralls:push'] end
Add 'db:setup' to Travis CI task
diff --git a/test/integration/default/serverspec/repositories_spec.rb b/test/integration/default/serverspec/repositories_spec.rb index abc1234..def5678 100644 --- a/test/integration/default/serverspec/repositories_spec.rb +++ b/test/integration/default/serverspec/repositories_spec.rb @@ -0,0 +1,19 @@+require 'serverspec_helper' + +describe 'nexus::repositories' do + describe command('curl -uadmin:admin123 http://localhost:8081/service/siesta/rest/v1/script -X POST -H "Content-Type: application/json" -d \'{"name":"get_repo","type":"groovy","content":"repository.repositoryManager.get(args)"}\'') do + its(:exit_status) { should eq 0 } + end + + describe command('curl -uadmin:admin123 http://localhost:8081/service/siesta/rest/v1/script/foo/run -X POST -H "Content-Type: text/plain"') do + its(:exit_status) { should eq 0 } + end + + describe command('curl -uadmin:admin123 http://localhost:8081/service/siesta/rest/v1/script/get_repo/run -X POST -H "Content-Type: text/plain" -d foo') do + its(:stdout) { should contain('result').before("name='foo'") } + end + + describe command('curl -uadmin:admin123 http://localhost:8081/service/siesta/rest/v1/script/get_repo/run -X POST -H "Content-Type: text/plain" -d doesnotexist') do + its(:stdout) { should contain('result').before('null') } + end +end
Add integration tests for repositories
diff --git a/lib/visa_net_uy/xmler.rb b/lib/visa_net_uy/xmler.rb index abc1234..def5678 100644 --- a/lib/visa_net_uy/xmler.rb +++ b/lib/visa_net_uy/xmler.rb @@ -62,7 +62,7 @@ return fields unless root.name == ROOT_NAME root.elements.each do |child| - fields[child.name] = child.get_text + fields[child.name] = child.get_text.value end fields
Fix response hash text class
diff --git a/app/serializers/api/v1/historical_emissions/record_serializer.rb b/app/serializers/api/v1/historical_emissions/record_serializer.rb index abc1234..def5678 100644 --- a/app/serializers/api/v1/historical_emissions/record_serializer.rb +++ b/app/serializers/api/v1/historical_emissions/record_serializer.rb @@ -3,6 +3,7 @@ module HistoricalEmissions class RecordSerializer < ActiveModel::Serializer belongs_to :location + belongs_to :iso_code3 belongs_to :gas belongs_to :data_source, key: :source belongs_to :sector @@ -11,6 +12,10 @@ def location object.location.wri_standard_name + end + + def iso_code3 + object.location.iso_code3 end def gas
Include iso_code3 in emissions request