diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/spec/core/users_spec.rb b/spec/core/users_spec.rb index abc1234..def5678 100644 --- a/spec/core/users_spec.rb +++ b/spec/core/users_spec.rb @@ -1,8 +1,6 @@ require 'spec_helper' -%w(cumulus rocket turtle).each do |username| - describe user(username) do - it { should exist } - it { should belong_to_group 'sudo' } - end +describe user('cumulus') do + it { should exist } + it { should belong_to_group 'sudo' } end
Remove tests for 'rocket' & 'turtle' users
diff --git a/spec/factories/tools.rb b/spec/factories/tools.rb index abc1234..def5678 100644 --- a/spec/factories/tools.rb +++ b/spec/factories/tools.rb @@ -2,6 +2,6 @@ factory :tool do tool_slot device - name { Faker::Pokemon.name } + name { Faker::Pokemon.name + Faker::Pokemon.name } end end
Change FactoryGirl to make tool names more unique
diff --git a/cookbooks/devgrid/definitions/mysql.rb b/cookbooks/devgrid/definitions/mysql.rb index abc1234..def5678 100644 --- a/cookbooks/devgrid/definitions/mysql.rb +++ b/cookbooks/devgrid/definitions/mysql.rb @@ -10,8 +10,8 @@ define :mysql_add_grants_for_user do execute "add_mysql_grants" do command "mysql -uroot -p#{node["mysql-root-password"]} - -e \"GRANT ALL ON #{params["database"]}.* - TO '#{params[:name]}'@'%' IDENTIFIED BY '#{params["password"]}';\"" + -e \"GRANT ALL ON #{params[:database]}.* + TO '#{params[:name]}'@'%' IDENTIFIED BY '#{params[:password]}';\"" end end
Fix problem with params in defenition
diff --git a/TWTValidation.podspec b/TWTValidation.podspec index abc1234..def5678 100644 --- a/TWTValidation.podspec +++ b/TWTValidation.podspec @@ -20,5 +20,5 @@ s.source_files = 'TWTValidation/**/*.{h,m}' - s.ios.resource_bundle = { 'TWTValidation' => 'TWTValidation/Supporting Files/*.lproj' } + s.ios.resource = 'TWTValidation/Supporting Files/*.lproj' end
Change podspec so strings table can be found
diff --git a/week-5/gps2_2.rb b/week-5/gps2_2.rb index abc1234..def5678 100644 --- a/week-5/gps2_2.rb +++ b/week-5/gps2_2.rb @@ -0,0 +1,70 @@+#Input: String for product, Integer for quantity +#Output: Hash containing product & quantity +#Methods: +#1) Create a list: No inputs, Hash output +#2) Add an item/quantity: String/integer input and Hash input, Hash output +#3) Remove item: String and Hash input, Hash output +#4) Update quantities: String/Integer and Hash input, Hash output +#5) Print List: Hash input, string output + +#Method 1 +#Create a new Hash and return empty Hash + +#Method 2 +#Add string to hash key and set key value to quantity +#Return modified hash + +#Method 3 +#Find string input in hash keys +#Remove key and value from Hash +#Return hash + +#Method 4 +#Find string input in hash keys +#Update key value to new quantity (input integer) +#Return Hash + +#Method 5 +#Read each key value pair in Hash +#Print out each pair as a line item + +#Method 1 +def new_grocery_list + {} +end + +#Method 2 +def add_to_grocery_list(new_product, new_quantity, my_list) + my_list[new_product] = new_quantity + my_list +end + +#Method 3 +def remove_from_grocery_list(remove_product, my_list) + my_list.delete(new_product) + my_list +end + +#Method 4 +def update_quantity_in_list(product, new_quantity, my_list) + my_list[product] = new_quantity + my_list +end + +#Method 5 +def print_list(my_list) + my_list.each{|key, value| puts key + " " + value.to_s} +end + +#What did you learn about pseudocode from working on this challenge? + #The psuedocode for this assignment wasn't terribly complicated in terms of logic. Breaking down each method and specifying the inputs and outputs for each was helpful since we were building multiple methods and keeping track of inputs/outputs could get confusing. +#What are the tradeoffs of using Arrays and Hashes for this challenge? + #Hashes are easer to call since you have to add/modify products and quantities. Hashes eliminate the need for a search function. +#What does a method return? + #A method returns the last executed statement of the method. When addind products and quantities to the list, I needed to call the list at the end to make sure we returned the full hash and not just the quantity of product added. +#What kind of things can you pass into methods as arguments? + #Any variables can be passed through, including hashes, strings, and values. +#How can you pass information between methods? + #Without using classes, the modified variables need to be returned in each method so that they can then be passed on to the next method. +#What concepts were solidified in this challenge, and what concepts are still confusing? + #The process of 'returning' objects was solidified, as well as modifying elements in a hash.
Add reflection for GPS 2.2
diff --git a/lib/awesome_print/ext/action_view.rb b/lib/awesome_print/ext/action_view.rb index abc1234..def5678 100644 --- a/lib/awesome_print/ext/action_view.rb +++ b/lib/awesome_print/ext/action_view.rb @@ -3,15 +3,16 @@ # Awesome Print is freely distributable under the terms of MIT license. # See LICENSE file or http://www.opensource.org/licenses/mit-license.php #------------------------------------------------------------------------------ -module AwesomePrintActionView +module AwesomePrint + module ActionView - # Use HTML colors and add default "debug_dump" class to the resulting HTML. - def ap_debug(object, options = {}) - object.ai(options.merge(:html => true)).sub(/^<pre([\s>])/, '<pre class="debug_dump"\\1') + # Use HTML colors and add default "debug_dump" class to the resulting HTML. + def ap_debug(object, options = {}) + object.ai(options.merge(:html => true)).sub(/^<pre([\s>])/, '<pre class="debug_dump"\\1') + end + + alias_method :ap, :ap_debug end - - alias_method :ap, :ap_debug - end -ActionView::Base.send(:include, AwesomePrintActionView) if defined?(ActionView) +ActionView::Base.send(:include, AwesomePrint::ActionView) if defined?(ActionView)
Use better namespace for ActionView plugin
diff --git a/lib/code/generator/java_generator.rb b/lib/code/generator/java_generator.rb index abc1234..def5678 100644 --- a/lib/code/generator/java_generator.rb +++ b/lib/code/generator/java_generator.rb @@ -30,6 +30,12 @@ return if schemas.nil? || schemas.empty? @logger.info ' > Generate Java Beans.' + model_dir = File.join @output_dir, 'model' + unless File.exist? model_dir + @logger.debug "Creating directory path #{model_dir}" + FileUtils.mkdir_p model_dir + end + parser = DataSchemaParser.new do |p| p.namespace = @namespace p.language = @language @@ -41,7 +47,9 @@ parser.data_schema = value hash = parser.parse - @builder.build_model hash + content = @builder.build_model hash + + write_source_file('model', hash['class'].name, content) end end end
Write Java bean source file.
diff --git a/spec/commands/build_spec.rb b/spec/commands/build_spec.rb index abc1234..def5678 100644 --- a/spec/commands/build_spec.rb +++ b/spec/commands/build_spec.rb @@ -17,30 +17,27 @@ it { should raise_error } end - context 'building each format' do - Polytexnic::FORMATS.each do |format| - subject { - lambda { - silence { Polytexnic::Commands::Build.for_format format } - } - } + context 'building all' do + subject(:build) { Polytexnic::Commands::Build } - it { should_not raise_error } - end - end + it { should respond_to(:all_formats) } + it "should build all formats" do + pdf_builder = build.builder_for('pdf') + html_builder = build.builder_for('html') + epub_builder = build.builder_for('epub') + mobi_builder = build.builder_for('mobi') - context 'building all' do - subject { - lambda { - silence { Polytexnic::Commands::Build.all_formats } - } - } + pdf_builder .should_receive(:build!) + html_builder.should_receive(:build!) + epub_builder.should_receive(:build!) + mobi_builder.should_receive(:build!) - it { should_not raise_error } + build.should_receive(:builder_for).with('pdf') .and_return(pdf_builder) + build.should_receive(:builder_for).with('html').and_return(html_builder) + build.should_receive(:builder_for).with('epub').and_return(epub_builder) + build.should_receive(:builder_for).with('mobi').and_return(mobi_builder) - after(:all) do - chdir_to_md_book - Polytexnic::Builders::Html.new.clean! + build.all_formats end end end
Use message expectations to speed up the build spec This commit also removes some (very slow) tests for `build!` that are already tested in the tests for individual builders. [#52758883]
diff --git a/lib/design_wizard/visitor_pattern.rb b/lib/design_wizard/visitor_pattern.rb index abc1234..def5678 100644 --- a/lib/design_wizard/visitor_pattern.rb +++ b/lib/design_wizard/visitor_pattern.rb @@ -17,17 +17,19 @@ self.class.visit_actions end - def self.initialize(visitor) - visitor.extend ClassMethods - visitor.reset_visit_actions - end + class << self + def initialize(visitor) + visitor.extend ClassMethods + visitor.reset_visit_actions + end - def self.included(visitor) - initialize visitor - end + def included(visitor) + initialize visitor + end - def self.extended(visitor) - initialize visitor + def extended(visitor) + initialize visitor + end end module ClassMethods
Change to a more rubyist syntax for class methods
diff --git a/spec/license_fields_spec.rb b/spec/license_fields_spec.rb index abc1234..def5678 100644 --- a/spec/license_fields_spec.rb +++ b/spec/license_fields_spec.rb @@ -0,0 +1,15 @@+# frozen_string_literal: true + +require 'spec_helper' + +describe 'license fillable fields' do + licenses.each do |license| + context "The #{license['title']} license" do + it 'should only contain supported fillable fields' do + matches = license['content'][0, 1000].scan(/\[([a-z]+)\]/) + extra_fields = matches.flatten - (fields.map { |f| f['name'] }) + expect(extra_fields).to be_empty + end + end + end +end
Revert "rm no longer relevant test" This reverts commit 5e7b07f998e9264092b8e1274f99605ead412138.
diff --git a/spec/models/article_spec.rb b/spec/models/article_spec.rb index abc1234..def5678 100644 --- a/spec/models/article_spec.rb +++ b/spec/models/article_spec.rb @@ -1,6 +1,27 @@ require 'spec_helper' describe Article do + let(:article) { FactoryGirl.build :article } + it { should belong_to :author } - it { should have_and_belong_to_many :tags } -end + it { pending "shoulda is being stupid with Rails 4 association reflections"; should have_and_belong_to_many :tags } + it { should have_many :revisions } + + context "#revisions" do + let(:editor){ FactoryGirl.create(:user) } + let(:revision) { FactoryGirl.create(:revision, editor: editor) } + + context "creating an article" do + before do + article.save + end + + it "has one revision that matches the article content" do + article.revisions.count.should eq 1 + article.revisions.first.content.should match article.content + end + end + + context "updating an article" + end +end
Add specs to article to cover the revision feature.
diff --git a/config/cronic.d/jobs.rb b/config/cronic.d/jobs.rb index abc1234..def5678 100644 --- a/config/cronic.d/jobs.rb +++ b/config/cronic.d/jobs.rb @@ -9,8 +9,8 @@ end # Notebook click summaries -# Hourly, with a gap during nightly computation -cron '0 0-3,12-23 * * * UTC' do +# Run at 0100am daily +cron '0 1 * * * UTC' do ScheduledJobs.run(:notebook_summaries) end @@ -21,8 +21,8 @@ end # User click summaries -# Every 4 hours, with a gap during nightly computation -cron '15 0,12,16,20 * * * UTC' do +# Run at 1235am daily +cron '35 0 * * * UTC' do ScheduledJobs.run(:user_summaries) end
Move more computation to the middle of the night
diff --git a/lib/fog/openstack/requests/compute/get_hypervisor_statistics.rb b/lib/fog/openstack/requests/compute/get_hypervisor_statistics.rb index abc1234..def5678 100644 --- a/lib/fog/openstack/requests/compute/get_hypervisor_statistics.rb +++ b/lib/fog/openstack/requests/compute/get_hypervisor_statistics.rb @@ -0,0 +1,39 @@+module Fog + module Compute + class OpenStack + class Real + def get_hypervisor_statistics(tenant_id) + request( + :expects => 200, + :method => 'GET', + :path => "/#{tenant_id}​/os-hypervisors/statistics" + ) + end + end + + class Mock + def get_hypervisor_statistics(tenant_id) + response = Excon::Response.new + response.status = 200 + response.body = { + "hypervisor_statistics" => { + "count" => 1, + "current_workload" => 0, + "disk_available_least" => 0, + "free_disk_gb" => 1028, + "free_ram_mb" => 7680, + "local_gb" => 1028, + "local_gb_used" => 0, + "memory_mb" => 8192, + "memory_mb_used" => 512, + "running_vms" => 0, + "vcpus" => 1, + "vcpus_used" => 0 + } + } + response + end + end + end + end +end
Add endpoint for hypervisor stats.
diff --git a/lib/attachinary/orm/base_extension.rb b/lib/attachinary/orm/base_extension.rb index abc1234..def5678 100644 --- a/lib/attachinary/orm/base_extension.rb +++ b/lib/attachinary/orm/base_extension.rb @@ -44,7 +44,7 @@ # ... # end define_method :"#{options[:scope]}_url=" do |url| - send(:"#{options[:scope]}=", Cloudinary::Uploader.upload(url)) + send(:"#{options[:scope]}=", Cloudinary::Uploader.upload(url, resource_type: "auto")) end else @@ -52,7 +52,7 @@ # ... # end define_method :"#{options[:singular]}_urls=" do |urls| - send(:"#{options[:scope]}=", urls.map { |url| Cloudinary::Uploader.upload(url) }) + send(:"#{options[:scope]}=", urls.map { |url| Cloudinary::Uploader.upload(url, resource_type: "auto") }) end end
Add resource_type argument for uploading with url
diff --git a/lib/sunspot-rails-http-basic-auth.rb b/lib/sunspot-rails-http-basic-auth.rb index abc1234..def5678 100644 --- a/lib/sunspot-rails-http-basic-auth.rb +++ b/lib/sunspot-rails-http-basic-auth.rb @@ -3,4 +3,10 @@ require 'sunspot-rails-http-basic-auth/rsolr/connection/net_http' require 'sunspot-rails-http-basic-auth/sunspot/rails' -require 'sunspot-rails-http-basic-auth/sunspot/rails/configuration'+require 'sunspot-rails-http-basic-auth/sunspot/rails/configuration' + + +if Rails::VERSION::MAJOR == 2 + # reload the session that was already initialized when sunspot-rails gem loaded + Sunspot.session = Sunspot::Rails.build_session +end
Patch to make this gem work with Rails 2 - the order it loads gems is different in Rails 2 and Rails 3 since we don't have Railties and the initializer block in Rails2
diff --git a/lib/travis/worker/cli/development.rb b/lib/travis/worker/cli/development.rb index abc1234..def5678 100644 --- a/lib/travis/worker/cli/development.rb +++ b/lib/travis/worker/cli/development.rb @@ -11,7 +11,7 @@ class Job < Thor desc "publish", "Publish a sample job payload" method_option :slug, :default => "ruby-amqp/amq-protocol" - method_option :commit, :default => "455e5f51605" + method_option :commit, :default => "e54c27a8d1c0f4df0fc9" method_option :branch, :default => "master" def publish payload = {
Modify published payload to match fixtures
diff --git a/app/controllers/feedback_controller.rb b/app/controllers/feedback_controller.rb index abc1234..def5678 100644 --- a/app/controllers/feedback_controller.rb +++ b/app/controllers/feedback_controller.rb @@ -14,7 +14,7 @@ redirect_to root_url flash[:success]= raw(t 'alert.feedback.success') else - flash[:error]= raw(t 'alert.feedback.fail', :errors => flash_errors(@feedback)) + flash.now[:error]= raw(t 'alert.feedback.fail', :errors => flash_errors(@feedback)) render :new end end
Stop feedback error alerts from persisting onto the home page
diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index abc1234..def5678 100644 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -13,6 +13,10 @@ else p "Something went wrong" end + end + + def show + end def edit
Add show action to profile controller
diff --git a/test/unit/peddler/test_operation.rb b/test/unit/peddler/test_operation.rb index abc1234..def5678 100644 --- a/test/unit/peddler/test_operation.rb +++ b/test/unit/peddler/test_operation.rb @@ -1,5 +1,5 @@ require 'helper' -require 'peddler/Operation' +require 'peddler/operation' class OperationTest < MiniTest::Test def setup
Fix faulty require in test
diff --git a/app/controllers/day_controller.rb b/app/controllers/day_controller.rb index abc1234..def5678 100644 --- a/app/controllers/day_controller.rb +++ b/app/controllers/day_controller.rb @@ -1,20 +1,33 @@ class DayController < ApplicationController - get '/:date?', authentication: true do - @date_string = params[:date] || Date.today.to_s + get '/:date?', authentication: true do |date_string| + @date_string = date_string || Date.today.to_s date = Date.parse(@date_string) - @lists = ListRepository.find_by_date(date) + @lists = List.find_by_date(date, user_id) - slim :'day/day' + slim :'day/index' end - post '/:date/list', authentication: true do - ListRepository.create_empty(params[:title], params[:date]) + post '/:date/list', authentication: true do |date| + List.create_empty(params[:title], date, user_id) + redirect to "/#{date}" end - private + delete '/:date/list/:id', authentication: true do |date, id| + List.delete_by_id(id, user_id) + redirect to "/#{date}" + end - def get_date(params) - date_string = params[:date] || Date.today.to_s - Date.parse(date_string) + post '/:date/list/:id', authentication: true do |date, id| + list = List.find_by_id(id, user_id) + list.add(params[:text]) if list + + redirect to "/#{date}" + end + + delete '/:date/list/:id/:item_id', authentication: true do |date, list_id, item_id| + list = List.find_by_id(list_id, user_id) + list.remove(item_id) if list + + redirect to "/#{date}" end end
Add endpoints for deleting lists, adding and removing items to/from a list
diff --git a/app/controllers/dog_controller.rb b/app/controllers/dog_controller.rb index abc1234..def5678 100644 --- a/app/controllers/dog_controller.rb +++ b/app/controllers/dog_controller.rb @@ -1,4 +1,8 @@+require 'rack-flash' + class DogController < ApplicationController + use Rack::Flash + before do if !logged_in? redirect '/login' @@ -21,6 +25,7 @@ post '/dogs' do current_user.dogs.build(name: params[:name]).save + flash[:message] = "Successfully added a dog!" redirect '/dogs' end @@ -37,6 +42,7 @@ dog = Dog.find(params[:id]) if dog.user_id == current_user.id dog.update(name: params[:name]) + flash[:message] = "Successfully updated a dog!" end redirect '/dogs' end @@ -45,6 +51,7 @@ dog = Dog.find(params[:id]) if dog.user_id == current_user.id Dog.destroy(dog.id) + flash[:message] = "Successfully deleted a dog!" end redirect '/dogs' end
Add flash messages to dogs.
diff --git a/app/inputs/image_preview_input.rb b/app/inputs/image_preview_input.rb index abc1234..def5678 100644 --- a/app/inputs/image_preview_input.rb +++ b/app/inputs/image_preview_input.rb @@ -1,6 +1,6 @@ class ImagePreviewInput < SimpleForm::Inputs::Base - def input + def input(wrapper_options = nil) resize = options.delete(:size) || '350x100>' size = resize.sub(/\D$/,'') keys = options.delete(:attribute_keys)
Update input definitions to new simple_form specs According to https://github.com/plataformatec/simple_form/pull/997, instead of *def input*, one should use *def input(wrapper_options)*
diff --git a/app/jobs/document_indexing_job.rb b/app/jobs/document_indexing_job.rb index abc1234..def5678 100644 --- a/app/jobs/document_indexing_job.rb +++ b/app/jobs/document_indexing_job.rb @@ -28,6 +28,10 @@ # # 3 | 2 | 2 # # 1 | 3 | 2 # # 2 | 3 | 2 + # + # Notes: This is pretty bad because it's in O((n-1)!). A way to improve it would be to add matches using and + # querying using the following query: SELECT * FROM document_matches where reference_document_id = ? + # OR compared_document_id = ? ORDER BY array_length(fingerprints, 1) DESC def perform(document_id) reference = Document.find(document_id)
Document how we can improve the indexing job
diff --git a/app/admin/api_key.rb b/app/admin/api_key.rb index abc1234..def5678 100644 --- a/app/admin/api_key.rb +++ b/app/admin/api_key.rb @@ -18,6 +18,11 @@ end form do |f| + unless f.object.new_record? + f.inputs "Api Key Details" do + f.input :access_token + end + end f.actions end end
Allow edit of access token in admin panel
diff --git a/spec/versioner_spec.rb b/spec/versioner_spec.rb index abc1234..def5678 100644 --- a/spec/versioner_spec.rb +++ b/spec/versioner_spec.rb @@ -29,6 +29,7 @@ Kosmos::Versioner.mark_preinstall(ksp_dir, package) expect(`git ls-files --others`).to be_empty + expect(`git log -1 --pretty=%B`).to eq "PRE: Example\n" end end end
Test for the commit message of mark_preinstall.
diff --git a/app/models/services/irc_bot_spammer.rb b/app/models/services/irc_bot_spammer.rb index abc1234..def5678 100644 --- a/app/models/services/irc_bot_spammer.rb +++ b/app/models/services/irc_bot_spammer.rb @@ -1,6 +1,6 @@ require 'socket' -class IrcBotSpammer +class Services::IrcBotSpammer IRC_BOT_SOCKET = File.join '', 'tmp', 'ircbot.sock' def self.send_message(message)
Put the IRC bot notification sender in Services
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 @@ -7,8 +7,7 @@ :annotation_original, :annotation_translated, :original_language, - :translation_language, - :tags + :translation_language ) belongs_to :rightholder @@ -17,4 +16,5 @@ belongs_to :license has_many :chunks + has_many :tags end
Add has_many :tags to material serializer
diff --git a/app/sources/releases/metal_archives.rb b/app/sources/releases/metal_archives.rb index abc1234..def5678 100644 --- a/app/sources/releases/metal_archives.rb +++ b/app/sources/releases/metal_archives.rb @@ -13,11 +13,11 @@ end def description - metal_archives.comment&.sanitize&.squish + metal_archives.notes&.sanitize&.squish end def released_at - metal_archives.released_at + metal_archives.date_released end private
Use correct release MA attributes
diff --git a/lib/guard/webpack/runner.rb b/lib/guard/webpack/runner.rb index abc1234..def5678 100644 --- a/lib/guard/webpack/runner.rb +++ b/lib/guard/webpack/runner.rb @@ -53,10 +53,13 @@ def run_webpack begin - system("#{webpack_bin} --watch #{option_flags}") + pid = fork{ exec("#{webpack_bin} --watch #{option_flags}") } + Process.wait(pid) rescue # TODO: Be more discerning. ::Guard::UI.error "Webpack unable to start (are you sure it's installed?)" + ensure + Process.kill('TERM',pid) end end
Use fork-exec, to ensure webpack process is killed on thread stop.
diff --git a/spec/functional/mixin/shell_out_spec.rb b/spec/functional/mixin/shell_out_spec.rb index abc1234..def5678 100644 --- a/spec/functional/mixin/shell_out_spec.rb +++ b/spec/functional/mixin/shell_out_spec.rb @@ -0,0 +1,56 @@+# +# Copyright:: Copyright (c) 2014 Chef Software, Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require 'spec_helper' + +describe Chef::Mixin::ShellOut do + include Chef::Mixin::ShellOut + + describe "shell_out_with_systems_locale" do + describe "when environment['LC_ALL'] is not set" do + it "should use the default shell_out setting" do + cmd = if windows? + shell_out_with_systems_locale('echo %LC_ALL%') + else + shell_out_with_systems_locale('echo $LC_ALL') + end + + # From mixlib-shellout/lib/mixlib/shell_out.rb: + # + # * +environment+: a Hash of environment variables to set before the command + # is run. By default, the environment will *always* be set to 'LC_ALL' => 'C' + # to prevent issues with multibyte characters in Ruby 1.8. To avoid this, + # use :environment => nil for *no* extra environment settings, or + # :environment => {'LC_ALL'=>nil, ...} to set other environment settings + # without changing the locale. + cmd.stdout.chomp.should eq 'C' + end + end + + describe "when environment['LC_ALL'] is set" do + it "should use the option's setting" do + cmd = if windows? + shell_out_with_systems_locale('echo %LC_ALL%', :environment => {'LC_ALL' => 'POSIX'}) + else + shell_out_with_systems_locale('echo $LC_ALL', :environment => {'LC_ALL' => 'POSIX'}) + end + + cmd.stdout.chomp.should eq 'POSIX' + end + end + end +end
Add functional test for shell_out_with_systems_locale
diff --git a/spec/rubocop/cops/favor_sprintf_spec.rb b/spec/rubocop/cops/favor_sprintf_spec.rb index abc1234..def5678 100644 --- a/spec/rubocop/cops/favor_sprintf_spec.rb +++ b/spec/rubocop/cops/favor_sprintf_spec.rb @@ -43,6 +43,8 @@ ['puts x % Y']) expect(fs.offences).to be_empty end + + it 'should work if the first operand contains embedded expressions' end end end
Add a pending example for the sprintf cop Currently the cop does not work for strings with embedded expressions in the them. This example should serve as a reminder of that.
diff --git a/lib/license_finder/packages/pip_package.rb b/lib/license_finder/packages/pip_package.rb index abc1234..def5678 100644 --- a/lib/license_finder/packages/pip_package.rb +++ b/lib/license_finder/packages/pip_package.rb @@ -1,4 +1,6 @@ # frozen_string_literal: true + +require 'set' module LicenseFinder class PipPackage < Package
Add missing require for pip package [#161131803] Signed-off-by: Shane Lattanzio <8d464e6324483c505e61a33227a5372ac7f64bc0@pivotal.io>
diff --git a/lib/fog/hp/models/compute/key_pair.rb b/lib/fog/hp/models/compute/key_pair.rb index abc1234..def5678 100644 --- a/lib/fog/hp/models/compute/key_pair.rb +++ b/lib/fog/hp/models/compute/key_pair.rb @@ -12,8 +12,6 @@ attribute :public_key attribute :private_key attribute :user_id - - attr_accessor :public_key def destroy requires :name
Fix public_key attribute to be visible in table.
diff --git a/lib/minitest/ruby_golf_metrics/reporter.rb b/lib/minitest/ruby_golf_metrics/reporter.rb index abc1234..def5678 100644 --- a/lib/minitest/ruby_golf_metrics/reporter.rb +++ b/lib/minitest/ruby_golf_metrics/reporter.rb @@ -13,7 +13,8 @@ def record(erg) method_name = erg.location. gsub("RubyGolfTest#test_", ""). - gsub(/_[0-9]+.*$/, "") + gsub(/ .*$/, ""). + gsub(/_[0-9]+/, "") @ergs[method_name] ||= [] @ergs[method_name] << erg.passed? end
Fix method name for failing tests
diff --git a/lib/graphite_client/event_reporter.rb b/lib/graphite_client/event_reporter.rb index abc1234..def5678 100644 --- a/lib/graphite_client/event_reporter.rb +++ b/lib/graphite_client/event_reporter.rb @@ -1,5 +1,6 @@+require 'json' require 'net/http' -require 'json' +require 'net/https' class GraphiteClient class EventReporter @@ -8,6 +9,8 @@ @http = Net::HTTP.new(uri.host, uri.port) @req = Net::HTTP::Post.new(uri.request_uri) + @http.use_ssl = true if uri.scheme == 'https' + if opts[:basic_auth] username = opts[:basic_auth][:username] password = opts[:basic_auth][:password] @@ -15,9 +18,16 @@ end end - def report(event={}) - @req.body = event.to_json + def report(event) + @req.body = EventValue.from(event) @http.request(@req) + end + + class EventValue + def self.from(event={}) + event[:tags] = Array(event[:tags]).join(',') + event.to_json + end end end end
Allow HTTPS hosts; Accept :tags as Array or String
diff --git a/lib/tasks/check_for_bad_time_handling.rake b/lib/tasks/check_for_bad_time_handling.rake index abc1234..def5678 100644 --- a/lib/tasks/check_for_bad_time_handling.rake +++ b/lib/tasks/check_for_bad_time_handling.rake @@ -1,11 +1,13 @@ task :check_for_bad_time_handling do directories = Dir.glob(File.join(Rails.root, '**', '*.rb')) matching_files = directories.select do |filename| - match = false - File.open(filename) do |file| - match = file.grep(%r{Time\.(now|utc|parse)}).any? rescue nil + unless filename.match /vendor\/bundle/ + match = false + File.open(filename) do |file| + match = file.grep(%r{Time\.(now|utc|parse)}).any? + end + match end - match end if matching_files.any? raise <<-MSG
Exclude bundle cache folders from bad_time_handling check
diff --git a/lib/user_permissions_controller_methods.rb b/lib/user_permissions_controller_methods.rb index abc1234..def5678 100644 --- a/lib/user_permissions_controller_methods.rb +++ b/lib/user_permissions_controller_methods.rb @@ -2,8 +2,7 @@ private def applications_and_permissions(user) ::Doorkeeper::Application.order(:name).all.map do |application| - permission_for_application = user.permissions.find_by_application_id(application.id) - permission_for_application ||= Permission.new(application: application, user: user) + permission_for_application = user.permissions.find_or_create_by_application_id(application.id) [application, permission_for_application] end end
Fix intermittent failure when editing permissions From close inspection of the parameters from when the errors occurred, an ID was not being supplied by the browser for the permission which the server was trying to create. I believe that the following happened (and I successfully reproduced): * The user was created/edited once, and they did not have a pre-existing permission for one or more application. The server therefore created it on submit. * The admin user clicked back (i.e. not being rendered a fresh page containing the new permission ID) * They submitted again, and the server tried to create another permission, but failed because it already existed. The fix, therefore, is to always create the permission before it is rendered to the browser, hence it always has an ID.
diff --git a/docs/analytics_scripts/ores_changes.rb b/docs/analytics_scripts/ores_changes.rb index abc1234..def5678 100644 --- a/docs/analytics_scripts/ores_changes.rb +++ b/docs/analytics_scripts/ores_changes.rb @@ -0,0 +1,30 @@+term = Campaign.find_by(slug: 'spring_2017') + +first_revs = [] +term.courses.each do |course| + course.articles_courses.each do |ac| + first_revs << ac.all_revisions.order('date ASC').first + end +end + +importer = RevisionScoreImporter.new + +first_revs.each do |rev| + next if rev.nil? + next if rev.wp10_previous + next if rev.wiki_id != 1 + puts rev.id + importer.send(:update_wp10_previous, rev) +end + +scores = [] +term.courses.each do |course| + course.articles_courses.each do |ac| + ordered_revisions = ac.all_revisions.order('date ASC') + first_revision = ordered_revisions.first + last_revision = ordered_revisions.last + scores << [first_revision&.wp10_previous || 0.0, last_revision&.wp10 || 0.0] + end +end + +CSV.open("/home/sage/#{term.slug}_ores_diff.csv", 'wb') { |csv| scores.each { |s| csv << s } }
Add script for getting ORES before/after data
diff --git a/app/models/alumni.rb b/app/models/alumni.rb index abc1234..def5678 100644 --- a/app/models/alumni.rb +++ b/app/models/alumni.rb @@ -1,2 +1,13 @@ class Alumni < ActiveRecord::Base + has_one :AlumniStatus + has_one :AlumniData + after_create :build_other_records + + private + def build_other_records + AlumniStatus.create({ :Alumni_id => self.id }) + AlumniData.create({ :Alumni_id => self.id }) + TieAlumniWithStudentMember.create({ :Alumni_id => self.id, :StudentMember_id => 0}) + true + end end
Create all the records simultaneously - Creation of the alumni record will lead to the creation of the alumni status and alumni data records too.
diff --git a/examples/installment.rb b/examples/installment.rb index abc1234..def5678 100644 --- a/examples/installment.rb +++ b/examples/installment.rb @@ -3,7 +3,7 @@ credentials = PagSeguro.application_credentials credentials.authorization_code = "BF0C85F19BEB4011AC4D99C88C6E0638" -installments = PagSeguro::Installment.find("100.00", {credentials: credentials}) +installments = PagSeguro::Installment.find("100.00") if installments.errors.any? puts "=> ERRORS" @@ -17,7 +17,7 @@ end end -visa_installments = PagSeguro::Installment.find("100.00", { card_brand: "visa", credentials: credentials }) +visa_installments = PagSeguro::Installment.find("100.00", :visa) puts if installments.errors.any?
Fix the params received by PagSeguro::Installmen::find
diff --git a/api/app/models/line_item_decorator.rb b/api/app/models/line_item_decorator.rb index abc1234..def5678 100644 --- a/api/app/models/line_item_decorator.rb +++ b/api/app/models/line_item_decorator.rb @@ -1,7 +1,7 @@-LineItem.class_eval do +Spree::LineItem.class_eval do def description d = variant.product.name.clone d << " (#{variant.options_text})" unless variant.option_values.empty? d end -end+end
Fix LineItem reference in LineItemDecorator
diff --git a/kernel/delta/struct.rb b/kernel/delta/struct.rb index abc1234..def5678 100644 --- a/kernel/delta/struct.rb +++ b/kernel/delta/struct.rb @@ -11,6 +11,23 @@ end def self.specialize_initialize + # Because people are crazy, they subclass Struct directly, ie. + # class Craptastic < Struct + # + # NOT + # + # class Fine < Struct.new(:x, :y) + # + # When they do this craptastic act, they'll sometimes define their + # own #initialize and super into Struct#initialize. + # + # When they do this and then do Craptastic.new(:x, :y), this code + # will accidentally shadow they're #initialize. So for now, only run + # the specialize if we're trying new Struct's directly from Struct itself, + # not a craptastic Struct subclass. + + return unless self.equal? Struct + attrs = self::STRUCT_ATTRS args = []
Fix Struct.specialize_initialize for subclasses of Struct
diff --git a/db/migrate/20220426132125_backfill_auth_bypass_id.rb b/db/migrate/20220426132125_backfill_auth_bypass_id.rb index abc1234..def5678 100644 --- a/db/migrate/20220426132125_backfill_auth_bypass_id.rb +++ b/db/migrate/20220426132125_backfill_auth_bypass_id.rb @@ -4,7 +4,7 @@ def up to_update = Edition.where(auth_bypass_id: nil) to_update.find_each do |edition| - edition.update!(auth_bypass_id: SecureRandom.uuid) + edition.update_column(:auth_bypass_id, SecureRandom.uuid) end end end
Migrate auth_bypass_id for all editions Regardless of whether an edition is draft or not, it will have an auth_bypass_id. Publishing api disregards auth_bypass_ids for non-draft editions. This simplifies the logic on the Whitehall end.
diff --git a/db/migrate/20090127102507_nuke_committerships.rb b/db/migrate/20090127102507_nuke_committerships.rb index abc1234..def5678 100644 --- a/db/migrate/20090127102507_nuke_committerships.rb +++ b/db/migrate/20090127102507_nuke_committerships.rb @@ -4,7 +4,7 @@ end def self.down - create_table "committerships" + create_table "committerships" do |t| t.integer "user_id" t.integer "repository_id" t.integer "kind", :default => 2
Fix stupid typo in NukeCommitterships migration
diff --git a/app/controllers/notices_controller.rb b/app/controllers/notices_controller.rb index abc1234..def5678 100644 --- a/app/controllers/notices_controller.rb +++ b/app/controllers/notices_controller.rb @@ -14,6 +14,6 @@ def jump @notice = Notice.where(hashid: params[:id]).first - redirect_to @notice || :root + redirect_to(@notice || :root, status: 301) end end
Set jump links to 301 redirects
diff --git a/activerecord-safer_migrations.gemspec b/activerecord-safer_migrations.gemspec index abc1234..def5678 100644 --- a/activerecord-safer_migrations.gemspec +++ b/activerecord-safer_migrations.gemspec @@ -17,6 +17,6 @@ gem.add_runtime_dependency "activerecord", ">= 4.0" gem.add_development_dependency "pg", "~> 0.21.0" - gem.add_development_dependency "rspec", "~> 3.3.0" + gem.add_development_dependency "rspec", "~> 3.6.0" gem.add_development_dependency "rubocop", "~> 0.35.1" end
Update rspec requirement to ~> 3.6.0 Updates requirements on [rspec](https://github.com/rspec/rspec) to permit the latest version.
diff --git a/app/models/meeting.rb b/app/models/meeting.rb index abc1234..def5678 100644 --- a/app/models/meeting.rb +++ b/app/models/meeting.rb @@ -11,7 +11,7 @@ # Contants # - TYPES = %i(standup planning review retrospective meeting workshop other).freeze + TYPES = %i(standup planning review retrospective meeting workshop grooming other).freeze end # == Schema Information
Add Grooming type to event list in Meeting model closes https://github.com/openSUSE/agile-team-dashboard/issues/68
diff --git a/app/models/project.rb b/app/models/project.rb index abc1234..def5678 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -11,7 +11,7 @@ self.projected_hours ||= 0.0 self.short_code = short_code.present? ? self.short_code.downcase : self.name[0..1].downcase self.short_code = self.short_code.parameterize - if !Project.where(short_code: self.short_code).take.nil? + if Project.where(short_code: self.short_code).take.nil? self.short_code = generate_unique_short_code end end
Fix Short Code Regeneration Bug
diff --git a/app/serializers/chapter_serializer.rb b/app/serializers/chapter_serializer.rb index abc1234..def5678 100644 --- a/app/serializers/chapter_serializer.rb +++ b/app/serializers/chapter_serializer.rb @@ -4,11 +4,10 @@ has_many :measurements def last_weeks_entries - + object.entries.where(2.weeks.ago...1.week.ago) end def this_weeks_entries object.entries.where(1.week.ago..Date.today) end - end
Implement last_weeks_entries attribute to ChapterSerializer
diff --git a/features/support/test_date_helper.rb b/features/support/test_date_helper.rb index abc1234..def5678 100644 --- a/features/support/test_date_helper.rb +++ b/features/support/test_date_helper.rb @@ -8,7 +8,7 @@ end def test_date - "20-04-#{Date.current.year}" + I18n.l(Date.parse("20-07-#{Date.current.year}")) end def test_time
Use a localized version of the date
diff --git a/lib/adhearsion/xmpp.rb b/lib/adhearsion/xmpp.rb index abc1234..def5678 100644 --- a/lib/adhearsion/xmpp.rb +++ b/lib/adhearsion/xmpp.rb @@ -34,7 +34,7 @@ class << self def method_missing(m, *args, &block) - m.send m, *args, &block + plugin.connection.send m, *args, &block end end end
Fix typo in method delegation
diff --git a/lib/cc_engine/issue.rb b/lib/cc_engine/issue.rb index abc1234..def5678 100644 --- a/lib/cc_engine/issue.rb +++ b/lib/cc_engine/issue.rb @@ -75,13 +75,6 @@ :location, :remediation_points, :content, - :fingerprint, - :check_name, - :description, - :categories, - :location, - :remediation_points, - :content, :fingerprint end end
Remove accidental duplicate attr_reader entries
diff --git a/lib/confoog/version.rb b/lib/confoog/version.rb index abc1234..def5678 100644 --- a/lib/confoog/version.rb +++ b/lib/confoog/version.rb @@ -2,5 +2,5 @@ module Confoog # Version of this Gem, using Semantic Versioning 2.0.0 # http://semver.org/ - VERSION = '0.3.0' + VERSION = '0.4.0' end
Tag for 0.4.0 and release Signed-off-by: Seapagan <4ab1b2fdb7784a8f9b55e81e3261617f44fd0585@gmail.com>
diff --git a/lib/tasks/rebuild_counter_caches.rake b/lib/tasks/rebuild_counter_caches.rake index abc1234..def5678 100644 --- a/lib/tasks/rebuild_counter_caches.rake +++ b/lib/tasks/rebuild_counter_caches.rake @@ -0,0 +1,17 @@+namespace :db do + desc "Rebuild counter caches for users and papers" + task rebuild_counter_caches: :environment do + + User.reset_column_information + User.find(:all).each do |u| + User.reset_counters u.id, :scites + User.reset_counters u.id, :comments + end + + Paper.reset_column_information + Paper.find(:all).each do |p| + Paper.reset_counters p.id, :scites + Paper.reset_counters p.id, :comments + end + end +end
Add rake task to rebuild counter caches
diff --git a/lib/tchart/process/settings_parser.rb b/lib/tchart/process/settings_parser.rb index abc1234..def5678 100644 --- a/lib/tchart/process/settings_parser.rb +++ b/lib/tchart/process/settings_parser.rb @@ -7,32 +7,35 @@ @settings = Settings.new end - def parse(line) # => true or false + def parse(line) # => true if a settings line, false otherwise. return false if ! match = /^([^=]+)=(.+)$/.match(line) - name, value = match[1].strip, match[2].strip - raise_unknown_setting(name) if not settings.has_setting?(name) - raise_not_a_recognizable_value(value) if not recognizable_value?(value) - save_setting(name, value) + name, value_as_string = match[1].strip, match[2].strip + raise_unknown_setting(name) if ! known_setting?(name) + raise_not_a_recognizable_value(value_as_string) if ! recognizable_value?(value_as_string) + save_setting(name, value_as_string) true end private - - def recognizable_value?(value) - value =~ /^(\+|-)?\d+(\.\d*)?$/ + + def known_setting?(name) + settings.has_setting?(name) end - def save_setting(name, value) - value = value.to_f - settings.send("#{name}=", value) + def recognizable_value?(value_as_string) + value_as_string =~ /^(\+|-)?\d+(\.\d*)?$/ end + def save_setting(name, value_as_string) + settings.send("#{name}=", value_as_string.to_f) + end + def raise_unknown_setting(name) raise TChartError, "unknown setting \"#{name}\"; expecting one of: #{settings.setting_names.join(', ')}" end - def raise_not_a_recognizable_value(value) - raise TChartError, "\"#{value}\" is not a recognizable setting value; expecting e.g. 123 or 123.45" + def raise_not_a_recognizable_value(value_as_string) + raise TChartError, "\"#{value_as_string}\" is not a recognizable setting value; expecting e.g. 123 or 123.45" end end
Revert back to using exceptions for code flow.
diff --git a/lib/toolsmith/helpers/grid_helpers.rb b/lib/toolsmith/helpers/grid_helpers.rb index abc1234..def5678 100644 --- a/lib/toolsmith/helpers/grid_helpers.rb +++ b/lib/toolsmith/helpers/grid_helpers.rb @@ -1,11 +1,29 @@ module Toolsmith module ViewHelpers module GridHelpers + + # Returns a bootstrap div for rows + # <%= row do %> + # Content + # <% end %> + # + # @param options [Hash] + # @param block [Proc] + # @return [String] <div class="row">Content</div> def row(options={}, &block) row_class = options[:fluid] ? "row-fluid" : "row" content_tag(:div, class: row_class, &block) end + # Returns a grid column element. + # <%= column 12 do %> + # I'm in a column! + # <% end %> + # + # @param width [Fixnum] + # @param options [Hash] + # @param block [Proc] + # @return [String] <div class="span12">I'm in a column!</div> def column(width, options = {}, &block) classes = %W[span#{width}] classes << "offset#{options[:offset]}" if options[:offset] @@ -13,6 +31,9 @@ content_tag(:div, class: classes, &block) end + # Create a row and fullwidth column (based on the standard 12 wide) + # @see #row + # @see #column def full_width_column(options={}, &block) row(options) do column(12, &block)
Add documentation for grid helpers.
diff --git a/spec/acceptance/tcp_spec.rb b/spec/acceptance/tcp_spec.rb index abc1234..def5678 100644 --- a/spec/acceptance/tcp_spec.rb +++ b/spec/acceptance/tcp_spec.rb @@ -0,0 +1,47 @@+require 'spec_helper' + +describe Listen::TCP do + + let(:port) { 4000 } + + let(:broadcaster) { Listen.to(Dir.pwd, forward_to: port) } + let(:recipient) { Listen.on(port) } + let(:callback) { ->(modified, added, removed) { + add_changes(:modified, modified) + add_changes(:added, added) + add_changes(:removed, removed) + } } + let(:paths) { Pathname.new(Dir.pwd) } + + around { |example| fixtures { |path| example.run } } + + before do + broadcaster.start + end + + it 'still handles local changes' do + broadcaster.block = callback + + expect(listen { + touch 'file.rb' + }).to eq( + modified: [], + added: ['file.rb'], + removed: [] + ) + end + + it 'forwards changes over TCP' do + recipient.start + recipient.block = callback + + expect(listen { + touch 'file.rb' + }).to eq( + modified: [], + added: ['file.rb'], + removed: [] + ) + end + +end
Add acceptance spec for TCP forwarding
diff --git a/lib/neo4j_dev_rails.rb b/lib/neo4j_dev_rails.rb index abc1234..def5678 100644 --- a/lib/neo4j_dev_rails.rb +++ b/lib/neo4j_dev_rails.rb @@ -5,16 +5,20 @@ require File.expand_path('../neo4j_dev_rails/railtie', __FILE__) if defined?(Rails) def self.clean_neo4j - response = RestClient.post 'http://localhost:7574/db/data/cypher', { query: 'START n0=node(0),nx=node(*) MATCH n0-[r0?]-(),nx-[rx?]-() WHERE nx <> n0 DELETE r0,rx,nx' }.to_json, accept: :json, content_type: :json + response = RestClient.post "#{test_host}:#{test_port}/db/data/cypher", { query: 'START n0=node(0),nx=node(*) MATCH n0-[r0?]-(),nx-[rx?]-() WHERE nx <> n0 DELETE r0,rx,nx' }.to_json, accept: :json, content_type: :json response.code == 200 end + + class << self + attr_accessor :test_host, :test_port + end + + def self.test_host + @test_host ||= 'http://localhost' + end + + def self.test_port + @test_port ||= 7574 + end + end - -# [ActiveSupport::TestCase, ActionDispatch::IntegrationTest].each do |klass| -# klass.class_eval do -# def clean_neo4j -# response = RestClient.post 'http://localhost:7574/db/data/cypher', { query: 'START n0=node(0),nx=node(*) MATCH n0-[r0?]-(),nx-[rx?]-() WHERE nx <> n0 DELETE r0,rx,nx' }.to_json, accept: :json, content_type: :json -# response.code == 200 -# end -# end -# end
Make test server host and port configurable when running the clean_neo4j method
diff --git a/bookingsync-application-engine.gemspec b/bookingsync-application-engine.gemspec index abc1234..def5678 100644 --- a/bookingsync-application-engine.gemspec +++ b/bookingsync-application-engine.gemspec @@ -7,7 +7,7 @@ Gem::Specification.new do |s| s.name = "bookingsync-application-engine" s.version = BookingsyncApplication::ENGINE_VERSION - s.authors = ["Marcin Nowicki"] + s.authors = ["Marcin Nowicki", "Mariusz Pietrzyk"] s.email = ["dev@bookingsync.com"] s.homepage = "https://github.com/BookingSync/bookingsync-application-engine" s.summary = "A Rails engine to simplify building BookingSync Applications"
Add me to gem authors
diff --git a/spec/lib/archive/ar_spec.rb b/spec/lib/archive/ar_spec.rb index abc1234..def5678 100644 --- a/spec/lib/archive/ar_spec.rb +++ b/spec/lib/archive/ar_spec.rb @@ -0,0 +1,24 @@+require 'spec_helper' + +describe Archive::Ar do + describe "create" do + end + + describe "extract" do + end + + describe "traverse" do + let(:options) { {} } + subject { Archive::Ar.traverse(source_file, options) } + + context "test.ar" do + let(:source_file) { "spec/fixtures/test.ar" } + + it "yields two things" do + expect {|b| + Archive::Ar.traverse(source_file, options, &b) + }.to yield_successive_args(anything, anything) + end + end + end +end
Add a simple traverse test
diff --git a/spec/models/section_spec.rb b/spec/models/section_spec.rb index abc1234..def5678 100644 --- a/spec/models/section_spec.rb +++ b/spec/models/section_spec.rb @@ -3,8 +3,13 @@ describe Section do describe 'associations' do describe 'chapters' do + let!(:chapter) { create(:chapter, :with_section) } + it 'does not include HiddenGoodsNomenclatures' do - pending + section = chapter.section + create(:hidden_goods_nomenclature, goods_nomenclature_item_id: chapter.goods_nomenclature_item_id) + + expect(section.chapters).to eq [] end end end
Fix pending spec for section.chapters with hidden codes
diff --git a/lib/dm-core/spec/lib/adapter_helpers.rb b/lib/dm-core/spec/lib/adapter_helpers.rb index abc1234..def5678 100644 --- a/lib/dm-core/spec/lib/adapter_helpers.rb +++ b/lib/dm-core/spec/lib/adapter_helpers.rb @@ -29,7 +29,11 @@ # create all tables and constraints before each spec DataMapper::Model.descendants.each do |model| next unless model.respond_to?(:auto_migrate!) - model.auto_migrate!(@repository.name) + begin + model.auto_migrate!(@repository.name) + rescue IncompleteModelError + # skip incomplete models + end end end @@ -37,7 +41,11 @@ # remove all tables and constraints after each spec DataMapper::Model.descendants.each do |model| next unless model.respond_to?(:auto_migrate_down!) - model.auto_migrate_down!(@repository.name) + begin + model.auto_migrate_down!(@repository.name) + rescue IncompleteModelError + # skip incomplete models + end end # TODO consider proper automigrate functionality if @adapter.respond_to?(:reset)
Change spec helpers to skip over incomplete models * If a model was created for some other purpose, besides testing its persistence logic, it's likely it was an anonymous class and may be considered incomplete and impossible to auto-migrate.
diff --git a/lib/exception_notifier/base_notifier.rb b/lib/exception_notifier/base_notifier.rb index abc1234..def5678 100644 --- a/lib/exception_notifier/base_notifier.rb +++ b/lib/exception_notifier/base_notifier.rb @@ -14,11 +14,11 @@ end def _pre_callback(exception, options, message, message_opts) - @base_options[:pre_callback].call(base_options, self, exception.backtrace, message, message_opts) if @base_options[:pre_callback].respond_to?(:call) + @base_options[:pre_callback].call(options, self, exception.backtrace, message, message_opts) if @base_options[:pre_callback].respond_to?(:call) end def _post_callback(exception, options, message, message_opts) - @base_options[:post_callback].call(base_options, self, exception.backtrace, message, message_opts) if @base_options[:post_callback].respond_to?(:call) + @base_options[:post_callback].call(options, self, exception.backtrace, message, message_opts) if @base_options[:post_callback].respond_to?(:call) end end
hotfix: Send the correct options in send_notice
diff --git a/stash_engine/app/controllers/stash_engine/application_controller.rb b/stash_engine/app/controllers/stash_engine/application_controller.rb index abc1234..def5678 100644 --- a/stash_engine/app/controllers/stash_engine/application_controller.rb +++ b/stash_engine/app/controllers/stash_engine/application_controller.rb @@ -10,10 +10,31 @@ prepend_view_path("#{Rails.application.root}/app/views") def force_to_domain - return if session[:test_domain] || request.host == current_tenant_display.full_domain - uri = URI(request.original_url) - uri.host = current_tenant_display.full_domain - redirect_to(uri.to_s) + return if session[:test_domain] + + host, port = tenant_host_and_port(current_tenant_display) + return if host_and_port_match?(request, host, port) + + redirect_to(redirect_url_for(request.original_url, host, port)) + end + + private + + def host_and_port_match?(request, host, port) + request.host == host && (port.nil? || request.port == port.to_i) + end + + def tenant_host_and_port(tenant) + full_domain = tenant.full_domain + host, port = full_domain.split(':') + [host, port] + end + + def redirect_url_for(original_url, host, port) + uri = URI(original_url) + uri.host = host + uri.port = port if port + uri.to_s end end
Support tenant domains with ports (e.g. localhost:3000 for testing)
diff --git a/SSToolkit.podspec b/SSToolkit.podspec index abc1234..def5678 100644 --- a/SSToolkit.podspec +++ b/SSToolkit.podspec @@ -0,0 +1,24 @@+Pod::Spec.new do |s| + s.name = 'SSToolkit' + s.version = '0.1.3' + s.platform = :ios + s.summary = 'A collection of well-documented iOS classes for making life easier.' + s.homepage = 'http://sstoolk.it' + s.author = { 'Sam Soffes' => 'sam@samsoff.es' } + s.source = { :git => 'https://github.com/samsoffes/sstoolkit.git', :tag => '0.1.3' } + + s.description = 'SSToolkit is a collection of well-documented iOS classes for making life ' \ + 'easier by solving common problems all iOS developers face. Some really ' \ + 'handy classes are SSCollectionView, SSGradientView, SSSwitch, and many more.' + + s.resources = 'Resources' + s.source_files = 'SSToolkit/**/*.{h,m}' + s.frameworks = 'QuartzCore', 'CoreGraphics' + + def s.post_install(target) + prefix_header = config.project_pods_root + target.prefix_header_filename + prefix_header.open('a') do |file| + file.puts(%{#ifdef __OBJC__\n#import "SSToolkitDefines.h"\n#endif}) + end + end +end
Add CocoaPods podspec for future 0.1.3 release.
diff --git a/lib/full_circle/builders/job_builder.rb b/lib/full_circle/builders/job_builder.rb index abc1234..def5678 100644 --- a/lib/full_circle/builders/job_builder.rb +++ b/lib/full_circle/builders/job_builder.rb @@ -11,7 +11,7 @@ company_city: hash['companyCity'], company_state: hash['companyState'], accept_print: hash['acceptPrint'], - company_zip: hash.fetch('companyZip'), + company_zip: hash['companyZip'], salary: hash['salary'], hours_type: hash['hoursType'], display_start: hash['displayStart'],
Remove the fetch in job builder
diff --git a/app/controllers/contact_controller.rb b/app/controllers/contact_controller.rb index abc1234..def5678 100644 --- a/app/controllers/contact_controller.rb +++ b/app/controllers/contact_controller.rb @@ -11,8 +11,9 @@ def create @profile = Profile.friendly.find(params[:id]) if params[:id] @message = Message.new(message_params) + @spam_emails = ENV['FISHY_EMAILS'].present? ? ENV.fetch('FISHY_EMAILS').split(',') : '' - if @message.valid? && ENV.fetch('FISHY_EMAILS').split(',').exclude?(@message.email) + if @message.valid? && @spam_emails.exclude?(@message.email) NotificationsMailer.new_message(@message, @profile && @profile.email).deliver if @profile.present? redirect_to(profile_path(@profile), notice: t(:notice, scope: 'contact.form'))
Check for the presents of the env var first
diff --git a/app/controllers/exports_controller.rb b/app/controllers/exports_controller.rb index abc1234..def5678 100644 --- a/app/controllers/exports_controller.rb +++ b/app/controllers/exports_controller.rb @@ -1,5 +1,4 @@ class ExportsController < ApplicationController - include ActionController::Live require_permission :can_export? def show @@ -8,6 +7,5 @@ response.headers["Content-Disposition"] = %(attachment; filename="#{export.filename}") export.stream_response(response) end - return redirect_to :root end end
Remove unneeded include and return path from exports controller
diff --git a/lib/kosmos/packages/enhanced_navball.rb b/lib/kosmos/packages/enhanced_navball.rb index abc1234..def5678 100644 --- a/lib/kosmos/packages/enhanced_navball.rb +++ b/lib/kosmos/packages/enhanced_navball.rb @@ -1,6 +1,6 @@ class EnhancedNavball < Kosmos::Package title 'Enhanced Navball' - url 'http://addons.cursecdn.com/files/2201/977/EnhancedNavBall_1_2.zip' + url 'http://kerbal.curseforge.com/plugins/220469-enhanced-navball-v1-2' def install merge_directory 'EnhancedNavBall/Plugins'
Update EnhancedNavball to use the new package installation method.
diff --git a/attributes/default.rb b/attributes/default.rb index abc1234..def5678 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -7,7 +7,14 @@ # MIT License # +distro_name = case node['platform_version'] +when '14.04' + 'trusty' +when '16.04' + 'xenial' +end + default['docker']['repository']['uri'] = 'https://apt.dockerproject.org/repo' -default['docker']['platform']['distro'] = 'ubuntu-trusty' +default['docker']['platform']['distro'] = "ubuntu-#{distro_name}" default['docker']['repository']['key'] = '58118E89F3A912897C070ADBF76221572C52609D' default['docker']['repository']['keyserver'] = 'hkp://p80.pool.sks-keyservers.net:80'
Add dynamic distro name to attributes
diff --git a/lib/rusttrace/usage.rb b/lib/rusttrace/usage.rb index abc1234..def5678 100644 --- a/lib/rusttrace/usage.rb +++ b/lib/rusttrace/usage.rb @@ -2,7 +2,6 @@ class Usage class CallCount < FFI::Struct layout :count, :uint, - :method_length, :uint, :method_name, :string def inspect
Remove unused struct field from Ruby
diff --git a/lib/tasks/gremlin.rake b/lib/tasks/gremlin.rake index abc1234..def5678 100644 --- a/lib/tasks/gremlin.rake +++ b/lib/tasks/gremlin.rake @@ -10,4 +10,15 @@ require 'notify_gremlin_indexer' NotifyGremlinIndexer.index_all end + + desc "Attempts to reindex documents that haven't been indexed yet." + task index_not_indexed: :cer_environment do + require 'notify_gremlin_indexer' + ids = Envelope.not_deleted + .where(last_graph_indexed_at: nil) + .ordered_by_date + .pluck(:id) + .reverse + ids.each { |id| NotifyGremlinIndexer.index_one(id) } + end end
Add task for indexing non-indexing envelopes
diff --git a/license_finder.gemspec b/license_finder.gemspec index abc1234..def5678 100644 --- a/license_finder.gemspec +++ b/license_finder.gemspec @@ -2,8 +2,8 @@ s.name = "license_finder" s.version = File.read "VERSION" s.platform = Gem::Platform::RUBY - s.email = ["jacob.maine@gmail.com"] s.authors = ["Jacob Maine", "Matthew Kane Parker", "Ian Lesperance", "David Edwards"] + s.email = ["brent@pivotalabs.com"] s.homepage = "https://github.com/pivotal/LicenseFinder" s.summary = %q{License finding heaven.} s.description = %q{Find and display licenses of a project's gem dependencies.}
Set gem email address to Brent Wheeldon (PM)
diff --git a/test/dependency_tracker_test.rb b/test/dependency_tracker_test.rb index abc1234..def5678 100644 --- a/test/dependency_tracker_test.rb +++ b/test/dependency_tracker_test.rb @@ -15,18 +15,21 @@ end end + def tracker + CacheDigests::DependencyTracker + end + def setup - CacheDigests::DependencyTracker.register_tracker(:neckbeard, NeckbeardTracker) + tracker.register_tracker(:neckbeard, NeckbeardTracker) end def teardown - CacheDigests::DependencyTracker.unregister_tracker(:neckbeard) + tracker.unregister_tracker(:neckbeard) end def test_finds_tracker_by_template_handler - name = "boo/hoo" - template = FixtureTemplate.new(name, :neckbeard) - dependencies = CacheDigests::DependencyTracker.find_dependencies(name, template) + template = FixtureTemplate.new("boo/hoo", :neckbeard) + dependencies = tracker.find_dependencies("boo/hoo", template) assert_equal ["foo/boo/hoo"], dependencies end end
Make the test more readable
diff --git a/lib/json_api_routes.rb b/lib/json_api_routes.rb index abc1234..def5678 100644 --- a/lib/json_api_routes.rb +++ b/lib/json_api_routes.rb @@ -17,13 +17,13 @@ end def create_versions(path) - get "/versions", to: "@{ path }#versions", format: false + get "/versions", to: "#{ path }#versions", format: false get "/versions/:id", to: "#{ path }#version", format: false end def json_api_resources(path, options={}) links = options.delete(:links) - versioned = options.delete(:version) + versioned = options.delete(:versioned) options = options.merge(except: [:new, :edit], constraints: { id: VALID_IDS }, format: false)
Fix typo in versioned route option
diff --git a/test/models/transaction_test.rb b/test/models/transaction_test.rb index abc1234..def5678 100644 --- a/test/models/transaction_test.rb +++ b/test/models/transaction_test.rb @@ -1,14 +1,54 @@-require 'test_helper' +require './test/test_helper' class TransactionTest < ActiveSupport::TestCase - test "it is invalid without a first name and last name" do + def valid_params + { + first_name: "Mike", + last_name: "Williams", + credit_card_number: 4444888899996666, + credit_card_expiration: 8833, + zipcode: 45455 + } + end + + test "it is invalid without attributes" do @transaction = Transaction.create() assert @transaction.invalid? end + test "it is valid with correct attributes" do + @transaction = Transaction.create(valid_params) + assert @transaction.valid? + end - @transaction = Transaction.create(first_name: "Mike", last_name: "Williams") - assert @transaction.valid? + test "it does not create a transaction when first name is empty" do + invalid_params = valid_params.merge(first_name: "") + transaction = Transaction.create(invalid_params) + refute transaction.valid? + end + test "it does not create a transaction when last name is empty" do + invalid_params = valid_params.merge(last_name: "") + transaction = Transaction.create(invalid_params) + refute transaction.valid? + end + + test "it does not create a transaction when credit card number is invalid" do + invalid_params = valid_params.merge(credit_card_number: 546666) + transaction = Transaction.create(invalid_params) + refute transaction.valid? + end + + test "it does not create a transaction when credit card expiration is invalid" do + invalid_params = valid_params.merge(credit_card_expiration: 24) + transaction = Transaction.create(invalid_params) + refute transaction.valid? + end + + test "it does not create a transaction when zipcode is invalid" do + invalid_params = valid_params.merge(zipcode: 559) + transaction = Transaction.create(invalid_params) + refute transaction.valid? + end end
Add tests for transaction validations
diff --git a/lib/pronto/fasterer.rb b/lib/pronto/fasterer.rb index abc1234..def5678 100644 --- a/lib/pronto/fasterer.rb +++ b/lib/pronto/fasterer.rb @@ -30,7 +30,7 @@ def new_message(error, line) path = line.patch.delta.new_file[:path] - Message.new(path, line, :warning, error.explanation) + Message.new(path, line, :warning, error.explanation, nil, self.class) end def config
Add the runner class into the report message
diff --git a/lib/remitano/orders.rb b/lib/remitano/orders.rb index abc1234..def5678 100644 --- a/lib/remitano/orders.rb +++ b/lib/remitano/orders.rb @@ -1,41 +1,32 @@ module Remitano class Orders < Remitano::Collection def all(options = {}) - Remitano::Helper.parse_objects! Remitano::Net::post('/open_orders').to_str, self.model + Remitano::Helper.parse_objects! Remitano::Net::get('/orders').to_str, self.model end def create(options = {}) - path = (options[:type] == Remitano::Order::SELL ? "/sell" : "/buy") - Remitano::Helper.parse_object! Remitano::Net::post(path, options).to_str, self.model + Remitano::Helper.parse_object! Remitano::Net::post("/orders", options).to_str, self.model end def sell(options = {}) - options.merge!({type: Remitano::Order::SELL}) - self.create options + create options.merge(side: "sell") end def buy(options = {}) - options.merge!({type: Remitano::Order::BUY}) - self.create options + create options.merge(side: "buy") end def find(order_id) - all = self.all - index = all.index {|order| order.id.to_i == order_id} - - return all[index] if index + Remitano::Helper.parse_objects! Remitano::Net::get("/orders/#{order_id}").to_str, self.model end end class Order < Remitano::Model - BUY = 0 - SELL = 1 - - attr_accessor :type, :amount, :price, :id, :datetime + attr_accessor :side, :type, :amount, :price, :id, :created_at, :updated_at attr_accessor :error, :message def cancel! - Remitano::Net::post('/cancel_order', {id: self.id}).to_str + Remitano::Net::put("/orders/#{id}/cancel").to_str end end end
Make order api more restful
diff --git a/lib/rom/lint/linter.rb b/lib/rom/lint/linter.rb index abc1234..def5678 100644 --- a/lib/rom/lint/linter.rb +++ b/lib/rom/lint/linter.rb @@ -15,17 +15,26 @@ # # @public class Linter + # A failure raised by +complain+ Failure = Class.new(StandardError) - def self.lints - public_instance_methods(true).grep(/^lint_/).map(&:to_s) - end - + # Iterate over all lint methods + # + # @yield [String, ROM::Lint] + # + # @api public def self.each_lint return to_enum unless block_given? lints.each { |lint| yield lint, self } end + # Run a lint method + # + # @param [String] lint name + # + # @raise [ROM::Lint::Linter::Failure] if linting fails + # + # @api public def lint(name) public_send name true # for assertions @@ -33,6 +42,20 @@ private + # Return a list a lint methods + # + # @return [String] + # + # @api private + def self.lints + public_instance_methods(true).grep(/^lint_/).map(&:to_s) + end + + # Raise a failure if a lint verification fails + # + # @raise [ROM::Lint::Linter::Failure] + # + # @api private def complain(*args) raise Failure, *args end
Improve documentation for Linter methods
diff --git a/app/models/spree/stock_item.rb b/app/models/spree/stock_item.rb index abc1234..def5678 100644 --- a/app/models/spree/stock_item.rb +++ b/app/models/spree/stock_item.rb @@ -6,8 +6,8 @@ belongs_to :variant, class_name: 'Spree::Variant' has_many :stock_movements, dependent: :destroy - validates_presence_of :stock_location, :variant - validates_uniqueness_of :variant_id, scope: :stock_location_id + validates :stock_location, :variant, presence: true + validates :variant_id, uniqueness: { scope: :stock_location_id } attr_accessible :count_on_hand, :variant, :stock_location, :backorderable, :variant_id
Address violation of Rubocop Rails/Validation:
diff --git a/app/workers/snapshot_worker.rb b/app/workers/snapshot_worker.rb index abc1234..def5678 100644 --- a/app/workers/snapshot_worker.rb +++ b/app/workers/snapshot_worker.rb @@ -4,7 +4,14 @@ include Sidekiq::Worker def perform(snapshot_id) - snapshot = Snapshot.find(snapshot_id) + begin + snapshot = Snapshot.find(snapshot_id) + rescue ActiveRecord::RecordNotFound + # The Snapshot was deleted before the worker could run, so there is + # nothing left for this worker to do. + return + end + url = snapshot.url viewport = snapshot.viewport snapshot_result = Snapshotter.new(url, viewport).take_snapshot!
Allow SnapshotWorkers that can't find Snapshot to rest in peace If you were to create a Snapshot and then delete it before the worker had the chance to act on it, the work request would stay in the queue, causing it to be run every time the workers spun up. This could happen easily, for instance, if there was an unexpected error that prevented the worker from returning successfully. In fact, this is a problem that I saw quite often while developing Diffux. To allow these zombie workers to rest in peace, I am adding a rescue for the exception that is raised when the record is not found. Because, if the Snapshot they were supposed to act upon is no longer there, there is no more work for them to do. Change-Id: If582e4b27514b5c7783480669db51172b4391c37
diff --git a/Casks/wch-ch34x-usb-serial-driver.rb b/Casks/wch-ch34x-usb-serial-driver.rb index abc1234..def5678 100644 --- a/Casks/wch-ch34x-usb-serial-driver.rb +++ b/Casks/wch-ch34x-usb-serial-driver.rb @@ -0,0 +1,15 @@+cask :v1 => 'wch-ch34x-usb-serial-driver' do + version '1.1' + sha256 'e2d9e46d3b09be09341fad017e0679988bcf0495dbeef933d1e1f4a33715c09b' + + url 'http://www.wch.cn/downloads/downfile.php?id=178' + name 'Wch USB serial driver for CH340/CH341' + homepage 'http://www.wch.cn/downloads.php?name=pro&proid=178' + license :gratis + + container :type => :zip, + :nested => 'CH341SER_MAC/ch34xInstall.pkg' + pkg 'CH341SER_MAC/ch34xInstall.pkg' + + uninstall :pkgutil => 'com.wch.ch34xinstall.usb.pkg' +end
Add Wch USB serial driver for CH340/CH341 v1.1
diff --git a/app/controllers/explore_controller.rb b/app/controllers/explore_controller.rb index abc1234..def5678 100644 --- a/app/controllers/explore_controller.rb +++ b/app/controllers/explore_controller.rb @@ -4,6 +4,7 @@ layout 'explore' def index + render_404 and return if current_user.nil? || !current_user.has_feature_flag?("explore_site") username = CartoDB.extract_subdomain(request).strip.downcase @viewed_user = User.where(username: username).first @default_fallback_basemap = @viewed_user.default_basemap @@ -14,6 +15,7 @@ end def search + render_404 and return if current_user.nil? || !current_user.has_feature_flag?("explore_site") @query_param = params[:q] respond_to do |format| format.html { render 'search' }
Disable explore and search pages for users that don't have the proper flag
diff --git a/app/controllers/reasons_controller.rb b/app/controllers/reasons_controller.rb index abc1234..def5678 100644 --- a/app/controllers/reasons_controller.rb +++ b/app/controllers/reasons_controller.rb @@ -2,6 +2,6 @@ def show @reason = Reason.find(params[:id]) @posts = @reason.posts.includes(:reasons).includes(:feedbacks).paginate(:page => params[:page], :per_page => 100).order('created_at DESC') - @sites = Site.where(:id => @posts.map(&:site_id)) + @sites = Site.where(:id => @posts.map(&:site_id)).to_a end end
Fix error on per-reason pages
diff --git a/app/mailers/rails_wink/wink_mailer.rb b/app/mailers/rails_wink/wink_mailer.rb index abc1234..def5678 100644 --- a/app/mailers/rails_wink/wink_mailer.rb +++ b/app/mailers/rails_wink/wink_mailer.rb @@ -5,7 +5,7 @@ def report(datadump, desc = '[No description provided]', from = nil) @datadump = datadump @desc = desc - @from = from + @from = from || 'none@localhost' subject = ''.tap do |sub| sub << "#{RailsWink.config[:prefix]}: " if RailsWink.config[:prefix]
Make sure the from address is never nil.
diff --git a/cookbooks/oozie/attributes/default.rb b/cookbooks/oozie/attributes/default.rb index abc1234..def5678 100644 --- a/cookbooks/oozie/attributes/default.rb +++ b/cookbooks/oozie/attributes/default.rb @@ -8,9 +8,9 @@ # hive cluster attributes -default[:oozie][:default][:path] = '/usr/share/oozie' -default[:oozie[:default][:version] = '3.2.0' -default[:oozie][:default][:download_url] = 'http://repo.staging.dmz/repo/linux/oozie/oozie-3.2.0-incubating.tar.gz' +default['oozie']['default']['path'] = '/usr/share/oozie' +default['oozie']['default']['version'] = '3.2.0' +default['oozie']['default']['download_url'] = 'http://repo.staging.dmz/repo/linux/oozie/oozie-3.2.0-incubating.tar.gz' # oozie-site.xml
Add missing bracket in the oozie cookbook that failed the ruby check and switch to strings Former-commit-id: d245f5279a98196c1250af0ead158af9e67713e6 [formerly c5b72d63acb8efce8ec2205bbfaf494c596d80c3] [formerly 862def5669bbf5708004bcbfe853c1d9a9dca5b6 [formerly a63ec4d1297105244c8305ba005be0a325239947 [formerly f9f426105ec2f7b358c948927d15cc20d384d2d2]]] Former-commit-id: 4aa45b5c3f29aec5566226d5c1ba420ea805d40c [formerly 680ba42faf29b8eec9ab5810cba185a7ffdee229] Former-commit-id: 842ee6ddc643b96595f4f0c37a6b0cbbcde8b42e Former-commit-id: 1d5db3b66fb1368e3b328d92a7f4be31262546c3
diff --git a/recipes/basic_structure.rb b/recipes/basic_structure.rb index abc1234..def5678 100644 --- a/recipes/basic_structure.rb +++ b/recipes/basic_structure.rb @@ -29,10 +29,11 @@ repository node['rails_app']['git_repository'] revision 'master' rails do + #NOTE it should take attributes, not hardcoded strings database do - database node['rails_app']['database_name'] - username node['rails_app']['name'] - password node['rails_app']['database_password'] + database 'rails_app' + username 'rails_app' + password '12*!asBUApg#' end end end
Change in ruby_application block (database) -> strings instead of attributes
diff --git a/core/db/migrate/20160308000300_disallow_adjustment_finalized_nulls.rb b/core/db/migrate/20160308000300_disallow_adjustment_finalized_nulls.rb index abc1234..def5678 100644 --- a/core/db/migrate/20160308000300_disallow_adjustment_finalized_nulls.rb +++ b/core/db/migrate/20160308000300_disallow_adjustment_finalized_nulls.rb @@ -0,0 +1,19 @@+class DisallowAdjustmentFinalizedNulls < ActiveRecord::Migration + def up + execute <<-SQL + update spree_adjustments + set finalized = #{ActiveRecord::Base.connection.quoted_false} + where finalized is null + SQL + + change_table :spree_adjustments do |t| + t.change :finalized, :boolean, null: false, default: false + end + end + + def down + change_table :spree_adjustments do |t| + t.change :finalized, :boolean, null: true, default: nil + end + end +end
Update spree_adjustments.finalized to be non null When we migrated from state=open/closed to finalized=true/false in d33254d we added `finalized` as a nullable column. This breaks the scopes that we added in that commit -- when finalized is null the adjustments are neither `finalized` nor `not_finalized`. I noticed this while trying to add some code and specs using the `not_finalized` scope. We could try to tweak the scopes but I think it'd be better to just avoid the ternary logic altogether by disallowing nulls. In the old code we had `state_machine :state, initial: :open` which prevented this problem even though the `state` column itself was nullable.
diff --git a/test/factories/responses.rb b/test/factories/responses.rb index abc1234..def5678 100644 --- a/test/factories/responses.rb +++ b/test/factories/responses.rb @@ -8,7 +8,7 @@ answer = response.answers.new :question => field answer.value = case field when Questions::FreeformField - (0...(Kernel.rand(10) + 10)).collect { (45..126).to_a[Kernel.rand(81)].chr }.join + (('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a).sample(Kernel.rand(10) + 10).join when Questions::CheckBoxField Kernel.rand(2) == 0 ? nil : true when Questions::RangeField
Stop potentially including invalid HTML in answers
diff --git a/generators/friendly_id_20_upgrade/friendly_id_20_upgrade_generator.rb b/generators/friendly_id_20_upgrade/friendly_id_20_upgrade_generator.rb index abc1234..def5678 100644 --- a/generators/friendly_id_20_upgrade/friendly_id_20_upgrade_generator.rb +++ b/generators/friendly_id_20_upgrade/friendly_id_20_upgrade_generator.rb @@ -5,6 +5,7 @@ m.migration_template( 'upgrade_friendly_id_to_20.rb', 'db/migrate', :migration_file_name => 'upgrade_friendly_id_to_20' ) + m.file "/../../../lib/tasks/friendly_id.rake", "lib/tasks/friendly_id.rake" end end end
Upgrade generator should also install rake tasks
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 @@ -1,9 +1,10 @@ require File.expand_path('../../../lib/beetle', __FILE__) -# Allow using Test::Unit for step assertions -# See http://wiki.github.com/aslakhellesoy/cucumber/using-testunit -require 'test/unit/assertions' -World(Test::Unit::Assertions) +# See https://github.com/cucumber/cucumber/wiki/Using-MiniTest +require 'minitest/unit' +World do + extend MiniTest::Assertions +end Before do `ruby features/support/system_notification_logger start`
Fix cucumber tests in Ruby 2.2 Test::Unit is no more
diff --git a/docs/_plugins/copy_javadoc_to_docs.rb b/docs/_plugins/copy_javadoc_to_docs.rb index abc1234..def5678 100644 --- a/docs/_plugins/copy_javadoc_to_docs.rb +++ b/docs/_plugins/copy_javadoc_to_docs.rb @@ -10,7 +10,11 @@ puts "Making directory " + dest mkdir_p dest -puts "cp -r " + source + "/. " + dest -cp_r(source + "/.", dest) +if !File.directory?(source) + puts source + " not found, continuing without javadoc" +else + puts "cp -r " + source + "/. " + dest + cp_r(source + "/.", dest) +end cd("..")
Allow docs to build without javadoc This is useful when developing documentation since building javadoc takes a while.
diff --git a/Casks/vivaldi-snapshot.rb b/Casks/vivaldi-snapshot.rb index abc1234..def5678 100644 --- a/Casks/vivaldi-snapshot.rb +++ b/Casks/vivaldi-snapshot.rb @@ -1,6 +1,6 @@ cask :v1 => 'vivaldi-snapshot' do - version '1.0.167.2' - sha256 'ded8ebb78e7f49bfdc56ed4444782dc90ec0d51965c672076f5c8e5109515608' + version '1.0.174.8' + sha256 'd363a3208176f276128866561fa3f3c055d0545e896de269163d4010fae66bf4' url "https://vivaldi.com/download/download.php?f=Vivaldi.#{version}.dmg" name 'Vivaldi'
Upgrade Vivaldi.app to v1.0.174.8 (Snapshot)
diff --git a/config/initializers/carrierwave.rb b/config/initializers/carrierwave.rb index abc1234..def5678 100644 --- a/config/initializers/carrierwave.rb +++ b/config/initializers/carrierwave.rb @@ -6,6 +6,6 @@ :rackspace_api_key => ENV['RACKSPACE_API_KEY'], :rackspace_auth_url => ENV['RACKSPACE_API_ENDPOINT'] } - config.fog_directory = ENV['RACKSPACE_CONTAINER'] - config.asset_host = ENV['RACKSPACE_ASSET_HOST'] + config.fog_directory = ENV['RACKSPACE_DIRECTORY_CONTAINER'] + config.asset_host = ENV['RACKSPACE_DIRECTORY_ASSET_HOST'] end
Make Container and Asset Hosts ENV variables explicit
diff --git a/features/android/support/app_installation_hooks.rb b/features/android/support/app_installation_hooks.rb index abc1234..def5678 100644 --- a/features/android/support/app_installation_hooks.rb +++ b/features/android/support/app_installation_hooks.rb @@ -9,7 +9,7 @@ # Create page objects which allows methods methods to be called in step # definitions the following way: # - # @android.wait_for_progress_to_complete + # @platform.wait_for_progress_to_complete # @app.clear_settings # @screen.home.await #
Update comments to mirror update variable name
diff --git a/spec/support/password_prompt_helpers.rb b/spec/support/password_prompt_helpers.rb index abc1234..def5678 100644 --- a/spec/support/password_prompt_helpers.rb +++ b/spec/support/password_prompt_helpers.rb @@ -6,10 +6,31 @@ "N:B3e%7Cmh" end + # Intercepts HighLine prompts for a one-time password (OTP) used as part of + # two factor authentication (2FA). The prevents blocking the spec waiting for + # input. + # + def mock_otp_entry(otp = "123456") + input = instance_double(HighLine) + + expect(input).to receive(:ask).with("Enter your two factor pin : ") + .once + .and_return(otp) + + expect(HighLine).to receive(:new).once.and_return(input) + end + # Intercepts HighLine prompting for a password and returns the testing default # or a specific value. Otherwise this blocks the specs. # def mock_password_entry(password = default_test_password) - expect_any_instance_of(HighLine).to receive(:ask).at_least(:once).and_return(password) + input = instance_double(HighLine) + + allow(input).to receive(:say).with("Your API credentials have expired, enter your password to update them.") + expect(input).to receive(:ask).with("Enter your password : ") + .once + .and_return(password) + + expect(HighLine).to receive(:new).once.and_return(input) end end
Update helpers to match on prompt When the specs encountered user input, we treated it as password entry where it could actually but prompting for a two factor code. To support this we need to update the mocks to match the prompt string used.
diff --git a/spec/stepping_stone/model/executor_spec.rb b/spec/stepping_stone/model/executor_spec.rb index abc1234..def5678 100644 --- a/spec/stepping_stone/model/executor_spec.rb +++ b/spec/stepping_stone/model/executor_spec.rb @@ -6,62 +6,45 @@ let(:server) { double("sut server") } subject { Executor.new(server) } - describe "#execute" do - def build_tc(*actions) - TestCase.new("test case", *actions) + def build_tc(*actions) + TestCase.new("test case", *actions) + end + + class FakeSession + attr_reader :events + + def initialize + @events = [] end - class TestSession - def apply(action) - action - end + def setup + @events << :setup end - let(:session) { TestSession.new } + def teardown + @events << :teardown + end + + def apply(action) + @events << action + action + end + end + + describe "#execute" do + let(:session) { FakeSession.new } it "executes the test case" do - test_case = build_tc("one", "two") + test_case = build_tc(:one, :two) server.should_receive(:start_test).with(test_case).and_yield(session) - session.should_receive(:setup).ordered - session.should_receive(:apply).with("one").ordered - session.should_receive(:apply).with("two").ordered - session.should_receive(:teardown).ordered subject.execute(test_case) - end - - class FakeSession - attr_reader :actions - - def initialize - @actions = [] - end - - def setup; end - def teardown; end - - def apply(action) - @actions << action - action - end - end - - class FakeServer - def initialize(session) - @session = session - end - - def start_test(test_case) - yield @session - end + session.events.should eq([:setup, :one, :two, :teardown]) end it "stops executing when an action fails" do - sess = FakeSession.new - serv = FakeServer.new(sess) - executor = Executor.new(serv) - test_case = build_tc(:fail, :pass) - executor.execute(test_case) - sess.actions.should eq([:fail]) + server.should_receive(:start_test).and_yield(session) + subject.execute(build_tc(:fail, :pass)) + session.events.should eq([:setup, :fail, :teardown]) end end end
Make all Executor specs use the session spy
diff --git a/lib/Mollie/API/Resource/Customers/Subscriptions.rb b/lib/Mollie/API/Resource/Customers/Subscriptions.rb index abc1234..def5678 100644 --- a/lib/Mollie/API/Resource/Customers/Subscriptions.rb +++ b/lib/Mollie/API/Resource/Customers/Subscriptions.rb @@ -13,7 +13,7 @@ def getResourceName customer_id = URI::encode(@parent_id) - "customers/#{@parent_id}/subscriptions" + "customers/#{customer_id}/subscriptions" end def with(customer)
Use encoded version of customer_id for subscriptions
diff --git a/spec/features/projects_ending_spec.rb b/spec/features/projects_ending_spec.rb index abc1234..def5678 100644 --- a/spec/features/projects_ending_spec.rb +++ b/spec/features/projects_ending_spec.rb @@ -11,11 +11,12 @@ scenario 'After reaching ending date' do @project.finish - travel (@project.online_days + 1).days - visit '/' - click_on 'Discover' - click_on @project.name - expect(page).to_not have_link('Contribute') + travel (@project.online_days + 1).days do + visit '/' + click_on 'Discover' + click_on @project.name + expect(page).to_not have_link('Contribute') + end end end
Remove time stub in test teardown ActiveSupport::Testing::TimeHelpers does not include auto removal of this type of stubs in test teardowns for now.
diff --git a/Casks/android-studio-canary.rb b/Casks/android-studio-canary.rb index abc1234..def5678 100644 --- a/Casks/android-studio-canary.rb +++ b/Casks/android-studio-canary.rb @@ -1,6 +1,6 @@ cask 'android-studio-canary' do - version '2.0.0.15-143.2637817' - sha256 'f06be886c30fe48c585108df7d23e8c33deb901fe4c7da2c0bf1ad434d6ba40e' + version '2.1.0.0-143.2664576' + sha256 '0d6661c414beb41a670f439b663ae06b78847d9c728ca14d5ce0efaf21cf5a74' url "https://dl.google.com/dl/android/studio/ide-zips/#{version.sub(%r{-.*}, '')}/android-studio-ide-#{version.sub(%r{.*?-}, '')}-mac.zip" name 'Android Studio Canary'
Update Android Studio (Canary) to 2.1 Preview 1