diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/tasks/docker.rake b/lib/tasks/docker.rake index abc1234..def5678 100644 --- a/lib/tasks/docker.rake +++ b/lib/tasks/docker.rake @@ -0,0 +1,17 @@+# frozen_string_literal: true + +namespace :docker do + namespace :development do + desc 'Build and start services in development' + task :start do + `docker-compose up -d` + end + end + + namespace :production do + desc 'Build or rebuild and start services in production' + task :start do + `docker-compose -f docker-compose.yml -f docker-compose.prod.yml pull && docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d` + end + end +end
Add some rake tasks for Docker
diff --git a/building_blocks.gemspec b/building_blocks.gemspec index abc1234..def5678 100644 --- a/building_blocks.gemspec +++ b/building_blocks.gemspec @@ -18,5 +18,5 @@ spec.require_paths = ['lib'] spec.add_development_dependency 'bundler', '~> 1.5' - spec.add_development_dependency 'rake' + spec.add_development_dependency 'rake', '~> 0' end
Add semantic versioning for rake dev dependency
diff --git a/ruby/lib/fetchit.rb b/ruby/lib/fetchit.rb index abc1234..def5678 100644 --- a/ruby/lib/fetchit.rb +++ b/ruby/lib/fetchit.rb @@ -6,7 +6,6 @@ #require "httmultiparty" require "httparty" require "base64" -require "time" require "yaml" CONFIG = YAML.load_file("config.yml") unless defined? CONFIG
Remove time as we do not need it right now
diff --git a/config/deploy.rb b/config/deploy.rb index abc1234..def5678 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -1,4 +1,4 @@-lock '3.7.0' +lock '3.7.1' set :application, 'evemonk' set :repo_url, 'git@github.com:biow0lf/evemonk.git'
Update capistrano version on capistrano config
diff --git a/spec/command/ubuntu/ppa_spec.rb b/spec/command/ubuntu/ppa_spec.rb index abc1234..def5678 100644 --- a/spec/command/ubuntu/ppa_spec.rb +++ b/spec/command/ubuntu/ppa_spec.rb @@ -0,0 +1,12 @@+require 'spec_helper' + +property[:os] = nil +set :os, :family => 'ubuntu' + +describe get_command(:check_ppa_exists, 'nginx/stable') do + it { should eq 'find /etc/apt/ -name *.list | xargs grep -o -E "deb +http://ppa.launchpad.net/nginx/stable"' } +end + +describe get_command(:check_ppa_is_enabled, 'nginx/stable') do + it { should eq 'find /etc/apt/ -name *.list | xargs grep -o -E "^deb +http://ppa.launchpad.net/nginx/stable"' } +end
Add test of ppa command
diff --git a/spec/frozen/core/io/pid_spec.rb b/spec/frozen/core/io/pid_spec.rb index abc1234..def5678 100644 --- a/spec/frozen/core/io/pid_spec.rb +++ b/spec/frozen/core/io/pid_spec.rb @@ -17,13 +17,13 @@ end it "returns the ID of a process associated with stream" do - IO.popen(RUBY_NAME, "r+") { |io| + IO.popen(RUBY_EXE, "r+") { |io| io.pid.should_not == nil } end it "raises IOError on closed stream" do - process_io = IO.popen(RUBY_NAME, "r+") { |io| io } + process_io = IO.popen(RUBY_EXE, "r+") { |io| io } lambda { process_io.pid }.should raise_error(IOError) end end
Use RUBY_EXE not RUBY_NAME if ruby_exe helper is not suitable.
diff --git a/spec/unit/mutest/result_spec.rb b/spec/unit/mutest/result_spec.rb index abc1234..def5678 100644 --- a/spec/unit/mutest/result_spec.rb +++ b/spec/unit/mutest/result_spec.rb @@ -16,7 +16,7 @@ expect(object.frozen?).to be(true) end - it 'it makes DSL methods from Mutest::Result available' do + it 'makes DSL methods from Mutest::Result available' do expect(object.length).to be(1) end end
Remove redundant 'it' in example docstring
diff --git a/spec/wbench/integration_spec.rb b/spec/wbench/integration_spec.rb index abc1234..def5678 100644 --- a/spec/wbench/integration_spec.rb +++ b/spec/wbench/integration_spec.rb @@ -3,7 +3,13 @@ require File.expand_path(File.dirname(__FILE__)) + '/../support/test_sites' describe 'wbench' do - sites.each do |site| + sites.each_with_index do |site, index| + if index == 0 + it 'accepts a user agent string' do + expect { WBench::Benchmark.run(sites.first, :loops => 1, :user_agent => 'a mobile browser') }.to_not raise_exception + end + end + it "should return information from #{site} in chrome" do expect { WBench::Benchmark.run(site, :loops => 1) }.to_not raise_exception end
Add testing for user agent string
diff --git a/spec/kaminari-i18n_spec.rb b/spec/kaminari-i18n_spec.rb index abc1234..def5678 100644 --- a/spec/kaminari-i18n_spec.rb +++ b/spec/kaminari-i18n_spec.rb @@ -1,8 +1,8 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper') Dir.glob('locales/*.yml').each do |locale_file| - describe "a kaminari-i18n #{locale_file} locale file" do + describe locale_file do it_behaves_like 'a valid locale file', locale_file - it { locale_file.should be_a_subset_of 'locales/en.yml' } + it { is_expected.to be_a_subset_of 'locales/en.yml' } end end
Update to rspec's expect syntax
diff --git a/spec/support/setup_dirs.rb b/spec/support/setup_dirs.rb index abc1234..def5678 100644 --- a/spec/support/setup_dirs.rb +++ b/spec/support/setup_dirs.rb @@ -1,5 +1,5 @@ dirs = [] dirs << Rails.root.join('public', 'uploads', 'failed_imports') -dirs.each{|dir| Fileutils.mkdir_p dir unless Dir.exist? dir} +dirs.each{|dir| FileUtils.mkdir_p dir unless Dir.exist? dir}
Fix stupid typo in specs support file
diff --git a/lib/rails-embryo.rb b/lib/rails-embryo.rb index abc1234..def5678 100644 --- a/lib/rails-embryo.rb +++ b/lib/rails-embryo.rb @@ -1,4 +1,5 @@ require "rails/generators" +require "rails/generators/app_base" require "embryo/filesystem" require "embryo/test_support" require "embryo/default_view" @@ -10,6 +11,7 @@ Embryo::TestSupport.new(filesystem).install Embryo::DefaultView.new(filesystem).install filesystem.commit_changes + update_bundle end private @@ -25,4 +27,14 @@ def gemfile filesystem.gemfile end + + def update_bundle + command = "bundle install" + if `which bundle`.strip.present? + say_status :run, command + `#{command}` + else + say_status :skip, command, :yellow + end + end end
Update the bundle when installing
diff --git a/lib/rfgraph/auth.rb b/lib/rfgraph/auth.rb index abc1234..def5678 100644 --- a/lib/rfgraph/auth.rb +++ b/lib/rfgraph/auth.rb @@ -16,10 +16,18 @@ def authorize_url(callback_url) "#{BASE_URL}/oauth/authorize?client_id=#{app_id}&redirect_uri=#{callback_url}" end - + + # Take the oauth2 request token and turn it into an access token + # which can be used to access private data def authorize(callback_url, code) data = open("#{BASE_URL}/oauth/access_token?client_id=#{app_id}&redirect_uri=#{CGI.escape callback_url}&client_secret=#{app_secret}&code=#{CGI.escape code}").read - @expires = data.match(/expires=([^&]+)/)[1] + + # The expiration date is not necessarily set, as the app might have + # requested offline_access to the data + match_data = data.match(/expires=([^&]+)/) + @expires = match_data && match_data[1] || nil + + # Extract the access token @access_token = data.match(/access_token=([^&]+)/)[1] end end
Make access token expiration date optional for offline_access privilege usage
diff --git a/lib/tango/logger.rb b/lib/tango/logger.rb index abc1234..def5678 100644 --- a/lib/tango/logger.rb +++ b/lib/tango/logger.rb @@ -1,3 +1,5 @@+# coding: utf-8 + module Tango class Logger def self.instance
Add a coding marker so tango runs on ruby 1.9
diff --git a/lita-google.gemspec b/lita-google.gemspec index abc1234..def5678 100644 --- a/lita-google.gemspec +++ b/lita-google.gemspec @@ -1,12 +1,13 @@ Gem::Specification.new do |spec| spec.name = "lita-google" - spec.version = "0.0.1" + spec.version = "0.0.2" spec.authors = ["Jimmy Cuadra"] spec.email = ["jimmy@jimmycuadra.com"] spec.description = %q{A Lita handler for returning Google search results.} spec.summary = %q{A Lita handler for returning Google search results.} spec.homepage = "https://github.com/jimmycuadra/lita-google" spec.license = "MIT" + spec.metadata = { "lita_plugin_type" => "handler" } spec.files = `git ls-files`.split($/) spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
Add plugin type metadata and bump version to 0.0.2.
diff --git a/capi/recipes/vim_luan.rb b/capi/recipes/vim_luan.rb index abc1234..def5678 100644 --- a/capi/recipes/vim_luan.rb +++ b/capi/recipes/vim_luan.rb @@ -1,4 +1,6 @@-package 'vim' +package 'vim' do + options '--with-lua' +end homebrew_cask 'macvim' vimfiles = ::File.join(node['sprout']['home'], node['workspace_directory'], 'vimfiles')
Install vim with lua support
diff --git a/features/step_definitions/file_steps.rb b/features/step_definitions/file_steps.rb index abc1234..def5678 100644 --- a/features/step_definitions/file_steps.rb +++ b/features/step_definitions/file_steps.rb @@ -1,11 +1,7 @@ Given(/^a file named "([^"]*)" like "([^"]*)"$/) do |file, example| text = read_example(example) - steps %Q{ - Given a file named "#{file}" with: - """ - #{text} - """ - } + + step %(a file named "#{file}" with:), text end Given(/^a spec_helper\.rb file that requires rack\/test but not JSON$/) do
Use step method from cucumber
diff --git a/spec/remote_spec.rb b/spec/remote_spec.rb index abc1234..def5678 100644 --- a/spec/remote_spec.rb +++ b/spec/remote_spec.rb @@ -0,0 +1,32 @@+require 'spec_helper' + +describe Bimble::Remote, :vcr do + + before :all do + @remote = Bimble::Remote.new('Floppy', 'carbon-diet', ENV['GITHUB_OAUTH_TOKEN']) + end + + it "should be able to fetch the default branch for a repo" do + @remote.default_branch.should == 'master' + end + + it "should be able to get a blob sha for a file on a branch" do + @remote.blob_sha('master', 'Gemfile').should == '2235b1712de344a56823ade0149d5ff41f68c092' + end + + it "should be able to get the content of the Gemfile blob" do + content = @remote.blob_content('2235b1712de344a56823ade0149d5ff41f68c092') + content.should include("source 'http://rubygems.org'") + content.should include("gem 'mysql2'") + end + + it "should be able to get the Gemfile in one call" do + @remote.gemfile.should include("source 'http://rubygems.org'") + end + + # change the content somehow and post a new blob object with that new content, getting a blob SHA back + # post a new tree object with that file path pointer replaced with your new blob SHA getting a tree SHA back + # create a new commit object with the current commit SHA as the parent and the new tree SHA, getting a commit SHA back + # update the reference of your branch to point to the new commit SHA + +end
Add tests for bimble remote method
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -4,6 +4,30 @@ Dir['./spec/support/**/*.rb'].each { |file| require file } RSpec.configure do |c| + + # rspec-expectations config + c.expect_with :rspec do |expects| + + # This option disables deprecated 'should' syntax. + expects.syntax = :expect + + # This option makes the +description+ and +failure_message+ of custom + # matchers include text for helper methods defined using +chain+, e.g.: + # be_bigger_than(2).and_smaller_than(4).description + # # => "be bigger than 2 and smaller than 4" + # ...rather than: + # # => "be bigger than 2" + expects.include_chain_clauses_in_custom_matcher_descriptions = true + end + + # rspec-mocks config + c.mock_with :rspec do |mocks| + + # Prevents you from mocking or stubbing a method that does not exist on + # a real object. + mocks.verify_partial_doubles = true + end + c.color = true c.formatter = :documentation c.tty = true
Update rspec config to disable 'should' syntax etc.
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,5 +1,7 @@ require "simplecov" -SimpleCov.start +SimpleCov.start do + add_filter 'spec/dummy' +end # Configure Rails Environment ENV["RAILS_ENV"] = "test"
Add simplecov filter for spec/dummy
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 @@ -41,7 +41,9 @@ } end -SCHEMA = Schema.build do +TEST_ENV = Environment.coerce(:test => 'memory://test') + +TEST_ENV.schema do base_relation :users do repository :test @@ -51,6 +53,3 @@ key :id end end - -TEST_ENV = Environment.coerce(:test => 'memory://test') -TEST_ENV.load_schema(SCHEMA)
Update to work with new rom-relation interfaces
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 @@ -24,6 +24,8 @@ config.hook_into :webmock config.default_cassette_options = { serialize_with: :json } config.configure_rspec_metadata! + + config.ignore_hosts 'codeclimate.com' end RSpec.configure do |config|
Allow specs to report results to codeclimate.com
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -7,7 +7,6 @@ require 'rubygems' require 'bundler/setup' -require 'dependent_protect' if ENV['COVERAGE'] require 'simplecov' @@ -16,6 +15,8 @@ SimpleCov.start end +require 'dependent_protect' + RSpec.configure do |config| config.treat_symbols_as_metadata_keys_with_true_values = true config.run_all_when_everything_filtered = true
Fix coverage task as it needs to load prior to library
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,12 +1,13 @@ require 'bundler/setup' Bundler.setup +require 'coveralls' +Coveralls.wear! + require 'slather' require 'pry' -require 'coveralls' require 'json_spec' -Coveralls.wear! FIXTURES_XML_PATH = File.join(File.dirname(__FILE__), 'fixtures/cobertura.xml') FIXTURES_JSON_PATH = File.join(File.dirname(__FILE__), 'fixtures/gutter.json')
Load coveralls before application code
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 @@ -23,3 +23,24 @@ PuppetlabsSpec::Files.cleanup end end + +require 'pathname' +dir = Pathname.new(__FILE__).parent +Puppet[:modulepath] = File.join(dir, 'fixtures', 'modules') + +# There's no real need to make this version dependent, but it helps find +# regressions in Puppet +# +# 1. Workaround for issue #16277 where default settings aren't initialised from +# a spec and so the libdir is never initialised (3.0.x) +# 2. Workaround for 2.7.20 that now only loads types for the current node +# environment (#13858) so Puppet[:modulepath] seems to get ignored +# 3. Workaround for 3.5 where context hasn't been configured yet, +# ticket https://tickets.puppetlabs.com/browse/MODULES-823 +# +ver = Gem::Version.new(Puppet.version.split('-').first) +if Gem::Requirement.new("~> 2.7.20") =~ ver || Gem::Requirement.new("~> 3.0.0") =~ ver || Gem::Requirement.new("~> 3.5") =~ ver + puts "augeasproviders: setting Puppet[:libdir] to work around broken type autoloading" + # libdir is only a single dir, so it can only workaround loading of one external module + Puppet[:libdir] = "#{Puppet[:modulepath]}/augeasproviders_core/lib" +end
Use modulesync to manage meta files
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,5 +1,8 @@+# It only makes sense to use CodeClimate reporter on Travis +if ENV['TRAVIS'] + require 'codeclimate-test-reporter' + CodeClimate::TestReporter.start +end + $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'chatrix' - -require 'codeclimate-test-reporter' -CodeClimate::TestReporter.start
Change require order in spec helper
diff --git a/plugins/providers/hyperv/plugin.rb b/plugins/providers/hyperv/plugin.rb index abc1234..def5678 100644 --- a/plugins/providers/hyperv/plugin.rb +++ b/plugins/providers/hyperv/plugin.rb @@ -32,6 +32,26 @@ Cap::SnapshotList end + provider_capability(:virtualbox, :configure_disks) do + require_relative "cap/configure_disks" + Cap::ConfigureDisks + end + + provider_capability(:virtualbox, :cleanup_disks) do + require_relative "cap/cleanup_disks" + Cap::CleanupDisks + end + + provider_capability(:virtualbox, :validate_disk_ext) do + require_relative "cap/validate_disk_ext" + Cap::ValidateDiskExt + end + + provider_capability(:virtualbox, :get_default_disk_ext) do + require_relative "cap/validate_disk_ext" + Cap::ValidateDiskExt + end + protected def self.init!
Add capabilities for disk management with Hyper-V
diff --git a/has_ratings.gemspec b/has_ratings.gemspec index abc1234..def5678 100644 --- a/has_ratings.gemspec +++ b/has_ratings.gemspec @@ -16,4 +16,6 @@ s.extra_rdoc_files = %w(README.rdoc CHANGELOG.rdoc LICENSE) s.add_dependency("enumerate_by", ">= 0.4.0") + s.add_development_dependency("rake") + s.add_development_dependency("plugin_test_helper", ">= 0.3.2") end
Add missing dependencies to gemspec
diff --git a/spec/tic_tac_toe/view/game_spec.rb b/spec/tic_tac_toe/view/game_spec.rb index abc1234..def5678 100644 --- a/spec/tic_tac_toe/view/game_spec.rb +++ b/spec/tic_tac_toe/view/game_spec.rb @@ -3,4 +3,9 @@ describe TicTacToe::View::Game do + it 'can find the mustache template' do + gv = TicTacToe::View::Game.new(TicTacToe::Game.make_new_game(TicTacToe::Board.empty_board)) + gv.render + end + end
Add a view integration test All it cares about is that the render call doesn't throw.
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 @@ -10,7 +10,7 @@ require 'active_fulfillment' require 'active_utils' -require 'mocha' +require 'mocha/setup' module Test module Unit
Fix deprecation warning from mocha Deprecation warning: > *** Mocha deprecation warning: Change `require 'mocha'` to `require > 'mocha/setup'`.
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 @@ -29,4 +29,15 @@ @user = FactoryGirl.create(:user, :name => 'Ian Fleming') request.env['warden'] = stub(:authenticate! => true, :authenticated? => true, :user => @user) end + + # https://github.com/airblade/paper_trail#globally + def with_versioning + was_enabled = PaperTrail.enabled? + PaperTrail.enabled = true + begin + yield + ensure + PaperTrail.enabled = was_enabled + end + end end
Add test helper method for using paper_trail
diff --git a/test/test_helper.rb b/test/test_helper.rb index abc1234..def5678 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -4,6 +4,7 @@ ENV["RAILS_ENV"] = "test" require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' +require 'turn/autorun' require 'factory_girl' require 'shoulda/context'
Load Turn in test helper
diff --git a/app/models/tip.rb b/app/models/tip.rb index abc1234..def5678 100644 --- a/app/models/tip.rb +++ b/app/models/tip.rb @@ -26,7 +26,11 @@ end def should_generate_new_friendly_id? - created_at < 1.day.ago + if persisted? + created_at < 1.day.ago + else + super + end end def title_must_be_unique_for_user
Fix small bug in friendly_id for Tips The slug was not being generated for brand new tips
diff --git a/app/models/scenario.rb b/app/models/scenario.rb index abc1234..def5678 100644 --- a/app/models/scenario.rb +++ b/app/models/scenario.rb @@ -1,15 +1,43 @@ class Scenario < ActiveRecord::Base - validates :system, :type_of, :season, :scenario_number, :name, :tier, :presence => true - validates :scenario_number, presence: true, if: scenario? + validates :system, :type_of, :name, :tier, :presence => true + validates :scenario_number, presence: true, if: :scenario_number_needed? + validates :season, presence: true, if: :season_needed? + + # @type_list = ['Scenario', 'Quest', 'Module', 'Adventure Path', 'ACG'] + + def long_name + if scenario? + "#{system} #{season}-#{"%02d" % scenario_number}: #{name}" + elsif quest? + "#{system} Season #{season} Quests: #{name}" + elsif AP? + "#{system} AP #{"%d" % scenario_number}: #{name}" + else + "#{system} #{name}" + end + end - def long_name - "#{system} #{season}-#{"%02d" % scenario_number}: #{name}" + def scenario? + type_of == 'Scenario' end - def scenario? - :type_of == 'Scenario' + def quest? + type_of == 'Quest' + end + + # noinspection RubyInstanceMethodNamingConvention + def AP? + type_of == 'Adventure Path' + end + + def season_needed? + self.scenario? || self.quest? + end + + def scenario_number_needed? + self.scenario? || self.AP? end
Add logic for different types. `scenario_number` and `season` not needed for all types.
diff --git a/test/integration/engine_test.rb b/test/integration/engine_test.rb index abc1234..def5678 100644 --- a/test/integration/engine_test.rb +++ b/test/integration/engine_test.rb @@ -6,6 +6,7 @@ include RouteTranslator::ConfigurationHelper def test_with_engine_inside_localized_block + skip 'Regression with Rails 5.1.3. See #172' get '/engine_es' assert_response :success assert_equal '/blorgh/posts', response.body
Mark failing test as skipped Ref: #172
diff --git a/vidibus-gem_template.gemspec b/vidibus-gem_template.gemspec index abc1234..def5678 100644 --- a/vidibus-gem_template.gemspec +++ b/vidibus-gem_template.gemspec @@ -8,8 +8,8 @@ s.name = 'vidibus-gem_template' s.version = Vidibus::GemTemplate::VERSION s.platform = Gem::Platform::RUBY - s.authors = 'TODO: Your Name' - s.email = 'TODO your.name@vidibus.com' + s.authors = 'Your Name' + s.email = 'your.name@vidibus.com' s.homepage = 'https://github.com/vidibus/vidibus-gem_template' s.summary = 'TODO: Write a gem summary' s.description = 'TODO: Write a gem description'
Remove todos for user settings
diff --git a/json-schema.gemspec b/json-schema.gemspec index abc1234..def5678 100644 --- a/json-schema.gemspec +++ b/json-schema.gemspec @@ -11,8 +11,8 @@ s.email = "hoxworth@gmail.com" s.homepage = "http://github.com/hoxworth/json-schema/tree/master" s.summary = "Ruby JSON Schema Validator" - s.files = Dir.glob("{lib}/**/*") + s.files = Dir[ "lib/**/*", "resources/*.json" ] s.require_path = "lib" - s.test_files = Dir.glob("{test}/**/test*") + s.test_files = Dir[ "test/**/test*", "test/{data,schemas}/*.json" ] s.extra_rdoc_files = ["README.textile"] end
Include draft schema resources and full test files in gem
diff --git a/i18n-hygiene.gemspec b/i18n-hygiene.gemspec index abc1234..def5678 100644 --- a/i18n-hygiene.gemspec +++ b/i18n-hygiene.gemspec @@ -13,4 +13,5 @@ s.add_dependency 'parallel', '~> 1.3' s.add_dependency 'rake', '~> 11.0.0' s.add_development_dependency 'rspec', '~> 3.0' + s.add_development_dependency 'pry-nav' end
Add pry-nav as dev dependency It sure is useful!
diff --git a/app/helpers/clusters_helper.rb b/app/helpers/clusters_helper.rb index abc1234..def5678 100644 --- a/app/helpers/clusters_helper.rb +++ b/app/helpers/clusters_helper.rb @@ -4,14 +4,6 @@ # EE overrides this def has_multiple_clusters? false - end - - def clusterable - @project || @group - end - - def can_create_cluster? - can?(current_user, :create_cluster, clusterable) end def render_gcp_signup_offer
Remove methods already provided by presenters
diff --git a/test/client_test.rb b/test/client_test.rb index abc1234..def5678 100644 --- a/test/client_test.rb +++ b/test/client_test.rb @@ -15,4 +15,9 @@ order = @client.list_orders_by_next_token.first refute_empty @client.get_order(order.amazon_order_id) end + + def test_gets_service_status + status = @client.get_service_status + refute_empty status.to_s + end end
Add integration test for service status
diff --git a/test/daemon_test.rb b/test/daemon_test.rb index abc1234..def5678 100644 --- a/test/daemon_test.rb +++ b/test/daemon_test.rb @@ -8,7 +8,7 @@ interval = 0.00001 with_fake_owserver do d = SAAL::Daemon.new(:interval => interval, :db => TEST_DBFILE, - :conf => TEST_SENSOR_FILE2) + :conf => TEST_SENSOR_FILE1) pid = d.run sleep nsecs # Potential timing bug when the system is under load Process.kill(signal, pid)
Test using the file that has the wrong sensor to include those cases.
diff --git a/app/models/concerns/rankable.rb b/app/models/concerns/rankable.rb index abc1234..def5678 100644 --- a/app/models/concerns/rankable.rb +++ b/app/models/concerns/rankable.rb @@ -8,8 +8,7 @@ end def rank - super - # Redis.current.zcount(ranking_key, "(#{stargazers_count}", '+inf') + 1 + Redis.current.zcount(ranking_key, "(#{stargazers_count}", '+inf') + 1 rescue Redis::CannotConnectError super end
Revert "Revert "Use redis rank again"" This reverts commit ffdd77aeaf993b038e4e3bec21ad3917bcd2a806.
diff --git a/app/models/course_membership.rb b/app/models/course_membership.rb index abc1234..def5678 100644 --- a/app/models/course_membership.rb +++ b/app/models/course_membership.rb @@ -2,8 +2,7 @@ belongs_to :course, touch: true belongs_to :user, touch: true - attr_accessible :auditing, :character_profile, :course_id, :instructor_of_record, - :user_id, :role + attr_accessible :auditing, :character_profile, :course, :course_id, :instructor_of_record, :user, :user_id, :role Role.all.each do |role| scope role.pluralize, ->(course) { where role: role }
Allow memberships to be created with user and course objects instead of just ids
diff --git a/reittiopas2.gemspec b/reittiopas2.gemspec index abc1234..def5678 100644 --- a/reittiopas2.gemspec +++ b/reittiopas2.gemspec @@ -18,6 +18,7 @@ gem.add_dependency "json", "~> 1.8" gem.add_dependency "addressable", "~> 2.3" + gem.add_development_dependency "rake", "~> 10.1" gem.add_development_dependency "rspec", "~> 2.14" gem.add_development_dependency "webmock", "~> 1.15" gem.add_development_dependency "guard-rspec", "~> 4.0"
Add Rake to development dependencies On one of my installations of Ruby 1.9.3 and Bundler 1.3.5, 'bundle exec rake' fails unless Rake is listed as a development dependency of the project. (Interestingly, it works on another.) As Rake _is_ a development dependency of the project, list it as such.
diff --git a/lib/blimpy/fleet.rb b/lib/blimpy/fleet.rb index abc1234..def5678 100644 --- a/lib/blimpy/fleet.rb +++ b/lib/blimpy/fleet.rb @@ -20,6 +20,11 @@ end def start + # Make sure all our hosts are valid first! + @hosts.each do |host| + host.validate! + end + @hosts.each do |host| @servers << host.start end
Validate all hosts before starting any of them up
diff --git a/lib/calyx/result.rb b/lib/calyx/result.rb index abc1234..def5678 100644 --- a/lib/calyx/result.rb +++ b/lib/calyx/result.rb @@ -5,8 +5,9 @@ @expression = expression.freeze end - # The syntax tree of nested nodes representing the production rules which - # generated this result. + # Produces a syntax tree of nested nodes as the output of the grammar. Each + # syntax node represents the production rules that were evaluated at each + # step of the generator. # # @return [Array] def tree @@ -15,7 +16,7 @@ alias_method :to_exp, :tree - # The generated text string produced by the grammar. + # Produces a text string as the output of the grammar. # # @return [String] def text @@ -26,7 +27,7 @@ alias_method :to_s, :text - # A symbol produced by converting the generated text string where possible. + # Produces a symbol as the output of the grammar. # # @return [Symbol] def symbol
Improve documentation of `Calyx::Result` API
diff --git a/lib/frecon/model.rb b/lib/frecon/model.rb index abc1234..def5678 100644 --- a/lib/frecon/model.rb +++ b/lib/frecon/model.rb @@ -3,5 +3,9 @@ include Mongoid::Document include Mongoid::Timestamps include Mongoid::Attributes::Dynamic + + def id + self._id.to_s + end end end
Redefine method ID to return string
diff --git a/Casks/handbrakecli-nightly.rb b/Casks/handbrakecli-nightly.rb index abc1234..def5678 100644 --- a/Casks/handbrakecli-nightly.rb +++ b/Casks/handbrakecli-nightly.rb @@ -1,6 +1,6 @@ cask :v1 => 'handbrakecli-nightly' do - version '7168svn' - sha256 '297b32cb22386bcbbddfc4cb1cdf4048e17aaa583f9fae0792292b971231c2ec' + version '7201svn' + sha256 'd71fbf6905e19d4b3d3e0982a05e1fb985a008ec6c18a1d620d2bb6f47999d43' url "http://download.handbrake.fr/nightly/HandBrake-#{version}-MacOSX.6_CLI_x86_64.dmg" homepage 'https://handbrake.fr'
Update HandbrakeCLI Nightly to v7201svn HandBrakeCLI Nightly v7201svn built 2015-05-17.
diff --git a/lib/ruby-os/hash.rb b/lib/ruby-os/hash.rb index abc1234..def5678 100644 --- a/lib/ruby-os/hash.rb +++ b/lib/ruby-os/hash.rb @@ -29,4 +29,22 @@ end self end + + # File activesupport/lib/active_support/core_ext/hash/transform_values.rb, line 7 + def transform_values + return enum_for(:transform_values) unless block_given? + result = self.class.new + each do |key, value| + result[key] = yield(value) + end + result + end + + # File activesupport/lib/active_support/core_ext/hash/transform_values.rb, line 17 + def transform_values! + return enum_for(:transform_values!) unless block_given? + each do |key, value| + self[key] = yield(value) + end + end end
Add transform_values extension from active support
diff --git a/lib/jiraSOAP/url.rb b/lib/jiraSOAP/url.rb index abc1234..def5678 100644 --- a/lib/jiraSOAP/url.rb +++ b/lib/jiraSOAP/url.rb @@ -1,9 +1,9 @@ # A bit of a hack to support using an NSURL in MacRuby while still supporting # MRI by using the URI module. # -# I suggest not thinking about it too much beyond this point: this is a -# URI object if you are running on CRuby, but it will be an NSURL if you -# are running on MacRuby. +# For any JIRA entity that has a URL object as an instance variable, you can +# stick what ever type of object you want in the instance varible, as long as +# the object has a #to_s method that returns a properly formatted URI. class URL # @return [NSURL, URI::HTTP] the type depends on your RUBY_ENGINE attr_accessor :url
Clarify some things about the URL class
diff --git a/lib/shield/model.rb b/lib/shield/model.rb index abc1234..def5678 100644 --- a/lib/shield/model.rb +++ b/lib/shield/model.rb @@ -22,12 +22,12 @@ !! You need to implement `fetch`. Below is a quick example implementation (in Ohm): - def fetch(username) - find(:email => username).first + def fetch(email) + find(:email => email).first end For more example implementations, check out - http://githu.com/cyx/shield-contrib + http://github.com/cyx/shield-contrib }.gsub(/^ {10}/, "") end end
Fix typos in exception message.
diff --git a/lib/warp/matcher.rb b/lib/warp/matcher.rb index abc1234..def5678 100644 --- a/lib/warp/matcher.rb +++ b/lib/warp/matcher.rb @@ -14,7 +14,9 @@ end end - # RSpec 2 + # RSpec 2 and 3 have different methods + # that they call on matcher to get the + # failure messages. if RSpec::Version::STRING[0] == "2" def failure_message_for_should failure_message
Clarify comment regarding RSpec 2 and 3.
diff --git a/Casks/omnipresence.rb b/Casks/omnipresence.rb index abc1234..def5678 100644 --- a/Casks/omnipresence.rb +++ b/Casks/omnipresence.rb @@ -1,6 +1,6 @@ cask :v1 => 'omnipresence' do - version '1.3' - sha256 '2a58504aef5f7f24c74fb79ab1b59b667d83f3ba8b75b161a62de8617c089128' + version '1.4' + sha256 '9a8752fa8e4ee4d82bd435f624635f1157f7c1538b96622af361ef43d95f2e02' url "http://downloads.omnigroup.com/software/MacOSX/10.10/OmniPresence-#{version}.dmg" name 'OmniPresence'
Update OmniPresence to version 1.4 This commit updates the version to 1.4 and the new SHA
diff --git a/lib/pausescreen.rb b/lib/pausescreen.rb index abc1234..def5678 100644 --- a/lib/pausescreen.rb +++ b/lib/pausescreen.rb @@ -9,10 +9,10 @@ end def draw - draw_rect(@window_width, @window_height, Color::Trans_black, - ZOrder::Pause_background) - @pause_button.draw(160, 144, ZOrder::Pause_button) - @press_q.draw(170, 296, ZOrder::Pause_button) + draw_rect(@window_width, @window_height, Color::TRANS_BLACK, + ZOrder::PAUSE_BACKGROUND) + @pause_button.draw(160, 144, ZOrder::PAUSE_BUTTON) + @press_q.draw(170, 296, ZOrder::PAUSE_BUTTON) end private
Use new uppercase constants in PauseScreen
diff --git a/lib/simple_slug.rb b/lib/simple_slug.rb index abc1234..def5678 100644 --- a/lib/simple_slug.rb +++ b/lib/simple_slug.rb @@ -10,7 +10,7 @@ @@excludes = %w(new edit show index session login logout sign_in sign_out users admin stylesheets assets javascripts images) mattr_accessor :slug_regexp - @@slug_regexp = /\A\w+[\w\d\-_]*\z/ + @@slug_regexp = /\A(?:\w+[\w\d\-_]*|--\d+)\z/ mattr_accessor :slug_column @@slug_column = 'slug'
Allow values like `--123` for slug
diff --git a/lib/simplecheck.rb b/lib/simplecheck.rb index abc1234..def5678 100644 --- a/lib/simplecheck.rb +++ b/lib/simplecheck.rb @@ -4,41 +4,40 @@ module Simplecheck def check( *arguments, &block ) error_message = if block_given? - simplecheck_check_arguments_with_block( arguments, block ) + Simplecheck.check_arguments_with_block( arguments, block ) else - simplecheck_check_arguments( arguments ) + Simplecheck.check_arguments( arguments ) end - error_message ? simplecheck_handle_failure( error_message ) : true + error_message ? Simplecheck.handle_failure( error_message ) : true end - private - def simplecheck_check_arguments( arguments ) + def Simplecheck.check_arguments( arguments ) case arguments.size when 1 - simplecheck_check_expression( arguments[ 0 ]) + Simplecheck.check_expression( arguments[ 0 ]) else - simplecheck_check_case_equality( *arguments ) + Simplecheck.check_case_equality( *arguments ) end end - def simplecheck_check_arguments_with_block( arguments, block ) - simplecheck_check_arguments(( arguments + [ block ])) + def Simplecheck.check_arguments_with_block( arguments, block ) + Simplecheck.check_arguments(( arguments + [ block ])) end - def simplecheck_check_expression( expression ) + def Simplecheck.check_expression( expression ) if !expression 'Condition is not satisfied' end end - def simplecheck_check_case_equality( *arguments, check_object ) - if invalid_argument = arguments.find{ |argument| !( check_object === argument )} - "#{ invalid_argument } does not satisfy #{ check_object }" + def Simplecheck.check_case_equality( *arguments, check_argument ) + if invalid_argument = arguments.find{ |argument| !( check_argument === argument )} + "#{ invalid_argument } does not satisfy #{ check_argument }" end end - def simplecheck_handle_failure( message ) + def Simplecheck.handle_failure( message ) raise Simplecheck::CheckFailed.new( message ) end end
Make check methods into module methods
diff --git a/spec/link_spec.rb b/spec/link_spec.rb index abc1234..def5678 100644 --- a/spec/link_spec.rb +++ b/spec/link_spec.rb @@ -13,6 +13,19 @@ @link.name.should eql("Link") end + it "should be able to check whether it is a source" do + @link.is_source?.should eql(true) + @link.is_target?.should eql(false) + end + + it "should be able to check whether it is a target" do + source = Backdat::Link.new + source.next = @link + @link.before = source + source.is_source?.should eql(true) + @link.is_target?.should eql(true) + end + it "should support fall-thru parameter checking at initialization" do @link = Backdat::Link.new(:bleh => "awesome") @link.link_config(:bleh).should eql("awesome") @@ -25,8 +38,8 @@ Backdat::Config.configuration.delete(:link_blehk) end - it "should default to the `:files` format" do - @link.format.should eql(:files) + it "should default to the `:file` format" do + @link.format.should eql(:file) end it "should have nil as a default next" do
Define interface for all links
diff --git a/features/support/capybara.rb b/features/support/capybara.rb index abc1234..def5678 100644 --- a/features/support/capybara.rb +++ b/features/support/capybara.rb @@ -1,5 +1,5 @@ # Configure Capybara Capybara.configure do |config| - config.default_wait_time = 20 + config.default_wait_time = 30 config.default_driver = :selenium end
Increase Capybara default wait time to 30 seconds in order to try to get Travis working
diff --git a/app/models/renalware/hd/mdm_patients_query.rb b/app/models/renalware/hd/mdm_patients_query.rb index abc1234..def5678 100644 --- a/app/models/renalware/hd/mdm_patients_query.rb +++ b/app/models/renalware/hd/mdm_patients_query.rb @@ -17,6 +17,7 @@ def search @search ||= begin relation + .includes(:hd_profile) .extending(ModalityScopes) .extending(Scopes) .with_current_key_pathology
Resolve HD MDM Patients list N+1 issues
diff --git a/lib/get_news.rb b/lib/get_news.rb index abc1234..def5678 100644 --- a/lib/get_news.rb +++ b/lib/get_news.rb @@ -4,8 +4,12 @@ module GetNews class Main - def get_news(search_word, news_count) - url = 'http://news.google.com/news/?ie=UTF8&output=atom&hl=ja&num=' + news_count + '&q=' + search_word + def get_news(search_word, news_count) + if news_count < 1 + return + end + + url = 'https://news.google.com/news?ned=us&ie=UTF-8&oe=UTF-8&q=' + search_word + '&output=atom&num=' + news_count.to_i + '&hl=ja' charset = nil xml = open(url) do |f|
Fix URL & cannot search by 0 searchCnt
diff --git a/lib/kudu/ack.rb b/lib/kudu/ack.rb index abc1234..def5678 100644 --- a/lib/kudu/ack.rb +++ b/lib/kudu/ack.rb @@ -24,6 +24,7 @@ end def attributes_for_export - attributes.merge(:acked_uid => score.external_uid, :kind => score.kind, :paths => [uid]) + template = "api/v1/views/ack.pg" + Petroglyph::Engine.new(File.read(template)).to_hash({:ack => self}, template) end end
Implement river export as petroglyph template
diff --git a/lib/rake_job.rb b/lib/rake_job.rb index abc1234..def5678 100644 --- a/lib/rake_job.rb +++ b/lib/rake_job.rb @@ -1,5 +1,3 @@- - class RakeJob def self.find_rake @@ -17,9 +15,14 @@ def run! command = "cd #{RAILS_ROOT} && #{@@rake} #{@task}" - system command + unless (system command) + raise RakeTaskNotFoundError + end end end -class RakeNotInstalledException < StandardError +class RakeTaskNotFoundError < StandardError end + +class RakeNotInstalledError < StandardError +end
Handle tasks that aren't found
diff --git a/lib/services.rb b/lib/services.rb index abc1234..def5678 100644 --- a/lib/services.rb +++ b/lib/services.rb @@ -5,7 +5,10 @@ module Services def self.publishing_api - @publishing_api ||= GdsApi::PublishingApiV2.new(Plek.new.find('publishing-api')) + @publishing_api ||= GdsApi::PublishingApiV2.new( + Plek.new.find('publishing-api'), + bearer_token: ENV['PUBLISHING_API_BEARER_TOKEN'] || 'example' + ) end def self.content_store
Add bearer_token for publishing API authentication
diff --git a/lib/shrinker.rb b/lib/shrinker.rb index abc1234..def5678 100644 --- a/lib/shrinker.rb +++ b/lib/shrinker.rb @@ -4,6 +4,8 @@ module Shrinker autoload :Config, 'shrinker/config' autoload :Serializer, 'shrinker/serializer' + autoload :EasyUrl, 'shrinker/easy_url' + autoload :Token, 'shrinker/token' module Backend autoload :Abstract, 'shrinker/backend/abstract'
Add Token and EasyUrl to Shrinker.
diff --git a/github-sync/init-database.rb b/github-sync/init-database.rb index abc1234..def5678 100644 --- a/github-sync/init-database.rb +++ b/github-sync/init-database.rb @@ -18,12 +18,12 @@ sync_db=SQLite3::Database.new(db_filename); - sync_db.execute( File.read( File.join( File.dirname(__FILE__), 'db_metadata', 'db_metadata_schema.sql' ) ) ) - sync_db.execute( File.read( File.join( File.dirname(__FILE__), 'db_events/db_event_schema.sql' ) ) ) - sync_db.execute( File.read( File.join( File.dirname(__FILE__), 'db_releases/db_release_schema.sql' ) ) ) - sync_db.execute( File.read( File.join( File.dirname(__FILE__), 'db_commits/db_commit_schema.sql' ) ) ) - sync_db.execute( File.read( File.join( File.dirname(__FILE__), 'db_issues/db_issue_schema.sql' ) ) ) - sync_db.execute( File.read( File.join( File.dirname(__FILE__), 'user_mapping/db_user_schema.sql' ) ) ) + sync_db.execute_batch( File.read( File.join( File.dirname(__FILE__), 'db_metadata', 'db_metadata_schema.sql' ) ) ) + sync_db.execute_batch( File.read( File.join( File.dirname(__FILE__), 'db_events', 'db_event_schema.sql' ) ) ) + sync_db.execute_batch( File.read( File.join( File.dirname(__FILE__), 'db_releases', 'db_release_schema.sql' ) ) ) + sync_db.execute_batch( File.read( File.join( File.dirname(__FILE__), 'db_commits', 'db_commit_schema.sql' ) ) ) + sync_db.execute_batch( File.read( File.join( File.dirname(__FILE__), 'db_issues', 'db_issue_schema.sql' ) ) ) + sync_db.execute_batch( File.read( File.join( File.dirname(__FILE__), 'user_mapping', 'db_user_schema.sql' ) ) ) end
Use execute_batch to run multiple SQL statements
diff --git a/homebrew/terraform-inventory.rb b/homebrew/terraform-inventory.rb index abc1234..def5678 100644 --- a/homebrew/terraform-inventory.rb +++ b/homebrew/terraform-inventory.rb @@ -3,8 +3,8 @@ head "https://github.com/adammck/terraform-inventory.git" # Update these when a new version is released - url "https://github.com/adammck/terraform-inventory/archive/0.3.tar.gz" - sha1 "fc4d492e328255b422429e221ff7d31533da96f9" + url "https://github.com/adammck/terraform-inventory/archive/v0.4.tar.gz" + sha1 "e878196877f068d49970c7f2b1ce32cc09a6ee02" depends_on "go" => :build
Update brew formula to v0.4
diff --git a/mina-hipchat.gemspec b/mina-hipchat.gemspec index abc1234..def5678 100644 --- a/mina-hipchat.gemspec +++ b/mina-hipchat.gemspec @@ -9,8 +9,8 @@ spec.authors = ["Jakub Juszczak"] spec.email = ["juszczak.j@googlemail.com"] - spec.summary = %q{Mina deploy notification for HipChat.} - spec.description = %q{Sending room notification in HipChat for Mina} + spec.summary = %q{HipChat notification for Mina Deploy} + spec.description = %q{Sending HipChat notifications for mina deploy} spec.homepage = "https://github.com/apertureless/mina-hipchat" spec.license = "MIT"
Fix spec summary and description
diff --git a/govuk_admin_template.gemspec b/govuk_admin_template.gemspec index abc1234..def5678 100644 --- a/govuk_admin_template.gemspec +++ b/govuk_admin_template.gemspec @@ -23,6 +23,6 @@ gem.add_development_dependency "capybara", "~> 3" gem.add_development_dependency "rspec-rails", "~> 5" - gem.add_development_dependency "rubocop-govuk", "4.6.0" + gem.add_development_dependency "rubocop-govuk", "4.7.0" gem.add_development_dependency "sassc-rails", "~> 2" end
Update rubocop-govuk requirement from = 4.6.0 to = 4.7.0 Updates the requirements on [rubocop-govuk](https://github.com/alphagov/rubocop-govuk) to permit the latest version. - [Release notes](https://github.com/alphagov/rubocop-govuk/releases) - [Changelog](https://github.com/alphagov/rubocop-govuk/blob/main/CHANGELOG.md) - [Commits](https://github.com/alphagov/rubocop-govuk/compare/v4.6.0...v4.7.0) --- updated-dependencies: - dependency-name: rubocop-govuk dependency-type: direct:development ... Signed-off-by: dependabot[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@github.com>
diff --git a/simple_find.gemspec b/simple_find.gemspec index abc1234..def5678 100644 --- a/simple_find.gemspec +++ b/simple_find.gemspec @@ -17,7 +17,7 @@ s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"] s.test_files = Dir["test/**/*"] - s.add_dependency "rails", "~> 4.0.0" + s.add_dependency "rails", ">= 4.0.0" s.add_development_dependency "sqlite3" end
Change gemspec dependencies to >= 4.0.0
diff --git a/nyaplot.gemspec b/nyaplot.gemspec index abc1234..def5678 100644 --- a/nyaplot.gemspec +++ b/nyaplot.gemspec @@ -6,11 +6,11 @@ Gem::Specification.new do |spec| spec.name = "nyaplot" spec.version = Nyaplot::VERSION - spec.authors = ["domitry"] + spec.authors = ["Naoki Nishida"] spec.email = ["domitry@gmail.com"] - spec.summary = %q{the Ruby front-end library of Ecoli.js} - spec.description = %q{the Ruby front-end library of Ecoli.js} - spec.homepage = "" + spec.summary = %q{interactive plots generator for Ruby users} + spec.description = %q{To get information about Nyaplot, visit the website or mailing-list of SciRuby, or ask me on GitHub.} + spec.homepage = "https://www.github.com/domitry/nyaplot" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0")
Add some description to gemspec
diff --git a/test/models/search_test.rb b/test/models/search_test.rb index abc1234..def5678 100644 --- a/test/models/search_test.rb +++ b/test/models/search_test.rb @@ -0,0 +1,10 @@+require_relative '../test_helper' + +class CmsSearchTest < ActiveSupport::TestCase + + def test_search + results = Comfy::Cms::Search.new(Comfy::Cms::Page, "Default").results + assert_equal(Comfy::Cms::Page.find_by_label('Default Page'), results.first) + end + +end
Add unit test for Search class
diff --git a/test/test_en_pak_locale.rb b/test/test_en_pak_locale.rb index abc1234..def5678 100644 --- a/test/test_en_pak_locale.rb +++ b/test/test_en_pak_locale.rb @@ -19,4 +19,8 @@ assert Faker::Internet.domain_suffix.is_a? String assert Faker::Company.suffix.is_a? String end + + def test_en_pak_default_country + assert_match(/\A(Pakistan|Islamic Republic of Pakistan)\z/, Faker::Address.default_country) + end end
Add default country check to en-PAK unit tests
diff --git a/config/initializers/gds-sso.rb b/config/initializers/gds-sso.rb index abc1234..def5678 100644 --- a/config/initializers/gds-sso.rb +++ b/config/initializers/gds-sso.rb @@ -1,6 +1,6 @@ GDS::SSO.config do |config| config.user_model = "User" - config.oauth_id = 'abcdefghjasndjkasnd' + config.oauth_id = 'abcdefghjasndjkasndpublisher' config.oauth_secret = 'secret' config.oauth_root_url = Plek.current.find("signon") end
Make OAuth UID unique in development
diff --git a/config/initializers/plugins.rb b/config/initializers/plugins.rb index abc1234..def5678 100644 --- a/config/initializers/plugins.rb +++ b/config/initializers/plugins.rb @@ -6,9 +6,3 @@ require 'noosfero/plugin/settings' require 'noosfero/plugin/spammable' Noosfero::Plugin.init_system if $NOOSFERO_LOAD_PLUGINS - -if Rails.env == 'development' && $NOOSFERO_LOAD_PLUGINS - ActionController::Base.send(:prepend_before_filter) do |controller| - Noosfero::Plugin.init_system - end -end
Remove plugin reload on development This is a known problem that will be fixed as described on http://noosfero.org/Development/ActionItem2932
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,9 +1,9 @@+require 'coveralls' +Coveralls.wear! + ENV["RAILS_ENV"] ||= 'test' require File.expand_path("../dummy/config/environment.rb", __FILE__) require 'rspec/rails' -require 'coveralls' - -Coveralls.wear! RSpec.configure do |config| config.treat_symbols_as_metadata_keys_with_true_values = true
Move coveralls initialization to the top of the spec helper
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 @@ -3,6 +3,7 @@ minimal = ENV['MINIMAL'] == 'true' require 'objspace' +require 'time' if minimal require 'frozen_record/minimal'
Fix CI for "minimal" test suites
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,4 +8,6 @@ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) +Dir["./spec/support/**/*.rb"].sort.each { |f| require f} + require 'percheron'
Load all spec support files
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,13 +21,13 @@ Dir[root.join('support/*.rb').to_s].each { |f| require f } Dir[root.join('shared/*.rb').to_s].each { |f| require f } +# Namespace holding all objects created during specs +module ROMSpec +end + RSpec.configure do |config| - config.before do - @constants = Object.constants - end - config.after do - added_constants = Object.constants - @constants - [:ThreadSafe] - added_constants.each { |name| Object.send(:remove_const, name) } + added_constants = ROMSpec.constants + added_constants.each { |name| ROMSpec.send(:remove_const, name) } end end
Use namespace ROMSpec in 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 @@ -0,0 +1,15 @@+$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../commonwatir/lib") +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../watir/lib") +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../firewatir/lib") + +require "watir" + +case ENV['watir_browser'] +when /firefox/ + Browser = FireWatir::Firefox +else + Browser = Watir::IE + WatirSpec.persistent_browser = true +end + +include Watir::Exception
Add spec helper that loads Watir
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,8 +1,47 @@ require 'bundler/setup' RSpec.configure do |config| + persist_between_runs = ENV['PERSIST_BETWEEN_RUNS'] + + def current_public_ip_cidr + "#{open('http://whatismyip.akamai.com').read}/32" + end + config.example_status_persistence_file_path = '.rspec_status' - config.expect_with :rspec do |c| - c.syntax = :expect + + config.add_setting :region, default: 'eu-west-2' + + config.before(:suite) do + variables = RSpec.configuration + configuration_directory = Paths.from_project_root_directory('src') + + puts + puts "Provisioning with deployment identifier: #{variables.deployment_identifier}" + puts + + Terraform.clean + Terraform.apply(directory: configuration_directory, vars: { + region: variables.region + }) + + puts + end + + config.after(:suite) do + unless persist_between_runs + variables = RSpec.configuration + configuration_directory = Paths.from_project_root_directory('src') + + puts + puts "Destroying with deployment identifier: #{variables.deployment_identifier}" + puts + + Terraform.clean + Terraform.destroy(directory: configuration_directory, vars: { + region: variables.region + }) + + puts + end end end
Allow persistent deploys for testing via environment variable.
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 @@ -13,6 +13,10 @@ require 'support/database_cleaner' require 'capybara/rspec' require 'capybara/rails' + +Capybara.register_driver :selenium do |app| + Capybara::Selenium::Driver.new(app, :browser => :chrome) +end RSpec.configure do |config| Netzke::Testing.rspec_init(config)
Move to Chrome for tests
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,5 +1,6 @@ require 'dm-core/spec/setup' require 'dm-core/spec/lib/pending_helpers' +require 'dm-core/spec/lib/spec_helper' require 'dm-accepts_nested_attributes' @@ -32,6 +33,14 @@ config.include(DataMapper::Spec::PendingHelpers) + config.after(:all) do + if DataMapper.respond_to?(:auto_migrate_down!, true) + DataMapper.send(:auto_migrate_down!, DataMapper::Spec.adapter.name) + end + + DataMapper::Spec.cleanup_models + end + config.after(:suite) do if DataMapper.respond_to?(:auto_migrate_down!, true) DataMapper.send(:auto_migrate_down!, DataMapper::Spec.adapter.name)
Migrate down and clear model descendants after :all. Clearing the descendants list avoids a lot of time-consuming duplication when cleaning up because model classes are not included several times in the descendants list.
diff --git a/spec/support/vcr.rb b/spec/support/vcr.rb index abc1234..def5678 100644 --- a/spec/support/vcr.rb +++ b/spec/support/vcr.rb @@ -9,6 +9,7 @@ '127.0.0.1', '0.0.0.0', 'api.knapsackpro.com', + 'api-fake.knapsackpro.com', 'api-staging.knapsackpro.com', 'api.knapsackpro.dev', ) @@ -18,6 +19,7 @@ WebMock.disable_net_connect!(allow: [ 'api.knapsackpro.com', + 'api-fake.knapsackpro.com', 'api-staging.knapsackpro.com', 'api.knapsackpro.dev', ]) if defined?(WebMock)
Add api-fake.knapsackpro.com to allowed hosts for VCR and web mock
diff --git a/recipes/rackspace.rb b/recipes/rackspace.rb index abc1234..def5678 100644 --- a/recipes/rackspace.rb +++ b/recipes/rackspace.rb @@ -25,3 +25,15 @@ sed -i '6s/.*/PRIVATE_IP=\$(ifconfig eth1 \| grep \"inet addr\" \| cut --delimiter=\":\" -f 2 \| cut --delimiter=\" \" -f 1)/' /etc/default/octohost EOH end + +execute 'install keys to push to git user' do # ~FC041 + command "curl -L #{node['git']['keys']} >> /home/git/.ssh/authorized_keys" +end + +bash 'start tentacles' do + user 'root' + cwd '/tmp' + code <<-EOH + octo tentacles start + EOH +end
Add keys and start up tentacles.
diff --git a/elements.podspec b/elements.podspec index abc1234..def5678 100644 --- a/elements.podspec +++ b/elements.podspec @@ -18,7 +18,7 @@ s.platform = :ios, '9.0' s.requires_arc = true - s.source_files = 'Pod/Classes/**/*{swift}' + s.source_files = 'Pod/Classes/**/*.{swift}' s.resource_bundles = { 'elements' => ['Pod/Classes/**/*.{lproj,storyboard,xib,xcassets,json,imageset,png}'] }
Apply cosmetic fix to podspec
diff --git a/lib/active_force/association.rb b/lib/active_force/association.rb index abc1234..def5678 100644 --- a/lib/active_force/association.rb +++ b/lib/active_force/association.rb @@ -12,6 +12,7 @@ query = ActiveForce::Query.new(association_name) query.fields model.fields query.where(options[:where]) if options[:where] + query.order(options[:order]) if options[:order] query.where("#{ foreing_key } = '#{ id }'") query end
Add order option to the relation.
diff --git a/jsonapi_deserializer.gemspec b/jsonapi_deserializer.gemspec index abc1234..def5678 100644 --- a/jsonapi_deserializer.gemspec +++ b/jsonapi_deserializer.gemspec @@ -18,7 +18,7 @@ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.add_development_dependency "bundler", "~> 1.10" + spec.add_development_dependency "bundler", ">= 1.10", "< 3.0" spec.add_development_dependency "rake", "~> 10.0" spec.add_development_dependency "rspec"
Allow an bundler version 1 or 2
diff --git a/lib/exercism/team_membership.rb b/lib/exercism/team_membership.rb index abc1234..def5678 100644 --- a/lib/exercism/team_membership.rb +++ b/lib/exercism/team_membership.rb @@ -8,7 +8,9 @@ scope :for_team,-> (team_id) {where(team_id: team_id)} before_create do - self.confirmed = false + if confirmed.nil? + self.confirmed = false + end true end
Allow setting confirmed on team membership at creation time
diff --git a/examples/bug_system.rb b/examples/bug_system.rb index abc1234..def5678 100644 --- a/examples/bug_system.rb +++ b/examples/bug_system.rb @@ -0,0 +1,145 @@+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) + +require 'finite_machine' + +class User + attr_accessor :name + + def initialize(name) + @name = name + end +end + +class Manager < User + attr_accessor :developers + + def initialize(name) + super + @developers = [] + end + + def manages(developer) + @developers << developer + end + + def assign(bug) + developer = @developers.first + bug.assign + developer.bug = bug + end +end + +class Tester < User + def report(bug) + bug.report + end + + def reopen(bug) + bug.reopen + end +end + +class Developer < User + attr_accessor :bug + + def work_on + bug.start + end + + def resolve + bug.close + end +end + +class BugSystem + attr_accessor :managers + + def initialize(managers = []) + @managers = managers + end + + def notify_manager(bug) + manager = @managers.first + manager.assign(bug) + end +end + +class Bug + attr_accessor :name + attr_accessor :priority + # fake belongs_to relationship + attr_accessor :bug_system + + def initialize(name, priority) + @name = name + @priority = priority + end + + def report + status.report + end + + def assign + status.assign + end + + def start + status.start + end + + def close + status.close + end + + def reopen + status.reopen + end + + def status + context = self + @status ||= FiniteMachine.define do + target context + + events { + event :report, :none => :new + event :assign, :new => :assigned + event :start, :assigned => :in_progress + event :close, [:in_progress, :reopened] => :resolved + event :reopen, :resolved => :reopened + } + + callbacks { + on_enter :new do |event| + bug_system.notify_manager(self) + end + } + end + end +end + +tester = Tester.new("John") +manager = Manager.new("David") +developer = Developer.new("Piotr") +manager.manages(developer) + +bug_system = BugSystem.new([manager]) +bug = Bug.new(:trojan, :high) +bug.bug_system = bug_system + +puts "A BUG's LIFE" +puts "#1 #{bug.status.current}" + +tester.report(bug) +puts "#2 #{bug.status.current}" + +developer.work_on +puts "#3 #{bug.status.current}" + +developer.resolve +puts "#4 #{bug.status.current}" + +tester.reopen(bug) +puts "#5 #{bug.status.current}" + +developer.resolve +puts "#6 #{bug.status.current}"
Add example usage based on bug system.
diff --git a/app/workers/create_project.rb b/app/workers/create_project.rb index abc1234..def5678 100644 --- a/app/workers/create_project.rb +++ b/app/workers/create_project.rb @@ -6,7 +6,6 @@ return false unless Activity.where(target_id: @product.id) .where.not(type: 'Activities::Chat') .where.not(type: 'Activities::FoundProduct') - .where.not(actor: @user) .empty? post Rails.application.routes.url_helpers.api_product_projects_path(@product),
Fix Kernel's posting of the initial project
diff --git a/lib/active_service/runner.rb b/lib/active_service/runner.rb index abc1234..def5678 100644 --- a/lib/active_service/runner.rb +++ b/lib/active_service/runner.rb @@ -26,9 +26,11 @@ def run_method(sym, *args, &block) self.class.run_before_hooks(self, sym) - send(sym, *args, &block) + result = send(sym, *args, &block) self.class.run_after_hooks(self, sym) + + result end end
Fix method return on run_method
diff --git a/lib/flipper/gates/boolean.rb b/lib/flipper/gates/boolean.rb index abc1234..def5678 100644 --- a/lib/flipper/gates/boolean.rb +++ b/lib/flipper/gates/boolean.rb @@ -3,27 +3,9 @@ class Boolean < Gate TruthMap = { true => true, + false => false, 'true' => true, - 'TRUE' => true, - 'True' => true, - 't' => true, - 'T' => true, - '1' => true, - 'on' => true, - 'ON' => true, - 1 => true, - 1.0 => true, - false => false, 'false' => false, - 'FALSE' => false, - 'False' => false, - 'f' => false, - 'F' => false, - '0' => false, - 'off' => false, - 'OFF' => false, - 0 => false, - 0.0 => false, nil => false, }
Reduce the supported "truthy" values.
diff --git a/puppet-lint.gemspec b/puppet-lint.gemspec index abc1234..def5678 100644 --- a/puppet-lint.gemspec +++ b/puppet-lint.gemspec @@ -9,33 +9,10 @@ s.description = 'Checks your Puppet manifests against the Puppetlabs style guide and alerts you to any discrepancies.' - s.executables = ['puppet-lint'] - s.files = [ - 'bin/puppet-lint', - 'lib/puppet-lint/configuration.rb', - 'lib/puppet-lint/lexer.rb', - 'lib/puppet-lint/plugin.rb', - 'lib/puppet-lint/plugins/check_classes.rb', - 'lib/puppet-lint/plugins/check_conditionals.rb', - 'lib/puppet-lint/plugins/check_resources.rb', - 'lib/puppet-lint/plugins/check_strings.rb', - 'lib/puppet-lint/plugins/check_variables.rb', - 'lib/puppet-lint/plugins/check_whitespace.rb', - 'lib/puppet-lint/plugins.rb', - 'lib/puppet-lint/tasks/puppet-lint.rb', - 'lib/puppet-lint.rb', - 'LICENSE', - 'puppet-lint.gemspec', - 'Rakefile', - 'README.md', - 'spec/puppet-lint/check_classes_spec.rb', - 'spec/puppet-lint/check_conditionals_spec.rb', - 'spec/puppet-lint/check_resources_spec.rb', - 'spec/puppet-lint/check_strings_spec.rb', - 'spec/puppet-lint/check_variables_spec.rb', - 'spec/puppet-lint/check_whitespace_spec.rb', - 'spec/spec_helper.rb', - ] + s.files = `git ls-files`.split("\n") + s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") + s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } + s.require_paths = ["lib"] s.add_development_dependency 'rspec' s.add_development_dependency 'rdoc'
Use git-ls-files to populate gemspec fields
diff --git a/lib/generators/active_record/devise_guests_generator.rb b/lib/generators/active_record/devise_guests_generator.rb index abc1234..def5678 100644 --- a/lib/generators/active_record/devise_guests_generator.rb +++ b/lib/generators/active_record/devise_guests_generator.rb @@ -20,14 +20,13 @@ RUBY end - def rails5? - Rails.version.start_with? '5' + def rails4? + Rails.version.start_with? '4' end def migration_version - if rails5? - "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]" - end + return if rails4? + "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]" end end end
Make migrations that work with Rails 6
diff --git a/lib/generators/gitcoin_blockchain_explorer_generator.rb b/lib/generators/gitcoin_blockchain_explorer_generator.rb index abc1234..def5678 100644 --- a/lib/generators/gitcoin_blockchain_explorer_generator.rb +++ b/lib/generators/gitcoin_blockchain_explorer_generator.rb @@ -3,20 +3,12 @@ def copy_files puts 'inject routes' - inject_into_file 'config/routes.rb', :before => "draw do" do - "\n get 'blockchain', to: 'blockchain#index'\n\n" - end - inject_into_file 'config/routes.rb', :before => " get 'blockchain', to: 'blockchain#index'" do - "\n post 'blockchain/search, to: 'blockchain#search'\n\n" - end - inject_into_file 'config/routes.rb', :before => " post 'blockchain/search, to: 'blockchain#search'" do - "\n get 'blockchain/block', to 'blockchain#block'\n\n" - end - inject_into_file 'config/routes.rb', :before => " get 'blockchain/block', to 'blockchain#block'" do - "\n get 'blockchain/transaction', to 'blockchain#transaction'\n\n" - end - inject_into_file 'config/routes.rb', :before => " get 'blockchain/transaction', to 'blockchain#transaction'" do - "\n get 'blockchain/address', to 'blockchain#address'\n\n" + prepend_file 'config/environments/test.rb' do + "\n get 'blockchain', to: 'blockchain#index'\n" + "\n post 'blockchain/search, to: 'blockchain#search'\n" + "\n get 'blockchain/block', to 'blockchain#block'\n" + "\n get 'blockchain/transaction', to 'blockchain#transaction'\n" + "\n get 'blockchain/address', to 'blockchain#address'\n" end puts 'Create controller and views'
Prepend to file instead of inject.
diff --git a/helper/string.rb b/helper/string.rb index abc1234..def5678 100644 --- a/helper/string.rb +++ b/helper/string.rb @@ -0,0 +1,14 @@+# http://stackoverflow.com/questions/1235863/test-if-a-string-is-basically-an-integer-in-quotes-using-ruby +class String + def integer? + [ # In descending order of likeliness: + /^[-+]?[1-9]([0-9]*)?$/, # decimal + /^0[0-7]+$/, # octal + /^0x[0-9A-Fa-f]+$/, # hexadecimal + /^0b[01]+$/ # binary + ].each do |match_pattern| + return true if self =~ match_pattern + end + return false + end +end
Add helper method to identify integers
diff --git a/rack-jekyll.gemspec b/rack-jekyll.gemspec index abc1234..def5678 100644 --- a/rack-jekyll.gemspec +++ b/rack-jekyll.gemspec @@ -21,7 +21,7 @@ s.rubyforge_project = 'rack-jekyll' s.rubygems_version = '1.3.1' s.add_dependency 'jekyll', "~> 0.12.0" - s.add_dependency 'rack', "~> 1.4.1" + s.add_dependency 'rack', "~> 1.5.0" s.add_development_dependency('bacon') s.platform = Gem::Platform::RUBY end
Update rack to ~> 1.5.0 This will pull in the latest version of Rack in the 1.5 series
diff --git a/test/options_test.rb b/test/options_test.rb index abc1234..def5678 100644 --- a/test/options_test.rb +++ b/test/options_test.rb @@ -9,10 +9,11 @@ ) end - def test_buffer_defaults_values_are_default_options + def test_buffer_defaults_values_are_the_same_as_rails_defaults + rails_defaults = Haml::Options.defaults.merge(Haml::Template.options) Haml::Options.buffer_option_keys.each do |key| assert_equal( - Haml::Options.defaults[key], + rails_defaults[key], Haml::Options.buffer_defaults[key], "key: #{key}" ) end
Test options in Rails situation
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 @@ -25,5 +25,5 @@ end def rom - Rails.application.config.rom.env + ROM.env end
Make configuration a value object Moves all logic out of `ROM::Rails::Configuration` into the Railtie in preparation of further API changes.
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 @@ -20,6 +20,6 @@ end def appboy_test_segment - ::ENV.fetch('APPBOY_TEST_SEGMENT') + ::ENV.fetch('APPBOY_TEST_SEGMENT', 'fake-test-segment') end end
Add test 'APPBOY_TEST_SEGMENT' default value
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -4,7 +4,10 @@ SimpleCov.start if ENV['CI'] == 'true' require 'codecov' - SimpleCov.formatter = SimpleCov::Formatter::Codecov + SimpleCov.formatters = [ + SimpleCov::Formatter::HTMLFormatter, + SimpleCov::Formatter::Codecov + ] end require 'tachikoma_ai'
:green_heart: Add formatter to display the coverage report on wercker