diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/test/background_exception_notification_test.rb b/test/background_exception_notification_test.rb index abc1234..def5678 100644 --- a/test/background_exception_notification_test.rb +++ b/test/background_exception_notification_test.rb @@ -30,6 +30,10 @@ assert @mail.subject.include? "[Dummy ERROR] (ZeroDivisionError) \"divided by 0\"" end + test "mail should say exception was raised in background" do + assert @mail.body.include? "A ZeroDivisionError occurred in background" + end + test "mail should contain backtrace in body" do assert @mail.body.include? "test/background_exception_notification_test.rb:6" end
Add one more test for background notifications.
diff --git a/lib/conway.rb b/lib/conway.rb index abc1234..def5678 100644 --- a/lib/conway.rb +++ b/lib/conway.rb @@ -14,20 +14,20 @@ end class Grid - attr_reader :width, :heigth , :fields + attr_reader :width, :heigth, :fields def initialize(width, heigth) @width, @heigth = width, heigth - @fields = Array.new(width) do - Array.new(heigth) do - Cell.new - end - end + @fields = Array.new(width) do + Array.new(heigth) do + Cell.new + end + end end - def each - fields.each - end + def each + fields.each + end end class Cell
Fix whitespace, once again ...
diff --git a/spec/controllers/ops_controller/settings/rbac_roles_spec.rb b/spec/controllers/ops_controller/settings/rbac_roles_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/ops_controller/settings/rbac_roles_spec.rb +++ b/spec/controllers/ops_controller/settings/rbac_roles_spec.rb @@ -0,0 +1,57 @@+describe OpsController do + before(:each) do + EvmSpecHelper.seed_specific_product_features( + %w(vm vm_compare vm_delete instance instance_delete image image_delete miq_template + miq_template_delete provider_foreman_explorer provider_foreman_view)) + end + + context '#rbac_expand_features' do + subject { controller.send(:rbac_expand_features, ['vm']) } + it 'expands features' do + is_expected.to include('vm_compare') + end + end + + context '#rbac_compact_features' do + let(:root) { 'vm' } + let(:complete_set) { [root] + MiqProductFeature.feature_children(root) } + let(:incomplete_set) { MiqProductFeature.feature_children(root) } + + it 'it does not return the descendants if the ancestor is present' do + expect(controller.send(:rbac_compact_features, complete_set)).to eq([root]) + end + + it 'it returns the descendants if the ancestor is not present' do + expect(controller.send(:rbac_compact_features, incomplete_set)).to match_array(incomplete_set) + end + end + + describe '#recurse_sections_and_features' do + context 'special "_tab_all_vm_rules" node' do + it 'yields vm, instance, template and image with *delete' do + expect do |b| + controller.send(:recurse_sections_and_features, '_tab_all_vm_rules', &b) + end.to yield_successive_args( + ['image', include('image_delete')], + ['instance', include('instance_delete')], + ['miq_template', include('miq_template_delete')], + ['vm', include('vm_delete')], + ) + end + end + context '"_tab_conf" feature node' do + it 'yields features including "provider_foreman_view"' do + expect do |b| + controller.send(:recurse_sections_and_features, '_tab_conf', &b) + end.to yield_with_args('provider_foreman_explorer', include('provider_foreman_view')) + end + end + context '"vm" feature node' do + it 'yields features including "vm_compare"' do + expect do |b| + controller.send(:recurse_sections_and_features, 'vm', &b) + end.to yield_with_args('vm', include('vm_compare')) + end + end + end +end
Add specs for role editor RBAC tree.
diff --git a/lib/mikoshi/plan.rb b/lib/mikoshi/plan.rb index abc1234..def5678 100644 --- a/lib/mikoshi/plan.rb +++ b/lib/mikoshi/plan.rb @@ -5,12 +5,13 @@ module Mikoshi class Plan class Base - attr_reader :data + attr_reader :data, :client - def initialize(yaml_path: nil) + def initialize(yaml_path: nil, client: nil) raise ArgumentError, 'Yaml file path is required.' if yaml_path.nil? @data = Hashie::Mash.new(YAML.safe_load(ERB.new(File.new(yaml_path).read).result)) + @client = client end end end
Add argument and attribute client
diff --git a/lib/rdf/reasoner.rb b/lib/rdf/reasoner.rb index abc1234..def5678 100644 --- a/lib/rdf/reasoner.rb +++ b/lib/rdf/reasoner.rb @@ -15,9 +15,9 @@ ## # Add entailment support for the specified regime # - # @param [:OWL, :RDFS, :SCHEMA] regime - def apply(regime) - require "rdf/reasoner/#{regime.downcase}" + # @param [Array<:owl, :rdfs, :schema>] regime + def apply(*regime) + regime.each {|r| require "rdf/reasoner/#{r.downcase}"} end module_function :apply
Allow Reasoner.apply to take multiple arguments.
diff --git a/lib/slappy/event.rb b/lib/slappy/event.rb index abc1234..def5678 100644 --- a/lib/slappy/event.rb +++ b/lib/slappy/event.rb @@ -26,7 +26,7 @@ end def ts - Time.at(@data['ts'].to_f) + Time.at((@data['ts'] || @data['event_ts']).to_f) end def reply(text, options = {})
Fix did not monitor reaction_added RTM
diff --git a/lib/tasks/test.rake b/lib/tasks/test.rake index abc1234..def5678 100644 --- a/lib/tasks/test.rake +++ b/lib/tasks/test.rake @@ -9,5 +9,5 @@ require 'coveralls/rake/task' Coveralls::RakeTask.new desc "GitLab | Run all tests on CI with simplecov" - task :test_ci => [:rubocop, :brakeman, 'jasmine:ci', :spinach, :spec, 'coveralls:push'] + task :test_ci => [:rubocop, :brakeman, 'teaspoon', :spinach, :spec, 'coveralls:push'] end
Use teaspoon instead of jasmine:ci Signed-off-by: Dmitriy Zaporozhets <be23d75b156792e5acab51b196a2deb155d35d6a@gmail.com>
diff --git a/lib/foauth.rb b/lib/foauth.rb index abc1234..def5678 100644 --- a/lib/foauth.rb +++ b/lib/foauth.rb @@ -6,6 +6,7 @@ # # @param [String] email Your foauth.org email address. # @param [String] password Your foauth.org password. + # @yield [builder] Passes the `Faraday::Builder` instance to the block if given. # @return [Faraday::Connection] Configured to proxy requests to foauth.org. def self.new(email, password) Faraday.new do |builder|
Document the optional block parameter
diff --git a/test/bane/behaviors/servers/timeout_in_listen_queue_test.rb b/test/bane/behaviors/servers/timeout_in_listen_queue_test.rb index abc1234..def5678 100644 --- a/test/bane/behaviors/servers/timeout_in_listen_queue_test.rb +++ b/test/bane/behaviors/servers/timeout_in_listen_queue_test.rb @@ -12,7 +12,7 @@ def test_never_connects run_server(Bane::Behaviors::Servers::TimeoutInListenQueue.make(port, Bane::Behaviors::Servers::LOCALHOST)) do - assert_raise(Errno::ECONNREFUSED) { TCPSocket.new('localhost', port) } + assert_raise(Errno::ETIMEDOUT) { TCPSocket.new('localhost', port) } end end
Fix test which threw ETIMEDOUT on ruby 1.9.3p551 on Mac OS X.
diff --git a/lib/runner.rb b/lib/runner.rb index abc1234..def5678 100644 --- a/lib/runner.rb +++ b/lib/runner.rb @@ -5,6 +5,14 @@ require './lib/utils' require './lib/commentators/console' require './lib/commentators/github' + +module Policial + class ConfigLoader + def raw(filename) + File.read(filename) + end + end +end class Runner def initialize(config)
Fix policial confg loading function
diff --git a/lib/dimples/template.rb b/lib/dimples/template.rb index abc1234..def5678 100644 --- a/lib/dimples/template.rb +++ b/lib/dimples/template.rb @@ -1,17 +1,18 @@+# frozen_string_literal: true + module Dimples class Template include Frontable + include Renderable + + attr_accessor :path + attr_accessor :contents + attr_accessor :metadata def initialize(site, path) @site = site + @path = path @contents, @metadata = read_with_front_matter(path) end - - def render(page, context) - payload = page.metadata.merge(context) - - puts "The payload for #{page} will be: #{payload}" - # bubble up only if it itself has a template? - end end -end+end
Include Renderable, add attr_accessors and set the path
diff --git a/lib/buoys/buoy.rb b/lib/buoys/buoy.rb index abc1234..def5678 100644 --- a/lib/buoys/buoy.rb +++ b/lib/buoys/buoy.rb @@ -40,5 +40,9 @@ def pre_buoy(key, *args) @previous = Buoys::Buoy.new(context, key, args) end + + def method_missing(method, *args, &block) + context.send(method, *args, &block) + end end end
Add method_missing definition to Buoys::Buoy To interpret named routes method ex) root_path, in config/buoys/*.rb
diff --git a/lib/scss_lint/engine.rb b/lib/scss_lint/engine.rb index abc1234..def5678 100644 --- a/lib/scss_lint/engine.rb +++ b/lib/scss_lint/engine.rb @@ -4,11 +4,15 @@ class Engine ENGINE_OPTIONS = { cache: false, syntax: :scss } + attr_reader :contents + def initialize(scss_or_filename) if File.exists?(scss_or_filename) @engine = Sass::Engine.for_file(scss_or_filename, ENGINE_OPTIONS) + @contents = File.open(scss_or_filename, 'r').read else @engine = Sass::Engine.new(scss_or_filename, ENGINE_OPTIONS) + @contents = scss_or_filename end end
Store actual string contents of SCSS files This will enable us to write linters that can access the original file in cases where line number or other such information can be inferred separately. Change-Id: I02182d1fdd19f1ce1a4c4e072c7a0655f1732889 Reviewed-on: https://gerrit.causes.com/16557 Reviewed-by: Shane da Silva <6f6e68d1df92f30cb4b3ce35260ddf94a402f33d@causes.com> Tested-by: Shane da Silva <6f6e68d1df92f30cb4b3ce35260ddf94a402f33d@causes.com> Reviewed-by: Greg Hurrell <79e2475f81a6317276bf7cbb3958b20d289b78df@causes.com>
diff --git a/db/migrate/20100814103856_create_cve_references.rb b/db/migrate/20100814103856_create_cve_references.rb index abc1234..def5678 100644 --- a/db/migrate/20100814103856_create_cve_references.rb +++ b/db/migrate/20100814103856_create_cve_references.rb @@ -2,8 +2,8 @@ def self.up create_table :cve_references do |t| t.string :source - t.string :title - t.string :uri + t.text :title + t.text :uri t.integer :cve_id t.timestamps end
CVEReference: Use text instead of string, to have space for long gitweb URLs
diff --git a/db/migrate/20190225092700_alter_localized_names.rb b/db/migrate/20190225092700_alter_localized_names.rb index abc1234..def5678 100644 --- a/db/migrate/20190225092700_alter_localized_names.rb +++ b/db/migrate/20190225092700_alter_localized_names.rb @@ -1,8 +1,14 @@ Sequel.migration do - change do + up do alter_table :localized_names do set_column_type :value, 'varchar(2048)' end end + + down do + alter_table :localized_names do + set_column_type :value, 'varchar(255)' + end + end end
Fix failing DB migration for localized_names Previous version worked correctly for migration but failed with an unsupported error on rollback. Address with explicit `up`/`down` blocks.
diff --git a/app/workers/download_manuscript_worker.rb b/app/workers/download_manuscript_worker.rb index abc1234..def5678 100644 --- a/app/workers/download_manuscript_worker.rb +++ b/app/workers/download_manuscript_worker.rb @@ -9,11 +9,9 @@ epub = EpubConverter.new manuscript.paper, User.first, true - response = Typhoeus.post( + response = RestClient.post( "http://ihat-staging.herokuapp.com/convert/docx", - body: { - epub: epub.epub_stream.string - } + {epub: epub.epub_stream.string, multipart: true} ) manuscript.paper.update JSON.parse(response.body).symbolize_keys!
Use RestClient instead of Typhoeus in the worker
diff --git a/lib/straight_shooter.rb b/lib/straight_shooter.rb index abc1234..def5678 100644 --- a/lib/straight_shooter.rb +++ b/lib/straight_shooter.rb @@ -12,7 +12,7 @@ def initialize(url, filename = nil) self.app = Qt::Application.new(ARGV) - self.page = Page.new(ARGV[0], ARGV[1]) + self.page = Page.new(url, filename) page.connect(page, SIGNAL('finished(bool)'), app, SLOT('quit()')) end
Use the method args, not the file ones.
diff --git a/lib/vmdb/initializer.rb b/lib/vmdb/initializer.rb index abc1234..def5678 100644 --- a/lib/vmdb/initializer.rb +++ b/lib/vmdb/initializer.rb @@ -19,11 +19,11 @@ end end - def self.log_db_connectable + private_class_method def self.log_db_connectable _log.info("Successfully connected to the database.") end - def self.log_db_not_connectable + private_class_method def self.log_db_not_connectable msg = "Cannot connect to the database!" _log.error(msg) if $stderr.tty? @@ -34,11 +34,11 @@ end end - def self.check_db_connectable + private_class_method def self.check_db_connectable ActiveRecord::Base.connectable? ? log_db_connectable : log_db_not_connectable end - def self.perform_db_connectable_check? + private_class_method def self.perform_db_connectable_check? ENV["PERFORM_DB_CONNECTABLE_CHECK"].to_s.downcase != "false" end end
Make all of these methods private, called only from init.
diff --git a/releaf-core/spec/features/settings_spec.rb b/releaf-core/spec/features/settings_spec.rb index abc1234..def5678 100644 --- a/releaf-core/spec/features/settings_spec.rb +++ b/releaf-core/spec/features/settings_spec.rb @@ -2,7 +2,7 @@ feature "Settings", js: true do scenario "edit settings" do Releaf::Settings.destroy_all - Releaf::Settings.register_defaults("content.updated_at" => Time.parse("2014-07-01 14:33:59 +0300"), "content.title" => "some") + Releaf::Settings.register_defaults("content.updated_at" => Time.parse("2014-07-01 14:33:59"), "content.title" => "some") auth_as_user visit releaf_core_settings_path @@ -14,12 +14,12 @@ expect(page).to have_number_of_resources(1) click_link "content.updated_at" - fill_in 'Value', with: '2014-04-01 12:33:59 +0300' + fill_in 'Value', with: '2014-04-01 12:33:59' save_and_check_response "Update succeeded" click_link "Back to list" - expect(page).to have_content("2014-04-01 12:33:59 +0300") + expect(page).to have_content("2014-04-01 12:33:59") - expect(Releaf::Settings["content.updated_at"]).to eq(Time.parse("2014-04-01 12:33:59 +0300")) + expect(Releaf::Settings["content.updated_at"]).to eq(Time.parse("2014-04-01 12:33:59")) end end
Make settings feature test timezone-safe
diff --git a/lib/guillotine.rb b/lib/guillotine.rb index abc1234..def5678 100644 --- a/lib/guillotine.rb +++ b/lib/guillotine.rb @@ -7,7 +7,11 @@ excecutor = Object.const_get("Executors").const_get(command_array.shift.capitalize) response = excecutor.send(command_array.shift.downcase.to_sym, opts, *command_array) rescue NameError => e - return nil + if Rails.env.production? + return nil + else + raise e + end end if response.nil? return true @@ -15,4 +19,4 @@ return response end end -end+end
Raise NameError Exceptions when not in production
diff --git a/woff.gemspec b/woff.gemspec index abc1234..def5678 100644 --- a/woff.gemspec +++ b/woff.gemspec @@ -22,8 +22,7 @@ gem.add_dependency "bindata", "~> 2.3" gem.add_dependency "brotli", "~> 0.1" - gem.add_development_dependency "rake", "~> 11.2.2" - gem.add_development_dependency "rspec", "~> 3.5.0" - gem.add_development_dependency "pry" - gem.add_development_dependency "pry-byebug" + gem.add_development_dependency "rake", "~> 11.2" + gem.add_development_dependency "rspec", "~> 3.5" + gem.add_development_dependency "pry-byebug", "~> 3.4" end
Update Dev Dependencies to Address Deprecations
diff --git a/test/integration/assign_test.rb b/test/integration/assign_test.rb index abc1234..def5678 100644 --- a/test/integration/assign_test.rb +++ b/test/integration/assign_test.rb @@ -24,4 +24,15 @@ '{% assign foo not values %}.', 'values' => "foo,bar,baz") end + + def test_assign_uses_error_mode + with_error_mode(:strict) do + assert_raises(SyntaxError) do + Template.parse("{% assign foo = ('X' | downcase) %}") + end + end + with_error_mode(:lax) do + assert Template.parse("{% assign foo = ('X' | downcase) %}") + end + end end # AssignTest
Add tests for assign tag fix
diff --git a/govuk_admin_template.gemspec b/govuk_admin_template.gemspec index abc1234..def5678 100644 --- a/govuk_admin_template.gemspec +++ b/govuk_admin_template.gemspec @@ -23,6 +23,6 @@ gem.add_development_dependency "capybara", "~> 3" gem.add_development_dependency "rspec-rails", "~> 5" - gem.add_development_dependency "rubocop-govuk", "4.7.0" + gem.add_development_dependency "rubocop-govuk", "4.8.0" gem.add_development_dependency "sassc-rails", "~> 2" end
Update rubocop-govuk requirement from = 4.7.0 to = 4.8.0 Updates the requirements on [rubocop-govuk](https://github.com/alphagov/rubocop-govuk) to permit the latest version. - [Release notes](https://github.com/alphagov/rubocop-govuk/releases) - [Changelog](https://github.com/alphagov/rubocop-govuk/blob/main/CHANGELOG.md) - [Commits](https://github.com/alphagov/rubocop-govuk/compare/v4.7.0...v4.8.0) --- updated-dependencies: - dependency-name: rubocop-govuk dependency-type: direct:development ... Signed-off-by: dependabot[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@github.com>
diff --git a/lib/mri_bridge.rb b/lib/mri_bridge.rb index abc1234..def5678 100644 --- a/lib/mri_bridge.rb +++ b/lib/mri_bridge.rb @@ -3,7 +3,7 @@ module Rubinius LookupTable = Hash - Tuple = Array + class Tuple < Array; end class Executable attr_accessor :primitive
Make Tuple a real class for MRI bridge.
diff --git a/app/controllers/admin/operational_fields_controller.rb b/app/controllers/admin/operational_fields_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/operational_fields_controller.rb +++ b/app/controllers/admin/operational_fields_controller.rb @@ -10,7 +10,7 @@ end def create - @operational_field = OperationalField.new(params[:operational_field]) + @operational_field = OperationalField.new(operational_field_params) if @operational_field.save redirect_to admin_operational_fields_path, notice: %{"#{@operational_field.name}" created.} else @@ -24,10 +24,15 @@ def update @operational_field = OperationalField.find(params[:id]) - if @operational_field.update_attributes(params[:operational_field]) + if @operational_field.update_attributes(operational_field_params) redirect_to admin_operational_fields_path, notice: %{"#{@operational_field.name}" saved.} else render action: "edit" end end + +private + def operational_field_params + params.require(:operational_field).permit(:name, :description) + end end
Add strong params for operational fields
diff --git a/spec/hamlit/parser_spec.rb b/spec/hamlit/parser_spec.rb index abc1234..def5678 100644 --- a/spec/hamlit/parser_spec.rb +++ b/spec/hamlit/parser_spec.rb @@ -10,7 +10,8 @@ '%span a', [:multi, [:html, :tag, 'span', [:haml, :attrs], [:static, 'a']], - [:static, "\n"]], + [:static, "\n"], + [:newline]], ) end @@ -19,7 +20,8 @@ '%span{ a: 1, b: { c: 2 } }', [:multi, [:html, :tag, "span", [:haml, :attrs, "{ a: 1, b: { c: 2 } }"]], - [:static, "\n"]], + [:static, "\n"], + [:newline]], ) end @@ -35,7 +37,8 @@ [:html, :attr, 'id', [:static, 'foo']], [:html, :attr, 'class', [:static, 'bar']], '{ baz: 1 }']], - [:static, "\n"]], + [:static, "\n"], + [:newline]], ) end end
Fix failing spec due to newline
diff --git a/rb/spec/integration/selenium/webdriver/opera/driver_spec.rb b/rb/spec/integration/selenium/webdriver/opera/driver_spec.rb index abc1234..def5678 100644 --- a/rb/spec/integration/selenium/webdriver/opera/driver_spec.rb +++ b/rb/spec/integration/selenium/webdriver/opera/driver_spec.rb @@ -3,6 +3,9 @@ module Opera describe Driver do + + before(:all) { GlobalTestEnv.quit_driver rescue nil } + it 'raises ArgumentError if sent an unknown capability as an argument' do lambda { Selenium::WebDriver.for :opera, :foo => 'bar'
AndreasTolfTolfsen: Make sure remote server is shut down before running specs on Selenium::WebDriver::Opera git-svn-id: 4179480af2c2519a5eb5e1e9b541cbdf5cf27696@13920 07704840-8298-11de-bf8c-fd130f914ac9
diff --git a/lib/parvus/cli.rb b/lib/parvus/cli.rb index abc1234..def5678 100644 --- a/lib/parvus/cli.rb +++ b/lib/parvus/cli.rb @@ -1,4 +1,5 @@ require_relative 'shorteners/butts_so' +require_relative 'shorteners/bitly' class CommandLineParser < Thor map '--version' => :version, '-v' => :version @@ -6,9 +7,10 @@ desc 'shorten URL', 'shortens the given URL using a service (butts.so by default)' method_option :service, type: :string, default: 'butts.so', aliases: '-s', - enum: %w(butts.so) + enum: %w(butts.so bitly) def shorten(url) puts ButtsSo.get_short_url(url) if options[:service].eql? 'butts.so' + puts Bitly.get_short_url(url) if options[:service].eql? 'bitly' end desc 'version', 'prints out the version of parvus installed'
Add support for bitly in the CLI class
diff --git a/app/models/competitions/oregon_womens_prestige_series_modules/common.rb b/app/models/competitions/oregon_womens_prestige_series_modules/common.rb index abc1234..def5678 100644 --- a/app/models/competitions/oregon_womens_prestige_series_modules/common.rb +++ b/app/models/competitions/oregon_womens_prestige_series_modules/common.rb @@ -1,6 +1,10 @@ module Competitions module OregonWomensPrestigeSeriesModules module Common + def members_only? + false + end + def point_schedule [ 25, 21, 18, 16, 14, 12, 10, 8, 7, 6, 5, 4, 3, 2, 1 ] end
Remove membership requirement for OWPS
diff --git a/Casks/mactex.rb b/Casks/mactex.rb index abc1234..def5678 100644 --- a/Casks/mactex.rb +++ b/Casks/mactex.rb @@ -6,7 +6,7 @@ url "http://mirror.ctan.org/systems/mac/mactex/mactex-#{version}.pkg" name 'MacTeX' homepage 'https://www.tug.org/mactex/' - license :unknown # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder + license :oss pkg "mactex-#{version}.pkg"
Add oss license information for MacTex License information is shown when running the installer from the pkg. `oss` is the appropriate choice here, as several different licenses are used within the package. From the license step of the installer: > TeX Live and teTeX are covered by a variety of licenses (e.g. GNU General Public License, LGPL, BSD license, X license). All licenses are compatible with the requirements for free and open source software, as far as we know.
diff --git a/config/initializers/stripe.rb b/config/initializers/stripe.rb index abc1234..def5678 100644 --- a/config/initializers/stripe.rb +++ b/config/initializers/stripe.rb @@ -1,2 +1,2 @@-Stripe.api_key = "xmLR9a78SA9MwiGrrD2Z6VQDBpe82Q0Y" -STRIPE_PUBLISHABLE_KEY = "pk_IFyTlHIcoXGg0MS2eLAn4CS3INPQx" +Stripe.api_key = "tGN0bIwXnHdwOa85VABjPdSn8nWY7G7I" +STRIPE_PUBLISHABLE_KEY = "pk_YT1CEhhujd0bklb2KGQZiaL3iTzj3"
Switch to the same default API key we use for tests in our bindings
diff --git a/lib/wright/cli.rb b/lib/wright/cli.rb index abc1234..def5678 100644 --- a/lib/wright/cli.rb +++ b/lib/wright/cli.rb @@ -48,7 +48,7 @@ @commands << e end - opts.on_tail('-v', '--version', 'Show wright version') do + opts.on_tail('--version', 'Show wright version') do puts "wright version #{Wright::VERSION}" @quit = true end
Remove short option for --version
diff --git a/db/migrate/20140507144143_rename_generic_site2_global.rb b/db/migrate/20140507144143_rename_generic_site2_global.rb index abc1234..def5678 100644 --- a/db/migrate/20140507144143_rename_generic_site2_global.rb +++ b/db/migrate/20140507144143_rename_generic_site2_global.rb @@ -1,9 +1,9 @@ class RenameGenericSite2Global < ActiveRecord::Migration def self.up - Site.where(name: 'generic').update_all(name: 'global') + Site.where(:name => 'generic').update_all(:name => 'global') end def self.down - Site.where(name: 'global').update_all(name: 'generic') + Site.where(:name => 'global').update_all(:name => 'generic') end end
Fix for generic renaming error
diff --git a/JMAttributedFormat.podspec b/JMAttributedFormat.podspec index abc1234..def5678 100644 --- a/JMAttributedFormat.podspec +++ b/JMAttributedFormat.podspec @@ -18,7 +18,7 @@ arguments, so your styled strings can be flexibly localized. DESC - s.homepage = "https://github.com/jmah/JMAttributedString" + s.homepage = "https://github.com/jmah/JMAttributedFormat" s.license = { :type => "MIT", :file => "LICENSE.txt" } @@ -27,7 +27,7 @@ s.author = { "Jonathon Mah" => "me@JonathonMah.com" } s.social_media_url = "http://twitter.com/dev_etc" - s.source = { :git => "https://github.com/jmah/JMAttributedString.git", :tag => "1.0.0" } + s.source = { :git => "https://github.com/jmah/JMAttributedFormat.git", :tag => "1.0.0" } s.source_files = "JMAttributedFormat.{h,m}"
Rename GitHub repository to match project name
diff --git a/db/migrate/20170209204216_create_orders.rb b/db/migrate/20170209204216_create_orders.rb index abc1234..def5678 100644 --- a/db/migrate/20170209204216_create_orders.rb +++ b/db/migrate/20170209204216_create_orders.rb @@ -1,6 +1,7 @@ class CreateOrders < ActiveRecord::Migration[5.0] def change create_table :orders do |t| + t.integer :user_id t.timestamps end
Edit migration, add :user_id to Orders table
diff --git a/Casks/brackets.rb b/Casks/brackets.rb index abc1234..def5678 100644 --- a/Casks/brackets.rb +++ b/Casks/brackets.rb @@ -1,7 +1,7 @@ class Brackets < Cask - url 'http://download.brackets.io/file.cfm?platform=OSX&build=36' + url 'http://download.brackets.io/file.cfm?platform=OSX&build=37' homepage 'http://brackets.io' - version 'Sprint 36' - sha256 'a7cf879cb32b828b82eea76659617e0d439d2412feff205304bcebcad9f36335' + version 'Sprint 37' + sha256 '3f9fbbcfa12015b30656d83c5b55f0c11f98a298499d6b9b2fd7c2a92bf38f99' link 'Brackets.app' end
Update Brackets to Sprint 37
diff --git a/BFTaskCenter.podspec b/BFTaskCenter.podspec index abc1234..def5678 100644 --- a/BFTaskCenter.podspec +++ b/BFTaskCenter.podspec @@ -10,7 +10,7 @@ s.license = 'MIT' s.author = { "Superbil" => "superbil@gmail.com" } - s.source = { :git => "https://github.com/Superbil/BFTaskCenter.git", :tag => s.version.to_s } + s.source = { :git => "https://github.com/Superbil/BFTaskCenter.git", :tag => "v#{s.version.to_s}" } s.social_media_url = 'https://twitter.com/Superbil' s.platform = :ios, '7.0'
Change mapping tag format at podspec
diff --git a/Library/Formula/kdelibs.rb b/Library/Formula/kdelibs.rb index abc1234..def5678 100644 --- a/Library/Formula/kdelibs.rb +++ b/Library/Formula/kdelibs.rb @@ -25,4 +25,17 @@ system "cmake .. #{std_cmake_parameters} -DCMAKE_PREFIX_PATH=#{gettext.prefix} -DBUNDLE_INSTALL_DIR=#{bin}" system "make install" end + + def caveats + <<-END_CAVEATS + WARNING: this doesn't actually work for running KDE applications yet! + + Please don't just add the Macports patches and expect them to be pulled. + I'm avoiding adding patches that haven't been committed to KDE upstream + (which I have commit access to). Instead of requesting I add these, + consider writing and testing an upstream-suitable patch. + + Thanks for your patience! + END_CAVEATS + end end
Add KDELibs caveat so people don't expect it to fully work yet.
diff --git a/lib/cloud_conductor/converters/open_stack_converter.rb b/lib/cloud_conductor/converters/open_stack_converter.rb index abc1234..def5678 100644 --- a/lib/cloud_conductor/converters/open_stack_converter.rb +++ b/lib/cloud_conductor/converters/open_stack_converter.rb @@ -15,14 +15,29 @@ module CloudConductor module Converters class OpenStackConverter < Converter + # rubocop:disable MethodLength def initialize super + # Remove unimplemented properties from Instance + properties = [] + properties << :DisableApiTermination + properties << :KernelId + properties << :Monitoring + properties << :PlacementGroupName + properties << :PrivateIpAddress + properties << :RamDiskId + properties << :SourceDestCheck + properties << :Tenancy + add_patch Patches::RemoveProperty.new 'AWS::EC2::Instance', properties + + # Remove unimplemented properties from LoadBalancer properties = [] properties << :AppCookieStickinessPolicy properties << :Subnets properties << :SecurityGroups add_patch Patches::RemoveProperty.new 'AWS::ElasticLoadBalancing::LoadBalancer', properties + add_patch Patches::RemoveRoute.new add_patch Patches::RemoveMultipleSubnet.new add_patch Patches::AddIAMUser.new
Add patches to OpenStackConverter to remove unimplemented properties
diff --git a/app/controllers/email_notifications_reminders_controller.rb b/app/controllers/email_notifications_reminders_controller.rb index abc1234..def5678 100644 --- a/app/controllers/email_notifications_reminders_controller.rb +++ b/app/controllers/email_notifications_reminders_controller.rb @@ -5,7 +5,8 @@ current_user.update_attributes( weekly_summary: true, email_on_comment: true, - email_on_comment_reply: true + email_on_comment_reply: true, + notifications_by_default: true ) destroy
Set notifications by default when accepting
diff --git a/app/helpers/application_helper/button/provider_user_sync.rb b/app/helpers/application_helper/button/provider_user_sync.rb index abc1234..def5678 100644 --- a/app/helpers/application_helper/button/provider_user_sync.rb +++ b/app/helpers/application_helper/button/provider_user_sync.rb @@ -2,6 +2,13 @@ needs :@record def visible? - @record.class == ManageIQ::Providers::Openstack::CloudManager + # If tenant mapping is not enabled, then the provider will have no + # tenants being refreshed into the ems. This means no groups can + # be created because groups require a tenant and role pair. If + # no groups can be created, then any new users will have their + # current_group attribute set to nil. Users cannot login if + # they do not have a current group. Therefore user sync is + # a noop if tenant mapping is not enabled. + @record.class == ManageIQ::Providers::Openstack::CloudManager && @record.tenant_mapping_enabled == true end end
Disable Sync Users button if tenant mapping is not enabled If tenant mapping is not enabled, then the provider will have no tenants being refreshed into the ems. This means no groups can be created because groups require a tenant and role pair. If no groups can be created, then any new users will have their current_group attribute set to nil. Users cannot login if they do not have a current group. Therefore user sync is a noop if tenant mapping is not enabled.
diff --git a/spec/converse/conversation_handler_spec.rb b/spec/converse/conversation_handler_spec.rb index abc1234..def5678 100644 --- a/spec/converse/conversation_handler_spec.rb +++ b/spec/converse/conversation_handler_spec.rb @@ -0,0 +1,19 @@+RSpec.describe Converse::ConversationHandler do + describe "#can_handle?" do + xit "returns true if the intent of the message was found" + xit "returns false if the intent of the message was not found" + end + + describe "#handle!" do + xit "returns false if the message cannot be handled" + end + + # The runner + # Looks at the DSL + # Compile it + # Creates a queue of conversations + # Each response pops off the queue and runs it + # A queue can have child queues which represent subconversations + # The storage mechanism should be pluggable + # You should be able to review the conversation as it has happened +end
Move the conversation handler to the appropriate place
diff --git a/git_flame.gemspec b/git_flame.gemspec index abc1234..def5678 100644 --- a/git_flame.gemspec +++ b/git_flame.gemspec @@ -4,9 +4,18 @@ Gem::Specification.new do |gem| gem.authors = ["Linus Oleander"] gem.email = ["linus@oleander.nu"] - gem.description = %q{Ruby Git blame} - gem.summary = %q{Ruby Git blame} - gem.homepage = "" + gem.description = %q{Generates some awesome stats from git-blame} + gem.summary = %q{ + Generates some awesome stats from git-blame + + A Ruby wrapper for git-blame. + Generates data like: + - Number of files changed by a user + - Number of commits by user + - Lines of code by a user + } + + gem.homepage = "https://github.com/oleander/git-flame-rb" gem.files = `git ls-files`.split($\) gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } @@ -15,4 +24,12 @@ gem.require_paths = ["lib"] gem.version = GitFlame::VERSION gem.executables = ["git-flame"] -end + + gem.add_dependency("progressbar") + gem.add_dependency("optparse") + gem.add_dependency("hirb") + gem.add_dependency("action_view") + gem.add_dependency("mimer_plus") + + gem.add_development_dependency("rspec") +end
Add dependencies and proper description to gemspec
diff --git a/Casks/gif-for-mac.rb b/Casks/gif-for-mac.rb index abc1234..def5678 100644 --- a/Casks/gif-for-mac.rb +++ b/Casks/gif-for-mac.rb @@ -0,0 +1,12 @@+cask :v1 => 'gif-for-mac' do + version :latest + sha256 :no_check + + # cloudfront.net is the official download host per the vendor homepage + url 'https://d309cd6updicdi.cloudfront.net/mac/bin/GIFforMac.dmg' + name 'GIF for Mac' + homepage 'https://www.riffsy.com/Mac' + license :gratis + + app 'GIF for Mac.app' +end
Add GIF for Mac latest
diff --git a/lib/cloudstrap/amazon/elb.rb b/lib/cloudstrap/amazon/elb.rb index abc1234..def5678 100644 --- a/lib/cloudstrap/amazon/elb.rb +++ b/lib/cloudstrap/amazon/elb.rb @@ -20,6 +20,11 @@ private + Contract Args[String] => ArrayOf[::Aws::ElasticLoadBalancing::Types::TagDescription] + def describe_tags(*elb_names) + call_api(:describe_tags, load_balancer_names: elb_names).tag_descriptions + end + def client ::Aws::ElasticLoadBalancing::Client end
Add method to find tags
diff --git a/lib/constant-redefinition.rb b/lib/constant-redefinition.rb index abc1234..def5678 100644 --- a/lib/constant-redefinition.rb +++ b/lib/constant-redefinition.rb @@ -1,12 +1,10 @@ class Object def define_if_not_defined(const, value) mod = self.is_a?(Module) ? self : self.class + mod.const_set(const, value) unless mod.const_defined?(const) if block_given? - mod.const_set(const, value) unless mod.const_defined?(const) yield mod.send(:remove_const, const) if mod.const_defined?(const) - else - mod.const_set(const, value) unless mod.const_defined?(const) end end
Move setting of constant in define_if_not_defined up so as to not repeat code
diff --git a/features/step_definitions/contact_steps.rb b/features/step_definitions/contact_steps.rb index abc1234..def5678 100644 --- a/features/step_definitions/contact_steps.rb +++ b/features/step_definitions/contact_steps.rb @@ -1,5 +1,6 @@ Given(/^I click to edit from restroom Mission Creek Cafe$/) do - visit '/restrooms/1' + restroom = Restroom.find_by name: "Mission Creek Cafe" + visit restroom_path restroom click_link 'Contact us about this post!' end @@ -8,7 +9,8 @@ end Given(/^I click to contact from restroom Mission Creek Cafe$/) do - visit '/restrooms/1' + restroom = Restroom.find_by name: "Mission Creek Cafe" + visit restroom_path restroom click_link 'Contact' end
Use restroom path in feature rather than hardcoding id.
diff --git a/herodotus.gemspec b/herodotus.gemspec index abc1234..def5678 100644 --- a/herodotus.gemspec +++ b/herodotus.gemspec @@ -22,5 +22,4 @@ s.add_development_dependency 'redgreen' s.add_development_dependency 'rake' s.add_development_dependency 'ruby-debug19' - s.add_development_dependency 'minitest' end
Remove minitest dependency, just use 1.9
diff --git a/db/migrate/20150423232324_create_users.rb b/db/migrate/20150423232324_create_users.rb index abc1234..def5678 100644 --- a/db/migrate/20150423232324_create_users.rb +++ b/db/migrate/20150423232324_create_users.rb @@ -1,3 +1,5 @@+# Encoding: utf-8 +# Create Users class CreateUsers < ActiveRecord::Migration def change create_table :users do |t|
Clean up user migration script
diff --git a/lib/capistrano_nrel_ext/recipes/php_apc.rb b/lib/capistrano_nrel_ext/recipes/php_apc.rb index abc1234..def5678 100644 --- a/lib/capistrano_nrel_ext/recipes/php_apc.rb +++ b/lib/capistrano_nrel_ext/recipes/php_apc.rb @@ -0,0 +1,25 @@+Capistrano::Configuration.instance(true).load do + # + # Hooks + # + after "deploy:start", "php_apc:clear_cache" + after "deploy:restart", "php_apc:clear_cache" + + # + # Tasks + # + namespace :php_apc do + desc <<-DESC + Clear the PHP APC cache. This should be executed if new PHP files have + been deployed. + DESC + task :clear_cache, :roles => :app, :except => { :no_release => true } do + apc_clear_cache_path = File.join(current_path, "public/apc_clear_cache.php") + run <<-CMD + echo "<?php header('Cache-Control: max-age=0'); apc_clear_cache(); apc_clear_cache('user'); ?>" > #{apc_clear_cache_path} && \ + curl -s "http://#{domain}/apc_clear_cache.php?cache_buster=#{Time.now.to_f}"; \ + rm -f #{apc_clear_cache_path}; + CMD + end + end +end
Add recipe for clearing PHP's APC cache on deploy.
diff --git a/test/integration/queue/list_queues_test.rb b/test/integration/queue/list_queues_test.rb index abc1234..def5678 100644 --- a/test/integration/queue/list_queues_test.rb +++ b/test/integration/queue/list_queues_test.rb @@ -24,16 +24,20 @@ after { QueueNameHelper.clean } it 'lists the available queues' do - result = subject.list_queues + expected_queues = 0 - expected_queues = 0 - result.queues.each { |q| - q.name.wont_be_nil - q.url.wont_be_nil + # An empty next marker means to start at the beginning + next_marker = '' + begin + result = subject.list_queues( { :marker => next_marker } ) + result.queues.each { |q| + q.name.wont_be_nil + q.url.wont_be_nil + expected_queues += 1 if queue_names.include? q.name + } - expected_queues += 1 if queue_names.include? q.name - } - + next_marker = result.next_marker + end while next_marker != '' expected_queues.must_equal queue_names.length end end
Update list_queues test to expect a next_marker. This prevents failures when running against a queue service with over 5000 queues.
diff --git a/test/profile/normalize_performance_test.rb b/test/profile/normalize_performance_test.rb index abc1234..def5678 100644 --- a/test/profile/normalize_performance_test.rb +++ b/test/profile/normalize_performance_test.rb @@ -4,7 +4,7 @@ class NormalizerPerformanceTest < Test::Unit::TestCase context ".normalize_url" do measure "normalizing a short URL", 1000 do - Twingly::URL::Normalizer.normalize('http://www.duh.se/') + Twingly::URL::Normalizer.normalize_url('http://www.duh.se/') end end end
Fix performance test, should be testing normalize_url
diff --git a/lib/tasks/generate_random_sensor_data.rake b/lib/tasks/generate_random_sensor_data.rake index abc1234..def5678 100644 --- a/lib/tasks/generate_random_sensor_data.rake +++ b/lib/tasks/generate_random_sensor_data.rake @@ -0,0 +1,14 @@+namespace :generate_random_sensor_data do + task :seed, :environment do + # This loads dummy ph and temperature data -- I don't have access to the aquarium currently -- Robert + # Code should be self-documenting + + require 'csv' + CSV.foreach('/home/rob/aquarimeter-web/readings.csv') do |row| + temp = row[0].to_f + ph = row[1].to_f + SensorReading.create!(aquarium_id:1, temperature:temp, ph:ph) + # Kernel.sleep(1) # add some latency...this is so I can graph over time and calculate mock avgs + end + end +end
Add task to seed fake readings
diff --git a/db/migrate/20190212172653_change_topic_user_id_to_bigint.rb b/db/migrate/20190212172653_change_topic_user_id_to_bigint.rb index abc1234..def5678 100644 --- a/db/migrate/20190212172653_change_topic_user_id_to_bigint.rb +++ b/db/migrate/20190212172653_change_topic_user_id_to_bigint.rb @@ -0,0 +1,9 @@+class ChangeTopicUserIdToBigint < ActiveRecord::Migration[6.0] + def up + change_column :topic_users, :id, :bigint + end + + def down + change_column :topic_users, :id, :integer + end +end
Update topic_user_id primary key to bigint
diff --git a/core/db/migrate/20171004223836_remove_icon_from_taxons.rb b/core/db/migrate/20171004223836_remove_icon_from_taxons.rb index abc1234..def5678 100644 --- a/core/db/migrate/20171004223836_remove_icon_from_taxons.rb +++ b/core/db/migrate/20171004223836_remove_icon_from_taxons.rb @@ -0,0 +1,8 @@+class RemoveIconFromTaxons < ActiveRecord::Migration[5.1] + def change + remove_column :spree_taxons, :icon_file_name + remove_column :spree_taxons, :icon_content_type + remove_column :spree_taxons, :icon_file_size + remove_column :spree_taxons, :icon_updated_at + end +end
Remove old icon columns from taxon
diff --git a/db/migrate/20140211203335_create_balanced_contributors.rb b/db/migrate/20140211203335_create_balanced_contributors.rb index abc1234..def5678 100644 --- a/db/migrate/20140211203335_create_balanced_contributors.rb +++ b/db/migrate/20140211203335_create_balanced_contributors.rb @@ -3,8 +3,6 @@ create_table :balanced_contributors do |t| t.references :user, index: true t.string :uri - t.string :credit_card_uri - t.string :bank_account_uri t.timestamps end
Remove unused fields from balanced_contributors migration
diff --git a/test/fakeweb_registrations.rb b/test/fakeweb_registrations.rb index abc1234..def5678 100644 --- a/test/fakeweb_registrations.rb +++ b/test/fakeweb_registrations.rb @@ -27,3 +27,5 @@ body: { _index: "posts", _type: "post", _id: "1", _version: 118, created: false }.to_json, content_type: "application/json; charset=UTF-8" ) + +FakeWeb.allow_net_connect = %r{http://127.0.0.1/*}
Allow connections to 127.0.0.1 to fix acceptance tests
diff --git a/rails_event_store/spec/browser_integration_spec.rb b/rails_event_store/spec/browser_integration_spec.rb index abc1234..def5678 100644 --- a/rails_event_store/spec/browser_integration_spec.rb +++ b/rails_event_store/spec/browser_integration_spec.rb @@ -19,8 +19,8 @@ response = request.get('/res/api/streams/all/relationships/events') expect(JSON.parse(response.body)["links"]).to eq({ - "last" => "http://example.org/res/api/streams/all/relationships/events/head/forward/20", - "next" => "http://example.org/res/api/streams/all/relationships/events/#{events[1].event_id}/backward/20" + "last" => "http://example.org/res/api/streams/all/relationships/events?page%5Bposition%5D=head&page%5Bdirection%5D=forward&page%5Bcount%5D=20", + "next" => "http://example.org/res/api/streams/all/relationships/events?page%5Bposition%5D=#{events[1].event_id}&page%5Bdirection%5D=backward&page%5Bcount%5D=20" }) end
Adjust to new paging params [d077238b]
diff --git a/lib/dapp/dimg/build/stage/ga_related_dependencies_base.rb b/lib/dapp/dimg/build/stage/ga_related_dependencies_base.rb index abc1234..def5678 100644 --- a/lib/dapp/dimg/build/stage/ga_related_dependencies_base.rb +++ b/lib/dapp/dimg/build/stage/ga_related_dependencies_base.rb @@ -8,7 +8,7 @@ end def empty? - dimg.stage_by_name(related_stage_name).empty? && super + dimg.stage_by_name(related_stage_name).empty? || super end def related_stage_name
Revert "Фикс stage_dependencies для пересборки стадий install,setup" This reverts commit 09d7cb4cf570609dea8dd4ab0d5691e125e672e9.
diff --git a/app/validators/reservations/custom_whitelist_validator.rb b/app/validators/reservations/custom_whitelist_validator.rb index abc1234..def5678 100644 --- a/app/validators/reservations/custom_whitelist_validator.rb +++ b/app/validators/reservations/custom_whitelist_validator.rb @@ -3,18 +3,21 @@ module Reservations class CustomWhitelistValidator < ActiveModel::Validator def validate(record) - custom_whitelist_id = record.custom_whitelist_id - return unless custom_whitelist_id.present? && record.custom_whitelist_id_changed? + return unless record.custom_whitelist_id.present? && record.custom_whitelist_id_changed? - if custom_whitelist_id.match(/\A[a-zA-Z0-9_-]*\z/) - begin - WhitelistTf.download_and_save_whitelist(custom_whitelist_id) - rescue ActiveRecord::RecordInvalid, Faraday::Error::ClientError - record.errors.add(:custom_whitelist_id, "couldn't download the custom whitelist: \"#{custom_whitelist_id}\"") - end + if record.custom_whitelist_id.match(/\A[a-zA-Z0-9_-]*\z/) + try_to_download_custom_whitelist(record) else - record.errors.add(:custom_whitelist_id, "invalid whitelist: \"#{custom_whitelist_id}\"") + record.errors.add(:custom_whitelist_id, "invalid whitelist: \"#{record.custom_whitelist_id}\"") end + end + + private + + def try_to_download_custom_whitelist(record) + WhitelistTf.download_and_save_whitelist(record.custom_whitelist_id) + rescue ActiveRecord::RecordInvalid, Faraday::Error::ClientError + record.errors.add(:custom_whitelist_id, "couldn't download the custom whitelist: \"#{record.custom_whitelist_id}\"") end end end
Clean up custom whitelist validator a little
diff --git a/lib/cooperator.rb b/lib/cooperator.rb index abc1234..def5678 100644 --- a/lib/cooperator.rb +++ b/lib/cooperator.rb @@ -45,10 +45,6 @@ throw :_finish end - def success? - context.success? - end - def failure! context.failure! throw :_finish
Remove method which has already been delegated.
diff --git a/test/i_object_info_test.rb b/test/i_object_info_test.rb index abc1234..def5678 100644 --- a/test/i_object_info_test.rb +++ b/test/i_object_info_test.rb @@ -6,8 +6,8 @@ setup do gir = IRepository.default - gir.require 'Everything', nil - @info = gir.find_by_name 'Everything', 'TestObj' + gir.require 'Regress', nil + @info = gir.find_by_name 'Regress', 'TestObj' end should "find a vfunc by name" do
Make tests in IObjectInfoTest pass by changing Everything to Regress.
diff --git a/spec/factories/plugins_thermometers.rb b/spec/factories/plugins_thermometers.rb index abc1234..def5678 100644 --- a/spec/factories/plugins_thermometers.rb +++ b/spec/factories/plugins_thermometers.rb @@ -1,10 +1,9 @@ FactoryGirl.define do factory :plugins_thermometer, :class => 'Plugins::Thermometer' do title "MyString" -offset 1 -total 1 -campaign_page nil -active false + offset 1 + goal 1 + campaign_page nil + active false end - end
Fix thermometer plugin factory as per Omar's master plan
diff --git a/spec/integration/queue_declare_spec.rb b/spec/integration/queue_declare_spec.rb index abc1234..def5678 100644 --- a/spec/integration/queue_declare_spec.rb +++ b/spec/integration/queue_declare_spec.rb @@ -4,12 +4,27 @@ describe "Queue" do context "with a server-generated name" do let(:connection) { HotBunnies.connect } - let(:channel) { connection.create_channel } + let(:channel) { connection.create_channel } - it "can be declared" do - channel.queue("", :auto_delete => true) + after :each do channel.close connection.close end + + it "can be declared as auto-deleted" do + channel.queue("", :auto_delete => true) + end + + it "can be declared as auto-deleted and non-durable" do + channel.queue("", :auto_delete => true, :durable => false) + end + + it "can be declared as NON-auto-deleted" do + channel.queue("", :auto_delete => false) + end + + it "can be declared as NON-durable" do + channel.queue("", :durable => false) + end end end
Use after :each so that RSpec execution thread is not blocked forever
diff --git a/lib/not_my_job.rb b/lib/not_my_job.rb index abc1234..def5678 100644 --- a/lib/not_my_job.rb +++ b/lib/not_my_job.rb @@ -13,7 +13,7 @@ end to = options.fetch(:to) { raise ArgumentError, "The :to option is required." } - with_prefix = options.fetch(:with_prefix) { true } + with_prefix = options.fetch(:with_prefix, true) method_prefix = with_prefix ? "#{to}_" : ""
Change the default value in fetch(:with_prefix)
diff --git a/lib/headlines/security_headers/strict_transport_security.rb b/lib/headlines/security_headers/strict_transport_security.rb index abc1234..def5678 100644 --- a/lib/headlines/security_headers/strict_transport_security.rb +++ b/lib/headlines/security_headers/strict_transport_security.rb @@ -16,7 +16,7 @@ end def include_subdomains? - value.gsub(" ", "").scan(";includeSubDomains").any? + value.gsub(" ", "").downcase.scan(";includesubdomains").any? end def max_age
Use case insensitive scan for includeSubDomains HSTS property
diff --git a/lib/tasks/qa.rake b/lib/tasks/qa.rake index abc1234..def5678 100644 --- a/lib/tasks/qa.rake +++ b/lib/tasks/qa.rake @@ -1,4 +1,4 @@ desc 'Show some QA details about the code' task qa: ['stats', 'doc:stats'] do - sh 'rails_best_practices -x schema' + sh 'rails_best_practices -x schema --spec' end
Update railsbp to include spec files too.
diff --git a/week-4/add-it-up/my_solution.rb b/week-4/add-it-up/my_solution.rb index abc1234..def5678 100644 --- a/week-4/add-it-up/my_solution.rb +++ b/week-4/add-it-up/my_solution.rb @@ -4,30 +4,23 @@ # include it in this file. Also make sure everything that isn't code # is commented in the file. -# I worked on this challenge [by myself, ]. +# I worked on this challenge with Jamie. # 0. total Pseudocode # make sure all pseudocode is commented out! - -# Input: array of [numbers] -# Output: sum of all the numbers (sum) -# Steps to solve the problem. # define total as 0 # take each element in the argument to the method and add them together # return sum # 1. total initial solution + def total(array) total = 0 - array.each { |arr| total += arr } + array.each { |i| total += i } return total end - - -#array.each do |i| - # sum += [i] # 3. total refactored solution
Update 4.7.2 add it up
diff --git a/Casks/intellij-idea-ce-eap.rb b/Casks/intellij-idea-ce-eap.rb index abc1234..def5678 100644 --- a/Casks/intellij-idea-ce-eap.rb +++ b/Casks/intellij-idea-ce-eap.rb @@ -1,6 +1,6 @@ cask 'intellij-idea-ce-eap' do - version '144.2608.2' - sha256 '21d2fd409de9924d04a235bf5343033a52d84658fdf96e16d6aab377beab0fea' + version '144.2925.2' + sha256 '2dacc14f5c1854ba830205624c56c32f53ba6dc200b02e0dddf04133fed1af2c' url "https://download.jetbrains.com/idea/ideaIC-#{version}.dmg" name 'IntelliJ IDEA EAP :: CE'
Upgrade IntelliJ IDEA CE EAP to v144.2925.2
diff --git a/Casks/rubymine-bundled-jdk.rb b/Casks/rubymine-bundled-jdk.rb index abc1234..def5678 100644 --- a/Casks/rubymine-bundled-jdk.rb +++ b/Casks/rubymine-bundled-jdk.rb @@ -1,6 +1,6 @@ cask :v1 => 'rubymine-bundled-jdk' do - version '7.1' - sha256 '2e9fced43c8e14ffbc82a72a8f6cde1cbab50861db079162ca5ff34c668ba57c' + version '7.1.2' + sha256 '8d96d6b0484039055335618939a50b25a97cf13c93c2137dbafe5e4986725095' url "https://download.jetbrains.com/ruby/RubyMine-#{version}-custom-jdk-bundled.dmg" name 'RubyMine' @@ -17,4 +17,6 @@ '~/Library/Logs/RubyMine70', '/usr/local/bin/mine', ] + + conflicts_with :cask => 'rubymine' end
Upgrade RubyMine with bundled JDK to 7.1.2 Also add conflicts_with stanza for RubyMine without bundled JDK
diff --git a/app/controllers/admin/scoreboards_controller.rb b/app/controllers/admin/scoreboards_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/scoreboards_controller.rb +++ b/app/controllers/admin/scoreboards_controller.rb @@ -34,9 +34,9 @@ # DELETE /scoreboards/1 def destroy @scoreboard.safe_destroy - redirect_to scoreboards_url, notice: 'Scoreboard deleted' + redirect_to admin_scoreboards_path, notice: 'Scoreboard deleted' rescue EnergySparks::SafeDestroyError => error - redirect_to scoreboards_url, alert: "Delete failed: #{error.message}" + redirect_to admin_scoreboards_path, alert: "Delete failed: #{error.message}" end private
Fix _url suffix and namespace for delete URLs
diff --git a/SHOmniAuthFacebook.podspec b/SHOmniAuthFacebook.podspec index abc1234..def5678 100644 --- a/SHOmniAuthFacebook.podspec +++ b/SHOmniAuthFacebook.podspec @@ -1,6 +1,14 @@ Pod::Spec.new do |s| - s.name = "SHOmniAuthFacebook" - s.version = "0.1.0" + name = "SHOmniAuthFacebook" + url = "https://github.com/seivan/#{name}" + git_url = "#{url}.git" + version = "0.1.0" + source_files = "#{name}/**/*.{h,m}" + + s.name = name + s.version = version + + s.summary = "Facebook Strategy for SHOmniAuth." s.description = <<-DESC @@ -12,14 +20,14 @@ s.license = {:type => 'MIT' } s.author = { "Seivan Heidari" => "seivan.heidari@icloud.com" } - s.source = { :git => "https://github.com/seivan/SHOmniAuthFacebook.git", :tag => s.version.to_s} + s.source = { :git => "https://github.com/seivan/SHOmniAuthFacebook.git", :tag => version } s.platform = :ios, '5.0' - s.source_files = 'SHOmniAuthFacebook/**/*.{h,m}' + s.source_files = source_files s.requires_arc = true s.frameworks = 'Accounts', 'Social' s.dependency 'Facebook-iOS-SDK', '~> 3.2.1' - s.dependency 'SHOmniAuth', '~> 0.1.0' + s.dependency 'SHOmniAuth', '~> 0.2.0' end
Update SHOmniAuth dependency to 0.2.0
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,5 +1,6 @@ class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. - protect_from_forgery with: :exception + protect_from_forgery with: :exception, + if: proc { request.headers["X-Auth"] != "tutorial_secret" } end
Disable csrf for tutorial react-native app Tutorial has to send the following header: "X-Auth": "tutorial_secret" and then CSRF is ignored.
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,29 +1,34 @@ class ApplicationController < ActionController::Base include Pundit protect_from_forgery with: :exception + before_action :configure_permitted_parameters, if: :devise_controller? + before_action :complete_account_signup, if: "user_signed_in? && !current_user.account.present?" private - def after_sign_in_path_for(resource_or_scope) - # request.env['omniauth.origin'] || root_url#profile_path - new_account_path - end + def after_sign_in_path_for(resource_or_scope) + # request.env['omniauth.origin'] || root_url#profile_path + new_account_path + end - def configure_permitted_parameters - devise_parameter_sanitizer.permit(:sign_up, keys: [:email, :password, :password_confirmation]) + def configure_permitted_parameters + devise_parameter_sanitizer.permit(:sign_up, keys: [:email, :password, :password_confirmation]) - devise_parameter_sanitizer.permit(:account_update, keys: [:email, :password, :password_confirmation, :current_password]) - end + devise_parameter_sanitizer.permit(:account_update, keys: [:email, :password, :password_confirmation, :current_password]) + end + # NOTE: pundit authorization + rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized + def user_not_authorized + # flash[:alert] = "You are not authorized to perform this action." + redirect_to(request.referrer || root_path) + end - rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized - -private - -def user_not_authorized - flash[:alert] = "You are not authorized to perform this action." - redirect_to(request.referrer || root_path) -end + # NOTE: redirect users back to the signup page if they haven't completed setting up their account. + def complete_account_signup + flash[:alert] = "Please complete your profile before continuing." + redirect_to new_account_path + end end
Add callback with redirect for incomplete registrations
diff --git a/app/controllers/letsencrypt_controller.rb b/app/controllers/letsencrypt_controller.rb index abc1234..def5678 100644 --- a/app/controllers/letsencrypt_controller.rb +++ b/app/controllers/letsencrypt_controller.rb @@ -1,5 +1,5 @@ class LetsencryptController < ApplicationController def verify - render text: 'G-SNx8QU3fN95LKlHwWjlPtWUy-WC2s_W4bkVjeCEHs.HGKAemL2fUjIRadTuQf-sqPIqvo2JUZKqjZzg1u2D0U' + render text: '-Pk_eaIGfnFWuM5fv8n3t9kFCbM-EfjA-IqPO_PfVfE.HGKAemL2fUjIRadTuQf-sqPIqvo2JUZKqjZzg1u2D0U' end end
Update the lets encrypt verification key.
diff --git a/config/initializers/swagger.rb b/config/initializers/swagger.rb index abc1234..def5678 100644 --- a/config/initializers/swagger.rb +++ b/config/initializers/swagger.rb @@ -5,10 +5,10 @@ } GrapeSwaggerRails.options.doc_expansion = 'list' -GrapeSwaggerRails.options.app_name = ENV['BRAND_NAME'] + ' API documentation' +GrapeSwaggerRails.options.app_name = (ENV['BRAND_NAME'] || 'Cloud.net') + ' API documentation' GrapeSwaggerRails.options.api_auth = 'basic' GrapeSwaggerRails.options.api_key_name = 'Authorization' GrapeSwaggerRails.options.api_key_type = 'header' -GrapeSwaggerRails.options.headers['Accept-Version'] = 'v1'+GrapeSwaggerRails.options.headers['Accept-Version'] = 'v1'
Fix for failing docker builds
diff --git a/app/models/product_type.rb b/app/models/product_type.rb index abc1234..def5678 100644 --- a/app/models/product_type.rb +++ b/app/models/product_type.rb @@ -1,6 +1,6 @@ class ProductType < ActiveRecord::Base acts_as_nested_set #:order => "name" - has_many :products + has_many :products, dependent: :restrict validates :name, :presence => true, :length => { :maximum => 255 }
Add dependent: :restrict to has_many
diff --git a/app/routes/unsubscribes.rb b/app/routes/unsubscribes.rb index abc1234..def5678 100644 --- a/app/routes/unsubscribes.rb +++ b/app/routes/unsubscribes.rb @@ -1,6 +1,6 @@ module Citygram::Routes class Unsubscribes < Sinatra::Base - FILTER_WORDS = %w(CANCEL QUIT STOP UNSUBSCRIBE) + FILTER_WORDS = %w(CANCEL QUIT STOP STOPALL UNSUBSCRIBE) FILTER_WORD_REGEXP = Regexp.union(FILTER_WORDS.map{|w| /^#{w}/i }) username = ENV.fetch('BASIC_AUTH_USERNAME')
Add STOPALL as filter word Better to be explicit.
diff --git a/test/lib/rails_sso/failure_app_test.rb b/test/lib/rails_sso/failure_app_test.rb index abc1234..def5678 100644 --- a/test/lib/rails_sso/failure_app_test.rb +++ b/test/lib/rails_sso/failure_app_test.rb @@ -16,7 +16,7 @@ env = { 'REQUEST_URI' => 'http://test.host', 'HTTP_HOST' => 'test.host', - 'CONTENT_TYPE' => 'application/json' + 'HTTP_X_REQUESTED_WITH' => 'XMLHttpRequest' } response = RailsSso::FailureApp.call(env).to_a
[fix] Adjust test to xhr? in failure app
diff --git a/operable.gemspec b/operable.gemspec index abc1234..def5678 100644 --- a/operable.gemspec +++ b/operable.gemspec @@ -13,12 +13,12 @@ s.summary = 'Arithmetic operations on your models.' s.description = 'Perform addition, subtraction, multiplication and division on your models.' - s.add_dependency 'activemodel', '~> 3.1.0' + s.add_dependency 'activemodel', '~> 3.0' - s.add_development_dependency 'activerecord', '~> 3.1.0' + s.add_development_dependency 'activerecord', '~> 3.0' s.add_development_dependency 'mongoid', '~> 2.3' s.add_development_dependency 'bson_ext', '~> 1.4' - s.add_development_dependency 'sqlite3', '~> 1.3' + s.add_development_dependency 'sqlite3' s.add_development_dependency 'growl' s.add_development_dependency 'rake' s.add_development_dependency 'rspec', '~> 2.8.0.rc1'
Allow to work with Rails RC
diff --git a/app/inputs/unique_input.rb b/app/inputs/unique_input.rb index abc1234..def5678 100644 --- a/app/inputs/unique_input.rb +++ b/app/inputs/unique_input.rb @@ -11,7 +11,7 @@ private def input_field_options - result = {} + result = input_html_options || {} result[:class] = "#{input_html_options_class} #{wrapper_class} simple_form_unique" result[:placeholder] = placeholder_text result[:'data-message-field'] = "##{message_element_id}"
Include additional passed-in fields when creating the input element.
diff --git a/app/patches/issue_patch.rb b/app/patches/issue_patch.rb index abc1234..def5678 100644 --- a/app/patches/issue_patch.rb +++ b/app/patches/issue_patch.rb @@ -9,8 +9,18 @@ next if assigned_serial_number?(cf) target_custom_value = serial_number_custom_values(cf).first - target_custom_value.update_attributes!( - :value => cf.format.generate_value(cf, self)) + new_serial_number = cf.format.generate_value(cf, self) + + # TODO find_or_create_by + if target_custom_value.present? + target_custom_value.update_attributes!( + :value => new_serial_number) + else + CustomValue.create!(:custom_field_id => cf.id, + :customized_type => 'Issue', + :customized_id => self.id, + :value => new_serial_number) + end end end
Fix not have a CustomValue of serial number Error
diff --git a/db/migrate/20170224133932_add_materialised_view_for_valid_taxon_concept_term_view.rb b/db/migrate/20170224133932_add_materialised_view_for_valid_taxon_concept_term_view.rb index abc1234..def5678 100644 --- a/db/migrate/20170224133932_add_materialised_view_for_valid_taxon_concept_term_view.rb +++ b/db/migrate/20170224133932_add_materialised_view_for_valid_taxon_concept_term_view.rb @@ -0,0 +1,12 @@+class AddMaterialisedViewForValidTaxonConceptTermView < ActiveRecord::Migration + def up + execute "DROP MATERIALIZED VIEW IF EXISTS valid_taxon_concept_term_mview" + execute "CREATE MATERIALIZED VIEW valid_taxon_concept_term_mview AS SELECT * FROM valid_taxon_concept_term_view" + execute "CREATE INDEX ON valid_taxon_concept_term_mview (taxon_concept_id)" + execute "CREATE INDEX ON valid_taxon_concept_term_mview (term_id)" + end + + def down + execute "DROP MATERIALIZED VIEW IF EXISTS valid_taxon_concept_term_mview" + end +end
Add materialized view for valid_taxon_concept_term_view
diff --git a/app/helpers/page_fragments/fragments_helper.rb b/app/helpers/page_fragments/fragments_helper.rb index abc1234..def5678 100644 --- a/app/helpers/page_fragments/fragments_helper.rb +++ b/app/helpers/page_fragments/fragments_helper.rb @@ -1,7 +1,7 @@ module PageFragments::FragmentsHelper def fragments(options={}) root = fragment_root(options.delete(:root)) - fragments = Wheelhouse::Page.where(:parent_id => root.id).fragments + fragments = Wheelhouse::Page.where(:parent_id => root.id).ordered.fragments safe_join(fragments.map { |f| fragment(f, options) }, "\n") end
Order page fragments when rendering
diff --git a/app/services/cap_quantity_and_store_changes.rb b/app/services/cap_quantity_and_store_changes.rb index abc1234..def5678 100644 --- a/app/services/cap_quantity_and_store_changes.rb +++ b/app/services/cap_quantity_and_store_changes.rb @@ -3,34 +3,42 @@ class CapQuantityAndStoreChanges def initialize(order) @order = order + @changes = {} end def call - changes = {} + cap_insufficient_stock! + verify_line_items + reload_order if changes.present? + + changes + end + + private + + attr_reader :order, :changes + + def cap_insufficient_stock! order.insufficient_stock_lines.each do |line_item| changes[line_item.id] = line_item.quantity line_item.cap_quantity_at_stock! end + end + def verify_line_items unavailable_stock_lines_for.each do |line_item| changes[line_item.id] = changes[line_item.id] || line_item.quantity line_item.update(quantity: 0) Spree::OrderInventory.new(order).verify(line_item, order.shipment) end - - if changes.present? - order.line_items.reload - order.update_order_fees! - end - - changes end - private - - attr_reader :order + def reload_order + order.line_items.reload + order.update_order_fees! + end def unavailable_stock_lines_for order.line_items.where('variant_id NOT IN (?)', available_variants_for.select(&:id))
Split method into higher-level smaller methods
diff --git a/pg_query.gemspec b/pg_query.gemspec index abc1234..def5678 100644 --- a/pg_query.gemspec +++ b/pg_query.gemspec @@ -26,5 +26,5 @@ s.add_development_dependency 'rubocop' s.add_development_dependency 'rubocop-rspec' - s.add_runtime_dependency 'json', '~> 1.8' + s.add_runtime_dependency 'json', '>= 1.8', '< 3' end
Update JSON gem dependency for Ruby 2.4
diff --git a/test/fixtures/cookbooks/yumserver-test/recipes/default.rb b/test/fixtures/cookbooks/yumserver-test/recipes/default.rb index abc1234..def5678 100644 --- a/test/fixtures/cookbooks/yumserver-test/recipes/default.rb +++ b/test/fixtures/cookbooks/yumserver-test/recipes/default.rb @@ -10,7 +10,7 @@ end yumserver_rsync_mirror 'centos-xen' do - repo_name 'centos-kvm' + repo_name 'centos-xen' repo_description 'CentOS Virtualization Packages' repo_url "rsync://mirror.bytemark.co.uk/centos/#{major_ver[/./,0]}/virt/x86_64/xen/" action :create
Switch mirrored repo used for testing
diff --git a/plugins/fstab.rb b/plugins/fstab.rb index abc1234..def5678 100644 --- a/plugins/fstab.rb +++ b/plugins/fstab.rb @@ -13,13 +13,12 @@ entry_hash = Hash.new fstab_entries.each do |entry| line = entry.split - unless line.empty? - entry_hash[line[0]] = { 'mount point' => line[1], - 'type' => line[2], - 'options' => line[3].split("'"), - 'dump' => line[4], - 'pass' => line[5] } - end + next if line.empty? + entry_hash[line[0]] = { 'mount point' => line[1], + 'type' => line[2], + 'options' => line[3].split("'"), + 'dump' => line[4], + 'pass' => line[5] } end fstab_return['fstab'] = entry_hash fstab.merge!(fstab_return) unless fstab_return.empty?
Use next to skip iteration per rubocop
diff --git a/ducksauce.gemspec b/ducksauce.gemspec index abc1234..def5678 100644 --- a/ducksauce.gemspec +++ b/ducksauce.gemspec @@ -8,6 +8,7 @@ gem.version = DuckSauce::VERSION gem.authors = ['Josh Ballanco'] gem.email = ['jballanc@gmail.com'] + gem.license = 'BSD 2-Clause' gem.description = 'DuckSauce handles duck type boilerplate so you don\'t have to.' gem.summary = <<-EOS.lines.map(&:lstrip).join DuckSauce is a gem that takes the hard work out of doing
Set the license in the gemspec
diff --git a/spec/default/java_spec.rb b/spec/default/java_spec.rb index abc1234..def5678 100644 --- a/spec/default/java_spec.rb +++ b/spec/default/java_spec.rb @@ -6,6 +6,6 @@ end describe command('java -version') do - its(:stderr) { should match('1.8.0_25') } + its(:stderr) { should include('1.8.0_25') } end end
Change Java version verification method
diff --git a/rss-dcterms.gemspec b/rss-dcterms.gemspec index abc1234..def5678 100644 --- a/rss-dcterms.gemspec +++ b/rss-dcterms.gemspec @@ -6,7 +6,7 @@ gem.email = ["KitaitiMakoto@gmail.com"] gem.description = %q{Enable standard bundled RSS library parse and make feeds including DCMI(Dublin Core Metadata Initiative) Metadata Terms} gem.summary = %q{DCTERMS support for standard bundled RSS library} - gem.homepage = "https://gitorious.org/rss/dcterms" + gem.homepage = "http://rss-ext.rubyforge.org/" gem.files = `git ls-files`.split($\) gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
Change homepage: Gitorious -> Rubyforge
diff --git a/spec/models/entity_spec.rb b/spec/models/entity_spec.rb index abc1234..def5678 100644 --- a/spec/models/entity_spec.rb +++ b/spec/models/entity_spec.rb @@ -20,4 +20,19 @@ require 'spec_helper' describe Entity do + before { @entity = Fabricate.build(:entity) } + subject { @entity } + + it { should validate_presence_of(:type) } + it { should ensure_inclusion_of(:type).in_array(["school", "company", "community"]) } + it { should ensure_inclusion_of(:level).in_array(["cool", "awesome"]) } + + it { should have_many(:event_partners) } + it { should have_many(:events).through(:event_partners) } + + describe "#inheritance_column" do + it "must disable STI to use 'type' as a column name" do + Entity.inheritance_column.should eq("disabled") + end + end end
Add tests to completely cover Entity model
diff --git a/spec/seventeen_mon_spec.rb b/spec/seventeen_mon_spec.rb index abc1234..def5678 100644 --- a/spec/seventeen_mon_spec.rb +++ b/spec/seventeen_mon_spec.rb @@ -6,7 +6,7 @@ ipdb_1 = SM::IPDB.instance ipdb_2 = SM::IPDB.instance - ipdb_1.object_id.should == ipdb_2.object_id + expect(ipdb_1.object_id).to eq(ipdb_2.object_id) end end @@ -18,16 +18,16 @@ it "can find location by ip" do result = SM.find_by_ip @ip_param - result.should include(:city) - result.should include(:province) - result.should include(:country) + expect(result).to include(:city) + expect(result).to include(:province) + expect(result).to include(:country) end it "can find location by address" do result = SM.find_by_address @url_param - result.should include(:city) - result.should include(:province) - result.should include(:country) + expect(result).to include(:city) + expect(result).to include(:province) + expect(result).to include(:country) end end end
Use the new `:expect` syntax
diff --git a/spec/array_hash_spec.rb b/spec/array_hash_spec.rb index abc1234..def5678 100644 --- a/spec/array_hash_spec.rb +++ b/spec/array_hash_spec.rb @@ -27,6 +27,6 @@ RSpec.describe 'change_value_of_key' do it 'changes the value of the key in the hash' do - expect(change_value_of_key(:favorite_food, 'sushi')).to eq({ name: "Chris", favorite_food: "sushi", age: 27, hair_color: 'blue' }) + expect(change_value_of_key(:favorite_food, 'sushi')).to eq({ name: "Chris", favorite_food: "sushi", age: 27 }) end end
Remove copy-paste error from test Assuming instructions and example data in lib are correct.
diff --git a/spec/gsl/matrix_spec.rb b/spec/gsl/matrix_spec.rb index abc1234..def5678 100644 --- a/spec/gsl/matrix_spec.rb +++ b/spec/gsl/matrix_spec.rb @@ -0,0 +1,95 @@+require 'spec_helper' + +# Note: test cases at this point all fit inside a uchar (0-127). +# TODO: paramaterize this better to more fully test doubles etc. + +class MatrixSpec < MiniTest::Spec + def klass + GSL::Matrix + end + + it 'allows instantiation' do + v = klass.new(1, 1) + v.must_be_instance_of(klass) + end + + it 'gets and sets elements' do + v = klass.new(10, 10) + 10.times do |i| + 10.times do |j| + v.set!(i, j, i*j) + end + end + + 10.times do |i| + 10.times do |j| + v.get(i, j).must_equal(i*j) + end + end + end + + it 'sets all elements' do + size = 10 + v = klass.new(size, size) + v.set_all!(10) + size.times do |i| + size.times do |j| + v.get(i, j).must_equal(10) + end + end + + v.set_all!(111) + size.times do |i| + size.times do |j| + v.get(i, j).must_equal(111) + end + end + end + + it 'adds other matricies to it' do + a = klass.new(10,10) + b = klass.new(10,10) + a.set_all!(43) + b.set_all!(32) + + a.add!(b) + + 10.times do |i| + 10.times do |j| + a.get(i, j).must_equal(75) + end + end + end + + it 'raises error on zero size' do + # lambda {klass.new(0,1)}.must_raise(Exception) + # lambda {klass.new(1,0)}.must_raise(Exception) + # lambda {klass.new(0,0)}.must_raise(Exception) + end +end + +# Create test class for each matrix type. Run those same tests. +[GSL::Matrix::Char, + GSL::Matrix::Complex, + GSL::Matrix::Complex::Float, + # GSL::Matrix::Complex::LongDouble, + GSL::Matrix::Float, + GSL::Matrix::Int, + # GSL::Matrix::LongDouble, + GSL::Matrix::Long, + GSL::Matrix::Short, + GSL::Matrix::UChar, + GSL::Matrix::UInt, + GSL::Matrix::ULong, + GSL::Matrix::UShort].each do |klass| + elements = klass.to_s.split('::') + elements.shift + test_class_name = elements.join('') + 'Spec' + eval %Q{ + class #{test_class_name} < MatrixSpec + def klass + #{klass} + end + end + } +end
Add minitest spec for some matrix ops.
diff --git a/spec/locamotion_spec.rb b/spec/locamotion_spec.rb index abc1234..def5678 100644 --- a/spec/locamotion_spec.rb +++ b/spec/locamotion_spec.rb @@ -2,7 +2,6 @@ describe "Locamotion" do before do - FileUtils.rm_rf('/tmp/rm_project') FileUtils.mkdir_p('/tmp/rm_project/app') content = <<-eos "I am localized!"._ @@ -13,6 +12,10 @@ @app = Locamotion::App.new end + after do + FileUtils.rm_rf('/tmp/rm_project') + end + describe "slurp" do it "gets all localizable strings" do expect(@app.parse_rubymotion_app('/tmp/rm_project/app/**/*.rb')).to match_array(["I am localized!", "I am also localized.", "I am to be localized"])
Clean up test folder after tests ran
diff --git a/spec/models/bug_spec.rb b/spec/models/bug_spec.rb index abc1234..def5678 100644 --- a/spec/models/bug_spec.rb +++ b/spec/models/bug_spec.rb @@ -1,6 +1,10 @@ require 'rails_helper' -describe Bug do +describe Bug, type: :model do + let(:valid_attributes) do + { title: 'My Title', description: 'My Text', closed: false, reporter_id: 1 } + end + it { should belong_to(:reporter) } it { should belong_to(:assignee) } it { should have_many(:comments) } @@ -8,17 +12,22 @@ it { should validate_presence_of(:reporter_id) } it { should validate_presence_of(:description) } - it 'validates associated reporter record' do - bug = Bug.new(title: 'foo', description: 'bar') - bug.build_reporter(id: 9999, email: nil) - expect(bug.save).to(eq false) - expect(bug.errors.full_messages_for(:reporter)[0]).to(eq 'Reporter is invalid') - end + context 'with valid and invalid User associations' do + before(:example) do + valid_attributes[:reporter_id] = nil + @bug = Bug.new(valid_attributes) + end - it 'validates associated assignee record' do - bug = Bug.new(title: 'foo', description: 'bar') - bug.build_assignee(id: 9999, email: nil) - expect(bug.save).to(eq false) - expect(bug.errors.full_messages_for(:assignee)[0]).to(eq 'Assignee is invalid') + it 'is invalid if reporter record is invalid' do + @bug.build_reporter(id: 9999, email: nil) + @bug.save + expect(@bug.errors[:reporter][0]).to(eq 'is invalid') + end + + it 'is invalid if assignee record is invalid' do + @bug.build_assignee(id: 9999, email: nil) + @bug.save + expect(@bug.errors[:assignee][0]).to(eq 'is invalid') + end end end
Improve Tests for Bug User Association Validation
diff --git a/spec/status_api_spec.rb b/spec/status_api_spec.rb index abc1234..def5678 100644 --- a/spec/status_api_spec.rb +++ b/spec/status_api_spec.rb @@ -1,6 +1,43 @@ require 'spec_helper' describe Github::StatusAPI do - + describe "#api" do + before do + @expected_response = { + status_url: "https://status.github.com/api/status.json", + messages_url: "https://status.github.com/api/messages.json", + last_message_url: "https://status.github.com/api/last-message.json" + } + + @stub_request = stub_request(:get, "https://status.github.com/api.json") + @stub_request.to_return(body: JSON.generate(@expected_response)) + + @actual_response = Github::StatusAPI.api + end + + describe "request" do + it "should have been requested" do + @stub_request.should have_been_requested + end + + it "should have requested api.json" do + @stub_request.should have_requested(:get, "https://status.github.com/api.json") + end + end + + describe "response" do + it "should have responded with a status url" do + @actual_response[:status_url].should == @expected_response[:status_url] + end + + it "should have responded with a messages url" do + @actual_response[:messages_url].should == @expected_response[:messages_url] + end + + it "should have responded with a last message url" do + @actual_response[:last_message_url].should == @expected_response[:last_message_url] + end + end + end end
Add spec for the querying the api urls.
diff --git a/test/integration/binary/serverspec/localhost/binary_spec.rb b/test/integration/binary/serverspec/localhost/binary_spec.rb index abc1234..def5678 100644 --- a/test/integration/binary/serverspec/localhost/binary_spec.rb +++ b/test/integration/binary/serverspec/localhost/binary_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe 'kafka::binary' do - describe file('/opt/kafka/build') do + describe file('/opt/kafka/dist') do it { should be_a_directory } it { should be_mode 755 } it { should be_owned_by('kafka') } @@ -13,10 +13,10 @@ describe file('/tmp/kitchen-chef-solo/cache/kafka_2.8.0-0.8.0-beta1.tgz') do it { should be_a_file } it { should be_mode 644 } - it { should match_md5checksum 'b90e355ea2bc1e5f62db1836fdd77502' } + it { should match_md5checksum 'f12e7698aff37a0e014cb9dc087f0b8f' } end - describe file('/opt/kafka/kafka_2.9.2-0.8.0-beta1.jar') do + describe file('/opt/kafka/kafka_2.8.0-0.8.0-beta1.jar') do it { should be_a_file } it { should be_owned_by('kafka') } it { should be_grouped_into('kafka') }
Test the right things in binary integration specs Suppose I just copied the source integration specs and then just didn't give a fuck. Oh well.
diff --git a/config.ru b/config.ru index abc1234..def5678 100644 --- a/config.ru +++ b/config.ru @@ -11,6 +11,7 @@ use Rack::Cors do allow do origins '*' + resource '/compile', :headers => :any, :methods => [:post] resource '/compile/*', :headers => :any, :methods => [:post] resource '/builds', :headers => :any, :methods => [:post] resource '/shots', :headers => :any, :methods => [:post]
Set up CORS for /compile.