diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/spec/features/api_spec.rb b/spec/features/api_spec.rb index abc1234..def5678 100644 --- a/spec/features/api_spec.rb +++ b/spec/features/api_spec.rb @@ -11,7 +11,7 @@ Dir.chdir(project_path) do Bundler.with_clean_env do - expect(`rake`).to include("0 failures") + expect(`rspec spec/`).to include("0 failures") end end end
Use rspec instead of rake because rubocop will fail for sure
diff --git a/spec/hatchet/node_spec.rb b/spec/hatchet/node_spec.rb index abc1234..def5678 100644 --- a/spec/hatchet/node_spec.rb +++ b/spec/hatchet/node_spec.rb @@ -2,7 +2,17 @@ describe "Node" do it "works with node buildpack" do - Hatchet::Runner.new("node_multi", buildpack_url: "https://github.com/heroku/heroku-buildpack-multi.git").deploy do |app| + before_deploy = Proc.new do + run!("rm .buildpacks") + run!("echo https://github.com/heroku/heroku-buildpack-nodejs.git >> .buildpacks") + run!("echo #{Hatchet::App.default_buildpack} >> .buildpacks") + end + + Hatchet::Runner.new( + "node_multi", + before_deploy: before_deploy, + buildpack_url: "https://github.com/heroku/heroku-buildpack-multi.git" + ).deploy do |app| expect(app.output).to match("Node Version in Ruby buildpack is: v4.1.2") expect(app.run("node -v")).to match("v4.1.2") end
Update multi-buildpack test to use current branch of the buildpack
diff --git a/spec/support/factories.rb b/spec/support/factories.rb index abc1234..def5678 100644 --- a/spec/support/factories.rb +++ b/spec/support/factories.rb @@ -29,12 +29,6 @@ FactoryGirl.create(:mock_token, :user_id => user.id) end end - - factory :user_with_invalid_mock_token do - after(:create) do |user, evaluator| - FactoryGirl.create(:mock_token, :user_id => user.id, :is_valid => false) - end - end end
Remove invalid token from factory
diff --git a/app/controllers/dre/devices_controller.rb b/app/controllers/dre/devices_controller.rb index abc1234..def5678 100644 --- a/app/controllers/dre/devices_controller.rb +++ b/app/controllers/dre/devices_controller.rb @@ -2,7 +2,7 @@ module Dre class DevicesController < ApplicationController - before_filter :authenticate! + before_action :authenticate! respond_to :json
Switch to before_filter to before_action Rails 5.1 deprecates `before_filter` for `before_action1`, so the change is needed to support newer versions of Rails.
diff --git a/app/presenters/tree_builder_containers.rb b/app/presenters/tree_builder_containers.rb index abc1234..def5678 100644 --- a/app/presenters/tree_builder_containers.rb +++ b/app/presenters/tree_builder_containers.rb @@ -18,6 +18,6 @@ # Get root nodes count/array for explorer tree def x_get_tree_roots(count_only, _options) - count_only_or_objects(count_only, Container.all, "name") + count_only_or_objects(count_only, rbac_filtered_objects(Container.all), "name") end end
Add Rbac search to containers tree
diff --git a/files/gitlab-cookbooks/gitlab/recipes/selinux.rb b/files/gitlab-cookbooks/gitlab/recipes/selinux.rb index abc1234..def5678 100644 --- a/files/gitlab-cookbooks/gitlab/recipes/selinux.rb +++ b/files/gitlab-cookbooks/gitlab/recipes/selinux.rb @@ -18,6 +18,7 @@ if RedhatHelper.system_is_rhel7? ssh_keygen_module = 'gitlab-7.2.0-ssh-keygen' execute "semodule -i /opt/gitlab/embedded/selinux/rhel/7/#{ssh_keygen_module}.pp" do + not_if "getenforce | grep Disabled" not_if "semodule -l | grep '^#{ssh_keygen_module}\\s'" end end
Check if SElinux is enforced and skip loading module if disabled.
diff --git a/examples/simple_iteration_of_games_in_a_directory.rb b/examples/simple_iteration_of_games_in_a_directory.rb index abc1234..def5678 100644 --- a/examples/simple_iteration_of_games_in_a_directory.rb +++ b/examples/simple_iteration_of_games_in_a_directory.rb @@ -0,0 +1,11 @@+#Assuming you have the gem installed, of course +require 'sgf' +parser = SGF::Parser.new + +Dir['*.sgf'].each do |file| + tree = parser.parse File.read(file) + tree.games.each do |game| + puts "White player: #{game.white_player} and Black player: #{game.black_player}" + end + tree.save file #Because may as well indent the files while I'm here, right? +end
Add a very simple example of usage. More to come. Fix #13
diff --git a/features/step_definitions/common_steps.rb b/features/step_definitions/common_steps.rb index abc1234..def5678 100644 --- a/features/step_definitions/common_steps.rb +++ b/features/step_definitions/common_steps.rb @@ -11,6 +11,6 @@ end Then /^debugger$/ do - debugger + binding.pry :debugger end
Change debugger step to use binding.pry
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version '1.0.1' -depends 'yum', '>= 3.6', '< 5.0' +depends 'yum', '>= 3.6' %w(amazon centos oracle redhat scientific zlinux).each do |os| supports os
Remove upper bound on yum constraint Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/Casks/mini-metro.rb b/Casks/mini-metro.rb index abc1234..def5678 100644 --- a/Casks/mini-metro.rb +++ b/Casks/mini-metro.rb @@ -1,7 +1,7 @@ class MiniMetro < Cask - url 'http://static.dinopoloclub.com/minimetro/builds/alpha9/MiniMetro-alpha9c-osx.zip' + url 'http://static.dinopoloclub.com/minimetro/builds/alpha9/MiniMetro-alpha9d-osx.zip' homepage 'http://dinopoloclub.com/minimetro/' - version 'Alpha 9c' - sha256 'ef7efc8fe17600d99531810c718be31e80f72076fa2223c5f23fce39a27ba00c' - link 'MiniMetro-alpha9c-osx.app', :target => 'Mini Metro.app' + version 'Alpha 9d' + sha256 '6ab2aa60fe4d65f347b2277ebb6ddb3712ef1efa30c8489cc559e5d9f817881b' + link 'MiniMetro-alpha9d-osx.app', :target => 'Mini Metro.app' end
Update Mini Metro to Alpha 9d
diff --git a/lib/git-deploy/git_tag.rb b/lib/git-deploy/git_tag.rb index abc1234..def5678 100644 --- a/lib/git-deploy/git_tag.rb +++ b/lib/git-deploy/git_tag.rb @@ -7,6 +7,11 @@ def initialize( app, options ) @app, @options = app, options + + # "2013-04-12.1132AM" + @options[ :tagname ] ||= '%F.%I%M%p' + # "Release: Friday, April 12, 2013 11:35:12 AM PDT" + @options[ :message ] ||= 'Release: %A, %B %d, %Y %r %Z' end def call( env )
Add some defaults to the git tag middleware
diff --git a/lib/hogger/application.rb b/lib/hogger/application.rb index abc1234..def5678 100644 --- a/lib/hogger/application.rb +++ b/lib/hogger/application.rb @@ -1,7 +1,7 @@ module Hogger class Application def self.routes - @@routes ||= RouteCollection.new + @@routes ||= Hogger::Routing::RouteCollection.new end def self.routes=(value) @@ -9,7 +9,7 @@ end def initialize - self.class.routes ||= RouteCollection.new + self.class.routes ||= Hogger::Routing::RouteCollection.new end def call(env)
Fix a Module error on Application
diff --git a/LeetCode/bootleg/find_all_sum_solutions.rb b/LeetCode/bootleg/find_all_sum_solutions.rb index abc1234..def5678 100644 --- a/LeetCode/bootleg/find_all_sum_solutions.rb +++ b/LeetCode/bootleg/find_all_sum_solutions.rb @@ -21,6 +21,21 @@ .reduce(:+) end +def count_sum_solution_dp(target) + dp = [0, 0] + (2..target).each { |i| + dp[i] = 0 + (1...i).each { |j| + dp[i] += 1 + dp[i - j] + } + } + + dp[target] +end + +assert_same(0, count_sum_solution_dp(1), "1 dp") +assert_same(1, count_sum_solution_dp(2), "2 dp") +assert_same(7, count_sum_solution_dp(4), "4 dp") assert_same(0, count_sum_solution(1), "1") assert_same(1, count_sum_solution(2), "2") assert_same(7, count_sum_solution(4), "4")
Read the fucking problem statement... count all sum solutions - DP
diff --git a/test/test_http_upload.rb b/test/test_http_upload.rb index abc1234..def5678 100644 --- a/test/test_http_upload.rb +++ b/test/test_http_upload.rb @@ -35,7 +35,7 @@ response = uploader.upload_attachment attachment assert_fail "Should throw an ApiError" rescue ApiError => e - assert_match "Session expired or authorization failed", e.message, + assert_match "Auth token not valid", e.message, end ensure Progstr::Filer.secret_key = "DEMO"
Update http test with latest error msg.
diff --git a/SackOfRainbows.podspec b/SackOfRainbows.podspec index abc1234..def5678 100644 --- a/SackOfRainbows.podspec +++ b/SackOfRainbows.podspec @@ -5,12 +5,12 @@ s.description = <<-DESC SackOfRainbows provides an expressive syntax to create color generators. Chain generators in serial or parallel to easily create gradients and complex patterns. DESC - s.homepage = "https://www.github.com/sozorogami/SackOfRainbows" + s.homepage = "https://github.com/sozorogami/SackOfRainbows" s.license = "MIT" s.author = { "Tyler Tape" => "tyler.tape@gmail.com" } s.social_media_url = "http://twitter.com/sozorogami" s.platform = :ios, "8.0" - s.source = { :git => "github.com/sozorogami/SackOfRainbows.git", :tag => "0.0.1" } + s.source = { :git => "https://github.com/sozorogami/SackOfRainbows.git", :tag => "v#{s.version}"} s.source_files = "SackOfRainbows/*.{swift,h}" s.public_header_files = "SackOfRainbows/*.h" end
Fix source URL in podspec
diff --git a/lib/fog/vsphere/requests/compute/vm_take_snapshot.rb b/lib/fog/vsphere/requests/compute/vm_take_snapshot.rb index abc1234..def5678 100644 --- a/lib/fog/vsphere/requests/compute/vm_take_snapshot.rb +++ b/lib/fog/vsphere/requests/compute/vm_take_snapshot.rb @@ -7,10 +7,10 @@ raise ArgumentError, "name is a required parameter" unless options.key? 'name' vm = get_vm_ref(options['instance_uuid']) task = vm.CreateSnapshot_Task( - name: options['name'], - description: options['description'] || '', - memory: options['memory'] || true, - quiesce: options['quiesce'] || false + :name => options['name'], + :description => options['description'] || '', + :memory => options['memory'] || true, + :quiesce => options['quiesce'] || false ) task.wait_for_completion
Use Ruby 1.8 hash syntax Changed a single hash to use 1.8 syntax to continue 1.8 support (at least for the time being).
diff --git a/lib/jekyll-responsive-image/extra_image_generator.rb b/lib/jekyll-responsive-image/extra_image_generator.rb index abc1234..def5678 100644 --- a/lib/jekyll-responsive-image/extra_image_generator.rb +++ b/lib/jekyll-responsive-image/extra_image_generator.rb @@ -2,6 +2,7 @@ module ResponsiveImage class ExtraImageGenerator < Jekyll::Generator include Jekyll::ResponsiveImage::Utils + include FileTest def generate(site) config = Config.new(site).to_h @@ -9,11 +10,13 @@ config['extra_images'].each do |pathspec| Dir.glob(site.in_source_dir(pathspec)) do |image_path| - path = Pathname.new(image_path) - relative_image_path = path.relative_path_from(site_source) + if FileTest.file?(image_path) + path = Pathname.new(image_path) + relative_image_path = path.relative_path_from(site_source) - result = ImageProcessor.process(relative_image_path, config) - result[:resized].each { |image| keep_resized_image!(site, image) } + result = ImageProcessor.process(relative_image_path, config) + result[:resized].each { |image| keep_resized_image!(site, image) } + end end end end
Add condition to extra image generation to only operate on 'files' returned by the glob
diff --git a/core/app/models/comment.rb b/core/app/models/comment.rb index abc1234..def5678 100644 --- a/core/app/models/comment.rb +++ b/core/app/models/comment.rb @@ -15,7 +15,9 @@ end - has_many :sub_comments, inverse_of: :parent + def sub_comments + SubComment.where(parent_id: self.id) + end index({ fact_data: 1, opinion: 1, created_at: 1})
Use method instead of relation
diff --git a/lib/rubella/input/json.rb b/lib/rubella/input/json.rb index abc1234..def5678 100644 --- a/lib/rubella/input/json.rb +++ b/lib/rubella/input/json.rb @@ -3,7 +3,13 @@ module Rubella module Input + # Gets data in JSON formate and translate it into a Ruby readable form to + # make it possible to handle the data. # + # TODO The validation of the data should happen here + # Check if data is array, with subarrays. Check, that all sub array have + # the same size. Check that all the content are numeric values between 0 + # and 100. # class JSON attr_reader :data
Add documentation and TODOs for JSON input
diff --git a/lib/services/http_post.rb b/lib/services/http_post.rb index abc1234..def5678 100644 --- a/lib/services/http_post.rb +++ b/lib/services/http_post.rb @@ -1,6 +1,4 @@ class Service::HttpPost < Service - Service.services.delete(self) - include HttpHelper alias receive_event deliver @@ -15,4 +13,3 @@ :guid => delivery_guid} end end -
Allow Serivce::HttpPost to be registered
diff --git a/lib/strict_open_struct.rb b/lib/strict_open_struct.rb index abc1234..def5678 100644 --- a/lib/strict_open_struct.rb +++ b/lib/strict_open_struct.rb @@ -1,10 +1,16 @@ require 'ostruct' -class StrictOpenStruct < OpenStruct - # Raises NoMethodError if the called method is not a setter and was not explicitly initialized with a value. +class StrictOpenStruct + + def initialize(*args) + @open_struct = OpenStruct.new(*args) + end + + # Raises NoMethodError unless the underlying OpenStruct + # responds to the method or the method is a setter def method_missing(method_name, *args, &block) - if respond_to?(method_name) || method_name =~ /=$/ - super + if @open_struct.respond_to?(method_name) || method_name =~ /=$/ + @open_struct.send(method_name, *args, &block) else fail NoMethodError, "undefined method `#{method_name}' for #{self}" end
Refactor so we don't inherit from core class
diff --git a/spec/controllers/api/contests/submissions_controller_spec.rb b/spec/controllers/api/contests/submissions_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/api/contests/submissions_controller_spec.rb +++ b/spec/controllers/api/contests/submissions_controller_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -RSpec.describe Api::Contests::SubmissionsController, type: :controller do +RSpec.describe Api::SubmissionsController, type: :controller do describe 'GET #index' do end
Fix spec to deal with renaming SubmissionsController.
diff --git a/recursion-vs-iteration/recursion_matt.rb b/recursion-vs-iteration/recursion_matt.rb index abc1234..def5678 100644 --- a/recursion-vs-iteration/recursion_matt.rb +++ b/recursion-vs-iteration/recursion_matt.rb @@ -1,3 +1,16 @@+require "benchmark" + +def all_prime_factors_recursive(num, factors = []) + + return nil if num == 1 + return factors << num if is_prime?(num) # base case: breaks the recursion + # base case must be conditional + + factors << lowest_factor(num) + num = num / lowest_factor(num) + all_prime_factors_recursive(num, factors) # the recursion +end + def is_prime?(num) factors = [] range = (2..num-1).to_a @@ -24,4 +37,11 @@ return false end end -end+end + +def lowest_factor(num) + range = (2..num-1).to_a + return range.find { |poss_factor| (num % poss_factor) == 0 } #finds the first possible factor +end + +puts Benchmark.measure{all_prime_factors_recursive(123123123)}
Add benchmark and working recursion solution
diff --git a/ouvrages_scaffold.gemspec b/ouvrages_scaffold.gemspec index abc1234..def5678 100644 --- a/ouvrages_scaffold.gemspec +++ b/ouvrages_scaffold.gemspec @@ -16,6 +16,6 @@ s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"] - s.add_dependency "rails", "~> 5.0.1" + s.add_dependency "rails", ">= 5.0.1" s.add_development_dependency "sqlite3" end
Fix dependency to works with Rails > 5.0.1
diff --git a/spec/factories/page_factory.rb b/spec/factories/page_factory.rb index abc1234..def5678 100644 --- a/spec/factories/page_factory.rb +++ b/spec/factories/page_factory.rb @@ -8,11 +8,5 @@ factory :page_with_layout do layout end - - # :parent_id => nil - - # factory :admin_user do - # spree_roles { [Spree::Role.find_by(name: 'admin') || create(:role, name: 'admin')] } - # end end end
Clean up copy/paste remnants in page factory
diff --git a/telemetry-logger.gemspec b/telemetry-logger.gemspec index abc1234..def5678 100644 --- a/telemetry-logger.gemspec +++ b/telemetry-logger.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'telemetry-logger' - s.version = '0.1.11' + s.version = '0.1.12' s.summary = 'Logging to STDERR with coloring and levels of severity' s.description = ' '
Package version number increased from 0.1.11 to 0.1.12
diff --git a/test/compilation_test.rb b/test/compilation_test.rb index abc1234..def5678 100644 --- a/test/compilation_test.rb +++ b/test/compilation_test.rb @@ -3,7 +3,7 @@ class CompilationTest < Test::Unit::TestCase def test_compilation path = 'vendor/assets/stylesheets' - %w(bootstrap responsive).each do |file| + %w(bootstrap bootstrap-responsive).each do |file| engine = Sass::Engine.for_file("#{path}/#{file}.scss", syntax: :scss, load_paths: [path]) assert_nothing_raised do engine.render
Fix import in the test
diff --git a/test/contrib/test_sys.rb b/test/contrib/test_sys.rb index abc1234..def5678 100644 --- a/test/contrib/test_sys.rb +++ b/test/contrib/test_sys.rb @@ -2,7 +2,13 @@ require 'test/unit' require 'test/filecreation' -require 'rake/contrib/sys' +begin + old_verbose = $VERBOSE + $VERBOSE = nil + require 'rake/contrib/sys' +ensure + $VERBOSE = old_verbose +end class TestSys < Test::Unit::TestCase include FileCreation
Disable expected sys warnings during test.
diff --git a/test/omise/test_token.rb b/test/omise/test_token.rb index abc1234..def5678 100644 --- a/test/omise/test_token.rb +++ b/test/omise/test_token.rb @@ -6,7 +6,7 @@ end def test_that_we_can_create_a_token - token = Omise::Token.create({ + token = Omise::Token.create(card: { name: "JOHN DOE", number: "4242424242424242", expiration_month: "1",
Add card param in token test
diff --git a/spec/hamlit/engine/error_spec.rb b/spec/hamlit/engine/error_spec.rb index abc1234..def5678 100644 --- a/spec/hamlit/engine/error_spec.rb +++ b/spec/hamlit/engine/error_spec.rb @@ -37,9 +37,10 @@ %9 HAML rescue Hamlit::SyntaxError => e - return unless e.respond_to?(:backtrace_locations) - line_number = e.backtrace_locations.first.to_s.match(/:(\d+):/)[1] - expect(line_number).to eq('8') + if e.respond_to?(:backtrace_locations) + line_number = e.backtrace_locations.first.to_s.match(/:(\d+):/)[1] + expect(line_number).to eq('8') + end end end end
Fix an error on Ruby 2.0
diff --git a/rspec-matchers_test.gemspec b/rspec-matchers_test.gemspec index abc1234..def5678 100644 --- a/rspec-matchers_test.gemspec +++ b/rspec-matchers_test.gemspec @@ -20,4 +20,5 @@ spec.add_development_dependency "bundler", "~> 1.7" spec.add_development_dependency "rake", "~> 10.0" + spec.add_development_dependency "rspec", "3.2" end
Set RSpec 3.2 dependency since it supports failure_message_for_should and failure_message_for_should_not
diff --git a/spec/dummy_app/app/models/fan.rb b/spec/dummy_app/app/models/fan.rb index abc1234..def5678 100644 --- a/spec/dummy_app/app/models/fan.rb +++ b/spec/dummy_app/app/models/fan.rb @@ -1,11 +1,5 @@ class Fan < ActiveRecord::Base validates_presence_of(:name) + has_and_belongs_to_many :teams - - RailsAdmin.config self do - label "Fans and friends" - label_for_navigation do - "#{config.label} Tab" - end - end end
Revert Fan model to it's original state
diff --git a/spec/integration/adapter_spec.rb b/spec/integration/adapter_spec.rb index abc1234..def5678 100644 --- a/spec/integration/adapter_spec.rb +++ b/spec/integration/adapter_spec.rb @@ -23,6 +23,21 @@ def adapter() DataMapper::Spec.adapter end def repository() DataMapper.repository(adapter.name) end + # Define a custom model with a UUID PK + def heffalump_model + @model ||= Class.new { + include DataMapper::Resource + + property :id, DataMapper::Property::Serial + property :color, DataMapper::Property::String + property :num_spots, DataMapper::Property::Integer + property :striped, DataMapper::Property::Boolean + + # This is needed for DataMapper.finalize + def self.name() 'Heffalump' end + }.tap { DataMapper.finalize } + end + before :all do setup_keyspace create_table
Add explicit model for shared spec * This model will be modified to use a UUID instead of a Serial property.
diff --git a/spec/requests/user_pages_spec.rb b/spec/requests/user_pages_spec.rb index abc1234..def5678 100644 --- a/spec/requests/user_pages_spec.rb +++ b/spec/requests/user_pages_spec.rb @@ -32,6 +32,11 @@ it "should not create a user" do expect { click_button submit}.not_to change(User, :count) end + + describe "after submition" do + before { click_button submit } + it { should have_selector('div#error_explanation') } + end end describe "with valid user data" do @@ -45,6 +50,13 @@ it "should create a user" do expect { click_button submit }.to change(User, :count).by(1) end + + describe "after submition" do + before { click_button submit } + let(:user) { User.find_by_email('test@example.com') } + + it { should have_selector('h1', text: user.name) } + end end end
Add tests for after new user submission
diff --git a/lib/fog/hp/models/compute/flavor.rb b/lib/fog/hp/models/compute/flavor.rb index abc1234..def5678 100644 --- a/lib/fog/hp/models/compute/flavor.rb +++ b/lib/fog/hp/models/compute/flavor.rb @@ -11,30 +11,10 @@ attribute :disk attribute :name attribute :ram - attribute :vcpus + attribute :cores, :aliases => 'vcpus' #def bits # 64 - #end - - #def cores - # # 2 quad-cores >= 2Ghz = 8 cores - # 8 * case ram - # when 256 - # 1/64.0 - # when 512 - # 1/32.0 - # when 1024 - # 1/16.0 - # when 2048 - # 1/8.0 - # when 4096 - # 1/4.0 - # when 8192 - # 1/2.0 - # when 15872 - # 1 - # end #end end
Add cores as an attribute to alias vcpus.
diff --git a/lib/nanoc-deploy/extra/deployers.rb b/lib/nanoc-deploy/extra/deployers.rb index abc1234..def5678 100644 --- a/lib/nanoc-deploy/extra/deployers.rb +++ b/lib/nanoc-deploy/extra/deployers.rb @@ -1,6 +1,6 @@ # encoding: utf-8 -module Nanoc3::Extra +module NanocDeploy::Extra module Deployers autoload 'Cloud', 'nanoc-deploy/extra/deployers/cloud' end
Fix typo in Deployers module name
diff --git a/lib/omniship/dhlgm/track/package.rb b/lib/omniship/dhlgm/track/package.rb index abc1234..def5678 100644 --- a/lib/omniship/dhlgm/track/package.rb +++ b/lib/omniship/dhlgm/track/package.rb @@ -25,8 +25,8 @@ # 600 : DELIVERED # 699 : DELIVERY STATUS NOT UPDATED def has_arrived? - activity.any? {|activity| - (activity.code == '699' and has_arrived_at_usps?) or ['570', '580', '590', '600'].include? activity.code + activity.any? {|activity| + ['570', '580', '590', '600'].include? activity.code } end @@ -35,7 +35,7 @@ # 538 : DEPART USPS SORT FACILITY # has been accepted by the post office or has been accepted any of these should be good def has_arrived_at_usps? - self.activity.any? do |activity| + self.activity.any? do |activity| activity.code == '510' or activity.code == '520' or activity.code == '538' end end
Revert "Revert "do not mark arrived if at usps"" This reverts commit 91bb774390d15792caf68946c1e4ecd3acbca76e.
diff --git a/app/models/timeslot.rb b/app/models/timeslot.rb index abc1234..def5678 100644 --- a/app/models/timeslot.rb +++ b/app/models/timeslot.rb @@ -10,14 +10,6 @@ def open? student.nil? - end - - def booked_slot - "#FF5722" - end - - def open_slot - "#2196F3" end def new_york_ordinal_time
Remove uneccessary model methods for determining color
diff --git a/db/migrate/20140601114738_create_users.rb b/db/migrate/20140601114738_create_users.rb index abc1234..def5678 100644 --- a/db/migrate/20140601114738_create_users.rb +++ b/db/migrate/20140601114738_create_users.rb @@ -1,7 +1,7 @@ class CreateUsers < ActiveRecord::Migration def change create_table :users do |t| - t.string :fisrt_name, null: false + t.string :first_name, null: false t.string :last_name, null: false t.string :email, null: false
Fix a typo in the create user migration
diff --git a/spec/client_spec.rb b/spec/client_spec.rb index abc1234..def5678 100644 --- a/spec/client_spec.rb +++ b/spec/client_spec.rb @@ -2,15 +2,22 @@ require "biased/client" describe(Biased::Client) do - before do - allow(Wikipedia).to( - receive_message_chain(:find, :content).and_return("owner = [[AOL]]") - ) - @client = Biased::Client.new("huffingtonpost.com") - end + context("creates a parent") do + it("with one word") do + allow(Wikipedia).to( + receive_message_chain(:find, :content).and_return("owner = [[AOL]]") + ) + @client = Biased::Client.new("huffingtonpost.com") + expect(@client.parent).to(eq("AOL")) + end - it("creates a parent") do - expect(@client.parent).to(eq("AOL")) + it("with two words") do + allow(Wikipedia).to( + receive_message_chain(:find, :content).and_return("owner = [[Vox Media]]") + ) + @client = Biased::Client.new("theverge.com") + expect(@client.parent).to(eq("Vox Media")) + end end end
Test parents which have two words
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -7,12 +7,16 @@ require 'infinity_test' require 'ostruct' +Bundler.require RSpec.configure do |config| config.include InfinityTest::Strategy::SharedExample config.include InfinityTest::Observer::SharedExample config.include InfinityTest::TestFramework::SharedExample config.include InfinityTest::Framework::SharedExample + + config.filter_run focus: true + config.run_all_when_everything_filtered = true config.expect_with :rspec do |c| c.syntax = :expect
Add focus feature to rspec specs
diff --git a/lib/activerecord_chronological_records.rb b/lib/activerecord_chronological_records.rb index abc1234..def5678 100644 --- a/lib/activerecord_chronological_records.rb +++ b/lib/activerecord_chronological_records.rb @@ -8,7 +8,7 @@ self.instance_eval <<-EOS def at(date) - where("#{start_column} <= :date AND (#{end_column} >= :date OR #{end_column} IS NULL)", :date => date) + where("(#{start_column} <= :date OR #{start_column} IS NULL) AND (#{end_column} >= :date OR #{end_column} IS NULL)", :date => date) end def current @@ -26,7 +26,7 @@ end def current? - #{start_column}.to_time <= Time.now && #{end_column}.to_time >= Time.now + (#{start_column}.blank? || #{start_column}.to_time <= Time.now) && (#{end_column}.blank? || #{end_column}.to_time >= Time.now) end def earliest
Handle start/end dates being blank
diff --git a/app/controllers/endorsements_controller.rb b/app/controllers/endorsements_controller.rb index abc1234..def5678 100644 --- a/app/controllers/endorsements_controller.rb +++ b/app/controllers/endorsements_controller.rb @@ -23,6 +23,7 @@ redirect_to endorsements_url, notice: 'La teva signatura ha estat recollida. Gràcies pel teu suport.' else @endorsements = Endorsement.visible.page "1" + @endorsements_counter = Endorsement.count flash.now[:error] = 'Alguna de les dades introduïdes no és correcta. Revisa-les i torna a provar.' render :index end
Fix counter issue on failing endorsement creation
diff --git a/app/controllers/kaui/credits_controller.rb b/app/controllers/kaui/credits_controller.rb index abc1234..def5678 100644 --- a/app/controllers/kaui/credits_controller.rb +++ b/app/controllers/kaui/credits_controller.rb @@ -23,13 +23,13 @@ # No need to show the newly created invoice for account level credits should_redirect_to_invoice = credit.invoice_id.present? - credit = credit.create(true, current_user.kb_username, params[:reason], params[:comment], options_for_klient) + credits = credit.create(true, current_user.kb_username, params[:reason], params[:comment], options_for_klient) flash[:notice] = 'Credit was successfully created' if should_redirect_to_invoice - redirect_to kaui_engine.account_invoice_path(credit.account_id, credit.invoice_id) + redirect_to kaui_engine.account_invoice_path(credits[0].account_id, credits[0].invoice_id) else - redirect_to kaui_engine.account_path(credit.account_id) + redirect_to kaui_engine.account_path(credits[0].account_id) end end end
Fix credit controller to support receiving multiple credit items back
diff --git a/app/models/gobierto_common/custom_field.rb b/app/models/gobierto_common/custom_field.rb index abc1234..def5678 100644 --- a/app/models/gobierto_common/custom_field.rb +++ b/app/models/gobierto_common/custom_field.rb @@ -20,6 +20,7 @@ translates :name before_create :set_uid, :set_position + after_validation :check_depending_uids def self.field_types_with_options field_types.select { |key, _| /option/.match(key) } @@ -50,5 +51,18 @@ self.class.where(site_id: site_id, class_name: class_name).maximum(:position).to_i + 1 end end + + def check_depending_uids + return unless changes[:uid].present? + + records.where("payload->>? IS NOT NULL", uid_was).each do |record| + record.update_attribute( + :payload, + record.payload.tap do |hash| + hash[uid] = hash.delete uid_was + end + ) + end + end end end
Update payload key of depending records when custom field uid changes
diff --git a/lib/avoid_metreon/moscone_event_crawler.rb b/lib/avoid_metreon/moscone_event_crawler.rb index abc1234..def5678 100644 --- a/lib/avoid_metreon/moscone_event_crawler.rb +++ b/lib/avoid_metreon/moscone_event_crawler.rb @@ -7,7 +7,7 @@ base_url 'http://www.moscone.com/site/do/event/list' - items 'xpath=//table[@id=\'list\']/tr[td+td+td+td]', :iterator do + items 'xpath=//table[@id=\'list\']/tr[td[4]]', :iterator do start_date xpath: 'td[1]' do |d| Date.strptime(d.split(' - ').first, '%m/%d/%y') end
Fix selector for calendar rows. The + symbol isn't actually supported in XPath. By using it, the event crawler was always matching 0 elements. Instead, you can select an element and specify its position within its parent element.
diff --git a/app/serializers/task_comment_serializer.rb b/app/serializers/task_comment_serializer.rb index abc1234..def5678 100644 --- a/app/serializers/task_comment_serializer.rb +++ b/app/serializers/task_comment_serializer.rb @@ -1,7 +1,17 @@ class TaskCommentSerializer < ActiveModel::Serializer - attributes :id, :comment, :created_at, :comment_by + attributes :id, :comment, :created_at, :author, :recipient - def comment_by - object.user.name + def author + { + id: object.user.id, + name: object.user.name, + } + end + + def recipient + { + id: object.recipient.id, + name: object.recipient.name, + } end end
ENHANCE: Add author and recipient to task comment serialiser
diff --git a/brainfuck.rb b/brainfuck.rb index abc1234..def5678 100644 --- a/brainfuck.rb +++ b/brainfuck.rb @@ -1,6 +1,6 @@ memory_idx = 0 ip = 0 -main_memory = Array.new(30000, 0) +main_memory = Array.new(256, 0) program = File.read("program.bf")
Reduce memory allocation for these toy examples
diff --git a/lib/patch/active_record/connection_pool.rb b/lib/patch/active_record/connection_pool.rb index abc1234..def5678 100644 --- a/lib/patch/active_record/connection_pool.rb +++ b/lib/patch/active_record/connection_pool.rb @@ -40,6 +40,7 @@ synchronize do super.tap do |stat| stat[:idle_timeout] = @idle_timeout + stat[:janitor_frequency] = @janitor && @janitor.frequency end end end
Add janitor frequency setting to pool stat
diff --git a/226_invert_binary_tree.rb b/226_invert_binary_tree.rb index abc1234..def5678 100644 --- a/226_invert_binary_tree.rb +++ b/226_invert_binary_tree.rb @@ -0,0 +1,18 @@+# Definition for a binary tree node. +# class TreeNode +# attr_accessor :val, :left, :right +# def initialize(val) +# @val = val +# @left, @right = nil, nil +# end +# end + +# @param {TreeNode} root +# @return {TreeNode} +def invert_tree(root) + return [] if root == nil + root.left, root.right = root.right, root.left + invert_tree(root.left) + invert_tree(root.right) + root +end
Add invert binary tree problem
diff --git a/scripts/verify-buildpack-binaries.rb b/scripts/verify-buildpack-binaries.rb index abc1234..def5678 100644 --- a/scripts/verify-buildpack-binaries.rb +++ b/scripts/verify-buildpack-binaries.rb @@ -1,7 +1,7 @@ #! /usr/bin/env ruby buildpacks_ci_dir = File.expand_path(File.join(File.dirname(__FILE__), '..')) -require_relative "#{buildpacks_ci_dir}/lib/buildpack-binary-md5-validator" +require_relative "#{buildpacks_ci_dir}/lib/buildpack-binary-md5-verifier" # uris that should not be checked because the binaries are already replaced and # we have vetted these uris/agree that they're not a concern
Correct relative pathing for including buildpack-binary-md5-verifier [#128159787]
diff --git a/billplz.gemspec b/billplz.gemspec index abc1234..def5678 100644 --- a/billplz.gemspec +++ b/billplz.gemspec @@ -17,6 +17,6 @@ spec.require_paths = ["lib"] spec.add_development_dependency "rake" - spec.add_development_dependency "test-unit" - spec.add_development_dependency "mocha" + spec.add_development_dependency "test-unit", "~> 1" + spec.add_development_dependency "mocha", "~> 3" end
Add version numbers to dependencies
diff --git a/app/controllers/news_items_controller.rb b/app/controllers/news_items_controller.rb index abc1234..def5678 100644 --- a/app/controllers/news_items_controller.rb +++ b/app/controllers/news_items_controller.rb @@ -1,9 +1,10 @@ class NewsItemsController < ApplicationController include NewsItemsHelper + before_filter :load_networks, :only => [:index, :search] + def index get_news_items - @networks = Network.all end def sort_options @@ -26,4 +27,8 @@ model = model_name.classify.constantize @news_items = model.with_sort(params[:sort_by]).by_network(current_network).paginate(:page => params[:page]) end + + def load_networks + @networks = Network.all + end end
Load networks for browsing and searching news items
diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -14,4 +14,24 @@ expect(response).to be_success end end + + describe 'PUT update' do + it 'does not work for anonymous user' do + put :update, params: { format: :json, email: 'hey@example.com' } + expect(response).to have_http_status(401) + end + + it 'updates current user' do + user = create(:user) + sign_in user + put :update, params: { + format: :json, email: 'hey@example.com', region: 'eu', + platform: 'xbl' + } + expect(response).to be_success + expect(user.reload.email).to eq('hey@example.com') + expect(user.region).to eq('eu') + expect(user.platform).to eq('xbl') + end + end end
Add tests for user update endpoint
diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -0,0 +1,42 @@+require 'rails_helper' + +describe UsersController do + let(:user) { create(:user) } + + #write feature test for signed-in/signed-out + describe 'GET #show' do + it 'renders #show' do + get :show + expect(response).to be_success + end + end + + describe 'GET #edit' do + it 'renders #edit' do + get :show + expect(response).to be_success + end + end + + + describe 'PATCH #update' do + context 'when information is valid' do + it 'successfully updates user' do + valid_user = attributes_for(:user, first_name: 'The', last_name: 'Rock', + phone: '1234567890', image: 'http://media3.s-nbcnews.com/i/newscms/2015_37/764896/the-rock-saves-puppy-today-tease-1-150908_54fb4b0bfa08dee373c956cefb9b9c49.jpg') + + patch(:update, user: valid_user) + response.should render_template("show") + end + end + + context 'when information is invalid' do + it 'renders #edit' do + invalid_user = attributes_for(:user, phone: 'not a string of numbers') + + patch(:update, user: invalid_user) + response.should render_template("edit") + end + end + end +end
Add tests for Users controller
diff --git a/spec/features/issues/note_polling_spec.rb b/spec/features/issues/note_polling_spec.rb index abc1234..def5678 100644 --- a/spec/features/issues/note_polling_spec.rb +++ b/spec/features/issues/note_polling_spec.rb @@ -0,0 +1,18 @@+require 'spec_helper' + +feature 'Issue notes polling' do + let!(:project) { create(:project, :public) } + let!(:issue) { create(:issue, project: project) } + + background do + visit namespace_project_issue_path(project.namespace, project, issue) + end + + scenario 'Another user adds a comment to an issue', js: true do + note = create(:note_on_issue, noteable: issue, + project_id: project.project_id, + note: 'Looks good!') + sleep 16 # refresh interval in notes.js.coffee, 15 seconds + expect(page).to have_selector("#note_#{note.id}", text: 'Looks good!') + end +end
Add feature specs for note polling Ref. #4032, !2084
diff --git a/spec/routing/dice_rolls_routing_spec.rb b/spec/routing/dice_rolls_routing_spec.rb index abc1234..def5678 100644 --- a/spec/routing/dice_rolls_routing_spec.rb +++ b/spec/routing/dice_rolls_routing_spec.rb @@ -0,0 +1,9 @@+require "rails_helper" + +RSpec.describe DiceRollsController, type: :routing do + describe "routing" do + it "routes to #create" do + expect(:post => "/games/1/dice_rolls").to route_to("dice_rolls#create", :game_id => "1") + end + end +end
Add routing spec for dice rolls
diff --git a/spec/views/help/index.html.haml_spec.rb b/spec/views/help/index.html.haml_spec.rb index abc1234..def5678 100644 --- a/spec/views/help/index.html.haml_spec.rb +++ b/spec/views/help/index.html.haml_spec.rb @@ -0,0 +1,55 @@+require 'rails_helper' + +describe 'help/index' do + describe 'version information' do + it 'is hidden from guests' do + stub_user + stub_version('8.0.2', 'abcdefg') + stub_helpers + + render + + expect(rendered).not_to match '8.0.2' + expect(rendered).not_to match 'abcdefg' + end + + it 'is hidden from users' do + stub_user(admin?: false) + stub_version('8.0.2', 'abcdefg') + stub_helpers + + render + + expect(rendered).not_to match '8.0.2' + expect(rendered).not_to match 'abcdefg' + end + + it 'is shown to admins' do + stub_user(admin?: true) + stub_version('8.0.2', 'abcdefg') + stub_helpers + + render + + expect(rendered).to match '8.0.2' + expect(rendered).to match 'abcdefg' + end + end + + def stub_user(messages = {}) + user = messages.empty? ? nil : double(messages) + + allow(view).to receive(:current_user).and_return(user) + end + + def stub_version(version, revision) + stub_const('Gitlab::VERSION', version) + stub_const('Gitlab::REVISION', revision) + end + + def stub_helpers + allow(view).to receive(:markdown).and_return('') + allow(view).to receive(:current_application_settings). + and_return(double.as_null_object) + end +end
Add a view spec (gasp!) for help/index
diff --git a/Casks/font-fira-code.rb b/Casks/font-fira-code.rb index abc1234..def5678 100644 --- a/Casks/font-fira-code.rb +++ b/Casks/font-fira-code.rb @@ -1,10 +1,13 @@ cask :v1 => 'font-fira-code' do - version '0.6' - sha256 '0ae8324527fbcbaf93eaf7be1171b5fa039b8444154a7262a914f75c6da78aae' + version '1.100' + sha256 '7d003a4b0e55b44135cad4d9c87fc87b96a3fbfaebcba03cb3e92ce49dcff9ba' - url 'https://github.com/tonsky/FiraCode/releases/download/0.6/FiraCode-Regular.otf' + url "https://github.com/tonsky/FiraCode/releases/download/#{version}/FiraCode_#{version}.zip" homepage 'https://github.com/tonsky/FiraCode' license :ofl font 'FiraCode-Regular.otf' + font 'FiraCode-Bold.otf' + font 'FiraCode-Medium.otf' + font 'FiraCode-Retina.otf' end
Update Fira Code to 1.100
diff --git a/StompClient.podspec b/StompClient.podspec index abc1234..def5678 100644 --- a/StompClient.podspec +++ b/StompClient.podspec @@ -9,7 +9,7 @@ s.author = { "ShengHua Wu" => "fantasy0404@gmail.com" } s.social_media_url = "https://twitter.com/ShengHuaWu" s.platform = :ios, "9.0" - s.source = { :git => "https://github.com/vetikett/StompClient.git", :tag => s.version.to_s } + s.source = { :git => "https://github.com/ShengHuaWu/StompClient.git", :tag => s.version.to_s } s.source_files = "StompClient/*.swift" s.requires_arc = true s.dependency "Starscream", "~> 2.0.0"
Fix the source url in podspec file.
diff --git a/recipes/source_install.rb b/recipes/source_install.rb index abc1234..def5678 100644 --- a/recipes/source_install.rb +++ b/recipes/source_install.rb @@ -21,7 +21,7 @@ source_version = "v#{node[:consul][:version]}" env = { - 'PATH' => "#{node[:go][:install_dir]}/bin:#{node[:go][:gobin]}:/usr/bin", + 'PATH' => "#{node[:go][:install_dir]}/go/bin:#{node[:go][:install_dir]}/bin:#{node[:go][:gobin]}:/usr/bin", 'GOPATH' => node[:go][:gopath] }
Fix the path to the go binary.
diff --git a/grizzly_ber.gemspec b/grizzly_ber.gemspec index abc1234..def5678 100644 --- a/grizzly_ber.gemspec +++ b/grizzly_ber.gemspec @@ -10,4 +10,5 @@ s.homepage = '' s.license = 'MIT' s.files = ["lib/grizzly_ber.rb", "lib/grizzly_tag.rb"] + s.required_ruby_version = '>= 2.0.0' #This gem uses some keyword args end
Set minimum ruby version in gemspec
diff --git a/0_code_wars/triple_shiftian.rb b/0_code_wars/triple_shiftian.rb index abc1234..def5678 100644 --- a/0_code_wars/triple_shiftian.rb +++ b/0_code_wars/triple_shiftian.rb @@ -0,0 +1,25 @@+# http://www.codewars.com/kata/56b7526481290c2ff1000c75/ +# --- iteration 1 --- +def triple_shiftian(base, n, memo={}) + if n < 3 + return base[n] + else + return_val = (4 * (memo[(n-1)] || triple_shiftian(base, n-1, memo))) \ + - (5 * (memo[(n-2)] || triple_shiftian(base, n-2, memo))) \ + + (3 * (memo[(n-3)] || triple_shiftian(base, n-3, memo))) + memo[n] ||= return_val + return return_val + end +end + +# --- iteration 2 --- +def triple_shiftian(base, n, memo = {}) + return memo[n] if memo[n] + return base[n] if n < 3 + memo[n] = 4*triple_shiftian(base, n-1, memo) - 5*triple_shiftian(base, n-2, memo) + 3*triple_shiftian(base, n-3, memo) +end + +# --- iteration 3 --- +def triple_shiftian(b, n) + (3..n).each{ |i| b << 4*b[i-1] - 5*b[i-2] + 3*b[i-3] } and n < 3 ? b[n] : b.last +end
Add code wars (7) triple shiftian
diff --git a/AFNetworking+AutoRetry.podspec b/AFNetworking+AutoRetry.podspec index abc1234..def5678 100644 --- a/AFNetworking+AutoRetry.podspec +++ b/AFNetworking+AutoRetry.podspec @@ -14,6 +14,7 @@ :tag => "v#{s.version}" } s.ios.deployment_target = '6.0' + s.osx.deployment_target = '10.8' s.requires_arc = true s.source_files = '*.{h,m}'
Update Podspec to support osx AFNetworking fully supports both iOS and OSX. Since this is just a category on AFHTTPRequestOperationManager and AFHTTPSessionManager the pod spec should inherit the dependencies of the Base Spec
diff --git a/spec/factories/user_factory.rb b/spec/factories/user_factory.rb index abc1234..def5678 100644 --- a/spec/factories/user_factory.rb +++ b/spec/factories/user_factory.rb @@ -5,6 +5,9 @@ email { "#{username}@example.com" } firstname 'Dev' lastname 'Eloper' + institution_code 'NYU' + aleph_id { (ENV['BOR_ID'] || 'BOR_ID') } + provider 'nyu_shibboleth' trait :nyu_aleph_attributes do patron_status '51' end
Use the new columns and remove the old ones in the UserFactory
diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index abc1234..def5678 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -18,6 +18,7 @@ # Install module and dependencies hosts.each do |host| copy_module_to(host, source: proj_root, module_name: 'puppet') + on host, puppet('module install puppet-extlib'), acceptable_exit_codes: [0, 1] on host, puppet('module install puppetlabs-stdlib'), acceptable_exit_codes: [0, 1] end end
Add missing dependency for Beaker tests
diff --git a/app/controllers/admin/base_controller.rb b/app/controllers/admin/base_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/base_controller.rb +++ b/app/controllers/admin/base_controller.rb @@ -30,12 +30,12 @@ end rescue_from Whitehall::Authority::Errors::PermissionDenied do |exception| - puts "You can't #{exception.action} that #{exception.subject}" + logger.warn "Attempt to perform '#{exception.action}' on #{exception.subject} prevented." forbidden! end rescue_from Whitehall::Authority::Errors::InvalidAction do |exception| - puts "Trying to do #{exception.action} which isn't a real action" + logger.warn "Attempt to perform unknown action '#{exception.action}' prevented." forbidden! end
Replace debug puts statements with logger.warn
diff --git a/paid.gemspec b/paid.gemspec index abc1234..def5678 100644 --- a/paid.gemspec +++ b/paid.gemspec @@ -9,7 +9,7 @@ s.version = Paid::VERSION s.authors = ['Ryan Jackson'] s.email = ['ryan@paidapi.com'] - s.homepage = 'https://docs.paidapi.com' + s.homepage = 'http://docs.paidapi.com' s.summary = 'Ruby bindings for Paid API' s.description = 'Paid is the programmatic way to manage payments. See https://paidapi.com for details.' s.license = 'MIT'
Update homepage url to be http
diff --git a/Wrap.podspec b/Wrap.podspec index abc1234..def5678 100644 --- a/Wrap.podspec +++ b/Wrap.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Wrap" - s.version = "2.1.0" + s.version = "2.1.1" s.summary = "The easy to use Swift JSON encoder" s.description = <<-DESC Wrap is an easy to use Swift JSON encoder. Don't spend hours writing JSON encoding code - just wrap it instead!
Bump Podspec to version 2.1.1
diff --git a/spec/classes/trove_db_postgresql_spec.rb b/spec/classes/trove_db_postgresql_spec.rb index abc1234..def5678 100644 --- a/spec/classes/trove_db_postgresql_spec.rb +++ b/spec/classes/trove_db_postgresql_spec.rb @@ -15,6 +15,8 @@ let :params do req_params end + + it { is_expected.to contain_class('trove::deps') } it { is_expected.to contain_openstacklib__db__postgresql('trove').with( :user => 'trove',
Include deps class in unit test for postgresql Change-Id: I9bafbff58643af7734c883326e819faa4bbddbb3
diff --git a/spec/integration/user_attributes_spec.rb b/spec/integration/user_attributes_spec.rb index abc1234..def5678 100644 --- a/spec/integration/user_attributes_spec.rb +++ b/spec/integration/user_attributes_spec.rb @@ -0,0 +1,48 @@+require 'spec_helper' + +describe ROM::Model::Attributes do + let(:attributes) do + Class.new do + include ROM::Model::Attributes + + attribute :name, String + + timestamps + end + end + + describe '.timestamps' do + it 'provides a way to specify timestamps with default values' do + expect(attributes.new.created_at).to be_a(DateTime) + expect(attributes.new.updated_at).to be_a(DateTime) + end + + context 'passing in arbritrary names' do + it 'excludes :created_at when passing in :updated_at' do + attributes = Class.new { + include ROM::Model::Attributes + + timestamps(:updated_at) + } + + model = attributes.new + + expect(model).not_to respond_to(:created_at) + expect(model).to respond_to(:updated_at) + end + + it 'accepts multiple timestamp attribute names' do + attributes = Class.new { + include ROM::Model::Attributes + + timestamps(:published_at, :revised_at) + } + + model = attributes.new + + expect(model).to respond_to(:published_at) + expect(model).to respond_to(:revised_at) + end + end + end +end
Reorganize spec locations and rake spec tasks
diff --git a/app/models/topic.rb b/app/models/topic.rb index abc1234..def5678 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -27,7 +27,16 @@ index node_id: 1 index user_id: 1 index last_active_mark: -1 - index like_count: 1 + index likes_count: 1 index suggested_at: 1 index excellent: -1 + + scope :no_reply, -> { where(replies_count: 0) } + scope :high_replies, -> { desc(:replies_count, :_id) } + scope :high_likes, -> { desc(:likes_count, :_id) } + scope :last_activated, -> { desc(:last_active_mark) } + scope :suggest, -> { where(:suggested_at.ne => nil).desc(:suggested_at) } + scope :popluar, -> { where(:like_count.gt => 5 ) } + scope :excellent, -> { where(:excellent.gte => 1) } + scope :without_node_ids, Proc.new { |ids| where(:node_ids.nin => ids) } end
Add the scope method for the Topic model for easier query.
diff --git a/spec/acceptance/puppetserver_spec.rb b/spec/acceptance/puppetserver_spec.rb index abc1234..def5678 100644 --- a/spec/acceptance/puppetserver_spec.rb +++ b/spec/acceptance/puppetserver_spec.rb @@ -23,7 +23,7 @@ describe port(8140) do it 'should listen on port 8140' do - pending 'Need to wait for puppetserver to start' + sleep 60 should be_listening end end
Add sleep in acceptance tests to give a change to puppetserver to be up before testing port listening
diff --git a/spec/models/protected_branch_spec.rb b/spec/models/protected_branch_spec.rb index abc1234..def5678 100644 --- a/spec/models/protected_branch_spec.rb +++ b/spec/models/protected_branch_spec.rb @@ -37,19 +37,6 @@ end end - describe '#update_repository' do - let(:gitolite) { mock } - - subject { ProtectedBranch.new(:project => project) } - - it "updates the branch's project repo permissions" do - Gitlab::GitHost.should_receive(:system).and_return(gitolite) - gitolite.should_receive(:update_project).with(project.path, project) - - subject.update_repository - end - end - describe '#commit' do subject { ProtectedBranch.new(:project => project, :name => 'cant_touch_this') }
Remove useless Protected branch test
diff --git a/spec/nanoc/cli/commands/view_spec.rb b/spec/nanoc/cli/commands/view_spec.rb index abc1234..def5678 100644 --- a/spec/nanoc/cli/commands/view_spec.rb +++ b/spec/nanoc/cli/commands/view_spec.rb @@ -0,0 +1,29 @@+describe Nanoc::CLI::Commands::View, site: true, stdio: true do + describe '#run' do + def run_nanoc_cmd(cmd) + pid = fork { Nanoc::CLI.run(cmd) } + + # Wait for server to start up + 10.times do + begin + Net::HTTP.get('0.0.0.0', '/', 50_385) + rescue Errno::ECONNREFUSED + sleep 0.1 + retry + end + break + end + + yield + ensure + Process.kill('TERM', pid) + end + + it 'serves /index.html as /' do + File.write('output/index.html', 'Hello there! Nanoc loves you! <3') + run_nanoc_cmd(['view', '--port', '50385']) do + expect(Net::HTTP.get('0.0.0.0', '/', 50_385)).to eql('Hello there! Nanoc loves you! <3') + end + end + end +end
Add spec for view command
diff --git a/app/controllers/interviews_controller.rb b/app/controllers/interviews_controller.rb index abc1234..def5678 100644 --- a/app/controllers/interviews_controller.rb +++ b/app/controllers/interviews_controller.rb @@ -11,7 +11,6 @@ @interview.update hired: false, interview_note: params[:interview_note] end - # TODO: some kind of API call to create users. redirect_to staff_dashboard_path else show_errors @interview end
Remove TODO related to future API call to create users We'll integrate the apps when we integrate the apps. When that happens, we'll know where to go. No need to clutter up the source code with this. Closes #160.
diff --git a/lib/badgeoverflow/core/models/badges/moderation/civic_duty.rb b/lib/badgeoverflow/core/models/badges/moderation/civic_duty.rb index abc1234..def5678 100644 --- a/lib/badgeoverflow/core/models/badges/moderation/civic_duty.rb +++ b/lib/badgeoverflow/core/models/badges/moderation/civic_duty.rb @@ -36,12 +36,8 @@ end end -class Electorate < CivicDuty - def progress_title - "Have you considered..." - end - - def calculate_progress! - self.progress_description = description +class Electorate < Badge + def series + :civic_duty end end
Refactor Electorate badge to inherit from Badge class, not CivicDuty
diff --git a/lib/govuk_message_queue_consumer/test_helpers/mock_message.rb b/lib/govuk_message_queue_consumer/test_helpers/mock_message.rb index abc1234..def5678 100644 --- a/lib/govuk_message_queue_consumer/test_helpers/mock_message.rb +++ b/lib/govuk_message_queue_consumer/test_helpers/mock_message.rb @@ -7,9 +7,7 @@ alias_method :retried?, :retried def initialize(payload = {}, headers = {}, delivery_info = {}) - @payload = payload - @headers = OpenStruct.new(headers) - @delivery_info = OpenStruct.new(delivery_info) + super(payload, OpenStruct.new(headers), OpenStruct.new(delivery_info)) end def ack
Use super to initialise MockMessage This resolves a rubocop violation.
diff --git a/jedict.gemspec b/jedict.gemspec index abc1234..def5678 100644 --- a/jedict.gemspec +++ b/jedict.gemspec @@ -7,7 +7,6 @@ s.authors = ["Sylvain Leclercq"] s.email = 'maisbiensurqueoui@gmail.com' s.files = ["lib/jedict.rb"] - s.executables.concat nil s.homepage = 'http://www.github.com/de-passage/jedict' s.license = 'MIT'
Fix generation error in gemspec
diff --git a/spec/watirspec/meta_spec.rb b/spec/watirspec/meta_spec.rb index abc1234..def5678 100644 --- a/spec/watirspec/meta_spec.rb +++ b/spec/watirspec/meta_spec.rb @@ -8,7 +8,7 @@ describe "#exist?" do it "returns true if the meta tag exists" do - browser.meta('http-equiv', "Content-Type").should exist + browser.meta(:http_equiv, "Content-Type").should exist end it "returns the first meta if given no args" do
Fix meta spec after merge..
diff --git a/factlink_blacklist.gemspec b/factlink_blacklist.gemspec index abc1234..def5678 100644 --- a/factlink_blacklist.gemspec +++ b/factlink_blacklist.gemspec @@ -6,10 +6,10 @@ Gem::Specification.new do |spec| spec.name = "factlink_blacklist" spec.version = FactlinkBlacklist::VERSION - spec.authors = ["Mark IJbema"] - spec.email = ["markijbema@gmail.com"] - spec.summary = %q{TODO: Write a short summary. Required.} - spec.description = %q{TODO: Write a longer description. Optional.} + spec.authors = ["Mark IJbema", "Eamon Nerbonne"] + spec.email = ["markijbema@gmail.com", "eamon@nerbonne.org"] + spec.summary = "Generates regular expresions that identify urls where (factlink) annotation is unwanted." + spec.description = "" spec.homepage = "" spec.license = "MIT"
Update gemspec (make it valid, for one)
diff --git a/week-6/bingo_solution.rb b/week-6/bingo_solution.rb index abc1234..def5678 100644 --- a/week-6/bingo_solution.rb +++ b/week-6/bingo_solution.rb @@ -0,0 +1,80 @@+# A Nested Array to Model a Bingo Board SOLO CHALLENGE + +# I spent [#] hours on this challenge. + + +# Release 0: Pseudocode +# Outline: + +# Create a method to generate a letter ( b, i, n, g, o) and a number (1-100) + #Method 1 call + # The letters we are going to need a sample letter from(bingo) + #- The numbers will be random number within the range (1-99) + +# Method 2 Check the called column for the number called. + #look to see if the number given is in column + #This should go to the corsponding letter and look if number is there. + +# If the number is in the column, replace with an 'x' + #If the bord has the number we will replace it with an x + #We are going to have to look over the entire array to find the called number + +# Display a column to the console + #We will print out the column to the console stacked on top of one another. + +# Display the board to the console (prettily) + #Print the new to the console so it lays out like a board.. remove the brackets. + +# Initial Solution + +class BingoBoard + + def initialize(board) + @bingo_board = board + + end + +end + +class Call + + def initialize(board_letter, board_number) + @letter = board_letter + @number = board_number + end + def next_letter + @letter.sample + end + def next_number + @number + end + +end + +# class Check +# def initialize +# @bingo_board = BingoBoard.new + + +#____________________________________________________________ +#DRIVER CODE (I.E. METHOD CALLS) GO BELOW THIS LINE +board = [[47, 44, 71, 8, 88], + [22, 69, 75, 65, 73], + [83, 85, 97, 89, 57], + [25, 31, 96, 68, 51], + [75, 70, 54, 80, 83]] + +board_letter = ['B', 'I', 'N', 'G', 'O'] +board_number = rand(1..99) + +new_game = BingoBoard.new(board) + p new_game. +#this is going to select the next letter for the game +new_ball = Call.new(board_letter, board_number) +p new_ball.next_letter +p new_ball.next_number + + + + +#Reflection
Add firt trial of solo project/letter and number working
diff --git a/copilot.gemspec b/copilot.gemspec index abc1234..def5678 100644 --- a/copilot.gemspec +++ b/copilot.gemspec @@ -17,7 +17,7 @@ s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"] s.test_files = Dir["test/**/*"] - s.add_dependency "rails", "~> 4.2.0" + s.add_dependency "rails", "~> 4.0" s.add_development_dependency "sqlite3" s.add_development_dependency "jquery-rails"
Update dependency version of rails
diff --git a/collaborate.gemspec b/collaborate.gemspec index abc1234..def5678 100644 --- a/collaborate.gemspec +++ b/collaborate.gemspec @@ -9,9 +9,8 @@ s.version = Collaborate::VERSION s.authors = ['Hayden Ball'] s.email = ['hayden@haydenball.me.uk'] - s.homepage = 'TODO' - s.summary = 'TODO: Summary of Collaborate.' - s.description = 'TODO: Description of Collaborate.' + s.homepage = 'https://github.com/ball-hayden/Collaborate' + s.summary = 'A Rails gem for real-time collaboration using ActionCable' s.license = 'MIT' s.files = Dir['{app,config,db,lib}/**/*', 'MIT-LICENSE', 'Rakefile', 'README.rdoc']
Add summary and homepage to gemspec
diff --git a/app/controllers/study_groups_controller.rb b/app/controllers/study_groups_controller.rb index abc1234..def5678 100644 --- a/app/controllers/study_groups_controller.rb +++ b/app/controllers/study_groups_controller.rb @@ -20,7 +20,7 @@ def update myparams = study_group_params - myparams[:users] = StudyGroupMembership.find(myparams[:study_group_membership_ids].reject(&:empty?)).map(&:user) + myparams[:external_users] = StudyGroupMembership.find(myparams[:study_group_membership_ids].reject(&:empty?)).map(&:user) myparams.delete(:study_group_membership_ids) update_and_respond(object: @study_group, params: myparams) end
Fix update of StudyGroups after providing all (int + ext) users
diff --git a/app/helpers/spree/base_helper_decorator.rb b/app/helpers/spree/base_helper_decorator.rb index abc1234..def5678 100644 --- a/app/helpers/spree/base_helper_decorator.rb +++ b/app/helpers/spree/base_helper_decorator.rb @@ -5,6 +5,8 @@ max_price = prices.max_by(&:price) min_price = prices.min_by(&:price) + if !max_price || !min_price + "재고가 없습니다" if max_price.price == min_price.price max_price.display_price.to_html else
Add "out of stock" error message if item doesn't have a max or min price
diff --git a/lib/apns-s3.rb b/lib/apns-s3.rb index abc1234..def5678 100644 --- a/lib/apns-s3.rb +++ b/lib/apns-s3.rb @@ -22,7 +22,7 @@ bucketname: nil, filename: nil ) - unless File.exists? filename + unless File.exist? filename credentials = Aws::Credentials.new( aws_access_key_id, aws_secret_access_key )
Fix from "File.exists?" method to "File.exist?"
diff --git a/lib/bourbon.rb b/lib/bourbon.rb index abc1234..def5678 100644 --- a/lib/bourbon.rb +++ b/lib/bourbon.rb @@ -1,7 +1,3 @@-# CodeKit needs relative paths -dir = File.dirname(__FILE__) -$LOAD_PATH.unshift dir unless $LOAD_PATH.include?(dir) - require "bourbon/generator" module Bourbon
Remove left over path helpers
diff --git a/lib/html_mockup/release/finalizers/dir.rb b/lib/html_mockup/release/finalizers/dir.rb index abc1234..def5678 100644 --- a/lib/html_mockup/release/finalizers/dir.rb +++ b/lib/html_mockup/release/finalizers/dir.rb @@ -5,16 +5,16 @@ # The directory name will have the format PREFIX-VERSION # module HtmlMockup::Release::Finalizers - class Dir < Base - def initialize(options = {}) - @options = options - end - + class Dir < Base # @option options :prefix Prefix to put before the version (default = "html") def call(release, options = {}) - @options.update(options) + if options + options = @options.dup.update(options) + else + options = @options + end - name = [(@options[:prefix] || "html"), release.scm.version].join("-") + name = [(options[:prefix] || "html"), release.scm.version].join("-") release.log(self, "Finalizing release to #{release.target_path + name}") if File.exist?(release.target_path + name)
Update Finalizers::Dir to new options interface
diff --git a/website/spec/controllers/sessions_controller_spec.rb b/website/spec/controllers/sessions_controller_spec.rb index abc1234..def5678 100644 --- a/website/spec/controllers/sessions_controller_spec.rb +++ b/website/spec/controllers/sessions_controller_spec.rb @@ -12,7 +12,7 @@ describe 'show' do it 'should render OK' do - get :show, id: Session.last + get :show, id: Session.last.id expect(response).to be_successful end end
Use id instead of instance in spec
diff --git a/lib/pakyow/console/editors/html_editor.rb b/lib/pakyow/console/editors/html_editor.rb index abc1234..def5678 100644 --- a/lib/pakyow/console/editors/html_editor.rb +++ b/lib/pakyow/console/editors/html_editor.rb @@ -1,3 +1,3 @@ Pakyow::Console.editor :html do - Pakyow::Presenter::View.new('<textarea data-scope="editor" style="resize:none" cols="80" rows="8" data-ui="trix"></textarea>') + Pakyow::Presenter::View.new('<textarea data-scope="editor" style="resize:none" cols="80" rows="8" data-ui="redactor"></textarea>') end
Use redactor instead of trix for html editor
diff --git a/lib/travis/build/script/addons/firefox.rb b/lib/travis/build/script/addons/firefox.rb index abc1234..def5678 100644 --- a/lib/travis/build/script/addons/firefox.rb +++ b/lib/travis/build/script/addons/firefox.rb @@ -10,10 +10,10 @@ def before_install @script.fold('install_firefox') do |script| - script.cmd "echo -e \"\033[33;1mInstalling Firefox v#@firefox_version\033[0m\"; ", assert: false, echo: false + script.cmd "echo -e \"\033[33;1mInstalling Firefox v#{@firefox_version}\033[0m\"; ", assert: false, echo: false script.cmd "sudo mkdir -p /usr/local/firefox", assert: false script.cmd "sudo chown travis /usr/local/firefox", assert: false - script.cmd "wget -O /tmp/firefox.tar.bz2 ftp://ftp.mozilla.org/pub/firefox/releases/#@firefox_version/linux-x86_64/en-US/firefox-#@firefox_version.tar.bz2", assert: false + script.cmd "wget -O /tmp/firefox.tar.bz2 ftp://ftp.mozilla.org/pub/firefox/releases/#{@firefox_version}/linux-x86_64/en-US/firefox-#{@firefox_version}.tar.bz2", assert: false script.cmd "pushd /usr/local/firefox", assert: false script.cmd "tar xf /tmp/firefox.tar.bz2", assert: false script.cmd "sudo ln -s /usr/local/firefox/firefox /usr/local/bin/firefox", assert: false
Add {} around interpolated instance variables This isn't required, but it makes the strings a little bit clearer.
diff --git a/bench/bench_enum.rb b/bench/bench_enum.rb index abc1234..def5678 100644 --- a/bench/bench_enum.rb +++ b/bench/bench_enum.rb @@ -0,0 +1,37 @@+require File.expand_path(File.join(File.dirname(__FILE__), "bench_helper")) + +module LibTest + extend FFI::Library + ffi_lib LIBTEST_PATH + enum :foo, [ :a, :b, :c ] + attach_function :ffi_bench, :bench_s32_v, [ :foo ], :void + def self.rb_bench(i0); nil; end +end + +puts "Benchmark [ enum ], :void performance, #{ITER}x calls" +10.times { + puts Benchmark.measure { + ITER.times { LibTest.ffi_bench(:a) } + } +} +unless RUBY_PLATFORM == "java" && JRUBY_VERSION < "1.3.0" + require 'dl' + require 'dl/import' + module LibTest + if RUBY_VERSION >= "1.9.0" + extend DL::Importer + else + extend DL::Importable + end + dlload LIBTEST_PATH + extern "void bench_s32_v(int)" + end +end + +puts "Benchmark ruby method(1 arg) performance, #{ITER}x calls" +10.times { + puts Benchmark.measure { + ITER.times { LibTest.rb_bench(:a) } + } +} +
Add benchmark for enum parameters
diff --git a/lib/yard/code_objects/step_transformer.rb b/lib/yard/code_objects/step_transformer.rb index abc1234..def5678 100644 --- a/lib/yard/code_objects/step_transformer.rb +++ b/lib/yard/code_objects/step_transformer.rb @@ -31,9 +31,9 @@ protected def find_value_for_constant(name) - @@constants ||= YARD::Registry.all(:constant) - constant = @@constants.find{|constant| constant.name == name.to_sym } - strip_regex_from(constant.value) if constant + constant = YARD::Registry.all(:constant).find{|c| c.name == name.to_sym } + log.warn "StepTransformer#find_value_for_constant : Could not find the CONSTANT #{name} using an empty string for value." unless constant + constant ? strip_regex_from(constant.value) : "" end def value_regex(value)
Fix Step Tranformer Caching Issue - Thought that I could cache the Constants Object from the Registry but it turns out that it cannot be done and calls to the Registry must be made each time; otherwise the cache of Constants is out of date after the first call by a StepTransformer.
diff --git a/benchmarks/speed.rb b/benchmarks/speed.rb index abc1234..def5678 100644 --- a/benchmarks/speed.rb +++ b/benchmarks/speed.rb @@ -1,8 +1,9 @@-# coding: utf-8 +# frozen_string_literal: true require 'benchmark/ips' -require 'splay_tree' require 'securerandom' + +require_relative '../lib/splay_tree' def generate_key(size) SecureRandom.hex(size)
Change to use local version
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.156.2' - sha256 '5bf824d69cc78746c0644b4b257e79adc49a4960ff690b3f7a09bca7f1c0d3a9' + version '1.0.167.2' + sha256 'ded8ebb78e7f49bfdc56ed4444782dc90ec0d51965c672076f5c8e5109515608' url "https://vivaldi.com/download/download.php?f=Vivaldi.#{version}.dmg" name 'Vivaldi'
Upgrade Vivaldi.app to v1.0.167.2 (Snapshot)
diff --git a/spec/unit/veritas/attribute/class_methods/descendants_spec.rb b/spec/unit/veritas/attribute/class_methods/descendants_spec.rb index abc1234..def5678 100644 --- a/spec/unit/veritas/attribute/class_methods/descendants_spec.rb +++ b/spec/unit/veritas/attribute/class_methods/descendants_spec.rb @@ -14,11 +14,7 @@ end context 'when there are descendants' do - let(:descendant) { Class.new(object) } - - before do - descendant # trigger the class inhertance - end + let!(:descendant) { Class.new(object) } it_should_behave_like 'an idempotent method'
Use let! to eagerly evaluate the descendant value
diff --git a/lib/konjak/parser.rb b/lib/konjak/parser.rb index abc1234..def5678 100644 --- a/lib/konjak/parser.rb +++ b/lib/konjak/parser.rb @@ -10,8 +10,10 @@ def parse(xml) if gtt - # FIXME + # FIXME GTT's tmx store &copy; as &amp;copy; xml = xml.gsub(/&amp;(#\d+|#x[0-9a-fA-F]+|[0-9a-zA-Z]+);/) { "&#{$1};" } + # FIXME GTT's tmx store leading space(\u0020) as non-breaking space(\u00A0) + xml = xml.gsub("\u00A0", ' ') end doc = Nokogiri::XML.parse(xml) Tmx.new doc
Replace \u00A0 -> \u0020 before parse gtt tmx GTTのtmxはsegmentのleading spaceをnon-breaking spaceとして記録しているよ うだった。本来はseg要素のtext nodeのみを置き換えるべきだが、 通常の文章でnon-breaking spaceが出てくることはなさそうなので、 XMLをパースする前に置き換えてしまう。
diff --git a/lib/puffery/model.rb b/lib/puffery/model.rb index abc1234..def5678 100644 --- a/lib/puffery/model.rb +++ b/lib/puffery/model.rb @@ -38,7 +38,8 @@ end def down - if client.down(self) + if client.down(self.remote_uid) + true # Sätt något för att visa att den är nere. LAST_SYNCED_AT? end end @@ -52,8 +53,9 @@ end def push_to_remote - if response = client.up(self) - set_remote_uid(response[:uid]) + if data = client.up(remote_uid, payload) + set_remote_uid(data['uid']) + true end end
Return true if request returns data
diff --git a/lib/outpost.rb b/lib/outpost.rb index abc1234..def5678 100644 --- a/lib/outpost.rb +++ b/lib/outpost.rb @@ -1,5 +1,3 @@-## -# Outpost require "outpost/engine" require 'active_record' require 'action_controller' @@ -16,8 +14,6 @@ autoload :Breadcrumb, 'outpost/breadcrumbs' autoload :Breadcrumbs - #---------------------- - class << self attr_writer :config def config @@ -26,14 +22,10 @@ end end -#---------------------- - if defined?(ActiveRecord::Base) ActiveRecord::Base.send :include, Outpost::Model end -#---------------------- - if defined?(ActionController::Base) ActionController::Base.send :include, Outpost::Controller end
Fix comments to allow yard to run