diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/test/integration/default/serverspec/default_spec.rb b/test/integration/default/serverspec/default_spec.rb index abc1234..def5678 100644 --- a/test/integration/default/serverspec/default_spec.rb +++ b/test/integration/default/serverspec/default_spec.rb @@ -19,6 +19,9 @@ describe 'Test file' do describe file('/tmp/test') do it { should exist } + it { should be_owned_by 'root' } + it { should be_grouped_into 'root' } + it { should be_mode 755 } its(:content) { should contain 'Hello world!' } end end
Add file tests to serverspec
diff --git a/test/integration/upstart/serverspec/upstart_spec.rb b/test/integration/upstart/serverspec/upstart_spec.rb index abc1234..def5678 100644 --- a/test/integration/upstart/serverspec/upstart_spec.rb +++ b/test/integration/upstart/serverspec/upstart_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' context 'when node[zookeeper][service_style] is set to upstart on Ubuntu' do - describe file '/etc/init/zookeeper' do + describe file '/etc/init/zookeeper.conf' do it { is_expected.to be_file } end
Fix Upstart service spec path
diff --git a/script/change_locales.rb b/script/change_locales.rb index abc1234..def5678 100644 --- a/script/change_locales.rb +++ b/script/change_locales.rb @@ -0,0 +1,15 @@+require 'json' + +keys_to_remove = ['mailToDev', 'saveLogFile'] + +Dir.glob('addon/_locales/**/*.json').each do |locale| + puts locale + data = JSON.parse(File.open(locale).read) + data.keys.each do |key| + if keys_to_remove.any? { |needle| key.include? needle } || key.match(/Promotions/) + puts "removing #{key}" + data.delete(key) + end + end + File.open(locale, 'w') {|f| f.write(JSON.pretty_generate(data)) } +end
Add script that makes it easy to update all locales at once
diff --git a/lib/rails-html-sanitizer.rb b/lib/rails-html-sanitizer.rb index abc1234..def5678 100644 --- a/lib/rails-html-sanitizer.rb +++ b/lib/rails-html-sanitizer.rb @@ -26,6 +26,10 @@ module ActionView module Helpers module SanitizeHelper + if method_defined?(:sanitizer_vendor) || private_method_defined?(:sanitizer_vendor) + undef_method(:sanitizer_vendor) + end + def sanitizer_vendor Rails::Html::Sanitizer end
Remove the method before redefining
diff --git a/common_spree_dependencies.rb b/common_spree_dependencies.rb index abc1234..def5678 100644 --- a/common_spree_dependencies.rb +++ b/common_spree_dependencies.rb @@ -23,10 +23,18 @@ gem 'email_spec', '1.4.0' gem 'factory_girl_rails', '~> 4.4.0' gem 'launchy' - gem 'pry' gem 'rspec-rails', '~> 2.14.0' gem 'selenium-webdriver', '~> 2.35' gem 'simplecov' gem 'webmock', '1.8.11' gem 'poltergeist', '1.5.0' end + +group :test, :development do + platforms :ruby_19 do + gem 'pry-debugger' + end + platforms :ruby_20, :ruby_21 do + gem 'pry-byebug' + end +end
Add pry and pry debuggers to common spree dependencies Including dev environment. Fixes #4957
diff --git a/test/ffi-gobject_introspection/i_repository_test.rb b/test/ffi-gobject_introspection/i_repository_test.rb index abc1234..def5678 100644 --- a/test/ffi-gobject_introspection/i_repository_test.rb +++ b/test/ffi-gobject_introspection/i_repository_test.rb @@ -20,36 +20,37 @@ end end + let(:gir) { GObjectIntrospection::IRepository.default } + describe "#require" do it "raises an error if the namespace doesn't exist" do assert_raises RuntimeError do - GObjectIntrospection::IRepository.default.require 'VeryUnlikelyGObjectNamespaceName', nil + gir.require 'VeryUnlikelyGObjectNamespaceName', nil end end it "allows version to be nil" do - GObjectIntrospection::IRepository.default.require 'GObject', nil + gir.require 'GObject', nil pass end it "allows version to be left out" do - GObjectIntrospection::IRepository.default.require 'GObject' + gir.require 'GObject' pass end end describe "enumerating the infos for GObject" do before do - @gir = GObjectIntrospection::IRepository.default - @gir.require 'GObject', "2.0" + gir.require 'GObject', "2.0" end it "yields more than one object" do - assert_operator @gir.n_infos('GObject'), :>, 0 + assert_operator gir.n_infos('GObject'), :>, 0 end it "yields IBaseInfo objects" do - assert_kind_of GObjectIntrospection::IBaseInfo, @gir.info('GObject', 0) + assert_kind_of GObjectIntrospection::IBaseInfo, gir.info('GObject', 0) end end end
Simplify IRepository tests with a let block
diff --git a/test/unit/integrations/helpers/bogus_helper_test.rb b/test/unit/integrations/helpers/bogus_helper_test.rb index abc1234..def5678 100644 --- a/test/unit/integrations/helpers/bogus_helper_test.rb +++ b/test/unit/integrations/helpers/bogus_helper_test.rb @@ -25,4 +25,8 @@ @helper.space_shuttle :name => 'Rockety' assert_equal fields, @helper.fields end + + def test_method_missing + assert_nil @helper.nonexisting_method + end end
Test for method missing return value.
diff --git a/lib/diesel/middleware/set_body_parameter.rb b/lib/diesel/middleware/set_body_parameter.rb index abc1234..def5678 100644 --- a/lib/diesel/middleware/set_body_parameter.rb +++ b/lib/diesel/middleware/set_body_parameter.rb @@ -10,6 +10,9 @@ else value end + if env[:request_headers]["Content-Type"].nil? + env[:request_headers]["Content-Type"] = "application/json" + end end end end
Set content type if there is a body parameter
diff --git a/lib/github_usage_tracker.rb b/lib/github_usage_tracker.rb index abc1234..def5678 100644 --- a/lib/github_usage_tracker.rb +++ b/lib/github_usage_tracker.rb @@ -20,6 +20,7 @@ WHERE time > '#{from_time.rfc3339}' AND time <= '#{current_time.rfc3339}' GROUP BY time(1m) + fill(previous) eos influxdb.query(query)
Use previous datapoints in usage aggregation query
diff --git a/lib/rollbar/rails_runner.rb b/lib/rollbar/rails_runner.rb index abc1234..def5678 100644 --- a/lib/rollbar/rails_runner.rb +++ b/lib/rollbar/rails_runner.rb @@ -46,7 +46,7 @@ def rollbar_managed yield rescue => e - Rollbar.scope(:context => command).error(e) + Rollbar.scope(:custom => { :command => command }).error(e) raise end
Use 'custom.command' key instead of 'context' for the command value.
diff --git a/lib/sprockets/lazy_proxy.rb b/lib/sprockets/lazy_proxy.rb index abc1234..def5678 100644 --- a/lib/sprockets/lazy_proxy.rb +++ b/lib/sprockets/lazy_proxy.rb @@ -1,13 +1,17 @@+require 'delegate' + module Sprockets - class LazyProxy + # Internal: Used for lazy loading processors. + # + # LazyProxy.new { CoffeeScriptTemplate } + # + class LazyProxy < Delegator def initialize(&block) - @block = block - @proc = nil + @_block = block end - def call(*args) - @proc ||= @block.call - @proc.call(*args) + def __getobj__ + @_obj ||= @_block.call end end end
Use delegator for lazy proxy
diff --git a/lib/tasks/reason_codes.rake b/lib/tasks/reason_codes.rake index abc1234..def5678 100644 --- a/lib/tasks/reason_codes.rake +++ b/lib/tasks/reason_codes.rake @@ -6,7 +6,7 @@ file = File.open ARGV.last doc = Nokogiri::XML file imported = 0 - doc.css('ReasonCode').each do |code_data| + doc.css('reason_code').each do |code_data| identifier = code_data.at_css('identifier').text code = ReasonCode.find_by identifier: identifier unless code.present?
Fix rake task to match control file
diff --git a/lib/sastrawi/dictionary/array_dictionary.rb b/lib/sastrawi/dictionary/array_dictionary.rb index abc1234..def5678 100644 --- a/lib/sastrawi/dictionary/array_dictionary.rb +++ b/lib/sastrawi/dictionary/array_dictionary.rb @@ -36,7 +36,7 @@ # Add a word to the dictionary def add(word) - return if word.nil? || word == '' + return if word.nil? || word.strip == '' @words.push(word) end
Remove whitespace as mentioned on bb2abe0
diff --git a/lib/thinking_sphinx/deltas/delayed_delta.rb b/lib/thinking_sphinx/deltas/delayed_delta.rb index abc1234..def5678 100644 --- a/lib/thinking_sphinx/deltas/delayed_delta.rb +++ b/lib/thinking_sphinx/deltas/delayed_delta.rb @@ -8,6 +8,9 @@ module Deltas class DelayedDelta < ThinkingSphinx::Deltas::DefaultDelta def index(model, instance = nil) + return true unless ThinkingSphinx.updates_enabled? && ThinkingSphinx.deltas_enabled? + return true if instance && !toggled(instance) + ThinkingSphinx::Deltas::Job.enqueue( ThinkingSphinx::Deltas::DeltaJob.new(delta_index_name(model)), ThinkingSphinx::Configuration.instance.delayed_job_priority
Make delayed deltas respect the TS.deltas_enabled/TS.updates_enabled flags
diff --git a/recipes/apc.rb b/recipes/apc.rb index abc1234..def5678 100644 --- a/recipes/apc.rb +++ b/recipes/apc.rb @@ -35,6 +35,7 @@ php_pear 'APC' do action :install + # Use channel 'pecl' since APC is not available on the default channel channel 'pecl' end
Add comment for pecl channel
diff --git a/sentimental.gemspec b/sentimental.gemspec index abc1234..def5678 100644 --- a/sentimental.gemspec +++ b/sentimental.gemspec @@ -17,6 +17,4 @@ spec.add_development_dependency "rake" spec.add_development_dependency "rspec", ">= 3.0.0" spec.add_development_dependency "rubocop", "~> 0.40", ">= 0.40.0" - - spec.add_runtime_dependency "json", "~> 1.8", ">= 1.8.3" end
Remove explicit dependency on gems in stdlib `json` is included in the Ruby standard library for all supported versions of Ruby.
diff --git a/app/models/abilities/everyone.rb b/app/models/abilities/everyone.rb index abc1234..def5678 100644 --- a/app/models/abilities/everyone.rb +++ b/app/models/abilities/everyone.rb @@ -14,7 +14,6 @@ can :read, Category can :read, Subcategory can :read, District - can :read, ActionPlan end end end
Remove action plan read permission
diff --git a/app/models/tutorial_enrolment.rb b/app/models/tutorial_enrolment.rb index abc1234..def5678 100644 --- a/app/models/tutorial_enrolment.rb +++ b/app/models/tutorial_enrolment.rb @@ -21,7 +21,7 @@ if project.tutorial_enrolments .joins(:tutorial) .where("tutorials.tutorial_stream_id = :sid #{ self.id.present? ? 'AND (tutorial_enrolments.id <> :id)' : ''}", sid: tutorial.tutorial_stream_id, id: self.id ) - .count <> 0 + .count > 0 errors.add(:project, 'already enrolled in a tutorial with same tutorial stream') end end
FIX: Replace not equal with greater than in max one tute enrolment
diff --git a/app/models/concerns/cube_data_model/cube_resource.rb b/app/models/concerns/cube_data_model/cube_resource.rb index abc1234..def5678 100644 --- a/app/models/concerns/cube_data_model/cube_resource.rb +++ b/app/models/concerns/cube_data_model/cube_resource.rb @@ -38,5 +38,14 @@ def qname "ukhpi:#{local_name}" end + + def objects_of(pred) + stmts = graph.query([resource, pred, nil]) + (stmts || []).map(&:object) + end + + def object_of(pred) + objects_of(pred).first + end end end
Add a convenience accessor for getting statemetn objects
diff --git a/spec/configuration_spec.rb b/spec/configuration_spec.rb index abc1234..def5678 100644 --- a/spec/configuration_spec.rb +++ b/spec/configuration_spec.rb @@ -0,0 +1,14 @@+require 'spec_helper' + +describe MetaTags::Configuration do + it 'should be returned by MetaTags.config' do + expect(MetaTags.config).to be_instance_of(MetaTags::Configuration) + end + + it 'should be yielded by MetaTags.configure' do + MetaTags.configure do |c| + expect(c).to be_instance_of(MetaTags::Configuration) + expect(c).to be(MetaTags.config) + end + end +end
Make sure MetaTags.config/configuration work as expected
diff --git a/spec/mixin_mutable_spec.rb b/spec/mixin_mutable_spec.rb index abc1234..def5678 100644 --- a/spec/mixin_mutable_spec.rb +++ b/spec/mixin_mutable_spec.rb @@ -3,7 +3,7 @@ describe RDF::Mutable do before :each do - @filename = "etc/doap.nt" + @filename = etc_file("doap.nt") # Possible reference implementations are RDF::Repository and RDF::Graph. @repo = RDF::Repository.new @subject = RDF::URI.new("http://rubygems.org/gems/rdf")
Update mutable specs to use etc_file helper
diff --git a/lib/braspag-rest/payment.rb b/lib/braspag-rest/payment.rb index abc1234..def5678 100644 --- a/lib/braspag-rest/payment.rb +++ b/lib/braspag-rest/payment.rb @@ -18,6 +18,7 @@ property :proof_of_sale, from: 'ProofOfSale' property :reason_code, from: 'ReasonCode' property :reason_message, from: 'ReasonMessage' + property :voided_amount, from: 'VoidedAmount' coerce_key :credit_card, BraspagRest::CreditCard
Add voided_amount method to BraspagRest::Payment.
diff --git a/lib/castle/extractors/ip.rb b/lib/castle/extractors/ip.rb index abc1234..def5678 100644 --- a/lib/castle/extractors/ip.rb +++ b/lib/castle/extractors/ip.rb @@ -9,7 +9,6 @@ end def call - return @request.env['HTTP_CF_CONNECTING_IP'] if @request.env['HTTP_CF_CONNECTING_IP'] return @request.remote_ip if @request.respond_to?(:remote_ip) @request.ip end
Drop special handling for CF IP header
diff --git a/lib/config/custom-routes.rb b/lib/config/custom-routes.rb index abc1234..def5678 100644 --- a/lib/config/custom-routes.rb +++ b/lib/config/custom-routes.rb @@ -3,7 +3,7 @@ Rails.application.routes.draw do # brand new controller example - # match '/mycontroller' => 'general#mycontroller' + # get '/mycontroller' => 'general#mycontroller' # Additional help page example - # match '/help/help_out' => 'help#help_out' + # get '/help/help_out' => 'help#help_out' end
Use HTTP methods for custom routes
diff --git a/spree_zipzones_070.gemspec b/spree_zipzones_070.gemspec index abc1234..def5678 100644 --- a/spree_zipzones_070.gemspec +++ b/spree_zipzones_070.gemspec @@ -15,7 +15,7 @@ s.require_path = 'lib' s.requirements << 'none' - s.add_dependency 'spree_core', '~> 1.3.2' + s.add_dependency 'spree_core', '~> 2.0.0' #s.add_development_dependency 'rspec-rails' end
Update gemspec for spree 2.0.
diff --git a/lib/knife-solo/berkshelf.rb b/lib/knife-solo/berkshelf.rb index abc1234..def5678 100644 --- a/lib/knife-solo/berkshelf.rb +++ b/lib/knife-solo/berkshelf.rb @@ -40,7 +40,8 @@ end def initial_config - if Gem::Version.new(::Berkshelf::VERSION) >= Gem::Version.new("3.0.0") + berkshelf_version = ::Berkshelf::VERSION rescue nil + if berkshelf_version && Gem::Version.new(berkshelf_version) >= Gem::Version.new("3.0.0") 'source "https://api.berkshelf.com"' else 'site :opscode'
Check if ::Berkshelf::VERSION is defined
diff --git a/lib/rom/support/registry.rb b/lib/rom/support/registry.rb index abc1234..def5678 100644 --- a/lib/rom/support/registry.rb +++ b/lib/rom/support/registry.rb @@ -32,12 +32,8 @@ private - def method_missing(name, *args) - if elements.key?(name) - self[name] - else - super - end + def method_missing(name, *) + elements.fetch(name) { super } end end end
Refactor several `method_missing`s to use `fetch`
diff --git a/lib/simple_filter/filter.rb b/lib/simple_filter/filter.rb index abc1234..def5678 100644 --- a/lib/simple_filter/filter.rb +++ b/lib/simple_filter/filter.rb @@ -5,11 +5,11 @@ def filter(name, options = {}) method_module = ModuleHelper.module_for 'Filter', name, self value_param = options.fetch :value_param, false - by_pass = options.fetch :by_pass, false + bypass = options.fetch :bypass, false method_module.module_eval <<-CODE, __FILE__, __LINE__ + 1 def #{name} - return if params[:#{name}].to_s.blank? && !#{by_pass} + return if params[:#{name}].to_s.blank? && !#{bypass} args = [:#{name}] args << params[:#{name}] if #{value_param}
Change by_pass param to bypass
diff --git a/lib/sort_it_out/sortable.rb b/lib/sort_it_out/sortable.rb index abc1234..def5678 100644 --- a/lib/sort_it_out/sortable.rb +++ b/lib/sort_it_out/sortable.rb @@ -10,7 +10,7 @@ unless included_modules.include? InstanceMethods include InstanceMethods before_filter :resolve_sort - class_inheritable_accessor :options + class_attribute :options end self.options = options @@ -49,4 +49,4 @@ end end -end+end
Stop using class_inheritable_accessor as it is deprecated in Rails 3.1.x.
diff --git a/activeadmin-blog.gemspec b/activeadmin-blog.gemspec index abc1234..def5678 100644 --- a/activeadmin-blog.gemspec +++ b/activeadmin-blog.gemspec @@ -8,8 +8,8 @@ spec.version = Activeadmin::Blog::VERSION spec.authors = ["Stefano Verna"] spec.email = ["stefano.verna@welaika.com"] - spec.description = %q{TODO: Write a gem description} - spec.summary = %q{TODO: Write a gem summary} + spec.description = "Adds a blog to active admin" + spec.summary = "Adds a blog to active admin" spec.homepage = "" spec.license = "MIT"
Add a gem description and summary
diff --git a/lib/tiyo_hw/runners/ruby.rb b/lib/tiyo_hw/runners/ruby.rb index abc1234..def5678 100644 --- a/lib/tiyo_hw/runners/ruby.rb +++ b/lib/tiyo_hw/runners/ruby.rb @@ -18,7 +18,7 @@ add_command "bin/rake db:setup" add_command "bin/rails s & sleep #{SLEEP_TIME} && open http://localhost:3000" add_command "bin/rake test" - add_command "%%" # Reown the rails s process + add_command "sleep 1 && %%" # Reown the rails s process end def prepare_commands
Add a sleep before reattempting to renown process
diff --git a/lib/bunny/concurrent/continuation_queue.rb b/lib/bunny/concurrent/continuation_queue.rb index abc1234..def5678 100644 --- a/lib/bunny/concurrent/continuation_queue.rb +++ b/lib/bunny/concurrent/continuation_queue.rb @@ -6,36 +6,53 @@ # # @private class ContinuationQueue - def initialize(*args, &block) - @q = ::Queue.new(*args) + def initialize + @q = [] + @lock = ::Mutex.new + @cond = ::ConditionVariable.new end - def push(*args) - @q.push(*args) + def push(item) + @lock.synchronize do + @q.push(item) + @cond.signal + end end alias << push def pop - @q.pop + poll end def poll(timeout_in_ms = nil) - if timeout_in_ms - Bunny::Timeout.timeout(timeout_in_ms / 1000.0, ::Timeout::Error) do - @q.pop + timeout = timeout_in_ms ? timeout_in_ms / 1000.0 : nil + + @lock.synchronize do + if @q.empty? + @cond.wait(@lock, timeout) + raise ::Timeout::Error if @q.empty? end - else - @q.pop + item = @q.shift + @cond.signal + + item end end def clear - @q.clear + @lock.synchronize do + @q.clear + end end - def method_missing(selector, *args, &block) - @q.__send__(selector, *args, &block) + def empty? + @q.empty? end + + def size + @q.size + end + alias length size end end end
Implement ContinuationQueue more efficiently with lower-level primitives.
diff --git a/webapp/lib/trisano.rb b/webapp/lib/trisano.rb index abc1234..def5678 100644 --- a/webapp/lib/trisano.rb +++ b/webapp/lib/trisano.rb @@ -1,5 +1,5 @@ module Trisano - VERSION = %w(3 5 4).freeze + VERSION = %w(3 5 5).freeze end require 'trisano/application'
Set TriSano version to 3.5.5
diff --git a/statsd-instrument.gemspec b/statsd-instrument.gemspec index abc1234..def5678 100644 --- a/statsd-instrument.gemspec +++ b/statsd-instrument.gemspec @@ -16,7 +16,7 @@ spec.license = "MIT" spec.files = `git ls-files`.split($/) - spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } + spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] end
Fix the gemspec executables prefix
diff --git a/ontrac-web-services.gemspec b/ontrac-web-services.gemspec index abc1234..def5678 100644 --- a/ontrac-web-services.gemspec +++ b/ontrac-web-services.gemspec @@ -17,5 +17,5 @@ gem.version = Ontrac::VERSION gem.required_ruby_version = '>= 1.9.0' - gem.add_dependency("nokogiri") + gem.add_dependency("nokogiri", "~> 1.0") end
Set a version for the nokogiri dependency.
diff --git a/spec/lib/gitlab/ci/variables/collection/item_spec.rb b/spec/lib/gitlab/ci/variables/collection/item_spec.rb index abc1234..def5678 100644 --- a/spec/lib/gitlab/ci/variables/collection/item_spec.rb +++ b/spec/lib/gitlab/ci/variables/collection/item_spec.rb @@ -14,12 +14,11 @@ end it 'supports using an active record resource' do - resource = described_class.fabricate(create(:ci_variable)) + variable = create(:ci_variable, key: 'CI_VAR', value: '123') + resource = described_class.fabricate(variable) expect(resource).to be_a(described_class) - expect(resource).to eq(key: 'VARIABLE_1', - value: 'VARIABLE_VALUE', - public: false) + expect(resource).to eq(key: 'CI_VAR', value: '123', public: false) end it 'supports using another collection item' do
Fix variables collection item sequence specs
diff --git a/spec/services/notification_recipient_service_spec.rb b/spec/services/notification_recipient_service_spec.rb index abc1234..def5678 100644 --- a/spec/services/notification_recipient_service_spec.rb +++ b/spec/services/notification_recipient_service_spec.rb @@ -19,8 +19,8 @@ end end - it 'avoids N+1 queries' do - create_watcher + it 'avoids N+1 queries', :request_store do + Gitlab::GitalyClient.allow_n_plus_1_calls { create_watcher } service.build_new_note_recipients(note) @@ -28,7 +28,7 @@ service.build_new_note_recipients(note) end - create_watcher + Gitlab::GitalyClient.allow_n_plus_1_calls { create_watcher } expect { service.build_new_note_recipients(note) }.not_to exceed_query_limit(control_count) end
Fix NotificationRecipientService spec for EE EE checks a license, which needs RequestStore enabled to avoid N+1 queries. However, enabling RequestStore causes Gitaly to complain about N+1 invocations, which we really don't care about here.
diff --git a/app/forms/additional_respondents_form/additional_respondent.rb b/app/forms/additional_respondents_form/additional_respondent.rb index abc1234..def5678 100644 --- a/app/forms/additional_respondents_form/additional_respondent.rb +++ b/app/forms/additional_respondents_form/additional_respondent.rb @@ -1,8 +1,7 @@ class AdditionalRespondentsForm class AdditionalRespondent < CollectionForm::Resource NAME_LENGTH = 100 - NO_ACAS_REASON = %w<joint_claimant_has_acas_number acas_has_no_jurisdiction - employer_contacted_acas interim_relief claim_against_security_services>.freeze + NO_ACAS_REASON = RespondentForm::NO_ACAS_REASON include AddressAttributes
Unify no acas reasons for all respondent types
diff --git a/lib/expedia.rb b/lib/expedia.rb index abc1234..def5678 100644 --- a/lib/expedia.rb +++ b/lib/expedia.rb @@ -25,7 +25,7 @@ attr_accessor :cid, :api_key, :shared_secret, :format, :locale, :currency_code, :minor_rev - # Default way to setup Expedia. Run rake task to create + # Default way to setup Expedia. Run generator to create # a fresh initializer with all configuration values. def setup yield self
Change in comments to refelect new behavior
diff --git a/lib/migrate.rb b/lib/migrate.rb index abc1234..def5678 100644 --- a/lib/migrate.rb +++ b/lib/migrate.rb @@ -34,7 +34,7 @@ # This enables us to have separate migrations # for each app. table: 'schema_info_metrics', - version: 4 + version: 5 ) # Cocoadocs migrations.
Migrate to the correct version.
diff --git a/app/controllers/export_controller.rb b/app/controllers/export_controller.rb index abc1234..def5678 100644 --- a/app/controllers/export_controller.rb +++ b/app/controllers/export_controller.rb @@ -2,9 +2,6 @@ ######### Exports class ExportController < ApplicationController - EXPORTABLE_MODELS = [Image, Location, LocationDescription, NameDescription, - Name].freeze - before_action :login_required # Callback (no view) to let reviewers change the export status of an @@ -14,12 +11,13 @@ id = params[:id].to_s type = params[:type].to_s value = params[:value].to_s - model_class = EXPORTABLE_MODELS.find { |m| m.name.downcase == type } - + model_class = type.camelize.safe_constantize if !reviewer? flash_error(:runtime_admin_only.t) redirect_back_or_default("/") - elsif !model_class + elsif !model_class || + !model_class.respond_to?(:column_names) || + model_class.column_names.exclude?("ok_for_export") flash_error(:runtime_invalid.t(type: '"type"', value: type)) redirect_back_or_default("/") elsif !value.match(/^[01]$/) @@ -38,4 +36,4 @@ end end end -end +end
Revert "Re-fix RCE issue in ExportController" This reverts commit 2367ff36fdfdfcd344d37e6fc117045ecb3260a7.
diff --git a/app/controllers/skills_controller.rb b/app/controllers/skills_controller.rb index abc1234..def5678 100644 --- a/app/controllers/skills_controller.rb +++ b/app/controllers/skills_controller.rb @@ -7,7 +7,7 @@ end def create - skill = current_user.skills.build(skills_params) + skill = User.first.skills.build(skills_params) if skill.save respond_to do |format| format.html {redirect_to skill_path(skill)}
Replace current_user with temporary fix
diff --git a/app/helpers/pulitzer/posts_helper.rb b/app/helpers/pulitzer/posts_helper.rb index abc1234..def5678 100644 --- a/app/helpers/pulitzer/posts_helper.rb +++ b/app/helpers/pulitzer/posts_helper.rb @@ -23,7 +23,7 @@ def render_element(element) if element.image_type? - image_tag element.image_url(:thumb) + image_tag(element.image_url(:thumb)) if element.image? elsif element.video_type? render_video(element) else
Fix element image type rendering
diff --git a/script_relocator.gemspec b/script_relocator.gemspec index abc1234..def5678 100644 --- a/script_relocator.gemspec +++ b/script_relocator.gemspec @@ -19,9 +19,9 @@ 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 'minitest-reporters', '~> 1.1' - spec.add_development_dependency 'rake', '~> 10.0' + spec.add_development_dependency 'bundler' + spec.add_development_dependency 'minitest-reporters' + spec.add_development_dependency 'rake' spec.add_runtime_dependency 'nokogiri', '~> 1.6' end
Test with newer versons of gems
diff --git a/app/services/scrapers/nhl_scraper.rb b/app/services/scrapers/nhl_scraper.rb index abc1234..def5678 100644 --- a/app/services/scrapers/nhl_scraper.rb +++ b/app/services/scrapers/nhl_scraper.rb @@ -8,12 +8,13 @@ # Extract the table which holds the league standings for the NHL def league_standings - # This XPath works for all league standings: division, conference and - # wildcard. + # Select the table rows `<tr>` within `<div id="shsStandings">` @document.xpath('//div[@id="shsStandings"]/table[2]/tbody/tr').text end def league_injuries + # The XPath query is confusing because XPath does not support CSS class + # selection. Hence, we must use magic. @document.xpath( '//div[@id="shsNHLInjuries"]/table[contains(concat(" ", normalize-space('\ '@class), " "), " shsTable ")] | //div[@id="shsNHLInjuries"]/h2' @@ -21,6 +22,7 @@ end def team_roster + # Select the table `<table>` within `<div id="shsNHLTeamStats">` @document.xpath('//div[@id="shsNHLTeamStats"]/table[1]').text end end
Add comments explaining the XPath queries
diff --git a/samples/ec2.rb b/samples/ec2.rb index abc1234..def5678 100644 --- a/samples/ec2.rb +++ b/samples/ec2.rb @@ -11,6 +11,13 @@ ec2 = AWS::EC2.new ENV["AWS_KEY"], ENV["AWS_SECRET"] -p ec2.describe_instances - -p ec2.describe_addresses +ec2.describe_addresses.addresses_set.each do |address| + puts "IP: #{address.public_ip}" + puts "Instance ID: #{address.instance_id}" + puts "Domain: #{address.domain}" + if address.domain == "vpc" + puts "Allocation ID: #{address.allocation_id}" + puts "Association ID: #{address.association_id}" + end + puts "" +end
Update sample to work with all information in DescribeAddresses
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 = 'evt-schema' s.summary = "Primitives for schema and structure" - s.version = '0.6.0.3' + s.version = '0.6.1.0' s.description = ' ' s.authors = ['The Eventide Project']
Package version is increased from 0.6.0.3 to 0.6.1.0
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 = 'evt-schema' s.summary = "Primitives for schema and data structure" - s.version = '2.2.7.1' + s.version = '2.2.7.2' s.description = ' ' s.authors = ['The Eventide Project']
Package version is increased from 2.2.7.1 to 2.2.7.2
diff --git a/Artsy+UILabels.podspec b/Artsy+UILabels.podspec index abc1234..def5678 100644 --- a/Artsy+UILabels.podspec +++ b/Artsy+UILabels.podspec @@ -15,4 +15,5 @@ s.frameworks = 'UIKit' s.dependency 'Artsy+UIColors', '~> 3.0' + s.dependency 'Artsy+UIFonts' end
Add UIFonts to the Podspec
diff --git a/db/migrate/20211028165711_add_partial_index_to_clinics_code.rb b/db/migrate/20211028165711_add_partial_index_to_clinics_code.rb index abc1234..def5678 100644 --- a/db/migrate/20211028165711_add_partial_index_to_clinics_code.rb +++ b/db/migrate/20211028165711_add_partial_index_to_clinics_code.rb @@ -0,0 +1,12 @@+class AddPartialIndexToClinicsCode < ActiveRecord::Migration[5.2] + def change + within_renalware_schema do + # Replace index on clinic_clinics.code so that it's unique + # only when deleted_at is null, so that it's possible to add a clinic with the same + # code as one that has been soft deleted. The alternative is to allow a user + # to reinstate a deleted clinic, but we are going this way for now! + remove_index(:clinic_clinics, :code) + add_index(:clinic_clinics, :code, unique: true, where: "deleted_at IS NULL") + end + end +end
Add partial index to clinic_clinics Replace index on clinic_clinics.code so that it's unique only when deleted_at is null, so that it's possible to add a clinic with the same code as one that has been soft deleted. The alternative is to allow a user to reinstate a deleted clinic, but we are going this way for now!
diff --git a/lib/fog/openstack/volume/requests/create_volume.rb b/lib/fog/openstack/volume/requests/create_volume.rb index abc1234..def5678 100644 --- a/lib/fog/openstack/volume/requests/create_volume.rb +++ b/lib/fog/openstack/volume/requests/create_volume.rb @@ -6,7 +6,8 @@ def _create_volume(data, options = {}) vanilla_options = [:snapshot_id, :imageRef, :volume_type, - :source_volid, :availability_zone, :metadata] + :source_volid, :availability_zone, :metadata, + :multiattach] vanilla_options.select { |o| options[o] }.each do |key| data['volume'][key] = options[key] end
Add multiattach parameter to volume creation
diff --git a/lib/generators/link_to_action/install_generator.rb b/lib/generators/link_to_action/install_generator.rb index abc1234..def5678 100644 --- a/lib/generators/link_to_action/install_generator.rb +++ b/lib/generators/link_to_action/install_generator.rb @@ -5,14 +5,16 @@ module Generators class InstallGenerator < Rails::Generators::Base desc "Copy LinkToAction configuration file" - source_root File.expand_path('../templates', __FILE__) + source_root File.expand_path('../../..', __FILE__) def copy_initializers - copy_file 'link_to_action.rb', 'config/initializers/link_to_action.rb' + copy_file 'generators/link_to_action/templates/link_to_action.rb', + 'config/initializers/link_to_action.rb' end def copy_locale_file - copy_file 'en.yml', 'config/locales/link_to_action.en.yml' + copy_file 'link_to_action/locale/en.yml', + 'config/locales/link_to_action.en.yml' end end end
Fix install generator (en.yml was not copied).
diff --git a/lib/mongomodel/concerns/attribute_methods/dirty.rb b/lib/mongomodel/concerns/attribute_methods/dirty.rb index abc1234..def5678 100644 --- a/lib/mongomodel/concerns/attribute_methods/dirty.rb +++ b/lib/mongomodel/concerns/attribute_methods/dirty.rb @@ -6,6 +6,7 @@ include ActiveModel::Dirty included do + before_save { @previously_changed = changes } after_save { changed_attributes.clear } end
Save previous changes before saving
diff --git a/Casks/texturepacker.rb b/Casks/texturepacker.rb index abc1234..def5678 100644 --- a/Casks/texturepacker.rb +++ b/Casks/texturepacker.rb @@ -4,7 +4,7 @@ url "https://www.codeandweb.com/download/texturepacker/#{version}/TexturePacker-#{version}-uni.dmg" name 'TexturePacker' - homepage 'http://www.codeandweb.com/texturepacker' + homepage 'https://www.codeandweb.com/texturepacker' license :freemium app 'TexturePacker.app'
Fix homepage to use SSL in TexturePacker Cask The HTTP URL is already getting redirected to HTTPS. Using the HTTPS URL directly makes it more secure and saves a HTTP round-trip.
diff --git a/app/controllers/payments_controller.rb b/app/controllers/payments_controller.rb index abc1234..def5678 100644 --- a/app/controllers/payments_controller.rb +++ b/app/controllers/payments_controller.rb @@ -5,9 +5,6 @@ @query = params[:query] @payments = @payments.search(@query) if @query.present? @groups = @payments.recent.grouped_by_relative_date - end - - def new end def create
Remove unused new action in payments controller.
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index abc1234..def5678 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -2,7 +2,7 @@ def index @projects = Project.by_last_updated @entry = Entry.new - @activities = Entry.last(10).reverse + @activities = Entry.last(20).reverse end def show
Increase size of activity feed
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -3,7 +3,7 @@ end def create - user = User.find_by_mtgname(params[:session][:mtgname].downcase) + user = User.find_by_mtgname(params[:session][:mtgname]) if user && user.authenticate(params[:session][:password]) sign_in user redirect_back_or user
Fix signin bug (because of lower case)
diff --git a/app/controllers/webhooks_controller.rb b/app/controllers/webhooks_controller.rb index abc1234..def5678 100644 --- a/app/controllers/webhooks_controller.rb +++ b/app/controllers/webhooks_controller.rb @@ -7,10 +7,10 @@ user_id: user.id, event: 'Uninstalled Shopify app', properties: { - plus: user.is_plus? + activeCharge: user.active_charge? } }) - user.update(plus: false) + user.update(active_charge: false) end end
Remove some more 'plus' occurrences
diff --git a/app/controllers/websites_controller.rb b/app/controllers/websites_controller.rb index abc1234..def5678 100644 --- a/app/controllers/websites_controller.rb +++ b/app/controllers/websites_controller.rb @@ -40,7 +40,7 @@ def update @website = @contact.websites.find(params[:id]) - if @website.update_attributes(params[:webiste]) + if @website.update_attributes(params[:website]) redirect_to contact_url(@contact), :notice => 'Website updated.' else render :action => :edit
Fix editing of contact's website.
diff --git a/app.rb b/app.rb index abc1234..def5678 100644 --- a/app.rb +++ b/app.rb @@ -28,14 +28,19 @@ erb :'index.html' end -get '/host/:host' do |host| +get %r{/host/([^\/?#\.]+)(?:\.|%2E)?([^\/?#]+)?} do |host, format| @record = IP.find_by_host(host) pass unless @record - erb :'show.html' + if format == 'txt' + content_type 'text/plain' + @record.ip + else + erb :'show.html' + end end -post '/host/:host' do |host| +post %r{/host/([^\/?#\.]+)(?:\.|%2E)?([^\/?#]+)?} do |host, format| record = IP.find_by_host(host) unless record record = IP.new @@ -46,5 +51,6 @@ record.save! - redirect "/#{host}" + format = ".#{format}" if format + redirect "/host/#{host}#{format}" end
Add support for '.txt' format to get IP in plain text
diff --git a/spec/api/giropay_spec.rb b/spec/api/giropay_spec.rb index abc1234..def5678 100644 --- a/spec/api/giropay_spec.rb +++ b/spec/api/giropay_spec.rb @@ -0,0 +1,12 @@+require 'spec_helper' + +describe GiroCheckout::GcGiropaytransactionstartMessage do + + it "should not be able to send a http request" do + transaction = Factory.create(:transaction) + msg = GiroCheckout::GcGiropaytransactionstartMessage.new(transaction, 'DUSDXXXX') + response = msg.make_api_call + expect(response).to be_an_instance_of(String) + end + +end
Test to check http interception
diff --git a/spec/factories/clouds.rb b/spec/factories/clouds.rb index abc1234..def5678 100644 --- a/spec/factories/clouds.rb +++ b/spec/factories/clouds.rb @@ -16,7 +16,7 @@ factory :cloud_aws, class: Cloud do name 'cloud-aws-12345678' cloud_type 'aws' - cloud_entry_point_url 'http://example.com/' + entry_point 'ap-northeast-1' key '1234567890abcdef' secret 'fedcba9876543210' tenant_id nil @@ -25,7 +25,7 @@ factory :cloud_openstack, class: Cloud do name 'cloud-openstack-12345678' cloud_type 'openstack' - cloud_entry_point_url 'http://example.com/' + entry_point 'http://example.com/' key '1234567890abcdef' secret 'fedcba9876543210' tenant_id '1'
Fix column name that is changed by ad67746 on factory file
diff --git a/spec/image/image_spec.rb b/spec/image/image_spec.rb index abc1234..def5678 100644 --- a/spec/image/image_spec.rb +++ b/spec/image/image_spec.rb @@ -26,20 +26,24 @@ it { should be_installed } end -describe service('glance-api') do - it { should be_enabled } - it { should be_running } +describe package('python-ceph') do + it { should be_installed } end -describe service('glance-registry') do - it { should be_enabled } - it { should be_running } +describe file('/etc/glance/glance.conf') do + it { should contain "default_store=rbd" } + it { should contain "rbd_store_pool=images" } + it { should contain "rbd_store_user=glance" } + it { should contain "rbd_store_ceph_conf=/etc/ceph/ceph.conf" } end -describe port(9292) do - it { should be_listening.with('tcp') } +describe file('/etc/ceph/ceph.client.glance.keyring') do + it { should be_owned_by 'glance' } + it { should be_grouped_into 'glance' } + it { should be_mode 400 } end -describe port(9191) do - it { should be_listening.with('tcp') } +describe cron do + it { should have_entry '1 0 * * * glance-cache-cleaner' } + it { should have_entry '*/30 * * * * glance-cache-pruner' } end
Add checks on Ceph backend for Glance
diff --git a/spec/lib/commons_spec.rb b/spec/lib/commons_spec.rb index abc1234..def5678 100644 --- a/spec/lib/commons_spec.rb +++ b/spec/lib/commons_spec.rb @@ -0,0 +1,30 @@+require 'rails_helper' +require "#{Rails.root}/lib/commons" + +describe Commons do + describe '.import_all_uploads' do + it 'should find and record files uploaded to Commons' do + create(:user, + wiki_id: 'Ragesoss') + VCR.use_cassette 'commons/import_all_uploads' do + Commons.import_all_uploads + expect(CommonsUpload.all.count).to eq(3194) + end + end + end + + describe '.update_usage_count' do + it 'should find and record files uploaded to Commons' do + create(:user, + wiki_id: 'Ragesoss') + VCR.use_cassette 'commons/import_all_uploads' do + Commons.import_all_uploads + end + VCR.use_cassette 'commons/update_usage_count' do + Commons.update_usage_count + expect(CommonsUpload.first.usage_count).to eq(1) + pp CommonsUpload.sum(:usage_count) + end + end + end +end
Add fragile, preliminary tests for Commons.rb
diff --git a/spec/permissions_spec.rb b/spec/permissions_spec.rb index abc1234..def5678 100644 --- a/spec/permissions_spec.rb +++ b/spec/permissions_spec.rb @@ -50,7 +50,16 @@ p.scoped_model(:view, model).should == scoped_model end - it "should allow scopes to be defined through where conditions" + it "should allow scopes to be defined through where conditions" do + model = mock + model.should_receive(:where).with(awesome: true).and_return(scoped_model = mock) + + p = Permissions.new do + can :view, model, awesome: true + end + + p.scoped_model(:view, model).should == scoped_model + end end end end
Add spec for where conditions hash
diff --git a/semver.podspec b/semver.podspec index abc1234..def5678 100644 --- a/semver.podspec +++ b/semver.podspec @@ -6,7 +6,8 @@ s.license = 'MIT' s.author = { "di wu" => "di.wu@me.com" } s.source = { :git => "https://github.com/weekwood/semver.swift.git", :tag => s.version.to_s } - s.platform = :ios, '8.0' + s.ios.deployment_target = '8.0' + s.osx.deployment_target = '10.10' s.requires_arc = true s.source_files = ['SemverSwift/Semver.swift'] end
Add os x support to podspec
diff --git a/spec/unit/helper_spec.rb b/spec/unit/helper_spec.rb index abc1234..def5678 100644 --- a/spec/unit/helper_spec.rb +++ b/spec/unit/helper_spec.rb @@ -0,0 +1,44 @@+ +# This seems wrong, but I don't actually know how to do this +require_relative '../../libraries/icinga2.rb' + +describe "#icinga_format" do + subject { icinga_format } + + it "handles hashes" do + expect(icinga_format({:foo => :bar})).to eq('{ "foo" = "bar" }') + end + + it "handles arrays" do + expect(icinga_format([1,3,5])).to eq('[ 1, 3, 5 ]') + end + + it "handles strings" do + expect(icinga_format("foo")).to eq('"foo"') + end + + it "handles floats" do + expect(icinga_format(1.2)).to eq('1.2') + end + + it "handles fixnums" do + expect(icinga_format(10)).to eq('10') + end + + it "handles nulls" do + expect(icinga_format(nil)).to eq("null") + end + + it "handles nesting" do + expect(icinga_format({:foo => [:bar, {1=>2}, {1=>[:a,:b,:c]}]})).to eq('{ "foo" = [ "bar", { 1 = 2 }, { 1 = [ "a", "b", "c" ] } ] }') + end + + it "handles arbitrary objects by stringifying them" do + expect(icinga_format(StandardError.new)).to eq('"#<StandardError: StandardError>"') + end + + it "Arbitrary stringifying works with nesting" do + expect(icinga_format({"err"=>StandardError.new, "list"=>[{"err"=>IOError.new}]})).to eq('{ "err" = "#<StandardError: StandardError>", "list" = [ { "err" = "#<IOError: IOError>" } ] }') + end + +end
Add unit tests for formatting output
diff --git a/app/models/post_viewer.rb b/app/models/post_viewer.rb index abc1234..def5678 100644 --- a/app/models/post_viewer.rb +++ b/app/models/post_viewer.rb @@ -3,4 +3,5 @@ belongs_to :user validates_presence_of :user, :post + attr_accessible :user, :user_id, :post, :post_id end
Fix post viewers to be attachable on post creation
diff --git a/softie.gemspec b/softie.gemspec index abc1234..def5678 100644 --- a/softie.gemspec +++ b/softie.gemspec @@ -21,4 +21,5 @@ spec.specification_version = 3 spec.add_runtime_dependency "mongo_mapper", ">= 0.9.0" spec.add_development_dependency "rspec", "~> 2.11" + spec.add_development_dependency "rake" end
Add Rake as a development dependency
diff --git a/test/tunefish_test.rb b/test/tunefish_test.rb index abc1234..def5678 100644 --- a/test/tunefish_test.rb +++ b/test/tunefish_test.rb @@ -27,7 +27,6 @@ def test_it_finds_activity_for_a_user VCR.use_cassette('user_activities') do activities = @client.user_activities(2) - assert_instance_of Array, activities assert_equal "youtube", activities.first.provider end end
Remove assertion that is now implicitly tested
diff --git a/app/models/indicator_history.rb b/app/models/indicator_history.rb index abc1234..def5678 100644 --- a/app/models/indicator_history.rb +++ b/app/models/indicator_history.rb @@ -31,15 +31,15 @@ end def update_permitted? - same_company + indicator.update_permitted? end def destroy_permitted? - same_company + indicator.destroy_permitted? end def view_permitted?(field) - same_company + indicator.view_permitted? end end
Fix error deleting indicator histories.
diff --git a/app/controllers/supervision_memberships_controller.rb b/app/controllers/supervision_memberships_controller.rb index abc1234..def5678 100644 --- a/app/controllers/supervision_memberships_controller.rb +++ b/app/controllers/supervision_memberships_controller.rb @@ -20,7 +20,7 @@ def destroy current_user.leave_supervision(@supervision) - redirect_to supervisions_path + redirect_to group_path(@supervision.group) end protected
Supervision: Change leave supervision button to direct back to group page
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 @@ -16,5 +16,3 @@ # Specify the path to a local JSON file with Ohai data (default: nil) # config.path = 'ohai.json' end - -at_exit { ChefSpec::Coverage.report! }
Remove the chefspec converge report These are useless and lead to poorly written specs Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -5,8 +5,9 @@ begin require 'simplecov' SimpleCov.start do - add_filter '/spec/' # exclude test code - add_filter '/vendor/' # exclude gems which are vendored on Travis CI + add_filter '/spec/' # exclude test code + add_filter '/vendor/' # exclude gems which are vendored on Travis CI + add_filter '/on_what.rb' # exclude help used only in gemspec end # On CI we publish simplecov results to codecov.io
Exclude on_what helper from test coverage
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 @@ -6,6 +6,8 @@ require_relative 'support/unique_worker' require_relative 'support/another_unique_worker' +Resque.redis.namespace = 'resque:test' + RSpec.configure do |config| config.before(:each) do ResqueSpec.reset!
Add a redis namespace 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 @@ -14,4 +14,8 @@ config.run_all_when_everything_filtered = true config.role_path = File.expand_path('../roles', __FILE__) + + # Default chefspec platform and platform version + config.platform = 'ubuntu' + config.version = '14.04' end
Set default chefspec platform and platform version
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,4 +23,8 @@ # Until this library is merged with capybara there needs to be a local app and you need to add # Install pow (get.pow.cx) and run add a symlink in ~/.pow with ln -s lib/capybara/spec capybara-testapp.heroku -REMOTE_TEST_URL = "http://capybara-testapp.heroku.dev:80" +if ENV['HOME'] =~ /jvandijk/ # TODO don't tie it to my personal stuff :) + REMOTE_TEST_URL = "http://capybara-testapp.heroku.dev:80" +else + REMOTE_TEST_URL = "http://capybara-mechanize-testapp.herokuapp.com:80" +end
Use the heroku app when it's not me
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,5 @@+require 'coveralls' +Coveralls.wear! + $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'saxr'
Add coveralls to 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 @@ -6,5 +6,7 @@ require 'fluent/plugin/out_fork' RSpec.configure do |config| + config.before(:all) do + Fluent::Test.setup + end end -
Call Fluent::Test.setup before executing all 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,22 +1,43 @@-$LOAD_PATH.unshift(File.dirname(__FILE__)) -$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) -$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'ext', 'balance_tags_c')) +# Wrap it in a lambda so that we can pass it to Spork.prefork, if spork is installed. +prefork_block = lambda do + # Loading more in this block will cause your tests to run faster. However, + # if you change any configuration or code from libraries loaded here, you'll + # need to restart spork for it take effect. -require 'pidgin2adium' -require 'faker' + $LOAD_PATH.unshift(File.dirname(__FILE__)) + $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) + $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'ext', 'balance_tags_c')) + + require 'pidgin2adium' + require 'faker' + + begin + # RSpec 2 + gem 'rspec', '>= 2.0.0.beta.18' + require 'rspec' + constant = RSpec + rescue Gem::LoadError + # RSpec 1 + gem 'rspec', '~> 1.3' + require 'spec' + require 'spec/autorun' + constant = Spec::Runner + end + + constant.configure do |config| + end +end begin - # RSpec 2 - gem 'rspec', '>= 2.0.0.beta.18' - require 'rspec' - constant = RSpec -rescue Gem::LoadError - # RSpec 1 - gem 'rspec', '~> 1.3' - require 'spec' - require 'spec/autorun' - constant = Spec::Runner + require 'rubygems' + require 'spork' + Spork.prefork(&prefork_block) + Spork.each_run do + # This code will be run each time you run your specs. + end +rescue LoadError + puts 'To make the tests run faster, run "sudo install spork" then run "spork"' + puts 'from the base pidgin2adium directory.' + # Spork isn't installed. + prefork_block.call end - -constant.configure do |config| -end
Use spork if available and fall back if it's not
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,4 +28,10 @@ RSpec.configure do |c| c.filter_run :focus => true if ENV['FOCUS'] c.include BlueShell::Matchers + c.before(:suite) do + unless ENV['TEST_ENV_NUMBER'] + agent_build_cmd = File.expand_path('../../go/src/github.com/cloudfoundry/bosh-agent/bin/build', __FILE__) + system(agent_build_cmd) + end + end end
Build agent before running individual tests Signed-off-by: Colin Obyrne <c47cc0033a0530c1ec004ae8db451730368aa030@pivotal.io>
diff --git a/lib/baustelle/cloud_formation/remote_template.rb b/lib/baustelle/cloud_formation/remote_template.rb index abc1234..def5678 100644 --- a/lib/baustelle/cloud_formation/remote_template.rb +++ b/lib/baustelle/cloud_formation/remote_template.rb @@ -20,7 +20,7 @@ file.put(body: stack_template.to_json) main_temlate_url = file.public_url stack_template.childs.each do |child_name, child_template| - file(child_name).put(child_template.to_json) + file(child_name).put(child_template.build(@stack_name, @region, @bucket.name).to_json) end yield main_temlate_url ensure
Call build for child templates
diff --git a/lib/convection/model/template/custom_resource.rb b/lib/convection/model/template/custom_resource.rb index abc1234..def5678 100644 --- a/lib/convection/model/template/custom_resource.rb +++ b/lib/convection/model/template/custom_resource.rb @@ -21,7 +21,6 @@ @template = parent.template template.attach_resource(@name, self.class) - attach_resource(@name, self.class) instance_exec(&block) if block end
Remove support for attaching a custom resource to itself
diff --git a/app/workers/beeminder_worker.rb b/app/workers/beeminder_worker.rb index abc1234..def5678 100644 --- a/app/workers/beeminder_worker.rb +++ b/app/workers/beeminder_worker.rb @@ -40,7 +40,7 @@ bclient = goal.provider.user.client bgoal = bclient.goal(goal.slug) scores.map do |ts,value| - Beeminder::Datapoint.new(value: value, timestamp: ts) + Beeminder::Datapoint.new(value: value, timestamp: ts, comment: "Auto-entered by beemind.me for #{ts.to_s} @ #{Time.now}") end.each do |datapoint| bgoal.add datapoint end
Add debug comment to datapoints
diff --git a/spec_helper.rb b/spec_helper.rb index abc1234..def5678 100644 --- a/spec_helper.rb +++ b/spec_helper.rb @@ -2,9 +2,6 @@ root = File.dirname(__FILE__) dir = "fixtures/code" CODE_LOADING_DIR = use_realpath ? File.realpath(dir, root) : File.expand_path(dir, root) - -# Don't run ruby/spec as root -raise 'ruby/spec is not designed to be run as root' if Process.uid == 0 # Enable Thread.report_on_exception by default to catch thread errors earlier if Thread.respond_to? :report_on_exception=
Move the warning about specs as root
diff --git a/cookbooks/rundeck/recipes/default.rb b/cookbooks/rundeck/recipes/default.rb index abc1234..def5678 100644 --- a/cookbooks/rundeck/recipes/default.rb +++ b/cookbooks/rundeck/recipes/default.rb @@ -40,7 +40,10 @@ source "rundeck.pub" end -sudoers "rundeck-admin" do - user node[:rundeck][:user] - rights "ALL = NOPASSWD: ALL" +file "/etc/sudoers.d/rundeck" do + owner "root" + group "root" + mode "0440" + content "rundeck ALL = NOPASSWD: ALL" + action :create end
Use the ghetto LWRP and not the sudoers provider that has been deprecated Former-commit-id: 477057bfb8bd3229883de6bf2be84454e2fdace7 [formerly 7723c617d48ae057ed86fb13a6467e9d59b5c8dd] [formerly eff00b7054b6aa9ab06951dbf5d6d5ab8785ba60 [formerly 707d56db92da0fdf05746c89f5d844279b8dded3]] Former-commit-id: 6134321bbc7a737fb2e71be772d074dc7937b348 [formerly d7ba76e7df8febf365bfb8edc3b638290d1a8fea] Former-commit-id: a58c8c3a276f17bad59e2ea7ff88f9c635766c33
diff --git a/Formula/geoip.rb b/Formula/geoip.rb index abc1234..def5678 100644 --- a/Formula/geoip.rb +++ b/Formula/geoip.rb @@ -14,8 +14,6 @@ end def install - # Fix issue with sed barfing on unicode characters on Mountain Lion. - ENV.delete('LANG') ENV.universal_binary if ARGV.build_universal? # Fixes a build error on Lion when configure does a variant of autoreconf
Fix Mountain Lion sed by setting LANG. It's also necessary to delete LC_ALL or it overrides the new LANG. LC_COLLATE is the problem variable but is affected by LANG and LC_ALL so just use them instead. Extends the fix made to geoip in dc955c. Fix Homebrew/homebrew#11728, fix Homebrew/homebrew#12890, fix Homebrew/homebrew#13653, fix Homebrew/homebrew#13734, fix Homebrew/homebrew#13787, fix Homebrew/homebrew#13818.
diff --git a/Formula/noweb.rb b/Formula/noweb.rb index abc1234..def5678 100644 --- a/Formula/noweb.rb +++ b/Formula/noweb.rb @@ -5,38 +5,43 @@ homepage 'http://www.cs.tufts.edu/~nr/noweb/' url 'ftp://www.eecs.harvard.edu/pub/nr/noweb.tgz' version '2.11b' - sha1 '3b391c42f46dcb8a002b863fb2e483560a7da51d' + sha256 'c913f26c1edb37e331c747619835b4cade000b54e459bb08f4d38899ab690d82' depends_on 'icon' + + def texpath + prefix/'tex/generic/noweb' + end def install cd "src" do system "bash", "awkname", "awk" system "make LIBSRC=icon ICONC=icont CFLAGS='-U_POSIX_C_SOURCE -D_POSIX_C_SOURCE=1'" - if which 'kpsewhich' - ohai 'TeX installation found. Installing TeX support files there might fail if your user does not have permission' - texmf = Pathname.new(`kpsewhich -var-value=TEXMFLOCAL`.chomp) - else - ohai 'No TeX installation found. Installing TeX support files in the noweb Cellar.' - texmf = prefix - end - bin.mkpath lib.mkpath man.mkpath - (texmf/'tex/generic/noweb').mkpath + texpath.mkpath system "make", "install", "BIN=#{bin}", "LIB=#{lib}", "MAN=#{man}", - "TEXINPUTS=#{texmf}/tex/generic/noweb" + "TEXINPUTS=#{texpath}" cd "icon" do system "make", "install", "BIN=#{bin}", "LIB=#{lib}", "MAN=#{man}", - "TEXINPUTS=#{texmf}/tex/generic/noweb" + "TEXINPUTS=#{texpath}" end end end + + def caveats; <<-EOS.undent + TeX support files are installed in the directory: + + #{texpath} + + You may need to add the directory to TEXINPUTS to run noweb properly. + EOS + end end
Clean up TeX support installation, add caveat. Closes Homebrew/homebrew#42110. Signed-off-by: Alex Dunn <46952c1342d5ce1a4f5689855eda3c9064bca8f6@gmail.com>
diff --git a/requirejs_optimizer.gemspec b/requirejs_optimizer.gemspec index abc1234..def5678 100644 --- a/requirejs_optimizer.gemspec +++ b/requirejs_optimizer.gemspec @@ -8,7 +8,7 @@ gem.summary = %q{A tool for optimizing Require.js modules using r.js under the asset pipeline.} gem.homepage = "" - gem.add_dependency "rails", "~> 3.1.0" + gem.add_dependency "rails", "~> 3.1" gem.add_development_dependency "rspec" gem.files = `git ls-files`.split($\)
Use correct rails version specifier
diff --git a/spec/integration/rails/test/test_helper.rb b/spec/integration/rails/test/test_helper.rb index abc1234..def5678 100644 --- a/spec/integration/rails/test/test_helper.rb +++ b/spec/integration/rails/test/test_helper.rb @@ -1,6 +1,11 @@ ENV["RAILS_ENV"] = "test" require File.expand_path(File.dirname(__FILE__) + "/../config/environment") require 'test_help' + +begin + require "redgreen" +rescue MissingSourceFile +end require File.dirname(__FILE__) + "/../../../../lib/webrat"
Use redgreen when running rails integraton tests if available
diff --git a/spec/rails_admin/install_generator_spec.rb b/spec/rails_admin/install_generator_spec.rb index abc1234..def5678 100644 --- a/spec/rails_admin/install_generator_spec.rb +++ b/spec/rails_admin/install_generator_spec.rb @@ -12,7 +12,7 @@ it 'mounts RailsAdmin as Engine and generates RailsAdmin Initializer' do expect_any_instance_of(generator_class).to receive(:route). with("mount RailsAdmin::Engine => '/admin', as: 'rails_admin'") - capture(:stdout) do + silence_stream(STDOUT) do generator.invoke('install') end expect(destination_root).to have_structure{
Remove deprecated use of capture
diff --git a/spec/dolphy_spec.rb b/spec/dolphy_spec.rb index abc1234..def5678 100644 --- a/spec/dolphy_spec.rb +++ b/spec/dolphy_spec.rb @@ -7,6 +7,11 @@ it 'returns a page saying Hello on a correct path' do visit '/' expect(page).to have_content "Hello" + end + + it 'does not have this route' do + visit '/fail' + expect(page).to have_content "Route not found!" end end
Add spec for failing route.
diff --git a/spec/engine_spec.rb b/spec/engine_spec.rb index abc1234..def5678 100644 --- a/spec/engine_spec.rb +++ b/spec/engine_spec.rb @@ -2,23 +2,23 @@ describe Petroglyph::Engine do specify "#to_hash" do - engine = Petroglyph::Engine.new('node :whatever => thing') - engine.to_hash({:thing => 'stuff'}).should eq({:whatever => 'stuff'}) + engine = Petroglyph::Engine.new('node :beverage => drink') + engine.to_hash({:drink => 'espresso'}).should eq({:beverage => 'espresso'}) end it "takes a template" do - engine = Petroglyph::Engine.new('node :whatever => "nevermind"') - engine.render.should eq({:whatever => "nevermind"}.to_json) + engine = Petroglyph::Engine.new('node :beverage => "no, thanks"') + engine.render.should eq({:beverage => "no, thanks"}.to_json) end it "takes a block" do Petroglyph::Engine.new.render do - node :whatever => "nevermind" - end.should eq({:whatever => "nevermind"}.to_json) + node :beverage => "hot chocolate" + end.should eq({:beverage => "hot chocolate"}.to_json) end it "passes the locals" do - engine = Petroglyph::Engine.new('node :whatever => thing') - engine.render(nil, {:thing => 'stuff'}).should eq({:whatever => 'stuff'}.to_json) + engine = Petroglyph::Engine.new('node :beverage => drink') + engine.render(nil, {:drink => 'bai mu cha'}).should eq({:beverage => 'bai mu cha'}.to_json) end end
Use different test data in each engine test.
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,13 @@ require 'rubygems' $:.unshift File.expand_path('../../lib', __FILE__) -gem 'asir' +if p = ENV['ASIR_LIB_PATH'] + $:.unshift File.expand_path(p) +else + gem 'asir' +end require 'asir' +require 'asir/transport/beanstalk' module ASIR module Test
Use $ASIR_LIB_PATH instead of gem.
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,10 +1,8 @@ require 'rubygems' -require 'ruby-debug' +require 'bundler/setup' +Bundler.require(:default, :development) -require 'rspec' require 'ceiling_cat' -require 'fakeweb' - require 'ceiling_cat/storage/hash' FakeWeb.allow_net_connect = false
Use bundler for loading 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 @@ -2,4 +2,6 @@ require 'rails/version' require 'rspec/rails/fixture_support' +# Avoid load order issues in activesupport +require 'active_support/deprecation' require 'ammeter/init'
Fix activesupport load order issues
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,5 @@ require 'simplecov' -SimpleCov.start +SimpleCov.start 'test_frameworks' require 'codeclimate-test-reporter' CodeClimate::TestReporter.start
Use simplecov's default "test_frameworks" profile
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 @@ -33,7 +33,7 @@ if subdirs subdir_file = castle.join(Homesick::SUBDIR_FILENAME) subdirs.each do |subdir| - system "echo #{subdir} >> #{subdir_file}" + File.open(subdir_file, 'a') { |file| file.write "\n#{subdir}\n" } end end return castle.directory('home')
Replace a system call in 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 @@ -14,6 +14,7 @@ Mongoid.configure do |config| config.connect_to('vidibus-versioning_test') + config.identity_map_enabled = true end RSpec.configure do |config|
Test with identity map enabled