diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/bollettino/renderers/payer_renderer.rb b/lib/bollettino/renderers/payer_renderer.rb index abc1234..def5678 100644 --- a/lib/bollettino/renderers/payer_renderer.rb +++ b/lib/bollettino/renderers/payer_renderer.rb @@ -11,7 +11,7 @@ write_text(image, [85, 315], payer.name[25..49]) write_text(image, [1508, 375], payer.name[0..22], KERNING_BOX_SMALLEST) - write_text(image, [1508, 330], payer.name[22..44], KERNING_BOX_SMALLEST) + write_text(image, [1508, 330], payer.name[23..45], KERNING_BOX_SMALLEST) end def self.render_address(image, payer)
Fix overlapping in payer's name
diff --git a/lib/dry/system/plugins/monitoring/proxy.rb b/lib/dry/system/plugins/monitoring/proxy.rb index abc1234..def5678 100644 --- a/lib/dry/system/plugins/monitoring/proxy.rb +++ b/lib/dry/system/plugins/monitoring/proxy.rb @@ -23,7 +23,7 @@ attr_reader :__notifications__ - monitored_methods(methods.empty? ? target.public_methods - Object.public_instance_methods : methods) + monitored_methods(monitored_methods) monitored_methods.each do |meth| define_method(meth) do |*args, &block|
Use variable already allocated for monitored_methods
diff --git a/lib/hstore_radio_buttons/button_options.rb b/lib/hstore_radio_buttons/button_options.rb index abc1234..def5678 100644 --- a/lib/hstore_radio_buttons/button_options.rb +++ b/lib/hstore_radio_buttons/button_options.rb @@ -2,7 +2,7 @@ class ButtonOptions attr_accessor :name, :options def initialize(name, options) - self.name = name.to_s + self.name = name self.options = *options end end
Revert "Fix attempt for an integration project" This reverts commit 2a223655705526140f9a51215ece8dabe5fc2860.
diff --git a/lib/test_kafka/zookeeper.rb b/lib/test_kafka/zookeeper.rb index abc1234..def5678 100644 --- a/lib/test_kafka/zookeeper.rb +++ b/lib/test_kafka/zookeeper.rb @@ -9,9 +9,9 @@ "org.apache.zookeeper.server.quorum.QuorumPeerMain", port, kafka_path, - :dataDir => "#{tmp_dir}/zookeeper", - :clientPort => port, - :maxClientCnxns => 0) + "dataDir" => "#{tmp_dir}/zookeeper", + "clientPort" => port, + "maxClientCnxns" => 0) end attr_reader :port
Use strings for ZK java properties
diff --git a/schema-evolution-manager.gemspec b/schema-evolution-manager.gemspec index abc1234..def5678 100644 --- a/schema-evolution-manager.gemspec +++ b/schema-evolution-manager.gemspec @@ -0,0 +1,12 @@+Gem::Specification.new do |s| + s.name = 'schema-evolution-manager' + s.version = '0.0.0' + s.date = Time.now.strftime('%Y-%m-%d') + s.summary = "Schema Evolution Manager makes it very simple for engineers to contribute schema changes to a postgresql database, managing the schema evolutions as proper source code." + s.authors = ["Michael Bryzek"] + s.files = %w( README.md ) + s.files += Dir.glob("bin/**/*") + s.files += Dir.glob("lib/**/*") + s.files += Dir.glob("template/**/*") + s.executables = ["sem-add", "sem-apply", "sem-config", "sem-dist", "sem-info", "sem-init"] +end
Add gemfile as an install option Resolves #13
diff --git a/lib/shenanigans/module/private_accessor.rb b/lib/shenanigans/module/private_accessor.rb index abc1234..def5678 100644 --- a/lib/shenanigans/module/private_accessor.rb +++ b/lib/shenanigans/module/private_accessor.rb @@ -1,8 +1,9 @@ class Module private - # Works like attr_accessor but generates private methods for - # class internal use only. + # Works like <tt>attr_accessor</tt> but generates private + # getter/setter methods for class internal use only. Useful + # for enforcing Smalltalk-style internal encapsulation. def private_accessor(*names) names.each do |name| instance_var_name = "@#{name}" @@ -18,5 +19,6 @@ self.send(:private, name) self.send(:private, "#{name}=") end + nil # like attr_accessor end end
Update documentation and change return value
diff --git a/spec/generator/generator_spec.rb b/spec/generator/generator_spec.rb index abc1234..def5678 100644 --- a/spec/generator/generator_spec.rb +++ b/spec/generator/generator_spec.rb @@ -3,5 +3,8 @@ describe Uniqueness do context 'generate' do it { expect(Uniqueness.generate).not_to be_nil } + it { expect(Uniqueness.generate(type: :numbers)).to match(/^[0-9]+$/) } + it { expect(Uniqueness.generate(prefix: 'hassan').index('hassan')).to eq 0 } + it { expect(Uniqueness.generate(suffix: 'hassan')).to end_with "hassan" } end end
Add specs for generate custom numbers with prefix and suffix options
diff --git a/spec/helpers/url_helpers_spec.rb b/spec/helpers/url_helpers_spec.rb index abc1234..def5678 100644 --- a/spec/helpers/url_helpers_spec.rb +++ b/spec/helpers/url_helpers_spec.rb @@ -0,0 +1,33 @@+require 'rails_helper' + +RSpec.describe "url helpers", type: :helper do + let(:headers) { helper.request.env } + + describe "#admin_root_url" do + context "when on the public website" do + before do + headers["HTTP_HOST"] = "petition.parliament.uk" + headers["HTTPS"] = "on" + headers["SERVER_PORT"] = 443 + end + + it "generates a moderation website url" do + expect(helper.admin_root_url).to eq("https://moderate.petition.parliament.uk/admin") + end + end + end + + describe "#home_url" do + context "when on the moderation website" do + before do + headers["HTTP_HOST"] = "moderate.petition.parliament.uk" + headers["HTTPS"] = "on" + headers["SERVER_PORT"] = 443 + end + + it "generates a public website url" do + expect(helper.home_url).to eq("https://petition.parliament.uk/") + end + end + end +end
Test that url helpers use the correct domain
diff --git a/lib/lita/handlers/greet.rb b/lib/lita/handlers/greet.rb index abc1234..def5678 100644 --- a/lib/lita/handlers/greet.rb +++ b/lib/lita/handlers/greet.rb @@ -2,7 +2,7 @@ module Handlers class Greet < Handler - route(/^(hello|hi|good morning|howdy|yo!?$|hey) .*/i, :say_hello) + route(/^(hello|hi!?(| .*)$|good morning|howdy|yo!?$|hey).*/i, :say_hello) route(/^welcome (.+)/i, :welcome) def say_hello(response)
Fix improve how Hi gets found
diff --git a/plugins/distribution/controllers/myprofile/distribution_plugin_supplier_controller.rb b/plugins/distribution/controllers/myprofile/distribution_plugin_supplier_controller.rb index abc1234..def5678 100644 --- a/plugins/distribution/controllers/myprofile/distribution_plugin_supplier_controller.rb +++ b/plugins/distribution/controllers/myprofile/distribution_plugin_supplier_controller.rb @@ -6,7 +6,7 @@ def index params['name'] = "" if params['name'].blank? - @suppliers = @node.suppliers.with_name(params['name']).paginate(:per_page => 2, :page => params["page"]) + @suppliers = @node.suppliers.with_name(params['name']).paginate(:per_page => 10, :page => params["page"]) respond_to do |format| format.html
Change pagination to 10 on supplier
diff --git a/lib/spec/rails/matchers.rb b/lib/spec/rails/matchers.rb index abc1234..def5678 100644 --- a/lib/spec/rails/matchers.rb +++ b/lib/spec/rails/matchers.rb @@ -1,12 +1,4 @@ dir = File.dirname(__FILE__) -require 'spec/rails/matchers/ar_be_valid' -require 'spec/rails/matchers/assert_select' -require 'spec/rails/matchers/change' -require 'spec/rails/matchers/have_text' -require 'spec/rails/matchers/include_text' -require 'spec/rails/matchers/redirect_to' -require 'spec/rails/matchers/route_to' -require 'spec/rails/matchers/render_template' module Spec module Rails @@ -31,3 +23,12 @@ end end end + +require 'spec/rails/matchers/ar_be_valid' +require 'spec/rails/matchers/assert_select' +require 'spec/rails/matchers/change' +require 'spec/rails/matchers/have_text' +require 'spec/rails/matchers/include_text' +require 'spec/rails/matchers/redirect_to' +require 'spec/rails/matchers/route_to' +require 'spec/rails/matchers/render_template'
Move require statements to underneath the Spec::Rails module, so that the module exists before we try to use it. [#939 state:resolved milestone:'Next Release']
diff --git a/lib/template/lib/routes.rb b/lib/template/lib/routes.rb index abc1234..def5678 100644 --- a/lib/template/lib/routes.rb +++ b/lib/template/lib/routes.rb @@ -3,6 +3,7 @@ use Pliny::Middleware::CORS use Pliny::Middleware::RequestID use Pliny::Middleware::RequestStore::Seed, store: Pliny::RequestStore + use Pliny::Middleware::Metrics use Pliny::Middleware::Instruments use Pliny::Middleware::RescueErrors, raise: Config.raise_errors? use Rack::Timeout,
Add Middleware::Metrics to the default stack
diff --git a/test/filters/test_pandoc.rb b/test/filters/test_pandoc.rb index abc1234..def5678 100644 --- a/test/filters/test_pandoc.rb +++ b/test/filters/test_pandoc.rb @@ -6,6 +6,10 @@ def test_filter if_have 'pandoc-ruby' do + if `which pandoc`.strip.empty? + skip "could not find pandoc" + end + # Create filter filter = ::Nanoc::Filters::Pandoc.new
Make pandoc test case not fail when pandoc is not available
diff --git a/db/migrate/112_add_api_key_to_public_bodies.rb b/db/migrate/112_add_api_key_to_public_bodies.rb index abc1234..def5678 100644 --- a/db/migrate/112_add_api_key_to_public_bodies.rb +++ b/db/migrate/112_add_api_key_to_public_bodies.rb @@ -9,7 +9,7 @@ pb.save! end - change_column :public_bodies, :api_key, :string, :null => false + change_column_null :public_bodies, :api_key, false end def self.down
Correct syntax for making column NOT NULL
diff --git a/db/migrate/20180719122729_create_oauth_apps.rb b/db/migrate/20180719122729_create_oauth_apps.rb index abc1234..def5678 100644 --- a/db/migrate/20180719122729_create_oauth_apps.rb +++ b/db/migrate/20180719122729_create_oauth_apps.rb @@ -13,7 +13,7 @@ # Oauth parameters String :client_id, unique: true, null: false String :client_secret, null: false - String :redirect_uri, null: false + String :redirect_url, null: false end end, Proc.new do
Support a single redirection uri
diff --git a/db/migrate/20140808035741_create_comments.rb b/db/migrate/20140808035741_create_comments.rb index abc1234..def5678 100644 --- a/db/migrate/20140808035741_create_comments.rb +++ b/db/migrate/20140808035741_create_comments.rb @@ -1,7 +1,7 @@ class CreateComments < ActiveRecord::Migration def change create_table :comments do |t| - t.text :comment + t.text :content t.integer :commentable_id t.string :commentable_type
Change migration field in comments migration from comment to content
diff --git a/roadie.gemspec b/roadie.gemspec index abc1234..def5678 100644 --- a/roadie.gemspec +++ b/roadie.gemspec @@ -13,6 +13,7 @@ s.homepage = 'http://github.com/Mange/roadie' s.summary = %q{Making HTML emails comfortable for the Ruby rockstars} s.description = %q{Roadie tries to make sending HTML emails a little less painful by inlining stylesheets and rewriting relative URLs for you.} + s.license = "MIT" s.required_ruby_version = ">= 1.9"
Add MIT license to gemspec
diff --git a/paperclip-optimizer.gemspec b/paperclip-optimizer.gemspec index abc1234..def5678 100644 --- a/paperclip-optimizer.gemspec +++ b/paperclip-optimizer.gemspec @@ -13,7 +13,7 @@ spec.homepage = "https://github.com/janfoeh/paperclip-optimizer" spec.license = "MIT" - spec.add_dependency "paperclip", ">= 3.4.1" + spec.add_dependency "paperclip", "~> 3.4" spec.add_dependency "image_optim", "~> 0.8" spec.add_development_dependency "bundler", "~> 1.3"
Allow all minor version upgrades of Paperclip 3.x
diff --git a/app/models/experience.rb b/app/models/experience.rb index abc1234..def5678 100644 --- a/app/models/experience.rb +++ b/app/models/experience.rb @@ -2,7 +2,7 @@ extend FriendlyId has_many :cocktails, dependent: :destroy - accepts_nested_attributes_for :cocktails, reject_if: lambda { |cocktail| cocktail[:substance].blank? && cocktail[:dosage].blank? } + accepts_nested_attributes_for :cocktails, reject_if: :cocktails_is_incomplete friendly_id :title, use: :slugged is_impressionable @@ -34,4 +34,8 @@ self.is_approved = true save end + + def cocktails_is_incomplete(cocktail) + cocktail[:substance].blank? && cocktail[:dosage].blank? + end end
Move condition to method for improved readability.
diff --git a/app/models/permission.rb b/app/models/permission.rb index abc1234..def5678 100644 --- a/app/models/permission.rb +++ b/app/models/permission.rb @@ -6,8 +6,5 @@ valhammer - # "word" in the url-safe base64 alphabet, or single '*' - SEGMENT = /([\w-]+|\*)/ - private_constant :SEGMENT - validates :value, format: /\A(#{SEGMENT}:)*#{SEGMENT}\z/ + validates :value, format: Accession::Permission.regexp end
Use Accession::Permission regexp for validation The code here predated what was available in accession
diff --git a/spec/features/creating_a_notebook_spec.rb b/spec/features/creating_a_notebook_spec.rb index abc1234..def5678 100644 --- a/spec/features/creating_a_notebook_spec.rb +++ b/spec/features/creating_a_notebook_spec.rb @@ -3,26 +3,42 @@ RSpec.describe "Creating a notebook" do let(:user) { create(:user) } - context "signing in" do + describe "displaying notebooks" do before do + @some_user = create(:user) + @not_your_notebook = create(:notebook, name: "Not your notebook", user: @some_user) + @your_notebook = create(:notebook, name: "Your notebook", user: user) + sign_in_as user end - describe "creating a notebook" do - before do - click_on "Create notebook" - - fill_in "Name", with: "Credit Card" - fill_in "Description", with: "credit card budget" - click_on "Save" - end - - it "shows it on the dashboard page" do - within("#notebooks") do - expect(page).to have_content "Credit Card" - expect(page).to have_content "credit card budget" - end + it "does not show notebooks you did not created" do + within("#notebooks") do + expect(page).to have_content "Your notebook" + expect(page).not_to have_content "Not your notebook" end end end + + describe "creating a notebook" do + before do + sign_in_as user + + click_on "Create notebook" + fill_in "Name", with: "Credit Card" + fill_in "Description", with: "credit card budget" + click_on "Save" + end + + it "shows it on the dashboard page" do + within("#notebooks") do + expect(page).to have_content "Credit Card" + expect(page).to have_content "credit card budget" + end + end + + it "shows a successful message" do + expect(page).to have_content "Notebook created" + end + end end
Add test scenarios for displaying notebooks per user
diff --git a/spec/integration/arel/many_to_one_spec.rb b/spec/integration/arel/many_to_one_spec.rb index abc1234..def5678 100644 --- a/spec/integration/arel/many_to_one_spec.rb +++ b/spec/integration/arel/many_to_one_spec.rb @@ -0,0 +1,27 @@+require 'spec_helper_integration' + +describe '[Arel] Many To One with generated mapper' do + include_context 'Models and Mappers' + + before(:all) do + setup_db + + insert_user 1, 'John', 18 + insert_user 2, 'Jane', 21 + + insert_address 1, 1, 'Street 1/2', 'Chicago', '12345' + insert_address 2, 2, 'Street 2/4', 'Boston', '67890' + + user_mapper + address_mapper.belongs_to :user, user_model + end + + it 'loads associated object' do + mapper = DM_ENV[address_model].include(:user) + address = mapper.first + user = DM_ENV[user_model].first + + address.user.should be_instance_of(user_model) + address.user.id.should eql(user.id) + end +end
Add explicit many_to_one integration spec for arel
diff --git a/etcenv.gemspec b/etcenv.gemspec index abc1234..def5678 100644 --- a/etcenv.gemspec +++ b/etcenv.gemspec @@ -19,10 +19,7 @@ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - if spec.respond_to?(:metadata) - spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com' to prevent pushes to rubygems.org, or delete to allow pushes to any server." - end - spec.add_development_dependency "bundler", "~> 1.9" spec.add_development_dependency "rake", "~> 10.0" + spec.add_development_dependency "rspec" end
Update gemspec: add rspec and allow push
diff --git a/schema.gemspec b/schema.gemspec index abc1234..def5678 100644 --- a/schema.gemspec +++ b/schema.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = 'evt-schema' s.summary = "Primitives for schema and data structure" - s.version = '1.2.2.0' + s.version = '2.2.2.0' s.description = ' ' s.authors = ['The Eventide Project']
Package version is increased from 1.2.2.0 to 2.2.2.0
diff --git a/test/gir_ffi/version_test.rb b/test/gir_ffi/version_test.rb index abc1234..def5678 100644 --- a/test/gir_ffi/version_test.rb +++ b/test/gir_ffi/version_test.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'gir_ffi_test_helper' -describe GirFFI::VERSION do +describe 'GirFFI::VERSION' do it 'is set to a valid version number' do GirFFI::VERSION.must_match(/\d+\.\d+\.\d+/) end
Fix description for GirFFI::VERSION test Unlike with classes, the bare constant does not result in the description being 'GirFFI::VERSION', but instead makes the description equal to the value of GirFFI::VERSION, which is not what we want.
diff --git a/lib/legal_markdown/legal_to_markdown/writer.rb b/lib/legal_markdown/legal_to_markdown/writer.rb index abc1234..def5678 100644 --- a/lib/legal_markdown/legal_to_markdown/writer.rb +++ b/lib/legal_markdown/legal_to_markdown/writer.rb @@ -6,7 +6,7 @@ require 'json' if writer == :jason if @output_file && @output_file != "-" File.open(@output_file, "w") {|f| f.write( final_content ); f.close } if writer == :markdown - File.open(@output_file, "w") { |f| JSON.dump(final_content, f); f.close } if writer == :jason + File.open(@output_file, "w") { |f| IO.write( f, JSON.pretty_generate( final_content ) ); f.close } if writer == :jason else STDOUT.write final_content end
Change JSON dump to JSON pretty_print
diff --git a/ext/extconf.rb b/ext/extconf.rb index abc1234..def5678 100644 --- a/ext/extconf.rb +++ b/ext/extconf.rb @@ -17,6 +17,8 @@ case CONFIG["arch"] when /mswin32|mingw|solaris/ $CFLAGS += " -march=native" +when 'i686-linux' + $CFLAGS += " -march-i686" end try_run(<<CODE,$CFLAGS) && ($defs << '-DHAVE_GCC_CAS')
Set march appropriately on RHEL5 32bit Fix for issue 24.
diff --git a/test/new/post_mortem_test.rb b/test/new/post_mortem_test.rb index abc1234..def5678 100644 --- a/test/new/post_mortem_test.rb +++ b/test/new/post_mortem_test.rb @@ -17,4 +17,9 @@ enter 'cont', 'break 12', 'cont' debug_file("post_mortem") { Debugger.post_mortem?.must_equal false } end + + it "must save the raised exception" do + enter 'cont' + debug_file("post_mortem") { Debugger.last_exception.must_be_kind_of RuntimeError } + end end
Add additional test example to post mortem tests
diff --git a/test/unit/finder_schema_validation_test.rb b/test/unit/finder_schema_validation_test.rb index abc1234..def5678 100644 --- a/test/unit/finder_schema_validation_test.rb +++ b/test/unit/finder_schema_validation_test.rb @@ -1,9 +1,15 @@ require 'test_helper' class FinderSchemaValidationTest < ActiveSupport::TestCase - test "the people finder is a valid finder" do - people_finder = JSON.parse(File.read("lib/finders/people.json")) + FINDER_FILES = Dir[Rails.root + "lib/finders/*.json"] - assert_valid_against_schema(people_finder, 'finder') + FINDER_FILES.each do |file_path| + name = File.basename(file_path, '.json') + + test "the #{name} finder is a valid finder" do + finder = JSON.parse(File.read(file_path)) + + assert_valid_against_schema(finder, 'finder') + end end end
Test all the existing finders The Finding Things Team is working towards moving some of the index pages to finders. This commit will make it easier to continue adding new finders and be sure they are tested and valid.
diff --git a/lib/capybara/bootstrap/alert.rb b/lib/capybara/bootstrap/alert.rb index abc1234..def5678 100644 --- a/lib/capybara/bootstrap/alert.rb +++ b/lib/capybara/bootstrap/alert.rb @@ -31,7 +31,7 @@ def css_for_type(type) case type when :success, :info, :warning, :danger - ".alert .alert-#{type}" + ".alert.alert-#{type}" else fail( ArgumentError,
Drop white space in CSS class name for Alert
diff --git a/lib/rrj/models/active_record.rb b/lib/rrj/models/active_record.rb index abc1234..def5678 100644 --- a/lib/rrj/models/active_record.rb +++ b/lib/rrj/models/active_record.rb @@ -13,6 +13,15 @@ after_create { callback_create_after } after_update { callback_update_after } after_destroy { callback_destroy_after } + + private + + # Update attributes to document + # + # @param [Hash] List of attribute to update with this value + def set(attributes) + update_attributes!(attributes) + end end end end
Create method set for saving attributes in model
diff --git a/week-4/shortest-string/my_solution.rb b/week-4/shortest-string/my_solution.rb index abc1234..def5678 100644 --- a/week-4/shortest-string/my_solution.rb +++ b/week-4/shortest-string/my_solution.rb @@ -17,4 +17,3 @@ list_of_words.min { |x,y| x.length <=> y.length } end shortest_string(["1","3","10","25"]) -
Include method for shortest string
diff --git a/lib/montage.rb b/lib/montage.rb index abc1234..def5678 100644 --- a/lib/montage.rb +++ b/lib/montage.rb @@ -1,7 +1,6 @@ require 'yaml' require 'pathname' -require 'fileutils' -require 'digest' +require 'digest/sha2' # Gems. require 'active_support/ordered_hash'
Remove fileutils (since isn't used explicitly).
diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb index abc1234..def5678 100644 --- a/config/deploy/staging.rb +++ b/config/deploy/staging.rb @@ -1,4 +1,4 @@-raise "No staging server setup yet!" +warn "No staging server setup yet!" # server ".us-west-2.compute.amazonaws.com", :app, :db, :primary => true # set :branch, "staging"
Switch to warn so cap -T works
diff --git a/app/models/dojo.rb b/app/models/dojo.rb index abc1234..def5678 100644 --- a/app/models/dojo.rb +++ b/app/models/dojo.rb @@ -14,6 +14,15 @@ validates :description, presence: true, length: { maximum: 50 } validates :logo, presence: false validates :tags, presence: true + validate :number_of_tags validates :url, presence: true + private + + def number_of_tags + num_of_tags = self.tags.length + if num_of_tags > 5 + errors.add(:number_of_tags, 'should be 1 to 5') + end + end end
Add custom validation to check number of tags
diff --git a/virtus-representable.gemspec b/virtus-representable.gemspec index abc1234..def5678 100644 --- a/virtus-representable.gemspec +++ b/virtus-representable.gemspec @@ -22,5 +22,5 @@ spec.add_development_dependency "rake" spec.add_dependency "virtus" spec.add_dependency "representable" - spec.add_dependency "active_support" + spec.add_dependency "activesupport" end
Use activesupport gem, not active_support
diff --git a/ariadne_js_rails.gemspec b/ariadne_js_rails.gemspec index abc1234..def5678 100644 --- a/ariadne_js_rails.gemspec +++ b/ariadne_js_rails.gemspec @@ -17,7 +17,7 @@ s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"] s.test_files = Dir["test/**/*"] - s.add_dependency "rails", "~> 4.2.3" + s.add_dependency "rails", ">= 4.1.9" # s.add_development_dependency "sqlite3" end
Update dependency for rails version.
diff --git a/lib/ie/compat.rb b/lib/ie/compat.rb index abc1234..def5678 100644 --- a/lib/ie/compat.rb +++ b/lib/ie/compat.rb @@ -17,5 +17,9 @@ case when defined? Rails require 'ie/compat/railtie' +when defined? Opal + Opal.append_path IE::Compat.assets_path +when defined? Sprockets + Sprockets.append_path IE::Compat.assets_path end
Add alternative support for Sprockets and Opal
diff --git a/config/rackup.ru b/config/rackup.ru index abc1234..def5678 100644 --- a/config/rackup.ru +++ b/config/rackup.ru @@ -9,6 +9,7 @@ set :environment, :production set :public, app_root + '/public' +set :views, app_root + '/views' disable :run, :reload
Set the views directory explicitly.
diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -1,7 +1,5 @@ class APIController < ActionController::API include Operations::Performable - - respond_to :json rescue_from StandardError do |ex| handle_error(ex, :internal_server_error, error: 'Internal server error')
Remove respond_to instruction causing an error
diff --git a/mailman_app.rb b/mailman_app.rb index abc1234..def5678 100644 --- a/mailman_app.rb +++ b/mailman_app.rb @@ -25,5 +25,4 @@ user.responses.create(content: message) end end - end
Remove newline (demo for Moazzam)
diff --git a/db/migrate/20090924204451_add_processing_to_issues.rb b/db/migrate/20090924204451_add_processing_to_issues.rb index abc1234..def5678 100644 --- a/db/migrate/20090924204451_add_processing_to_issues.rb +++ b/db/migrate/20090924204451_add_processing_to_issues.rb @@ -0,0 +1,9 @@+class AddProcessingToIssues < ActiveRecord::Migration + def self.up + add_column :issues, :processing, :boolean, :default => true + end + + def self.down + remove_column :issues, :processing + end +end
Add processing attribute to issues.
diff --git a/app/models/spree/order_version.rb b/app/models/spree/order_version.rb index abc1234..def5678 100644 --- a/app/models/spree/order_version.rb +++ b/app/models/spree/order_version.rb @@ -10,7 +10,7 @@ products: order.products.map{|product| product.current_version.id}, taxons: order.products.map{|product| {product.id => product.taxons.map{|taxon| taxon.current_version.id}}}, variants: order.variants.map{|variant| {variant.product_id => variant.current_version.id}}, - option_types: [] + option_types: order.products.map{|product| {product.id => product.option_types.map{|option_type| option_type.current_version.id}}} } create status: status, order: order @@ -22,7 +22,7 @@ end def taxons(product_id:) - taxons = [] + taxon_ids = [] status[:taxons].each do |taxon| if taxon_ids = taxon[product_id] @@ -46,4 +46,17 @@ variants end + + def option_types(product_id:) + option_types = [] + + status[:option_types].each do |option_type| + if option_type_ids = option_type[product_id] + versions = PaperTrail::Version.where(id: option_type_ids) + option_types += versions.map &:reify + end + end + + option_types + end end
Add versioning logic to orders+option_types
diff --git a/lib/loudmouth.rb b/lib/loudmouth.rb index abc1234..def5678 100644 --- a/lib/loudmouth.rb +++ b/lib/loudmouth.rb @@ -1,6 +1,7 @@ require "loudmouth" require "rails/routes" require "extensions/helper" +require "extensions/active_record" module Loudmouth class Engine < Rails::Engine @@ -25,12 +26,12 @@ end def self.include_helpers - ActiveSupport.on_load(:action_controller) do + # ActiveSupport.on_load(:action_controller) do + # include Loudmouth::Controllers::Helpers + # end + + ActiveSupport.on_load(:action_view) do include Loudmouth::Controllers::Helpers end - - # ActiveSupport.on_load(:action_view) do - # include Loudmouth::Controllers::Helpers - # end end end
Include helpers under :action_view Load ActiveRecord extensions.
diff --git a/app/services/dashboard_runlist.rb b/app/services/dashboard_runlist.rb index abc1234..def5678 100644 --- a/app/services/dashboard_runlist.rb +++ b/app/services/dashboard_runlist.rb @@ -25,6 +25,8 @@ { id: submission.id, group_id: submission.collaboration_run_id, + # Return time in milliseconds, so it's JS-friendly. + created_at: submission.created_at.to_i * 1000, answers: answers(submission) } end
Add date to LARA arg-block dashboard API [#112541903]
diff --git a/lib/harbor/core.rb b/lib/harbor/core.rb index abc1234..def5678 100644 --- a/lib/harbor/core.rb +++ b/lib/harbor/core.rb @@ -30,7 +30,7 @@ class Harbor def initialize - self.class::applications.each do |application| + self.class::registered_applications.each do |application| applications << application.new end @@ -55,11 +55,12 @@ end def self.register_application(application) - applications << application unless applications.include? application + unless registered_applications.include? application + registered_applications << application + end end - private - def self.applications + def self.registered_applications @applications ||= [] end end
Allow public access to registered applications
diff --git a/web.rb b/web.rb index abc1234..def5678 100644 --- a/web.rb +++ b/web.rb @@ -2,7 +2,7 @@ # External libs require 'sinatra' # Internal modules -require 'tradera.rb' +require './tradera.rb' get '/' do redirect '/index.html'
Use absolute path in include
diff --git a/minimal-mistakes-jekyll.gemspec b/minimal-mistakes-jekyll.gemspec index abc1234..def5678 100644 --- a/minimal-mistakes-jekyll.gemspec +++ b/minimal-mistakes-jekyll.gemspec @@ -22,6 +22,6 @@ spec.add_runtime_dependency "jekyll-feed", "~> 0.9.1" spec.add_runtime_dependency "jemoji", "~> 0.8" - spec.add_development_dependency "bundler", "~> 1.12" + spec.add_development_dependency "bundler", ">= 2.2.10" spec.add_development_dependency "rake", "~> 12.3.3" end
Update min bundler specs for security
diff --git a/lib/lazy_object.rb b/lib/lazy_object.rb index abc1234..def5678 100644 --- a/lib/lazy_object.rb +++ b/lib/lazy_object.rb @@ -9,6 +9,7 @@ # lazy = LazyObject.new { VeryExpensiveObject.new } # At this point the VeryExpensiveObject hasn't been initialized yet. # lazy.get_expensive_results(foo, bar) # Initializes VeryExpensiveObject and calls 'get_expensive_results' on it, passing in foo and bar class LazyObject < BasicObject + include ::Comparable def self.version '0.0.2' @@ -16,6 +17,10 @@ def initialize(&callable) @__callable__ = callable + end + + def <=>(item) + __target_object__ <=> item end # Cached target object.
Include Comparable module and delegate it to the target object
diff --git a/lib/watirspec.rb b/lib/watirspec.rb index abc1234..def5678 100644 --- a/lib/watirspec.rb +++ b/lib/watirspec.rb @@ -1,6 +1,6 @@ module WatirSpec class << self - attr_accessor :browser_args, :persistent_browser, :unguarded + attr_accessor :browser_args, :persistent_browser, :unguarded, :implementation def html File.expand_path("#{File.dirname(__FILE__)}/../html")
Add ability to set impl name manually using WatirSpec.implementation=
diff --git a/lib/octopi/blob.rb b/lib/octopi/blob.rb index abc1234..def5678 100644 --- a/lib/octopi/blob.rb +++ b/lib/octopi/blob.rb @@ -1,7 +1,7 @@ require File.join(File.dirname(__FILE__), "resource") module Octopi class Blob < Base - attr_accessor :text + attr_accessor :text, :data, :name, :sha, :size, :mode, :mime_type include Resource set_resource_name "blob"
Add more attr_accessors to Blob - Closes GH-33
diff --git a/liquid-c.gemspec b/liquid-c.gemspec index abc1234..def5678 100644 --- a/liquid-c.gemspec +++ b/liquid-c.gemspec @@ -7,7 +7,7 @@ spec.name = "liquid-c" spec.version = Liquid::C::VERSION spec.authors = ["Justin Li", "Dylan Thacker-Smith"] - spec.email = ["jli@shopify.com", "Dylan.Smith@shopify.com"] + spec.email = ["gems@shopify.com"] spec.summary = "Liquid performance extension in C" spec.homepage = "" spec.license = "MIT"
Use gems@shopify.com email address in gemspec
diff --git a/lib/poms/errors.rb b/lib/poms/errors.rb index abc1234..def5678 100644 --- a/lib/poms/errors.rb +++ b/lib/poms/errors.rb @@ -4,24 +4,19 @@ AuthenticationError = Class.new(StandardError) # Base exception for all Poms-specific HTTP errors. - class HttpError < StandardError - end + HttpError = Class.new(StandardError) # Wrapper exception for dealing with driver-agnostic 404 responses. - class HttpMissingError < HttpError - end + HttpMissingError = Class.new(HttpError) # Wrapper exception for dealing with driver-agnostic 500 responses. - class HttpServerError < HttpError - end + HttpServerError = Class.new(HttpError) # Custom error than can be used to indicate a required configuration value # is missing. - class MissingConfigurationError < StandardError - end + MissingConfigurationError = Class.new(StandardError) # Custom error to indicate that the gem has not been configured at all. - class NotConfigured < StandardError - end + NotConfigured = Class.new(StandardError) end end
Use shorthand syntax to define custom exceptions
diff --git a/spec/services/search_orders_spec.rb b/spec/services/search_orders_spec.rb index abc1234..def5678 100644 --- a/spec/services/search_orders_spec.rb +++ b/spec/services/search_orders_spec.rb @@ -8,6 +8,8 @@ let!(:order2) { create(:order_with_line_items, distributor: distributor, line_items_count: 2) } let!(:order3) { create(:order_with_line_items, distributor: distributor, line_items_count: 1) } let!(:order_empty) { create(:order, distributor: distributor) } + let!(:order_empty_but_complete) { create(:order, distributor: distributor, state: :complete) } + let!(:order_empty_but_canceled) { create(:order, distributor: distributor, state: :canceled) } let(:enterprise_user) { distributor.owner } @@ -16,7 +18,10 @@ let(:service) { SearchOrders.new(params, enterprise_user) } it 'returns orders' do - expect(service.orders.count).to eq 3 + expect(service.orders.count).to eq 5 + service.orders.each do |order| + expect(order.id).not_to eq(order_empty.id) + end end end end
Update test to add more case with finalized order with no line items Those empty order but finalized must be returned by the API
diff --git a/spec/tasks/negative_balance_spec.rb b/spec/tasks/negative_balance_spec.rb index abc1234..def5678 100644 --- a/spec/tasks/negative_balance_spec.rb +++ b/spec/tasks/negative_balance_spec.rb @@ -17,7 +17,7 @@ warning_emails = deliveries.select { |m| m.subject[/negative balance warning/] } expect(warning_emails.length).to eq 1 email = warning_emails.first - expect(email.bcc).to eq ENV['MAILER_FINANCE_RECIPIENTS'].split(', ') + expect(email.bcc).to eq ENV['MAILER_ENQUIRY_RECIPIENTS'].split(', ') negative_balance = Regexp.escape Invoice.pretty_total user.account.remaining_balance expect(email.body.to_s).to match(/account balance is currently negative by #{negative_balance}/) end
FIx for negative balance mailer spec
diff --git a/lib/synx/tabber.rb b/lib/synx/tabber.rb index abc1234..def5678 100644 --- a/lib/synx/tabber.rb +++ b/lib/synx/tabber.rb @@ -1,39 +1,39 @@ module Synx class Tabber - @@options = {} - @@tabbing = 0 + @options = {} + @tabbing = 0 class << self def increase(n=1) - @@tabbing += n + @tabbing += n end def decrease(n=1) - @@tabbing -= n - @@tabbing = 0 if @@tabbing < 0 + @tabbing -= n + @tabbing = 0 if @tabbing < 0 end def current - @@tabbing + @tabbing end def reset - @@tabbing = 0 + @tabbing = 0 self.options = {} end def options=(options = {}) - @@options = options + @options = options end def options - @@options + @options end def puts(str="") str = str.uncolorize if options[:no_color] - Kernel.puts (a_single_tab * @@tabbing) + str.to_s unless options[:quiet] + Kernel.puts (a_single_tab * @tabbing) + str.to_s unless options[:quiet] end def a_single_tab
Remove class variables from Tabber @@vars are generally considered a Bad Thing in Ruby. See http://bit.ly/1kcit9V for a quick rationale.
diff --git a/keno.gemspec b/keno.gemspec index abc1234..def5678 100644 --- a/keno.gemspec +++ b/keno.gemspec @@ -8,9 +8,9 @@ spec.version = Keno::VERSION spec.authors = ["Dave Powers"] spec.email = ["djpowers89@gmail.com"] - spec.summary = %q{TODO: Write a short summary. Required.} - spec.description = %q{TODO: Write a longer description. Optional.} - spec.homepage = "" + spec.summary = %q{A Ruby gem to generate Keno winning numbers.} + spec.description = %q{A Ruby gem to generate Keno winning numbers.} + spec.homepage = "https://github.com/djpowers/keno" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0")
Update gemspec file with summary, description, and homepage
diff --git a/features/support/env.rb b/features/support/env.rb index abc1234..def5678 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -10,8 +10,19 @@ "fixtures")) Before do + $git_fixture_dir_exists ||= false @dirs = [FIXTURES_PATH] + ["no_git", "with_git"].each do |dir| + git_path = File.join(FIXTURES_PATH, dir) + FileUtils.mkdir_p(git_path) + if dir.eql?("with_git") + Dir.chdir(git_path) + `git init .` + end + end + $git_fixture_dir_exists = true end + After do %w{ pre-commit
[Cucumber] Add creating of fixtures before scenarios Signed-off-by: Daniel Schmidt <95584f82d85fd95b525d0d56fac4758a79f7199d@adytonsystems.com>
diff --git a/features/support/env.rb b/features/support/env.rb index abc1234..def5678 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -5,7 +5,7 @@ ENV['RUBYLIB'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../lib')}#{File::PATH_SEPARATOR}#{ENV['RUBYLIB']}" Before do - @aruba_timeout_seconds = 120 + @aruba_timeout_seconds = 80 end class CalatravaWorld
Revert "Longer timeout for travis to finish `rake bootstrap`" This reverts commit 846d47359e970bce0e898d82569687b7d601b6a0.
diff --git a/features/support/env.rb b/features/support/env.rb index abc1234..def5678 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -5,10 +5,11 @@ class ReekWorld def run(cmd) - out, err, status = Open3.capture3(cmd) - @last_stdout = out - @last_stderr = err - @last_exit_status = status.exitstatus + stderr_file = Tempfile.new('reek-world') + stderr_file.close + @last_stdout = `#{cmd} 2> #{stderr_file.path}` + @last_exit_status = $?.exitstatus + @last_stderr = IO.read(stderr_file.path) end def reek(args)
Work around broken Open3 on JRuby 1.7.16
diff --git a/spec/delegate_all_for/delegate_all_for_spec.rb b/spec/delegate_all_for/delegate_all_for_spec.rb index abc1234..def5678 100644 --- a/spec/delegate_all_for/delegate_all_for_spec.rb +++ b/spec/delegate_all_for/delegate_all_for_spec.rb @@ -1,20 +1,21 @@ require File.expand_path('../../spec_helper', __FILE__) +require File.expand_path('../../support/active_record', __FILE__) + +class Child < ActiveRecord::Base + belongs_to :parent + #def self.column_names; %w(two three four) end + def two; 'child' end + def extra; true end +end class Parent < ActiveRecord::Base - def self.column_names; %w(one two) end + #def self.column_names; %w(one two) end has_one :child delegate_all_for :child, except: [:three], also_include: [:extra] def initialize; end def two; 'parent' end -end - -class Child < ActiveRecord::Base - belongs_to :parent - def self.column_names; %w(two three four) end - def two; 'child' end - def extra; true end end describe DelegateAllFor do
Rearrange Child and Parent definitions so Child is in scope when we delegate to it from Parent
diff --git a/lib/usi/session.rb b/lib/usi/session.rb index abc1234..def5678 100644 --- a/lib/usi/session.rb +++ b/lib/usi/session.rb @@ -1,9 +1,12 @@+require "open3" + module USI class Session - attr_reader :engine + attr_reader :engine, :stdin, :stdout, :stderr, :wait_thr def initialize(engine) @engine = engine + @stdin, @stdout, @stderr, @wait_thr = *Open3.popen3(@engine.engine_path.to_s, chdir: @engine.engine_path.dirname) end end end
Use Open3.popen3 in execution of engine.
diff --git a/spec/govuk_seed_crawler/topic_exchange_spec.rb b/spec/govuk_seed_crawler/topic_exchange_spec.rb index abc1234..def5678 100644 --- a/spec/govuk_seed_crawler/topic_exchange_spec.rb +++ b/spec/govuk_seed_crawler/topic_exchange_spec.rb @@ -0,0 +1,32 @@+require 'spec_helper' + +describe GovukSeedCrawler::TopicExchange do + subject { GovukSeedCrawler::TopicExchange.new(options) } + + let(:options) { {} } + + let(:mock_bunny) { + double(:mock_bunny, :start => true, :create_channel => mock_channel) + } + + let(:mock_channel) { + double(:mock_bunny_channel, :topic => true) + } + + context "under normal usage" do + it "responds to #exchange" do + allow(Bunny).to receive(:new).with(options).and_return(mock_bunny) + expect(subject).to respond_to(:exchange) + end + + it "responds to #close" do + allow(Bunny).to receive(:new).with(options).and_return(mock_bunny) + expect(subject).to respond_to(:close) + end + + it "creates an AMQP connection" do + expect(Bunny).to receive(:new).with(options).and_return(mock_bunny) + subject + end + end +end
Add unit tests for TopicExchange class
diff --git a/spec/models/utils/util_user_db_manager_spec.rb b/spec/models/utils/util_user_db_manager_spec.rb index abc1234..def5678 100644 --- a/spec/models/utils/util_user_db_manager_spec.rb +++ b/spec/models/utils/util_user_db_manager_spec.rb @@ -13,7 +13,7 @@ # make sure user account doesn't already exist subject.remove_user(user) expect(subject.user_account_exists?(user)).to be(false) - user.create_unconfirmed + Util::UserDbManager.new.create_user_account(user) expect(user.unencrypted_password).to eq(original_password) expect(described_class.new.user_account_exists?(user)).to be(true)
Make the UserDbManager responsible for creating user accounts
diff --git a/spec/requests/api/v1/playlists_request_spec.rb b/spec/requests/api/v1/playlists_request_spec.rb index abc1234..def5678 100644 --- a/spec/requests/api/v1/playlists_request_spec.rb +++ b/spec/requests/api/v1/playlists_request_spec.rb @@ -0,0 +1,39 @@+require 'rails_helper' + +RSpec.describe "Api::V1::Playlists", type: :request do + + + before(:each) do + @user = User.create( + username: "NewUser", + password: "password" + ) + @token = Auth.create_token(@user.id) + @token_headers = { + 'Accept': 'application/json', + 'Content-Type': 'application/json', + 'Authorization': "Bearer: #{@token}" + } + @tokenless_headers = { + 'Content-Type': 'application/json' + } + end + + it "requires all routes to have a token" do + responses = [] + response_bodies = [] + + post '/api/v1/playlists', params: { playlist_id: 1 }.to_json, headers: @tokenless_headers + responses << response + response_bodies << JSON.parse(response.body) + + get '/api/v1/playlists', headers: @tokenless_headers + responses << response + response_bodies << JSON.parse(response.body) + + responses.each { |r| expect(r).have_http_status(403) } + response_bodies.each { |body| expect(body["errors"]).to eq([{ "message" => "Token is invalid!"}]) } + + end + +end
Add test for /api/v1/playlists route
diff --git a/lib/brick_ftp/http_client.rb b/lib/brick_ftp/http_client.rb index abc1234..def5678 100644 --- a/lib/brick_ftp/http_client.rb +++ b/lib/brick_ftp/http_client.rb @@ -40,6 +40,7 @@ def request(method, path, params: {}, headers: {}) req = Net::HTTP.const_get(method.to_s.capitalize).new(path, headers) req['Content-Type'] = 'application/json' + req['Cookie'] = BrickFTP::Authentication.cookie(BrickFTP.config.session).to_s if BrickFTP.config.session req.body = params.to_json unless params.empty? @conn.request(req)
Set session cookie if logged in.
diff --git a/lib/generators/doorkeeper/views_generator.rb b/lib/generators/doorkeeper/views_generator.rb index abc1234..def5678 100644 --- a/lib/generators/doorkeeper/views_generator.rb +++ b/lib/generators/doorkeeper/views_generator.rb @@ -2,6 +2,8 @@ module Generators class ViewsGenerator < Rails::Generators::Base source_root File.expand_path('../../../../app/views/doorkeeper', __FILE__) + + desc "Copies default Doorkeeper views to your application." def manifest directory 'applications', 'app/views/doorkeeper/applications'
Add description to views generator
diff --git a/lib/genomer-plugin-view/gff_record_helper.rb b/lib/genomer-plugin-view/gff_record_helper.rb index abc1234..def5678 100644 --- a/lib/genomer-plugin-view/gff_record_helper.rb +++ b/lib/genomer-plugin-view/gff_record_helper.rb @@ -28,23 +28,6 @@ end end - def to_genbank_feature_row - out = [coordinates] - attributes.each do |atr| - out << process(atr) - end - out - end - - def process(attr) - key, value = attr - case key - when 'ID' then ['locus_tag', value] - when 'Name' then ['gene', value] - else return attr - end - end - def to_genbank_table_entry delimiter = "\t" indent = delimiter * 2
Remove unused gff3 helper methods
diff --git a/lib/knapsack_pro/config/ci/github_actions.rb b/lib/knapsack_pro/config/ci/github_actions.rb index abc1234..def5678 100644 --- a/lib/knapsack_pro/config/ci/github_actions.rb +++ b/lib/knapsack_pro/config/ci/github_actions.rb @@ -1,4 +1,4 @@-# https://help.github.com/en/articles/virtual-environments-for-github-actions#environment-variables +# https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables module KnapsackPro module Config module CI
Update link to list of Github Actions envs
diff --git a/lib/spontaneous/data_mapper/content_table.rb b/lib/spontaneous/data_mapper/content_table.rb index abc1234..def5678 100644 --- a/lib/spontaneous/data_mapper/content_table.rb +++ b/lib/spontaneous/data_mapper/content_table.rb @@ -1,6 +1,8 @@ module Spontaneous module DataMapper class ContentTable + REVISION_PADDING = 5 + attr_reader :name, :database def initialize(name, database) @@ -23,9 +25,7 @@ @database.logger = logger end - def db - @database - end + alias_method :db, :database def qualify(revision, col) Sequel::SQL::QualifiedIdentifier.new(revision_table(revision), col) @@ -41,11 +41,11 @@ end def revision_table?(table_name) - /^__r\d{5}_content$/ === table_name.to_s + /\A__r\d{#{REVISION_PADDING}}_#{@name}\z/ === table_name.to_s end def pad_revision_number(revision_number) - revision_number.to_s.rjust(5, "0") + revision_number.to_s.rjust(REVISION_PADDING, "0") end end end
Replace revision padding magic number with a constant Also remove hard-coded table name from #revision_table? test
diff --git a/lib/asciidoctor-diagram/util/cli.rb b/lib/asciidoctor-diagram/util/cli.rb index abc1234..def5678 100644 --- a/lib/asciidoctor-diagram/util/cli.rb +++ b/lib/asciidoctor-diagram/util/cli.rb @@ -8,7 +8,7 @@ def self.run(*args) stdout, stderr, status = Open3.capture3(*args) - if status != 0 + if status.exitstatus != 0 raise "#{File.basename(args[0])} failed: #{stdout.empty? ? stderr : stdout}" end
Correct process exit code check
diff --git a/markdown-test.rb b/markdown-test.rb index abc1234..def5678 100644 --- a/markdown-test.rb +++ b/markdown-test.rb @@ -2,6 +2,9 @@ puts "Maruku:" puts `bin/maruku -o - --html-frag #{ARGV[0]}` + +puts "Old Maruku:" +puts `maruku -o - --html-frag #{ARGV[0]}` puts "\n\nRedcarpet:" puts `redcarpet #{ARGV[0]}`
Include old maruku in comparison script
diff --git a/lib/filter_factory/filter.rb b/lib/filter_factory/filter.rb index abc1234..def5678 100644 --- a/lib/filter_factory/filter.rb +++ b/lib/filter_factory/filter.rb @@ -47,7 +47,7 @@ class << self def create(&block) - new.tap { |filter| filter.instance_eval &block } + new.tap { |filter| filter.instance_eval(&block) } end end
Add brackets around block in Filter::create.
diff --git a/lib/fassets_presentations/engine.rb b/lib/fassets_presentations/engine.rb index abc1234..def5678 100644 --- a/lib/fassets_presentations/engine.rb +++ b/lib/fassets_presentations/engine.rb @@ -2,7 +2,7 @@ class Engine < Rails::Engine isolate_namespace FassetsPresentations initializer :assets do |config| - Rails.application.config.assets.precompile += %w(fassets_presentations/pres_edit_box.js fassets_presentations/pres_edit_box.css fassets_presentations/presentations.js fassets_presentations/mercury.js fassets_presentations/mercury_overrides.css fassets_presentations/frames_wysiwyg.js fassets_presentations/frames.js fassets_presentations/templates/default/styles.css fassets_presentations/templates/default/editor.css fassets_presentations/templates/default/script.js fassets_presentations/templates/xmendel/styles.css fassets_presentations/templates/xmendel/editor.css fassets_presentations/templates/xmendel/script.js fassets_presentations/templates/uzl_corporate/styles.css fassets_presentations/templates/uzl_corporate/editor.css fassets_presentations/templates/uzl_corporate/script.js) + Rails.application.config.assets.precompile += %w(fassets_presentations/pres_edit_box.js fassets_presentations/pres_edit_box.css fassets_presentations/presentations.js fassets_presentations/mercury.js fassets_presentations/mercury_overrides.css fassets_presentations/frames_wysiwyg.js fassets_presentations/frames.js fassets_presentations/templates/default/styles.css fassets_presentations/templates/default/editor.css fassets_presentations/templates/default/script.js fassets_presentations/templates/xmendel/styles.css fassets_presentations/templates/xmendel/editor.css fassets_presentations/templates/xmendel/script.js fassets_presentations/templates/uzl_corporate/styles.css fassets_presentations/templates/uzl_corporate/editor.css fassets_presentations/templates/uzl_corporate/script.js fancybox.css) Rails.application.config.autoload_paths += %W(#{config.root}/lib) Rails.application.config.autoload_paths += Dir["#{config.root}/lib/**/"] end
Add fancybox.css to precompile list
diff --git a/lib/mobylette/mobile_user_agents.rb b/lib/mobylette/mobile_user_agents.rb index abc1234..def5678 100644 --- a/lib/mobylette/mobile_user_agents.rb +++ b/lib/mobylette/mobile_user_agents.rb @@ -6,5 +6,5 @@ 'x320|x240|j2me|sgh|portable|sprint|docomo|kddi|softbank|android|mmp|' + 'pdxgw|netfront|xiino|vodafone|portalmmm|sagem|mot-|sie-|ipod|up\\.b|' + 'webos|amoi|novarra|cdm|alcatel|pocket|ipad|iphone|mobileexplorer|' + - 'mobile|maemo|fennec' + 'mobile|maemo|fennec|silk' end
Add Silk (Kindle) to the user agent list
diff --git a/lib/xcode/builder/scheme_builder.rb b/lib/xcode/builder/scheme_builder.rb index abc1234..def5678 100644 --- a/lib/xcode/builder/scheme_builder.rb +++ b/lib/xcode/builder/scheme_builder.rb @@ -36,11 +36,11 @@ # cmd # end - def test + def test options = {:sdk => @sdk, :show_output => false} unless @scheme.testable? print_task :builder, "Nothing to test", :warning else - super + super options end end
Allow overriding test options for schemes
diff --git a/lib/organisation_registry.rb b/lib/organisation_registry.rb index abc1234..def5678 100644 --- a/lib/organisation_registry.rb +++ b/lib/organisation_registry.rb @@ -1,7 +1,7 @@ require "time" class OrganisationRegistry - CACHE_LIFETIME = 12 * 3600 + CACHE_LIFETIME = 12 * 3600 # 12 hours def initialize(index, clock = DateTime) @index = index
Add a comment to be explicit about the cache time.
diff --git a/shared/complex/hash.rb b/shared/complex/hash.rb index abc1234..def5678 100644 --- a/shared/complex/hash.rb +++ b/shared/complex/hash.rb @@ -8,9 +8,9 @@ end it "is different for different instances" do - Complex(1, 2).hash.should_not == Complex(1, 1).hash + Complex(1, 2).hash.should_not == Complex(1, 1).hash Complex(2, 1).hash.should_not == Complex(1, 1).hash - Complex(1, 2).hash.should_not == Complex(2, 1).hash + Complex(1, 2).hash.should_not == Complex(2, 1).hash end end
Remove unintended tabs in spec.
diff --git a/lib/appsignal/integrations/sequel.rb b/lib/appsignal/integrations/sequel.rb index abc1234..def5678 100644 --- a/lib/appsignal/integrations/sequel.rb +++ b/lib/appsignal/integrations/sequel.rb @@ -7,7 +7,7 @@ # Add query instrumentation def log_yield(sql, args = nil) name = 'sql.sequel' - payload = {sql: sql, args: args} + payload = {:sql => sql, :args => args} ActiveSupport::Notifications.instrument(name, payload) { yield } end
Use the old hash syntax to support older Rubies.
diff --git a/lib/cargo.rb b/lib/cargo.rb index abc1234..def5678 100644 --- a/lib/cargo.rb +++ b/lib/cargo.rb @@ -18,4 +18,4 @@ end end -include Cargo +extend Cargo
Use extend instead of include.
diff --git a/lib/http_streaming_client/version.rb b/lib/http_streaming_client/version.rb index abc1234..def5678 100644 --- a/lib/http_streaming_client/version.rb +++ b/lib/http_streaming_client/version.rb @@ -28,5 +28,5 @@ ########################################################################### module HttpStreamingClient - VERSION = "0.8.6" + VERSION = "0.8.7" end
Fix for EOFError NoMethodError issue
diff --git a/lib/mountable_image_server/server.rb b/lib/mountable_image_server/server.rb index abc1234..def5678 100644 --- a/lib/mountable_image_server/server.rb +++ b/lib/mountable_image_server/server.rb @@ -11,6 +11,7 @@ image_processor = ImageProcessor.new(path, params) image_processor.run do |processed_image_path| + cache_control :public, max_age: 500000 content_type(Rack::Mime::MIME_TYPES.fetch(processed_image_path.extname.downcase)) body(processed_image_path.read) end
Add Cache-Control headers to response
diff --git a/lib/rspec/core/mocking/with_rspec.rb b/lib/rspec/core/mocking/with_rspec.rb index abc1234..def5678 100644 --- a/lib/rspec/core/mocking/with_rspec.rb +++ b/lib/rspec/core/mocking/with_rspec.rb @@ -4,10 +4,8 @@ module Core module MockFrameworkAdapter - include RSpec::Mocks::ExampleMethods - def _setup_mocks - RSpec::Mocks::setup + RSpec::Mocks::setup(self) end def _verify_mocks
Update rspec mock framework adapter to new API for RSpec::Mocks
diff --git a/lib/ubuntu_unused_kernels.rb b/lib/ubuntu_unused_kernels.rb index abc1234..def5678 100644 --- a/lib/ubuntu_unused_kernels.rb +++ b/lib/ubuntu_unused_kernels.rb @@ -8,17 +8,17 @@ class << self def to_remove - current, suffix = get_current - packages = get_installed(suffix) + current = get_current + packages = get_installed - PACKAGE_PREFIXES.each do |prefix| - latest = packages.sort.select { |package| - package =~ /^#{prefix}-#{VERSION_REGEX}-#{suffix}$/ - }.last + latest = packages.map { |package| + package.match(VERSION_REGEX)[0] + }.sort.last - packages.delete(latest) - packages.delete("#{prefix}-#{current}-#{suffix}") - end + packages.reject! { |package| + package =~ /\b#{Regexp.escape(current)}\b/ || + package =~ /\b#{Regexp.escape(latest)}\b/ + } return packages end
Fix post-suffix tests for to_remove Now that we're ignoring suffixes.
diff --git a/lib/vidibus/oauth2_server.rb b/lib/vidibus/oauth2_server.rb index abc1234..def5678 100644 --- a/lib/vidibus/oauth2_server.rb +++ b/lib/vidibus/oauth2_server.rb @@ -20,6 +20,6 @@ class InvalidTokenError < Oauth2ServerError; end class ExpiredTokenError < Oauth2ServerError; end - FLOWS = %w[web_server] + FLOWS = %w[web_server code authorization_code] end end
Allow several values as flow
diff --git a/lib/cool.io.rb b/lib/cool.io.rb index abc1234..def5678 100644 --- a/lib/cool.io.rb +++ b/lib/cool.io.rb @@ -19,7 +19,6 @@ require "cool.io/dns_resolver" require "cool.io/socket" require "cool.io/server" -require "cool.io/dsl" module Coolio def self.inspect
Remove dsl.rb from default required modules
diff --git a/lib/vagrant-ca-certificates/config/ca_certificates.rb b/lib/vagrant-ca-certificates/config/ca_certificates.rb index abc1234..def5678 100644 --- a/lib/vagrant-ca-certificates/config/ca_certificates.rb +++ b/lib/vagrant-ca-certificates/config/ca_certificates.rb @@ -20,14 +20,6 @@ @enabled = false if @enabled == UNSET_VALUE @certs = [] if @certs == UNSET_VALUE @certs_path = '/usr/share/ca-certificates/vagrant' if @certs_path == UNSET_VALUE - - # This blows up with "...CaCertificates::URL (NameError)" - #@certs.each do |cert| - # next unless cert.is_a?(URL) - # tempfile = Tempfile.new(['cacert', '.pem']) - # Vagrant::Util::Downloader.new(cert.to_s, tempfile.path) - # cert = tempfile.path - #end end end end
Remove URL block from config. URL support is planned and this block was accidentally included in a pull request.
diff --git a/kitcat.gemspec b/kitcat.gemspec index abc1234..def5678 100644 --- a/kitcat.gemspec +++ b/kitcat.gemspec @@ -16,9 +16,9 @@ gem.require_path = 'lib' gem.add_runtime_dependency 'ruby-progressbar', '~> 1.8' - gem.add_runtime_dependency 'activemodel', '~> 4.2' + gem.add_runtime_dependency 'activemodel' - gem.add_development_dependency 'rspec', '~> 3.4' + gem.add_development_dependency 'rspec' gem.add_development_dependency 'timecop', '~> 0.8' gem.add_development_dependency 'coveralls', '~> 0.8' gem.add_development_dependency 'rake', '~> 11.1'
Remove restrictive version stuff for rails 5.0
diff --git a/test/null_asset_compiler_test.rb b/test/null_asset_compiler_test.rb index abc1234..def5678 100644 --- a/test/null_asset_compiler_test.rb +++ b/test/null_asset_compiler_test.rb @@ -1,4 +1,5 @@ require_relative 'test_helper' +require 'rack-zippy/asset_compiler' module Rack module Zippy
Add require dependency so null compiler test runs with ruby directly
diff --git a/lib/pentago.rb b/lib/pentago.rb index abc1234..def5678 100644 --- a/lib/pentago.rb +++ b/lib/pentago.rb @@ -1,6 +1,5 @@ require 'observer' -require 'rubygems' require 'bundler/setup' Bundler.require @@ -18,4 +17,4 @@ require_relative 'pentago/human_player' require_relative 'pentago/negamax_player' -require_relative 'pentago/ui/console'+require_relative 'pentago/ui/console'
Remove unnecessary 'rubygems' require statement.
diff --git a/test/unit/recipes/resolv_spec.rb b/test/unit/recipes/resolv_spec.rb index abc1234..def5678 100644 --- a/test/unit/recipes/resolv_spec.rb +++ b/test/unit/recipes/resolv_spec.rb @@ -0,0 +1,62 @@+describe 'sys::resolv' do + + before do + stub_command("test -L /etc/resolv.conf").and_return(false) + end + + let(:chef_run) do + ChefSpec::SoloRunner.new do |node| + node.default['sys']['resolv']['servers'] = %w(8.8.4.4 8.8.8.8) + node.default['sys']['resolv']['search'] = "example.com" + end.converge(described_recipe) + end + + context "node['sys']['resolv']['servers'] is empty" do + let(:chef_run) { ChefSpec::SoloRunner.new.converge(described_recipe) } + + it 'does nothing' do + expect(chef_run.run_context.resource_collection + .to_hash.keep_if { |x| x['updated'] }).to be_empty + end + end + + context 'with basic attributes' do + it 'creates /etc/resolv.conf' do + expect(chef_run).to create_template('/etc/resolv.conf') + end + end + + context '/etc/resolv.conf is a symlink' do + before do + stub_command("test -L /etc/resolv.conf").and_return(true) + end + + let(:chef_run) do + ChefSpec::SoloRunner.new do |node| + node.default['sys']['resolv']['servers'] = %w(8.8.4.4 8.8.8.8) + end.converge(described_recipe) + end + + it 'emits a warning' do + expect(chef_run).to write_log('resolv.conf-symlink') + end + + it 'does not touch /etc/resolv.conf' do + expect(chef_run).to_not create_template('/etc/resolv.conf') + end + end + + context 'both domain and search defined' do + let(:chef_run) do + ChefSpec::SoloRunner.new do |node| + node.default['sys']['resolv']['servers'] = %w(8.8.4.4 8.8.8.8) + node.default['sys']['resolv']['search'] = "example.com t.example.com" + node.default['sys']['resolv']['domain'] = "example.com" + end.converge(described_recipe) + end + + it 'emits a warning' do + expect(chef_run).to write_log('domain+search') + end + end +end
Add unit tests for resolv recipe
diff --git a/lib/verdict.rb b/lib/verdict.rb index abc1234..def5678 100644 --- a/lib/verdict.rb +++ b/lib/verdict.rb @@ -11,19 +11,16 @@ end def repository - if @repository.nil? - @repository = {} - discovery - end - + discovery if @repository.nil? @repository end def discovery + @repository = {} Dir[File.join(Verdict.directory, '**', '*.rb')].each { |f| load f } if @directory end - def clear_respository_cache + def clear_repository_cache @repository = nil end
Allow Verdict.discovery to be called multiple times without exceptions Since we're using `load` instead of `require`, it's important to clear the repository cache before searching for experiment definitions again.
diff --git a/lib/dimples.rb b/lib/dimples.rb index abc1234..def5678 100644 --- a/lib/dimples.rb +++ b/lib/dimples.rb @@ -2,6 +2,7 @@ $LOAD_PATH.unshift(__dir__) +require 'fileutils' require 'hashie' require 'tilt' require 'yaml'
Add the missing fileutils require
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -1,7 +1,7 @@ name 'mingw' maintainer 'Chef Software, Inc.' maintainer_email 'cookbooks@chef.io' -license 'apache2' +license 'Apache 2.0' description 'Installs a mingw/msys based toolchain on windows' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version '0.1.0'
Use the full license name
diff --git a/spec/msgr/msgr_spec.rb b/spec/msgr/msgr_spec.rb index abc1234..def5678 100644 --- a/spec/msgr/msgr_spec.rb +++ b/spec/msgr/msgr_spec.rb @@ -23,7 +23,7 @@ end after do - client.stop + client.stop delete: true end it 'should dispatch published methods to consumer' do
Delete queues and exchange after test run
diff --git a/test/integration/detailed_guide_test.rb b/test/integration/detailed_guide_test.rb index abc1234..def5678 100644 --- a/test/integration/detailed_guide_test.rb +++ b/test/integration/detailed_guide_test.rb @@ -4,7 +4,7 @@ test "meta data tag is present" do detailed_guide = create(:published_detailed_guide, summary: "This is a published detailed guide summary") - get "/#{detailed_guide.slug}" + get detailed_guide_path(detailed_guide.slug) assert response.body.include? "<meta name=\"description\" content=\"This is a published detailed guide summary\" />" end
Fix detailed guide test for new paths
diff --git a/test/models/user_mailer_content_test.rb b/test/models/user_mailer_content_test.rb index abc1234..def5678 100644 --- a/test/models/user_mailer_content_test.rb +++ b/test/models/user_mailer_content_test.rb @@ -0,0 +1,38 @@+require "test_helper" +class UserMailerContentTest < ActionMailer::TestCase + #Use sparingly to apply exemptions to the below due to awkward setups + #that work but do not fit the below patterns + exemptions = [ + "app/views/user_mailer/suspension_reminder.html.erb", + "app/views/user_mailer/suspension_notification.html.erb", + ] + + context "considering all email content" do + should "have no malformed links in html content files" do + found_errors = Array.new + file_list = Dir.glob("app/views/user_mailer/*.html.erb").to_a - exemptions + + file_list.each do |file_path| + file = File.open file_path + content = file.read + # Number of link_to calls made total + base_size = content.scan(/link_to/).size + + # e.g. "<%= link_to "support form", t('support.url') %>" + found_examples = content.scan(/<%= link_to [^']*, t\('[^']*.url'\) %>/) + + # e.g "<%= link_to t('department.name'), t('department.url') %>" + found_examples += content.scan(/<%= link_to t\('[^']*'\), t\('[^']*.url'\) %>/) + + # Sometimes we have this specific pattern, we should check for it too + found_examples += content.scan(/<%= link_to 'sign in', new_user_session_url\(protocol\: 'https'\) %>/) + + if found_examples.size != base_size + found_errors.push(file_path) + end + end + + assert(found_errors.empty?, "The following files have malformed link_to calls to be investigated: #{found_errors}") + end + end +end
Add content scanning test for user mail content This commit adds a new test file with the intent of scanning content for malformed patterns that may prevent certain approaches from working as intended. First implementation of this test scans any html mail content files for malformed link_to calls, while allowing for specific exemptions to be hard coded into the test.
diff --git a/lib/sweep.rb b/lib/sweep.rb index abc1234..def5678 100644 --- a/lib/sweep.rb +++ b/lib/sweep.rb @@ -15,3 +15,11 @@ } end +require 'rubygems' +require 'active_record' +require 'racket' + +require 'sweep/scheduler' +require 'sweep/task' +require 'sweep/module' +
Add basic require for operations.
diff --git a/db/migrate/20160918000000_create_indices.rb b/db/migrate/20160918000000_create_indices.rb index abc1234..def5678 100644 --- a/db/migrate/20160918000000_create_indices.rb +++ b/db/migrate/20160918000000_create_indices.rb @@ -9,6 +9,8 @@ add_index :facilities, :nct_id add_index :outcomes, :nct_id add_index :outcome_measured_values, :title + add_index :study_xml_records, :nct_id + add_index :study_xml_records, :created_study_at end
AACT-219: Add indexes to the StudyXmlRecords table
diff --git a/lib/csv_rails/active_model.rb b/lib/csv_rails/active_model.rb index abc1234..def5678 100644 --- a/lib/csv_rails/active_model.rb +++ b/lib/csv_rails/active_model.rb @@ -5,7 +5,12 @@ def to_csv(opts={}) fields = opts[:fields] || csv_fields header = csv_header(fields, opts.delete(:i18n_scope)) - send(:all).to_a.to_csv(opts.update(:fields => fields, :header => header)) + all = if self.respond_to?(:to_a) + to_a + else + send(:all).to_a + end + all.to_csv(opts.update(:fields => fields, :header => header)) end def csv_header(fields, scope=nil)
Remove deprecation warning using rails 4.0.0.rc1.