diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/finite_machine/transition_builder.rb b/lib/finite_machine/transition_builder.rb index abc1234..def5678 100644 --- a/lib/finite_machine/transition_builder.rb +++ b/lib/finite_machine/transition_builder.rb @@ -48,9 +48,7 @@ if machine.singleton_class.send(:method_defined?, name) machine.events_chain.insert(name, transition) else - _event = Event.new(machine, name: name) - _event << transition - machine.events_chain.add(name, _event) + machine.events_chain.add(name, transition) event_definition.apply(name) end
Change to remove event dependency.
diff --git a/spec/active_decorator/graphql_spec.rb b/spec/active_decorator/graphql_spec.rb index abc1234..def5678 100644 --- a/spec/active_decorator/graphql_spec.rb +++ b/spec/active_decorator/graphql_spec.rb @@ -39,13 +39,7 @@ end specify do - query = <<~QUERY - { - test_model { - decoration_method - } - } - QUERY + query = "{ test_model { decoration_method } }" result = TestSchema.execute( query,
Fix test failures on Ruby 2.2.7.
diff --git a/spec/electric_sheep/transport_spec.rb b/spec/electric_sheep/transport_spec.rb index abc1234..def5678 100644 --- a/spec/electric_sheep/transport_spec.rb +++ b/spec/electric_sheep/transport_spec.rb @@ -21,7 +21,7 @@ ) ElectricSheep::Helpers::Directories.any_instance.expects(:mk_project_directory!) metadata.expects(:type).returns(:do) - transport.perform + transport.perform! transport.done.must_equal true end end
Fix spec of Transport module
diff --git a/spec/requests/index_endpoints_spec.rb b/spec/requests/index_endpoints_spec.rb index abc1234..def5678 100644 --- a/spec/requests/index_endpoints_spec.rb +++ b/spec/requests/index_endpoints_spec.rb @@ -0,0 +1,20 @@+require 'rails_helper' + +describe "GET /districts/:district/endpoints", type: :request do + let(:user) { create :user } + let(:district) { create :district } + + it "returns a list of endpoint" do + district.endpoints.create(name: "ep1") + district.endpoints.create(name: "ep2") + + api_request(:get, "/v1/districts/#{district.name}/endpoints") + expect(response.status).to eq 200 + endpoints = JSON.load(response.body)["endpoints"] + expect(endpoints.count).to eq 2 + expect(endpoints[0]["name"]).to eq "ep1" + expect(endpoints[0]["dns_name"]).to be_blank + expect(endpoints[1]["name"]).to eq "ep2" + expect(endpoints[1]["dns_name"]).to be_blank + end +end
Add index endpoint request spec
diff --git a/spec/views/header_sign_in_box_spec.rb b/spec/views/header_sign_in_box_spec.rb index abc1234..def5678 100644 --- a/spec/views/header_sign_in_box_spec.rb +++ b/spec/views/header_sign_in_box_spec.rb @@ -8,7 +8,7 @@ allow(view).to receive(:user_signed_in?) { logged_in } allow(view).to receive(:display_search_box_in_header?) - allow(view).to receive(:locals) { [] } + allow(view).to receive(:alternate_locales) { [] } render end
Fix test with incorrect locale name
diff --git a/saltstack/test/spec/server/pound_spec.rb b/saltstack/test/spec/server/pound_spec.rb index abc1234..def5678 100644 --- a/saltstack/test/spec/server/pound_spec.rb +++ b/saltstack/test/spec/server/pound_spec.rb @@ -7,8 +7,8 @@ it { should be_running } end - describe port(443) do - it { should be_listening } - end +# describe port(443) do +# it { should be_listening } +# end end
Disable pound port checking with autotest
diff --git a/lib/rrj/rabbit/publish/base_publisher.rb b/lib/rrj/rabbit/publish/base_publisher.rb index abc1234..def5678 100644 --- a/lib/rrj/rabbit/publish/base_publisher.rb +++ b/lib/rrj/rabbit/publish/base_publisher.rb @@ -47,3 +47,4 @@ require 'rrj/rabbit/publish/publisher' require 'rrj/rabbit/publish/listener' +require 'rrj/rabbit/publish/listener_admin'
Add require for admin listener
diff --git a/acceptance/tests/storeconfigs/non_parameter_queries.rb b/acceptance/tests/storeconfigs/non_parameter_queries.rb index abc1234..def5678 100644 --- a/acceptance/tests/storeconfigs/non_parameter_queries.rb +++ b/acceptance/tests/storeconfigs/non_parameter_queries.rb @@ -0,0 +1,99 @@+test_name "non-parameter queries" do + + exporter, *collectors = hosts + + dir = collectors.first.tmpdir('collections') + + manifest = <<MANIFEST +node "#{exporter}" { + @@file { 'file-a': + path => "#{dir}/file-a", + ensure => present, + tag => here, + } + + @@file { 'file-b': + path => "#{dir}/file-b", + ensure => present, + tag => [here, there], + } + + @@file { 'file-c': + path => "#{dir}/file-c", + ensure => present, + tag => [there], + } +} + +node #{collectors.map {|collector| "\"#{collector}\""}.join(', ')} { + # The magic of facts! + include $test_name + + file { "#{dir}": + ensure => directory, + } +} + +class title_query { + File <<| title == 'file-c' |>> +} + +class title_query_no_match { + File <<| title == 'file' |>> +} + +class tag_query { + File <<| tag == 'here' |>> +} + +class tag_inverse_query { + File <<| tag != 'here' |>> +} +MANIFEST + + tmpdir = master.tmpdir('storeconfigs') + + manifest_file = File.join(tmpdir, 'site.pp') + + create_remote_file(master, manifest_file, manifest) + + on master, "chmod -R +rX #{tmpdir}" + + with_master_running_on master, "--storeconfigs --storeconfigs_backend puppetdb --autosign true --manifest #{manifest_file}", :preserve_ssl => true do + + step "Run exporter to populate the database" do + run_agent_on exporter, "--test --server #{master}", :acceptable_exit_codes => [0,2] + + # Wait until the catalog has been processed + sleep_until_queue_empty database + end + + test_collection = proc do |nodes, test_name, expected| + on nodes, "rm -rf #{dir}" + + on nodes, "FACTER_test_name=#{test_name} puppet agent --test --server #{master}", :acceptable_exit_codes => [0,2] + + nodes.each do |node| + on node, "ls #{dir}" + created = stdout.split.map(&:strip).sort + assert_equal(expected, created, "#{node} collected #{created.join(', ')} instead of #{expected.join(', ')} for #{test_name}") + end + end + + step "title queries should work" do + test_collection.call collectors, "title_query", %w[file-c] + end + + step "title queries should work when nothing matches" do + test_collection.call collectors, "title_query_no_match", %w[] + end + + step "tag queries should work" do + test_collection.call collectors, "tag_query", %w[file-a file-b] + end + + step "'not' tag queries should work" do + test_collection.call collectors, "tag_inverse_query", %w[file-c] + end + end +end
Add a test of tag/title queries This ensures that title queries match, that they match only exactly, and that tag queries match both single and array tags, and that matching a missing tag works.
diff --git a/lib/ProMotion/cocoatouch/NavigationController.rb b/lib/ProMotion/cocoatouch/NavigationController.rb index abc1234..def5678 100644 --- a/lib/ProMotion/cocoatouch/NavigationController.rb +++ b/lib/ProMotion/cocoatouch/NavigationController.rb @@ -1,7 +1,15 @@ module ProMotion - class NavigationController < UINavigationController - def shouldAutorotate - visibleViewController.shouldAutorotate - end - end + class NavigationController < UINavigationController + def shouldAutorotate + visibleViewController.shouldAutorotate + end + + def supportedInterfaceOrientations + visibleViewController.supportedInterfaceOrientations + end + + def preferredInterfaceOrientationForPresentation + visibleViewController.preferredInterfaceOrientationForPresentation + end + end end
Support iOS 6 force rotation.
diff --git a/lib/fotoramajs.rb b/lib/fotoramajs.rb index abc1234..def5678 100644 --- a/lib/fotoramajs.rb +++ b/lib/fotoramajs.rb @@ -1,5 +1,11 @@ # Used only for Ruby on Rails gem to tell, that gem contain `lib/assets`. module Fotoramajs + class Railtie < Rails::Railtie + initializer 'fotorama.config' do |app| + app.config.assets.precompile += ['fotorama.png', 'fotorama@2x.png'] + end + end + module Rails class Engine < ::Rails::Engine end
Add fotorama images to precompile
diff --git a/lib/llt/diff/treebank/parser/nokogiri_handler.rb b/lib/llt/diff/treebank/parser/nokogiri_handler.rb index abc1234..def5678 100644 --- a/lib/llt/diff/treebank/parser/nokogiri_handler.rb +++ b/lib/llt/diff/treebank/parser/nokogiri_handler.rb @@ -22,7 +22,7 @@ private def register_word(attrs) - super(first_val(attrs)) + super(attrs.shift.last) # need to shift, we don't want the id in the next step attrs.each { |k, v| @word.send("#{k}=", v) } end end
Fix minor error in refactored NokogiriHandler
diff --git a/lib/full_text_search/fetcher.rb b/lib/full_text_search/fetcher.rb index abc1234..def5678 100644 --- a/lib/full_text_search/fetcher.rb +++ b/lib/full_text_search/fetcher.rb @@ -0,0 +1,23 @@+module FullTextSearch + module Fetcher + def load_result_ids + ret = [] + # get all the results ranks and ids + @scope.each do |scope| + klass = scope.singularize.camelcase.constantize + ranks_and_ids_in_scope = klass.search_result_ranks_and_ids(@tokens, User.current, @projects, @options) + ret += ranks_and_ids_in_scope.map {|rs| [scope, rs]} + end + # sort results, higher rank and id first + # a.last # => [score, id] + if @options[:params][:order_type] == "desc" + ret.sort! {|a, b| b.last <=> a.last } + else + ret.sort! {|a, b| a.last <=> b.last } + end + # only keep ids now that results are sorted + ret.map! {|scope, r| [scope, r.last]} + ret + end + end +end
Order search result by selected condition
diff --git a/lib/halfday/nginx/capistrano.rb b/lib/halfday/nginx/capistrano.rb index abc1234..def5678 100644 --- a/lib/halfday/nginx/capistrano.rb +++ b/lib/halfday/nginx/capistrano.rb @@ -7,9 +7,12 @@ desc 'Add app configuration for Mirego infrastructure' task :configure, roles: :app do if %w{ci qa staging}.include?(rails_env) - conf = File.open(File.expand_path('../templates/app.conf', __FILE__)).read + conf_path = "/etc/nginx/apps.conf.d/#{application}.conf" - run "echo \"#{conf}\" > /etc/nginx/apps.conf.d/#{application}.conf" + upload File.expand_path('../templates/app.conf', __FILE__), conf_path + + run "sed -i #{conf_path} -e s/\\\\[APPLICATION\\\\]/#{application}/g" + run "source #{current_path}/.env && sed -i #{conf_path} -e s/\\\\[PORT\\\\]/$PORT/g" run "sudo service nginx reload" end end
Fix nginx configuration with file upload and sed
diff --git a/spec/factories/internal_user.rb b/spec/factories/internal_user.rb index abc1234..def5678 100644 --- a/spec/factories/internal_user.rb +++ b/spec/factories/internal_user.rb @@ -19,6 +19,16 @@ singleton_internal_user end + factory :learner, class: 'InternalUser' do + activated_user + association :consumer + generated_email + generated_user_name + password { 'learner' } + role { 'learner' } + singleton_internal_user + end + trait :activated_user do after(:create, &:activate!) end
Add factory for internal user with learner role
diff --git a/spec/support/rdb_request_helpers.rb b/spec/support/rdb_request_helpers.rb index abc1234..def5678 100644 --- a/spec/support/rdb_request_helpers.rb +++ b/spec/support/rdb_request_helpers.rb @@ -31,7 +31,7 @@ # Renders an image of current page with poltergeist. def render_image(name) - page.driver.render("tmp/screenshot-#{name}.png", :full => true) + page.driver.render("../../screenshot-#{name}.png", :full => true) end # Wait for finish of ajax request
Save screenshots in rdb tmp dir instead redmine tmp dir.
diff --git a/axiom-types.gemspec b/axiom-types.gemspec index abc1234..def5678 100644 --- a/axiom-types.gemspec +++ b/axiom-types.gemspec @@ -19,9 +19,9 @@ gem.required_ruby_version = '>= 1.9.3' - gem.add_runtime_dependency('descendants_tracker', '~> 0.0.4') - gem.add_runtime_dependency('ice_nine', '~> 0.11.0') - gem.add_runtime_dependency('thread_safe', '~> 0.3', '>= 0.3.1') + gem.add_runtime_dependency('descendants_tracker', '~> 0.0', '>= 0.0.4') + gem.add_runtime_dependency('ice_nine', '~> 0.11', '>= 0.11.0') + gem.add_runtime_dependency('thread_safe', '~> 0.3', '>= 0.3.1') gem.add_development_dependency('bundler', '~> 1.5', '>= 1.5.3') end
Change dependencies to be friendly to semantically versioned gems
diff --git a/lib/minx/utils.rb b/lib/minx/utils.rb index abc1234..def5678 100644 --- a/lib/minx/utils.rb +++ b/lib/minx/utils.rb @@ -1,6 +1,6 @@ module Minx - class << self + module Utils # Map messages from +input+ to +output+. # @@ -52,6 +52,7 @@ end end end + end - end + extend Utils end
Move utility methods into their own module
diff --git a/lib/acts_as_licensable/license.rb b/lib/acts_as_licensable/license.rb index abc1234..def5678 100644 --- a/lib/acts_as_licensable/license.rb +++ b/lib/acts_as_licensable/license.rb @@ -1,8 +1,11 @@ class License < ActiveRecord::Base #:nodoc: + has_many :licensings, :dependent => :destroy validates_presence_of :name validates_presence_of :url validates_inclusion_of :kind, :in => [1, 2, 3] + + attr_accessible :name, :short_name, :url, :version, :kind def self.setup_licenses license_yml = YAML.load(File.open(File.join(File.dirname(__FILE__), "../../fixtures/licenses.yml")))
Add reverse association of licensings
diff --git a/lib/notifiable.rb b/lib/notifiable.rb index abc1234..def5678 100644 --- a/lib/notifiable.rb +++ b/lib/notifiable.rb @@ -1,3 +1,5 @@+require 'simple_uuid' + require 'notifiable/active_record' require 'notifiable/app' require 'notifiable/notifiable_concern' @@ -24,6 +26,9 @@ mattr_accessor :notifier_classes @@notifier_classes = {} + mattr_accessor :count_opens + @@count_opens = false + def self.configure yield self end
Add count_opens and simple_uuid generator in config file
diff --git a/lib/voicearchive/task_client.rb b/lib/voicearchive/task_client.rb index abc1234..def5678 100644 --- a/lib/voicearchive/task_client.rb +++ b/lib/voicearchive/task_client.rb @@ -32,6 +32,14 @@ JSON.parse(response.body) end + def search_tasks(search_options, options) + response = call('ordertask/search', options.merge({ + search: search_options, + }), 'post') + + JSON.parse(response.body) + end + def count_tasks(options = {}) options[:count] = true response = call("task", options, 'get')
Implement search_tasks on the TaskClient
diff --git a/lib/conjur/patches/rest-client.rb b/lib/conjur/patches/rest-client.rb index abc1234..def5678 100644 --- a/lib/conjur/patches/rest-client.rb +++ b/lib/conjur/patches/rest-client.rb @@ -26,7 +26,7 @@ class MIME::Types def self.type_for_extension ext candidates = of ext - candidates.empty? ? ext : candidates[0].content_type + (candidates.nil? or candidates.empty?) ? ext : candidates[0].content_type end end end
Fix the mime_types issue once and for all. Although it's been difficult to reproduce, there is anecdotal evidence that this will sometimes raise an exception because `candidates` is `nil`. An extra test here won't hurt anything.
diff --git a/lib/kosmos/packages/safe_chute.rb b/lib/kosmos/packages/safe_chute.rb index abc1234..def5678 100644 --- a/lib/kosmos/packages/safe_chute.rb +++ b/lib/kosmos/packages/safe_chute.rb @@ -0,0 +1,8 @@+class SafeChute < Kosmos::Package + title 'Safe Chute' + url 'http://genesisrage.net/ksp/SafeChute.zip' + + def install + merge_directory 'GameData' + end +end
Add a package for SafeChute.
diff --git a/lib/sequel/adapters/jdbc/mssql.rb b/lib/sequel/adapters/jdbc/mssql.rb index abc1234..def5678 100644 --- a/lib/sequel/adapters/jdbc/mssql.rb +++ b/lib/sequel/adapters/jdbc/mssql.rb @@ -2,6 +2,11 @@ module Sequel module JDBC + class Database + # Alias the generic JDBC version so it can be called directly later + alias jdbc_schema_parse_table schema_parse_table + end + # Database and Dataset instance methods for MSSQL specific # support via JDBC. module MSSQL @@ -29,6 +34,12 @@ stmt.close end end + + # Call the generic JDBC version instead of MSSQL version, + # since the JDBC version handles primary keys. + def schema_parse_table(table, opts={}) + jdbc_schema_parse_table(table, opts) + end end # Dataset class for MSSQL datasets accessed via JDBC.
Use generic JDBC schema parsing in MSSQL subadapter, since it handles primary keys
diff --git a/lib/disclosure.rb b/lib/disclosure.rb index abc1234..def5678 100644 --- a/lib/disclosure.rb +++ b/lib/disclosure.rb @@ -1,4 +1,5 @@ require "disclosure/engine" +require 'disclosure/exceptions' require "disclosure/configuration" module Disclosure @@ -8,16 +9,25 @@ def self.bootstrap! Disclosure.configuration.notifier_classes.each do |klass| - unless klass.methods.include?(:notifiable_actions) - klass.define_method(:notifiable_actions) do - raise ::NotImplementedError, "Notifiable actions must be defined in #{klass.name}." + if !klass.methods.include?(:notifiable_actions) + klass.class_eval do + class << self + def notifiable_actions + raise Disclosure::NotifiableActionsNotDefined.new("Notifiable actions must be defined in #{self.name}.") + end + end end end - klass.notifiable_actions.each do |action| - unless klass.instance_methods.include?(:"#{action}?") - klass.define_method(:"#{action}?") do - raise ::NotImplementedError, "#{action}? must be defined in #{klass}." + # We don't use an else here, because we may have *just* added + # the method - it's not a if this, else that - we may need to do both + if klass.methods.include?(:notifiable_actions) + # If notifiable actions has just been defined, it will raise an exception + (klass.notifiable_actions rescue []).each do |action| + unless klass.instance_methods.include?(:"#{action}?") + klass.define_method(:"#{action}?") do + raise Disclosure::ActionMethodNotDefined.new("#{action}? must be defined in #{klass}.") + end end end end
Adjust bootstrap method to spec
diff --git a/db/migrate/20200114203042_add_missing_platform_info.rb b/db/migrate/20200114203042_add_missing_platform_info.rb index abc1234..def5678 100644 --- a/db/migrate/20200114203042_add_missing_platform_info.rb +++ b/db/migrate/20200114203042_add_missing_platform_info.rb @@ -5,6 +5,16 @@ runs.each do |run_id| run = Run.find(run_id) run.update_platform_info(run.sequence_run.attributes) + # Sending run to firestore + # check that the local environment has + # ENV["REPORT_SERVICE_SELF_URL"] + # ENV["REPORT_SERVICE_URL"] + # ENV["REPORT_SERVICE_TOKEN"] + sender = ReportService::RunSender.new(run, { send_all_answers: true }) + result = sender.send + if !result || !result["success"] + puts "Failed to send Sequence Run: #{run.id}" + end end end
Update migration, send data to firestore [#170193041]
diff --git a/lib/slatan/ear.rb b/lib/slatan/ear.rb index abc1234..def5678 100644 --- a/lib/slatan/ear.rb +++ b/lib/slatan/ear.rb @@ -4,11 +4,11 @@ using StringEx class Ear - def initialize(mouth) + def initialize() @concerns = [] Dir[File.expand_path('../../../concerns', __FILE__) << '/*.rb'].each do |file| require file - @concerns << Object.const_get(File.basename(file, '.*').camelize).new(mouth) + @concerns << Object.const_get(File.basename(file, '.*').camelize).new end end
Remove Mouth dependency from Ear class
diff --git a/lib/url_signer.rb b/lib/url_signer.rb index abc1234..def5678 100644 --- a/lib/url_signer.rb +++ b/lib/url_signer.rb @@ -5,11 +5,37 @@ module_function + # Returns a new <tt>URI</tt> instance by appending a <tt>signature</tt> parameter to the query of +url+. + # The method accepts that +url+ can be either a <tt>String</tt> or a <tt>URI</tt> instance. + # + # signed_url = UrlSigner.sign('http://google.fr&q=test') # => <URI::HTTP...> + # + # The following key/value parameters can be given to +options+: + # * <tt>:key</tt> - the secret key used for encryption + # * <tt>:hash_method</tt> - the hash function to pass to <tt>Digest::HMAC</tt>. Defaults to <tt>Digest::SHA1</tt>. + # + # Note that if a +URL_SIGNING_KEY+ environment variable is defined, it will be used as a default value for the +:key+ option. def sign(url, *options) temp_signer = UrlSigner::Signer.new(url, *options) temp_signer.sign end + # Verify the authenticity of the +url+ by checking the value of the <tt>signature</tt> query parameter (if present). + # The method accepts that +url+ can be either a <tt>String</tt> or a <tt>URI</tt> instance. + # + # The following key/value parameters can be given to +options+: + # * <tt>:key</tt> - the secret key used for encryption + # * <tt>:hash_method</tt> - the hash function to pass to <tt>Digest::HMAC</tt>. Defaults to <tt>Digest::SHA1</tt>. + # + # Note that if a +URL_SIGNING_KEY+ environment variable is defined, it will be used as a default value for the +:key+ option. + # + # ==== Examples + # + # dummy_url = 'http://google.fr?q=test + # UrlSigner.valid?(dummy_url) # => false + # + # signed_url = UrlSigner.sign('http://google.fr&q=test') + # UrlSigner.valid?(signed_url) # => true def valid?(url, *options) temp_verifier = UrlSigner::Verifier.new(url, *options) temp_verifier.valid?
Add basic doc for UrlSigner.{sign|valid?}
diff --git a/Casks/sql-power-architect-jdbc.rb b/Casks/sql-power-architect-jdbc.rb index abc1234..def5678 100644 --- a/Casks/sql-power-architect-jdbc.rb +++ b/Casks/sql-power-architect-jdbc.rb @@ -0,0 +1,11 @@+cask 'sql-power-architect-jdbc' do + version '1.0.8' + sha256 'a564e294aba5e7f4701717f8d36a898b06e6354000df332e5b6aa41377b06665' + + url "http://download.sqlpower.ca/architect/#{version}/community/SQL-Power-Architect-OSX-#{version}.tar.gz" + name 'SQL Power Architect Community edition' + homepage 'http://www.sqlpower.ca/' + license :gpl + + app 'SQL Power Architect JDBC.app' +end
Add SQL Power Architect JDBC (Community) v1.0.8
diff --git a/spec/classes/homebrew_spec.rb b/spec/classes/homebrew_spec.rb index abc1234..def5678 100644 --- a/spec/classes/homebrew_spec.rb +++ b/spec/classes/homebrew_spec.rb @@ -4,7 +4,7 @@ let(:facts) { default_test_facts } let(:dir) { facts[:homebrew_root] } - let(:cmddir) { "#{dir}/Library/Taps/boxen/homebrew-brews/cmd" } + let(:cmddir) { "#{dir}/Homebrew/Library/Taps/boxen/homebrew-brews/cmd" } it do should contain_exec("install homebrew to #{dir}/Homebrew").with({ @@ -22,7 +22,7 @@ should contain_file("#{dir}/lib").with_ensure("directory") should contain_file(cmddir).with_ensure("directory") - should contain_file("#{dir}/Library/Taps").with_ensure("directory") + should contain_file("#{dir}/Homebrew/Library/Taps").with_ensure("directory") should contain_file("/test/boxen/cache/homebrew").with_ensure("directory") end end
Include Homebrew in library path
diff --git a/spec/features/comment_spec.rb b/spec/features/comment_spec.rb index abc1234..def5678 100644 --- a/spec/features/comment_spec.rb +++ b/spec/features/comment_spec.rb @@ -0,0 +1,23 @@+require 'rails_helper' + +describe 'Comments Panel' do + it "user can see comments on queried translation" do + pending + end + + context "when logged in" do + it "user can make comments on a query by clicking comment link" do + pending + end + + it "user can make comments on comments of a query by clicking nested comment link" do + pending + end + end + + context "when not logged in" do + it "user can't make comments on a query after clicking comment link" do + pending + end + end +end
Add skeleton for tests on features for comments
diff --git a/lib/health-data-standards/validate/schema_validator.rb b/lib/health-data-standards/validate/schema_validator.rb index abc1234..def5678 100644 --- a/lib/health-data-standards/validate/schema_validator.rb +++ b/lib/health-data-standards/validate/schema_validator.rb @@ -12,6 +12,7 @@ # Validate the document against the configured schema def validate(document,data={}) + @xsd.errors.clear doc = get_document(document) @xsd.validate(doc).map do |error| build_error(error.message, "/", data[:file_name])
Clear the @xsd error messages before validating, or else the previous document's errors get lumped in with this one's
diff --git a/lib/prospector.rb b/lib/prospector.rb index abc1234..def5678 100644 --- a/lib/prospector.rb +++ b/lib/prospector.rb @@ -6,6 +6,7 @@ require "prospector/configuration" require "prospector/error" require "prospector/background" +require "prospector/tasks" require "prospector/railtie" if defined?(Rails)
Include Rake tasks automatically for non-rails apps
diff --git a/publify_core/app/controllers/notes_controller.rb b/publify_core/app/controllers/notes_controller.rb index abc1234..def5678 100644 --- a/publify_core/app/controllers/notes_controller.rb +++ b/publify_core/app/controllers/notes_controller.rb @@ -17,7 +17,7 @@ end def show - @note = Note.published.find_by_permalink(CGI.escape(params[:permalink])) + @note = Note.published.find_by permalink: CGI.escape(params[:permalink]) return render 'errors/404', status: 404 unless @note
Replace use of Note.find_by_permalink with Note.find_by
diff --git a/plugins/rabbitmq/rabbitmq-stomp-alive.rb b/plugins/rabbitmq/rabbitmq-stomp-alive.rb index abc1234..def5678 100644 --- a/plugins/rabbitmq/rabbitmq-stomp-alive.rb +++ b/plugins/rabbitmq/rabbitmq-stomp-alive.rb @@ -0,0 +1,97 @@+#!/usr/bin/env ruby +# +# RabbitMQ check alive plugin +# === +# +# This plugin checks if RabbitMQ server is alive using the REST API +# +# Copyright 2013 Milos Gajdos +# +# Released under the same terms as Sensu (the MIT license); see LICENSE +# for details. + +require 'rubygems' if RUBY_VERSION < '1.9.0' +require 'sensu-plugin/check/cli' +require 'stomp' + +class CheckRabbitStomp < Sensu::Plugin::Check::CLI + + option :host, + :description => "RabbitMQ host", + :short => '-w', + :long => '--host HOST', + :default => 'localhost' + + option :username, + :description => "RabbitMQ username", + :short => '-u', + :long => '--username USERNAME', + :default => 'guest' + + option :password, + :description => "RabbitMQ password", + :short => '-p', + :long => '--password PASSWORD', + :default => 'guest' + + option :port, + :description => "RabbitMQ STOMP port", + :short => '-P', + :long => '--port PORT', + :default => '61613' + + option :ssl, + :description => "Enable SSL for connection to RabbitMQ", + :long => '--ssl', + :boolean => true, + :default => false + + option :queue, + :description => "Queue to post a message to and receive from", + :short => '-q', + :long => '--queue QUEUE', + :default => 'aliveness-test' + + def run + res = vhost_alive? + + if res["status"] == "ok" + ok res["message"] + elsif res["status"] == "critical" + critical res["message"] + else + unknown res["message"] + end + end + + def vhost_alive? + hash = { + :hosts => [ + { + :login => config[:username], + :passcode => config[:password], + :host => config[:host], + :port => config[:port], + :ssl => config[:ssl] + } + ], + :reliable => false, # disable failover + :connect_timeout => 10 + } + + begin + conn = Stomp::Client.new(hash) + conn.publish("/queue/#{config[:queue]}", "STOMP Alive Test") + conn.subscribe("/queue/#{config[:queue]}") do |msg| + end + { "status" => "ok", "message" => "RabbitMQ server is alive" } + rescue Errno::ECONNREFUSED + { "status" => "critical", "message" => "TCP connection refused" } + rescue Stomp::Error::BrokerException => e + { "status" => "critical", "message" => "Error from broker. Check auth details? #{e.message}" } + rescue Exception => e + { "status" => "unknown", "message" => "#{e.class}: #{e.message}" } + end + end + +end
Add RabbitMQ Alive check against STOMP
diff --git a/lib/cupertino/provisioning_portal/helpers.rb b/lib/cupertino/provisioning_portal/helpers.rb index abc1234..def5678 100644 --- a/lib/cupertino/provisioning_portal/helpers.rb +++ b/lib/cupertino/provisioning_portal/helpers.rb @@ -26,7 +26,9 @@ def team teams = [] page.form_with(:name => 'saveTeamSelection').radiobuttons.each do |radio| - name = page.search("label[for=\"#{radio.dom_id}\"]").first.text.strip + primary = page.search(".label-primary[for=\"#{radio.dom_id}\"]").first.text.strip + secondary = page.search(".label-secondary[for=\"#{radio.dom_id}\"]").first.text.strip + name = "#{primary}, #{secondary}" teams << [name, radio.value] end
Add support for multiple teams with the same primary name Change-Id: Ie70c29e16cbe41081fe13c1a1c0ae084cbef863f
diff --git a/favicon_party.gemspec b/favicon_party.gemspec index abc1234..def5678 100644 --- a/favicon_party.gemspec +++ b/favicon_party.gemspec @@ -27,6 +27,7 @@ s.add_development_dependency "minitest-reporters", "~> 1.4" s.add_development_dependency "pry", "~> 0.14" + s.add_dependency "webrick", "~> 1.7" s.add_dependency "nokogiri", "~> 1.11" s.add_dependency "mini_magick", "~> 4.11" end
Fix missing webrick error in ruby 3.0
diff --git a/lib/couchbase-id.rb b/lib/couchbase-id.rb index abc1234..def5678 100644 --- a/lib/couchbase-id.rb +++ b/lib/couchbase-id.rb @@ -1,4 +1,5 @@-require 'radix' +require 'radix/base' + if RUBY_PLATFORM == 'java' require 'couchbase-jruby-model' else
Use radix/base for ruby 2.1 compatibility
diff --git a/spec/unit/lib/angellist_api/client/users_spec.rb b/spec/unit/lib/angellist_api/client/users_spec.rb index abc1234..def5678 100644 --- a/spec/unit/lib/angellist_api/client/users_spec.rb +++ b/spec/unit/lib/angellist_api/client/users_spec.rb @@ -6,7 +6,7 @@ describe "#get_user" do it "gets 1/users/<id>" do id = "123" - client.should_receive(:get).with("1/users/#{id}").and_return("success") + client.should_receive(:get).with("1/users/#{id}", {}).and_return("success") client.get_user(id).should == "success" end end
Fix spec from adding options to get_user
diff --git a/spec/lib/spatial_features/has_spatial_features_spec.rb b/spec/lib/spatial_features/has_spatial_features_spec.rb index abc1234..def5678 100644 --- a/spec/lib/spatial_features/has_spatial_features_spec.rb +++ b/spec/lib/spatial_features/has_spatial_features_spec.rb @@ -0,0 +1,23 @@+require 'spec_helper' + +describe SpatialFeatures do + describe '::features' do + it 'returns the features of a class' + it 'returns the features of a scope' + end + + describe '#total_intersection_area_in_square_meters' do + TOLERANCE = 0.000001 # Because calculations are performed using projected geometry, there will be a slight inaccuracy + House = new_dummy_class + Disaster = new_dummy_class + + subject { create_record_with_polygon(House, Rectangle.new(1, 1)) } + + it 'can intersect a single record' do + flood = create_record_with_polygon(Disaster, Rectangle.new(1, 0.5)) + + expect(subject.total_intersection_area_in_square_meters(flood)) + .to be_within(TOLERANCE).of(0.5) + end + end +end
Add very basic intersection area test
diff --git a/omf_ec/lib/omf_ec/backward/core_ext/array.rb b/omf_ec/lib/omf_ec/backward/core_ext/array.rb index abc1234..def5678 100644 --- a/omf_ec/lib/omf_ec/backward/core_ext/array.rb +++ b/omf_ec/lib/omf_ec/backward/core_ext/array.rb @@ -7,7 +7,7 @@ def stopApplications if !self.empty? && self.all? { |v| v.class == OmfEc::Group } - self.each { |g| g.startApplications } + self.each { |g| g.stopApplications } end end
Fix stopApplications error in backward core ext
diff --git a/spec/support/test_datasource.rb b/spec/support/test_datasource.rb index abc1234..def5678 100644 --- a/spec/support/test_datasource.rb +++ b/spec/support/test_datasource.rb @@ -1,10 +1,7 @@-require 'spec_helper' -require 'rspec/mocks/standalone' - class TestDatasource def fetch { - 1 => double('station', + 1 => TestStation.new( id: 1, name: 'test-station-1', docks_total: 30, @@ -12,7 +9,7 @@ lat: 51.53005939, long: -0.120973687 ), - 2 => double('station', + 2 => TestStation.new( id: 2, name: 'test-station-2', docks_total: 30, @@ -22,4 +19,6 @@ ) } end + + TestStation = OpenStruct end
Move away from using RSpec double away from RSpec Whilst this class is only used in specs its not great practice and actually broke somehow in RSpec 3.2 Simpler to just use OpenStruct
diff --git a/munge/reporter.rb b/munge/reporter.rb index abc1234..def5678 100644 --- a/munge/reporter.rb +++ b/munge/reporter.rb @@ -33,7 +33,7 @@ end def output(fields) - $stderr.puts fields.join(',') + $stderr.puts fields.join(' ') end end
Use space as error delimiter, for usable links in Jenkins
diff --git a/guard-jasmine.gemspec b/guard-jasmine.gemspec index abc1234..def5678 100644 --- a/guard-jasmine.gemspec +++ b/guard-jasmine.gemspec @@ -16,6 +16,7 @@ s.rubyforge_project = 'guard-jasmine' s.add_dependency 'guard', '>= 0.4' + s.add_dependency 'multi_json', '~> 1.0.3' s.add_development_dependency 'bundler', '~> 1.0' s.add_development_dependency 'guard-rspec', '~> 0.4'
Add multi json as dependency.
diff --git a/moped-turbo.gemspec b/moped-turbo.gemspec index abc1234..def5678 100644 --- a/moped-turbo.gemspec +++ b/moped-turbo.gemspec @@ -14,6 +14,8 @@ s.summary = "C extensions for Moped, a Ruby driver for MongoDB" s.description = s.summary + s.add_dependency("moped", ["~> 1.1.3"]) + s.files = Dir.glob("lib/**/*") + Dir.glob("ext/**/*.{c,h,rb}") + %w(CHANGELOG.md LICENSE README.md) s.extensions = [ "ext/moped/turbo/extconf.rb" ] s.require_path = "lib"
Update gemspec, add moped dependency
diff --git a/examples/create_authorization.rb b/examples/create_authorization.rb index abc1234..def5678 100644 --- a/examples/create_authorization.rb +++ b/examples/create_authorization.rb @@ -1,8 +1,6 @@ module CreateAuthorization def CreateAuthorization.run(client, org) - region_id = "can" - card = client.cards.post(org, ::Io::Flow::V0::Models::CardForm.new( :number => "4012888888881881",
Remove unused 'region_id' var from example
diff --git a/spec/stress/channel_close_stress_spec.rb b/spec/stress/channel_close_stress_spec.rb index abc1234..def5678 100644 --- a/spec/stress/channel_close_stress_spec.rb +++ b/spec/stress/channel_close_stress_spec.rb @@ -1,6 +1,6 @@ require "spec_helper" -describe "Rapidly opening and closing lots of channels" do +describe "Rapidly closing lots of temporary channels" do before :all do @connection = Bunny.new(:automatic_recovery => false).tap do |c| c.start
Correct example group name to be unique
diff --git a/smartfocus.gemspec b/smartfocus.gemspec index abc1234..def5678 100644 --- a/smartfocus.gemspec +++ b/smartfocus.gemspec @@ -15,7 +15,7 @@ s.require_path = 'lib' s.authors = ['Bastien Gysler', 'eboutic.ch'] - s.email = ['basgys@gmail.com', 'tech@eboutic.ch'] + s.email = 'tech@eboutic.ch' s.homepage = 'https://github.com/eboutic/smartfocus' s.add_dependency("httparty", "~> 0.12.0")
Change support email from gem spec
diff --git a/got_fixed.gemspec b/got_fixed.gemspec index abc1234..def5678 100644 --- a/got_fixed.gemspec +++ b/got_fixed.gemspec @@ -13,7 +13,7 @@ s.summary = %q{Build a public dashboard of your private issue tracker} s.homepage = "https://github.com/ssaunier/got_fixed" - s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"] + s.files = Dir["{app,config,db,lib}/**/*"] + ["LICENSE.txt", "Rakefile", "README.rdoc"] s.test_files = Dir["spec/**/*"] s.add_dependency "rails", ">= 3.1"
Fix warning at bundle install
diff --git a/test/integration/db_setup/rspec/db_setup_spec.rb b/test/integration/db_setup/rspec/db_setup_spec.rb index abc1234..def5678 100644 --- a/test/integration/db_setup/rspec/db_setup_spec.rb +++ b/test/integration/db_setup/rspec/db_setup_spec.rb @@ -0,0 +1,31 @@+require 'spec_helper' +require 'json' + +describe 'db_setup' do + chef_run = ChefSpec::SoloRunner.new + + before(:all) do + chef_run.node.normal_attrs = property[:chef_attributes] + chef_run.converge('role[db_setup]') + end + + it 'is create yum global config' do + expect(file('/etc/yum.conf')).to be_file + end + + it 'is installed mysql package' do + expect(package('mysql-community-client')).to be_installed + end + + it 'is installed mysql-devel package' do + expect(package('mysql-community-devel')).to be_installed + end + + it 'is installed mysql-server package' do + expect(package('mysql-community-server')).to be_installed + end + + it 'is mysql service enabled and running' do + expect(service('mysqld')).to be_enabled.and be_running + end +end
Add db_setup spec of integration test of test-kicthen
diff --git a/spec/controllers/sessions_controller_spec.rb b/spec/controllers/sessions_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/sessions_controller_spec.rb +++ b/spec/controllers/sessions_controller_spec.rb @@ -15,6 +15,19 @@ end describe "with invalid params" do + + it "should return a HTTP 401 code if the user doesn't exist" do + post :create, username: "tooth.fairy@example.com", password: "abcd" + + response.status.should == 401 # Unauthorized + end + + it "should return a HTTP 401 code if the password is wrong" do + user = create(:user, password: "12345678") + post :create, username: user.email, password: "abcd" + + response.status.should == 401 # Unauthorized + end end end
Add invalid data tests for session controller
diff --git a/spec/factories/configuration_factory_spec.rb b/spec/factories/configuration_factory_spec.rb index abc1234..def5678 100644 --- a/spec/factories/configuration_factory_spec.rb +++ b/spec/factories/configuration_factory_spec.rb @@ -1,15 +1,24 @@ require 'spec_helper' describe ReadingList::ConfigurationFactory do - let(:config_path) { 'spec/resources/test_config.yml' } - subject(:factory) do - ReadingList::ConfigurationFactory.new(config_file: config_path) + ReadingList::ConfigurationFactory.new(config_file: CONFIG_FILE) end describe '#config' do it 'returns a Configuration instance' do expect(factory.config).to be_a(ReadingList::Configuration) end + + it 'fills in the values from the file' do + config = factory.config + + expect(config.name).to eq('Test Name') + expect(config.email).to eq('test@example.com') + expect(config.website).to eq('https://www.example.com') + expect(config.book_file).to eq('spec/resources/test_books.json') + expect(config.theme).to eq('default') + expect(config.output_dir).to eq('~/reading_list_output') + end end end
Add tests that the config factory properly reads the YAML file.
diff --git a/app/models/statisfaction/event.rb b/app/models/statisfaction/event.rb index abc1234..def5678 100644 --- a/app/models/statisfaction/event.rb +++ b/app/models/statisfaction/event.rb @@ -1,5 +1,5 @@ module Statisfaction class Event < ActiveRecord::Base - table_name = "statisfaction_events" + set_table_name "statisfaction_events" end end
Revert "Fix deprecation warning when setting table names." This reverts commit af36b786776e3ceabd57ed11b4a15a04866e5a0d. The reason for this is that Rails 3.0 does not yet support table_name=
diff --git a/spec/support/capybara_helpers.rb b/spec/support/capybara_helpers.rb index abc1234..def5678 100644 --- a/spec/support/capybara_helpers.rb +++ b/spec/support/capybara_helpers.rb @@ -0,0 +1,12 @@+module CapybaraHelpers + def sign_in_as(user) + visit new_user_session_path + + within "form#new_user" do + fill_in "user[login]", :with => user.username + fill_in "user[password]", :with => 'password1' + end + + click_button "Log In" + end +end
Add helpers to sign in a user during feature spec
diff --git a/app.rb b/app.rb index abc1234..def5678 100644 --- a/app.rb +++ b/app.rb @@ -7,10 +7,21 @@ def init_db db = SQLite3::Database.new 'leprosorium.db' db.results_as_hash = true + return db end before do db = init_db +end + +configure do + db = init_db + db.execute 'CREATE TABLE IF NOT EXISTS "Posts" + ( + "id" INTEGER PRIMARY KEY AUTOINCREMENT, + "created_date" DATE, + "content" TEXT + );' end get '/' do
Create teble Posts in database
diff --git a/spec/dolphy_spec.rb b/spec/dolphy_spec.rb index abc1234..def5678 100644 --- a/spec/dolphy_spec.rb +++ b/spec/dolphy_spec.rb @@ -32,6 +32,7 @@ describe "#redirect_to" do it "redirects to the given path" do visit '/wat' + expect(current_path).to eq "/hello" expect(page).to have_content "hello world!" end end
Check if URL is correct on redirects.
diff --git a/app.rb b/app.rb index abc1234..def5678 100644 --- a/app.rb +++ b/app.rb @@ -8,8 +8,7 @@ def hostname(ip) begin - address_parts = ip.split(/\./).map(&:to_i) - hostname = Socket.gethostbyaddr(address_parts.pack('CCCC')).first + hostname = Addrinfo.ip('::1').getnameinfo[0] rescue SocketError hostname = nil end @@ -20,7 +19,7 @@ end get '/' do - @ip = env['HTTP_X_FORWARDED_FOR'] + @ip = env['HTTP_X_FORWARDED_FOR'] || env['REMOTE_ADDR'] @hostname = hostname(@ip) if @ip erb :'index.html'
Handle IPv6 IPs without raising exceptions
diff --git a/spec/balance_tags_c_extn_spec.rb b/spec/balance_tags_c_extn_spec.rb index abc1234..def5678 100644 --- a/spec/balance_tags_c_extn_spec.rb +++ b/spec/balance_tags_c_extn_spec.rb @@ -19,8 +19,8 @@ # Make sure it doesn't segfault it "should be balanced correctly when run many times" do + text = Faker::Lorem.paragraphs(6) 2_000.times do - text = Faker::Lorem.paragraphs(3) Pidgin2Adium.balance_tags_c("<p><b>#{text}").should == "<p><b>#{text}</b></p>" end end
Move Faker::Lorem call out of block to speed up balance_tags_c spec dramatically
diff --git a/spec/lib/sanitize_config_spec.rb b/spec/lib/sanitize_config_spec.rb index abc1234..def5678 100644 --- a/spec/lib/sanitize_config_spec.rb +++ b/spec/lib/sanitize_config_spec.rb @@ -14,9 +14,5 @@ it 'keeps ul' do expect(Sanitize.fragment('<p>Check out:</p><ul><li>Foo</li><li>Bar</li></ul>', subject)).to eq '<p>Check out:</p><ul><li>Foo</li><li>Bar</li></ul>' end - - it 'keep links in lists' do - expect(Sanitize.fragment('<p>Check out:</p><ul><li><a href="https://joinmastodon.org" rel="nofollow noopener" target="_blank">joinmastodon.org</a></li><li>Bar</li></ul>', subject)).to eq '<p>Check out:</p><p><a href="https://joinmastodon.org" rel="nofollow noopener" target="_blank">joinmastodon.org</a><br>Bar</p>' - end end end
Fix sanitizer text case for glitch-soc, which preserves lists
diff --git a/spec/rocket_pants/errors_spec.rb b/spec/rocket_pants/errors_spec.rb index abc1234..def5678 100644 --- a/spec/rocket_pants/errors_spec.rb +++ b/spec/rocket_pants/errors_spec.rb @@ -1,4 +1,84 @@ require 'spec_helper' describe RocketPants::Errors do + + describe 'getting all errors' do + + it 'should return a list of all errors' do + list = RocketPants::Errors.all + list.should be_present + list.keys.should be_all { |v| v.is_a?(Symbol) } + list.values.should be_all { |v| v < RocketPants::Error } + end + + it 'should return a muteable list' do + list = RocketPants::Errors.all + list.should_not have_key(:my_error) + RocketPants::Errors.register! :my_error + list.should_not have_key(:my_error) + new_list = RocketPants::Errors.all + new_list.should_not == list + new_list.should have_key(:my_error) + end + + end + + describe 'getting an error from a key' do + + it 'should let you use an error you have registered before' do + RocketPants::Errors.all.each_pair do |key, value| + RocketPants::Errors[key].should == value + end + RocketPants::Errors.register! :ninja_error + RocketPants::Errors[:ninja_error].should == RocketPants::NinjaError + end + + + it 'should return nil for unknown errors' do + RocketPants::Errors[:life_the_universe_and_everything].should be_nil + end + + end + + describe 'adding a new error' do + + it 'should add it to the mapping' do + RocketPants::Errors[:fourty_two].should be_nil + error = Class.new(RocketPants::Error) + error.error_name :fourty_two + RocketPants::Errors.add error + RocketPants::Errors[:fourty_two].should == error + end + + end + + describe 'registering an error' do + + it 'should add a constant' do + RocketPants.should_not be_const_defined(:AnotherException) + RocketPants::Errors.register! :another_exception + RocketPants.should be_const_defined(:AnotherException) + RocketPants::AnotherException.should be < RocketPants::Error + end + + it 'should let you set the http status' do + RocketPants::Errors.register! :another_exception_two, :http_status => :forbidden + RocketPants::Errors[:another_exception_two].http_status.should == :forbidden + end + + it 'should let you set the error name' do + RocketPants::Errors[:threes_a_charm].should be_blank + RocketPants::Errors.register! :another_exception_three, :error_name => :threes_a_charm + RocketPants::Errors[:threes_a_charm].should be_present + end + + it 'should let you set the class name' do + RocketPants.should_not be_const_defined(:NumberFour) + RocketPants::Errors.register! :another_exception_four, :class_name => 'NumberFour' + RocketPants.should be_const_defined(:NumberFour) + RocketPants::Errors[:another_exception_four].should == RocketPants::NumberFour + end + + end + end
Add specs for the errors spec
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -7,7 +7,6 @@ require 'rubygems' require 'bundler/setup' -require 'ruby_core_extensions' if ENV['COVERAGE'] require 'simplecov' @@ -16,6 +15,8 @@ SimpleCov.start end +require 'ruby_core_extensions' + RSpec.configure do |config| config.treat_symbols_as_metadata_keys_with_true_values = true config.run_all_when_everything_filtered = true
Fix coverage task as it needs to load prior to library
diff --git a/spec/support/capybara_helpers.rb b/spec/support/capybara_helpers.rb index abc1234..def5678 100644 --- a/spec/support/capybara_helpers.rb +++ b/spec/support/capybara_helpers.rb @@ -2,6 +2,6 @@ select datetime.day, from: "#{field}_3i" select datetime.strftime("%B"), from: "#{field}_2i" select datetime.year, from: "#{field}_1i" - select datetime.hour, from: "#{field}_4i" + select datetime.strftime("%H"), from: "#{field}_4i" select datetime.strftime("%M"), from: "#{field}_5i" end
Fix bug with choosing hours that begin with 0.
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,7 +14,7 @@ if ENV['TRAVIS'] require 'coveralls' SimpleCov.formatter = Coveralls::SimpleCov::Formatter -elsif ENV['CI'] # rubocop:disable IfUnlessModifier +elsif ENV['CI'] require 'simplecov-rcov' SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter end
Revert "Disable false positive of RuboCop" This reverts commit bdb343d791b8d537a9e601a4b73976c6924c9f37.
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,2 +1,13 @@ require 'simplecov' +# Start the code coverage inspector here so any tests that are run +# which include the spec_helper count towards the code that is covered. SimpleCov.start + +RSpec.configure do |config| + # These two settings work together to allow you to limit a spec run + # to individual examples or groups you care about by tagging them with + # `:focus` metadata. When nothing is tagged with `:focus`, all examples + # get run. + config.filter_run :focus + config.run_all_when_everything_filtered = true +end
Add support for RSpec :focus keyword
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,7 +13,7 @@ $LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) - + ENV["RAILS_ENV"] ||= 'test' require "action_controller/railtie" @@ -31,7 +31,6 @@ Test::Application.initialize! RSpec.configure do |config| - config.treat_symbols_as_metadata_keys_with_true_values = true config.run_all_when_everything_filtered = true config.filter_run :focus
Fix last rspec deprecation notice.
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 @@ -10,6 +10,7 @@ require 'chewy/rspec' ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:') +ActiveRecord::Base.logger = Logger.new('/dev/null') Kaminari::Hooks.init
Fix specs for activerecord 4.0
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 @@ -5,6 +5,10 @@ RSpec.configure do |config| $stdout.sync = true config.filter_run_excluding concourse_test: true + + # Run tests in living color, even on CI + config.color = true + config.tty = true def fly(arg, env = {}) target = 'buildpacks'
Make RSpec emit colored output no matter what We thought concourse-filter was swallowing color codes. It wasn't: we weren't emitting any on CI. [#133046105]
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,7 +1,5 @@-if ENV['CODECLIMATE_REPO_TOKEN'] - require "codeclimate-test-reporter" - CodeClimate::TestReporter.start -end +require 'simplecov' +SimpleCov.start require 'rspec' require 'dkim/query'
Use SimpleCov instead of CodeClimate::TestReporter. * https://github.com/codeclimate/ruby-test-reporter/blob/master/CHANGELOG.md#v100-2016-11-03
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,6 +2,8 @@ require "btc_ticker" require 'webmock/rspec' + +WebMock.disable_net_connect!(allow_localhost: true) RSpec.configure do |config| # Enable flags like --only-failures and --next-failure
Configure WebMock to disable net connect (Localhost only)
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 @@ -8,7 +8,7 @@ # Spawn the server in another process -@server = fork do +@server = Thread.new do require 'simple_sinatra_server' Sinatra::Default.set( @@ -19,7 +19,8 @@ end # Kill the server process when rspec finishes -at_exit { Process.kill("TERM", @server) } +at_exit { @server.exit } + # Give the app a change to initialize $stderr.puts "Waiting for thin to initialize..."
Rework server spawning to work correctly under rspec 1.2
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,9 @@ RSpec.configure do |config| config.include Requests::JsonHelper + config.filter_run focus: true + config.run_all_when_everything_filtered = true + config.before(:each) do Refinery::API.configure do |conf| conf.api_token = "123"
Add ability to focus a spec
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,2 +1,9 @@ require 'chefspec' require 'chefspec/berkshelf' + +RSpec.configure do |config| + config.formatter = :documentation + config.color = true +end + +at_exit { ChefSpec::Coverage.report! }
Configure RSpec output to be more informative
diff --git a/icapps-translations.gemspec b/icapps-translations.gemspec index abc1234..def5678 100644 --- a/icapps-translations.gemspec +++ b/icapps-translations.gemspec @@ -9,7 +9,7 @@ spec.authors = ["Jelle Vandebeeck"] spec.email = ["jelle.vandebeeck@icapps.com"] spec.summary = %q{Import translations from the iCapps translations portal.} - spec.homepage = "http://translations.icapps.com" + spec.homepage = 'https://github.com/fousa/icapps-translations' spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0")
Add the correct github url.
diff --git a/test/integration/default/default_spec.rb b/test/integration/default/default_spec.rb index abc1234..def5678 100644 --- a/test/integration/default/default_spec.rb +++ b/test/integration/default/default_spec.rb @@ -19,6 +19,7 @@ describe service('W3SVC') do it { should be_installed } it { should be_running } + its ('startmode') { should be 'Auto'} end # Unless we are on a 'polluted' machine, the default website should
Make sure IIS is set to auto Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/app/views/revision_analytics/dyk_eligible.json.jbuilder b/app/views/revision_analytics/dyk_eligible.json.jbuilder index abc1234..def5678 100644 --- a/app/views/revision_analytics/dyk_eligible.json.jbuilder +++ b/app/views/revision_analytics/dyk_eligible.json.jbuilder @@ -2,7 +2,7 @@ json.array! @articles do |article| revision = article.revisions.order(wp10: :desc).first json.key article.id - json.title article.title.gsub('_', ' ') + json.title full_title(article) json.revision_score revision.wp10 json.user_wiki_id User.find(revision.user_id).wiki_id json.revision_datetime revision.date
Use full_title for page titles in DYK list
diff --git a/lib/cfp/engine.rb b/lib/cfp/engine.rb index abc1234..def5678 100644 --- a/lib/cfp/engine.rb +++ b/lib/cfp/engine.rb @@ -1,5 +1,12 @@ module Cfp class Engine < ::Rails::Engine isolate_namespace Cfp + + # Load decorators on main app + config.to_prepare do + Dir.glob(Rails.root + "app/decorators/**/*_decorator*.rb").each do |c| + require_dependency(c) + end + end end end
Load decorators on main app
diff --git a/app/controllers/ahoy/messages_controller.rb b/app/controllers/ahoy/messages_controller.rb index abc1234..def5678 100644 --- a/app/controllers/ahoy/messages_controller.rb +++ b/app/controllers/ahoy/messages_controller.rb @@ -13,6 +13,7 @@ def click if @message and !@message.clicked_at @message.clicked_at = Time.now + @message.opened_at ||= @message.clicked_at @message.save! end url = params[:url]
Set opened_at if empty when clicked
diff --git a/app/controllers/api/base_controller.rb b/app/controllers/api/base_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/base_controller.rb +++ b/app/controllers/api/base_controller.rb @@ -35,6 +35,10 @@ end helper_method :current_team + def set_current_team + set_current_tenant(current_team) + end + def api_token_value request.headers["HTTP_X_API_TOKEN"].presence || params[:api_token].presence end
Set current tennant based of the API token
diff --git a/app/controllers/api/docs_controller.rb b/app/controllers/api/docs_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/docs_controller.rb +++ b/app/controllers/api/docs_controller.rb @@ -15,6 +15,11 @@ case section when :Agendas when :Councillors + { + ward_id: "Display the councillor who is representing this ward", + counciillor_name: "Search for councillor using their name", + date: "Search for councillor base on when they started in office, in format dd/mm/yyyy. Also you can have a range by using '<em>,</em>' between the date." + } when :Committees when :Items when :Motions
Add URL Query Help Text For Councillor In API Docs
diff --git a/app/controllers/location_controller.rb b/app/controllers/location_controller.rb index abc1234..def5678 100644 --- a/app/controllers/location_controller.rb +++ b/app/controllers/location_controller.rb @@ -11,11 +11,11 @@ def list return unless params[:location] - locations = WoeidHelper.search_by_name(params[:location]) - if locations && locations.count == 1 - save_location locations[0].woeid + similar_locations = WoeidHelper.search_by_name(params[:location]) + if similar_locations && similar_locations.count == 1 + save_location similar_locations[0].woeid else - @locations = locations + @locations = similar_locations end end @@ -24,9 +24,9 @@ if positive_integer?(params[:location]) save_location params[:location] else - locations = WoeidHelper.search_by_name(params[:location]) - if locations & locations.count == 1 - save_location locations[0].woeid + similar_locations = WoeidHelper.search_by_name(params[:location]) + if similar_locations & similar_locations.count == 1 + save_location similar_locations[0].woeid else redirect_to location_ask_path, alert: 'Hubo un error con el cambio de su ubicación. Inténtelo de nuevo.' end
Rename variables to be more descriptive
diff --git a/app/controllers/topology_controller.rb b/app/controllers/topology_controller.rb index abc1234..def5678 100644 --- a/app/controllers/topology_controller.rb +++ b/app/controllers/topology_controller.rb @@ -30,7 +30,7 @@ end def index - redirect_to :action => 'show' + redirect_to(:action => 'show') end def data
Fix rubocop warnings in TopologyController
diff --git a/lib/lxc/server.rb b/lib/lxc/server.rb index abc1234..def5678 100644 --- a/lib/lxc/server.rb +++ b/lib/lxc/server.rb @@ -26,6 +26,7 @@ end not_found do + content_type :json, :encoding => :utf8 json_response(:error => "Invalid request path") end
Set content type for 404
diff --git a/lib/rom/header.rb b/lib/rom/header.rb index abc1234..def5678 100644 --- a/lib/rom/header.rb +++ b/lib/rom/header.rb @@ -6,7 +6,7 @@ include Enumerable include Equalizer.new(:attributes, :model) - attr_reader :attributes, :model, :mapping, :tuple_proc + attr_reader :attributes, :model, :mapping def self.coerce(input, model = nil) if input.is_a?(self)
Remove unused reader from Header
diff --git a/lib/pod/command/spec/doc.rb b/lib/pod/command/spec/doc.rb index abc1234..def5678 100644 --- a/lib/pod/command/spec/doc.rb +++ b/lib/pod/command/spec/doc.rb @@ -8,7 +8,9 @@ Opens the web documentation of the Pod with the given NAME. DESC - self.arguments = [['NAME', :required]] + self.arguments = [ + CLAide::Argument.new('NAME', true) + ] def initialize(argv) @name = argv.shift_argument
Fix for new CLAide argument syntax
diff --git a/lib/quick_shoulda/errors.rb b/lib/quick_shoulda/errors.rb index abc1234..def5678 100644 --- a/lib/quick_shoulda/errors.rb +++ b/lib/quick_shoulda/errors.rb @@ -18,7 +18,7 @@ end end - class NotAModelPathError < StandardError + class NotRubyFileError < StandardError def initialize(msg = 'Given file must have .rb extension') super(msg) end
Fix mistake from copy & paste
diff --git a/lib/rpub/hash_delegation.rb b/lib/rpub/hash_delegation.rb index abc1234..def5678 100644 --- a/lib/rpub/hash_delegation.rb +++ b/lib/rpub/hash_delegation.rb @@ -2,7 +2,11 @@ # Delegate missing methods to keys in a Hash atribute on the current object. module HashDelegation def self.included(base) - def base.delegate_to_hash(attr) + base.extend ClassMethods + end + + module ClassMethods + def delegate_to_hash(attr) define_method(:delegated_hash) { send attr } end end
Make delegate_to_hash easier to document
diff --git a/lib/skroutz_api/resource.rb b/lib/skroutz_api/resource.rb index abc1234..def5678 100644 --- a/lib/skroutz_api/resource.rb +++ b/lib/skroutz_api/resource.rb @@ -6,31 +6,6 @@ def initialize(attributes, client) @attributes = attributes @client = client - end - - def find(id, options = {}) - response = client.get("#{resource_prefix}/#{id}") - - return parse_body(response) unless block_given? - - yield response - end - - def page(pagenum = 1, options = {}) - per = options[:per] || client.config[:pagination_page_size] - response = client.get(resource_prefix, page: pagenum, per: per) - - return SkroutzApi::PaginatedCollection.new(self, response) unless block_given? - - yield response - end - - def all(options = {}) - response = client.get(resource_prefix) - - return SkroutzApi::PaginatedCollection.new(self, response) unless block_given? - - yield response end def resource_prefix
Remove CollectionProxy methods from Resource
diff --git a/lib/email_verifier.rb b/lib/email_verifier.rb index abc1234..def5678 100644 --- a/lib/email_verifier.rb +++ b/lib/email_verifier.rb @@ -11,6 +11,7 @@ @emailed_alerts = [] @acknowledged_alerts = [] @missing_alerts = [] + @inbox = Inbox.new end def have_all_alerts_been_emailed? @@ -33,6 +34,8 @@ private + attr_reader :inbox + def has_email_address_received_email_with_contents?(email:, contents:) inbox.message_count_for_query("#{contents} to:#{email}") != 0 end @@ -40,12 +43,4 @@ def acknowledged_as_missing?(contents:) ACKNOWLEDGED_EMAIL_CONTENTS.include?(contents) end - - def inbox - @inbox ||= Inbox.new - end - - def email_search_queries - [] - end end
Move `inbox` into a class attribute
diff --git a/lib/exchange_rates.rb b/lib/exchange_rates.rb index abc1234..def5678 100644 --- a/lib/exchange_rates.rb +++ b/lib/exchange_rates.rb @@ -1,7 +1,7 @@ require 'money/bank/open_exchange_rates_bank' moe = Money::Bank::OpenExchangeRatesBank.new -moe.ttl_in_seconds = 1.months / 1001 # match free tier on open exchange rates +moe.ttl_in_seconds = 1.months / 2000 moe.app_id = ENV.fetch('OPEN_EXCHANGE_RATES_APP_ID') moe.update_rates Money.default_bank = moe
Add wiggle room to openexchangerates polling interval
diff --git a/lib/fluffle/errors.rb b/lib/fluffle/errors.rb index abc1234..def5678 100644 --- a/lib/fluffle/errors.rb +++ b/lib/fluffle/errors.rb @@ -15,6 +15,10 @@ # Raised if it timed out waiting for a confirm from the broker class ConfirmTimeoutError < TimeoutError + end + + # Raised if it received a nack from the broker + class NackError < StandardError end # Raised if it received a return from the server
Add missing `NackError` error subclass
diff --git a/config.rb b/config.rb index abc1234..def5678 100644 --- a/config.rb +++ b/config.rb @@ -22,7 +22,6 @@ configure :build do activate :minify_css - activate :minify_javascript activate :asset_hash end
Disable compression of javascript to resolve error Signed-off-by: Michael Barton <1d6e1cf70ec6f9ab28d3ea4b27a49a77654d370e@michaelbarton.me.uk>
diff --git a/config.ru b/config.ru index abc1234..def5678 100644 --- a/config.ru +++ b/config.ru @@ -21,9 +21,13 @@ if Builds::BUILD_CONFIG['teamCityBaseUrl'] require 'teamcity' TeamCity.configure do |config| - config.endpoint = Builds::BUILD_CONFIG['teamCityBaseUrl'] + '/app/rest' - config.http_user = ENV['TEAM_CITY_USER'] - config.http_password = ENV['TEAM_CITY_PASSWORD'] + if ENV['TEAM_CITY_USER'] + config.endpoint = Builds::BUILD_CONFIG['teamCityBaseUrl'] + '/app/rest' + config.http_user = ENV['TEAM_CITY_USER'] + config.http_password = ENV['TEAM_CITY_PASSWORD'] + else + config.endpoint = Builds::BUILD_CONFIG['teamCityBaseUrl'] + '/app/rest?guest=1' + end end end
Add possibility to both use guest and password authentication to TC
diff --git a/config.ru b/config.ru index abc1234..def5678 100644 --- a/config.ru +++ b/config.ru @@ -7,7 +7,7 @@ :views => File.join(File.dirname(__FILE__), 'views') ) -log = File.new("sinatra.log", "a") +log = File.new("wink.log", "a") STDOUT.reopen(log) STDERR.reopen(log)
Rename log file to wink.log, which makes more sense
diff --git a/lib/rtest/test.rb b/lib/rtest/test.rb index abc1234..def5678 100644 --- a/lib/rtest/test.rb +++ b/lib/rtest/test.rb @@ -3,9 +3,8 @@ module Rtest class Test < Runnable + include Assertions PREFIX = /^test_/ - - include Assertions def self.runnable_methods methods_matching PREFIX
Include modules before constant assignments
diff --git a/lib/tasks/ci.rake b/lib/tasks/ci.rake index abc1234..def5678 100644 --- a/lib/tasks/ci.rake +++ b/lib/tasks/ci.rake @@ -7,8 +7,9 @@ Rake::Task['brakeman:run'].invoke Rake::Task['jasmine:ci'].invoke Rake::Task['spec'].invoke - puts 'Info: Sleeping for ten seconds to give CPU time to cool down and perhaps not fail on the cuke tasks because drop down lists aren''t populated fast enough.'.green - sleep 10 + duration = 5 + puts "Info: Sleeping for #{duration} seconds to give CPU time to cool down and perhaps not fail on the cuke tasks because drop down lists aren't populated fast enough.".green + sleep duration Rake::Task['cucumber'].invoke end end
Reduce feature test sleep bakc to what it was
diff --git a/test/api/group_sets_api_test.rb b/test/api/group_sets_api_test.rb index abc1234..def5678 100644 --- a/test/api/group_sets_api_test.rb +++ b/test/api/group_sets_api_test.rb @@ -0,0 +1,13 @@+require 'test_helper' + +class GroupSetsApiTest < ActiveSupport::TestCase + include Rack::Test::Methods + include TestHelpers::AuthHelper + include TestHelpers::JsonHelper + include TestHelpers::TestFileHelper + + def app + Rails.application + end + +end
TEST: Add unit tests for group_sets_api
diff --git a/test/least-squares-method-2d.rb b/test/least-squares-method-2d.rb index abc1234..def5678 100644 --- a/test/least-squares-method-2d.rb +++ b/test/least-squares-method-2d.rb @@ -0,0 +1,53 @@+#!/usr/bin/env ruby +# coding: utf-8 + +# ŏ@ɂ钼 y = a * x + b ̎̎Zo + +s1 = [[32.0, 24.0], + [131.0, 62.0], + [159.0, 110.0], + [245.0, 146.0]] +s2 = [[ 0.0, 0.0], + [ 0.0, 10.0], + [ 0.0, 20.0], + [ 0.0, 30.0]] +s3 = [[ 0.0, 0.0], + [ 10.0, 0.0], + [ 20.0, 0.0], + [ 30.0, 0.0]] +s = s1 + +def s.sum(&b) + self.inject(0.0) do |t, pnt| + t + b.call(pnt[0], pnt[1]) + end +end + +n = s.size.to_f +a = (n * s.sum{|x,y|x*y} - s.sum{|x,y|x} * s.sum{|x,y|y}) / + (n * s.sum{|x,y|x**2} - (s.sum{|x,y|x})**2) +b = (s.sum{|x,y|x**2} * s.sum{|x,y|y} - s.sum{|x,y|x*y} * s.sum{|x,y|x}) / + (n * s.sum{|x,y|x**2} - (s.sum{|x,y|x})**2) + +puts "a: #{a}" +puts "b: #{b}" + +line = nil +if a == 0 && b == 0 + puts "horizontal" + line = Build.infline [0.0, s[0].y], Vec::xdir +elsif a.nan? && b.nan? + puts "vertical" + line = Build.infline [s[0].x, 0.0], Vec::ydir +else + p1 = [0.0, b] + p2 = [100.0, a*100.0+b] + dir = p2.to_v - p1.to_v + line = Build.infline p1, dir +end + +ps = s.map {|pt| Build.vertex pt} +ps << line +comp = Build.compound ps +BRepIO.save comp, "tmp.brep" +
Add 2d least squares method sample script.
diff --git a/app/workers/share_analytics_updater.rb b/app/workers/share_analytics_updater.rb index abc1234..def5678 100644 --- a/app/workers/share_analytics_updater.rb +++ b/app/workers/share_analytics_updater.rb @@ -10,8 +10,11 @@ uri = URI.parse(uri) response = Net::HTTP.post_form(uri, {key: ENV['SHARE_PROGRESS_API_KEY'], id: button.sp_id}) - if response.success? + parsed_body = JSON.parse(response.body).with_indifferent_access + if parsed_body[:success] button.update(analytics: response.body ) + else + raise "ShareProgress button update failed with the following message from their API: #{parsed_body[:message]}." end end
Print fail message in case of a failed update request to SP:
diff --git a/decorate-responder.gemspec b/decorate-responder.gemspec index abc1234..def5678 100644 --- a/decorate-responder.gemspec +++ b/decorate-responder.gemspec @@ -19,7 +19,7 @@ gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.require_paths = ['lib'] - gem.add_runtime_dependency 'responders', '~> 2.0' + gem.add_runtime_dependency 'responders', '>= 2', '< 4' gem.add_development_dependency 'rake' gem.add_development_dependency 'minitest'
Update responders requirement from ~> 2.0 to >= 2, < 4 Updates the requirements on [responders](https://github.com/plataformatec/responders) to permit the latest version. - [Release notes](https://github.com/plataformatec/responders/releases) - [Changelog](https://github.com/plataformatec/responders/blob/master/CHANGELOG.md) - [Commits](https://github.com/plataformatec/responders/compare/v2.0.0...v3.0.0) Signed-off-by: dependabot-preview[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>
diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake index abc1234..def5678 100644 --- a/lib/tasks/import.rake +++ b/lib/tasks/import.rake @@ -23,9 +23,7 @@ csv.each_with_index do |row, index| input = import.raw_inputs.create data: row.to_h RawInputTransformJob.perform_later input.id - if csv.length == index + 1 - RawInputErrorsJob.perform_later - end + RawInputErrorsJob.perform_later if csv.length == index + 1 end else puts 'allowed headers:', CsvTransformer.allowed_headers
Use an inline if statement (for rubocop)
diff --git a/messaging.gemspec b/messaging.gemspec index abc1234..def5678 100644 --- a/messaging.gemspec +++ b/messaging.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'evt-messaging' - s.version = '2.5.6.0' + s.version = '2.5.7.0' s.summary = 'Common primitives for platform-specific messaging implementations for Eventide' s.description = ' '
Package version is increased from 2.5.6.0 to 2.5.7.0