diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/guard-notifier-blink1.gemspec b/guard-notifier-blink1.gemspec index abc1234..def5678 100644 --- a/guard-notifier-blink1.gemspec +++ b/guard-notifier-blink1.gemspec @@ -18,7 +18,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_runtime_dependency "guard", "~> 2.1" + spec.add_runtime_dependency "guard", "~> 2.9" spec.add_runtime_dependency "colorable", "~> 0.2.0" spec.add_development_dependency "bundler", "~> 1.7"
Update minimum version of Guard to 2.9 The `Guard::Notifier::SUPPORTED` constant was not available until Guard 2.9.0.
diff --git a/lib/vidibus/subdomain/extensions/controller.rb b/lib/vidibus/subdomain/extensions/controller.rb index abc1234..def5678 100644 --- a/lib/vidibus/subdomain/extensions/controller.rb +++ b/lib/vidibus/subdomain/extensions/controller.rb @@ -16,7 +16,7 @@ # Returns current subdomain. def subdomain @subdomain ||= begin - request.host_with_port.match(/^([^\.]+)/) + request.host_with_port.match(/(.+)\.#{::Service.this.domain}/) if $1 s = OpenStruct.new s.realm = $1
Exclude domain of current service from hostname to detect subdomain properly
diff --git a/jquery-lazy-images.gemspec b/jquery-lazy-images.gemspec index abc1234..def5678 100644 --- a/jquery-lazy-images.gemspec +++ b/jquery-lazy-images.gemspec @@ -13,7 +13,7 @@ This Rails engine prevents images from loading until they're actually going to be displayed. This saves bandwidth, reduces server load, and helps the user stay under their data quota." - s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"] + s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile"] s.add_dependency "rails", "~> 3.2.3"
Remove removed doc file from gemspec
diff --git a/lib/cocoapods/search/pod.rb b/lib/cocoapods/search/pod.rb index abc1234..def5678 100644 --- a/lib/cocoapods/search/pod.rb +++ b/lib/cocoapods/search/pod.rb @@ -3,6 +3,10 @@ module Cocoapods::Search class Pod attr_accessor :name, :star_count, :fork_count, :has_github + + def initialize + @has_github = false + end def score if @has_github
Fix warning: instance variable @has_github not initialized
diff --git a/KHAForm.podspec b/KHAForm.podspec index abc1234..def5678 100644 --- a/KHAForm.podspec +++ b/KHAForm.podspec @@ -1,11 +1,11 @@ Pod::Spec.new do |s| s.name = "KHAForm" - s.version = "0.5" + s.version = "0.6" s.summary = "Simple tableview form in swift" s.homepage = "https://github.com/alexsteinerde/KHAForm" s.license = { :type => "MIT", :file => "LICENSE" } - s.author = { "Kohei Hayakawa" => "kohei.hayakawa.5@gmail.com", "Alex Steiner" => "info@alexsteiner.de" } + s.author = { "Kohei Hayakawa" => "kohei.hayakawa.5@gmail.com", "Alexander Steiner" => "info@alexsteiner.de" } s.platform = :ios, "9.0" - s.source = { :git => "https://github.com/alexsteinerde/KHAForm.git", :tag => "0.5" } + s.source = { :git => "https://github.com/alexsteinerde/KHAForm.git", :tag => s.version.to_s } s.source_files = "KHAForm" end
Increase pod version and change podspec file
diff --git a/firmata.gemspec b/firmata.gemspec index abc1234..def5678 100644 --- a/firmata.gemspec +++ b/firmata.gemspec @@ -2,8 +2,8 @@ require File.expand_path('../lib/firmata/version', __FILE__) Gem::Specification.new do |gem| - gem.authors = ["'Mike Breen'"] - gem.email = ["hardbap@gmail.com"] + gem.authors = ["'Mike Breen', 'Adrian Zankich'"] + gem.email = ["info@hybridgroup.com"] gem.description = %q{A lib for working with the Firmata protocol in Ruby.} gem.summary = %q{} gem.homepage = "" @@ -11,7 +11,7 @@ gem.files = `git ls-files`.split($\) gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) - gem.name = "firmata" + gem.name = "hybridgroup-firmata" gem.require_paths = ["lib"] gem.version = Firmata::VERSION
Update some info for building from fork
diff --git a/roles/edgeuno.rb b/roles/edgeuno.rb index abc1234..def5678 100644 --- a/roles/edgeuno.rb +++ b/roles/edgeuno.rb @@ -2,6 +2,11 @@ description "Role applied to all servers at Edgeuno" default_attributes( + :accounts => { + :users => { + :e1admin => { :status => :administrator } + } + }, :hosted_by => "EdgeUno", :location => "Bogotá, Colombia", :networking => {
Add remote hands account for Edgeuno
diff --git a/recipes/mongodb.rb b/recipes/mongodb.rb index abc1234..def5678 100644 --- a/recipes/mongodb.rb +++ b/recipes/mongodb.rb @@ -17,6 +17,12 @@ # limitations under the License. # +# Install dependencies needed to compile `mongo` ruby gem. +# @see https://sethvargo.com/using-gems-with-chef/ +package 'libsasl2-dev' do + action :nothing +end.run_action(:install) + include_recipe "mongodb" include_recipe "mongodb::user_management"
Install library needed to compile `mongo` ruby gem
diff --git a/recipes/smartos.rb b/recipes/smartos.rb index abc1234..def5678 100644 --- a/recipes/smartos.rb +++ b/recipes/smartos.rb @@ -18,7 +18,7 @@ # # for backwards compatibility with older datasets -if !system("pkgin avail | grep build-essential") +if !system("pkgin -y avail | grep build-essential") packages = %w( gcc47 gcc47-runtime
Allow database to update w/o interaction
diff --git a/lib/faker/default/esport.rb b/lib/faker/default/esport.rb index abc1234..def5678 100644 --- a/lib/faker/default/esport.rb +++ b/lib/faker/default/esport.rb @@ -3,22 +3,67 @@ module Faker class Esport < Base class << self + ## + # Produces the name of a professional eSports player. + # + # @return [String] + # + # @example + # Faker::Esport.player #=> "Crimsix" + # + # @faker.version 1.7.0 def player fetch('esport.players') end + ## + # Produces the name of an eSports team. + # + # @return [String] + # + # @example + # Faker::Esport.team #=> "CLG" + # + # @faker.version 1.7.0 def team fetch('esport.teams') end + ## + # Produces the name of an eSports league. + # + # @return [String] + # + # @example + # Faker::Esport.league #=> "IEM" + # + # @faker.version 1.7.0 def league fetch('esport.leagues') end + ## + # Produces the name of an eSports event. + # + # @return [String] + # + # @example + # Faker::Esport.event #=> "ESL Cologne" + # + # @faker.version 1.7.0 def event fetch('esport.events') end + ## + # Produces the name of a game played as an eSport. + # + # @return [String] + # + # @example + # Faker::Esport.game #=> "Dota 2" + # + # @faker.version 1.7.0 def game fetch('esport.games') end
Add YARD docs for Faker::Esport
diff --git a/spec/config_spec.rb b/spec/config_spec.rb index abc1234..def5678 100644 --- a/spec/config_spec.rb +++ b/spec/config_spec.rb @@ -3,6 +3,17 @@ describe Confoog::Settings do subject {Confoog::Settings.new} + + before(:all) do + # create an internal STDERR so we can still test this but it will not + # clutter up the output + $original_stderr = $stderr + $stderr = StringIO.new + end + + after(:all) do + $stderr = $original_stderr + end it "should allow the setting of arbitrary value pairs of any type" do subject[:first] = "testing a string"
Add missing before(:all) and after(:all) to one rspec file Add to spec/config_spec.rb to silence console output during testing [ci skip] Signed-off-by: Seapagan <4ab1b2fdb7784a8f9b55e81e3261617f44fd0585@gmail.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 @@ -5,6 +5,6 @@ require 'clean_files' -Spec::Runner.configure do |config| +RSpec.configure do |config| end
Use new rspec configuration syntax
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 @@ -2,3 +2,13 @@ $: << File.join(File.dirname(__FILE__), "/../../lib" ) require 'cucumber_priority' + +if defined?(RSpec) + RSpec.configure do |config| + if config.respond_to?(:expect_with) + config.expect_with(:rspec) do |c| + c.syntax = [:expect, :should] + end + end + end +end
Remove deprecation warnings in new RSpecs
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 @@ -9,6 +9,8 @@ name = 'vidibus-gem_template_test' host = 'localhost' config.master = Mongo::Connection.new.db(name) + # Display MongoDB logs for debugging: + # config.master = Mongo::Connection.new("localhost", 27017, :logger => Logger.new($stdout, :info)).db(name) config.logger = nil end
Add a configuration example for enabling MongoDB logging
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,2 +1,3 @@ $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__) require "franklin" +require "pry"
Add pry when runnign specs
diff --git a/app/controllers/cangaroo/endpoint_controller.rb b/app/controllers/cangaroo/endpoint_controller.rb index abc1234..def5678 100644 --- a/app/controllers/cangaroo/endpoint_controller.rb +++ b/app/controllers/cangaroo/endpoint_controller.rb @@ -41,14 +41,19 @@ def key if Rails.configuration.cangaroo.basic_auth user, pass = ActionController::HttpAuthentication::Basic::user_name_and_password(request) - pass + user else request.headers['X-Hub-Store'] end end def token - request.headers['X-Hub-Access-Token'] + if Rails.configuration.cangaroo.basic_auth + user, pass = ActionController::HttpAuthentication::Basic::user_name_and_password(request) + pass + else + request.headers['X-Hub-Access-Token'] + end end end end
Support basic auth on push endpoint
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,4 +1,4 @@-if ENV["CODECLIMATE_REPO_TOKEN"] +if ENV["CC_TEST_REPORTER_ID"] require "simplecov" SimpleCov.start end
Use correct ENV Var for CodeClimate
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 @@ -16,6 +16,9 @@ end RSpec.configure do |config| + config.filter_run :focus => true + config.run_all_when_everything_filtered = true + # In RSpec 3 this will no longer be necessary. config.treat_symbols_as_metadata_keys_with_true_values = true end
Add support for :focus metadata filtering in rspec This is just a convenience to allow isolated tests to be run by adding :focus to the example or example group metadata.
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,8 @@ RSpec.configure do |config| config.include(RDF::Spec::Matchers) + config.filter_run :focus => true + config.run_all_when_everything_filtered = true config.exclusion_filter = {:ruby => lambda { |version| RUBY_VERSION.to_s !~ /^#{version}/ }}
Add RSpec filter configurations to allow running just focused 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 @@ -1,5 +1,12 @@+require 'simplecov' require 'coveralls' -Coveralls.wear! + +SimpleCov.formatter = Coveralls::SimpleCov::Formatter +if ENV['TRAVIS_CI'].nil? + SimpleCov.start +else + SimpleCov.start { add_filter 'lib/ovchipkaart/scraper.rb' } +end require 'ovchipkaart'
Exclude the scraper for SimpleCov if ENV is TRAVIS_CI
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,10 +8,6 @@ config.treat_symbols_as_metadata_keys_with_true_values = true config.filter_run_excluding do_not_run_in_transpeced_spec: ENV['TRANSPECED_SPEC'] -end - -Dir[File.join(File.dirname(__FILE__), 'support', '*')].each do |path| - require path end require 'simplecov' @@ -29,3 +25,7 @@ add_filter '/spec/' add_filter '/vendor/bundle/' end + +Dir[File.join(File.dirname(__FILE__), 'support', '*')].each do |path| + require path +end
Fix coverage of some spec files was not measured
diff --git a/greeklish.gemspec b/greeklish.gemspec index abc1234..def5678 100644 --- a/greeklish.gemspec +++ b/greeklish.gemspec @@ -8,9 +8,9 @@ spec.version = Greeklish::VERSION spec.authors = ["Petros Markou"] spec.email = ["markoupetr@skroutz.gr"] - spec.summary = %q{TODO: Write a short summary. Required.} - spec.description = %q{TODO: Write a longer description. Optional.} - spec.homepage = "" + spec.summary = %q{Generates greeklish forms} + spec.description = %q{Configurable generator of Greek words to greeklish forms.} + spec.homepage = "https://github.com/skroutz/greeklish" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0")
Update summary, description and homepage in gemspec
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 "pry" require "support/sequel_test_support" +require "support/blog_schema" RSpec.configure do |config| config.expect_with :rspec do |expectations| @@ -29,6 +30,7 @@ # Kernel.srand config.seed config.before(:suite) do - SequelMapper::SequelTestSupport.truncate_tables + SequelMapper::SequelTestSupport.drop_tables + SequelMapper::SequelTestSupport.create_tables(BLOG_SCHEMA) end end
Drop and recreate schema before test run The performance hit is not so bad for the convenience it provides.
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 @@ -28,9 +28,6 @@ RSpec.configure do |config| - config.filter_run :focus => true - config.run_all_when_everything_filtered = true - config.after(:each) do if example.metadata[:example_group][:file_path] =~ /unit|shared/ DM_ENV.reset
Remove unused rspec :focus metadata configuration I actually remember that being kinda dangerous from app development. If you happen to forget to remove a :focus flag, only the focused tests will be run. During library development, I found myself simply running the specs in question explicitly, using something like: bundle exec rspec -cfs spec/file/path
diff --git a/bm/minitest_example.rb b/bm/minitest_example.rb index abc1234..def5678 100644 --- a/bm/minitest_example.rb +++ b/bm/minitest_example.rb @@ -0,0 +1,33 @@+require 'minitest/unit' +require 'minitest/autorun' + +class ShowThemHowToBeatIt < MiniTest::Unit::TestCase + + # will fail + def test_show_them_how_to_funky + refute_equal("funky", "funky") + end + + # will pass + def test_show_them_whats_right + assert_equal("right", "right") + end + + # will error + def test_no_one_wants_to_be_defeated + raise SyntaxError + end + + # pending + def test_better_do_what_you_can + raise NotImplementedError + end + + # omit + def test_just_beat_it + e = NotImplementedError.new + #e.set_assertion(true) + raise e + end + +end
Add a minitest example for comparison. [test]
diff --git a/lib/action_subscriber/middleware/error_handler.rb b/lib/action_subscriber/middleware/error_handler.rb index abc1234..def5678 100644 --- a/lib/action_subscriber/middleware/error_handler.rb +++ b/lib/action_subscriber/middleware/error_handler.rb @@ -8,26 +8,10 @@ end def call(env) - job_mutex = ::Mutex.new - job_complete = ::ConditionVariable.new - - job_mutex.synchronize do - ::Thread.new do - job_mutex.synchronize do - begin - @app.call(env) - rescue => error - logger.error "FAILED #{env.message_id}" - ::ActionSubscriber.configuration.error_handler.call(error, env.to_h) - ensure - job_complete.signal - end - end - end - - # TODO we might want to pass a timeout to this wait so we can handle jobs that get frozen - job_complete.wait(job_mutex) - end + @app.call(env) + rescue => error + logger.error "FAILED #{env.message_id}" + ::ActionSubscriber.configuration.error_handler.call(error, env.to_h) end end end
Remove extra thread in error handler - already in a threadpool
diff --git a/lib/arbetsformedlingen/codes/municipality_code.rb b/lib/arbetsformedlingen/codes/municipality_code.rb index abc1234..def5678 100644 --- a/lib/arbetsformedlingen/codes/municipality_code.rb +++ b/lib/arbetsformedlingen/codes/municipality_code.rb @@ -22,8 +22,10 @@ name.to_s.strip end - def self.to_form_array - CODE_MAP.to_a + def self.to_form_array(name_only: false) + return CODE_MAP.to_a unless name_only + + CODE_MAP.to_a.map { |name| [name, name] } end end end
Add Municipality::to_form_array method name_only option
diff --git a/lib/generators/sauce/install/install_generator.rb b/lib/generators/sauce/install/install_generator.rb index abc1234..def5678 100644 --- a/lib/generators/sauce/install/install_generator.rb +++ b/lib/generators/sauce/install/install_generator.rb @@ -41,7 +41,6 @@ require 'sauce' Sauce.config do |conf| - conf.browser_url = "http://#{@random_id}.test/" conf.browsers = [ ["Windows 2003", "firefox", "3.6."] ]
Remove the unnecessary fake domain nonsense from the Rails2 generator Fixes #56
diff --git a/app/models/manageiq/providers/google/regions.rb b/app/models/manageiq/providers/google/regions.rb index abc1234..def5678 100644 --- a/app/models/manageiq/providers/google/regions.rb +++ b/app/models/manageiq/providers/google/regions.rb @@ -3,6 +3,11 @@ module Regions # From https://cloud.google.com/compute/docs/zones REGIONS = { + "us-east1" => { + :name => "us-east1", + :hostname => "us-east1", + :description => "Eastern US", + }, "us-central1" => { :name => "us-central1", :hostname => "us-central1",
Add the new Eastern US region to GCE
diff --git a/lib/tasks/move_primary_section_into_taggable.rake b/lib/tasks/move_primary_section_into_taggable.rake index abc1234..def5678 100644 --- a/lib/tasks/move_primary_section_into_taggable.rake +++ b/lib/tasks/move_primary_section_into_taggable.rake @@ -1,5 +1,5 @@ namespace :migrate do - desc "Populate tag objects with parent ids" + desc "Copy data from attr primary_section to taggable primary_section" task :move_primary_section_into_taggable => :environment do Artefact.all.each do |artefact| unless artefact.attributes['primary_section'].nil?
Update desc to be relevant & accurate
diff --git a/app/controllers/task_comments_controller.rb b/app/controllers/task_comments_controller.rb index abc1234..def5678 100644 --- a/app/controllers/task_comments_controller.rb +++ b/app/controllers/task_comments_controller.rb @@ -20,7 +20,7 @@ @task = Task.find(params[:task_id]) @comment = @task.comments.find(params[:id]) if @comment.destroy - redirect_to project_posts_path(session[:project_id]) + redirect_to project_task_path(session[:project_id],@task) end end
Comment added to task show to view single task comment
diff --git a/lib/thinking_sphinx/test.rb b/lib/thinking_sphinx/test.rb index abc1234..def5678 100644 --- a/lib/thinking_sphinx/test.rb +++ b/lib/thinking_sphinx/test.rb @@ -4,9 +4,9 @@ config.settings['quiet_deltas'] = suppress_delta_output end - def self.start + def self.start(options = {}) config.render_to_file - config.controller.index + config.controller.index if options[:index].nil? || options[:index] config.controller.start end @@ -35,6 +35,15 @@ end end + def self.clear + [ + config.indices_location, + config.searchd.binlog_path + ].each do |path| + FileUtils.rm_r(path) if File.exists?(path) + end + end + def self.config @config ||= ::ThinkingSphinx::Configuration.instance end
Add clear method and no-index option for start to ThinkingSphinx::Test.
diff --git a/spec/exchanges/bitconnect/integration/market_spec.rb b/spec/exchanges/bitconnect/integration/market_spec.rb index abc1234..def5678 100644 --- a/spec/exchanges/bitconnect/integration/market_spec.rb +++ b/spec/exchanges/bitconnect/integration/market_spec.rb @@ -14,8 +14,8 @@ end it 'fetch ticker' do - btc_bcc_pair = Cryptoexchange::Models::MarketPair.new(base: 'BTC', target: 'BCC', market: 'bitconnect') - ticker = client.ticker(btc_bcc_pair) + pair = Cryptoexchange::Models::MarketPair.new(base: 'BTC', target: 'BCC', market: 'bitconnect') + ticker = client.ticker(pair) expect(ticker.base).to eq 'BTC' expect(ticker.target).to eq 'BCC'
Refactor longer varname to pair
diff --git a/QRSwift.podspec b/QRSwift.podspec index abc1234..def5678 100644 --- a/QRSwift.podspec +++ b/QRSwift.podspec @@ -15,6 +15,7 @@ s.ios.deployment_target = "9.0" s.osx.deployment_target = "10.11" + s.tvos.deployment_target = "10" s.source = { :git => "https://github.com/chrisamanse/QRSwift.git", :tag => "#{s.version}" }
Add tvos deployment target in podspec
diff --git a/spec/unit/concurrent/synchronized_sorted_set_spec.rb b/spec/unit/concurrent/synchronized_sorted_set_spec.rb index abc1234..def5678 100644 --- a/spec/unit/concurrent/synchronized_sorted_set_spec.rb +++ b/spec/unit/concurrent/synchronized_sorted_set_spec.rb @@ -1,34 +1,36 @@ require "spec_helper" require "bunny/concurrent/synchronized_sorted_set" -describe Bunny::Concurrent::SynchronizedSortedSet do - it "synchronizes common operations needed by Bunny" do - s = described_class.new - s.length.should == 0 +unless ENV["CI"] + describe Bunny::Concurrent::SynchronizedSortedSet do + it "synchronizes common operations needed by Bunny" do + s = described_class.new + s.length.should == 0 - 10.times do - Thread.new do - s << 1 - s << 1 - s << 2 - s << 3 - s << 4 - s << 4 - s << 4 - s << 4 - s << 5 - s << 5 - s << 5 - s << 5 - s << 6 - s << 7 - s << 8 - s.delete 8 - s.delete_if { |i| i == 1 } + 10.times do + Thread.new do + s << 1 + s << 1 + s << 2 + s << 3 + s << 4 + s << 4 + s << 4 + s << 4 + s << 5 + s << 5 + s << 5 + s << 5 + s << 6 + s << 7 + s << 8 + s.delete 8 + s.delete_if { |i| i == 1 } + end end + sleep 2.0 + + s.length.should == 6 end - sleep 3.0 - - s.length.should == 6 end end
Exclude this test from CI
diff --git a/app/validators/status_prerequisite_validator.rb b/app/validators/status_prerequisite_validator.rb index abc1234..def5678 100644 --- a/app/validators/status_prerequisite_validator.rb +++ b/app/validators/status_prerequisite_validator.rb @@ -1,15 +1,25 @@ class StatusPrerequisiteValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) if value == "scheduled" - return true if record.has_draft? && record.scheduled_at.present? + return true if can_be_scheduled?(record) record.errors[attribute] << "#{value}, requires a draft and scheduled_at date to be present" end if value == "submitted_for_2i" - return true if record.has_draft? && record.review_requester_id.present? + return true if can_be_submitted_for_2i?(record) record.errors[attribute] << "#{value}, requires a draft and review_requester_id to be present" end end + +private + + def can_be_scheduled?(record) + record.has_draft? && record.scheduled_at.present? + end + + def can_be_submitted_for_2i?(record) + record.has_draft? && record.review_requester_id.present? + end end
Refactor the status prerequisite validator
diff --git a/spec/models/tag_spec.rb b/spec/models/tag_spec.rb index abc1234..def5678 100644 --- a/spec/models/tag_spec.rb +++ b/spec/models/tag_spec.rb @@ -2,7 +2,7 @@ RSpec.describe Tag, type: :model do describe 'tag associations' do - it { is_expected.to have_many(:pintags)} + xit { is_expected.to have_many(:pintags)} it { is_expected.to validate_presence_of(:label) } end end
Put test in pending - tag is expected to have many pintags
diff --git a/envryo.gemspec b/envryo.gemspec index abc1234..def5678 100644 --- a/envryo.gemspec +++ b/envryo.gemspec @@ -18,6 +18,8 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] + spec.add_runtime_dependency "evernote_oauth", "~> 0.2" + spec.add_development_dependency "bundler", "~> 1.6" spec.add_development_dependency "rake" spec.add_development_dependency "rspec"
Add evernote_oauth as runtime dependency
diff --git a/spec/support/samples.rb b/spec/support/samples.rb index abc1234..def5678 100644 --- a/spec/support/samples.rb +++ b/spec/support/samples.rb @@ -5,7 +5,7 @@ def sample_fitness_evaluator fitness_evaluator = Object.new def fitness_evaluator.fitness(params) - params.each_value.inject(:*) || 1 + params.map { |hash| hash.each_value.reduce(:*) }.reduce(:*) || 1 end fitness_evaluator
Fix sample fitness evaluator to use array of hashes
diff --git a/spec/unit/timer_spec.rb b/spec/unit/timer_spec.rb index abc1234..def5678 100644 --- a/spec/unit/timer_spec.rb +++ b/spec/unit/timer_spec.rb @@ -24,6 +24,6 @@ # busy work end - expect(yielded.size).to be >= 3 + expect(yielded.size).to be >= 2 end end
Change to ensure passes on old rubies and windows
diff --git a/app/helpers/rawnet_admin/resource_helper.rb b/app/helpers/rawnet_admin/resource_helper.rb index abc1234..def5678 100644 --- a/app/helpers/rawnet_admin/resource_helper.rb +++ b/app/helpers/rawnet_admin/resource_helper.rb @@ -15,7 +15,7 @@ confirm: "Are you sure?" } }.merge(options) - icon_link_to 'Delete', route, 'trash', options + icon_link_to text, route, 'trash', options end def view_link_to(route, text="View", options={})
Allow changing of delete link text
diff --git a/lib/active_admin/engine.rb b/lib/active_admin/engine.rb index abc1234..def5678 100644 --- a/lib/active_admin/engine.rb +++ b/lib/active_admin/engine.rb @@ -1,7 +1,8 @@ # frozen_string_literal: true module ActiveAdmin class Engine < ::Rails::Engine - initializer "active_admin.load_app_path" do |app| + # Set default values for app_path and load_paths before running initializers + initializer "active_admin.load_app_path", before: :load_config_initializers do |app| ActiveAdmin::Application.setting :app_path, app.root ActiveAdmin::Application.setting :load_paths, [File.expand_path("app/admin", app.root)] end
Support specs running with config.eager_load=true `ActiveAdmin::Aplication.remove_active_admin_load_paths_from_rails_autoload_and_eager_load` is not working on feature tests. Starting from Rails 7.0, running tests with eager_load enabled produces the following error: ``` Failure/Error: require "#{ActiveAdmin::TestApplication.new.full_app_dir}/config/environment.rb" FrozenError: can't modify frozen Array: ["<root>/tmp/test_apps/rails_70/app/admin", "<root>/tmp/test_apps/rails_70/app/channels", "<root>/tmp/test_apps/rails_70/app/controllers", "<root>/tmp/test_apps/rails_70/app/controllers/concerns", "<root>/tmp/test_apps/rails_70/app/helpers", "<root>/tmp/test_apps/rails_70/app/jobs", "<root>/tmp/test_apps/rails_70/app/mailers", "<root>/tmp/test_apps/rails_70/app/models", "<root>/tmp/test_apps/rails_70/app/models/concerns", "<root>/tmp/test_apps/rails_70/app/policies" ``` `ActiveAdmin::Aplication.remove_active_admin_load_paths_from_rails_autoload_and_eager_load` fails because `ActiveAdmin.application.load_paths` value is `<root>/app/admin` when it should be `<root>/tmp/test_apps/rails_70/app/admin`. `ActiveAdmin::ApplicationSettings` initialize `load_path` with `[File.expand_path("app/admin", Rails.root)]`. On testing app bootstrap ([this line](https://github.com/activeadmin/activeadmin/blob/master/features/support/env.rb#L12)) `Rails.root` is nil and `File.expand_path` is expanding to the folder where `rake test` runs (`<root>`). `ActiveAdmin::Engine` has an initializer to define default value for `load_paths`. The problem is that the block runs after initializers in `config/initializers` folder, including `ActiveAdmin.setup` where `ActiveAdmin::Aplication.remove_active_admin_load_paths_from_rails_autoload_and_eager_load` is called from. This commit makes sure the block runs before `config/initializers`. That way the block sets a proper default.
diff --git a/SwiftySwift.podspec b/SwiftySwift.podspec index abc1234..def5678 100644 --- a/SwiftySwift.podspec +++ b/SwiftySwift.podspec @@ -6,8 +6,30 @@ s.license = { :type => 'MIT' } s.authors = { "Agustin de Cabrera" => "agustindc@gmail.com" } s.source = { :git => "https://github.com/adeca/SwiftySwift.git", :tag => s.version.to_s } - s.source_files = 'SwiftySwift/*.swift' s.requires_arc = true s.platform = :ios, '8.0' s.ios.deployment_target = "8.0" + + s.subspec 'Core' do |sub| + sub.source_files = 'SwiftySwift/SwiftySwift.swift' + end + + s.subspec 'Cocoa' do |sub| + sub.source_files = 'SwiftySwift/SwiftyCocoa.swift' + sub.dependency 'SwiftySwift/Core' + end + + s.subspec 'Geometry' do |sub| + sub.source_files = 'SwiftySwift/SwiftyGeometry.swift' + sub.dependency 'SwiftySwift/Core' + end + + s.subspec 'UIKit' do |sub| + sub.source_files = 'SwiftySwift/SwiftyUIKit.swift' + sub.dependency 'SwiftySwift/Cocoa' + end + + s.subspec 'MultiRange' do |sub| + sub.source_files = 'SwiftySwift/MultiRange.swift' + end end
Split Podfile spec into several sub-specs.
diff --git a/app/views/live/events/_event_data.json.ruby b/app/views/live/events/_event_data.json.ruby index abc1234..def5678 100644 --- a/app/views/live/events/_event_data.json.ruby +++ b/app/views/live/events/_event_data.json.ruby @@ -1,6 +1,7 @@ { eventId: @event.id, eventName: @event.name, + multiLap: @event.multiple_laps?, splits: @event.ordered_splits.map do |split| { id: split.id,
Add multiLap key to _event_data JSON response
diff --git a/SwiftKeychainWrapper.podspec b/SwiftKeychainWrapper.podspec index abc1234..def5678 100644 --- a/SwiftKeychainWrapper.podspec +++ b/SwiftKeychainWrapper.podspec @@ -1,9 +1,9 @@ Pod::Spec.new do |s| s.name = 'SwiftKeychainWrapper' - s.version = '2.0.0' - s.summary = 'Static wrapper for the iOS Keychain written in Swift.' + s.version = '2.0.0' + s.summary = 'Wrapper for the iOS Keychain written in Swift.' s.description = <<-DESC - A simple static wrapper for the iOS Keychain to allow you to use it in a similar fashion to NSUserDefaults. Supports Access Groups. Written in Swift.' + A simple wrapper for the iOS Keychain to allow you to use it in a similar fashion to NSUserDefaults. Supports Access Groups. Written in Swift.' DESC s.module_name = "SwiftKeychainWrapper" s.homepage = 'https://github.com/jrendel/SwiftKeychainWrapper'
Update to pod spec description
diff --git a/week-4/address/my_solution.rb b/week-4/address/my_solution.rb index abc1234..def5678 100644 --- a/week-4/address/my_solution.rb +++ b/week-4/address/my_solution.rb @@ -4,3 +4,6 @@ # Your Solution Below +def make_address(street, city, state, zip) + return "You live at #{street}, in the beautiful city of #{city}, #{state}. Your zip is #{zip.to_s}." +end
Complete the answer for 4.3.1 Return A Formatted Address.
diff --git a/scripts/list-routes.rb b/scripts/list-routes.rb index abc1234..def5678 100644 --- a/scripts/list-routes.rb +++ b/scripts/list-routes.rb @@ -0,0 +1,32 @@+#!/usr/bin/env ruby + +require 'json' +require 'set' + +routes_by_domain_url = {} + +page = JSON.parse `cf curl '/v2/routes?results-per-page=100'` +next_url = page["next_url"] + +while next_url + page = JSON.parse `cf curl '#{next_url}'` + page['resources'].map do |resource| + host = resource.dig('entity', 'host') + unless host.empty? + domain_url = resource.dig('entity', 'domain_url') + if routes_by_domain_url.include? domain_url + routes_by_domain_url[domain_url] << host + else + routes_by_domain_url[domain_url] = [host].to_set + end + end + end + next_url = page["next_url"] +end + +routes_by_domain_url.each do |url, hosts| + domain = JSON.parse(`cf curl '#{url}'`).dig('entity', 'name') + hosts.each do |host| + puts "https://#{host}.#{domain}" + end +end
Add a script to list the routes in a region This may be useful when we're trying to understand what things are running on the platform. Possible future improvements: - send a `dig` to custom domains to see if DNS is actually setup - send an HTTP request to the domain to see if it's serving 200s [skip-ci]
diff --git a/safeword.gemspec b/safeword.gemspec index abc1234..def5678 100644 --- a/safeword.gemspec +++ b/safeword.gemspec @@ -27,4 +27,6 @@ spec.add_development_dependency 'pry', '~> 0.10' spec.add_development_dependency 'rake', '~> 11.2' spec.add_development_dependency 'rspec', '~> 3.5' + spec.add_development_dependency 'rubocop', '~> 0.46' + spec.add_development_dependency 'rubocop-rspec', '~> 1.8' end
Add Rubocop to help keep the codebase healthy
diff --git a/test/functional/repos_controller_test.rb b/test/functional/repos_controller_test.rb index abc1234..def5678 100644 --- a/test/functional/repos_controller_test.rb +++ b/test/functional/repos_controller_test.rb @@ -22,8 +22,10 @@ test 'logged in user can create repo' do sign_in users(:mockstar) - assert_difference -> { Repo.count } do - post :create, repo: { name: 'refinerycms', user_name: 'refinery' } + VCR.use_cassette "create_repo_refinery", record: :once do + assert_difference -> { Repo.count } do + post :create, repo: { name: 'refinerycms', user_name: 'refinery' } + end end assert_redirected_to repo_path('refinery/refinerycms')
Use VCR cassete so tests will pass on travis
diff --git a/lib/specter.rb b/lib/specter.rb index abc1234..def5678 100644 --- a/lib/specter.rb +++ b/lib/specter.rb @@ -3,5 +3,11 @@ require 'clap' class Specter - # Your code goes here... + def patterns + @patterns ||= [] + end + + def filenames + Dir[*patterns] + end end
Handle file patterns and names.
diff --git a/db/migrate/033_change_diary_entries_language.rb b/db/migrate/033_change_diary_entries_language.rb index abc1234..def5678 100644 --- a/db/migrate/033_change_diary_entries_language.rb +++ b/db/migrate/033_change_diary_entries_language.rb @@ -1,7 +1,7 @@ class ChangeDiaryEntriesLanguage < ActiveRecord::Migration def self.up remove_column "diary_entries", "language" - add_column "diary_entries", "language_code", :string + add_column "diary_entries", "language_code", :string, :null => false, :default => "en" end def self.down
Tweak migration to ensure that migrating from a database with existing diary entries sets a default language for those entries.
diff --git a/settings.gemspec b/settings.gemspec index abc1234..def5678 100644 --- a/settings.gemspec +++ b/settings.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'settings' - s.version = '0.1.3' + s.version = '0.1.4' s.summary = 'Settings data access and assignment' s.description = ' '
Package version increased from 0.1.3 to 0.1.4
diff --git a/app/models/setup/deletion.rb b/app/models/setup/deletion.rb index abc1234..def5678 100644 --- a/app/models/setup/deletion.rb +++ b/app/models/setup/deletion.rb @@ -5,9 +5,10 @@ build_in_data_type def run(message) - if (model = data_type_from(message).records_model) + data_type = data_type_from(message) + if (model = data_type.records_model) scope = objects_from(message) - destroy_callback = + destroy_callback = data_type.is_a?(FileDataType) || begin model.send(:get_callbacks, :destroy).present? rescue
Fix | Deletion of multiples files records
diff --git a/test/api/override_test.rb b/test/api/override_test.rb index abc1234..def5678 100644 --- a/test/api/override_test.rb +++ b/test/api/override_test.rb @@ -26,11 +26,12 @@ end test "make sure modules can overwrite I18n methods" do - @I18n.extend OverrideInverse + @I18n.extend OverrideInverse @I18n.backend.store_translations('en', :foo => 'bar') assert_equal 'rab', @I18n.translate(:foo, :locale => 'en') - assert_equal 'rab', @I18n.t(:foo, :locale => 'en') + # FIXME: this fails under 1.8.7 + # assert_equal 'rab', @I18n.t(:foo, :locale => 'en') assert_equal 'rab', @I18n.translate!(:foo, :locale => 'en') assert_equal 'rab', @I18n.t!(:foo, :locale => 'en') end
Fix the build bu disabling a 1.8.7 specific test
diff --git a/test/spec/upstart_spec.rb b/test/spec/upstart_spec.rb index abc1234..def5678 100644 --- a/test/spec/upstart_spec.rb +++ b/test/spec/upstart_spec.rb @@ -0,0 +1,51 @@+# +# Copyright 2015, Noah Kantrowitz +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require 'spec_helper' + +describe PoiseService::Providers::Upstart do + service_provider('upstart') + step_into(:poise_service) + before do + allow_any_instance_of(described_class).to receive(:notifying_block) {|&block| block.call } + end + + let(:chefspec_options) { { platform: 'ubuntu', version: '14.04'} } + + recipe do + poise_service 'test' do + command 'myapp --serve' + end + end + + it { is_expected.to render_file('/etc/init/test.conf').with_content(<<-EOH) } +# test generated by poise-service + +description "test" + +start on runlevel [2345] +stop on runlevel [!2345] + +respawn +respawn limit 10 5 +umask 022 +setuid root +chdir / +kill signal TERM + +exec myapp --serve +EOH +end
Add a test for upstart template rendering.
diff --git a/test/test_registration.rb b/test/test_registration.rb index abc1234..def5678 100644 --- a/test/test_registration.rb +++ b/test/test_registration.rb @@ -17,17 +17,17 @@ def test_registered # all these class names must appear once in enumerate class names - classes = [ "RCP_ComputerSystem.mof", - "RCP_OperatingSystem.mof", - "RCP_OSProcess.mof", - "RCP_PhysicalMemory.mof", - "RCP_Processor.mof", - "RCP_RunningOS.mof", - "RCP_UnixProcess.mof" + classes = [ "RCP_ComputerSystem", + "RCP_OperatingSystem", + "RCP_OSProcess", + "RCP_PhysicalMemory", + "RCP_Processor", + "RCP_RunningOS", + "RCP_UnixProcess" ] - @client.class_names(@op).each do |name| - assert classes.delete(name) + @client.class_names(@op, Sfcc::Flags::DeepInheritance).each do |name| + classes.delete(name.to_s) end assert_equal [], classes end
Fix registration test, add DeepInheritance
diff --git a/lib/apiuri.rb b/lib/apiuri.rb index abc1234..def5678 100644 --- a/lib/apiuri.rb +++ b/lib/apiuri.rb @@ -0,0 +1,23 @@+require 'uri' + +class ApiUri + VENDOR_HOST = "api.replicated.com" + VENDOR_BASE_PATH = "/vendor/v1" + + def self.build_uri(module_name, endpoint = nil, params = nil) + uri_base = "https://" << VENDOR_HOST + uri = URI(uri_base) + + path = VENDOR_BASE_PATH << "/" << module_name + if endpoint + path = path << "/" << endpoint + end + uri.path = path + + if params + uri.query = URI.encode_www_form(params) + end + + return uri + end +end
Add a class to build a URI object This uses the standard format for the Replicated Vendor API to build up a uri object for an endpoint. With this simplified interface, the request client can be simplified, and the API modules only need to be concerned with building the correct `endpoint` string.
diff --git a/spec/lib/stellar/price_spec.rb b/spec/lib/stellar/price_spec.rb index abc1234..def5678 100644 --- a/spec/lib/stellar/price_spec.rb +++ b/spec/lib/stellar/price_spec.rb @@ -4,7 +4,7 @@ subject{ Stellar::Price } let(:seed){ 225571644875421139403973254661022579608 } #generated using Random.new let(:random){ Random.new(seed) } - let(:iterations){ ENV["SMOKE_ITERATIONS"].present? ? ENV["SMOKE_ITERATIONS"] : 2000} + let(:iterations){ ENV["SMOKE_ITERATIONS"].present? ? ENV["SMOKE_ITERATIONS"].to_i : 2000} it "withstands a random smoke test" do iterations.times do |i|
Fix SMOKE_ITERATIONS for test suite
diff --git a/spec/local_vm_requests_spec.rb b/spec/local_vm_requests_spec.rb index abc1234..def5678 100644 --- a/spec/local_vm_requests_spec.rb +++ b/spec/local_vm_requests_spec.rb @@ -3,7 +3,9 @@ # TODO - Global vars are so bad. Do this better. describe "VMRequests" do - it "creates a VM" + it "creates a VM" do + get_compute(:local).local_create_vm((ENV['LOCAL_TEST_VM_NAME'] || 'precise64'), 'spec-test-vm') + end it "lists available vms" do res = get_compute(:local).local_list_defined_vms
Add spec to create VM.
diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index abc1234..def5678 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -18,6 +18,7 @@ # Install module and dependencies hosts.each do |host| copy_module_to(host, source: proj_root, module_name: 'resolv') + on host, puppet('module install puppet-extlib'), acceptable_exit_codes: [0, 1] on host, puppet('module install puppetlabs-stdlib'), acceptable_exit_codes: [0, 1] end end
Add missing dependency for Beaker tests
diff --git a/snitcher.gemspec b/snitcher.gemspec index abc1234..def5678 100644 --- a/snitcher.gemspec +++ b/snitcher.gemspec @@ -8,8 +8,8 @@ spec.version = Snitcher::VERSION spec.author = "Collective Idea" - spec.email = "info@collectiveidea.com" - spec.homepage = "https://github.com/collectiveidea/snitcher" + spec.email = "hi@deadmanssnitch.com" + spec.homepage = "https://github.com/deadmanssnitch/snitcher" spec.summary = "Simple API client for deadmanssnitch.com" spec.license = "MIT"
Update link and email address for new github org. We've moved the code from collectiveidea to deadmanssnitch so we should reflect that in the gemspec.
diff --git a/services/importer/spec/factories/pg_connection.rb b/services/importer/spec/factories/pg_connection.rb index abc1234..def5678 100644 --- a/services/importer/spec/factories/pg_connection.rb +++ b/services/importer/spec/factories/pg_connection.rb @@ -9,7 +9,7 @@ module Factories class PGConnection def initialize(options = {}) - @options = SequelRails.configuration.environment_for(Rails.env).merge(options) + @options = read_config.merge(options) create_db if options[:create_db] end @@ -23,11 +23,19 @@ private + def read_config + begin + load_from_json + rescue + load_from_yml + end + end + def create_db begin - connection.run("CREATE DATABASE \"#{@options[:create_db]}\" + connection.run("CREATE DATABASE \"#{ @options[:create_db] }\" WITH TEMPLATE = template_postgis - OWNER = #{@options[:username]} + OWNER = #{ @options[:user] } ENCODING = 'UTF8' CONNECTION LIMIT=-1") rescue Sequel::DatabaseError => e @@ -39,6 +47,29 @@ raise unless e.message =~ /extension \"postgis\" already exists/ end end + + def load_from_json + json_config = File.join(File.dirname("#{__FILE__}"), 'database.json') + ::JSON.parse(File.read(json_config)).each_with_object({}){ |(k,v), h| + h[k.to_sym] = v + } + end + + def load_from_yml + if ENV['RAILS_DATABASE_FILE'] + yml_config = "#{File.dirname(__FILE__)}/../../../../config/#{ENV['RAILS_DATABASE_FILE']}" + else + yml_config = "#{File.dirname(__FILE__)}/../../../../config/database.yml" + end + yml_config = YAML.load_file(yml_config)['test'].each_with_object({}){ |(k,v), h| + h[k.to_sym] = v + } + yml_config[:user] = yml_config.delete :username + yml_config[:adapter].sub!('postgresql', 'postgres') + yml_config + rescue + raise("Configure database settings in RAILS_ROOT/config/database.yml or spec/factories/database.json") + end end end end
Use built-ins for importer unit tests, avoid loading SequelRails and its dependencies
diff --git a/lib/ckeditor-rails/tasks.rake b/lib/ckeditor-rails/tasks.rake index abc1234..def5678 100644 --- a/lib/ckeditor-rails/tasks.rake +++ b/lib/ckeditor-rails/tasks.rake @@ -6,6 +6,8 @@ for file in Dir["public/assets/ckeditor/**/*"] next unless file =~ fingerprint nondigest = file.sub fingerprint, '.' - FileUtils.cp file, nondigest, verbose: true + if !File.exist?(nondigest) or File.mtime(file) > File.mtime(nondigest) + FileUtils.cp file, nondigest, verbose: true + end end end
Copy fingerprinted assets only if more recent than non-fingerprinted versions
diff --git a/APIService/APIService-TalkingData.podspec b/APIService/APIService-TalkingData.podspec index abc1234..def5678 100644 --- a/APIService/APIService-TalkingData.podspec +++ b/APIService/APIService-TalkingData.podspec @@ -0,0 +1,23 @@+Pod::Spec.new do |s| + s.name = "APIService-TalkingData" + s.version = "2.2.36" + s.summary = "TalkingData Analytics SDK. https://www.talkingdata.com" + s.homepage = "https://github.com/ElfSundae/AppComponents" + s.documentation_url = "http://doc.talkingdata.com/posts/20" + s.authors = { + "TalkingData" => "https://www.talkingdata.com" + } + s.license = { + :type => "Copyright", + :text => "Copyright https://www.talkingdata.com" + } + s.source = { + :http => "http://www.tenddata.com:8080/download/TalkingData_Analytics_iOS_SDK.zip" + } + s.platform = :ios, "6.0" + s.frameworks = "Security", "SystemConfiguration", "CoreTelephony", "CoreMotion", "AdSupport" + s.libraries = "z" + + s.source_files = "**/TalkingData.h", "**/TalkingDataSMS.h" + s.vendored_libraries = "**/libTalkingData.a" +end
Revert "Remove TalkingData, app can use TalkingData-AppAnalytics instead" This reverts commit d34b2833a444cffb8f9eeee4d59133dcc4066567.
diff --git a/schema.gemspec b/schema.gemspec index abc1234..def5678 100644 --- a/schema.gemspec +++ b/schema.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = 'schema' s.summary = "Primitives for schema and structure" - s.version = '0.4.5.1' + s.version = '0.4.5.2' s.description = ' ' s.authors = ['The Eventide Project']
Package version is increased from 0.4.5.1 to 0.4.5.2
diff --git a/lib/rake/classic_namespace.rb b/lib/rake/classic_namespace.rb index abc1234..def5678 100644 --- a/lib/rake/classic_namespace.rb +++ b/lib/rake/classic_namespace.rb @@ -3,7 +3,9 @@ # referenced Task from the top level. warn "WARNING: Classic namespaces are deprecated and will be removed from future versions of Rake." +# :stopdoc: Task = Rake::Task FileTask = Rake::FileTask FileCreationTask = Rake::FileCreationTask RakeApp = Rake::Application +# :startdoc:
Hide the deprecated classic namespace from RDoc
diff --git a/lib/recaptcha_mailhide/url.rb b/lib/recaptcha_mailhide/url.rb index abc1234..def5678 100644 --- a/lib/recaptcha_mailhide/url.rb +++ b/lib/recaptcha_mailhide/url.rb @@ -1,11 +1,11 @@ module RecaptchaMailhide module URL - BASE_URL = "http://www.google.com/recaptcha/mailhide/d" + BASE_URL = "https://www.google.com/recaptcha/mailhide/d" - def self.url_for(email) + def self.url_for(email_address) public_key = RecaptchaMailhide.configuration.public_key - encrypted_email = RecaptchaMailhide::Encrypt.encrypt(email) - BASE_URL + "?k=#{public_key}&c=#{encrypted_email}" + encrypted_address = Encrypt.encrypt(email_address) + BASE_URL + "?k=#{public_key}&c=#{encrypted_address}" end end end
Use HTTPS in generated URLs.
diff --git a/lib/recorder/rails/railtie.rb b/lib/recorder/rails/railtie.rb index abc1234..def5678 100644 --- a/lib/recorder/rails/railtie.rb +++ b/lib/recorder/rails/railtie.rb @@ -2,7 +2,7 @@ module Recorder module Rails - class Railtie < Rails::Railtie + class Railtie < ::Rails::Railtie initializer 'recorder.configure' do |_app| require 'recorder/sidekiq/revisions_worker' if defined?(Sidekiq) end
Fix 'uninitialized constant Recorder::Rails::Railtie' error
diff --git a/lib/tasks/data/poll_imdb.rake b/lib/tasks/data/poll_imdb.rake index abc1234..def5678 100644 --- a/lib/tasks/data/poll_imdb.rake +++ b/lib/tasks/data/poll_imdb.rake @@ -0,0 +1,6 @@+namespace :data do + desc 'Poll data from Imdb to import movies in our database' + task :poll_imdb => :environment do + Movie.create imdb_id: rand(999_999) + end +end
feat(task): Add a rake task to poll imdb
diff --git a/lib/tasks/publishing_api.rake b/lib/tasks/publishing_api.rake index abc1234..def5678 100644 --- a/lib/tasks/publishing_api.rake +++ b/lib/tasks/publishing_api.rake @@ -15,7 +15,7 @@ Rails.application.publishing_api_v2.patch_links( artefact.content_id, links: { - ordered_related_items: artefact.related_artefacts.map(&:content_id).compact + ordered_related_items: artefact.ordered_related_artefacts.map(&:content_id).compact } ) end
Send related items in order to publishing-api The ordering is important because the user has specified it in the UI.
diff --git a/lib/tic_tac_toe/rack_shell.rb b/lib/tic_tac_toe/rack_shell.rb index abc1234..def5678 100644 --- a/lib/tic_tac_toe/rack_shell.rb +++ b/lib/tic_tac_toe/rack_shell.rb @@ -6,6 +6,9 @@ return RackShell.new end + def call(env) + [200, {}, ["Hello World"]] + end end end
Add a hello world call implementation
diff --git a/lib/timerage/time_interval.rb b/lib/timerage/time_interval.rb index abc1234..def5678 100644 --- a/lib/timerage/time_interval.rb +++ b/lib/timerage/time_interval.rb @@ -30,20 +30,26 @@ an_obj.respond_to?(:end) end + # --- + # + # This is implemented in a slightly more procedural style than i + # prefer because we want to work well with ActiveSupport::Duration + # steps. Adding a Duration to a time uses the timezone (dst, etc), + # leap second and leap day aware `#advance` method in + # ActiveSupport. However, multiplying a Duration by a number + # returns a number, rather than a duration. This, in turn, means + # that adding a duration times a number to a time results in + # Timely incorrect results. So we do it the hard way. def time_enumerator(step) - not_done = if exclude_end? - ->(nxt) { nxt < self.end } - else - ->(nxt) { nxt <= self.end } - end + count = (self.end - self.begin).div(step) + count += 1 if !exclude_end? and (self.end - self.begin) % step == 0 + # We've included our end if it should be Enumerator.new do |y| - nxt = self.begin + y << last = self.begin - while not_done.call(nxt) do - y << nxt - - nxt += step + (count-1).times do + y << last = last + step end end end
Reduce the number of comparisons during iteration
diff --git a/lib/torckapi/response/base.rb b/lib/torckapi/response/base.rb index abc1234..def5678 100644 --- a/lib/torckapi/response/base.rb +++ b/lib/torckapi/response/base.rb @@ -7,7 +7,7 @@ def self.bdecode_and_check(data, key) begin - bdecoded_data = BEncode.load(data, :ignore_trailing_junk => true) + bdecoded_data = BEncode.load(data) rescue BEncode::DecodeError raise Torckapi::Tracker::MalformedResponseError, "Can't decode '%s'" % data end
Revert "Allow proper loading of failed Bencoded data" This reverts commit b000225b6a3068eb858ed8290fe3594ed849e383.
diff --git a/src/models/operating_system.rb b/src/models/operating_system.rb index abc1234..def5678 100644 --- a/src/models/operating_system.rb +++ b/src/models/operating_system.rb @@ -15,6 +15,4 @@ require 'sinatra/activerecord' class OperatingSystem < ActiveRecord::Base - def initialize - end end
Remove override constructor to initialize model
diff --git a/CMNavBarNotificationView.podspec b/CMNavBarNotificationView.podspec index abc1234..def5678 100644 --- a/CMNavBarNotificationView.podspec +++ b/CMNavBarNotificationView.podspec @@ -1,12 +1,13 @@ Pod::Spec.new do |s| s.name = "CMNavBarNotificationView" - s.version = "1.0.3" + s.version = "1.0.4" s.summary = "An in-app notification view above the navigation bar totally based on MPNotificationView." s.homepage = "https://github.com/edgurgel/CMNavBarNotificationView" s.license = 'MIT' s.authors = { "Eduardo Pinho" => "eduardo.gurgel@codeminer42.com", "Codeminer42" => "contato@codeminer42.com" } - s.source = { :git => "https://github.com/edgurgel/CMNavBarNotificationView.git", :tag => "1.0.3" } + s.source = { :git => "https://github.com/edgurgel/CMNavBarNotificationView.git", :tag => "1.0.4" } s.platform = :ios, '4.0' s.source_files = 'CMNavBarNotificationView/*.{h,m}','OBGradientView/*.{h,m}' s.public_header_files = 'CMNavBarNotificationView/**/*.h' + s.requires_arc = true end
Bump new version and add requires_arc to podspec
diff --git a/validate_as_email.gemspec b/validate_as_email.gemspec index abc1234..def5678 100644 --- a/validate_as_email.gemspec +++ b/validate_as_email.gemspec @@ -16,6 +16,6 @@ gem.version = ValidateAsEmail::VERSION gem.platform = Gem::Platform::RUBY - gem.add_dependency 'activemodel', '> 3', '< 4.1' + gem.add_dependency 'activemodel', '> 3', '< 5' gem.add_dependency 'mail', '~> 2.5' end
Allow to run with activemodel 4.2.x
diff --git a/test/unit/test_store_metadata.rb b/test/unit/test_store_metadata.rb index abc1234..def5678 100644 --- a/test/unit/test_store_metadata.rb +++ b/test/unit/test_store_metadata.rb @@ -1,6 +1,6 @@ require 'helper' -class TestStoreConstruction < Test::Pwl::TestCase +class TestStoreMetaData < Test::Pwl::TestCase # when comparing timestamps, allow not more than this difference in seconds TIMESTAMP_PRECISION = 1
Fix wrong test class name
diff --git a/source/feed.xml.builder b/source/feed.xml.builder index abc1234..def5678 100644 --- a/source/feed.xml.builder +++ b/source/feed.xml.builder @@ -6,6 +6,7 @@ xml.link "href" => "http://blog.troutwine.us/feed.xml", "rel" => "self" xml.updated data.blog.articles.first.date.to_time.iso8601 xml.author { xml.name "Brian L. Troutwine" } + xml.icon "http://blog.troutwine.us/images/favicon.png" data.blog.articles.each do |article| xml.entry do
Add favicon icon to Atom feed output. Signed-off-by: Brian L. Troutwine <760e7dab2836853c63805033e514668301fa9c47@troutwine.us>
diff --git a/counter_api.rb b/counter_api.rb index abc1234..def5678 100644 --- a/counter_api.rb +++ b/counter_api.rb @@ -1,8 +1,7 @@ require "sinatra/json" configure do - session = Moped::Session.new([ '127.0.0.1:27017' ]) - session.use "cloud_counter_#{ENV['RACK_ENV']}" + session ||= Moped::Session.connect(ENV.fetch('MONGOSOUP_URL', '127.0.0.1:27017')) end post '/counters' do
Connect to mongo on heroku too
diff --git a/spec/controller_spec.rb b/spec/controller_spec.rb index abc1234..def5678 100644 --- a/spec/controller_spec.rb +++ b/spec/controller_spec.rb @@ -0,0 +1,13 @@+require File.join(File.dirname(__FILE__), 'spec_helper.rb') + +class Test < Merb::Controller + def index + "index" + end +end + +describe Merb::Controller do + it "should set the language on request" do + controller = dispatch_to(Test, :index) + end +end
Add controller spec (not full)
diff --git a/spec/end_to_end_spec.rb b/spec/end_to_end_spec.rb index abc1234..def5678 100644 --- a/spec/end_to_end_spec.rb +++ b/spec/end_to_end_spec.rb @@ -24,4 +24,12 @@ shell.game_loop end + it "ends after a draw" do + x_moves = [0, 1, 3, 8, 4] + y_moves = [2, 6, 7, 5] + moves = x_moves.zip(y_moves).flatten + inputs = moves.map { |move| move.to_s + "\n" } + allow(console).to receive(:gets).and_return(*inputs) + shell.game_loop + end end
Add a test that plays through a tie game
diff --git a/mpfr2.rb b/mpfr2.rb index abc1234..def5678 100644 --- a/mpfr2.rb +++ b/mpfr2.rb @@ -0,0 +1,47 @@+require 'formula' + +class Mpfr2 < Formula + homepage 'http://www.mpfr.org/' + # Tracking legacy version on gcc ftp + url 'ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-2.4.2.tar.bz2' + sha1 '7ca93006e38ae6e53a995af836173cf10ee7c18c' + + depends_on 'gmp4' + + keg_only 'Conflicts with mpfr in main repository.' + + option '32-bit' + + fails_with :clang do + build 421 + cause <<-EOS.undent + clang build 421 segfaults while building in superenv; + see https://github.com/mxcl/homebrew/issues/15061 + EOS + end + + def install + gmp4 = Formula.factory 'gmp4' + + args = [ + "--disable-dependency-tracking", + "--prefix=#{prefix}", + "--with-gmp=#{gmp4.opt_prefix}" + ] + + # Build 32-bit where appropriate, and help configure find 64-bit CPUs + # Note: This logic should match what the GMP formula does. + if MacOS.prefer_64_bit? and not build.build_32_bit? + ENV.m64 + args << "--build=x86_64-apple-darwin" + else + ENV.m32 + args << "--build=none-apple-darwin" + end + + system "./configure", *args + system "make" + system "make check" + system "make install" + end +end
Add legacy version of mpfr. * Add mpfr 2.4.2 from GCC infrastructure.
diff --git a/app/controllers/policies_controller.rb b/app/controllers/policies_controller.rb index abc1234..def5678 100644 --- a/app/controllers/policies_controller.rb +++ b/app/controllers/policies_controller.rb @@ -5,7 +5,7 @@ before_action :authenticate_user!, except: [:index, :show, :detail] def index - @policies = Policy.order(:private, :name) + @policies = Policy.order(:private, :name).includes(:divisions => :wiki_motions) end def show
Reduce sql calls on list of policies
diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index abc1234..def5678 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -30,5 +30,9 @@ def resource @subject ||= chain.distinct("subjects") .find { |subject| subject.parameterize == params[:id].parameterize } + + raise Exception, "Subject #{params[:id]} not valid" unless @subject + + @subject end end
Raise error when subject not found
diff --git a/lib/plucky.rb b/lib/plucky.rb index abc1234..def5678 100644 --- a/lib/plucky.rb +++ b/lib/plucky.rb @@ -15,16 +15,13 @@ end def self.to_object_id(value) - if value.nil? || (value.respond_to?(:empty?) && value.empty?) - nil - elsif value.is_a?(BSON::ObjectId) + return value if value.is_a?(BSON::ObjectId) + return nil if value.nil? || (value.respond_to?(:empty?) && value.empty?) + + if BSON::ObjectId.legal?(value.to_s) + BSON::ObjectId.from_string(value.to_s) + else value - else - if BSON::ObjectId.legal?(value.to_s) - BSON::ObjectId.from_string(value.to_s) - else - value - end end end end
Check if already bson object id first. Assumes that is most common.
diff --git a/app/importers/iep_import/iep_storer.rb b/app/importers/iep_import/iep_storer.rb index abc1234..def5678 100644 --- a/app/importers/iep_import/iep_storer.rb +++ b/app/importers/iep_import/iep_storer.rb @@ -18,14 +18,31 @@ return @logger.info("student not in db!") unless @student - @logger.info("storing iep for student to db.") + return unless store_object_in_s3 - @client.put_object( + store_object_in_database + end + + def store_object_in_s3 + @logger.info("storing iep for student to s3...") + + response = @client.put_object( bucket: ENV['AWS_S3_IEP_BUCKET'], key: @file_name, body: File.open(@path_to_file), server_side_encryption: 'AES256' ) + + return false unless response + + @logger.info(" successfully stored to s3!") + @logger.info(" encrypted with: #{response[:server_side_encryption]}") + + return true + end + + def store_object_in_database + @logger.info("storing iep for student to db.") IepDocument.create!( file_date: @file_date,
Print out AWS S3 confirmation of server_side_encrpytion status + ... also don't save an object to the DB unless we hear back from AWS that it saved successfully
diff --git a/jsrebuild.gemspec b/jsrebuild.gemspec index abc1234..def5678 100644 --- a/jsrebuild.gemspec +++ b/jsrebuild.gemspec @@ -1,24 +1,31 @@+# -*- encoding: utf-8 -*- +lib = File.expand_path('../lib/', __FILE__) +$:.unshift lib unless $:.include?(lib) + +require 'jsrebuild' + Gem::Specification.new do |gem| - gem.name = "jsrebuild" - gem.version = "0.1.0" + gem.name = "jsrebuild" + gem.version = JSRebuild::VERSION + gem.platform = Gem::Platform::RUBY - gem.author = "Benedict Eastaugh" - gem.email = "benedict@eastaugh.net" - gem.homepage = "https://github.com/othermedia/jsrebuild" + gem.author = "Benedict Eastaugh" + gem.email = "benedict@eastaugh.net" + gem.homepage = "https://github.com/othermedia/jsrebuild" - gem.summary = "Dynamic rebuilder for JavaScript projects" - gem.description = "Dynamically runs the Jake build tool to rebuild JavaScript - projects in development environmentgem.".sub(/\s+/, " ") + gem.summary = "Dynamic rebuilder for JavaScript projects" + gem.description = "Dynamically runs the Jake build tool to rebuild JavaScript + projects in development environmentgem.".sub(/\s+/, " ") - gem.license = "BSD" + gem.license = "BSD" gem.add_dependency "cool.io", ">= 1.0.0" gem.add_dependency "eventful", ">= 1.0.0" gem.add_dependency "jake", ">= 1.0.1" gem.add_dependency "oyster", ">= 0.9.5" - gem.executables = ["jsrebuild"] - - gem.files = Dir.glob("{bin,lib}/**/*") + - %w(History.txt LICENSE README.md) + gem.executables = ['jsrebuild'] + gem.require_path = 'lib' + gem.files = Dir.glob("{bin,lib}/**/*") + + %w(History.txt LICENSE README.md) end
Add require_path, load version from JSRebuild::VERSION constant and add gem platform to gemspec.
diff --git a/lib/server.rb b/lib/server.rb index abc1234..def5678 100644 --- a/lib/server.rb +++ b/lib/server.rb @@ -1,4 +1,5 @@ require 'socket' +require 'stringio' class Server def initialize(port, sleep = 1)
Add missing require for StringIO
diff --git a/spec/controllers/moderation_controller_spec.rb b/spec/controllers/moderation_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/moderation_controller_spec.rb +++ b/spec/controllers/moderation_controller_spec.rb @@ -1,4 +1,58 @@ require 'rails_helper' RSpec.describe ModerationController, type: :controller do + describe "GET #index" do + context "unauthenticated users" do + it 'respons with not found' do + expect { get :index }.to raise_error(ActionController::RoutingError) + end + end + + context "unauthorized users" do + login_user + + it 'respons with not found if visitor' do + expect { get :index }.to raise_error(ActionController::RoutingError) + end + + it 'respons with not found if contributor' do + user.make_contributor! + expect { get :index }.to raise_error(ActionController::RoutingError) + end + + it 'respons with not found if editor' do + user.make_editor! + expect { get :index }.to raise_error(ActionController::RoutingError) + end + end + + context "authorized users" do + login_user + + it 'allows moderation if moderator' do + user.make_moderator! + get :index + expect(response).to be_success + expect(response).to render_template("index") + end + + it 'allows moderation if admin' do + user.make_admin! + get :index + expect(response).to be_success + expect(response).to render_template("index") + end + end + + context "with query" do + login_moderator + + it 'respondes to active page' do + get :index, params: { q: { collection_name_cont: "learn" }, active: :new_collections } + + expect(response).to be_success + expect(response).to render_template("index") + end + end + end end
Add some moderation controller tests
diff --git a/pre-commit.d/whitespace.rb b/pre-commit.d/whitespace.rb index abc1234..def5678 100644 --- a/pre-commit.d/whitespace.rb +++ b/pre-commit.d/whitespace.rb @@ -4,17 +4,17 @@ `git rev-parse --verify HEAD` against = if $? == 0 - 'HEAD' + 'HEAD' else - '4b825dc642cb6eb9a060e54bf8d69288fbee4904' + '4b825dc642cb6eb9a060e54bf8d69288fbee4904' end files = `git diff-index #{COLOR_UI ? '--color' : ''} --check --cached #{against}` unless $? == 0 - puts "#{msg('/!\\', 'white', 'on_red')} #{msg('WHOA THERE', 'red')}, #{msg('/!\\', 'white', 'on_red')}\n\n" - puts "#{msg('Whitespace', 'black', 'on_white')} problems in commit! Take a gander at this:\n\n" - puts "#{files}\n\n" - exit(1) + puts "#{msg('/!\\', 'white', 'on_red')} #{msg('WHOA THERE', 'red')}, #{msg('/!\\', 'white', 'on_red')}\n\n" + puts "#{msg('Whitespace', 'black', 'on_white')} problems in commit! Take a gander at this:\n\n" + puts "#{files}\n\n" + exit(1) end exit(0)
Use spaces instead of tabs.
diff --git a/railties/configs/routes.rb b/railties/configs/routes.rb index abc1234..def5678 100644 --- a/railties/configs/routes.rb +++ b/railties/configs/routes.rb @@ -19,6 +19,7 @@ # -- just remember to delete public/index.html. # map.root :controller => "welcome" - # Install the default route as the lowest priority. + # Install the default routes as the lowest priority. map.connect ':controller/:action/:id' -end + map.connect ':controller/:action/:id.:format' +end
Include default route for formats git-svn-id: afc9fed30c1a09d8801d1e4fbe6e01c29c67d11f@6576 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
diff --git a/lib/csi/record.rb b/lib/csi/record.rb index abc1234..def5678 100644 --- a/lib/csi/record.rb +++ b/lib/csi/record.rb @@ -13,7 +13,7 @@ raise CSI::CodeInvalid, 'String required' unless code.is_a? String type.downcase! - raise CSI::TypeInvalid, 'Invalid type - SIC and NAICS only' unless type == 'naics' || type = 'sic' + raise CSI::TypeInvalid, 'Invalid type - SIC and NAICS only' unless type == 'naics' || type == 'sic' data_file = File.expand_path(__FILE__+"/../../data/#{type}/#{code}.toml") raise CSI::ClassificationInvalid unless File.exists? data_file @@ -39,4 +39,4 @@ end end end -end+end
Fix '=' instead of '==' typo on conditional
diff --git a/lib/mongoid_connection_pool/mongoid/sessions.rb b/lib/mongoid_connection_pool/mongoid/sessions.rb index abc1234..def5678 100644 --- a/lib/mongoid_connection_pool/mongoid/sessions.rb +++ b/lib/mongoid_connection_pool/mongoid/sessions.rb @@ -22,13 +22,17 @@ @session_pool[name] end - def disconnect + def disconnect(thread=Thread.current) synchronize do - if @session_pool && @session_pool.any? - @session_pool.each {|s| s.disconnect} - @session_pool = nil + @session_pool.try(:each) do |name, pool| + if thread + pool.session_for(thread).try(:disconnect) + else + pool.sessions.try(:each) { |session| session.disconnect } + end end end + true end def with_name(name)
Fix locking issue on disconnect
diff --git a/test/syntax_test.rb b/test/syntax_test.rb index abc1234..def5678 100644 --- a/test/syntax_test.rb +++ b/test/syntax_test.rb @@ -0,0 +1,32 @@+require 'test_helper' + +describe "Syntax check" do + project_root = Pathname.new(File.expand_path("#{File.dirname(__FILE__)}/../")) + backend_files = Dir[project_root.join('**', '*.rb')].reject{|f| f.match %r{/Casks/}} + %w{1.8 1.9 2.0 2.1}.each do |major_version| + describe "under Ruby #{major_version}" do + interpreter = Pathname.new("/System/Library/Frameworks/Ruby.framework/Versions/#{major_version}/usr/bin/ruby") + interpreter = Pathname.new(Dir["#{ENV['HOME']}/.rbenv/versions/#{major_version}*/bin/ruby"].first.to_s) unless interpreter.exist? + interpreter = Pathname.new(Dir["#{ENV['HOME']}/.rvm/rubies/ruby-#{major_version}*/bin/ruby"].first.to_s) unless interpreter.exist? + interpreter = Pathname.new(Dir["/usr/local/bin/ruby{-,}#{major_version}*"].first.to_s) unless interpreter.exist? + interpreter = Pathname.new(Dir["/opt/local/bin/ruby{-,}#{major_version}*"].first.to_s) unless interpreter.exist? + flags = %w{-c} + flags.unshift '--disable-all' if major_version.to_f > 1.8 # perf + backend_files.each do |file| + it "#{file} is valid Ruby" do + skip unless interpreter.exist? + + # Reason for this hack is unknown. Travis appears to freeze, + # but only in one section of the build matrix. + skip if ENV.key?('TRAVIS_JOB_ID') and + RUBY_VERSION.match(%r{^1\.8}) + + args = flags + [ '--', file ] + shutup do + raise SyntaxError.new("#{file} failed syntax check") unless system(interpreter, *args) + end + end + end + end + end +end
Add a syntax test to help support multiple Rubies This is no real gain on Travis, which runs the full test suite against two Rubies. It does catch a few classes of error when running the test suite locally.
diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index abc1234..def5678 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -1,6 +1,6 @@ class NewsController < ApplicationController before_action :set_news, only: [:show, :edit, :update, :destroy] - skip_before_action :authenticate_user!, only: :index + skip_before_action :authenticate_user!, only: [:index, :show] respond_to :html @@ -13,6 +13,7 @@ end def show + authenticate_user! if @news.internal? respond_with(@news) end
Make news readable for public
diff --git a/app/models/mixins/tenancy_mixin.rb b/app/models/mixins/tenancy_mixin.rb index abc1234..def5678 100644 --- a/app/models/mixins/tenancy_mixin.rb +++ b/app/models/mixins/tenancy_mixin.rb @@ -24,11 +24,11 @@ # Current user # Parent EMS # Root tenant - self.tenant_id ||= if respond_to?(:miq_group) && miq_group + self.tenant_id ||= if respond_to?(:miq_group) && miq_group.try(:tenant_id) miq_group.tenant_id - elsif User.current_tenant + elsif User.current_tenant.try(:id) User.current_tenant.id - elsif respond_to?(:ext_management_system) && ext_management_system + elsif respond_to?(:ext_management_system) && ext_management_system.try(:tenant_id) ext_management_system.tenant_id else Tenant.root_tenant.try(:id)
Handle case of nil tenant id on group, user, and ems. If the group, user, ems is nil (handled already) or if their tenant id is nil(fixed in this commit), we need to fall through to the next option. Owning group -> current user -> parent ems -> root tenant Fixes some API specs where a Vmware::InfraManager wasn't falling through to the last case, getting the default tenant, because the instance responded to ext_management_system (returning self) but the instance didn't have a tenant_id value.
diff --git a/app/models/reports/admin_report.rb b/app/models/reports/admin_report.rb index abc1234..def5678 100644 --- a/app/models/reports/admin_report.rb +++ b/app/models/reports/admin_report.rb @@ -39,7 +39,7 @@ private def category - params[:category] if FormAnswer::AWARD_TYPE_FULL_NAMES.keys.include?(params[:category]) + params[:category] if ::FormAnswer::AWARD_TYPE_FULL_NAMES.keys.include?(params[:category]) end def pdf_filename
Fix issue with not found constant
diff --git a/app/models/spree/user_decorator.rb b/app/models/spree/user_decorator.rb index abc1234..def5678 100644 --- a/app/models/spree/user_decorator.rb +++ b/app/models/spree/user_decorator.rb @@ -1,6 +1,6 @@ module Spree User.class_eval do - scope :dibs_referrers, lambda { includes(:roles).where("#{::Spree::Role.table_name}.name" => "dibs_referral") } + scope :dibs_referrers, lambda { includes(:spree_roles).where("#{::Spree::Role.table_name}.name" => "dibs_referral") } has_many :dibs_referrals, class_name: '::Spree::Order', foreign_key: 'dibs_referral_id', uniq: true end end
Fix role reference in checkout
diff --git a/app/serializers/user_serializer.rb b/app/serializers/user_serializer.rb index abc1234..def5678 100644 --- a/app/serializers/user_serializer.rb +++ b/app/serializers/user_serializer.rb @@ -2,5 +2,6 @@ include TalkSerializer include ModerationActions - all_attributes except: :email + attributes :id, :created_at, :updated_at, :display_name, + :zooniverse_id, :credited_name, :admin, :banned end
Whitelist instead of blacklist user attributes
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 @@ -23,9 +23,9 @@ out, err, status = Open3.capture3(*(['bzip2'] + arguments)) args_string = arguments.collect {|a| "'#{a}'" }.join(' ') + assert(err == '', "`bzip2 #{args_string}` returned error: #{err}") + assert(out == '', "`bzip2 #{args_string}` returned output: #{out}") assert(status.exitstatus == 0, "`bzip2 #{args_string}` exit status was non-zero") - assert(out == '', "`bzip2 #{args_string}` returned output: #{out}") - assert(err == '', "`bzip2 #{args_string}` returned error: #{err}") end def assert_bunzip2_successful(*arguments)
Reorder assertions to report error/output on a non-zero exit status.