diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
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 @@ -5,8 +5,8 @@ return unless File.exists?('.env') File.readlines('.env').each do |line| - values = line.split('=') - ENV[values.first] = values.last.chomp + key, value = line.split('=') + ENV[key] = value.chomp end end
Clean up environment reading for specs
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 @@ -12,9 +12,14 @@ require 'rspec/rails' require 'rspec/autorun' require 'capybara/rspec' +require 'capybara/poltergeist' Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f } Dir[Rails.root.join("spec/shared/**/*.rb")].each { |f| require f } + +Capybara.javascript_driver = :poltergeist + +GirlFriday::Queue.immediate! RSpec.configure do |config| config.mock_with :rspec @@ -43,5 +48,3 @@ DatabaseCleaner.clean end end - -GirlFriday::Queue.immediate!
Use poltergeist as js driver for capybara
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 @@ -1,6 +1,8 @@-unless ENV['TRAVIS'] +unless ENV['CI'] require 'simplecov' - SimpleCov.start + SimpleCov.start do + add_filter 'spec' + end end require 'rspec' @@ -32,4 +34,4 @@ return @fail if @fail raise "Callback Phase" end -end+end
Exclude specs from code coverage report
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 @@ -8,6 +8,7 @@ logfile = File.open(File.expand_path("../../log/test.log", __FILE__), 'a') logfile.sync = true Celluloid.logger = Logger.new(logfile) +Celluloid.shutdown_timeout = 1 Dir['./spec/support/*.rb'].map {|f| require f }
Change the default shutdown timeout in specs to 1 second
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 @@ -21,8 +21,7 @@ config.run_all_when_everything_filtered = true # Set a default platform (this is overridden as needed) - config.platform = 'ubuntu' - config.version = '16.04' + config.platform = 'ubuntu' # Be random! config.order = 'random'
Remove the default platform version from the chefspec Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/spec/winnow_spec.rb b/spec/winnow_spec.rb index abc1234..def5678 100644 --- a/spec/winnow_spec.rb +++ b/spec/winnow_spec.rb @@ -27,5 +27,15 @@ expect(fprint_hashes).to eq hashes end + + it 'chooses the smallest hash per window' do + # window size = t - k + 1 = 2 ; for a two-char string, the sole + # fingerprint should just be from the char with the smallest hash value + fprinter = Winnow::Fingerprinter.new(t: 2, k: 1) + fprints = fprinter.fingerprints("ab") + + expect(fprints.length).to eq 1 + expect(fprints.first.value).to eq ["a", "b"].map(&:hash).min + end end end
Add test for simple case with only one window.
diff --git a/lib/arena/block.rb b/lib/arena/block.rb index abc1234..def5678 100644 --- a/lib/arena/block.rb +++ b/lib/arena/block.rb @@ -14,31 +14,38 @@ :connection_id, :connected_at, :connected_by_user_id, :connected_by_username def user - @user ||= Arena::User.new(@attrs.dup['user']) + @user ||= Arena::User.new(@attrs['user']) end def _class - @_class ||= @attrs.dup['class'] + @_class ||= @attrs['class'] end def _base_class - @_base_class ||= @attrs.dup['base_class'] + @_base_class ||= @attrs['base_class'] end def source - @source ||= Arena::Entity::Source.new(@attrs.dup['source']) + @source ||= Arena::Entity::Source.new(@attrs['source']) end def image - @image ||= Arena::Entity::Image.new(@attrs.dup['image']) + @image ||= Arena::Entity::Image.new(@attrs['image']) if has_image? end def attachment - @attachment ||= Arena::Entity::Attachment.new(@attrs.dup['attachment']) + @attachment ||= Arena::Entity::Attachment.new(@attrs['attachment']) if has_attachment? end def connections @connections ||= @attrs['connections'].collect { |channel| Arena::Channel.new(channel) } + end + + # Detect optional portions of the response + [:image, :attachment].each do |kind| + define_method "has_#{kind}?" do + !@attrs[kind.to_s].nil? + end end end
Remove duplication, better handling of types with convenience methods for optional portions of response
diff --git a/lib/updown/call.rb b/lib/updown/call.rb index abc1234..def5678 100644 --- a/lib/updown/call.rb +++ b/lib/updown/call.rb @@ -37,7 +37,7 @@ JSON.parse yield rescue RestClient::BadRequest, RestClient::Unauthorized, RestClient::ResourceNotFound => e result = (JSON.parse(e.response) rescue {}) - raise Updown::Error.new(result['error'] || e.reponse) + raise Updown::Error.new(result['error'] || e.response) end end
Update exception message when no 'error'. Hi, In case key 'error' has not been set into result hash, shouldn't we set the exception message with e.response instead of e.reponse (I'm not sure it exists, isn't it ?) Thank you.
diff --git a/config/initializers/paperclip.rb b/config/initializers/paperclip.rb index abc1234..def5678 100644 --- a/config/initializers/paperclip.rb +++ b/config/initializers/paperclip.rb @@ -5,7 +5,8 @@ hash_secret: ENV.fetch("ANNICT_PAPERCLIP_RANDOM_SECRET"), path: ENV.fetch("ANNICT_PAPERCLIP_PATH"), styles: { master: ["1000x1000\>", :jpg] }, - url: ENV.fetch("ANNICT_PAPERCLIP_URL") + url: ENV.fetch("ANNICT_PAPERCLIP_URL"), + default_url: "/paperclip/default/:style/no-image.jpg" } options = if Rails.env.production?
Add default_url to Paperclip config
diff --git a/config/schedule.rb b/config/schedule.rb index abc1234..def5678 100644 --- a/config/schedule.rb +++ b/config/schedule.rb @@ -2,7 +2,8 @@ set :output, File.join(File.expand_path(File.dirname(__FILE__)), "log", "cron_log.log") -job_type :rake, "cd :path && RAILS_ENV=:environment /home/rails/.rvm/bin/rake :task :output" +job_type :rake, "cd :path && RAILS_ENV=:environment /home/rails/.rvm/bin/rake :task :output" +job_type :find_command "cd :path && :task :output" # Sync with OSM but not between 1:59 and 3:00 o'clock every '* 0-1 * * *' do @@ -14,7 +15,6 @@ end #Remove cached files older than 3 days -# every 1.minute do -# command "find #{:path}/tmp/cache/ -mmin +4320 -type f -delete", :environment => :production -# end - +every 10.minutes do + find_command "find tmp/cache/ -mmin +4320 -type f -delete", :environment => :production +end
Delete cached files older than 3 days via cron
diff --git a/AeroGearHttp.podspec b/AeroGearHttp.podspec index abc1234..def5678 100644 --- a/AeroGearHttp.podspec +++ b/AeroGearHttp.podspec @@ -6,7 +6,7 @@ s.license = 'Apache License, Version 2.0' s.author = "Red Hat, Inc." s.source = { :git => 'https://github.com/aerogear/aerogear-ios-http.git', :tag => s.version } - s.platform = :ios, 8.0 + s.platform = :ios, 7.0 s.source_files = 'AeroGearHttp/*.{swift}' s.requires_arc = true end
Set back min deployment to7.0
diff --git a/Casks/apns-pusher.rb b/Casks/apns-pusher.rb index abc1234..def5678 100644 --- a/Casks/apns-pusher.rb +++ b/Casks/apns-pusher.rb @@ -2,10 +2,10 @@ version '2.3' sha256 '6aa54050bea8603b45e6737bf2cc6997180b1a58f1d02095f5141176a1335205' - url "https://github.com/blommegard/APNS-Pusher/releases/download/v#{version}/APNS.Pusher.app.zip" - appcast 'https://github.com/blommegard/APNS-Pusher/releases.atom' + url "https://github.com/KnuffApp/APNS-Pusher/releases/download/v#{version}/APNS.Pusher.app.zip" + appcast 'https://github.com/KnuffApp/APNS-Pusher/releases.atom' name 'APNS Pusher' - homepage 'https://github.com/blommegard/APNS-Pusher' + homepage 'https://github.com/KnuffApp/APNS-Pusher' license :mit app 'APNS Pusher.app'
Fix the URLs of APNS Pusher
diff --git a/sciencemag_latest_news.gemspec b/sciencemag_latest_news.gemspec index abc1234..def5678 100644 --- a/sciencemag_latest_news.gemspec +++ b/sciencemag_latest_news.gemspec @@ -20,9 +20,8 @@ spec.executables = "sciencemag_latest_news" spec.require_paths = ["lib"] - spec.add_development_dependency "bundler", "~> 1.14" - spec.add_development_dependency "rake", "~> 10.0" - spec.add_development_dependency "pry", "0.11.1" + spec.add_development_dependency "bundler", "~> 2.2" + spec.add_development_dependency "rake", "~> 13.0" - spec.add_runtime_dependency "nokogiri", "1.8.1" + spec.add_runtime_dependency "nokogiri", "1.11.2" end
Update dependencies and remove pry
diff --git a/lib/deface/template_helper.rb b/lib/deface/template_helper.rb index abc1234..def5678 100644 --- a/lib/deface/template_helper.rb +++ b/lib/deface/template_helper.rb @@ -16,7 +16,9 @@ #this needs to be reviewed for production mode, overrides not present Rails.application.config.deface.enabled = apply_overrides @lookup_context ||= ActionView::LookupContext.new(ActionController::Base.view_paths, {:formats => [:html]}) - view = @lookup_context.find(name, prefix, partial) + view = @lookup_context.disable_cache do + @lookup_context.find(name, prefix, partial) + end if view.handler.to_s == "Haml::Plugin" Deface::HamlConverter.new(view.source).result
Disable cache when loading template source
diff --git a/Casks/rest-client.rb b/Casks/rest-client.rb index abc1234..def5678 100644 --- a/Casks/rest-client.rb +++ b/Casks/rest-client.rb @@ -1,7 +1,7 @@ class RestClient < Cask - url 'https://rest-client.googlecode.com/files/restclient-ui-3.2-app.zip' + url 'https://rest-client.googlecode.com/files/restclient-ui-3.2.1-app.zip' homepage 'https://code.google.com/p/rest-client' - version '3.2' - sha1 'e6846058083b3f765f7c33ac69a558cc473940cd' + version '3.2.1' + sha1 'af3ba630c417524ae6a8a972680d26e6ad470dd1' link 'WizTools.org RESTClient.app' end
Update Rest client to version 3.2.1
diff --git a/spec/capistrano_fastly_spec.rb b/spec/capistrano_fastly_spec.rb index abc1234..def5678 100644 --- a/spec/capistrano_fastly_spec.rb +++ b/spec/capistrano_fastly_spec.rb @@ -1,5 +1,13 @@ require 'spec_helper' describe Capistrano::Fastly do - pending "YOOOOOOO!" + before do + @configuration = Capistrano::Configuration.new + Capistrano::Fastly.load_into(@configuration) + end + + it 'provides fastly:purge_all' do + @configuration.find_task('fastly:purge_all').should_not == nil + end + end
Test for existence of purge_all task
diff --git a/lib/dry/monitor/sql/logger.rb b/lib/dry/monitor/sql/logger.rb index abc1234..def5678 100644 --- a/lib/dry/monitor/sql/logger.rb +++ b/lib/dry/monitor/sql/logger.rb @@ -7,7 +7,7 @@ class Logger extend Dry::Configurable - setting :theme, Rouge::Themes::Gruvbox + setting :theme, Rouge::Themes::Gruvbox.new setting :colorize, true setting :message_template, %( Loaded %s in %sms %s).freeze
Fix default config for rouge
diff --git a/lib/webpagetest/connection.rb b/lib/webpagetest/connection.rb index abc1234..def5678 100644 --- a/lib/webpagetest/connection.rb +++ b/lib/webpagetest/connection.rb @@ -3,21 +3,22 @@ module Connection ENDPOINT = 'http://www.webpagetest.org/' + FARADAY_OPTIONS = { + request: :url_encoded, + response: :logger, + adapter: Faraday.default_adapter, + } def get_connection(options = nil) - options = Hashie::Mash.new( { - request: :url_encoded, - response: :logger, - adapter: Faraday.default_adapter, - } ) if options.nil? - + options = Hashie::Mash.new(FARADAY_OPTIONS) if options.nil? + url = options.url || ENDPOINT connection = Faraday.new(url: url) do |faraday| faraday.request options.request - faraday.response options.response + faraday.response options.response unless options.response.nil? faraday.adapter options.adapter end end end -end+end
Add option to override faraday options This allows you to redefine Webpagetest::Connection::FARADAY_OPTIONS to silence logging, by not adding `response: :logger`
diff --git a/lib/aruba-doubles/cucumber.rb b/lib/aruba-doubles/cucumber.rb index abc1234..def5678 100644 --- a/lib/aruba-doubles/cucumber.rb +++ b/lib/aruba-doubles/cucumber.rb @@ -3,11 +3,11 @@ World(ArubaDoubles) Before do - Double.setup + ArubaDoubles::Double.setup end After do - Double.teardown + ArubaDoubles::Double.teardown end Given /^I double `([^`]*)`$/ do |cmd|
Fix missing constant bug under Ruby 1.8.7
diff --git a/metasploit-credential.gemspec b/metasploit-credential.gemspec index abc1234..def5678 100644 --- a/metasploit-credential.gemspec +++ b/metasploit-credential.gemspec @@ -20,8 +20,8 @@ # Various Metasploit::Credential records have associations to Mdm records s.add_runtime_dependency 'metasploit_data_models', '~> 0.17.0' + # Metasploit::Credential::SSHKey validation and helper methods + s.add_runtime_dependency 'net-ssh' # Metasploit::Credential::NTLMHash helper methods s.add_runtime_dependency 'rubyntlm' - # Metasploit::Credential::SSHKey validation and helper methods - s.add_runtime_dependency 'net-ssh' end
Fix order of runtime dependencies MSP-9605
diff --git a/features/step_definitions/view_quarters_steps.rb b/features/step_definitions/view_quarters_steps.rb index abc1234..def5678 100644 --- a/features/step_definitions/view_quarters_steps.rb +++ b/features/step_definitions/view_quarters_steps.rb @@ -1,5 +1,9 @@ Then(/^I should see the names of each list from the Trello board$/) do + wait_for_element_does_not_exist("android.widget.ProgressBar") list_displayed = query("ListView AppCompatTextView", :text) expected_list = ["Q1 2015", "Q2 2015", "Q3 2015", "Q4 2015"] - raise 'List displayed wrong items' unless list_displayed == expected_list + unless list_displayed == expected_list + puts list_displayed + raise 'List displayed wrong items' + end end
Fix step definitions to wait for ProgressBar to disappear before checking list
diff --git a/distillery.gemspec b/distillery.gemspec index abc1234..def5678 100644 --- a/distillery.gemspec +++ b/distillery.gemspec @@ -22,4 +22,8 @@ s.add_dependency('nokogiri', '> 1.0') s.add_development_dependency('rspec', '> 2.0') + s.add_development_dependency('guard') + s.add_development_dependency('guard-rspec') + s.add_development_dependency('ruby-debug19') + s.add_development_dependency('rb-fsevent') end
Add dev gems to gemspec.
diff --git a/part-2/sock_drawer.rb b/part-2/sock_drawer.rb index abc1234..def5678 100644 --- a/part-2/sock_drawer.rb +++ b/part-2/sock_drawer.rb @@ -5,4 +5,13 @@ @socks = args.fetch(:socks) { Array.new } @matcher = args.fetch(:matcher) end + + def supply_match_for(possible_match) + # iterate through all socks in the drawer + # compare each sock to possible_match + # if matching_attributes, return both socks + # remove those socks from drawer + matched_sock = @socks.find {|s| @matcher.match?(s, possible_match)} + @socks.delete(matched_sock) + end end
Add method to supply match from sockdrawer
diff --git a/app/controllers/queries_controller.rb b/app/controllers/queries_controller.rb index abc1234..def5678 100644 --- a/app/controllers/queries_controller.rb +++ b/app/controllers/queries_controller.rb @@ -12,6 +12,10 @@ @language = @query.language end + def new + @query = language.queries.new + end + def create @query = language.queries.new(query_params) @@ -21,6 +25,10 @@ render 'languages/show' end end + + # def bing_new + # @query = language.queries.new + # end def bing_create text_to_translate = params[:query][:english]
Add query new path, comment out bing_new path - because in modal
diff --git a/app/models/person_detail_retriever.rb b/app/models/person_detail_retriever.rb index abc1234..def5678 100644 --- a/app/models/person_detail_retriever.rb +++ b/app/models/person_detail_retriever.rb @@ -8,11 +8,32 @@ # add details for our person from secondary apis def retrieve! - person_detail = InfluenceExplorerPersonDetail.new(person).person_detail + self.person_detail = person.person_detail + update_from_usa_elected_required_apis if is_usa_elected_official? + person_detail.save! + end + + private + # assumes if state specifies jurisdiction that is within us + # is an elected official + def is_usa_elected_official? + return false unless person.state.present? + + return true if Metadatum::Us::ABBREVIATION == person.state + return true if OpenGovernment::STATES.values.include?(person.state) + + state_prefix = person.state.split("-").first + return true if OpenGovernment::STATES.values.include?(state_prefix) + + false + end + + def update_from_usa_elected_required_apis + self.person_detail = InfluenceExplorerPersonDetail.new(person).person_detail + pvs = ProjectVoteSmartPersonDetail.new(person, person_detail: person_detail, officials: officials) - person_detail = pvs.person_detail - person_detail.save! + self.person_detail = pvs.person_detail end end
Refactor to more easily skip steps for non-elected Supports #255
diff --git a/aptible-auth.gemspec b/aptible-auth.gemspec index abc1234..def5678 100644 --- a/aptible-auth.gemspec +++ b/aptible-auth.gemspec @@ -22,7 +22,7 @@ spec.add_dependency 'aptible-resource', '~> 1.0' spec.add_dependency 'gem_config' - spec.add_dependency 'oauth2', '~> 1.4' + spec.add_dependency 'oauth2', '1.4.7' spec.add_development_dependency 'aptible-tasks', '>= 0.6.0' spec.add_development_dependency 'pry'
Fix oauth2 dependency to 1.4.7 Currently, oauth2 1.4.8 includes a change that causes aptible-cli to break when attempting authorization: https://github.com/oauth-xx/oauth2/issues/572 The underlying cause is a hash not being converted to a string, which Faraday's default adapter provides. This will need to be fixed in the oauth2 gem to properly address the issue.
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,3 +1,20 @@ class ApplicationController < ActionController::Base protect_from_forgery with: :exception + + helper_mathod :current_chef, :logged_in? + + def current_chef + @current_chef ||= Chef.find session[:chef_id] if session[:chef_id] + end + + def logged_in? + !!current_chef + end + + def require_user + if !logged_in? + flash[:danger] = 'You must be logged in to do that' + redirect_to root_path + end + end end
Add helpers for current chef, logged in, and require_user
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,7 +1,7 @@ class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. - protect_from_forgery with: :exception + protect_from_forgery with: :null_session def landing @pick = Pick.new
Change protect_from_forgery to null_session do to Api calls
diff --git a/demo/applique/bezel.rb b/demo/applique/bezel.rb index abc1234..def5678 100644 --- a/demo/applique/bezel.rb +++ b/demo/applique/bezel.rb @@ -1,13 +1,14 @@-# require bezel +# Use a dummy Gem location for this example. +dummy_gem_home = File.expand_path('../fixtures', File.dirname(__FILE__)) +ENV['GEM_HOME'] = dummy_gem_home +Gem.path.unshift(dummy_gem_home) + +Gem::Specification.reset + +#p Gem::Specification.all_names +#puts "Gem path added: #{dummy_gem_home}" + +# Require Bezel require 'bezel' -# use a dummy Gem location for this example - -ENV['GEM_HOME'] = File.expand_path('../fixtures', File.dirname(__FILE__)) - -#p Gem::Specification.all_names - -#Gem.path.unshift(File.expand_path('../fixtures', File.dirname(__FILE__))) -#puts "Gem path added: " + File.expand_path('fixtures', File.dirname(__FILE__)) -
Reset gem specs for testing. [test]
diff --git a/test/test_helper.rb b/test/test_helper.rb index abc1234..def5678 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,6 +1,8 @@ ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' +require 'rspec/rails' +require 'capybara/rails' class ActiveSupport::TestCase # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
Add capybara to the spec helper file
diff --git a/test/test_helper.rb b/test/test_helper.rb index abc1234..def5678 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,3 +1,4 @@+RAILS_GEM_VERSION="2.2.2" ENV['RAILS_ENV'] ||= 'test' require File.expand_path(File.dirname(__FILE__) + "/application/config/environment") require 'test_help'
Use Rails 2.2.2 gems by default for testing
diff --git a/examples/models.rb b/examples/models.rb index abc1234..def5678 100644 --- a/examples/models.rb +++ b/examples/models.rb @@ -24,7 +24,7 @@ # Easy and powerful scope examples scope :by_admin, -> { where_assoc_exists(:author, &:admins) } scope :commented_on_by_admin, -> { where_assoc_exists(:comments, &:by_admin) } - scope :with_many_reported_comments, lambda {|min_nb=5| where_assoc_count(min_nb, :<=, :comments, &:reported) } + scope :with_many_reported_comments, ->(min_nb = 5) { where_assoc_count(min_nb, :<=, :comments, &:reported) } end class Comment < ActiveRecord::Base
Tweak code for rubocop [ci skip]
diff --git a/spec/space2underscore_spec.rb b/spec/space2underscore_spec.rb index abc1234..def5678 100644 --- a/spec/space2underscore_spec.rb +++ b/spec/space2underscore_spec.rb @@ -14,15 +14,19 @@ end def checkout_master - system("git checkout master #{hidden}") + execute_command('git checkout master') end def delete_branch - system("git branch -D #{branch_name} #{hidden}") + execute_command("git branch -D #{branch_name}") end def create_branch - system("git branch #{branch_name} #{hidden}") + execute_command("git branch #{branch_name}") + end + + def execute_command(command) + system("#{command} #{hidden}") end describe '.create_new_branch' do
Make a command to hide the output
diff --git a/spec/controllers/contributors_controller_spec.rb b/spec/controllers/contributors_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/contributors_controller_spec.rb +++ b/spec/controllers/contributors_controller_spec.rb @@ -10,7 +10,7 @@ it 'returns json representation of user with relevant roles' do get :index, format: :json - expect(assigns(:contributors)).to eq [coach, organizer] + expect(assigns(:contributors).sort).to eq [coach, organizer].sort end end end
Sort lists for some added determinism
diff --git a/spec/controllers/transactions_controller_spec.rb b/spec/controllers/transactions_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/transactions_controller_spec.rb +++ b/spec/controllers/transactions_controller_spec.rb @@ -3,8 +3,17 @@ describe TransactionsController do describe 'GET #index' do - it "populates an array of transactions" - it "renders the :index template" + it "populates an array of all transactions" do + deposit = FactoryGirl.create(:deposit) + withdrawal = FactoryGirl.create(:withdrawal) + get :index + expect(assigns(:transactions)).to match_array([deposit, withdrawal]) + end + + it "renders the :index template" do + get :index + expect(response).to render_template :index + end end describe 'GET #show' do @@ -21,4 +30,30 @@ end end + describe 'GET #new' do + it "assigns a new transaction to @transaction" do + get :new + expect(assigns(:transaction)).to be_a_new(Transaction) + end + + it "renders the :new template" do + get :new + expect(response).to render_template :new + end + end + + describe 'GET #edit' do + it "assigns the requested transaction to @transaction" do + transaction = FactoryGirl.create(:transaction) + get :edit, id: transaction + expect(assigns(:transaction)).to eq transaction + end + it "renders the :edit template" do + transaction = FactoryGirl.create(:transaction) + get :edit, id: transaction + expect(response).to render_template :edit + end + end + end +
Add tests to GET methods of transactions_controller.rb
diff --git a/cfa_stat_gatherer.rb b/cfa_stat_gatherer.rb index abc1234..def5678 100644 --- a/cfa_stat_gatherer.rb +++ b/cfa_stat_gatherer.rb @@ -0,0 +1,42 @@+require 'pry' +require 'csv' +require './lib/cliometrics' + +# Most 2013 repos +cfa_repos = %w(ohana-api ohana-web-search cityvoice promptly public-records ohanakapa-ruby bizfriendly-web streetmix bizfriendly-api lv-trucks-map click_that_hood lv-trucks-notifier food_trucks fast_pass in-n-out criminal_case_search trailsyserver trailsy tourserver hermes-dashboard hermes-doc hermes-be) + +# Most 2013 repos demoed at the summit +summit_repos = %w(ohana-api ohana-web-search cityvoice promptly public-records bizfriendly-web streetmix bizfriendly-api click_that_hood fast_pass in-n-out criminal_case_search trailsyserver trailsy tourserver) + +# Pretty much the "big project" per city +city_repos = %w(ohana-api ohana-web-search cityvoice promptly public-records bizfriendly-web bizfriendly-api lv-trucks-map lv-trucks-notifier food_trucks fast_pass in-n-out criminal_case_search trailsyserver trailsy) + +client = Cliometrics::Client.new(2013) + +# Set up an array of arrays (with header row) for CSV production +full_result_set_array = Array.new +header_row = ['Repository Name'] +(0..52).each do |week_index| + header_row << week_index +end +full_result_set_array << header_row + +# Do city repos for now +city_repos.each do |repo_name| + puts "Processing #{repo_name}" + array_for_single_repo = [repo_name] + commit_set = Cliometrics::CommitSet.new(client.get_commits_for(repo_name)) + commit_set.commits_by_week.each do |commit_count_for_week| + array_for_single_repo << commit_count_for_week + end + full_result_set_array << array_for_single_repo +end + +# Write CSV output +CSV.open("stats_for_2013.csv", "w") do |csv| + full_result_set_array.each do |row| + csv << row + end +end + +binding.pry
Add initial CFA stat gatherer script
diff --git a/app/mailers/teacher_mailer.rb b/app/mailers/teacher_mailer.rb index abc1234..def5678 100644 --- a/app/mailers/teacher_mailer.rb +++ b/app/mailers/teacher_mailer.rb @@ -1,5 +1,5 @@ class TeacherMailer < ActionMailer::Base - default from: "leap@southdevon.ac.uk" + default from: Settings.absence_line_email def email_teacher(teacher, learner, register_event, slot) if teacher.present? && teacher.college_email.present?
Change email from to look at settings
diff --git a/app/models/assignment_file.rb b/app/models/assignment_file.rb index abc1234..def5678 100644 --- a/app/models/assignment_file.rb +++ b/app/models/assignment_file.rb @@ -4,13 +4,18 @@ has_many :criteria_assignment_files_joins, dependent: :destroy has_many :template_divisions + before_validation :clean_filename validates_presence_of :filename validates_uniqueness_of :filename, scope: :assignment_id - before_validation do - self.filename = Pathname.new(self.filename).cleanpath.to_s - end validates_format_of :filename, with: /\A[\-\._a-zA-Z0-9][\/\-\._a-zA-Z0-9]*\z/, message: I18n.t('validation_messages.format_of_assignment_file') + private + + def clean_filename + if self.filename + self.filename = Pathname.new(self.filename).cleanpath.to_s + end + end end
assignment: Fix required file before_validation callback
diff --git a/app/models/hosting_account.rb b/app/models/hosting_account.rb index abc1234..def5678 100644 --- a/app/models/hosting_account.rb +++ b/app/models/hosting_account.rb @@ -1,3 +1,6 @@ class HostingAccount < ActiveRecord::Base + attr_accessible :annual_fee, :backed_up_on, :backup_cycle, :domain_id, + :ftp_host, :host_name, :started_on, :username, :password + belongs_to :domain, touch: true end
Whitelist attributes for hosting accounts
diff --git a/app/models/setup/parameter.rb b/app/models/setup/parameter.rb index abc1234..def5678 100644 --- a/app/models/setup/parameter.rb +++ b/app/models/setup/parameter.rb @@ -4,7 +4,10 @@ include JsonMetadata include ChangedIf - build_in_data_type.with(:key, :value, :description, :metadata).referenced_by(:key) + build_in_data_type + .with(:key, :value, :description, :metadata) + .referenced_by(:key) + .and({ label: '{{key}}' }) deny :create
Update | Parameter build-in schema
diff --git a/Casks/dart-editor.rb b/Casks/dart-editor.rb index abc1234..def5678 100644 --- a/Casks/dart-editor.rb +++ b/Casks/dart-editor.rb @@ -1,7 +1,7 @@ class DartEditor < Cask url 'http://storage.googleapis.com/dart-archive/channels/stable/release/latest/editor/darteditor-macos-x64.zip' homepage 'https://www.dartlang.org/tools/editor/' - version '1.1.3' - sha256 '48cced0709aa9bddfa3d03365b0fc4b3b9b157799f244746dc127ea95052825e' + version 'latest' + no_checksum link 'dart/DartEditor.app' end
Use latest for dart editor
diff --git a/test/redic_test.rb b/test/redic_test.rb index abc1234..def5678 100644 --- a/test/redic_test.rb +++ b/test/redic_test.rb @@ -28,3 +28,9 @@ assert_equal ["OK", "QUEUED", ["OK"]], c.run end + +test "runtime errors" do |c| + assert_raise RuntimeError do + c.call("KABLAMMO") + end +end
Add a test for RuntimeErrors. Just verify that we are now indeed raising runtime errors.
diff --git a/serialize.gemspec b/serialize.gemspec index abc1234..def5678 100644 --- a/serialize.gemspec +++ b/serialize.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'serialize' - s.version = '0.1.1' + s.version = '0.1.2' s.summary = 'Common interface for serialization and deserialization, and serializer discovery' s.description = ' '
Package version is increased from 0.1.1 to 0.1.2
diff --git a/test/override_assert_raise.rb b/test/override_assert_raise.rb index abc1234..def5678 100644 --- a/test/override_assert_raise.rb +++ b/test/override_assert_raise.rb @@ -9,6 +9,9 @@ rescue ::Test::Unit::AssertionFailedError => e # failed assert raises this Error and that extends StandardError, so rescue it first raise e + rescue expected_class.class => e + # https://github.com/test-unit/test-unit/issues/94 + assert_equal e.message, expected_class.message rescue expected_class assert true # passed rescue => e
Fix to assert exception message
diff --git a/lib/twterm/user.rb b/lib/twterm/user.rb index abc1234..def5678 100644 --- a/lib/twterm/user.rb +++ b/lib/twterm/user.rb @@ -6,7 +6,6 @@ alias_method :protected?, :protected alias_method :verified?, :verified - MAX_CACHED_TIME = 3600 COLORS = [:red, :blue, :green, :cyan, :yellow, :magenta] def initialize(user)
Remove MAX_CACHED_TIME constant from User class
diff --git a/lib/vapebot/bot.rb b/lib/vapebot/bot.rb index abc1234..def5678 100644 --- a/lib/vapebot/bot.rb +++ b/lib/vapebot/bot.rb @@ -45,7 +45,12 @@ elsif msg.cmd == "broadcast" connection.broadcastmsg(msg.cmd_args.join(" ")) elsif handler - response = eval "#{handler} #{msg.cmd_args}" + #As of now Commands with args are all privledged methods + if Database::Users.is_admin? msg.source + response = eval "#{handler} #{msg.cmd_args}" + else + response = "You are not authorized to perform this action." + end else response = Database::Facts.get(msg.cmd) end
Add authorization check for commands with arguments... only factoids used by all.
diff --git a/app/decorators/log_decorator.rb b/app/decorators/log_decorator.rb index abc1234..def5678 100644 --- a/app/decorators/log_decorator.rb +++ b/app/decorators/log_decorator.rb @@ -1,4 +1,6 @@ class LogDecorator < Draper::Base + decorates :activity_log + def created_at Time.new(model.created_at) end
Make the log decorator wrap the ActivityLog class.
diff --git a/app/helpers/requirejs_helper.rb b/app/helpers/requirejs_helper.rb index abc1234..def5678 100644 --- a/app/helpers/requirejs_helper.rb +++ b/app/helpers/requirejs_helper.rb @@ -22,11 +22,18 @@ run_config = requirejs.run_config if Rails.application.config.assets.digest modules = requirejs.build_config['modules'].map { |m| m['name'] } - paths = {} - modules.each do |m| - paths[m] = javascript_path(m).sub /\.js$/,'' + + # Generate default paths from the modules spec + default_paths = {} + modules.each { |m| default_paths[m] = m } + + # Update paths in the requirejs configuration with the defaults + # and convert the path targets to use digestified asset names. + cfg = (run_config['paths'] ||= {}) + cfg.merge!(default_paths) { |k, user, default| user } + cfg.each do |k, v| + cfg[k] = javascript_path(v).sub /\.js$/,'' end - run_config['paths'] = paths end html.concat <<-HTML <script>var require = #{run_config.to_json};</script>
Make items in the user path spec take precedence. The gem auto-generates a path spec based upon the modules spec from requirejs.yml. This change ensures that any paths spec provided by the user takes precedence and is digest-mangled for use in production.
diff --git a/lib/autotest/twitter/client.rb b/lib/autotest/twitter/client.rb index abc1234..def5678 100644 --- a/lib/autotest/twitter/client.rb +++ b/lib/autotest/twitter/client.rb @@ -30,7 +30,7 @@ raise 'The number of elements in `consumer` must be at least two' if consumer.size < 2 raise 'The number of elements in `access_token` must be at least two' if access_token.size < 2 - args = consumer + ['https://api.twitter.com/1'] + args = consumer + [{:site => 'https://api.twitter.com/1'}] OAuth::AccessToken.new(OAuth::Consumer.new(*args), *access_token) end end
Fix the arguments to give to OAuth::Consumer.new
diff --git a/lib/bankscrap/exporters/csv.rb b/lib/bankscrap/exporters/csv.rb index abc1234..def5678 100644 --- a/lib/bankscrap/exporters/csv.rb +++ b/lib/bankscrap/exporters/csv.rb @@ -3,7 +3,7 @@ module BankScrap module Exporter class Csv - HEADERS = %w(Date Description Amount).freeze + HEADERS = %w(ID Date Description DescriptionDetails Amount).freeze def initialize(output = nil) @output = output || 'transactions.csv'
Fix headers for CSV exporter
diff --git a/lib/chroma/helpers/bounders.rb b/lib/chroma/helpers/bounders.rb index abc1234..def5678 100644 --- a/lib/chroma/helpers/bounders.rb +++ b/lib/chroma/helpers/bounders.rb @@ -4,7 +4,7 @@ def bound01(n, max) is_percent = n.to_s.include? '%' n = [max, [0, n.to_f].max].min - n = (n * max).to_i / 100 if is_percent + n = (n * max).to_i / 100.0 if is_percent return 1 if (n - max).abs < 0.000001
Fix rounding issue from not using float division
diff --git a/examples/multi_select_disabled.rb b/examples/multi_select_disabled.rb index abc1234..def5678 100644 --- a/examples/multi_select_disabled.rb +++ b/examples/multi_select_disabled.rb @@ -0,0 +1,17 @@+# encoding: utf-8 + +require_relative "../lib/tty-prompt" + +prompt = TTY::Prompt.new + +drinks = [ + {name: 'sake', disabled: '(out of stock)'}, + 'vodka', + {name: 'beer', disabled: '(out of stock)'}, + 'wine', + 'whisky', + 'bourbon' +] +answer = prompt.multi_select('Choose your favourite drink?', drinks, default: 2) + +puts answer.inspect
Add multi select example with disabled items
diff --git a/test/fixtures/cookbooks/test/recipes/default.rb b/test/fixtures/cookbooks/test/recipes/default.rb index abc1234..def5678 100644 --- a/test/fixtures/cookbooks/test/recipes/default.rb +++ b/test/fixtures/cookbooks/test/recipes/default.rb @@ -2,9 +2,18 @@ git_client 'install it' +home_dir = + if windows? + 'C:/Users/random' + elsif macos? + '/Users/random' + else + '/home/random' + end + user 'random' do manage_home true - home '/home/random' + home home_dir end git_config 'add name to random' do @@ -14,7 +23,7 @@ value 'John Doe global' end -git '/home/random/git_repo' do +git "#{home_dir}/git_repo" do repository 'https://github.com/chef/chef-repo.git' user 'random' end @@ -24,7 +33,7 @@ scope 'local' key 'user.name' value 'John Doe local' - path '/home/random/git_repo' + path "#{home_dir}/git_repo" end git_config 'change system config' do
Set home dir propertly between Windows and MacOS for testing Signed-off-by: Lance Albertson <3161cdc7bf197e4c3a35b9cbe358c79910f27e90@osuosl.org>
diff --git a/Casks/phpstorm-eap.rb b/Casks/phpstorm-eap.rb index abc1234..def5678 100644 --- a/Casks/phpstorm-eap.rb +++ b/Casks/phpstorm-eap.rb @@ -1,6 +1,6 @@ class PhpstormEap < Cask - version '139.105' - sha256 '9821ed1d1728fdcc833e896d7f2802643edd1707' + version '139.173' + sha256 '0815ca8237791fa41137aa27401d47a206d8f36ca4dd9fa7fdcc488ec96a7bdb' url "http://download.jetbrains.com/webide/PhpStorm-EAP-#{version}.dmg" homepage 'http://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Early+Access+Program'
Update PhpStom EAP.app to version 139.173
diff --git a/Casks/phpstorm-eap.rb b/Casks/phpstorm-eap.rb index abc1234..def5678 100644 --- a/Casks/phpstorm-eap.rb +++ b/Casks/phpstorm-eap.rb @@ -1,6 +1,6 @@ class PhpstormEap < Cask - version '138.2071' - sha256 'f0c52920fdce0ca3f1001342e816e5283c3efe502a1b0d39667332b4afeced87' + version '138.2502' + sha256 '61c1872a4e487f955956cba93eb8a2f5f743c8dd1aff1eac1c96555b306cdb81' url "http://download.jetbrains.com/webide/PhpStorm-EAP-#{version}.dmg" homepage 'http://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Early+Access+Program'
Update PhpStorm EAP to v138.2502
diff --git a/ConnectMe/rADMeNow.rb b/ConnectMe/rADMeNow.rb index abc1234..def5678 100644 --- a/ConnectMe/rADMeNow.rb +++ b/ConnectMe/rADMeNow.rb @@ -3,8 +3,8 @@ require 'require_relative' -load('./rCheckWifi.rb') -load('./rVPNMeNow.rb') +load(File.join(File.dirname(__FILE__),'rCheckWifi.rb')) +load(File.join(File.dirname(__FILE__),'rVPNMeNow.rb')) if !File.directory?("/Volumes/e_18_data11$") then if(!getFHNWWifi)
Use correct paths for loading additional ruby scripts
diff --git a/features/support/genomer_steps.rb b/features/support/genomer_steps.rb index abc1234..def5678 100644 --- a/features/support/genomer_steps.rb +++ b/features/support/genomer_steps.rb @@ -0,0 +1,11 @@+When /^I create a new genomer project$/ do + step 'I successfully run `genomer init project`' + step 'I cd to "project"' + step 'I append to "Gemfile" with "gem \'genomer-plugin-view\', :path =>\'../../../\'"' +end + +Then /^the output should contain a valid man page$/ do + step 'the output should not contain "md2man/roff: raw_html not implemented"' + step 'the output should not contain "\<"' + step 'the output should not contain "\>"' +end
Add cucumber steps for testing man pages
diff --git a/lib/frankie/class_level_api.rb b/lib/frankie/class_level_api.rb index abc1234..def5678 100644 --- a/lib/frankie/class_level_api.rb +++ b/lib/frankie/class_level_api.rb @@ -20,10 +20,6 @@ after_hooks << Proc.new(&blk) end - def content_type type - defaults[:headers]["Content-Type"] = type - end - def use middleware, *args, &block middlewares << [middleware, args, block] end
Remove the content type helper since it uses defaults
diff --git a/config/initializers/asset_sync.rb b/config/initializers/asset_sync.rb index abc1234..def5678 100644 --- a/config/initializers/asset_sync.rb +++ b/config/initializers/asset_sync.rb @@ -17,4 +17,7 @@ # Use the Rails generated 'manifest.yml' file to produce the list of files to # upload instead of searching the assets directory. config.manifest = true -end+end + +# Fix bug with SSL certificate verification failing with dot in bucket name +Fog.credentials = { path_style: true }
Fix bug with S3 SSL certificate verification failing with dot in bucket name.
diff --git a/config/initializers/parameters.rb b/config/initializers/parameters.rb index abc1234..def5678 100644 --- a/config/initializers/parameters.rb +++ b/config/initializers/parameters.rb @@ -4,3 +4,4 @@ GenieacsGui::Application.config.device_filters = {'Last inform' => 'summary.lastInform', 'Tag' => '_tags'} GenieacsGui::Application.config.device_filters.merge!(GenieacsGui::Application.config.summary_parameters) GenieacsGui::Application.config.device_filters.merge!(GenieacsGui::Application.config.index_parameters) +GenieacsGui::Application.config.device_filters.delete_if {|key, value| not value.is_a?(String)}
Exclude objects from search filters.
diff --git a/lib/virtus/attribute/strict.rb b/lib/virtus/attribute/strict.rb index abc1234..def5678 100644 --- a/lib/virtus/attribute/strict.rb +++ b/lib/virtus/attribute/strict.rb @@ -1,8 +1,14 @@ module Virtus class Attribute + # Attribute extension which raises CoercionError when coercion failed + # module Strict + # @see [Attribute#coerce] + # + # @raises [CoercionError] when coercer failed + # # @api public def coerce(*) output = super
Add docs for Strict extension
diff --git a/app/authorizers/inventory_authorizer.rb b/app/authorizers/inventory_authorizer.rb index abc1234..def5678 100644 --- a/app/authorizers/inventory_authorizer.rb +++ b/app/authorizers/inventory_authorizer.rb @@ -4,7 +4,7 @@ end def updatable_by?(user) - resource.facilitator?(user: user) + resource.member?(user: user) end def readable_by?(user)
Allow inventory members edit the inventory
diff --git a/app/commands/api/user_authentication.rb b/app/commands/api/user_authentication.rb index abc1234..def5678 100644 --- a/app/commands/api/user_authentication.rb +++ b/app/commands/api/user_authentication.rb @@ -13,8 +13,8 @@ token, exp_date = Api::TokenProvider.encode(user_id: user.id) user.update(api_token: token) { - "token": token, - "expiry_date": exp_date.to_formatted_s(:db) + "token" => token, + "expiry_date" => exp_date.to_formatted_s(:db) } end end
Fix problem with heroku syntax
diff --git a/app/controllers/companies_controller.rb b/app/controllers/companies_controller.rb index abc1234..def5678 100644 --- a/app/controllers/companies_controller.rb +++ b/app/controllers/companies_controller.rb @@ -10,6 +10,7 @@ def create @company = Company.create(company_params) + redirect_to '/companies' end def edit
Fix create controller for companies
diff --git a/deferred_job.gemspec b/deferred_job.gemspec index abc1234..def5678 100644 --- a/deferred_job.gemspec +++ b/deferred_job.gemspec @@ -15,5 +15,5 @@ s.require_paths = ['lib'] s.summary = 'Deferred job library for Sidekiq or generic classes' s.test_files = Dir.glob('spec/*.rb') - s.version = '0.1.1' # TODO + s.version = '1.0.0' end
Update the gem version to 1.0.0 [3184]
diff --git a/config/initializers/01_redis.rb b/config/initializers/01_redis.rb index abc1234..def5678 100644 --- a/config/initializers/01_redis.rb +++ b/config/initializers/01_redis.rb @@ -1,4 +1,6 @@ require 'redis-namespace' + +redis_default = '127.0.0.1:6379' redis_conns = ENV['redis_conns'].to_i <= 0 ? 10 : @@ -9,12 +11,12 @@ ENV['redis_timeout'].to_i redis_host = ENV.fetch('redis_host') do - ENV.fetch('cache_servers').split(',').first + ENV.fetch('cache_servers', redis_default).split(',').first .split(':').first end redis_port = ENV.fetch('redis_port') do - ENV.fetch('cache_servers').split(',').first + ENV.fetch('cache_servers', redis_default).split(',').first .split(':').last.to_i || 6379 end
Set default server for redis
diff --git a/lib/battlenet/api/api_response.rb b/lib/battlenet/api/api_response.rb index abc1234..def5678 100644 --- a/lib/battlenet/api/api_response.rb +++ b/lib/battlenet/api/api_response.rb @@ -10,7 +10,8 @@ def get_data(path, options) unless @client.nil? - @data = @client.get(path, options) + response = @client.get(path, options) + @data = response.parsed_response end end
Change the response data returned to be the parsed response (Hash format)
diff --git a/lib/chef/knife/secure_bag_edit.rb b/lib/chef/knife/secure_bag_edit.rb index abc1234..def5678 100644 --- a/lib/chef/knife/secure_bag_edit.rb +++ b/lib/chef/knife/secure_bag_edit.rb @@ -14,17 +14,17 @@ item = Chef::DataBagItem.load(bag, item_name) @raw_data = item.to_hash - item = SecureDataBag::Item.from_item(item, key:read_secret) + item = SecureDataBag::Item.from_item(item) hash = item.to_hash(encoded: false) hash = data_for_edit(hash) hash end - def edit_item(item) + def edit_data(data, *args) output = super output = data_for_save(output) - item = SecureDataBag::Item.from_hash(output, key:read_secret) + item = SecureDataBag::Item.from_hash(output) item.encoded_fields encoded_fields item.to_hash encoded:true end
Stop overriding keys in knife secure bag edit
diff --git a/lib/chef/resource/aws_iam_role.rb b/lib/chef/resource/aws_iam_role.rb index abc1234..def5678 100644 --- a/lib/chef/resource/aws_iam_role.rb +++ b/lib/chef/resource/aws_iam_role.rb @@ -20,12 +20,12 @@ # # The path to the role. For more information about paths, see http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html # - attribute :path, kind_of: String + attribute :path, kind_of: String # # The policy that grants an entity permission to assume the role. # - attribute :assume_role_policy_document, kind_of: [ String, Array ], required: true + attribute :assume_role_policy_document, kind_of: String, required: true def aws_object driver.iam_resource.role(name).load
Allow only strings for assume role polciy
diff --git a/lib/shipping_easy/http/request.rb b/lib/shipping_easy/http/request.rb index abc1234..def5678 100644 --- a/lib/shipping_easy/http/request.rb +++ b/lib/shipping_easy/http/request.rb @@ -19,8 +19,9 @@ end def sign_request! + params[:api_key] = api_key + params[:api_timestamp] = Time.now.to_i params[:api_signature] = signature.to_s - params[:api_timestamp] = Time.now.to_i end def uri
Add api_key and calculate signature afterwards.
diff --git a/lib/tasks/import/dns_details.rake b/lib/tasks/import/dns_details.rake index abc1234..def5678 100644 --- a/lib/tasks/import/dns_details.rake +++ b/lib/tasks/import/dns_details.rake @@ -1,6 +1,7 @@ require 'transition/import/dns_details' namespace :import do + desc 'Look up CNAME details for all hosts' task :dns_details => :environment do Transition::Import::DnsDetails.from_nameserver! end
Add a description for DNS rake task
diff --git a/release/1_create_dmg.rb b/release/1_create_dmg.rb index abc1234..def5678 100644 --- a/release/1_create_dmg.rb +++ b/release/1_create_dmg.rb @@ -27,7 +27,7 @@ require 'fileutils' FileUtils.rm_rf(dmgwork) FileUtils.mkdir(dmgwork) -FileUtils.cp_r(app, dmgwork) +FileUtils.mv(app, dmgwork) # Copy additional files files = "./files"
Fix code sign problem to create dmg
diff --git a/ruby_prof_rails.gemspec b/ruby_prof_rails.gemspec index abc1234..def5678 100644 --- a/ruby_prof_rails.gemspec +++ b/ruby_prof_rails.gemspec @@ -17,7 +17,7 @@ server restart or affecting other users sessions.} s.license = 'MIT' - s.files = Dir['{app,config,db,lib}/**/*', 'MIT-LICENSE', 'Rakefile', 'README.md'] + s.files = Dir['{app,config,lib}/**/*', 'MIT-LICENSE', 'Rakefile', 'README.md'] s.test_files = Dir['test/**/*'] s.add_dependency 'rails', '>= 3.0'
Remove db directory from gemspec
diff --git a/db/migrate/20190212170745_change_quarter_id_to_bigint.rb b/db/migrate/20190212170745_change_quarter_id_to_bigint.rb index abc1234..def5678 100644 --- a/db/migrate/20190212170745_change_quarter_id_to_bigint.rb +++ b/db/migrate/20190212170745_change_quarter_id_to_bigint.rb @@ -0,0 +1,9 @@+class ChangeQuarterIdToBigint < ActiveRecord::Migration[6.0] + def up + change_column :quarter_months, :quarter_id, :bigint + end + + def down + change_column :quarter_months, :quarter_id, :integer + end +end
Update quarter_id foreign key to bigint
diff --git a/ScrollableGraphView.podspec b/ScrollableGraphView.podspec index abc1234..def5678 100644 --- a/ScrollableGraphView.podspec +++ b/ScrollableGraphView.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "ScrollableGraphView" -s.version = "1.0.1" +s.version = "1.1.0" s.summary = "Scrollable graph view for iOS" s.description = "An adaptive scrollable graph view for iOS to visualise simple discrete datasets. Written in Swift." s.homepage = "https://github.com/philackm/Scrollable-GraphView"
Update cocoapod version to 1.1.0
diff --git a/lib/algoliasearch/utilities.rb b/lib/algoliasearch/utilities.rb index abc1234..def5678 100644 --- a/lib/algoliasearch/utilities.rb +++ b/lib/algoliasearch/utilities.rb @@ -13,7 +13,7 @@ def reindex_all_models get_model_classes.each do |klass| - klass.reindex! + klass.reindex end end end
Use a temporary index to reindex instead of the inplace one.
diff --git a/lib/companies_house/request.rb b/lib/companies_house/request.rb index abc1234..def5678 100644 --- a/lib/companies_house/request.rb +++ b/lib/companies_house/request.rb @@ -4,6 +4,11 @@ BASE_URI = 'http://data.companieshouse.gov.uk/doc/company/' + # White list of allowed prefixes for companies house numbers. + # 1st line is English and Welsh prefixes + # 2nd line is Scottish prefixes + # 3rd line is Northen Irish prefixes + # \d\d is the default prefix in regex notation. ALLOWED_PREFIXES = %w(AC BR FC GE IP LP OC RC SE ZC SC SA SF SL SZ SP SO SR NI NA NF NL NZ NP NO NR
Add comment to prefixes white list
diff --git a/test/tags_test.rb b/test/tags_test.rb index abc1234..def5678 100644 --- a/test/tags_test.rb +++ b/test/tags_test.rb @@ -0,0 +1,16 @@+require_relative 'config' + +class TagsTest < PunchTest + + def test_brf_parser_doesnt_ignore_tags + brf_write <<-EOS + Februar 2015 - Simon Kiener + + 03.01.15 08:00-10:00 Total: 02:00 CRAZY + + Total: 02:00 + EOS + + assert_equal current_month.days.last.tags, [:crazy] + end +end
Add failing tests for tags parsing
diff --git a/test/test_misc.rb b/test/test_misc.rb index abc1234..def5678 100644 --- a/test/test_misc.rb +++ b/test/test_misc.rb @@ -0,0 +1,40 @@+#!/usr/bin/ruby -w + +# +# Test miscellaneous items that don't fit elsewhere +# + +require "./#{File.dirname(__FILE__)}/etchtest" +require 'webrick' + +class EtchMiscTests < Test::Unit::TestCase + include EtchTests + + def setup + # Generate a file to use as our etch target/destination + @targetfile = released_tempfile + #puts "Using #{@targetfile} as target file" + + # Generate a directory for our test repository + @repodir = initialize_repository + @server = get_server(@repodir) + + # Create a directory to use as a working directory for the client + @testroot = tempdir + #puts "Using #{@testroot} as client working directory" + end + + def test_empty_repository + # Does etch behave properly if the repository is empty? I.e. no source or + # commands directories. + testname = 'empty repository' + run_etch(@server, @testroot, :testname => testname) + end + + def teardown + remove_repository(@repodir) + FileUtils.rm_rf(@testroot) + FileUtils.rm_rf(@targetfile) + end +end +
Add a file for misc tests, starting with test_empty_repository to try to reproduce an issue reported by a user on the mailing list
diff --git a/Casks/xquartz.rb b/Casks/xquartz.rb index abc1234..def5678 100644 --- a/Casks/xquartz.rb +++ b/Casks/xquartz.rb @@ -5,6 +5,11 @@ version '2.7.6' sha256 '02aa3268af0bd7dcd5dfbc10d673f5c6834bba6371a928d2a3fc44a8039b194e' install 'XQuartz.pkg' + + after_install do + Pathname.new(Dir.home).join('Library', 'Logs').mkpath + end + uninstall :quit => 'org.macosforge.xquartz.X11', :pkgutil => 'org.macosforge.xquartz.pkg' end
XQuartz: Create Logs dir if it does not exist
diff --git a/lib/geocoder/lookups/geoip2.rb b/lib/geocoder/lookups/geoip2.rb index abc1234..def5678 100644 --- a/lib/geocoder/lookups/geoip2.rb +++ b/lib/geocoder/lookups/geoip2.rb @@ -37,7 +37,8 @@ def results(query) return [] unless configuration[:file] - Array(@mmdb.lookup(query.to_s)) + result = @mmdb.lookup(query.to_s) + result.nil? ? [] : [result] end end end
Revert "Remove unnecessary ternary operator" This reverts commit 97b6bb948f9c298b4d6c30ceddf9702e85b2d046.
diff --git a/lib/minitest/fivemat_plugin.rb b/lib/minitest/fivemat_plugin.rb index abc1234..def5678 100644 --- a/lib/minitest/fivemat_plugin.rb +++ b/lib/minitest/fivemat_plugin.rb @@ -4,13 +4,18 @@ class FivematReporter < Reporter include ElapsedTime + def initialize(*args) + super + @class = nil + end + def record(result) - if defined?(@class) && @class != result.class + if @class != result.klass if @class print_elapsed_time(io, @class_start_time) io.print "\n" end - @class = result.class + @class = result.klass @class_start_time = Time.now io.print "#@class " end
Fix reporting for Minitest 5+ The fix give in 191bef2b3caf4df5c2fab0396dedfc24152c7b8e actually broke the reporter entirely; because `@class` will not be defined initially, it never will be because the body of the `if` statement will never be entered. I can thing of two fixes. The smallest-diff fix would be to change to ```ruby @class = nil unless defined?(@class) if @class != result.klass ``` However, it seems more in the spirit of OO to do one-time initialisation of variables in the constructor. This commit also updates the reporter to use the accessor `Result#klass`, rather than `#class`.
diff --git a/rapa.gemspec b/rapa.gemspec index abc1234..def5678 100644 --- a/rapa.gemspec +++ b/rapa.gemspec @@ -13,7 +13,7 @@ spec.require_paths = ["lib"] - spec.add_development_dependency "bundler", "~> 1.14" + spec.add_development_dependency "bundler", "~> 1.13" spec.add_development_dependency "rake", "~> 10.0" spec.add_development_dependency "rspec", "~> 3.0" end
Use bundler 1.13 or later Because CircleCI uses 1.13
diff --git a/lib/plenty_client/warehouse.rb b/lib/plenty_client/warehouse.rb index abc1234..def5678 100644 --- a/lib/plenty_client/warehouse.rb +++ b/lib/plenty_client/warehouse.rb @@ -2,25 +2,13 @@ module PlentyClient module Warehouse - include PlentyClient::Endpoint include PlentyClient::Request + extend PlentyClient::Concerns::RestPaths - LIST_WAREHOUSES = '/stockmanagement/warehouses' - FIND_WAREHOUSE = '/stockmanagement/warehouses/{warehouseId}' - CREATE_WAREHOUSE = '/stockmanagement/warehouses' + skip_rest_paths :update, :destroy - class << self - def list(headers = {}, &block) - get(build_endpoint(LIST_WAREHOUSES), headers, &block) - end - - def find(warehouse_id, headers = {}, &block) - get(build_endpoint(FIND_WAREHOUSE, warehouse: warehouse_id), headers, &block) - end - - def create(body = {}) - post(build_endpoint(CREATE_WAREHOUSE), body) - end + private_class_method def self.base_path + '/stockmanagement/warehouses' end end end
Refactor Warehouse with RestPaths mixin
diff --git a/lib/rom/sql/mapper_compiler.rb b/lib/rom/sql/mapper_compiler.rb index abc1234..def5678 100644 --- a/lib/rom/sql/mapper_compiler.rb +++ b/lib/rom/sql/mapper_compiler.rb @@ -4,10 +4,10 @@ module SQL class MapperCompiler < ROM::MapperCompiler def visit_attribute(node) - name, _, meta = node + name, _, meta_options = node - if meta[:wrapped] - [name, from: self.alias] + if meta_options[:wrapped] + [name, from: meta_options[:alias]] else [name] end
Fix mapper compiler reading attribute alias After merging #324 to master, `rom` test suite (once `rom-sql` dependency was updated to the new master ref) was failing due to a change introduced by error on reading the attribute alias from the mapper compiler.
diff --git a/lib/travis/travis_yml_stats.rb b/lib/travis/travis_yml_stats.rb index abc1234..def5678 100644 --- a/lib/travis/travis_yml_stats.rb +++ b/lib/travis/travis_yml_stats.rb @@ -32,7 +32,7 @@ end def normalize_string(str) - str.downcase.tr(" ", "-") + str.to_s.downcase.tr(" ", "-") end end end
Handle nils when normalising strings
diff --git a/Segment-GoogleAnalytics.podspec b/Segment-GoogleAnalytics.podspec index abc1234..def5678 100644 --- a/Segment-GoogleAnalytics.podspec +++ b/Segment-GoogleAnalytics.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Segment-GoogleAnalytics" - s.version = "1.1.0" + s.version = "1.1.1" s.summary = "Google Analytics Integration for Segment's analytics-ios library." s.description = <<-DESC
Prepare for next development version
diff --git a/example.rb b/example.rb index abc1234..def5678 100644 --- a/example.rb +++ b/example.rb @@ -0,0 +1,93 @@+require "bundler/setup" + +module PHTTP + require "typhoeus" + require "forwardable" + require "delegate" + require "json" + + class Response < SimpleDelegator + def response_json + JSON.parse(response_body) + end + + alias_method :json, :response_json + end + + class Foundation + extend Forwardable + + attr_reader :hydra + + def initialize(hydra = Typhoeus::Hydra.new, defaults) + @hydra = hydra + @defaults = defaults + @queued = [] + end + + def queue(request) + @queued << request + hydra.queue(request) + end + + def run + yield self + hydra.run + @queued + end + + def request(url, options = {}, &block) + request = Typhoeus::Request.new(url, merge_defaults(options)) + request.on_complete(&create_callback(block)) if block_given? + queue request + end + + def merge_defaults(options = {}) + @defaults.merge(options) do |key, default, new| + if default.respond_to?(:merge) + default.merge(new) + else + new + end + end + end + + def create_callback(callable) + lambda { |response| callable.call Response.new(response) } + end + end + + def self.parallel(options = {}, &block) + root = Foundation.new(options) + root.run(&block) + end +end + +def api_url(path) + url = URI.parse("https://gateway.int.ea.com/proxy/identity") + url.path = path + url.to_s +end + +defaults = { + method: :get, + headers: { "X-Expand-Results" => "true" }, +} + +persona_uid = "400296307" + +response = PHTTP.parallel(defaults) do |http| + login_params = { + grant_type: "client_credentials", + client_id: "NFS14-Rivals-Web-Client", + client_secret: "NFS14RivalsWebClientSecret" + } + + http.request("https://accounts.int.ea.com/connect/token", method: :post, params: login_params) do |response| + if response.success? + puts "Yay: #{response.response_json}" + else + puts "Boo: #{response.code} => #{response.response_body}" + end + end +end
Add first skeleton for performing requests with a hydra
diff --git a/db/migrate/0002_create_games.rb b/db/migrate/0002_create_games.rb index abc1234..def5678 100644 --- a/db/migrate/0002_create_games.rb +++ b/db/migrate/0002_create_games.rb @@ -0,0 +1,10 @@+class CreateGames < ActiveRecord::Migration + def up + create_table :games do |t| + t.integer :player_id + t.integer :answer + t.integer :last_guess + t.integer :turn_count + end + end +end
Add migration for a games table.
diff --git a/delayed_job_data_mapper.gemspec b/delayed_job_data_mapper.gemspec index abc1234..def5678 100644 --- a/delayed_job_data_mapper.gemspec +++ b/delayed_job_data_mapper.gemspec @@ -17,7 +17,7 @@ s.add_runtime_dependency 'dm-core' s.add_runtime_dependency 'dm-observer' s.add_runtime_dependency 'dm-aggregates' - s.add_runtime_dependency 'delayed_job', '~> 2.1' - s.add_development_dependency 'rspec', '>= 1.2.9' + s.add_runtime_dependency 'delayed_job', '3.0.0.pre' + s.add_development_dependency 'rspec' end
Update Delayed Job and RSpec dependencies in gemspec.
diff --git a/name_resolution/name_resolver.rb b/name_resolution/name_resolver.rb index abc1234..def5678 100644 --- a/name_resolution/name_resolver.rb +++ b/name_resolution/name_resolver.rb @@ -8,21 +8,15 @@ timeout: default: 30 EOS - # Doesn't work :( - TIMEOUT=77 def build_report - resolver = Resolv::DNS.new(:nameserver => [option(:nameserver)]) - - # Only Ruby >= 2.0.0 supports setting a timeout. - # Without this DNS timeouts will raise a PluginTimeoutError - if resolver.respond_to? :timeouts= - resolver.timeouts = option(:timeout) - end - begin - resolver.getaddress(option(:resolve_address)) - rescue Resolv::ResolvError, Resolv::ResolvTimeout => err + # Only Ruby >= 2.0.0 supports setting a timeout, so use this + Timeout.timeout(option(:timeout)) do + resolver = Resolv::DNS.new(:nameserver => [option(:nameserver)]) + resolver.getaddress(option(:resolve_address)) + end + rescue Resolv::ResolvError, Resolv::ResolvTimeout, Timeout::Error => err report(:resolved? => 0, :result => err) else report(:resolved? => 1)
Use Ruby Timeout instead of Resolv::DNS timeout
diff --git a/spec/features/home_page_spec.rb b/spec/features/home_page_spec.rb index abc1234..def5678 100644 --- a/spec/features/home_page_spec.rb +++ b/spec/features/home_page_spec.rb @@ -0,0 +1,52 @@+require 'spec_helper' + +include Warden::Test::Helpers + +describe_options = { type: :feature } + +describe "Visting the home page" do + + before do + # TODO: This really shouldn't be necessary + unspoof_http_auth + sign_in :curator + @user = User.where(login: 'curator1').first + end + + it "loads the page when there are no groups" do + visit '/' + page.should have_content "#{@user.login}" + end + + context "when there are only a couple of groups" do + before { add_groups_to_user(2) } + it "loads the page" do + visit '/' + page.should have_content "#{@user.login}" + page.should have_content "What is ScholarSphere?" + page.status_code.should == 200 + end + end + + context "when there are only a lot of groups" do + before { add_groups_to_user(100) } + it "loads the page" do + visit '/' + page.should have_content "#{@user.login}" + page.should have_content "What is ScholarSphere?" + page.status_code.should == 200 + end + end + + def add_groups_to_user(number_of_groups) + group_list_array = [] + (0..number_of_groups).each do |i| + group_list_array << "umg/up.dlt.scholarsphere-admin.admin#{i}" + end + @user.update_attribute(:group_list, group_list_array.join(';?;')) + # groups_last_update can't be nil, otherwise @user.groups will be [] + # (see User.rb (def groups) ) + @user.update_attribute(:groups_last_update, Time.now) + @user.save! + end +end
Add a failing integration test for long Solr GET request REFS 9085 When a user with a large number of groups logs in a 500 error is raised due to too long of a GET between Blacklight and Solr.
diff --git a/app/helpers/oauth_helper.rb b/app/helpers/oauth_helper.rb index abc1234..def5678 100644 --- a/app/helpers/oauth_helper.rb +++ b/app/helpers/oauth_helper.rb @@ -13,7 +13,7 @@ def enabled_social_providers enabled_oauth_providers.select do |name| - [:twitter, :gitlab, :github, :bitbucket, :google_oauth2].include?(name.to_sym) + [:saml, :twitter, :gitlab, :github, :bitbucket, :google_oauth2].include?(name.to_sym) end end
Add SAML to list of social_provider
diff --git a/app/models/stock/package.rb b/app/models/stock/package.rb index abc1234..def5678 100644 --- a/app/models/stock/package.rb +++ b/app/models/stock/package.rb @@ -24,8 +24,10 @@ # # @return [Array<Spree::ShippingMethod>] def shipping_methods - super.delete_if do |shipping_method| - !ships_with?(order.distributor, shipping_method) + available_shipping_methods = super.to_a + + available_shipping_methods.delete_if do |shipping_method| + !ships_with?(order.distributor.shipping_methods.to_a, shipping_method) end end @@ -33,11 +35,11 @@ # Checks whether the given distributor provides the specified shipping method # - # @param distributor [Spree::Enterprise] + # @param shipping_methods [Array<Spree::ShippingMethod>] # @param shipping_method [Spree::ShippingMethod] # @return [Boolean] - def ships_with?(distributor, shipping_method) - distributor.shipping_methods.include?(shipping_method) + def ships_with?(shipping_methods, shipping_method) + shipping_methods.include?(shipping_method) end end end
Fix insane N+1 in Package The #ships_with? method was being called ~800 times when loading the admin order edit page (with Aus production data), and triggering a new query each time it was called.
diff --git a/app/models/user_interest.rb b/app/models/user_interest.rb index abc1234..def5678 100644 --- a/app/models/user_interest.rb +++ b/app/models/user_interest.rb @@ -1,4 +1,6 @@ class UserInterest < ApplicationRecord belongs_to :user belongs_to :interest + + validates_uniqueness_of :user_id, scope: [:interest_id] end
Add validation to UserInterest to prevent redundancy
diff --git a/spec/full_usage_spec.rb b/spec/full_usage_spec.rb index abc1234..def5678 100644 --- a/spec/full_usage_spec.rb +++ b/spec/full_usage_spec.rb @@ -1,22 +1,37 @@ require "spec_helper" -RSpec.describe 'DeepCover usage' do - it 'run `ruby spec/full_usage/simple/simple.rb` successfully' do +RSpec::Matchers.define :run_successfully do + match do |path| reader, writer = IO.pipe - options = {4 => writer.fileno, in: File::NULL, out: File::NULL, err: File::NULL} + error_r, error_w = IO.pipe + options = {4 => writer.fileno, in: File::NULL, out: File::NULL, err: error_w} - pid = spawn('ruby', 'spec/full_usage/simple/simple.rb', '4', options) + pid = spawn('ruby', "spec/full_usage/#{path}", '4', options) writer.close - problems = reader.read + error_w.close + @output = reader.read.chomp + @errors = error_r.read.chomp Process.wait(pid) - exit_code = $?.exitstatus + @exit_code = $?.exitstatus reader.close + @ouput_ok = @expected_output.nil? || @expected_output == @output - if problems.empty? - fail "Test program should have returned something but didn't" - elsif problems != "Done\n" - fail "Received unexpected message from test program:\n#{problems}" - end - exit_code.should be 0 + @exit_code == 0 && @ouput_ok && @errors == '' + end + + chain :and_output do |output| + @expected_output = output + end + + failure_message do + [ + ("expected output '#{@expected_output}', got '#{@output}'" unless @ouput_ok), + ("expected exit code 0, got #{@exit_code}" if @exit_code != 0), + ("expected no errors, got '#{@errors}'" unless @errors.empty?), + ].compact.join(' and ') end end + +RSpec.describe 'DeepCover usage' do + it { 'simple/simple.rb'.should run_successfully.and_output('Done') } +end
Create matcher for full usage
diff --git a/spec/models/ngo_spec.rb b/spec/models/ngo_spec.rb index abc1234..def5678 100644 --- a/spec/models/ngo_spec.rb +++ b/spec/models/ngo_spec.rb @@ -10,6 +10,8 @@ it { is_expected.to validate_presence_of :name } it { is_expected.to validate_presence_of :identifier } end + + it { is_expected.to define_enum_for(:locale).with([:de, :en])} describe 'associations' do let(:ngo) { create :ngo }
Add spec to test that ngo has locale enum
diff --git a/engineyard-serverside.gemspec b/engineyard-serverside.gemspec index abc1234..def5678 100644 --- a/engineyard-serverside.gemspec +++ b/engineyard-serverside.gemspec @@ -1,4 +1,4 @@-# -*- encoding: utf-8 -* +# -*- encoding: utf-8 -*- lib = File.expand_path('../lib/', __FILE__) $:.unshift lib unless $:.include?(lib) require 'engineyard-serverside/version' @@ -19,6 +19,6 @@ s.add_development_dependency('rspec', '= 1.3.2') s.add_development_dependency('rake', '>= 0.9.2.2') - s.required_rubygems_version = %q{1.3.6} + s.required_rubygems_version = %q{>= 1.3.6} s.test_files = Dir.glob("spec/**/*") end
Correct Gem::Requirement for rubygems (oops!) and fixed utf-8 marker.
diff --git a/test/test_melt.rb b/test/test_melt.rb index abc1234..def5678 100644 --- a/test/test_melt.rb +++ b/test/test_melt.rb @@ -2,9 +2,7 @@ require 'melt' class TestMelt < Minitest::Test - def test_it_does_something_useful - icicle = "----->" - + def test_it_melt # winter icicle.freeze assert icicle.frozen?, 'Icicle is not frozen!' @@ -13,4 +11,20 @@ icicle.melt refute icicle.frozen?, 'Icile is not melted!' end + + def test_melted_is_same_object + oid = icicle.object_id + + # winter + icicle.freeze + assert_equal oid, icicle.object_id + + # spring + icicle.melt + assert_equal oid, icicle.object_id + end + + def icicle + @icicle ||= "----->" + end end
Test object_id is not changed during meltdown.
diff --git a/script/cruise_build.rb b/script/cruise_build.rb index abc1234..def5678 100644 --- a/script/cruise_build.rb +++ b/script/cruise_build.rb @@ -6,10 +6,10 @@ # local overrides are loaded by Rake. project_name = ARGV.first -project.source_control.branch = "montanabranch" +project.source_control.branch = "montanacycling" case project_name -when "racing_on_rails", "montanabranch" +when "racing_on_rails", "montanacycling" exec "rake cruise" when "aba", "atra", "obra", "wsba" exec "rm -rf local && git clone git@butlerpress.com:#{project_name}.git local && rake cruise"
Use montanacycling for consistency, not montanabranch