diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/libraries/package_provider.rb b/libraries/package_provider.rb index abc1234..def5678 100644 --- a/libraries/package_provider.rb +++ b/libraries/package_provider.rb @@ -28,7 +28,7 @@ def initialize(*args) original_initialize(*args) - if node.platform?("freebsd") && node.platform_version.to_f < 8.2 && + if platform?("freebsd") && node.platform_version.to_f < 8.2 && @new_resource.source != "ports" Chef::Log.info "Packages for FreeBSD < 8.2 are gone, forcing #{@new_resource.name} to install from ports (was: #{@new_resource.source.inspect})" @new_resource.source("ports")
Fix braino that ends up creating a weird "platform?" attribute. Signed-off-by: jtimberman <d6955d9721560531274cb8f50ff595a9bd39d66f@opscode.com>
diff --git a/lib/rack_dav/handler.rb b/lib/rack_dav/handler.rb index abc1234..def5678 100644 --- a/lib/rack_dav/handler.rb +++ b/lib/rack_dav/handler.rb @@ -19,8 +19,8 @@ begin controller = Controller.new(request, response, @options.dup) - controller.send(request.request_method.downcase) - + res = controller.send(request.request_method.downcase) + response.status = res.code if res.is_a?(HTTPStatus::Status) rescue HTTPStatus::Status => status response.status = status.code end
Allow response to be returned
diff --git a/yard.gemspec b/yard.gemspec index abc1234..def5678 100644 --- a/yard.gemspec +++ b/yard.gemspec @@ -7,7 +7,7 @@ s.homepage = "http://yard.soen.ca" s.platform = Gem::Platform::RUBY s.summary = "Documentation tool for consistent and usable documentation in Ruby." - s.files = Dir.glob("{bin,lib,spec,templates,benchmarks}/**/*") + ['LICENSE', 'README.markdown', 'Rakefile'] + s.files = Dir.glob("{bin,lib,spec,templates,benchmarks}/**/*") + ['LICENSE', 'FAQ.markdown', 'README.markdown', 'Rakefile'] s.require_paths = ['lib'] s.executables = [ 'yardoc', 'yri', 'yard-graph' ] s.has_rdoc = false
Add FAQ to gem package
diff --git a/spec/features/admin/admin_profiles_spec.rb b/spec/features/admin/admin_profiles_spec.rb index abc1234..def5678 100644 --- a/spec/features/admin/admin_profiles_spec.rb +++ b/spec/features/admin/admin_profiles_spec.rb @@ -0,0 +1,19 @@+# frozen_string_literal: true + +require 'rails_helper' + +RSpec.feature 'Admin::Profiles', type: :feature do + let(:admin) { create(:admin_user) } + + before { sign_in admin } + + describe '#edit' do + it 'can edit site' do + visit edit_admin_profile_path(admin) + fill_in 'admin_user_password', with: 'new_password' + fill_in 'admin_user_password_confirmation', with: 'new_password' + click_button '更新Admin user' + expect(page).to have_content('Dashboard') + end + end +end
Add simpe test for edit admin password
diff --git a/spec/features/update_project_capacities.rb b/spec/features/update_project_capacities.rb index abc1234..def5678 100644 --- a/spec/features/update_project_capacities.rb +++ b/spec/features/update_project_capacities.rb @@ -0,0 +1,24 @@+require 'rails_helper' + +feature 'Update project capacities' do + Given!(:current_account) { FactoryGirl.create(:account) } + Given!(:project_to_work_on) { FactoryGirl.create(:project) } + Given!(:project_not_to_work_on) { FactoryGirl.create(:project) } + # TODO extract this to a helper + When { visit new_account_session_path + fill_in 'Email', with: current_account.email + fill_in 'Password', with: current_account.password + click_button 'Log in'} + + When { click_link_or_button project_to_work_on.name } + + When { select("1 half-day", from: "Amount") } + When { select("4", from: "Quality") } + When { fill_in("Worked at", with: "2015-05-06") } + + When { click_link_or_button "Log Capacity" } + # TODO Need to create model test for update capacity method + Then { expect(Project.find_by(name: project_to_work_on.name, total_capacity_owed: 15, capacity_used: 4, capacity_remaining: 11)).to be_present } + + +end
Check that a project's capacity gets updated
diff --git a/spec/integration/custom_attributes_spec.rb b/spec/integration/custom_attributes_spec.rb index abc1234..def5678 100644 --- a/spec/integration/custom_attributes_spec.rb +++ b/spec/integration/custom_attributes_spec.rb @@ -1,14 +1,6 @@ require 'spec_helper' describe 'custom attributes' do - - #module Coercible - #class Coercer - #class RegularExpression < Object - #primitive RegExp - #end - #end - #end before do module Examples
Remove obsolete code from spec
diff --git a/informant-rails.gemspec b/informant-rails.gemspec index abc1234..def5678 100644 --- a/informant-rails.gemspec +++ b/informant-rails.gemspec @@ -10,6 +10,7 @@ s.license = "GPL" s.authors = ["Paul Elliott", "Cameron Daigle"] + s.email = ["paul@codingfrontier.com"] s.description = "The Informant tells you what's irritating your users." s.homepage = "http://www.theinformant.io" s.require_paths = ["lib"]
Add email to the gemspec
diff --git a/spec/poper/rule/fifty_char_summary_spec.rb b/spec/poper/rule/fifty_char_summary_spec.rb index abc1234..def5678 100644 --- a/spec/poper/rule/fifty_char_summary_spec.rb +++ b/spec/poper/rule/fifty_char_summary_spec.rb @@ -16,6 +16,11 @@ let(:msg) { 'Implement that feature - really really really well.' } it { should_not be_nil } end + + context 'fifty char summary with a newline' do + let(:msg) { "Implement that feature - really really really well\n"} + it { should be_nil } + end end end end
Add spec for counting linebreaks in 50 char rule
diff --git a/app/lib/panopticon_registerer.rb b/app/lib/panopticon_registerer.rb index abc1234..def5678 100644 --- a/app/lib/panopticon_registerer.rb +++ b/app/lib/panopticon_registerer.rb @@ -24,7 +24,7 @@ end def notify_of_update - api.put_artefact!(mapping.id, artefact_attributes) + api.put_artefact!(mapping.panopticon_id, artefact_attributes) end def mapping
Use correct ID when updating artefact
diff --git a/app/models/ability/membership.rb b/app/models/ability/membership.rb index abc1234..def5678 100644 --- a/app/models/ability/membership.rb +++ b/app/models/ability/membership.rb @@ -3,7 +3,9 @@ super(user) can [:update], ::Membership do |membership| - membership.user_id == user.id + membership.user_id == user.id || + user_is_admin_of?(membership.group_id) || + user_is_admin_of?(membership.target_model.group_id) end can [:make_admin], ::Membership do |membership|
Allow coordinators to assign titles to others
diff --git a/app/models/weekly_time_report.rb b/app/models/weekly_time_report.rb index abc1234..def5678 100644 --- a/app/models/weekly_time_report.rb +++ b/app/models/weekly_time_report.rb @@ -0,0 +1,20 @@+# Get internal/external hour split for a given week +class WeeklyTimeReport + def initialize(date_in_week=Time.zone.now) + @date = date_in_week + end + + def run + get_weekly_hours(@date) + end + + def sum_hours(method, hours) + hours.select{|wu| wu.send(method) }.sum(&:hours) + end + + def get_weekly_hours(date) + start_date, end_date = date.beginning_of_week.to_date, date.end_of_week.to_date + work_units = WorkUnit.scheduled_between(start_date, end_date) + { external: sum_hours(:external?, work_units).to_i, internal: sum_hours(:internal?, work_units).to_i } + end +end
Add WeeklyTimeReport service class. Unused except in a cron job at present.
diff --git a/app/decorators/social_stream/base/activities_controller_decorator.rb b/app/decorators/social_stream/base/activities_controller_decorator.rb index abc1234..def5678 100644 --- a/app/decorators/social_stream/base/activities_controller_decorator.rb +++ b/app/decorators/social_stream/base/activities_controller_decorator.rb @@ -6,6 +6,15 @@ Activity.timeline(current_section, current_subject). page(params[:page]) + + respond_to do |format| + format.html { + if(params.has_key?(:page)) + render @activities + end + } + format.atom + end end end
Fix see more in activities
diff --git a/spec/ethos/entity.rb b/spec/ethos/entity.rb index abc1234..def5678 100644 --- a/spec/ethos/entity.rb +++ b/spec/ethos/entity.rb @@ -59,3 +59,34 @@ asserts(entity.value) == 1 end end + +scope do + setup do + class Entity + prepend Ethos::Entity + + attribute :name, type: String + attribute :parent, type: Entity + end + end + + scope do + define entity: -> { Entity.new } + + spec do + asserts(entity.parent) == nil + end + end + + scope do + define entity: -> { Entity.new name: 'Child', parent: {name: 'Parent'} } + + spec do + asserts(entity.parent).is_a? Entity + end + + spec do + asserts(entity.parent.name) == 'Parent' + end + end +end
Test embedding of entities as attributes
diff --git a/spec/lib/dog_spec.rb b/spec/lib/dog_spec.rb index abc1234..def5678 100644 --- a/spec/lib/dog_spec.rb +++ b/spec/lib/dog_spec.rb @@ -7,10 +7,14 @@ expect(dog.name).to eq 'Pochi' end - xit "has fangs" do + it "has fangs" do + dog = Dog.new + expect(dog.fangs).to eq 2 end - xit "is alived" do + it "is alived" do + dog = Dog.new + expect(dog).to be_alived end end
Add tests to be failed
diff --git a/spec/recalls_spec.rb b/spec/recalls_spec.rb index abc1234..def5678 100644 --- a/spec/recalls_spec.rb +++ b/spec/recalls_spec.rb @@ -10,9 +10,9 @@ describe "search" do context "when a search returns a success" do before do - stub_request(:get, 'http://search.usa.gov/search/recalls'). - with(:api_key => 'badcheese', :format => "json"). - to_return(:body => fixture('recalls_search_response.json'), :headers => {'Content-Type' => 'text/json; charset=utf-8'}) + stub_request(:get, "http://search.usa.gov/search/recalls/?format=json"). + with(:headers => {'Accept'=>'application/json'}). + to_return(:status => 200, :body => fixture('recalls_search_response.json'), :headers => {}) end it "should return a hash with the results" do
Fix stubbing of request, tests pass.
diff --git a/spec/release_spec.rb b/spec/release_spec.rb index abc1234..def5678 100644 --- a/spec/release_spec.rb +++ b/spec/release_spec.rb @@ -3,6 +3,7 @@ require 'spec_helper' require 'json' +require 'erb' version = JSON.parse(File.read('metadata.json'))['version'] @@ -18,4 +19,11 @@ it 'README should mention the version' do expect(%x{grep ^#{version} README.md}).to match /#{version}\|\d+\.\d+\.\d+/ end + + it '.README.erb should generated README.md' do + template = File.read('.README.erb') + readme = File.read('README.md') + renderer = ERB.new(template, nil, '-') + expect(readme).to eq renderer.result() + end end
Add test for README generation A test added to ensure that the README has been synced from the ERB template.
diff --git a/spec/support/i18n.rb b/spec/support/i18n.rb index abc1234..def5678 100644 --- a/spec/support/i18n.rb +++ b/spec/support/i18n.rb @@ -0,0 +1,16 @@+RSpec.configure do |config| + # Check that the factories are all valid. + config.before(:suite) do + # The Stubbed I18n backend will return the translation key, while having the same behaviour + # as the standard backend. This allows tests to be written without assuming the translation. + class StubbedI18nBackend < I18n::Backend::Simple + protected + + def lookup(_, key, _, _) + super + key.to_s + end + end + I18n.backend = StubbedI18nBackend.new + end +end
Implement a stub for the I18n translation function to return the keys given instead of translating when running specs.
diff --git a/rightscale-cli.gemspec b/rightscale-cli.gemspec index abc1234..def5678 100644 --- a/rightscale-cli.gemspec +++ b/rightscale-cli.gemspec @@ -11,10 +11,10 @@ s.bindir = 'bin' s.executables = Dir.entries(s.bindir) - [".", "..", '.gitignore'] s.homepage = 'https://github.com/flaccid/rightscale-cli' - s.add_dependency 'activesupport' - s.add_dependency "json", ">= 1.4.4" - s.add_dependency 'right_api_client' - s.add_dependency 'octokit' - s.add_dependency 'thor' - s.add_dependency 'nokogiri' + s.add_runtime_dependency 'activesupport' '~> 4.0', '~> 0' + s.add_runtime_dependency 'json', '>= 1.4.4', '~> 0' + s.add_runtime_dependency 'right_api_client' '~> 1.5', '~> 0' + s.add_runtime_dependency 'octokit' '~> 2.7', '~> 0' + s.add_runtime_dependency 'thor' '~> 0.18', '~> 0' + s.add_runtime_dependency 'nokogiri' '~> 1.6', '~> 0' end
Use add_runtime_dependency in gemspce and use more specific versions for deps.
diff --git a/jorm.gemspec b/jorm.gemspec index abc1234..def5678 100644 --- a/jorm.gemspec +++ b/jorm.gemspec @@ -19,11 +19,8 @@ lib/jorm.rb lib/jorm/folder.rb lib/jorm/version.rb - test/mt_helper.rb - test/test_jorm.rb } spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_runtime_dependency "main", "~> 5.2"
Remove test files from gemspec
diff --git a/yelp.gemspec b/yelp.gemspec index abc1234..def5678 100644 --- a/yelp.gemspec +++ b/yelp.gemspec @@ -21,4 +21,5 @@ spec.add_development_dependency "bundler", "~> 1.5" spec.add_development_dependency "rake" spec.add_development_dependency "rspec", "~> 2.6" + spec.add_development_dependency "pry" end
Add pry as a development dependency for debugging
diff --git a/config/schedule.rb b/config/schedule.rb index abc1234..def5678 100644 --- a/config/schedule.rb +++ b/config/schedule.rb @@ -22,6 +22,5 @@ set :output, "log/whenever.log" every :hour do - rake "om:fetch", path: "/home/openmensa/application/current/" - rake "om:fetch", path: "/home/openmensa/develop/current/" + rake "om:fetch" end
Use whenever defer for multistage on same server instead of double tasks
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 @@ -1,3 +1,14 @@ #!/usr/bin/env ruby -p "My project name is: #{ARGV.inspect}" +project_name = ARGV.first + +case project_name +when "racing_on_rails" + # Nothing else to get +when "atra" + exec("svn co svn+ssh://butlerpress.com/var/repos/atra/trunk local") +else + raise "Don't know how to build project named: '#{project_name}'" +end + +exec("rake cruise")
Add ATRA in as a test
diff --git a/appium_tests/search_poem_spec.rb b/appium_tests/search_poem_spec.rb index abc1234..def5678 100644 --- a/appium_tests/search_poem_spec.rb +++ b/appium_tests/search_poem_spec.rb @@ -24,5 +24,13 @@ keyboard = find_element(:class_name, 'XCUIElementTypeKeyboard') keyboard.find_element(:name, 'Search').click end + it '検索結果の歌をすべて「取り消し」にする' do + toolbar = find_element(:class_name, 'XCUIElementTypeToolbar') + toolbar.find_element(:name, '全て取消').click + end + it '元の画面に戻ると、選ばれている歌の数が88酒になっている' do + click_back_button + can_see '88首' + end end end
Add appium test to check result of selection on PoemPicker search result
diff --git a/ext/wikitext/extconf.rb b/ext/wikitext/extconf.rb index abc1234..def5678 100644 --- a/ext/wikitext/extconf.rb +++ b/ext/wikitext/extconf.rb @@ -28,7 +28,7 @@ exit 1 end -if RUBY_VERSION !~ /\A2\.[012]\./ +if RUBY_VERSION !~ /\A2\.[0123](\.|$)/ raise "unsupported Ruby version: #{RUBY_VERSION}" end
Mark Ruby 2.3.0 as supported Fixes: https://github.com/wincent/wikitext/issues/3
diff --git a/Casks/fuze.rb b/Casks/fuze.rb index abc1234..def5678 100644 --- a/Casks/fuze.rb +++ b/Casks/fuze.rb @@ -0,0 +1,7 @@+class Fuze < Cask + url 'https://www.fuzemeeting.com/extensions/FuzeMeetingMac.dmg' + homepage 'https://www.fuzemeeting.com' + version 'latest' + no_checksum + link 'Fuze.app' +end
Add Fuze.app (online meetings)/latest version
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -11,6 +11,7 @@ u.name = "testpoint" u.password = u.password_confirmation = "testpoint" u.superadmin = true + u.skip_confirmation! end if Project.none?
Update seed, can login with seeding account
diff --git a/lib/chef_fs/file_system/base_fs_object.rb b/lib/chef_fs/file_system/base_fs_object.rb index abc1234..def5678 100644 --- a/lib/chef_fs/file_system/base_fs_object.rb +++ b/lib/chef_fs/file_system/base_fs_object.rb @@ -5,8 +5,8 @@ class BaseFSObject def initialize(name, parent) @parent = parent + @name = name if parent - @name = name @path = ChefFS::PathUtils::join(parent.path, name) else if name != ''
Fix path_for_printing on BaseFSObject root objects
diff --git a/test/vcr_setup.rb b/test/vcr_setup.rb index abc1234..def5678 100644 --- a/test/vcr_setup.rb +++ b/test/vcr_setup.rb @@ -1,7 +1,7 @@ require 'vcr' VCR.configure do |c| - c.cassette_library_dir = 'cassettes' + c.cassette_library_dir = 'test/cassettes' c.hook_into :typhoeus c.filter_sensitive_data('<API_KEY>') { ENV['RETAILIGENCE_API_KEY'] || 'retailigence_api_key' } end
Change cassette directory to test/cassettes
diff --git a/app/models/domain.rb b/app/models/domain.rb index abc1234..def5678 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -20,7 +20,7 @@ title_tag = header.at("title") if header title = title_tag.inner_text.strip if title_tag {meta: meta, title: title} - rescue RestClient::InternalServerError, RestClient::BadRequest, RestClient::ResourceNotFound, RestClient::Forbidden, RestClient::BadGateway, Errno::ECONNREFUSED, Errno::EINVAL + rescue RestClient::InternalServerError, RestClient::BadRequest, RestClient::ResourceNotFound, RestClient::Forbidden, RestClient::RequestTimeout, RestClient::BadGateway, Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::EINVAL {meta: nil, title: nil} end end
Handle a few more error cases
diff --git a/config/initializers/08-rack-cors.rb b/config/initializers/08-rack-cors.rb index abc1234..def5678 100644 --- a/config/initializers/08-rack-cors.rb +++ b/config/initializers/08-rack-cors.rb @@ -3,7 +3,7 @@ Rails.configuration.middleware.use Rack::Cors do allow do - origins GlobalSetting.cors_origin + origins GlobalSetting.cors_origin.split(',').map(&:strip) resource '*', headers: :any, methods: [:get, :post, :options] end end
Make it possible to add multiple CORS origins in discourse.conf and docker yml files
diff --git a/app/models/person.rb b/app/models/person.rb index abc1234..def5678 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -40,7 +40,7 @@ # Returns the initial(s) for this person (used in avatars) def initials - if first_name && last_name + if first_name.present? && last_name.present? first_name[0] + last_name[0] else email[0]
Check names to make sure they're not blank
diff --git a/app/models/report.rb b/app/models/report.rb index abc1234..def5678 100644 --- a/app/models/report.rb +++ b/app/models/report.rb @@ -23,9 +23,11 @@ view_for(user).read_at end - protected + class << self + protected - def self.view_for(user) - ReportView.where(user_id: user.id).first_or_initialize + def view_for(user) + ReportView.where(user_id: user.id).first_or_initialize + end end end
Make method private Fix Lint/IneffectiveAccessModifier
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -6,7 +6,7 @@ def create user = User.find_by(username: params[:username]) - unless user + if user != nil @user = User.create(user_params) session[:user_id] = @user.id redirect_to root_path
Fix validation for signing up
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -0,0 +1,57 @@+# Index action +get '/users' do + @users = User.all + erb :'users/index' +end + +# Show action +get '/users/:id' do + @user = User.find(params[:id]) + erb :'users/show' +end + +# Edit action +get '/users/:id/edit' do + @user = User.find(params[:id]) + erb :'users/edit' +end + +# Update action +put '/users/:id' do + @user = User.find(params[:id]) + + @user.assign_attributes(params[:user]) + + if @user.save + redirect '/users' + else + erb :'users/edit?errors=Oops! The user was not updated.' + end +end + +# New action +get '/users/new' do + erb :'users/new' +end + +# Create action +post '/users' do + @user = User.new(params[:user]) + + if @user.save + redirect '/users' + else + redirect '/users/new?error=Oops! The user was not created.' + end +end + +# Destroy action +delete 'users/:id' do + @user = User.find(params[:id]) + + if @user.destroy + redirect '/users' + else + redirect '/users?errors=User was not destroyed.' + end +end
Add crud routes for users
diff --git a/app/helpers/access_levels_helper.rb b/app/helpers/access_levels_helper.rb index abc1234..def5678 100644 --- a/app/helpers/access_levels_helper.rb +++ b/app/helpers/access_levels_helper.rb @@ -8,7 +8,7 @@ end end - def translate(permit) + def translate(permit, options = {}) translations = { enrolled: 'FK-members' }
Add option hash to translate
diff --git a/lib/metacrunch/mab2/document/datafield.rb b/lib/metacrunch/mab2/document/datafield.rb index abc1234..def5678 100644 --- a/lib/metacrunch/mab2/document/datafield.rb +++ b/lib/metacrunch/mab2/document/datafield.rb @@ -6,7 +6,7 @@ attr_accessor :tag attr_accessor :ind1, :ind2 - def initialize(tag = nil, ind1:nil, ind2:nil) + def initialize(tag, ind1:nil, ind2:nil) @tag = tag @ind1 = ind1 @ind2 = ind2
Tag must not be nil.
diff --git a/app/controllers/concerns/response_support.rb b/app/controllers/concerns/response_support.rb index abc1234..def5678 100644 --- a/app/controllers/concerns/response_support.rb +++ b/app/controllers/concerns/response_support.rb @@ -22,7 +22,7 @@ new_uri = URI.parse(url) new_form_params = URI.decode_www_form(new_uri.query) new_form_params << ['at', ENV['ITUNES_AFFILIATE_TOKEN']] - new_form_params << ['app', 'iTunes'] + new_form_params << %w(app iTunes) new_form_params << ['ct', request.host] new_uri.query = URI.encode_www_form(new_form_params) response[attr] = new_uri.to_s
Use `%w` or `%W` for an array of words
diff --git a/lib/stepping_stone/text_mapper/pattern.rb b/lib/stepping_stone/text_mapper/pattern.rb index abc1234..def5678 100644 --- a/lib/stepping_stone/text_mapper/pattern.rb +++ b/lib/stepping_stone/text_mapper/pattern.rb @@ -1,55 +1,57 @@ module SteppingStone - class Pattern - def self.[](*parts) - new(parts) - end + module TextMapper + class Pattern + def self.[](*parts) + new(parts) + end - attr_reader :parts + attr_reader :parts - def initialize(parts) - @parts = parts - end + def initialize(parts) + @parts = parts + end - def match(targets) - self.===(targets) - end + def match(targets) + self.===(targets) + end - def ===(targets) - return false unless Array === targets - compare(parts, targets) - end + def ===(targets) + return false unless Array === targets + compare(parts, targets) + end - def captures_from(targets) - result, bindings = captures_helper(parts, targets) - return bindings if result - end + def captures_from(targets) + result, bindings = captures_helper(parts, targets) + return bindings if result + end - def captures_helper(parts, targets, last_result=nil, captures=[]) - return [last_result, captures] unless part = parts[0] and target = targets[0] + def captures_helper(parts, targets, last_result=nil, captures=[]) + return [last_result, captures] unless part = parts[0] and target = targets[0] - current_result = (part === target) - if current_result - case part - when Class - captures.push(target) - when Regexp - captures.push(*part.match(target).captures) + current_result = (part === target) + if current_result + case part + when Class + captures.push(target) + when Regexp + captures.push(*part.match(target).captures) + end + captures_helper(parts[1..-1], targets[1..-1], current_result, captures) end - captures_helper(parts[1..-1], targets[1..-1], current_result, captures) end - end - def to_s - "#{self.class}: '#{parts}'" - end + def to_s + "#{self.class}: '#{parts}'" + end - private + private - def compare(parts, targets, last_result=nil) - return last_result unless part = parts[0] and target = targets[0] - current_result = (part === target) - return false unless current_result - compare(parts[1..-1], targets[1..-1], current_result) + def compare(parts, targets, last_result=nil) + return last_result unless part = parts[0] and target = targets[0] + current_result = (part === target) + return false unless current_result + compare(parts[1..-1], targets[1..-1], current_result) + end end end end
Move Pattern into TextMapper module
diff --git a/app/models/spree/inventory_unit_decorator.rb b/app/models/spree/inventory_unit_decorator.rb index abc1234..def5678 100644 --- a/app/models/spree/inventory_unit_decorator.rb +++ b/app/models/spree/inventory_unit_decorator.rb @@ -1,7 +1,5 @@ module Spree module InventoryUnitDecorator - # delegate :pos_variant_id, to: :variant - def count_on_hand_for(stock_location) stock_items.find_by(stock_location_id: stock_location.id).count_on_hand end
Remove pos_variant_id delegate for inventory unit I had an idea that ended up nowhere, this is now legacy code that can be safely removed.
diff --git a/lib/ginst.rb b/lib/ginst.rb index abc1234..def5678 100644 --- a/lib/ginst.rb +++ b/lib/ginst.rb @@ -31,6 +31,7 @@ @@root end + VERSION = File.read(root+'/VERSION') end # Add vendorized gems to load path
Add Ginst::VERSION to the module
diff --git a/assets/lib/out.rb b/assets/lib/out.rb index abc1234..def5678 100644 --- a/assets/lib/out.rb +++ b/assets/lib/out.rb @@ -30,7 +30,7 @@ Status.new( state: input['params']['status'], - atc_url: input['params']['base_url'], + atc_url: input['source']['base_url'], sha: sha, repo: repo ).create!
Fix passing base_url from source
diff --git a/cookbooks/libffi/recipes/default.rb b/cookbooks/libffi/recipes/default.rb index abc1234..def5678 100644 --- a/cookbooks/libffi/recipes/default.rb +++ b/cookbooks/libffi/recipes/default.rb @@ -1,3 +1,11 @@+# Compile libffi util_autotools "libffi" do file "libffi-3.0.10.tar.gz" end + +# Move libffi headers. libffi installs its headers in a +# really strange place, so we move them into the standard +# location. +execute "libffi-headers-move" do + command "mv #{embedded_dir}/lib/libffi-*/include/* #{embedded_dir}/include" +end
libffi: Move headers to a standard location
diff --git a/MKLog.podspec b/MKLog.podspec index abc1234..def5678 100644 --- a/MKLog.podspec +++ b/MKLog.podspec @@ -21,6 +21,7 @@ s.platform = :ios, '7.0' s.requires_arc = true + s.watchos.deployment_target = '2.0' s.source_files = 'Pod/Classes/**/*' s.resource_bundles = {
Add watchOS as a deployment target
diff --git a/arm-none-eabi-gcc.rb b/arm-none-eabi-gcc.rb index abc1234..def5678 100644 --- a/arm-none-eabi-gcc.rb +++ b/arm-none-eabi-gcc.rb @@ -3,10 +3,10 @@ class ArmNoneEabiGcc < Formula homepage 'https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads' - version '7-2018-q2-update' + version '8-2018-q4-major' - url 'https://developer.arm.com/-/media/Files/downloads/gnu-rm/7-2018q2/gcc-arm-none-eabi-7-2018-q2-update-mac.tar.bz2' - sha256 'c1c4af5226d52bd1b688cf1bd78f60eeea53b19fb337ef1df4380d752ba88759' + url 'https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/8-2018q4/gcc-arm-none-eabi-8-2018-q4-major-mac.tar.bz2' + sha256 '0b528ed24db9f0fa39e5efdae9bcfc56bf9e07555cb267c70ff3fee84ec98460' def install (prefix/"gcc").install Dir["./*"]
Update ARM gcc to `8-2018-q4-major`
diff --git a/spec/concurrency_spec.rb b/spec/concurrency_spec.rb index abc1234..def5678 100644 --- a/spec/concurrency_spec.rb +++ b/spec/concurrency_spec.rb @@ -0,0 +1,77 @@+require "spec_helper" + +describe "gemstash concurrency tests" do + TIMEOUT = 2 + + def write_thread(resource_id) + env = Gemstash::Env.current + + Thread.new do + Thread.current[:name] = "write-thread-for-#{resource_id}" + Gemstash::Env.current = env + storage = Gemstash::Storage.for("concurrent_test") + resource = storage.resource(resource_id.to_s) + resource.save({ file: "Example content" }, example: true) + end + end + + def read_thread(resource_id) + env = Gemstash::Env.current + + Thread.new do + Thread.current[:name] = "read-thread-for-#{resource_id}" + Gemstash::Env.current = env + storage = Gemstash::Storage.for("concurrent_test") + resource = storage.resource(resource_id.to_s) + + if resource.exist?(:file) + raise "Property mismatch" unless resource.properties[:example] + raise "Content mismatch" unless resource.content(:file) == "Example content" + end + end + end + + def check_for_errors_and_deadlocks(threads) + threads = [threads] unless threads.is_a?(Array) + error = nil + + threads.each do |thread| + begin + # Join raises an error if the thread raised an error + result = thread.join(TIMEOUT) + raise "Thread #{thread[:name]} did not die in #{TIMEOUT} seconds, possible deadlock!" unless result + rescue => e + error = e unless error + end + end + + raise error if error + end + + describe "storage" do + it "works with serial code" do + check_for_errors_and_deadlocks(write_thread(1)) + check_for_errors_and_deadlocks(read_thread(1)) + check_for_errors_and_deadlocks(read_thread(2)) + check_for_errors_and_deadlocks(write_thread(2)) + end + + it "works with concurrent reads and writes" do + threads = [] + + 1.upto(25) do |i| + 10.times do + if rand(2) == 0 + threads << write_thread(i) + threads << read_thread(i) + else + threads << read_thread(i) + threads << write_thread(i) + end + end + end + + check_for_errors_and_deadlocks(threads) + end + end +end
Add concurrency spec that currently fails
diff --git a/spec/imdb/series_spec.rb b/spec/imdb/series_spec.rb index abc1234..def5678 100644 --- a/spec/imdb/series_spec.rb +++ b/spec/imdb/series_spec.rb @@ -11,7 +11,7 @@ end it "reports the number of seasons" do - @serie.seasons.size.should eql(4) + @serie.seasons.size.should eql(5) end it "can fetch a specific season" do
Update number of Walking Dead seasons.
diff --git a/lib/chef_zero/endpoints/cookbooks_endpoint.rb b/lib/chef_zero/endpoints/cookbooks_endpoint.rb index abc1234..def5678 100644 --- a/lib/chef_zero/endpoints/cookbooks_endpoint.rb +++ b/lib/chef_zero/endpoints/cookbooks_endpoint.rb @@ -5,7 +5,14 @@ # /cookbooks class CookbooksEndpoint < CookbooksBase def get(request) - json_response(200, format_cookbooks_list(request, all_cookbooks_list)) + if request.query_params['num_versions'] == 'all' + num_versions = nil + elsif request.query_params['num_versions'] + num_versions = request.query_params['num_versions'].to_i + else + num_versions = 1 + end + json_response(200, format_cookbooks_list(request, all_cookbooks_list, {}, num_versions)) end end end
Support cookbook_versions query param in /cookbooks
diff --git a/lib/livesplit_parser.rb b/lib/livesplit_parser.rb index abc1234..def5678 100644 --- a/lib/livesplit_parser.rb +++ b/lib/livesplit_parser.rb @@ -16,8 +16,8 @@ splits['Run']['Segments'].first.second.each do |segment| split = OpenStruct.new split.title = segment['Name'] - split.best_time = duration_in_seconds_of segment['PersonalBestSplitTime'] - split.run_time = duration_in_seconds_of segment['BestSegmentTime'] + split.run_time = duration_in_seconds_of segment['PersonalBestSplitTime'] + split.best_time = duration_in_seconds_of segment['BestSegmentTime'] split.parent = run run_time += split.best_time run.splits << split
Fix LiveSplit files having incorrect durations
diff --git a/spec/lib/hash_id_spec.rb b/spec/lib/hash_id_spec.rb index abc1234..def5678 100644 --- a/spec/lib/hash_id_spec.rb +++ b/spec/lib/hash_id_spec.rb @@ -0,0 +1,13 @@+require "spec_helper" + +describe HashId do + it ".hash" do + HashId.hash(15).should == "bd0dce790c91139b20bf406a0357359c65b88e3c" + end + + describe ".valid?" do + it { HashId.valid?(15, "bd0dce790c91139b20bf406a0357359c65b88e3c").should be_true } + it { HashId.valid?(15, "this hash is wrong").should be_false } + it { HashId.valid?(14, "bd0dce790c91139b20bf406a0357359c65b88e3c").should be_false } + end +end
Add unit test for HashId
diff --git a/lib/milkshake/loader.rb b/lib/milkshake/loader.rb index abc1234..def5678 100644 --- a/lib/milkshake/loader.rb +++ b/lib/milkshake/loader.rb @@ -24,6 +24,7 @@ self.environment.gemspecs.each do |gemspec| paths.concat Dir.glob(File.join(gemspec.full_gem_path, *relative_path)) end + paths.concat Dir.glob(File.join(Rails.root, 'rails/init.rb')) paths.concat Dir.glob(File.join(Rails.root, *relative_path)) paths end
Load the local rail/init.rb file
diff --git a/rasn1.gemspec b/rasn1.gemspec index abc1234..def5678 100644 --- a/rasn1.gemspec +++ b/rasn1.gemspec @@ -20,6 +20,8 @@ #spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ['lib'] + spec.required_ruby_version = '>= 2.1.0' + spec.add_dependency 'yard', '~>0.9' spec.add_development_dependency 'bundler', '~> 1.13'
Set minimal version of ruby to 2.1.0
diff --git a/geode-book/redirects.rb b/geode-book/redirects.rb index abc1234..def5678 100644 --- a/geode-book/redirects.rb +++ b/geode-book/redirects.rb @@ -14,5 +14,5 @@ #permissions and limitations under the License. r301 %r{/releases/latest/javadoc/(.*)}, 'http://geode.apache.org/releases/latest/javadoc/$1' -rewrite '/', '/docs/guide/110/about_geode.html' -rewrite '/index.html', '/docs/guide/110/about_geode.html' +rewrite '/', '/docs/guide/19/about_geode.html' +rewrite '/index.html', '/docs/guide/19/about_geode.html'
Fix geoge-book redirect url for 1.9.0
diff --git a/lib/rakismet/railtie.rb b/lib/rakismet/railtie.rb index abc1234..def5678 100644 --- a/lib/rakismet/railtie.rb +++ b/lib/rakismet/railtie.rb @@ -5,7 +5,7 @@ class Railtie < Rails::Railtie config.rakismet = ActiveSupport::OrderedOptions.new config.rakismet.host = 'rest.akismet.com' - initializer 'rakismet.get_config' do |app| + initializer 'rakismet.get_config', :after => :load_config_initializers do |app| Rakismet.key = app.config.rakismet.key Rakismet.url = app.config.rakismet.url Rakismet.host = app.config.rakismet.host
Make sure the initializers are loaded before retrieving key
diff --git a/lib/ravelin/customer.rb b/lib/ravelin/customer.rb index abc1234..def5678 100644 --- a/lib/ravelin/customer.rb +++ b/lib/ravelin/customer.rb @@ -15,6 +15,7 @@ :telephone_country, :location, :country, + :market, :custom attr_required :customer_id
Add market field to Customer object
diff --git a/lib/rubinius/toolset.rb b/lib/rubinius/toolset.rb index abc1234..def5678 100644 --- a/lib/rubinius/toolset.rb +++ b/lib/rubinius/toolset.rb @@ -2,18 +2,22 @@ module Rubinius module ToolSet + # Access the current toolset module def self.current @current ||= Module.new end + # Start a new toolset module by clearing out the current one def self.start @current = nil end + # Access the Hash containing the finished toolset modules def self.map @map ||= {} end + # Finish the current toolset module by registering it with a name def self.finish(name) ts = current::TS ts.const_set :ToolSet, ts @@ -21,6 +25,7 @@ const_set name.to_s.capitalize.to_sym, ts end + # Get a finished toolset module by name def self.get(name) map[name] end
Add some minimal documentation for Rubinius::ToolSet methods
diff --git a/lib/sensu-plugin/cli.rb b/lib/sensu-plugin/cli.rb index abc1234..def5678 100644 --- a/lib/sensu-plugin/cli.rb +++ b/lib/sensu-plugin/cli.rb @@ -8,9 +8,9 @@ attr_accessor :argv - def initialize - super - self.argv = self.parse_options + def initialize(argv=ARGV) + super() + self.argv = self.parse_options(argv) end # Implementing classes should override this to produce appropriate
Allow ARGV to be injected for improved testability
diff --git a/lib/transam_accounting/transam_accountable.rb b/lib/transam_accounting/transam_accountable.rb index abc1234..def5678 100644 --- a/lib/transam_accounting/transam_accountable.rb +++ b/lib/transam_accounting/transam_accountable.rb @@ -21,7 +21,7 @@ has_many :grants # Each org can have 0 or more expenditures - has_many :expeditures + has_many :expenditures # Each org can have 0 or more expense types has_many :expense_types
Fix bug in accounting plugin
diff --git a/View_class.rb b/View_class.rb index abc1234..def5678 100644 --- a/View_class.rb +++ b/View_class.rb @@ -23,7 +23,7 @@ end def display_listing(filtered_listings) - filtered_listings[0..4].each do |listing_object| + filtered_listings.each do |listing_object| print "#{listing_object.name} \n" print "#{listing_object.description} \n \n" end
Remove filter so it displays all organizations
diff --git a/lib/electric_sheep/interactors/shell_interactor.rb b/lib/electric_sheep/interactors/shell_interactor.rb index abc1234..def5678 100644 --- a/lib/electric_sheep/interactors/shell_interactor.rb +++ b/lib/electric_sheep/interactors/shell_interactor.rb @@ -7,17 +7,17 @@ def exec(cmd) @logger.debug cmd if @logger after_exec do - {out: '', err: ''}.tap{ |result| - @child = POSIX::Spawn::Child.new(cmd) - unless @child.out.nil? - result[:out] = @child.out.chomp - @logger.debug result[:out] if @logger - end - unless @child.err.nil? - result[:err] = @child.err.chomp - end - - }.merge({exit_status: @child.status}) + result = {out: '', err: ''} + child = POSIX::Spawn::Child.new(cmd) + unless child.out.nil? + result[:out] = child.out.chomp + @logger.debug result[:out] if @logger + end + unless child.err.nil? + result[:err] = child.err.chomp + end + result[:exit_status]=child.status + result end end
Make command execution more readable and avoid instance variable assignment
diff --git a/test/controllers/policy_controller_test.rb b/test/controllers/policy_controller_test.rb index abc1234..def5678 100644 --- a/test/controllers/policy_controller_test.rb +++ b/test/controllers/policy_controller_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class PolicyControllerTest < ActionDispatch::IntegrationTest +class PolicyControllerTest < IntegrationTestCase test "should get privacy" do get policy_privacy_url assert_response :success
Use modified base class for test - Fixes a test Failure. The failure occurs because the `browser` bot thinks the `get` request is coming from a bot. That problem is fixed in our IntegrationTestCase class.
diff --git a/config/initializers/pg_search.rb b/config/initializers/pg_search.rb index abc1234..def5678 100644 --- a/config/initializers/pg_search.rb +++ b/config/initializers/pg_search.rb @@ -2,5 +2,11 @@ # Configure PgSearch multi-search options # PgSearch.multisearch_options = { - using: [:tsearch, :trigram] + using: { + tsearch: { + prefix: true, + any_word: true + }, + trigram: true + } }
Customize tsearch and trigram methods
diff --git a/spec/omniauth/identity/models/mongoid_spec.rb b/spec/omniauth/identity/models/mongoid_spec.rb index abc1234..def5678 100644 --- a/spec/omniauth/identity/models/mongoid_spec.rb +++ b/spec/omniauth/identity/models/mongoid_spec.rb @@ -10,7 +10,7 @@ MongoidTestIdentity.locate('ham_sandwich' => 'open faced', 'category' => 'sandwiches').should == 'wakka' end - it 'should not use STI rules for its collection name' do - MongoidTestIdentity.collection.name.should == 'mongoid_test_identities' - end + # it 'should not use STI rules for its collection name' do + # MongoidTestIdentity.collection.name.should == 'mongoid_test_identities' + # end end
Comment broken spec in order to transpec
diff --git a/lib/david/transmission.rb b/lib/david/transmission.rb index abc1234..def5678 100644 --- a/lib/david/transmission.rb +++ b/lib/david/transmission.rb @@ -31,12 +31,17 @@ end def normalize_host(host) - ip = IPAddr.new(Resolv.getaddress(host)) + ip = IPAddr.new(host) if ipv6? && ip.ipv4? ip = ip.ipv4_mapped end - rescue Resolv::ResolvError + rescue ArgumentError + begin + host = Resolv.getaddress(host) + retry + rescue Resolv::ResolvError + end else ip.to_s end
Resolve on send only if no IP address.
diff --git a/lib/engineyard/version.rb b/lib/engineyard/version.rb index abc1234..def5678 100644 --- a/lib/engineyard/version.rb +++ b/lib/engineyard/version.rb @@ -1,4 +1,4 @@ module EY - VERSION = '2.1.0' + VERSION = '2.1.1.pre' ENGINEYARD_SERVERSIDE_VERSION = ENV['ENGINEYARD_SERVERSIDE_VERSION'] || '2.1.0' end
Add .pre for next release
diff --git a/lib/eukaliptus/request.rb b/lib/eukaliptus/request.rb index abc1234..def5678 100644 --- a/lib/eukaliptus/request.rb +++ b/lib/eukaliptus/request.rb @@ -4,7 +4,7 @@ class Request < ::Rack::Request def params rack_input = env["rack.input"].read - Rack::Utils.parse_query(rack_input, "&") + @params ||= Rack::Utils.parse_query(rack_input, "&") end def facebook?
Save params to instance var as rack.input read only read once
diff --git a/lib/hasoffersv3/report.rb b/lib/hasoffersv3/report.rb index abc1234..def5678 100644 --- a/lib/hasoffersv3/report.rb +++ b/lib/hasoffersv3/report.rb @@ -4,7 +4,9 @@ class << self def getConversions(params = {}, &block) - get_request(Target, 'getConversions', params, &block) + # TODO: This *should* be a GET request, however, if we use that here we get: "The requested URL's length exceeds the capacity limit for this server." + # because the number of affiliate_ids we pass in is too high. + post_request(Target, 'getConversions', params, &block) end def getModSummaryLogs(params = {}, &block)
Use a POST request for "getConversions" because a GET request fails since we pass in too many affiliate_ids.
diff --git a/lib/paper_trail/config.rb b/lib/paper_trail/config.rb index abc1234..def5678 100644 --- a/lib/paper_trail/config.rb +++ b/lib/paper_trail/config.rb @@ -34,5 +34,25 @@ def enabled=(enable) @mutex.synchronize { @enabled = enable } end + + def track_associations=(_) + raise AssociationTrackingRemovedError + end + + def track_associations? + raise AssociationTrackingRemovedError + end + + # Error for PT v10.x for when association tracking is attempted to be + # used without the paper_trail-association_tracking gem present + class AssociationTrackingRemovedError < RuntimeError + MESSAGE_FMT = "Association Tracking for PaperTrail has been extracted "\ + "to a seperate gem. Please add "\ + "`paper_trail-association_tracking` to your Gemfile." + + def message + format(MESSAGE_FMT) + end + end end end
Add association tracking removal exception
diff --git a/app/controllers/user_registrations_controller.rb b/app/controllers/user_registrations_controller.rb index abc1234..def5678 100644 --- a/app/controllers/user_registrations_controller.rb +++ b/app/controllers/user_registrations_controller.rb @@ -33,6 +33,8 @@ private def spree_user_params + return params[:spree_user] if params[:spree_user].empty? + params.require(:spree_user). permit(:email, :password, :password_confirmation, :remember_me) end
Fix case with empty spree_user in user_registrations controller
diff --git a/app/models/manager_refresh/refresh_parser_dto.rb b/app/models/manager_refresh/refresh_parser_dto.rb index abc1234..def5678 100644 --- a/app/models/manager_refresh/refresh_parser_dto.rb +++ b/app/models/manager_refresh/refresh_parser_dto.rb @@ -0,0 +1,40 @@+module ManagerRefresh + class RefreshParserDto + def initialize(ems, options = nil) + @ems = ems + @options = options || {} + @data = {:_dto_collection => true} + end + + def process_dto_collection(collection, key) + collection.each do |item| + _uid, new_result = yield(item) + next if new_result.blank? + + dto = @data[key].new_dto(new_result) + @data[key] << dto + end + end + + def add_dto_collection(model_class, association, manager_ref = nil) + @data[association] = ::ManagerRefresh::DtoCollection.new(model_class, + :parent => @ems, + :association => association, + :manager_ref => manager_ref) + end + + def add_cloud_manager_db_cached_dto(model_class, association, manager_ref = nil) + @data[association] = ::ManagerRefresh::DtoCollection.new(model_class, + :parent => @ems.parent_manager, + :association => association, + :manager_ref => manager_ref, + :strategy => :local_db_cache_all) + end + + class << self + def ems_inv_to_hashes(ems, options = nil) + new(ems, options).ems_inv_to_hashes + end + end + end +end
Add a base class for DTO based parsers Add a base class for DTO based parsers
diff --git a/lib/transaction_logger.rb b/lib/transaction_logger.rb index abc1234..def5678 100644 --- a/lib/transaction_logger.rb +++ b/lib/transaction_logger.rb @@ -12,10 +12,22 @@ info 'Response received', params end + def info(str, params=nil) + Yp.logger.info(format(str, params)) + end + + def error(str) + Yp.logger.error(format_message(str)) + end + + def fatal(str) + Yp.logger.fatal(format_message(str)) + end + private - def info(str, params=nil) - Yp.logger.info("#{format_message(str)} #{format_params(params)}") + def format(str, params) + "#{format_message(str)} #{format_params(params)}" end def format_message(str) @@ -23,7 +35,7 @@ end def format_params(params) - " with params #{filter_card_params(params).to_s}" + " with params #{filter_card_params(params).to_s}" unless params.nil? end def filter_card_params(hash)
Add pubic methods to transaction logger
diff --git a/lib/watir/rspec/helper.rb b/lib/watir/rspec/helper.rb index abc1234..def5678 100644 --- a/lib/watir/rspec/helper.rb +++ b/lib/watir/rspec/helper.rb @@ -3,11 +3,15 @@ module Helper extend Forwardable + def browser + @browser || $browser + end + def method_missing name, *args #:nodoc: - if @browser.respond_to?(name) + if browser.respond_to?(name) Helper.module_eval %Q[ def #{name}(*args) - @browser.send(:#{name}, *args) {yield} + browser.send(:#{name}, *args) {yield} end ] self.send(name, *args) {yield} @@ -19,7 +23,7 @@ # make sure that using method 'p' will be invoked on browser # and not Kernel # use Kernel.p if you need to dump some variable - def_delegators :@browser, :p + def_delegators :browser, :p end end end
Add browser method and support for using $browser variable too when needed for RSpec.before/after :suite.
diff --git a/lib/webhookr-mailchimp.rb b/lib/webhookr-mailchimp.rb index abc1234..def5678 100644 --- a/lib/webhookr-mailchimp.rb +++ b/lib/webhookr-mailchimp.rb @@ -25,7 +25,8 @@ def parse(raw_response) RecursiveOpenStruct.new( - assert_valid_packet(Rack::Utils.parse_nested_query(raw_response)) + assert_valid_packet(Rack::Utils.parse_nested_query(raw_response)), + :recurse_over_arrays => true ) end
Enable recursing over arrays for the response
diff --git a/library/etc/group_spec.rb b/library/etc/group_spec.rb index abc1234..def5678 100644 --- a/library/etc/group_spec.rb +++ b/library/etc/group_spec.rb @@ -4,4 +4,14 @@ describe "Etc.group" do it_behaves_like(:etc_on_windows, :group) + + it "raises a RuntimeError for parallel iteration" do + proc { + Etc.group do | group | + Etc.group do | group2 | + end + end + }.should raise_error(RuntimeError) + end + end
Add spec for parallel group iteration Spec is shamelessly taken from #1149 by @cwgem. This way it's ensured it is run and don't have to wait for a Rubyspec pull request.
diff --git a/core/app/helpers/refinery/site_bar_helper.rb b/core/app/helpers/refinery/site_bar_helper.rb index abc1234..def5678 100644 --- a/core/app/helpers/refinery/site_bar_helper.rb +++ b/core/app/helpers/refinery/site_bar_helper.rb @@ -4,9 +4,10 @@ # Generates the link to determine where the site bar switch button returns to. def site_bar_switch_link link_to_if(admin?, t('.switch_to_your_website', site_bar_translate_locale_args), - refinery.root_path(site_bar_translate_locale_args)) do + refinery.root_path(site_bar_translate_locale_args), + 'data-no-turbolink' => true) do link_to t('.switch_to_your_website_editor', site_bar_translate_locale_args), - refinery.admin_root_path + refinery.admin_root_path, 'data-no-turbolink' => true end end
Remove turbolinks from the site bar links.
diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb index abc1234..def5678 100644 --- a/spec/models/namespace_spec.rb +++ b/spec/models/namespace_spec.rb @@ -0,0 +1,36 @@+require File.expand_path('../../spec_helper', __FILE__) + +describe "A Namespace" do + before do + @namespace = Namespace.new('full_name' => 'Object') + end + + it "should know what it responds to" do + @namespace.respond_to?(:full_name).should == true + @namespace.respond_to?(:binding).should == true + @namespace.respond_to?(:respond_to?).should == true + @namespace.respond_to?(:unknown).should == false + end + + it "should respond to namespace keys" do + @namespace.full_name.should == 'Object' + end + + it "should throw an exception on unknown keys" do + lambda { + @namespace.unknown + }.should.raise(NoMethodError) + end + + it "should be able to assign new keys to the namespace" do + @namespace.respond_to?(:name).should == false + @namespace.assign('name', '…') + @namespace.respond_to?(:name).should == true + end + + it "should have a public binding" do + lambda { + @namespace.binding + }.should.not.raise + end +end
Add a spec for Namespace.
diff --git a/spec/tic_tac_toe/game_spec.rb b/spec/tic_tac_toe/game_spec.rb index abc1234..def5678 100644 --- a/spec/tic_tac_toe/game_spec.rb +++ b/spec/tic_tac_toe/game_spec.rb @@ -4,18 +4,16 @@ end describe TicTacToe::Game do + let(:display) { double(:display) } it 'can start a game' do - display = double(:display) allow(display).to receive(:printf) - game = TicTacToe::Game.new display game.start end describe 'when playing' do it 'changes the active player' do - display = double(:display) game = TicTacToe::Game.new display expect { game.do_turn }.to change { game.to_play }
Add a let for the display test variable
diff --git a/spec/features/events_features_spec.rb b/spec/features/events_features_spec.rb index abc1234..def5678 100644 --- a/spec/features/events_features_spec.rb +++ b/spec/features/events_features_spec.rb @@ -11,20 +11,33 @@ user = FactoryGirl.create(:user) user.add_role :admin sign_in_user(user) - mock_api - end - - it "should successfully connect to the api" do - VCR.use_cassette('api') do - visit '/api/setup' - # stop trying to click around here, just put it in the settings table - # and ensure the api is connected - page.should have_content("Test API") - end + visit '/events' end it "should show the events page" do + page.should have_content "Events" end + + it "should show multiple events" do + page.should have_content "standalone" + page.should have_content "tokens" + end + + it "should show the client for an event" do + page.should have_content "i-424242" + end + + it "should show the check for an event" do + page.should have_content "standalone" + end + + pending "should show the output for an event" do + page.body.should have_content "i-424242 true" + end + + pending "should show time since issued for an event" do + end + end end
Add basic feature specs for events
diff --git a/spec/requests/create_district_spec.rb b/spec/requests/create_district_spec.rb index abc1234..def5678 100644 --- a/spec/requests/create_district_spec.rb +++ b/spec/requests/create_district_spec.rb @@ -24,6 +24,16 @@ it "creates a district" do post "/v1/districts", params, auth expect(response.status).to eq 201 + + body = JSON.load(response.body) + expect(body["district"]["name"]).to eq "district" + expect(body["district"]["cidr_block"]).to match %r{10\.[0-9]+\.0.0\/16} + expect(body["district"]["stack_name"]).to eq "barcelona-district" + expect(body["district"]["s3_bucket_name"]).to match %r{barcelona-district-[0-9]+} + expect(body["district"]["nat_type"]).to eq "instance" + expect(body["district"]["cluster_size"]).to eq 1 + expect(body["district"]["cluster_backend"]).to eq "autoscaling" + expect(body["district"]["cluster_instance_type"]).to eq "t2.micro" end end end
Add spec to test create district API
diff --git a/spec/support/example_group_methods.rb b/spec/support/example_group_methods.rb index abc1234..def5678 100644 --- a/spec/support/example_group_methods.rb +++ b/spec/support/example_group_methods.rb @@ -1,7 +1,7 @@ module Spec module ExampleGroupMethods def testing_block_passing_broken? - RUBY_PLATFORM.include?('java') && JRUBY_VERSION <= '1.6.5' && RUBY_VERSION >= '1.9.2' + RUBY_PLATFORM.include?('java') && JRUBY_VERSION <= '1.7.0.dev' && RUBY_VERSION >= '1.9.2' end end end
Fix failing spec by changing the JRUBY_VERSION in the guard method
diff --git a/app/controllers/api/v1/sessions_controller.rb b/app/controllers/api/v1/sessions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/v1/sessions_controller.rb +++ b/app/controllers/api/v1/sessions_controller.rb @@ -2,6 +2,22 @@ module V1 class SessionsController < ApplicationController skip_before_action :authenticate + + def create + user = User.first #.authenticate(params[:email], params[:password]) + if user + session[:user_id] = user.id + render status: 200, json: 'OK' + else + render status: 401, json: 'Unauthorized' + end + end + + def destroy + session[:user_id] = nil + render status: 200, json: 'OK' + end + end end end
Implement session create and destroy
diff --git a/app/presenters/speedy_af/proxy/master_file.rb b/app/presenters/speedy_af/proxy/master_file.rb index abc1234..def5678 100644 --- a/app/presenters/speedy_af/proxy/master_file.rb +++ b/app/presenters/speedy_af/proxy/master_file.rb @@ -20,4 +20,11 @@ def find_encoder_class(klass_name) ActiveEncode::Base.descendants.find { |c| c.name == klass_name } end + + def display_title + mf_title = structuralMetadata.section_title if has_structuralMetadata? + mf_title ||= title if title.present? + mf_title ||= file_location.split("/").last if file_location.present? && (media_object.master_file_ids.size > 1) + mf_title.blank? ? nil : mf_title + end end
Copy display_title to proxy to avoid reifying in gather_all_comments
diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb index abc1234..def5678 100644 --- a/config/initializers/secret_token.rb +++ b/config/initializers/secret_token.rb @@ -9,4 +9,4 @@ # Make sure your secret_key_base is kept private # if you're sharing your code publicly. -Rails4ready::Application.config.secret_key_base = '2e96d0f378e6ffb2a9c61645a9f8af7519d47b4f484f26b02b30b54596e670b02c22b58528e6481fca274fb2e1d9d5b39ceac9ee334f0db2e44a5f5b489d97e4' +Rails4ready::Application.config.secret_key_base = ENV['SECRET_KEY_BASE'] || '2e96d0f378e6ffb2a9c61645a9f8af7519d47b4f484f26b02b30b54596e670b02c22b58528e6481fca274fb2e1d9d5b39ceac9ee334f0db2e44a5f5b489d97e4'
Use a non versioned secret key in production environment
diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb index abc1234..def5678 100644 --- a/config/initializers/secret_token.rb +++ b/config/initializers/secret_token.rb @@ -9,8 +9,8 @@ # Make sure your secret_key_base is kept private # if you're sharing your code publicly. -Psychlopedia::Application.config.secret_key_base = if Rails.env.development? - ('h' * 30) +Psychlopedia::Application.config.secret_key_base = if Rails.env.development? || Rails.env.test? + ('h' * 30) else ENV['SECRET_KEY_BASE'] end
Add dummy secret_key_base for testing environment.
diff --git a/lib/presenters/dataset_presenter.rb b/lib/presenters/dataset_presenter.rb index abc1234..def5678 100644 --- a/lib/presenters/dataset_presenter.rb +++ b/lib/presenters/dataset_presenter.rb @@ -9,6 +9,7 @@ "title" => @dataset.title, "slug" => @dataset.slug, "description" => @dataset.description, + "total_observations" => @dataset.observations.count, "release" => ReleasePresenter.new( @dataset.release ).present } end
Include how many observations dataset has
diff --git a/support/triggered_package.rb b/support/triggered_package.rb index abc1234..def5678 100644 --- a/support/triggered_package.rb +++ b/support/triggered_package.rb @@ -10,4 +10,4 @@ res = http.request(req) output = JSON.parse(res.body) id = output.find { |job| job['name'] == 'Trigger:package' }['id'] -puts "#{ENV['CI_PROJECT_URL']}/builds/#{id}/artifacts/file/pkg/ubuntu-xenial/gitlab.deb" +puts "#{ENV['CI_PROJECT_URL']}/builds/#{id}/artifacts/raw/pkg/ubuntu-xenial/gitlab.deb"
Fix URL to download artifact
diff --git a/OCMock.podspec b/OCMock.podspec index abc1234..def5678 100644 --- a/OCMock.podspec +++ b/OCMock.podspec @@ -23,6 +23,5 @@ "Source/OCMock/" + file } - s.framework = "XCTest" s.requires_arc = false -end+end
Remove s.framework = "XCTest" from the podspec I was having issues building, since I'm not using XCTest yet. I was able to build and use OCMock 3.x locally just fine without linking XCTest. This should also fix #149.
diff --git a/astute.gemspec b/astute.gemspec index abc1234..def5678 100644 --- a/astute.gemspec +++ b/astute.gemspec @@ -11,7 +11,7 @@ s.email = ['mscherbakov@mirantis.com'] s.add_dependency 'activesupport', '3.0.10' - s.add_dependency 'mcollective-client', '~> 2.2.4' #'2.3.1' + s.add_dependency 'mcollective-client', '~> 2.3.1' s.add_dependency 'symboltable', '1.0.2' s.add_dependency 'rest-client', '~> 1.6.7' s.add_dependency 'kwalify', '~> 0.7.2'
Return correct version of mcollective gem
diff --git a/app/controllers/teams/members_controller.rb b/app/controllers/teams/members_controller.rb index abc1234..def5678 100644 --- a/app/controllers/teams/members_controller.rb +++ b/app/controllers/teams/members_controller.rb @@ -43,7 +43,7 @@ protected def team_member - @member ||= user_team.members.find(params[:id]) + @member ||= user_team.members.find_by_username(params[:id]) end end
Update user finding (by username) in teams members (team of users) controller
diff --git a/spec/attrocity/attrocity_spec.rb b/spec/attrocity/attrocity_spec.rb index abc1234..def5678 100644 --- a/spec/attrocity/attrocity_spec.rb +++ b/spec/attrocity/attrocity_spec.rb @@ -11,9 +11,15 @@ }.not_to raise_error end + let(:person) { Examples::Person.new(age: 29) } + it 'creates a reader for instance-scope attribute set' do - person = Examples::Person.new(age: 29) expect { person.attribute_set }.not_to raise_error + end + + it 'creates a reader for attribute' do + pending + expect(person.age).to eq(29) end end
[TS/TC][86656248] Add pending spec for method response
diff --git a/spec/bipbip/plugin/mysql_spec.rb b/spec/bipbip/plugin/mysql_spec.rb index abc1234..def5678 100644 --- a/spec/bipbip/plugin/mysql_spec.rb +++ b/spec/bipbip/plugin/mysql_spec.rb @@ -2,7 +2,7 @@ require 'bipbip/plugin/mysql' describe Bipbip::Plugin::Mysql do - let(:plugin) { Bipbip::Plugin::Mysql.new('mysql', { 'hostname' => 'localhost', 'port' => 3306, 'username' => 'travis', 'password' => '' }, 10) } + let(:plugin) { Bipbip::Plugin::Mysql.new('mysql', { 'hostname' => 'localhost', 'port' => 3306, 'username' => 'root', 'password' => '' }, 10) } it 'should collect data' do data = plugin.monitor
Change mysql user in tests to "root" so we have permissions to check replication status
diff --git a/app/controllers/concerns/order_stock_check.rb b/app/controllers/concerns/order_stock_check.rb index abc1234..def5678 100644 --- a/app/controllers/concerns/order_stock_check.rb +++ b/app/controllers/concerns/order_stock_check.rb @@ -19,14 +19,14 @@ end def check_order_cycle_expiry - if current_order_cycle&.closed? - Bugsnag.notify("Notice: order cycle closed during checkout completion", order: current_order) - current_order.empty! - current_order.set_order_cycle! nil - flash[:info] = I18n.t('order_cycle_closed') + return unless current_order_cycle&.closed? - redirect_to main_app.shop_path - end + Bugsnag.notify("Notice: order cycle closed during checkout completion", order: current_order) + current_order.empty! + current_order.set_order_cycle! nil + + flash[:info] = I18n.t('order_cycle_closed') + redirect_to main_app.shop_path end private
Replace conditional with a guard clause
diff --git a/spec/freebsd/guest-tools_spec.rb b/spec/freebsd/guest-tools_spec.rb index abc1234..def5678 100644 --- a/spec/freebsd/guest-tools_spec.rb +++ b/spec/freebsd/guest-tools_spec.rb @@ -0,0 +1,49 @@+require 'spec_helper' + +# Ensure guest tools are installed in /lib/smartdc + +describe file('/lib/smartdc/add-network-interface') do + it { should be_file } + it { should be_executable } +end + +describe file('/lib/smartdc/firstboot') do + it { should be_file } + it { should be_executable } +end + +describe file('/lib/smartdc/format-secondary-disk') do + it { should be_file } + it { should be_executable } +end + +describe file('/lib/smartdc/lib_smartdc_scripts.cfg') do + it { should be_file } + it { should be_executable } +end + +describe file('/lib/smartdc/run-operator-script') do + it { should be_file } + it { should be_executable } +end + +describe file('/lib/smartdc/run-user-script') do + it { should be_file } + it { should be_executable } +end + +describe file('/lib/smartdc/set-hostname') do + it { should be_file } + it { should be_executable } +end + +describe file('/lib/smartdc/set-root-authorized-keys') do + it { should be_file } + it { should be_executable } +end + +describe file('/lib/smartdc/set-rootpassword') do + it { should be_file } + it { should be_executable } +end +
Test for guest tools in /lib/smartdc
diff --git a/features/step_definitions/directory_steps.rb b/features/step_definitions/directory_steps.rb index abc1234..def5678 100644 --- a/features/step_definitions/directory_steps.rb +++ b/features/step_definitions/directory_steps.rb @@ -7,3 +7,10 @@ Given /^I delete '(.+)'$/ do |virtual_path| delete_path expand(virtual_path) end + +When /^I remove the directory "([^"]*)"$/ do |dir_name| + in_current_dir do + # FileUtils#rmdir cannot delete non-empty directories. + FileUtils.rm_r(dir_name) + end +end
Add a step to remove an arbitrary directory
diff --git a/spec/lib/rspec/spec_file_spec.rb b/spec/lib/rspec/spec_file_spec.rb index abc1234..def5678 100644 --- a/spec/lib/rspec/spec_file_spec.rb +++ b/spec/lib/rspec/spec_file_spec.rb @@ -25,4 +25,29 @@ end end end + + context 'file with schema' do + let(:raml_file) do + File.expand_path('features/support/examples/basic_raml_with_schema.raml') + end + + describe '#initialize' do + it 'assigns @raml' do + expect(spec_file.raml).to eql raml + end + end + + describe '#template' do + it 'is a string' do + expect(spec_file.template.is_a?(String)).to be true + end + end + + describe '#render' do + it 'interpolates the correct values' do + schema = JsonTestData.generate!(raml.resources.first.methods.first.responses.first.bodies.first.schema) + puts schema + end + end + end end
Test for specs generated using JSON schema instead of example
diff --git a/Taylor.podspec b/Taylor.podspec index abc1234..def5678 100644 --- a/Taylor.podspec +++ b/Taylor.podspec @@ -21,14 +21,13 @@ s.source = { :git => "https://github.com/izqui/Taylor.git", :tag => s.version.to_s } s.social_media_url = 'https://twitter.com/izqui9' - s.platform = :osx, '10.10' - s.platform = :ios, '9.0' + s.ios.deployment_target = '8.0' + s.osx.deployment_target = '10.10' + s.requires_arc = true s.source_files = 'Taylor/**/*.swift' - # s.public_header_files = 'Pod/Classes/**/*.h' - # s.frameworks = 'UIKit', 'MapKit' s.dependency 'CocoaAsyncSocket', '~> 7.4.2' - s.dependency 'SwiftSockets', :git => "https://github.com/izqui/SwiftSockets.git" + # s.dependency 'SwiftSockets', :git => "https://github.com/izqui/SwiftSockets.git" end
Fix pod platform. Still waiting for Swift Sockets to release.
diff --git a/config/unicorn.rb b/config/unicorn.rb index abc1234..def5678 100644 --- a/config/unicorn.rb +++ b/config/unicorn.rb @@ -6,7 +6,7 @@ # revisit when moving to deploying with capistrano # source: https://coderwall.com/p/fprnhg before_fork do |server, worker| - @sidekiq_pid ||= spawn("bundle exec sidekiq -c 2") + @sidekiq_pid ||= spawn("bundle exec sidekiq -q geocoding -c 2") end after_fork do |server, worker|
Modify start up of sidekiq
diff --git a/roles/ucl.rb b/roles/ucl.rb index abc1234..def5678 100644 --- a/roles/ucl.rb +++ b/roles/ucl.rb @@ -28,7 +28,7 @@ :search => ["ucl.openstreetmap.org", "openstreetmap.org"] }, :ntp => { - :servers => ["0.uk.pool.ntp.org", "1.uk.pool.ntp.org", "europe.pool.ntp.org"] + :servers => ["ntp1.ucl.ac.uk", "ntp2.ucl.ac.uk"] } )
Switch UCL machines to use the UCL ntp servers
diff --git a/testrus.gemspec b/testrus.gemspec index abc1234..def5678 100644 --- a/testrus.gemspec +++ b/testrus.gemspec @@ -18,6 +18,8 @@ gem.add_development_dependency("fakefs", "0.4.1") gem.add_development_dependency("pry", "0.9.10") gem.add_development_dependency("rr", "1.0.4") + gem.add_development_dependency("test-unit", "2.5.3") + gem.add_development_dependency("rake", "10.0.2") gem.files = `git ls-files`.split($/) gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
Add test-unit and rake as dev dependencies
diff --git a/delayed_job.gemspec b/delayed_job.gemspec index abc1234..def5678 100644 --- a/delayed_job.gemspec +++ b/delayed_job.gemspec @@ -3,12 +3,13 @@ spec.authors = ['Brandon Keepers', 'Brian Ryckbost', 'Chris Gaffney', 'David Genord II', 'Erik Michaels-Ober', 'Matt Griffin', 'Steve Richert', 'Tobias Lütke'] spec.description = 'Delayed_job (or DJ) encapsulates the common pattern of asynchronously executing longer tasks in the background. It is a direct extraction from Shopify where the job table is responsible for a multitude of core tasks.' spec.email = ['brian@collectiveidea.com'] - spec.files = %w[CHANGELOG.md CONTRIBUTING.md LICENSE.md README.md delayed_job.gemspec] - spec.files += Dir['{contrib,lib,recipes}/**/*'] + spec.files = %w[CHANGELOG.md CONTRIBUTING.md LICENSE.md README.md Rakefile delayed_job.gemspec] + spec.files += Dir.glob('{contrib,lib,recipes,spec}/**/*') spec.homepage = 'http://github.com/collectiveidea/delayed_job' spec.licenses = ['MIT'] spec.name = 'delayed_job' spec.require_paths = ['lib'] spec.summary = 'Database-backed asynchronous priority queue system -- Extracted from Shopify' + spec.test_files = Dir.glob('spec/**/*') spec.version = '4.0.5' end
Revert "Don't package test files with gem" These files are needed for shared specs in delayed_job_active_record, delayed_job_mongoid, etc. This reverts commit 27ce6b0357dafb6a9a56c7730f6a616f78b986b7.
diff --git a/BRYXBanner.podspec b/BRYXBanner.podspec index abc1234..def5678 100644 --- a/BRYXBanner.podspec +++ b/BRYXBanner.podspec @@ -10,5 +10,7 @@ s.platform = :ios, '8.0' s.requires_arc = true + s.swift_version = '4.2' + s.source_files = 'Pod/Classes/**/*' end
Add 4.2 swift_version to podspec