diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/app/helpers/load_balancer_helper.rb b/app/helpers/load_balancer_helper.rb index abc1234..def5678 100644 --- a/app/helpers/load_balancer_helper.rb +++ b/app/helpers/load_balancer_helper.rb @@ -21,7 +21,7 @@ def self.display_port_range(r) if r.nil? "nil" - elsif r.size == 0 # rubocop:disable Style/ZeroLengthPredicate + elsif r.size.zero? "" elsif r.size == 1 r.first.to_s
Fix rubocop warning in LoadBalancerHelper
diff --git a/db/migrate/20150112212957_create_schools.rb b/db/migrate/20150112212957_create_schools.rb index abc1234..def5678 100644 --- a/db/migrate/20150112212957_create_schools.rb +++ b/db/migrate/20150112212957_create_schools.rb @@ -1,10 +1,14 @@ class CreateSchools < ActiveRecord::Migration def change create_table :schools do |t| - t.string :dbn + t.string :dbn t.string :school t.integer :total_enrollment t.float :amount_owed + t.string :district_name + t.integer :district_no + t.string :assembly_district + t.integer :senate_district t.timestamps end
Update migration file for schools to add additional fields for new data
diff --git a/spec/helpers/google_analytics_spec.rb b/spec/helpers/google_analytics_spec.rb index abc1234..def5678 100644 --- a/spec/helpers/google_analytics_spec.rb +++ b/spec/helpers/google_analytics_spec.rb @@ -0,0 +1,17 @@+require "spec_helper" +include Nanoc::Toolbox::Helpers::GoogleAnalytics + +describe Nanoc::Toolbox::Helpers::GoogleAnalytics do + subject { Nanoc::Toolbox::Helpers::GoogleAnalytics } + it { should respond_to(:ga_tracking_snippet) } + describe ".ga_tracking_snippet" do + it "returns a string that contains the JS" do + ga_tracking_snippet("").should include("<script") + ga_tracking_snippet("").should include("var _gaq = _gaq || [];") + end + + it "includes the passed code" do + ga_tracking_snippet("qwertzuiop").should include("qwertzuiop") + end + end +end
Add the spec for the google analytics helper
diff --git a/app/controllers/schools_controller.rb b/app/controllers/schools_controller.rb index abc1234..def5678 100644 --- a/app/controllers/schools_controller.rb +++ b/app/controllers/schools_controller.rb @@ -1,7 +1,6 @@ class SchoolsController < ApplicationController # skip_before_action :verify_authenticity_token def index - # @schools = School.all gon.schools = School.all end
REmove commented out code setting all schools to @school
diff --git a/app/controllers/uploads_controller.rb b/app/controllers/uploads_controller.rb index abc1234..def5678 100644 --- a/app/controllers/uploads_controller.rb +++ b/app/controllers/uploads_controller.rb @@ -1,7 +1,9 @@ class UploadsController < ApplicationController def upload file = params[:files].first - response = Upload.store(file.tempfile) + # response needs to be array to prepare for multiple simultaneous uploads + response = [] + response << Upload.store(file.tempfile) respond_to do |format| format.html { render :json => response} # For testing purposes format.json { render :json => response}
Make response from upload an array
diff --git a/test/unit/ontology_parser/distributed_test.rb b/test/unit/ontology_parser/distributed_test.rb index abc1234..def5678 100644 --- a/test/unit/ontology_parser/distributed_test.rb +++ b/test/unit/ontology_parser/distributed_test.rb @@ -22,7 +22,7 @@ end should 'found all symbols' do - assert_equal 3, @symbols.count + assert_equal 2, @symbols.count end should 'found all axioms' do
Update the number of symbols in the ontology
diff --git a/rb/spec/integration/selenium/webdriver/mouse_spec.rb b/rb/spec/integration/selenium/webdriver/mouse_spec.rb index abc1234..def5678 100644 --- a/rb/spec/integration/selenium/webdriver/mouse_spec.rb +++ b/rb/spec/integration/selenium/webdriver/mouse_spec.rb @@ -25,9 +25,7 @@ text = droppable.find_element(:tag_name => "p").text text.should == "Dropped!" end - end - compliant_on :browser => :chrome do it "double clicks an element" do driver.navigate.to url_for("javascriptPage.html") element = driver.find_element(:id, 'doubleClickField')
JariBakken: Enable double/context click specs for IE. git-svn-id: 4179480af2c2519a5eb5e1e9b541cbdf5cf27696@13526 07704840-8298-11de-bf8c-fd130f914ac9
diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index abc1234..def5678 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -15,6 +15,6 @@ def update @account = Account.find(params[:id]) @account.update based_on: @account.client.user(params[:account][:based_on])[:id] - @account.update_model # TODO: delayed_job + @account.delay.update_model end end
Use delayed_job for archive downloading
diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index abc1234..def5678 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -10,15 +10,23 @@ end def new - @comment = Comment.new + if current_user + @comment = Comment.new + else + redirect_to root_path, notice: 'You have to be logged it to do that!!' + end end def edit + if current_user + @comment = Comment.new + else + redirect_to root_path, notice: 'You have to be logged it to do that!!' + end end def create @comment = Comment.new(comment_params) - respond_to do |format| if @comment.save format.html { redirect_to @comment, notice: 'Comment was successfully created.' } @@ -39,9 +47,13 @@ end def destroy - @comment.destroy - respond_to do |format| - format.html { redirect_to comments_url, notice: 'Comment was successfully destroyed.' } + if current_user + @comment.destroy + respond_to do |format| + format.html { redirect_to comments_url, notice: 'Comment was successfully destroyed.' } + end + else + redirect_to root_path, notice: 'You have to be logged it to do that!!' end end
Check if user is logged in before executing certain actions
diff --git a/app/controllers/job_task_controller.rb b/app/controllers/job_task_controller.rb index abc1234..def5678 100644 --- a/app/controllers/job_task_controller.rb +++ b/app/controllers/job_task_controller.rb @@ -1,5 +1,7 @@ class JobTaskController < ApplicationController layout "default" + + before_filter :admin_only, :only => [ :destroy, :restart ] def index @job_tasks = JobTask.paginate(:per_page => 25, :order => "id DESC", :page => params[:page])
r1901: Access control for job task restart/destroy --HG-- branch : moe extra : convert_revision : svn%3A2d28d66d-8d94-df11-8c86-00306ef368cb/trunk/moe%40279
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -1,22 +1,20 @@ class SessionsController < ApplicationController - def new end - # def create - # user = User.find_by_email(params[:email]) - # if user.password == params[:password] - # session[:user_id] = user.id - # redirect_to root_path - # else - # flash.now[:error] = "Invalid username or password." - # render :new - # end - # end + def create + user = User.find_by_email(params[:email]) + if user && user.authenticate(params[:password]) + session[:user_id] = user.id + redirect_to root_path + else + flash.now[:error] = "Invalid username or password." + render :new + end + end - # def destroy - # session.clear - # redirect_to root_path - # end - + def destroy + session.clear + redirect_to root_path + end end
Add correct has_secure_password implementation of sessions with Rails 4 and the latest Bcrypt gem methods.
diff --git a/app/controllers/webhooks_controller.rb b/app/controllers/webhooks_controller.rb index abc1234..def5678 100644 --- a/app/controllers/webhooks_controller.rb +++ b/app/controllers/webhooks_controller.rb @@ -1,9 +1,11 @@ class WebhooksController < ApplicationController def mailchimp - user = User.find_by(email: params[:data][:email]) + if params[:data] && params[:data][:email] + user = User.find_by(email: params[:data][:email]) - if user - user.update_column(is_subscribed: false) + if user + user.update_column(is_subscribed: false) + end end render nothing: true
Add extra if statement so mailchimp doesn't get pissed off.
diff --git a/core/lib/generators/spree/custom_user/custom_user_generator.rb b/core/lib/generators/spree/custom_user/custom_user_generator.rb index abc1234..def5678 100644 --- a/core/lib/generators/spree/custom_user/custom_user_generator.rb +++ b/core/lib/generators/spree/custom_user/custom_user_generator.rb @@ -2,7 +2,6 @@ module Spree class CustomUserGenerator < Rails::Generators::NamedBase - include Rails::Generators::ResourceHelpers include ActiveRecord::Generators::Migration desc "Set up a Solidus installation with a custom User class"
Remove unused module include from custom user generator This include exists since this generator was introduced but no method is ever called on that module.
diff --git a/src/controllers/systems_controller.rb b/src/controllers/systems_controller.rb index abc1234..def5678 100644 --- a/src/controllers/systems_controller.rb +++ b/src/controllers/systems_controller.rb @@ -26,8 +26,12 @@ post '/' do system = System.new permit_params - system.save + unless system.save + status 400 + return json system.errors + end + status 201 json system end
Switch status code and response body by validation result
diff --git a/spec/sastrawi_spec.rb b/spec/sastrawi_spec.rb index abc1234..def5678 100644 --- a/spec/sastrawi_spec.rb +++ b/spec/sastrawi_spec.rb @@ -32,4 +32,16 @@ expect((base_form - stemming_result).empty?).to eq(true) end + + it 'should stem "-ku, -mu, -nya" suffixes' do + suffixed_words = %w[jubahku bajumu celananya] + base_form = %w[jubah baju celana] + stemming_result = [] + + suffixed_words.each do |word| + stemming_result.push(Sastrawi.stem(word)) + end + + expect((base_form - stemming_result).empty?).to eq(true) + end end
Add test for "-ku, -mu, -nya" suffixes
diff --git a/spree_temando.gemspec b/spree_temando.gemspec index abc1234..def5678 100644 --- a/spree_temando.gemspec +++ b/spree_temando.gemspec @@ -16,6 +16,7 @@ s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"] s.test_files = Dir["test/**/*"] + s.add_dependency 'spree_core', "~> 1.1.1" s.add_dependency "rails", "~> 3.2.3" s.add_dependency 'temando', '~>0.1.0'
Add spree_core as a dependency
diff --git a/test/form_forms/form_registry_test.rb b/test/form_forms/form_registry_test.rb index abc1234..def5678 100644 --- a/test/form_forms/form_registry_test.rb +++ b/test/form_forms/form_registry_test.rb @@ -10,7 +10,7 @@ FormRegistry['foo'] = form assert_equal FormRegistry['foo'], form assert_equal FormRegistry[:foo], form - assert_includes FormRegistry.keys, 'foo' + assert FormRegistry.keys.include?('foo'), "Expected FormRegistry.keys to include 'foo'" FormRegistry.delete('foo') assert_nil FormRegistry['foo']
Fix assertion for Ruby 1.8 which doesn't ship MiniTest
diff --git a/test/integration/test_return_codes.rb b/test/integration/test_return_codes.rb index abc1234..def5678 100644 --- a/test/integration/test_return_codes.rb +++ b/test/integration/test_return_codes.rb @@ -0,0 +1,38 @@+require_relative '../test_helper' + +# NOTE: These tests depend on the OpenLDAP retcode overlay. +# See: section 12.12 http://www.openldap.org/doc/admin24/overlays.html + +class TestReturnCodeIntegration < LDAPIntegrationTestCase + def test_operations_error + refute @ldap.search(filter: "cn=operationsError", base: "ou=Retcodes,dc=rubyldap,dc=com") + assert result = @ldap.get_operation_result + + assert_equal 1, result.code + assert_equal Net::LDAP::ResultStrings[1], result.message + end + + def test_protocol_error + refute @ldap.search(filter: "cn=protocolError", base: "ou=Retcodes,dc=rubyldap,dc=com") + assert result = @ldap.get_operation_result + + assert_equal 2, result.code + assert_equal Net::LDAP::ResultStrings[2], result.message + end + + def test_time_limit_exceeded + refute @ldap.search(filter: "cn=timeLimitExceeded", base: "ou=Retcodes,dc=rubyldap,dc=com") + assert result = @ldap.get_operation_result + + assert_equal 3, result.code + assert_equal Net::LDAP::ResultStrings[3], result.message + end + + def test_size_limit_exceeded + refute @ldap.search(filter: "cn=sizeLimitExceeded", base: "ou=Retcodes,dc=rubyldap,dc=com") + assert result = @ldap.get_operation_result + + assert_equal 4, result.code + assert_equal Net::LDAP::ResultStrings[4], result.message + end +end
Add return code integration tests
diff --git a/spec/models/manageiq/providers/hawkular/middleware_manager_spec.rb b/spec/models/manageiq/providers/hawkular/middleware_manager_spec.rb index abc1234..def5678 100644 --- a/spec/models/manageiq/providers/hawkular/middleware_manager_spec.rb +++ b/spec/models/manageiq/providers/hawkular/middleware_manager_spec.rb @@ -0,0 +1,9 @@+describe ManageIQ::Providers::Hawkular::MiddlewareManager do + it ".ems_type" do + expect(described_class.ems_type).to eq('hawkular') + end + + it ".description" do + expect(described_class.description).to eq('Hawkular') + end +end
Add a middleware manager spec (transferred from ManageIQ/manageiq@157973577dbd2e7db105e305e25f5ff408907bbd)
diff --git a/lib/three_scale_api/resources/oauth_dev_portal.rb b/lib/three_scale_api/resources/oauth_dev_portal.rb index abc1234..def5678 100644 --- a/lib/three_scale_api/resources/oauth_dev_portal.rb +++ b/lib/three_scale_api/resources/oauth_dev_portal.rb @@ -3,8 +3,8 @@ require 'three_scale_api/resources/default' module ThreeScaleApi module Resources - # WebHook resource wrapper for the WebHook entity received by the REST API - class OAuthAdminPortal < DefaultResource + # WebHook resource wrapper for the OAuth for Developer portal entity received by the REST API + class OAuthDevPortal < DefaultResource end end end
Fix resource for OAuth for Devel portal
diff --git a/app/serializers/material_serializer.rb b/app/serializers/material_serializer.rb index abc1234..def5678 100644 --- a/app/serializers/material_serializer.rb +++ b/app/serializers/material_serializer.rb @@ -1,5 +1,6 @@ class MaterialSerializer < ActiveModel::Serializer attributes( + :id, :original_link, :caption_original, :caption_translated, @@ -15,5 +16,5 @@ belongs_to :state belongs_to :license - # has_many :chunks + has_many :chunks end
Add id attribute to material serializer
diff --git a/Library/Homebrew/test/test_sandbox.rb b/Library/Homebrew/test/test_sandbox.rb index abc1234..def5678 100644 --- a/Library/Homebrew/test/test_sandbox.rb +++ b/Library/Homebrew/test/test_sandbox.rb @@ -25,4 +25,30 @@ end refute_predicate @file, :exist? end + + def test_complains_on_failure + Utils.expects(:popen_read => "foo") + ARGV.stubs(:verbose? => true) + out, _err = capture_io do + assert_raises(ErrorDuringExecution) { @sandbox.exec "false" } + end + assert_match "foo", out + end + + def test_ignores_bogus_python_error + with_bogus_error = <<-EOS.undent + foo + Mar 17 02:55:06 sandboxd[342]: Python(49765) deny file-write-unlink /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/errors.pyc + bar + EOS + Utils.expects(:popen_read => with_bogus_error) + ARGV.stubs(:verbose? => true) + out, _err = capture_io do + assert_raises(ErrorDuringExecution) { @sandbox.exec "false" } + end + refute_predicate out, :empty? + assert_match "foo", out + assert_match "bar", out + refute_match "Python", out + end end
Test that sandbox complains correctly Test that sandbox does not complain about bogus .pyc errors and does complain about other failures. Closes #684.
diff --git a/Casks/intellij-idea.rb b/Casks/intellij-idea.rb index abc1234..def5678 100644 --- a/Casks/intellij-idea.rb +++ b/Casks/intellij-idea.rb @@ -1,6 +1,6 @@ cask :v1 => 'intellij-idea' do - version '15.0' - sha256 'a195493e2c4a1b55f76d9784ef2d8815bffb46d6b4a1b11a8000489a011097b6' + version '15.0.1' + sha256 'b253782bf1a10763c4fd84bffce0e28d855da8eb6499a91647860cb443695fdd' url "https://download.jetbrains.com/idea/ideaIU-#{version}-custom-jdk-bundled.dmg" name 'IntelliJ IDEA'
Upgrade IntelliJ IDEA to 15.0.1.
diff --git a/virtual.gemspec b/virtual.gemspec index abc1234..def5678 100644 --- a/virtual.gemspec +++ b/virtual.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'virtual' - s.version = '0.1.0' + s.version = '0.1.1' s.summary = 'Virtual method declaration' s.description = ' '
Package version is increased from 0.1.0 to 0.1.1
diff --git a/benchmarks/class_exec_vs_klass_exec.rb b/benchmarks/class_exec_vs_klass_exec.rb index abc1234..def5678 100644 --- a/benchmarks/class_exec_vs_klass_exec.rb +++ b/benchmarks/class_exec_vs_klass_exec.rb @@ -0,0 +1,43 @@+require 'benchmark/ips' +require 'rspec/support' +require 'rspec/support/with_keywords_when_needed' + +Klass = Class.new do + def test(*args, **kwargs) + end +end + +def class_exec_args + Klass.class_exec(:a, :b) { } +end + +def klass_exec_args + RSpec::Support::WithKeywordsWhenNeeded.class_exec(Klass, :a, :b) { } +end + +def class_exec_kw_args + Klass.class_exec(a: :b) { |a:| } +end + +def klass_exec_kw_args + RSpec::Support::WithKeywordsWhenNeeded.class_exec(Klass, a: :b) { |a:| } +end + +Benchmark.ips do |x| + x.report("class_exec(*args) ") { class_exec_args } + x.report("klass_exec(*args) ") { klass_exec_args } + x.report("class_exec(*args, **kwargs)") { class_exec_kw_args } + x.report("klass_exec(*args, **kwargs)") { klass_exec_kw_args } +end + +__END__ + +Calculating ------------------------------------- +class_exec(*args) + 5.555M (± 1.6%) i/s - 27.864M in 5.017682s +klass_exec(*args) + 657.945k (± 4.6%) i/s - 3.315M in 5.051511s +class_exec(*args, **kwargs) + 2.882M (± 3.3%) i/s - 14.555M in 5.056905s +klass_exec(*args, **kwargs) + 52.710k (± 4.1%) i/s - 265.188k in 5.041218s
Add bench mark for keywords class exec
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index abc1234..def5678 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -17,7 +17,7 @@ end def link_header(text, level) - %Q(<h#{level} id="#{text.parameterize}">#{link_to(text.html_safe, params.merge(anchor: text.gsub("&amp;", "and").parameterize), class: "link-header")}</h#{level}>).html_safe + %Q(<h#{level} id="#{anchorize(text)}">#{link_to(text.html_safe, params.merge(anchor: anchorize(text)), class: "link-header")}</h#{level}>).html_safe end # Returns the meta description on a per-page basis. @@ -39,4 +39,9 @@ html.html_safe end + # Formats text for use in anchor/id attributes + def anchorize(text) + return text.gsub("&amp;", "and").parameterize + end + end
Fix ampersands in link_header helper
diff --git a/app/helpers/switch_user_helper.rb b/app/helpers/switch_user_helper.rb index abc1234..def5678 100644 --- a/app/helpers/switch_user_helper.rb +++ b/app/helpers/switch_user_helper.rb @@ -35,7 +35,7 @@ end def tag_label(user, name) - name.respond_to?(:call) ? name.call(user) : user.send(name) + user.send(name) end def available?
Revert "select option label can now specify a proc." This reverts commit 66adcf11ab5a5a55777f41fb6e29badd04e7509f.
diff --git a/app/helpers/system_note_helper.rb b/app/helpers/system_note_helper.rb index abc1234..def5678 100644 --- a/app/helpers/system_note_helper.rb +++ b/app/helpers/system_note_helper.rb @@ -7,7 +7,7 @@ 'closed' => 'icon_status_closed', 'time_tracking' => 'icon_stopwatch', 'assignee' => 'icon_user', - 'title' => 'icon_pencil', + 'title' => 'icon_edit', 'task' => 'icon_check_square_o', 'label' => 'icon_tags', 'cross_reference' => 'icon_random',
Update MR title change icon
diff --git a/cookbooks/sudo/recipes/default.rb b/cookbooks/sudo/recipes/default.rb index abc1234..def5678 100644 --- a/cookbooks/sudo/recipes/default.rb +++ b/cookbooks/sudo/recipes/default.rb @@ -18,7 +18,7 @@ # package "sudo" do - action :upgrade + action :install end template "/etc/sudoers" do
Change the sudo recipe so it doesn't try to do an upgrade on every run. This takes forever on CentOS Former-commit-id: bf91f36cda6822d668e733832811ad3305067aea [formerly 7f6332604b3c3657d74ac86ae38a0a03f392ed59] [formerly 9aa9e35ec4bd39dfde0f4f71b80ab66b064d17b5 [formerly 2fd6c1c31794e680c19d5d6015d84c02dcd2d3ad [formerly 83fd27a6f414ac8728a51ae4e2dbe9204d5f5468]]] Former-commit-id: ad9aa1208eba2c611c0ceec947316906d9c28349 [formerly 1f1bd139e553f5d04efbb938cd7e519c3462dcd1] Former-commit-id: 143d035ac6c4ea3a38222382daca4c3f990eb55e Former-commit-id: eb29b6d72d7d4c88c5e89537787e0affd504eff5
diff --git a/roboter.gemspec b/roboter.gemspec index abc1234..def5678 100644 --- a/roboter.gemspec +++ b/roboter.gemspec @@ -14,4 +14,9 @@ gem.name = "roboter" gem.require_paths = ["lib"] gem.version = Roboter::VERSION + + gem.add_development_dependency "rspec" + gem.add_development_dependency "guard-rspec" + + gem.add_runtime_dependency "blather" end
Add blather, rspec and guard dependencies.
diff --git a/lib/arrthorizer/rspec/matchers.rb b/lib/arrthorizer/rspec/matchers.rb index abc1234..def5678 100644 --- a/lib/arrthorizer/rspec/matchers.rb +++ b/lib/arrthorizer/rspec/matchers.rb @@ -19,7 +19,7 @@ "Expected role #{@role.name} to apply in context #{context.inspect}\nfor user #{user.inspect}, but it does not apply!" end - def negative_failure_message + def failure_message_when_negates "Expected role #{@role.name} not to apply in context #{context.inspect}\nfor user #{user.inspect}, but it applies!" end
Move to newer RSpec matcher syntax
diff --git a/Mapzen-ios-sdk.podspec b/Mapzen-ios-sdk.podspec index abc1234..def5678 100644 --- a/Mapzen-ios-sdk.podspec +++ b/Mapzen-ios-sdk.podspec @@ -23,6 +23,6 @@ cs.dependency 'OnTheRoad', '~> 1.0.0-beta' cs.dependency 'Tangram-es', '~> 0.4' cs.source_files = "src/*.swift" - cs.resources = 'images/*.png' + cs.resources = [ 'images/*.png', 'tangram/*' ] end end
Update podspec to include bubble-wrap bundled style
diff --git a/api/app/controllers/v1/analytics_controller.rb b/api/app/controllers/v1/analytics_controller.rb index abc1234..def5678 100644 --- a/api/app/controllers/v1/analytics_controller.rb +++ b/api/app/controllers/v1/analytics_controller.rb @@ -11,7 +11,7 @@ end def page - segment(:page, %w(user_id name)) + segment(:page, %w(user_id name properties)) end def group
Add page properties in analytics
diff --git a/lib/onebox/engine/image_onebox.rb b/lib/onebox/engine/image_onebox.rb index abc1234..def5678 100644 --- a/lib/onebox/engine/image_onebox.rb +++ b/lib/onebox/engine/image_onebox.rb @@ -7,7 +7,7 @@ def to_html # Fix Dropbox image links - if /^https:\/\/www.dropbox.com/.match @url + if /^https:\/\/www.dropbox.com\/s\//.match @url @url.gsub!("https://www.dropbox.com","https://dl.dropboxusercontent.com") end
Make dropbox image matching more strict
diff --git a/db/migrate/20170224053931_add_used_column_to_user_invitations.rb b/db/migrate/20170224053931_add_used_column_to_user_invitations.rb index abc1234..def5678 100644 --- a/db/migrate/20170224053931_add_used_column_to_user_invitations.rb +++ b/db/migrate/20170224053931_add_used_column_to_user_invitations.rb @@ -1,15 +1,16 @@ class AddUsedColumnToUserInvitations < ActiveRecord::Migration def change - transaction do - add_column :user_invitations, :used, :boolean, default: false + add_column :user_invitations, :used, :boolean, default: false - uis = UserInvitations.all - uis.each do |ui| - user = User.where(email: ui.email) - user_already_at_org = false - user_already_at_org = OrganizationUser.where(id: user.id, organization: ui.organization_id) if user.present? - ui.update!(used: true) if user_already_at_org.present? - end + update_existing_user_invitations + end + + def update_existing_user_invitations + UserInvitation.all.each do |ui| + user = User.where(email: ui.email) + user_already_at_org = false + user_already_at_org = OrganizationUser.where(id: user.id, organization: ui.organization_id) if user.present? + ui.update!(used: true) if user_already_at_org.present? end end end
Fix error in updating existing user invites
diff --git a/lib/ruboty/gitlab/actions/base.rb b/lib/ruboty/gitlab/actions/base.rb index abc1234..def5678 100644 --- a/lib/ruboty/gitlab/actions/base.rb +++ b/lib/ruboty/gitlab/actions/base.rb @@ -41,7 +41,7 @@ end def search_project - client.projects({ search: given_project }).first + client.projects({ search: given_project }).find { |project| project.name == given_project } end def project
Fix bug; mistake same prefix project name
diff --git a/app/presenters/tree_builder_service_catalog.rb b/app/presenters/tree_builder_service_catalog.rb index abc1234..def5678 100644 --- a/app/presenters/tree_builder_service_catalog.rb +++ b/app/presenters/tree_builder_service_catalog.rb @@ -21,7 +21,7 @@ end def x_get_tree_roots(count_only, _options) - includes = {:tenant => {}} + includes = {:tenant => {}, :service_templates => {}} objects = Rbac.filtered(ServiceTemplateCatalog, :include_for_find => includes).sort_by { |o| o.name.downcase } filtered_objects = [] # only show catalogs nodes that have any servicetemplate records under them
Include :service_templates to remove N+1 query service_templates is loaded here: https://github.com/ManageIQ/manageiq-ui-classic/blob/master/app/presenters/tree_builder_service_catalog.rb#L35
diff --git a/lib/spectrum/config/field_list.rb b/lib/spectrum/config/field_list.rb index abc1234..def5678 100644 --- a/lib/spectrum/config/field_list.rb +++ b/lib/spectrum/config/field_list.rb @@ -10,6 +10,7 @@ __getobj__.values.each do |f| return f if f.uid == uid end + nil end def each
Return nil on not found.
diff --git a/PINRemoteImage.podspec b/PINRemoteImage.podspec index abc1234..def5678 100644 --- a/PINRemoteImage.podspec +++ b/PINRemoteImage.podspec @@ -9,12 +9,12 @@ Pod::Spec.new do |s| s.name = "PINRemoteImage" - s.version = "1.0" + s.version = "1.1" s.summary = "A thread safe, performant, feature rich image fetcher" s.homepage = "https://github.com/pinterest/PINRemoteImage" s.license = 'Apache 2.0' s.author = { "Garrett Moon" => "garrett@pinterest.com" } - s.source = { :git => "https://github.com/pinterest/PINRemoteImage.git", :tag => 1.0 } + s.source = { :git => "https://github.com/pinterest/PINRemoteImage.git", :tag => 1.1 } s.social_media_url = 'https://twitter.com/garrettmoon' s.platform = :ios, '6.0'
Update podspec for 1.1 release
diff --git a/jekyll-agency.gemspec b/jekyll-agency.gemspec index abc1234..def5678 100644 --- a/jekyll-agency.gemspec +++ b/jekyll-agency.gemspec @@ -1,18 +1,16 @@ Gem::Specification.new do |spec| - spec.name = "jekyll-agency" - spec.version = "1.0.7" - spec.authors = ["Ravi Riley"] - - spec.summary = "Bootstrap Agency ported to Jekyll. Added lots of new features: Markdown support, custom pages, Google Analytics, customizable styling, and more! This is the most up-to-date Jekyll Agency theme." - spec.homepage = "https://github.com/raviriley/agency-jekyll-theme" - spec.license = "MIT" - - spec.files = `git ls-files -z`.split("\x0").select do |f| + spec.name = "jekyll-agency" + spec.version = "1.0.7" + spec.authors = ["Ravi Riley"] + spec.summary = "Bootstrap Agency ported to Jekyll. Added lots of new features: Markdown support, custom pages, Google Analytics, customizable styling, and more! This is the most up-to-date Jekyll Agency theme." + spec.homepage = "https://github.com/raviriley/agency-jekyll-theme" + spec.license = "MIT" + spec.files = `git ls-files -z`.split("\x0").select do |f| f.match(%r{^(assets|_(data|includes|layouts|sass)/|(LICENSE|README|index|404|legal)((\.(txt|md|markdown|html)|$)))}i) end + spec.required_ruby_version = '>= 2.5.0' spec.add_runtime_dependency "jekyll", "~> 4.0" - spec.add_development_dependency "bundler", "~> 2.0" spec.add_development_dependency "rake", "~> 12.0" end
Add ruby >=2.5.0 required min version
diff --git a/seo_cms.gemspec b/seo_cms.gemspec index abc1234..def5678 100644 --- a/seo_cms.gemspec +++ b/seo_cms.gemspec @@ -21,5 +21,5 @@ s.add_development_dependency 'sqlite3' s.add_development_dependency 'ancestry', '>= 0', '>= 0' - s.add_development_dependency 'test-unit' + # s.add_development_dependency 'test-unit' end
Remove ancestry from dev gems
diff --git a/Casks/charles.rb b/Casks/charles.rb index abc1234..def5678 100644 --- a/Casks/charles.rb +++ b/Casks/charles.rb @@ -1,6 +1,6 @@ cask :v1 => 'charles' do - version '3.10.2' - sha256 'd68be46d7dc9654b4b3b094a2f451226376d7bf3c5d401aecba082b27e0b8b6a' + version '3.11' + sha256 'b31efe7c80464a92984d7a76e8a41df0d766c4047695b083f7278a9668585592' url "http://www.charlesproxy.com/assets/release/#{version}/charles-proxy-#{version}.dmg" name 'Charles'
Update Charles to version 3.11
diff --git a/app/serializers/sprangular/taxon_serializer.rb b/app/serializers/sprangular/taxon_serializer.rb index abc1234..def5678 100644 --- a/app/serializers/sprangular/taxon_serializer.rb +++ b/app/serializers/sprangular/taxon_serializer.rb @@ -1,6 +1,6 @@ module Sprangular class TaxonSerializer < BaseSerializer - attributes :id, :name, :pretty_name, :permalink, :parent_id, :taxonomy_id + attributes *taxon_attributes has_many :children, key: :taxons, serializer: self end
Use default attributes which allows for easier overriding
diff --git a/plugin/hammer.vim/lib/vim/improvedbuffer.rb b/plugin/hammer.vim/lib/vim/improvedbuffer.rb index abc1234..def5678 100644 --- a/plugin/hammer.vim/lib/vim/improvedbuffer.rb +++ b/plugin/hammer.vim/lib/vim/improvedbuffer.rb @@ -17,11 +17,11 @@ end def basename - File.basename self.name + File.basename self.name.to_s end def extname - File.extname self.name + File.extname self.name.to_s end def saved?
Make sure we're passing a string to File methods.
diff --git a/mcagents/execute_shell_command.rb b/mcagents/execute_shell_command.rb index abc1234..def5678 100644 --- a/mcagents/execute_shell_command.rb +++ b/mcagents/execute_shell_command.rb @@ -20,9 +20,9 @@ class Execute_shell_command < RPC::Agent action 'execute' do - reply[:exit_code], reply[:stdout], reply[:stderr] = run(request[:cmd], - :stdout => :stdout, - :stderr => :stderr) + reply[:exit_code] = run(request[:cmd], + :stdout => :stdout, + :stderr => :stderr) reply[:stdout] ||= "" reply[:stderr] ||= "" end
Fix problem with empty stdout/stderr answer for shell magent Change-Id: I76e2c984bf86aa0df3ec1762df52cb1533ad7665 Closes-Bug: #1322475
diff --git a/spec/battlenetapi_spec.rb b/spec/battlenetapi_spec.rb index abc1234..def5678 100644 --- a/spec/battlenetapi_spec.rb +++ b/spec/battlenetapi_spec.rb @@ -8,10 +8,5 @@ config.region = :eu end end - - it "should escape spaces in realm names" do - c = Battlenet::Client.new({domain: 'http://www.test.com', endpoint: "/emerald dream/mal'ganis"}) - expect(c.endpoint).to eq('/emerald%20dream/mal\'ganis') - end end end
Remove an incorrect endpoint test
diff --git a/spec/bsf/database_spec.rb b/spec/bsf/database_spec.rb index abc1234..def5678 100644 --- a/spec/bsf/database_spec.rb +++ b/spec/bsf/database_spec.rb @@ -34,6 +34,15 @@ end + describe 'method_missing' do + + it 'invocates the method on the Sequel database connection' do + database = described_class.new(options) + database.servers.should == [:default] + end + + end + def options(host = false) hash = { :database_name => 'test', :database_user => 'test', :database_password => 'test' }
Add method_missing test for Bsf::Database class Add a test to make sure method_missing is working as intended. To do this call a method that should exist on an instance of the Sequel::SQLite::Database class and check that the return value is what we would expect from that call.
diff --git a/assignments/ruby/robot-name/robot-name_test.rb b/assignments/ruby/robot-name/robot-name_test.rb index abc1234..def5678 100644 --- a/assignments/ruby/robot-name/robot-name_test.rb +++ b/assignments/ruby/robot-name/robot-name_test.rb @@ -8,24 +8,22 @@ end def test_name_sticks - skip robot = Robot.new robot.name assert_equal robot.name, robot.name end def test_different_robots_have_different_names - skip assert Robot.new.name != Robot.new.name end def test_reset_name - skip robot = Robot.new name = robot.name robot.reset name2 = robot.name assert name != name2 + assert_match /\w{2}\d{3}/, name2 end end
Improve test suite for ruby:robot-name
diff --git a/spec/orm/active_record.rb b/spec/orm/active_record.rb index abc1234..def5678 100644 --- a/spec/orm/active_record.rb +++ b/spec/orm/active_record.rb @@ -1,3 +1,8 @@ ActiveRecord::Migration.verbose = false -ActiveRecord::Migrator.migrate(File.expand_path('../../rails_app/db/migrate/', __FILE__)) +migration_path = File.expand_path('../../rails_app/db/migrate/', __FILE__) +if ActiveRecord.version.release < Gem::Version.new('5.2.0') + ActiveRecord::Migrator.migrate(migration_path) +else + ActiveRecord::MigrationContext.new(migration_path).migrate +end
Fix specs on Rails 5.2
diff --git a/Library/Homebrew/cask/spec/cask/artifact/uninstall_no_zap_spec.rb b/Library/Homebrew/cask/spec/cask/artifact/uninstall_no_zap_spec.rb index abc1234..def5678 100644 --- a/Library/Homebrew/cask/spec/cask/artifact/uninstall_no_zap_spec.rb +++ b/Library/Homebrew/cask/spec/cask/artifact/uninstall_no_zap_spec.rb @@ -0,0 +1,21 @@+require "spec_helper" + +describe Hbc::Artifact::Zap do + let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-installable.rb") } + + let(:zap_artifact) { + Hbc::Artifact::Zap.new(cask) + } + + before do + shutup do + InstallHelper.install_without_artifacts(cask) + end + end + + describe "#uninstall_phase" do + subject { zap_artifact } + + it { is_expected.not_to respond_to(:uninstall_phase) } + end +end
Add test to ensure `Zap` does not have an `uninstall_phase`.
diff --git a/spec/features/guest_can_not_see_dashboard_spec.rb b/spec/features/guest_can_not_see_dashboard_spec.rb index abc1234..def5678 100644 --- a/spec/features/guest_can_not_see_dashboard_spec.rb +++ b/spec/features/guest_can_not_see_dashboard_spec.rb @@ -4,7 +4,7 @@ scenario 'Guests are asked to log in first' do visit dashboards_show_path - expect(current_path).to eq(root_path) + expect(page).to show :welcome_page expect(page).to flash_message t('not_logged_in') end end
Use page object and corresponding matchers rather than looking at URL
diff --git a/spec/unit/facter/haveged_startup_provider_spec.rb b/spec/unit/facter/haveged_startup_provider_spec.rb index abc1234..def5678 100644 --- a/spec/unit/facter/haveged_startup_provider_spec.rb +++ b/spec/unit/facter/haveged_startup_provider_spec.rb @@ -1,26 +1,25 @@ require 'spec_helper' describe 'Facter::Util::Fact' do - before(:each) do - Facter.clear - Facter.fact(:kernel).stubs(:value).returns('Linux') - end + context 'haveged_startup_provider with /proc/1/comm' do + let(:facts) do + { kernel: 'Linux' } + end - after(:each) do - Facter.clear - end - - context 'haveged_startup_provider with /proc/1/comm' do it { - File.stubs(:open).returns("foo\n") - expect(Facter.fact(:haveged_startup_provider).value).to eq('foo') + allow(File).to receive(:open).and_returns("foo\n") + expect(Facter).to receive(:fact).with(:haveged_startup_provider).and_returns('foo') } end context 'haveged_startup_provider without /proc/1/comm' do + let(:facts) do + { kernel: 'Linux' } + end + it { - File.stubs(:open) { raise(StandardException) } - expect(Facter.fact(:haveged_startup_provider).value).to eq('init') + allow(File).to receive(:open) { raise(StandardException) } + expect(Facter).to receive(:fact).with(:haveged_startup_provider).and_returns('init') } end end
Update fact testing to use rspec-mock
diff --git a/bosh-dev/lib/bosh/dev/stemcell_rake_methods.rb b/bosh-dev/lib/bosh/dev/stemcell_rake_methods.rb index abc1234..def5678 100644 --- a/bosh-dev/lib/bosh/dev/stemcell_rake_methods.rb +++ b/bosh-dev/lib/bosh/dev/stemcell_rake_methods.rb @@ -1,7 +1,6 @@ require 'bosh/dev/build_from_spec' require 'bosh/dev/stemcell_builder_options' require 'bosh/dev/gems_generator' -require 'bosh/dev/micro_bosh_release' module Bosh::Dev class StemcellRakeMethods @@ -29,9 +28,5 @@ private attr_reader :environment, :args, :stemcell_builder_options - - def source_root - File.expand_path('../../../../..', __FILE__) - end end end
Remove unused method and require
diff --git a/app/controllers/articles_controller.rb b/app/controllers/articles_controller.rb index abc1234..def5678 100644 --- a/app/controllers/articles_controller.rb +++ b/app/controllers/articles_controller.rb @@ -5,4 +5,8 @@ def index @articles = Article.all end + + def show + @article = Article.find(params[:id]) + end end
Define show action for articles controller
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -3,8 +3,17 @@ end def create + user = User.find_by(name: params[:name]) + if user and user.authenticate(params[:password]) + session[:user_id] = user.user_id + redirect_to admin_url + else + redirect_to login_url, alert 'Invalid user/password combination' + end end def destroy + session[:user_id] = nil + redirect_to store_url, notice: 'Logged out' end end
Implement login in and out by storing the user_id in the session.
diff --git a/Casks/comma-chameleon.rb b/Casks/comma-chameleon.rb index abc1234..def5678 100644 --- a/Casks/comma-chameleon.rb +++ b/Casks/comma-chameleon.rb @@ -2,6 +2,7 @@ version '0.4.0' sha256 '63d39758bad01bc439b55f53d377121e3d0e6159aef4551058d311033ee49bd8' + # github.com/theodi/comma-chameleon was verified as official when first introduced to the cask url "https://github.com/theodi/comma-chameleon/releases/download/#{version}/comma-chameleon-darwin-x64.tar.gz" appcast 'https://github.com/theodi/comma-chameleon/releases.atom', checkpoint: 'cc3f440579531be0269dc596023156ced8164ecb1e6ce71560224a0bade4b3da'
Fix `url` stanza comment for Comma Chameleon.
diff --git a/spec/unit/setting_spec.rb b/spec/unit/setting_spec.rb index abc1234..def5678 100644 --- a/spec/unit/setting_spec.rb +++ b/spec/unit/setting_spec.rb @@ -1,7 +1,21 @@ require 'spec_helper' -class SettingTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end +describe Setting do + + before :each do + load "#{Rails.root}/db/seeds.rb" + end + + it "should return the api server" do + api_server = Setting.api_server + api_server.should_not be_nil + api_server.should_not be_false + Setting.api_server.should_not be_nil + end + + it "should return true if environments are in use" do + env_setting = Setting.find_by_name("use_environments") + Setting.use_environments?.should be_false + end + end
Add unit tests or setting
diff --git a/sponges.gemspec b/sponges.gemspec index abc1234..def5678 100644 --- a/sponges.gemspec +++ b/sponges.gemspec @@ -11,7 +11,7 @@ s.homepage = "https://github.com/AF83/sponges" s.summary = "Turn any ruby object in a daemons controlling an army of sponges." s.description = "When I build some worker, I want them to be like an army of spongebob, always stressed and eager to work. sponges helps you to build this army of sponge, to control them, and, well, kill them gracefully." - s.files = `git ls-files app lib`.split("\n") + s.files = `git ls-files lib LICENSE REAMDE.md`.split("\n") s.platform = Gem::Platform::RUBY s.require_paths = ['lib'] s.add_dependency "boson"
Add the readme and license files to the gem
diff --git a/spec/unit/endpoint/builds_spec.rb b/spec/unit/endpoint/builds_spec.rb index abc1234..def5678 100644 --- a/spec/unit/endpoint/builds_spec.rb +++ b/spec/unit/endpoint/builds_spec.rb @@ -1,5 +1,42 @@ require 'spec_helper' describe Travis::Api::App::Endpoint::Builds do - it 'has to be tested' + include Travis::Testing::Stubs + + it 'works with default options' do + get('/repos.json', {}).should be_ok + end + + context '/repos.json is requested' do + before :each do + @plain_response_body = get('/repos.json').body + end + + context 'when `pretty=true` is given' do + it 'prints pretty formatted data' do + response = get('/repos.json?pretty=true') + response.should be_ok + response.body.should_not eq(@plain_response_body) + response.body.should match(/\n/) + end + end + + context 'when `pretty=1` is given' do + it 'prints pretty formatted data' do + response = get('/repos.json?pretty=1') + response.should be_ok + response.body.should_not eq(@plain_response_body) + response.body.should match(/\n/) + end + end + + context 'when `pretty=bogus` is given' do + it 'prints plain-formatted data' do + response = get('/repos.json?pretty=bogus') + response.should be_ok + response.body.should eq(@plain_response_body) + end + end + end + end
Add specs for pretty print JSON They only check that the response includes `\n`, which should not happen otherwise.
diff --git a/app/decorators/person_decorator.rb b/app/decorators/person_decorator.rb index abc1234..def5678 100644 --- a/app/decorators/person_decorator.rb +++ b/app/decorators/person_decorator.rb @@ -24,6 +24,10 @@ # end def profile_url(size: 'w300') - "#{h.configuration.base_url}#{size}#{object["profile_path"]}" + if profile_path.present? + "#{h.configuration.base_url}#{size}#{object["profile_path"]}" + else + "http://dummyimage.com/300x450/d9d9d9/000000.png&text=N/A" + end end end
Add N/A default profile for missing person profiles
diff --git a/strong_json.gemspec b/strong_json.gemspec index abc1234..def5678 100644 --- a/strong_json.gemspec +++ b/strong_json.gemspec @@ -10,7 +10,7 @@ spec.email = ["matsumoto@soutaro.com"] spec.summary = "Type check JSON objects" spec.description = "Type check JSON objects" - spec.homepage = "" + spec.homepage = "https://github.com/soutaro/strong_json" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0")
Add homepage URL to the gemspec By this change: 1. Users can jump to this repository on GitHub from rubygems.org 2. Maybe users can jump to this repository on GitHub from deppbot
diff --git a/Casks/actprinter.rb b/Casks/actprinter.rb index abc1234..def5678 100644 --- a/Casks/actprinter.rb +++ b/Casks/actprinter.rb @@ -1,6 +1,6 @@ cask :v1 => 'actprinter' do - version '3.2.1' - sha256 '979768faafd99b5714d3397ef7dd29ff085b3f7c7aac59ea6c96c4f15f0ceb6d' + version '3.2.2' + sha256 '6e49ac75f8a660e33b3f0d3033bf9788cfeef5a0838faad93f06b21af0efb2ee' # actprinter.com is the official download host per the vendor homepage url "http://www.actprinter.com/mac/ACTPrinter%20for%20Mac%20#{version}.zip"
Upgrade ACTPrinter for Mac.app to v3.2.2
diff --git a/config/initializers/client_side_validations.rb b/config/initializers/client_side_validations.rb index abc1234..def5678 100644 --- a/config/initializers/client_side_validations.rb +++ b/config/initializers/client_side_validations.rb @@ -18,3 +18,35 @@ %{<div class="field_with_errors">#{html_tag}</div>}.html_safe end end + +module ClientSideValidations + module ActionView + module Helpers + module FormHelper + def construct_validators + @validators.each_with_object({}) do |object_opts, validator_hash| + option_hash = object_opts[1].each_with_object({}) do |attr, result| + result[attr[0]] = attr[1][:options] + end + + validation_hash = + if object_opts[0].respond_to?(:client_side_validation_hash) + object_opts[0].client_side_validation_hash(option_hash) + else + {} + end + + option_hash.each_key do |attr| + # due to value of option_hash return 'Symbol', meanwhile value of validation_hash return 'String' + # =>validation_hash[attr.to_sym] + if validation_hash[attr.to_sym] + validator_hash.merge!(object_opts[1][attr][:name] => validation_hash[attr.to_sym]) + end + end + end + end + end + end + end +end +
Customize client_side_validation gem by changed ‘validation_hash[attr] => validation_hash[attr.to_sym]’ << due to value of option_hash return 'Symbol', meanwhile value of validation_hash return 'String'>>
diff --git a/app/validators/schema_validator.rb b/app/validators/schema_validator.rb index abc1234..def5678 100644 --- a/app/validators/schema_validator.rb +++ b/app/validators/schema_validator.rb @@ -28,7 +28,7 @@ attr_reader :payload, :type def schema - @schema || JSON.load(File.read(schema_filepath)) + @schema || find_schema rescue Errno::ENOENT => error if Rails.env.development? errors << missing_schema_message @@ -41,14 +41,8 @@ {} end - def schema_filepath - File.join( - ENV["GOVUK_CONTENT_SCHEMAS_PATH"], - "formats", - schema_name, - "publisher_v2", - "#{type}.json" - ) + def find_schema + GovukSchemas::Schema.find(schema_name, schema_type: type) end def schema_name @@ -64,6 +58,6 @@ end def dev_help - "Ensure GOVUK_CONTENT_SCHEMAS_PATH env varibale is set and points to the dist directory of govuk-content-schemas" + "Ensure GOVUK_CONTENT_SCHEMAS_PATH env variable is set and points to the dist directory of govuk-content-schemas" end end
Use schema gem to find schemas
diff --git a/app/workers/travis_build_killer.rb b/app/workers/travis_build_killer.rb index abc1234..def5678 100644 --- a/app/workers/travis_build_killer.rb +++ b/app/workers/travis_build_killer.rb @@ -10,14 +10,25 @@ if !first_unique_worker? logger.info "#{self.class} is already running, skipping" else - kill_builds + process_repo end end private + attr_accessor :repo + + def process_repo + @repo = CommitMonitorRepo.where(:upstream_user => "ManageIQ", :name => "manageiq").first + if @repo.nil? + logger.info "The ManageIQ/manageiq repo has not been defined. Skipping." + return + end + + kill_builds + end + def kill_builds - repo = CommitMonitorRepo.where(:upstream_user => "ManageIQ", :name => "manageiq").first repo.with_travis_service do |travis| builds_to_cancel = travis.builds .take_while { |b| b.pending? || b.canceled? }
Fix issue where TravisBuildKiller blows up when manageiq repo is missing.
diff --git a/spec/features/admin_sends_sms_spec.rb b/spec/features/admin_sends_sms_spec.rb index abc1234..def5678 100644 --- a/spec/features/admin_sends_sms_spec.rb +++ b/spec/features/admin_sends_sms_spec.rb @@ -1,7 +1,11 @@ require 'spec_helper' -describe 'foo' do - it 'foo' do - expect(true).to be_true +describe 'admin visits new notification page' do + it 'sends message' do + visit new_notifications_path + fill_in 'Number', with: '3128600685' + fill_in 'Message', with: 'Hello from test env!' + click_button 'Submit' + expect(page).to have_content('sent to') end end
Add test for sending an sms
diff --git a/spec/requests/preview_request_spec.rb b/spec/requests/preview_request_spec.rb index abc1234..def5678 100644 --- a/spec/requests/preview_request_spec.rb +++ b/spec/requests/preview_request_spec.rb @@ -13,7 +13,7 @@ it "renders markdown content" do sign_in rory post preview_path, params: valid_attributes - expect(response.body).to include "<h1>" + expect(response.body).to include '<h1 id="header-1">' end end end
Fix request spec for header id attributes Added the id attributes to the headings in html so we can link directly to section, this spec was updated to include the section name.
diff --git a/spec/support/shared_contexts/aruba.rb b/spec/support/shared_contexts/aruba.rb index abc1234..def5678 100644 --- a/spec/support/shared_contexts/aruba.rb +++ b/spec/support/shared_contexts/aruba.rb @@ -8,7 +8,7 @@ def create_test_files(files, data = 'a') Array(files).each do |s| next if s.to_s[0] == '%' - local_path = expand_path(s) + local_path = @aruba.expand_path(s) FileUtils.mkdir_p File.dirname(local_path) File.open(local_path, 'w') { |f| f << data }
Make create_test_files use correct path expansion
diff --git a/appengine/cloudsql/app.rb b/appengine/cloudsql/app.rb index abc1234..def5678 100644 --- a/appengine/cloudsql/app.rb +++ b/appengine/cloudsql/app.rb @@ -17,10 +17,12 @@ require "sinatra" require "sequel" +# [START connect] DB = Sequel.mysql2 user: ENV["MYSQL_USER"], password: ENV["MYSQL_PASSWORD"], database: ENV["MYSQL_DATABASE"], socket: ENV["MYSQL_SOCKET_PATH"] +# [END connect] get "/" do # Save visit in database
Add doc region showing connecting to MySQL database
diff --git a/spec/convection/model/template/resource/aws_efs_file_system_spec.rb b/spec/convection/model/template/resource/aws_efs_file_system_spec.rb index abc1234..def5678 100644 --- a/spec/convection/model/template/resource/aws_efs_file_system_spec.rb +++ b/spec/convection/model/template/resource/aws_efs_file_system_spec.rb @@ -10,14 +10,14 @@ end it 'allows FileSystemTags to be set' do + expected_tags = [] + expected_tags << { 'Key' => 'key-1', 'Value' => 'value-1' } + expected_tags << { 'Key' => 'key-2', 'Value' => 'value-2' } + expect(subject.render['Properties']['FileSystemTags']).to be_nil subject.tag 'key-1', 'value-1' subject.tag 'key-2', 'value-2' - expect(subject.render['Properties']['FileSystemTags']).to eq([{ - 'Key'=>'key-1', 'Value'=>'value-1' - },{ - 'Key'=>'key-2', 'Value'=>'value-2' - }]) + expect(subject.render['Properties']['FileSystemTags']).to eq(expected_tags) end it 'allows PerformanceMode to be set' do
Fix lint errors in tests.
diff --git a/lib/georgia_mailer.rb b/lib/georgia_mailer.rb index abc1234..def5678 100644 --- a/lib/georgia_mailer.rb +++ b/lib/georgia_mailer.rb @@ -10,12 +10,14 @@ Georgia.navigation += %w(messages) Georgia.permissions.merge!(inbox: { - read_messages: { guest: false, contributor: false, editor: true, admin: true, }, - print_messages: { guest: false, contributor: false, editor: true, admin: true, }, - mark_messages_as_spam: { guest: false, contributor: false, editor: true, admin: true, }, - mark_messages_as_ham: { guest: false, contributor: false, editor: true, admin: true, }, - delete_messages: { guest: false, contributor: false, editor: true, admin: true, }, - empty_trash: { guest: false, contributor: false, editor: false, admin: true, }, + read_messages: { communications: true, admin: true, }, + print_messages: { communications: true, admin: true, }, + mark_messages_as_spam: { communications: true, admin: true, }, + mark_messages_as_ham: { communications: true, admin: true, }, + delete_messages: { communications: true, admin: true, }, + empty_trash: { communications: false, admin: true, }, }) + Georgia.roles += %w(communications) + end
Add communications role for messages
diff --git a/lib/grease/adapter.rb b/lib/grease/adapter.rb index abc1234..def5678 100644 --- a/lib/grease/adapter.rb +++ b/lib/grease/adapter.rb @@ -7,8 +7,9 @@ def call(input) context = input[:environment].context_class.new(input) template = @engine.new { input[:data] } - output = template.render(context, {}) + # TODO: Hack for converting ActiveSupport::SafeBuffer into String + output = "#{template.render(context, {})}" context.metadata.merge(data: output) end end
Fix TypeError raised by ActiveSupport::SafeBuffer
diff --git a/has_public_id.gemspec b/has_public_id.gemspec index abc1234..def5678 100644 --- a/has_public_id.gemspec +++ b/has_public_id.gemspec @@ -17,7 +17,7 @@ s.test_files = Dir["test/**/*"] s.licenses = ['MIT'] - s.add_dependency "rails", "~> 4.0" + s.add_dependency "rails", "~> 5.0" s.add_development_dependency "sqlite3" end
Update rails restriction to 5
diff --git a/app/controllers/admin/companies/contacts_controller.rb b/app/controllers/admin/companies/contacts_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/companies/contacts_controller.rb +++ b/app/controllers/admin/companies/contacts_controller.rb @@ -3,6 +3,6 @@ actions :index, :show def collection - @contacts ||= apply_scopes(end_of_association_chain).page(params[:page]) + @contacts ||= apply_scopes(end_of_association_chain).order('created_at desc').page(params[:page]) end end
Order company contacts by newer first
diff --git a/lib/tasks/router.rake b/lib/tasks/router.rake index abc1234..def5678 100644 --- a/lib/tasks/router.rake +++ b/lib/tasks/router.rake @@ -12,6 +12,7 @@ task :register_routes => :router_environment do @router_api.add_route('/guidance/employment-income-manual', 'prefix', 'manuals-frontend') + @router_api.add_route('/guidance/immigration', 'prefix', 'manuals-frontend') end desc 'Register manuals-frontend application and routes with the router'
Fix for immigration placeholder manual 404ing
diff --git a/lib/webrat/sinatra.rb b/lib/webrat/sinatra.rb index abc1234..def5678 100644 --- a/lib/webrat/sinatra.rb +++ b/lib/webrat/sinatra.rb @@ -5,11 +5,13 @@ module Webrat class SinatraSession < RackSession #:nodoc: include Sinatra::Test::Methods + + attr_reader :request, :response %w(get head post put delete).each do |verb| define_method(verb) do |*args| # (path, data, headers = nil) path, data, headers = *args - params = data.merge({:env => headers || {}}) + params = data.merge(:env => headers || {}) self.__send__("#{verb}_it", path, params) get_it(@response.location, params) while @response.redirect? end
Allow accessing the request and response from SinatraSession
diff --git a/support/go_build.rb b/support/go_build.rb index abc1234..def5678 100644 --- a/support/go_build.rb +++ b/support/go_build.rb @@ -12,7 +12,8 @@ GO_ENV = { 'GOPATH' => BUILD_DIR, - 'GO15VENDOREXPERIMENT' => '1' + 'GO15VENDOREXPERIMENT' => '1', + 'GO111MODULE' => 'off' }.freeze def create_fresh_build_dir
Set Go111MODULE to 'off' during compilation Given more to the Go community moves to Go modules, one might default to GO111MODULE to on in their environment. If this is done, this project fails to compile. By setting the environment for the compilation this is fixed.
diff --git a/config/environments/development.rb b/config/environments/development.rb index abc1234..def5678 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -10,7 +10,7 @@ config.assets.compress = false config.assets.debug = true config.cache_classes = false - config.cache_store = :null_store + config.cache_store = :memory_store config.consider_all_requests_local = true config.eager_load = false config.session_store :cookie_store, key: '_gradecraft_session'
Change the cache store to a memory store so that caching will be performed if it is turned on
diff --git a/db/migrate/20120809184458_longer_url_fields.rb b/db/migrate/20120809184458_longer_url_fields.rb index abc1234..def5678 100644 --- a/db/migrate/20120809184458_longer_url_fields.rb +++ b/db/migrate/20120809184458_longer_url_fields.rb @@ -0,0 +1,11 @@+class LongerUrlFields < ActiveRecord::Migration + def up + change_column :discussions, :url, :string, limit: 2048 + change_column :pages, :url, :string, limit: 2048 + end + + def down + change_column :pages, :url, :string, limit: 255 + change_column :discussions, :url, :string, limit: 255 + end +end
Expand URL fields from 255 to 2048 * discussions and pages
diff --git a/src/controllers/systems_controller.rb b/src/controllers/systems_controller.rb index abc1234..def5678 100644 --- a/src/controllers/systems_controller.rb +++ b/src/controllers/systems_controller.rb @@ -23,4 +23,11 @@ get '/:id' do json System.find(params[:id]) end + + post '/' do + system = System.new params + system.save + + json system + end end
Add API as "POST /systems" to create system entry.
diff --git a/test/test_helper.rb b/test/test_helper.rb index abc1234..def5678 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -4,6 +4,8 @@ require_relative "../test/dummy/config/environment" ActiveRecord::Migrator.migrations_paths = [File.expand_path("../test/dummy/db/migrate", __dir__)] require "rails/test_help" + +require "byebug" # Filter out Minitest backtrace while allowing backtrace from other libraries # to be shown.
Make debugger available in testing
diff --git a/core/app/models/spree/log_entry.rb b/core/app/models/spree/log_entry.rb index abc1234..def5678 100644 --- a/core/app/models/spree/log_entry.rb +++ b/core/app/models/spree/log_entry.rb @@ -1,5 +1,16 @@ module Spree class LogEntry < ActiveRecord::Base belongs_to :source, :polymorphic => true + + # Fix for #1767 + # If a payment fails, we want to make sure we keep the record of it failing + after_rollback :save_anyway + + def save_anyway + log = Spree::LogEntry.new + log.source = source + log.details = details + log.save! + end end end
Save LogEntry records if they are being rolled back Related to #1767
diff --git a/lib/react_on_rails/git_utils.rb b/lib/react_on_rails/git_utils.rb index abc1234..def5678 100644 --- a/lib/react_on_rails/git_utils.rb +++ b/lib/react_on_rails/git_utils.rb @@ -2,8 +2,8 @@ module GitUtils def self.uncommitted_changes?(message_handler) return false if ENV["COVERAGE"] - status = `git status` - return false if status.include?("nothing to commit, working directory clean") + status = `git status --porcelain` + return false if status.empty? error = "You have uncommitted code. Please commit or stash your changes before continuing" message_handler.add_error(error) true
Check uncommited code in a project.
diff --git a/app/controllers/problem_reports_controller.rb b/app/controllers/problem_reports_controller.rb index abc1234..def5678 100644 --- a/app/controllers/problem_reports_controller.rb +++ b/app/controllers/problem_reports_controller.rb @@ -17,7 +17,7 @@ end def current_user_params - if logged_in? + if logged_in_regular? { person_email: current_user.email, person_id: current_user.id } else {}
Fix report problem form for readonly user
diff --git a/core/lib/spree/localized_number.rb b/core/lib/spree/localized_number.rb index abc1234..def5678 100644 --- a/core/lib/spree/localized_number.rb +++ b/core/lib/spree/localized_number.rb @@ -8,7 +8,9 @@ separator, delimiter = I18n.t([:'number.currency.format.separator', :'number.currency.format.delimiter']) non_number_characters = /[^0-9\-#{separator}]/ - # strip everything else first + # work on a copy, prevent original argument modification + number = number.dup + # strip everything else first, including thousands delimiter number.gsub!(non_number_characters, '') # then replace the locale-specific decimal separator with the standard separator if necessary number.gsub!(separator, '.') unless separator == '.'
Fix of bug in `Spree::LocalizedNumber.parse`, which mangles object passed as an argument.
diff --git a/test/config_test.rb b/test/config_test.rb index abc1234..def5678 100644 --- a/test/config_test.rb +++ b/test/config_test.rb @@ -0,0 +1,9 @@+require 'minitest/autorun' +require_relative '../lib/tritium/config' + +class ConfigTest < MiniTest::Unit::TestCase + + def test_functional_location + assert File.exists?(Tritium.functional_test_location), "can't find functional tests" + end +end
Write a test for the functional_test_location
diff --git a/picturefill.gemspec b/picturefill.gemspec index abc1234..def5678 100644 --- a/picturefill.gemspec +++ b/picturefill.gemspec @@ -16,4 +16,8 @@ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.require_paths = ["lib"] + + gem.add_development_dependency "rspec-rails" + gem.add_development_dependency "rails" + gem.add_development_dependency "sqlite3" end
Add spec dependencies to gemspec
diff --git a/examples/watir/features/steps/stories_steps.rb b/examples/watir/features/steps/stories_steps.rb index abc1234..def5678 100644 --- a/examples/watir/features/steps/stories_steps.rb +++ b/examples/watir/features/steps/stories_steps.rb @@ -9,7 +9,7 @@ Watir::Browser = Watir::IE when /java/ require 'celerity' - Watir::Browser = Celerity::Browser + module Watir; Browser = Celerity::Browser; end else raise "This platform is not supported (#{PLATFORM})" end
Make Watir example run on Celerity again (broken by 9d00123).
diff --git a/lib/tasks/octopress_import.rake b/lib/tasks/octopress_import.rake index abc1234..def5678 100644 --- a/lib/tasks/octopress_import.rake +++ b/lib/tasks/octopress_import.rake @@ -25,7 +25,7 @@ paths.each do |name| album_data = YAML.load_file(File.join(root_path, name, index_filename)) photo = Photo.where(path: name, filename: album_data['cover']).first - raise "can't find photo #{name}#{album_data['cover']}" unless photo + raise "can't find photo #{name}/#{album_data['cover']}" unless photo album = Album.where(title: album_data['title']).first_or_create album.update_attributes(cover_photo: photo) end
Fix album import error message
diff --git a/test/test_helper.rb b/test/test_helper.rb index abc1234..def5678 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -6,7 +6,7 @@ $:.unshift File.expand_path("../../lib") require 'beaneater' require 'timeout' -require 'mocha' +require 'mocha/setup' rescue require 'mocha' require 'json' class MiniTest::Unit::TestCase
Fix mocha initialization deprecation warning Maintains compatability with all versions of mocha
diff --git a/test/test_helper.rb b/test/test_helper.rb index abc1234..def5678 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,8 +1,8 @@+require 'coveralls' +Coveralls.wear! + require 'ruby-bbcode' require "minitest/autorun" -require 'coveralls' - -Coveralls.wear! # This hack allows us to make all the private methods of a class public. class Class
Make sure coveralls is initialized before anything else
diff --git a/test/test_helper.rb b/test/test_helper.rb index abc1234..def5678 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -19,4 +19,9 @@ ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__) # Load support files -Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }+Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f } + +# Clear mongo db +Mongoid.master.collections.select do |collection| + collection.name !~ /system/ +end.each(&:drop)
Clean mongo db before running tests
diff --git a/spec/unit/veritas/relation/materialized/class_methods/new_spec.rb b/spec/unit/veritas/relation/materialized/class_methods/new_spec.rb index abc1234..def5678 100644 --- a/spec/unit/veritas/relation/materialized/class_methods/new_spec.rb +++ b/spec/unit/veritas/relation/materialized/class_methods/new_spec.rb @@ -16,7 +16,10 @@ its(:header) { should equal(header) } - its(:directions) { should == directions } + its(:directions) do + should be_instance_of(Relation::Operation::Order::DirectionSet) + should == directions + end it { should == tuples } end
Add spec for direction coercion in a materialized relation
diff --git a/lib/doorkeeper_sso_client/mixins/controller_helpers.rb b/lib/doorkeeper_sso_client/mixins/controller_helpers.rb index abc1234..def5678 100644 --- a/lib/doorkeeper_sso_client/mixins/controller_helpers.rb +++ b/lib/doorkeeper_sso_client/mixins/controller_helpers.rb @@ -9,11 +9,10 @@ unless options[:skip_devise_hook] class_eval <<-METHODS, __FILE__, __LINE__ + 1 - def authenticate_#{scope}_with_passport! + def authenticate_#{scope}! validate_passport! - authenticate_#{scope}_without_passport! + super end - alias_method_chain :authenticate_#{scope}!, :passport METHODS end end
Use superclassing instead of alias method as it breaks loading (routes defined way later)
diff --git a/lib/array_cartesian_product.rb b/lib/array_cartesian_product.rb index abc1234..def5678 100644 --- a/lib/array_cartesian_product.rb +++ b/lib/array_cartesian_product.rb @@ -17,7 +17,7 @@ end def minimum_length_cartesian_terms(b) - carts = self.cartesian_product(b).map { |a| a.flatten.uniq }.uniq + carts = self.cartesian_product(b).map { |a| a.flatten.uniq.sort }.uniq return [] if carts.empty? minLength = carts.min { |a, b| a.length <=> b.length }.length
Fix cartesian product to sort terms to avoid dups like [a,b],[b,a]
diff --git a/lib/coverband/utils/railtie.rb b/lib/coverband/utils/railtie.rb index abc1234..def5678 100644 --- a/lib/coverband/utils/railtie.rb +++ b/lib/coverband/utils/railtie.rb @@ -2,6 +2,18 @@ Coverband.eager_loading_coverage! module Coverband + module RailsEagerLoad + def eager_load! + Coverband.configuration.logger&.debug('Coverband: set to eager_loading') + Coverband.eager_loading_coverage! + super + ensure + Coverband.report_coverage(true) + Coverband.runtime_coverage! + end + end + Rails::Engine.prepend(RailsEagerLoad) + class Railtie < Rails::Railtie initializer 'coverband.configure' do |app| app.middleware.use Coverband::Middleware
Set to eager_loading when rails eager_load! called
diff --git a/lib/netsuite/support/fields.rb b/lib/netsuite/support/fields.rb index abc1234..def5678 100644 --- a/lib/netsuite/support/fields.rb +++ b/lib/netsuite/support/fields.rb @@ -60,13 +60,6 @@ read_only_fields << name_sym field name end - - # a bit of trickery: this is for classes which inherit from other classes - # i.e. the AssemblyItem, KitItem, etc; this copies the superclass's fields over - def inherited(klass) - klass.instance_variable_set("@fields", self.fields) - klass.instance_variable_set("@read_only_fields", self.read_only_fields) - end end end
Remove class inheritance instance variable hack
diff --git a/lib/refinery/tasks/refinery.rb b/lib/refinery/tasks/refinery.rb index abc1234..def5678 100644 --- a/lib/refinery/tasks/refinery.rb +++ b/lib/refinery/tasks/refinery.rb @@ -2,7 +2,7 @@ # So here, we find them (if there are any) and include them into rake. extra_rake_tasks = [] if defined?(Refinery) && Refinery.is_a_gem - extra_rake_tasks << Dir[Refinery.root.join("vendor", "plugins", "*", "**", "tasks", "**", "*", "*.rake")].sort + extra_rake_tasks << Dir[Refinery.root.join("vendor", "plugins", "*", "**", "tasks", "**", "*", "*.rake").to_s].sort end # We also need to load in the rake tasks from gem plugins whether Refinery is a gem or not:
Fix pathname because of different interface in 1.9.x
diff --git a/lib/tasks/mnemosyne/clean.rake b/lib/tasks/mnemosyne/clean.rake index abc1234..def5678 100644 --- a/lib/tasks/mnemosyne/clean.rake +++ b/lib/tasks/mnemosyne/clean.rake @@ -19,9 +19,9 @@ end ActiveRecord::Base.connection.execute <<~SQL - SELECT drop_chunks(#{cutoff}, 'traces', NULL); - SELECT drop_chunks(#{cutoff}, 'spans', NULL); - SELECT drop_chunks(#{cutoff}, 'failures', NULL); + SELECT _timescaledb_internal.drop_chunks_impl(#{cutoff}, 'traces', NULL); + SELECT _timescaledb_internal.drop_chunks_impl(#{cutoff}, 'spans', NULL); + SELECT _timescaledb_internal.drop_chunks_impl(#{cutoff}, 'failures', NULL); SQL logger.info do
Use another internal impl as drop_chunks does not accept BIGINT
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -4,6 +4,6 @@ RSpec.configure do |c| c.before(:each) do redis = Forgetsy.redis - redis.flushdb + redis.redis.flushdb # Avoid blind passthrough end end
Fix redis-namespace blind passthrough deprecation