diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb index abc1234..def5678 100644 --- a/spec/factories/projects.rb +++ b/spec/factories/projects.rb @@ -4,6 +4,6 @@ factory :project do book client - release_date 3.months.since + release_date 3.months.since.to_date end end
Fix project factory to use Date in release_date
diff --git a/ProcessingKit.podspec b/ProcessingKit.podspec index abc1234..def5678 100644 --- a/ProcessingKit.podspec +++ b/ProcessingKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "ProcessingKit" - s.version = "0.2" + s.version = "0.3.0" s.summary = "Visual Programming library for iOS." s.description = <<-DESC ProcessingKit is a Visual Programming library for iOS.
:arrow_up: Upgrade pod version to 0.3.0
diff --git a/lib/active_admin/mongoid/helpers/collection.rb b/lib/active_admin/mongoid/helpers/collection.rb index abc1234..def5678 100644 --- a/lib/active_admin/mongoid/helpers/collection.rb +++ b/lib/active_admin/mongoid/helpers/collection.rb @@ -9,7 +9,7 @@ if collection.is_a?(::Mongoid::Criteria) collection.count(true) else - collection.count + original_collection_size(collection) end end
Change back to overridden merge
diff --git a/test/integration/phpenv/serverspec/default_spec.rb b/test/integration/phpenv/serverspec/default_spec.rb index abc1234..def5678 100644 --- a/test/integration/phpenv/serverspec/default_spec.rb +++ b/test/integration/phpenv/serverspec/default_spec.rb @@ -15,16 +15,14 @@ require 'serverspec' set :backend, :exec -describe file('/opt/phpenv/versions/5.3.29') do - it { should be_directory } -end +['5.3.29', '5.4.35', '5.5.19'].each do |php_version| + describe file("/opt/phpenv/versions/#{php_version}") do + it { should be_directory } + end -describe file('/opt/phpenv/versions/5.4.35') do - it { should be_directory } -end - -describe file('/opt/phpenv/versions/5.5.19') do - it { should be_directory } + describe file("/opt/phpenv/versions/#{php_version}/bin/pear") do + it { should be_file } + end end describe file('/opt/phpenv/version') do
Add little test to make sur pear is installed
diff --git a/db/migrate/20140922170030_add_typeto_public.rb b/db/migrate/20140922170030_add_typeto_public.rb index abc1234..def5678 100644 --- a/db/migrate/20140922170030_add_typeto_public.rb +++ b/db/migrate/20140922170030_add_typeto_public.rb @@ -6,7 +6,7 @@ # t.string :type, null: true - Metasploit::Credential::Public.update_all(type: 'Metasploit::Credential::Username') + execute "UPDATE metasploit_credential_publics SET type = 'Metasploit::Credential::Username'" change_column :metasploit_credential_publics, :type, :string, null: false
Use direct SQL instead of model reference in migraion MSP-11247
diff --git a/SwiftlySalesforce.podspec b/SwiftlySalesforce.podspec index abc1234..def5678 100644 --- a/SwiftlySalesforce.podspec +++ b/SwiftlySalesforce.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "SwiftlySalesforce" -s.version = "7.1.5" +s.version = "7.1.6" s.summary = "The swiftest way to build iOS apps that connect to Salesforce." s.description = <<-DESC
Update default Salesforce API version Now 44.0 (Winter '19)
diff --git a/lib/redmine_recurring_tasks/issue_presenter.rb b/lib/redmine_recurring_tasks/issue_presenter.rb index abc1234..def5678 100644 --- a/lib/redmine_recurring_tasks/issue_presenter.rb +++ b/lib/redmine_recurring_tasks/issue_presenter.rb @@ -28,13 +28,14 @@ end def schedule_template - return '' if recurring_task_root.issue == __getobj__ + root_issue = recurring_task_root&.issue + return '' if root_issue.blank? || root_issue == __getobj__ result = <<-HTML <div> #{I18n.t(:template)}: - #{ActionController::Base.helpers.link_to("#{recurring_task_root.issue.subject.truncate(60)} ##{recurring_task_root.issue.id}", issue_path(recurring_task_root.issue))} + #{ActionController::Base.helpers.link_to("#{root_issue.subject.truncate(60)} ##{root_issue.id}", issue_path(root_issue))} </div> HTML result.html_safe
Fix error on issue page
diff --git a/vmdb/spec/models/miq_server/log_management_spec.rb b/vmdb/spec/models/miq_server/log_management_spec.rb index abc1234..def5678 100644 --- a/vmdb/spec/models/miq_server/log_management_spec.rb +++ b/vmdb/spec/models/miq_server/log_management_spec.rb @@ -2,21 +2,21 @@ describe MiqServer do context "LogManagement" do - let(:depot) { FactoryGirl.build(:file_depot, :uri => uri) { |d| d.save(:validate => false) } } - let(:new_depot_hash) { {:uri => "nfs://server.example.com", :username => "new_user", :password => "new_pass"} } - let(:uri) { "smb://server/share" } - - before do - _, @miq_server, @zone = EvmSpecHelper.create_guid_miq_server_zone - depot.update_authentication(:default => {:userid => "user", :password => "pass"}) - end - context "#get_log_depot_settings" do let(:depot_hash) do {:uri => uri, :username => "user", :password => "pass", :name => "File Depot"} + end + + let(:depot) { FactoryGirl.build(:file_depot, :uri => uri) { |d| d.save(:validate => false) } } + let(:new_depot_hash) { {:uri => "nfs://server.example.com", :username => "new_user", :password => "new_pass"} } + let(:uri) { "smb://server/share" } + + before do + _, @miq_server, @zone = EvmSpecHelper.create_guid_miq_server_zone + depot.update_authentication(:default => {:userid => "user", :password => "pass"}) end it "set on miq_server" do
Move specific setup out of the general LogManagement context. https://bugzilla.redhat.com/show_bug.cgi?id=1174855
diff --git a/lib/rom/command_registry.rb b/lib/rom/command_registry.rb index abc1234..def5678 100644 --- a/lib/rom/command_registry.rb +++ b/lib/rom/command_registry.rb @@ -17,9 +17,6 @@ # rom.command(:users).try { update(:by_id, 1).set(name: 'Jane Doe') } # rom.command(:users).try { delete(:by_id, 1) } # - # rom.command(:users).try { |command| command.create(name: 'Jane') } - # rom.command(:users).try { |command| command.delete(:by_id, 1) } - # # @return [Commands::Result] # # @api public
Remove obsolete usage of CommandRegistry Passing argument to the block was removed in 63d6e1316. [ci skip]
diff --git a/lib/strut/report_builder.rb b/lib/strut/report_builder.rb index abc1234..def5678 100644 --- a/lib/strut/report_builder.rb +++ b/lib/strut/report_builder.rb @@ -40,7 +40,7 @@ end def failed_result?(result, metadata) - metadata.expected_value && metadata.expected_value != result + metadata.expected_value && metadata.expected_value.to_s != result.to_s end end end
Convert expected and returned values to strings before comparison so we can check bools, ints, etc.
diff --git a/lib/workers/heroku_build.rb b/lib/workers/heroku_build.rb index abc1234..def5678 100644 --- a/lib/workers/heroku_build.rb +++ b/lib/workers/heroku_build.rb @@ -2,6 +2,8 @@ class HerokuBuilder include Sidekiq::Worker + + class AuthenticationMissing < StandardError; end def perform(user_id, url, version, options={}) @user_id = user_id @@ -11,15 +13,20 @@ # TODO Use a selected app @app_name = 'cryptic-atoll-7822' - fetch_token - setup_clients + begin + fetch_token + setup_clients - submit_build + submit_build + rescue AuthenticationMissing + log(auth_missing: true) + end end def fetch_token - # TODO Deal with missing keys encrypted_token = $redis.hget("heroku_#{@user_id}", 'tokens') + raise AuthenticationMissing unless encrypted_token + message = JSON.parse(decrypt(encrypted_token)) @token = message['token'] end
Handle missing heroku authentication token
diff --git a/lib/migration/emotion_tag_importer.rb b/lib/migration/emotion_tag_importer.rb index abc1234..def5678 100644 --- a/lib/migration/emotion_tag_importer.rb +++ b/lib/migration/emotion_tag_importer.rb @@ -16,6 +16,6 @@ end def self.migrate_all - migrate_all_from_collection(Legacy::Emotion.all) + migrate_all_from_collection(Legacy::Emotion.where(:setting > 0).all) end end
Change the migration to only migrate emotions with positive intensity.
diff --git a/lib/nacre/order/invoice_collection.rb b/lib/nacre/order/invoice_collection.rb index abc1234..def5678 100644 --- a/lib/nacre/order/invoice_collection.rb +++ b/lib/nacre/order/invoice_collection.rb @@ -7,9 +7,9 @@ def initialize(resource_list = []) self.members = [] - # resource_list.each do |resource_params| - # members << Nacre::Order::Invoice.new(resource_params) - # end + resource_list.each do |resource_params| + members << Nacre::Order::Invoice.new(resource_params) + end end def each(&block)
Fix broken members list build in Order::InvoiceCollection I accidentally committed a class with essential code commented out.
diff --git a/lib/puppet_x/elastic/es_versioning.rb b/lib/puppet_x/elastic/es_versioning.rb index abc1234..def5678 100644 --- a/lib/puppet_x/elastic/es_versioning.rb +++ b/lib/puppet_x/elastic/es_versioning.rb @@ -3,7 +3,7 @@ class EsVersioning def self.opt_flags(package_name, catalog) if (es_pkg = catalog.resource("Package[#{package_name}]")) - es_version = es_pkg.provider.properties[:version] + es_version = es_pkg.provider.properties[:version] || es_pkg.provider.properties[:ensure] else raise Puppet::Error, "could not find `Package[#{package_name}]` resource" end
Fix es version detection on apt-based distributions
diff --git a/lib/samuel/driver_patches/net_http.rb b/lib/samuel/driver_patches/net_http.rb index abc1234..def5678 100644 --- a/lib/samuel/driver_patches/net_http.rb +++ b/lib/samuel/driver_patches/net_http.rb @@ -11,15 +11,14 @@ end def request_with_samuel(request, body = nil, &block) - Samuel::Diary.record_request(self, request, Time.now) - - response, exception_raised = nil, false + request_time, response, exception_raised = Time.now, nil, false begin response = request_without_samuel(request, body, &block) rescue Exception => response exception_raised = true end + Samuel::Diary.record_request(self, request, request_time) Samuel::Diary.record_response(self, request, response, Time.now) raise response if exception_raised
Fix exception with Net::HTTP and ruby 1.8.7 Apparently Net::HTTP#request modifies the Request object. The .detect call in Samuel::Diary#record_response was unable to find the matching request.
diff --git a/lib/stack_master/template_compiler.rb b/lib/stack_master/template_compiler.rb index abc1234..def5678 100644 --- a/lib/stack_master/template_compiler.rb +++ b/lib/stack_master/template_compiler.rb @@ -12,9 +12,8 @@ # private def self.template_compiler_for_file(template_file_path, config) - template_compilers = config.template_compilers - compiler = template_compilers.fetch(file_ext(template_file_path)) - @compilers.fetch(compiler) + compiler_name = config.template_compilers.fetch(file_ext(template_file_path)) + @compilers.fetch(compiler_name) end private_class_method :template_compiler_for_file
Refactor: Make method body more readable
diff --git a/lib/tankard/api/utils/page_finders.rb b/lib/tankard/api/utils/page_finders.rb index abc1234..def5678 100644 --- a/lib/tankard/api/utils/page_finders.rb +++ b/lib/tankard/api/utils/page_finders.rb @@ -9,12 +9,7 @@ private def find_on_all_pages(uri, request, options, block) page = 0 - # the clone is here just in case someone decides to create an api class of their own - # and not go through client. If they re-use the api class they have created then - # we would possibably have additional options set that they would reuse with subsequent calls - # honestly though no one should ever create an api class of their own to use, its a bad idea - # might pull out this clone at some point - options = options.clone + begin page += 1 options[:p] = page
Remove options clone from find_on_all_pages
diff --git a/lib/tasks/add_achievements_to_fb.rake b/lib/tasks/add_achievements_to_fb.rake index abc1234..def5678 100644 --- a/lib/tasks/add_achievements_to_fb.rake +++ b/lib/tasks/add_achievements_to_fb.rake @@ -10,15 +10,19 @@ #iterate through all undeleted achievements Achievement.all.each do |ach| - badge = init_badge(ach) #prepare the badge object + # assume that if facebook_obj_id is not NULL, the Facebook object already exists + # verifying the object ID with Facebook and trying to self correct is a bit complicated + if ach.facebook_obj_id.nil? + badge = init_badge(ach) #prepare the badge object - #post badge object to FB - id = @graph.put_connections("app", "objects/#{app_namespace}:badge", - :object => JSON.generate(badge)) + #post badge object to FB + id = @graph.put_connections("app", "objects/#{app_namespace}:badge", + :object => JSON.generate(badge)) - # get ID as response and save it to the db - ach.facebook_obj_id = id["id"] - ach.save! + # get ID as response and save it to the db + ach.facebook_obj_id = id["id"] + ach.save! + end end end
Check that facebook_obj_id in achievements does not exist before posting it to FB. Only create a new 'badge' object on FB if its facebook_obj_id is currently NULL> If not, assume the id is valid and don't do anything for this achievement. As this task is primarily meant to be run once before achievements have ever been posted to FB, nearly all of them should have facebook_obj_id is NULL. References Coursemology/coursemology.org#192.
diff --git a/lib/tasks_private/database_types.rake b/lib/tasks_private/database_types.rake index abc1234..def5678 100644 --- a/lib/tasks_private/database_types.rake +++ b/lib/tasks_private/database_types.rake @@ -0,0 +1,32 @@+namespace 'aws:extract' do + desc 'Get / refresh database_types' + task :database_types do + require 'open-uri' + + instances = URI.open("https://instances.vantage.sh/rds/instances.json") do |io| + JSON.parse(io.read) + end + + results = instances.map do |instance| + network_performance = if instance["networkPerformance"].match?(/(\d+ Gigabit)/) + :very_high + else + instance["networkPerformance"].downcase.tr(' ', '_').to_sym + end + + result = { + :name => instance["instanceType"], + :family => instance["instanceFamily"], + :vcpu => instance["vcpu"].to_i, + :memory => instance["memory"].to_f * 1.gigabyte, + :ebs_optimized => instance["dedicatedEbsThroughput"].present?, + :deprecated => instance["currentGeneration"] != "Yes", + :network_performance => network_performance + } + + [result[:name], result.sort.to_h] + end.to_h + + File.write(ManageIQ::Providers::Amazon::Engine.root.join("db/fixtures/aws_database_types.yml"), results.sort.to_h.to_yaml) + end +end
Add a rake task to auto-update database types
diff --git a/lib/taverna_player/output_renderer.rb b/lib/taverna_player/output_renderer.rb index abc1234..def5678 100644 --- a/lib/taverna_player/output_renderer.rb +++ b/lib/taverna_player/output_renderer.rb @@ -33,15 +33,8 @@ def render(content, mimetype) type = MIME::Types[mimetype].first - renderer = begin - @hash[type.media_type][type.sub_type] - rescue - begin - @hash[type.media_type][:default] - rescue - @hash[:default] - end - end + renderer = @hash[type.media_type][type.sub_type] || + @hash[type.media_type][:default] || @hash[:default] if renderer.is_a? Proc renderer.call(content, type)
Fix output renderer call chain. Things were not rendering correctly when an unknown type was given.
diff --git a/examples/rspec_doubles/features/support/env.rb b/examples/rspec_doubles/features/support/env.rb index abc1234..def5678 100644 --- a/examples/rspec_doubles/features/support/env.rb +++ b/examples/rspec_doubles/features/support/env.rb @@ -3,10 +3,10 @@ # # require 'rspec/core' # RSpec.configure do |c| -# c.mock_framework :rspec -# c.mock_framework :mocha +# c.mock_framework = :rspec +# c.mock_framework = :mocha # c.mock_framework = :rr -# c.mock_framework :flexmock +# c.mock_framework = :flexmock # end require 'cucumber/rspec/doubles'
Fix typo - use = everywhere
diff --git a/app/decorators/orchestration_template_decorator.rb b/app/decorators/orchestration_template_decorator.rb index abc1234..def5678 100644 --- a/app/decorators/orchestration_template_decorator.rb +++ b/app/decorators/orchestration_template_decorator.rb @@ -2,4 +2,10 @@ def self.fonticon 'ff ff-template' end + + def single_quad + { + :fonticon => fonticon + } + end end
Add single_quad definition for the OrchestrationTemplate model
diff --git a/spec/controllers/organization_users_controller_spec.rb b/spec/controllers/organization_users_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/organization_users_controller_spec.rb +++ b/spec/controllers/organization_users_controller_spec.rb @@ -13,50 +13,31 @@ }) end - let!(:admin) { create(:user) } - let!(:organization_admin) do - create(:organization_user, { - user: admin, - organization: organization, - admin: true - }) + before do + request.env["HTTP_REFERER"] = "http://example.com/back" + subject.stub(:current_user).and_return(user) end - before do - request.env["HTTP_REFERER"] = "http://example.com/back" - subject.stub(:current_user).and_return(admin) - end + it 'allows authorized users to delete contributors' do + allow_any_instance_of(OrganizationUserAuthorizer).to receive(:destroy?) { true } - it 'deletes contributors' do expect { delete :destroy, id: organization_user.id, organization_id: organization.id }.to change(OrganizationUser, :count).by(-1) end - it "fails to delete contributors outside of the admin's organization" do - other_organization_user = create(:organization_user) + it 'does not allow unauthorized users to delete contributors' do + allow_any_instance_of(OrganizationUserAuthorizer).to receive(:destroy?) { false } expect { - delete :destroy, id: other_organization_user.id, - organization_id: organization.id + delete :destroy, id: organization_user.id, organization_id: organization.id }.to_not change(OrganizationUser, :count) end - it 'fails if the current_user is not an admin of that organization' do - other_user = create(:user) - subject.stub(:current_user).and_return(other_user) + it 'authorizes that the logged-in users can remove the contributor' do + expect_any_instance_of(OrganizationUserAuthorizer).to receive(:destroy?) - expect { - delete :destroy, id: organization_user.id, - organization_id: organization.id - }.to_not change(OrganizationUser, :count) - end - - it 'fails if the current_user is the only remaining organization admin' do - expect { - delete :destroy, id: organization_admin.id, - organization_id: organization.id - }.to_not change(OrganizationUser, :count) + delete :destroy, id: organization_user.id, organization_id: organization.id end end
Refactor contributor removal controller specs We adopt the style used in the OrganizationInvitation controller tests, which only assert that we: 1. authorize the resource 2. assert the behavior when a user is and is not authorized to perform a given action
diff --git a/lib/asciiart.rb b/lib/asciiart.rb index abc1234..def5678 100644 --- a/lib/asciiart.rb +++ b/lib/asciiart.rb @@ -46,5 +46,9 @@ def image_chars @image_chars ||= ' .~:+=o*x^%#@$MW'.chars.to_a end + + def inspect + "#<#{self.class.to_s}>" + end end
Implement inspect because the deault one was crazy
diff --git a/lib/rspec/rails/matchers/relation_match_array.rb b/lib/rspec/rails/matchers/relation_match_array.rb index abc1234..def5678 100644 --- a/lib/rspec/rails/matchers/relation_match_array.rb +++ b/lib/rspec/rails/matchers/relation_match_array.rb @@ -1,3 +1,3 @@-if defined?(:ActiveRecord) +if defined?(ActiveRecord) RSpec::Matchers::OperatorMatcher.register(ActiveRecord::Relation, '=~', RSpec::Matchers::MatchArray) end
Fix mistake in check to see if ActiveRecord is defined
diff --git a/app/controllers/spree/admin/suppliers_controller.rb b/app/controllers/spree/admin/suppliers_controller.rb index abc1234..def5678 100644 --- a/app/controllers/spree/admin/suppliers_controller.rb +++ b/app/controllers/spree/admin/suppliers_controller.rb @@ -1,10 +1,16 @@ class Spree::Admin::SuppliersController < Spree::Admin::ResourceController + + update.before :build_address def new @supplier = Spree::Supplier.new(address_attributes: {country_id: Spree::Address.default.country_id}) end private + + def build_address + @supplier.address = Spree::Address.default unless @supplier.address.present? + end def collection params[:q] ||= {}
Fix for supplier edit page.
diff --git a/VOKMultiImagePicker-iOS.podspec b/VOKMultiImagePicker-iOS.podspec index abc1234..def5678 100644 --- a/VOKMultiImagePicker-iOS.podspec +++ b/VOKMultiImagePicker-iOS.podspec @@ -1,15 +1,6 @@-# -# Be sure to run `pod lib lint VOKMultiImagePicker-iOS.podspec' to ensure this is a -# valid spec and remove all comments before submitting the spec. -# -# Any lines starting with a # are optional, but encouraged -# -# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html -# - Pod::Spec.new do |s| s.name = "VOKMultiImagePicker-iOS" - s.version = "0.1.1" + s.version = "0.2.0" s.summary = "A multiple image picker using Photos framework." s.description = "A customizable library for selecting assets from the built in Photos app using the Photos framework." s.homepage = "https://github.com/vokalinteractive/VOKMultiImagePicker-iOS"
Remove superfluous comments, bump podspec
diff --git a/app/controllers/admin/screened_ip_addresses_controller.rb b/app/controllers/admin/screened_ip_addresses_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/screened_ip_addresses_controller.rb +++ b/app/controllers/admin/screened_ip_addresses_controller.rb @@ -3,7 +3,7 @@ before_filter :fetch_screened_ip_address, only: [:update, :destroy] def index - screened_ip_addresses = ScreenedIpAddress.limit(200).order('last_match_at desc').to_a + screened_ip_addresses = ScreenedIpAddress.limit(200).order('id desc').to_a render_serialized(screened_ip_addresses, ScreenedIpAddressSerializer) end
Order by creation time by default in screened ip addresses table
diff --git a/field_types/core/user/user_cell.rb b/field_types/core/user/user_cell.rb index abc1234..def5678 100644 --- a/field_types/core/user/user_cell.rb +++ b/field_types/core/user/user_cell.rb @@ -3,7 +3,6 @@ module Core module User class UserCell < FieldCell - def dropdown render end @@ -19,13 +18,12 @@ end def render_select_options - options = "" - @options[:user_data].each do |user_info| - options += "<option value='#{user_info[1]}'>#{user_info[0]}</option>" - end - options.html_safe + @options[:form].select 'data[user_id]', options_for_select: user_data_for_select, selected: {} end + def user_data_for_select + @options[:user_data].map{ |user| [user.fullname, user.id] } + end end end end
Refactor FieldItem New form to no longer use uninstantiated Fields to generate FieldItem form, remove author from ContentItem grids, extract user_data_for_select from ContentItem New view, fix some autoloading issues caused by newline in application config
diff --git a/test/integration/default/default_spec.rb b/test/integration/default/default_spec.rb index abc1234..def5678 100644 --- a/test/integration/default/default_spec.rb +++ b/test/integration/default/default_spec.rb @@ -8,7 +8,13 @@ end if %w(debian ubuntu).include?(os[:family]) - describe package('libsss-sudo') do - it { should be_installed } + if os[:family] == 'debian' && os[:release].to_i <= 7 + describe package('libsss-sudo0') do + it { should be_installed } + end + else + describe package('libsss-sudo') do + it { should be_installed } + end end end
Add back Debian 7 integration test Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/fakeredis.gemspec b/fakeredis.gemspec index abc1234..def5678 100644 --- a/fakeredis.gemspec +++ b/fakeredis.gemspec @@ -18,6 +18,6 @@ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.require_paths = ["lib"] - s.add_runtime_dependency(%q<redis>, ["~> 3.0"]) + s.add_runtime_dependency(%q<redis>, ["~> 3.2"]) s.add_development_dependency(%q<rspec>, ["~> 3.0"]) end
Update redis dependency to 3.2.0
diff --git a/app/controllers/spree/home_controller_decorator.rb b/app/controllers/spree/home_controller_decorator.rb index abc1234..def5678 100644 --- a/app/controllers/spree/home_controller_decorator.rb +++ b/app/controllers/spree/home_controller_decorator.rb @@ -2,7 +2,7 @@ def index slider = Spree::Taxon.where(:name => 'Slider').first - @slider_products = slider.products.active.distinct if slider + @slider_products = slider.products.active if slider featured = Spree::Taxon.where(:name => 'Featured').first @featured_products = featured.products.active if featured
Revert "Prevent duplicate products from showing up in the main products slider" This reverts commit fed2afad46e4a38ee2cf1c0e51e31d1073257d9d.
diff --git a/app/models/course_membership.rb b/app/models/course_membership.rb index abc1234..def5678 100644 --- a/app/models/course_membership.rb +++ b/app/models/course_membership.rb @@ -27,10 +27,13 @@ case extra['roles'].downcase when /instructor/ self.update_attribute(:role, 'professor') + self.update_attribute(:instructor_of_record, true) when /teachingassistant/ self.update_attribute(:role, 'gsi') + self.update_attribute(:instructor_of_record, true) else self.update_attribute(:role, 'student') + self.update_attribute(:instructor_of_record, false) end end end
Update the instructors of record when their roles are updated
diff --git a/app/models/etsource/reloader.rb b/app/models/etsource/reloader.rb index abc1234..def5678 100644 --- a/app/models/etsource/reloader.rb +++ b/app/models/etsource/reloader.rb @@ -31,6 +31,13 @@ true end + def stop! + if @listener + @listener.stop + @listener = nil + end + end + def reload! Rails.cache.clear
Make it possible to stop the ETsource live reload in the running application
diff --git a/app/controllers/monologue/posts_controller.rb b/app/controllers/monologue/posts_controller.rb index abc1234..def5678 100644 --- a/app/controllers/monologue/posts_controller.rb +++ b/app/controllers/monologue/posts_controller.rb @@ -1,7 +1,7 @@ class Monologue::PostsController < Monologue::ApplicationController def index @page = params[:page].nil? ? 1 : params[:page] - @posts = Monologue::Post.published.page(@page) + @posts = Monologue::Post.page(@page).published end def show
Revert "Revert "Fixed a pagination bug"" making a null change to get travis to build This reverts commit 7b164901bc5282f15e30c0ac8edef63042208f22.
diff --git a/app/controllers/omnisocial/auth_controller.rb b/app/controllers/omnisocial/auth_controller.rb index abc1234..def5678 100644 --- a/app/controllers/omnisocial/auth_controller.rb +++ b/app/controllers/omnisocial/auth_controller.rb @@ -12,9 +12,9 @@ def callback account = case request.env['rack.auth']['provider'] - when 'twitter': + when 'twitter' then Omnisocial::TwitterAccount.find_or_create_from_auth_hash(request.env['rack.auth']) - when 'facebook': + when 'facebook' then Omnisocial::FacebookAccount.find_or_create_from_auth_hash(request.env['rack.auth']) end
Replace : with 'then' in when statements for Ruby 1.9 compatability. Ruby 1.9 no longer supports the colon in place of then here.
diff --git a/app/lib/connectors/opennebula/user_handler.rb b/app/lib/connectors/opennebula/user_handler.rb index abc1234..def5678 100644 --- a/app/lib/connectors/opennebula/user_handler.rb +++ b/app/lib/connectors/opennebula/user_handler.rb @@ -15,8 +15,7 @@ alias list find_all def create(username, password, auth, group) - user_alloc = OpenNebula::User.build_xml - user = OpenNebula::User.new(user_alloc, client) + user = OpenNebula::User.new(OpenNebula::User.build_xml, client) handle_opennebula_error do user.allocate(username, password, auth) @@ -38,8 +37,7 @@ end def token(username, group, expiration) - user_alloc = OpenNebula::User.build_xml - user = OpenNebula::User.new(user_alloc, client) + user = OpenNebula::User.new(OpenNebula::User.build_xml, client) handle_opennebula_error { user.login(username, '', (expiration - Time.now.to_i), group.id) } end
Remove some butter-passing from OpenNebula connector
diff --git a/app/lib/connectors/opennebula/user_handler.rb b/app/lib/connectors/opennebula/user_handler.rb index abc1234..def5678 100644 --- a/app/lib/connectors/opennebula/user_handler.rb +++ b/app/lib/connectors/opennebula/user_handler.rb @@ -39,7 +39,7 @@ def token(username, group, expiration) user = OpenNebula::User.new(OpenNebula::User.build_xml, client) - handle_opennebula_error { user.login(username, '', (expiration - Time.now.to_i), group.id) } + handle_opennebula_error { user.login(username, '', (expiration.to_i - Time.now.to_i), group.id) } end end end
Add conversion of expiration attribute to integer
diff --git a/app/services/zahlen/conekta_gateway/charge.rb b/app/services/zahlen/conekta_gateway/charge.rb index abc1234..def5678 100644 --- a/app/services/zahlen/conekta_gateway/charge.rb +++ b/app/services/zahlen/conekta_gateway/charge.rb @@ -31,7 +31,7 @@ end def self.search_subscription(charge) - Zahlen::Subscription.where(gateway_customer_id: charge[:customer_id]) + Zahlen::Subscription.where(gateway: 'conekta', gateway_customer_id: charge[:customer_id]) .order('created_at desc') .first end
Add missing param on search subs
diff --git a/install.rb b/install.rb index abc1234..def5678 100644 --- a/install.rb +++ b/install.rb @@ -1,31 +1,32 @@-# Workaround a problem with script/plugin and http-based repos. -# See http://dev.rubyonrails.org/ticket/8189 -Dir.chdir(Dir.getwd.sub(/vendor.*/, '')) do +unless defined?(ACTIVE_SCAFFOLD_INSTALL_ASSETS) && ACTIVE_SCAFFOLD_INSTALL_ASSETS == false + # Workaround a problem with script/plugin and http-based repos. + # See http://dev.rubyonrails.org/ticket/8189 + Dir.chdir(Dir.getwd.sub(/vendor.*/, '')) do -## -## Copy over asset files (javascript/css/images) from the plugin directory to public/ -## + ## + ## Copy over asset files (javascript/css/images) from the plugin directory to public/ + ## -def copy_files(source_path, destination_path, directory) - source, destination = File.join(directory, source_path), File.join(RAILS_ROOT, destination_path) - FileUtils.mkdir(destination) unless File.exist?(destination) - FileUtils.cp_r(Dir.glob(source+'/*.*'), destination) -end + def copy_files(source_path, destination_path, directory) + source, destination = File.join(directory, source_path), File.join(RAILS_ROOT, destination_path) + FileUtils.mkdir(destination) unless File.exist?(destination) + FileUtils.cp_r(Dir.glob(source+'/*.*'), destination) + end -directory = File.dirname(__FILE__) + directory = File.dirname(__FILE__) -copy_files("/public", "/public", directory) + copy_files("/public", "/public", directory) -available_frontends = Dir[File.join(directory, 'frontends', '*')].collect { |d| File.basename d } -[ :stylesheets, :javascripts, :images].each do |asset_type| - path = "/public/#{asset_type}/active_scaffold" - copy_files(path, path, directory) + available_frontends = Dir[File.join(directory, 'frontends', '*')].collect { |d| File.basename d } + [ :stylesheets, :javascripts, :images].each do |asset_type| + path = "/public/#{asset_type}/active_scaffold" + copy_files(path, path, directory) - available_frontends.each do |frontend| - source = "/frontends/#{frontend}/#{asset_type}/" - destination = "/public/#{asset_type}/active_scaffold/#{frontend}" - copy_files(source, destination, directory) + available_frontends.each do |frontend| + source = "/frontends/#{frontend}/#{asset_type}/" + destination = "/public/#{asset_type}/active_scaffold/#{frontend}" + copy_files(source, destination, directory) + end + end end -end - end
Add switch to control if assets should be copied: ACTIVE_SCAFFOLD_INSTALL_ASSETS should be defined in config/environments/xx.rb
diff --git a/estate-demo.gemspec b/estate-demo.gemspec index abc1234..def5678 100644 --- a/estate-demo.gemspec +++ b/estate-demo.gemspec @@ -8,9 +8,15 @@ gem.version = Estate::Demo::VERSION gem.authors = ["kocolondon"] gem.email = ["kingsley@kocolondon.com"] - gem.description = %q{TODO: Demo practice project for developing with Ruby} - gem.summary = %q{TODO: Write a gem summary} + gem.description = %q{Demo practice project for developing with Ruby} + gem.summary = %q{Write a gem summary} gem.homepage = "" + + gem.add_development_dependency 'rspec', '~> 2.14.1' + gem.add_development_dependency 'cucumber', '~> 1.3.10' + gem.add_development_dependency 'rspec-expectations', '~> 2.14.4' + + gem.add_runtime_dependency 'activerecord', '~> 4.0.1' gem.files = `git ls-files`.split($/) gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
Add some development and runtime dependencies to gemspec
diff --git a/japr.gemspec b/japr.gemspec index abc1234..def5678 100644 --- a/japr.gemspec +++ b/japr.gemspec @@ -26,7 +26,7 @@ s.rubygems_version = '2.2.2' # Runtime dependencies - s.add_runtime_dependency 'jekyll', '~> 3.5' + s.add_runtime_dependency 'jekyll', '>= 3.5', '< 5.0' s.add_runtime_dependency 'liquid', '~> 4.0' # Development dependencies
Update jekyll requirement from ~> 3.5 to >= 3.5, < 5.0 Updates the requirements on [jekyll](https://github.com/jekyll/jekyll) to permit the latest version. - [Release notes](https://github.com/jekyll/jekyll/releases) - [Changelog](https://github.com/jekyll/jekyll/blob/master/History.markdown) - [Commits](https://github.com/jekyll/jekyll/compare/v3.5.0...v3.8.6) Signed-off-by: dependabot-preview[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>
diff --git a/blockcypher-ruby.gemspec b/blockcypher-ruby.gemspec index abc1234..def5678 100644 --- a/blockcypher-ruby.gemspec +++ b/blockcypher-ruby.gemspec @@ -5,7 +5,7 @@ s.licenses = ['Apache 2.0'] s.description = "Ruby library to help you build your crypto application on BlockCypher" s.summary = "Ruby library to help you build your crypto application on BlockCypher" - s.authors = ["CoinHako", "BlockCypher", "meXBT"] + s.authors = ["CoinHako", "BlockCypher", "meXBT", 'Gem'] s.email = 'contact@blockcypher.com' s.files = Dir["{spec,lib}/**/*"] + %w(LICENSE README.md) s.homepage = 'http://www.blockcypher.com'
Add Gem as an author
diff --git a/files/brews/gh.rb b/files/brews/gh.rb index abc1234..def5678 100644 --- a/files/brews/gh.rb +++ b/files/brews/gh.rb @@ -10,7 +10,7 @@ head 'https://github.com/jingweno/gh.git' - depends_on 'hg' + depends_on 'mercurial' depends_on 'go' def install
Use mercurial as dep instead of hg
diff --git a/test/cli/test_generators.rb b/test/cli/test_generators.rb index abc1234..def5678 100644 --- a/test/cli/test_generators.rb +++ b/test/cli/test_generators.rb @@ -0,0 +1,82 @@+# frozen_string_literal: true + +require "helpers" + +# tests cli command: generators +class CLIGeneratorsTest < Minitest::Test + include Aruba::Api + include Helpers + + def setup + setup_aruba + end + + def test_generators + # NOTE: testing user may have more than the default generator, + # so our patterns will need to accommodate this possibility + pattern = /default/ + # retrieve generators: + run_command "kbsecret generators" do |cmd| + cmd.wait + assert_match pattern, cmd.output + end + end + + def test_generators_show_all + pattern = /default\n\tFormat: hex\n\tLength: 16/ + + # retrieve generators: + run_command "kbsecret generators -a" do |cmd| + cmd.wait + assert_match pattern, cmd.output + end + end + + def test_generators_added + label = "test-generator" + pattern = /default.*#{label}|#{label}.*default/m + + # add generator + run_command_and_stop "kbsecret generator new #{label} -F hex -l 64" + + # retrieve generators: + run_command "kbsecret generators" do |cmd| + cmd.wait + assert_match pattern, cmd.output + end + ensure + # remove generator + run_command_and_stop "kbsecret generator rm #{label}" + end + + def test_generators_added_show_all + label = "test-generator" + format = "base64" + length = "64" + test_detail = /#{label}\n\tFormat: #{format}\n\tLength: #{length}/ + default_detail = /default\n\tFormat: hex\n\tLength: 16/ + pattern = /#{default_detail}.*#{test_detail}|#{test_detail}.*#{default_detail}/m + + # add generator + run_command_and_stop "kbsecret generator new #{label} -F #{format} -l #{length}" + + # retrieve generators: + run_command "kbsecret generators -a" do |cmd| + cmd.wait + assert_match pattern, cmd.output + end + ensure + # remove generator + run_command_and_stop "kbsecret generator rm #{label}" + end + + def test_generators_unknown_option + error_pattern = /Unknown option/ + + # retrieve generators: + run_command "kbsecret generators -x" do |cmd| + cmd.wait + assert_match error_pattern, cmd.stderr + end + end +end
test: Add CLI tests - generators Contributes to #7
diff --git a/lib/graph/graph.rb b/lib/graph/graph.rb index abc1234..def5678 100644 --- a/lib/graph/graph.rb +++ b/lib/graph/graph.rb @@ -39,6 +39,16 @@ # out.incoming.delete(node) # } end + + # connect the first node to the second node (directionality) + # the second node will be added to the outgoing list of the first node + # and the first node will be added to the incoming list of the second + # node. + def connect_to(node1,node2) + # assuming node1 and node2 are part of this graph + node1.outgoing << node2 + node2.incoming << node1 + end end
Add the implementation for the connect_to method, it passes the (admittedly limited) spec.
diff --git a/lib/key_control.rb b/lib/key_control.rb index abc1234..def5678 100644 --- a/lib/key_control.rb +++ b/lib/key_control.rb @@ -3,10 +3,14 @@ module KeyControl - THREAD = "@t" - PROCESS = "@p" SESSION = "@s" USER = "@u" DEFAULT = "@us" GROUP = "@g" + + # Thread and Process-level keyrings won't work for the time being, due to the + # fact that calls to keyctl have to happen through a subshell. These are here + # for the sake of documentation. + THREAD = "@t" + PROCESS = "@p" end
Document issues with thread and process keyrings
diff --git a/lib/active_shipping/lib/requires_parameters.rb b/lib/active_shipping/lib/requires_parameters.rb index abc1234..def5678 100644 --- a/lib/active_shipping/lib/requires_parameters.rb +++ b/lib/active_shipping/lib/requires_parameters.rb @@ -1,15 +1,14 @@-module ActiveMerchant - module RequiresParameters +module ActiveMerchant #:nodoc: + module RequiresParameters #:nodoc: def requires!(hash, *params) - keys = hash.keys params.each do |param| if param.is_a?(Array) - raise ArgumentError.new("Missing required parameter: #{param}") unless keys.include?(param.first) + raise ArgumentError.new("Missing required parameter: #{param.first}") unless hash.has_key?(param.first) valid_options = param[1..-1] - raise ArgumentError.new("Parameter :#{param.first} must be one of #{valid_options.inspect}") unless valid_options.include?(hash[param.first]) + raise ArgumentError.new("Parameter: #{param.first} must be one of #{valid_options.to_sentence(:connector => 'or')}") unless valid_options.include?(hash[param.first]) else - raise ArgumentError.new("Missing required parameter: #{param}") unless keys.include?(param) + raise ArgumentError.new("Missing required parameter: #{param}") unless hash.has_key?(param) end end end
Update requires parameters to latest version
diff --git a/lib/awspec/helper/credentials_loader.rb b/lib/awspec/helper/credentials_loader.rb index abc1234..def5678 100644 --- a/lib/awspec/helper/credentials_loader.rb +++ b/lib/awspec/helper/credentials_loader.rb @@ -16,11 +16,13 @@ creds = YAML.load_file('spec/secrets.yml') if File.exist?('spec/secrets.yml') creds = YAML.load_file('secrets.yml') if File.exist?('secrets.yml') Aws.config.update({ - region: creds['region'], + region: creds['region'] + }) if creds.include?('region') + Aws.config.update({ credentials: Aws::Credentials.new( creds['aws_access_key_id'], creds['aws_secret_access_key']) - }) if creds + }) if creds.include?('aws_access_key_id') && creds.include?('aws_secret_access_key') end end end
Support "IAM Roles for EC2" with secrets.yml
diff --git a/lib/fastlane/plugin/yarn/helper/yarn_helper.rb b/lib/fastlane/plugin/yarn/helper/yarn_helper.rb index abc1234..def5678 100644 --- a/lib/fastlane/plugin/yarn/helper/yarn_helper.rb +++ b/lib/fastlane/plugin/yarn/helper/yarn_helper.rb @@ -7,19 +7,22 @@ attr_accessor :task attr_accessor :commands attr_accessor :package_path + attr_accessor :yarn def initialize(package_path: nil) self.package_path = package_path if self.package_path - Dir.chdir(File.dirname(self.package_path)) + self.yarn = "cd #{File.dirname(self.package_path)} && yarn" + else + self.yarn = "yarn" end end # Run a certain action def trigger(command: nil, task: nil, print_command: true, print_command_output: true) - command = ["yarn", command, task].compact.join(" ") + command = [self.yarn, command, task].compact.join(" ") Action.sh(command, print_command: print_command, print_command_output: print_command_output) end @@ -28,7 +31,7 @@ UI.message("Checking yarn install and dependencies") begin - Action.sh("yarn", print_command: true, print_command_output: true) + Action.sh(self.yarn, print_command: true, print_command_output: true) rescue Errno::ENOENT => e UI.error("Yarn not installed, please install with Homebrew or npm.") raise e @@ -38,8 +41,11 @@ def check_package() UI.message("Checking for valid package.json") - unless self.package_path.nil? + + if self.package_path.nil? package_path = 'package.json' + else + package_path = self.package_path end unless File.exists?(package_path)
Fix warning for conflicting chdir
diff --git a/lib/rspec/rails/loggers/html_request_logger.rb b/lib/rspec/rails/loggers/html_request_logger.rb index abc1234..def5678 100644 --- a/lib/rspec/rails/loggers/html_request_logger.rb +++ b/lib/rspec/rails/loggers/html_request_logger.rb @@ -20,6 +20,12 @@ @logs = [] end + def replace_files(vars) + vars.each do |key, value| + vars[key] = 'Uploaded file' if value.class == Rack::Test::UploadedFile + end + end + def after builder = Builder::XmlMarkup.new(:indent => 2) html = builder.html { @@ -36,7 +42,7 @@ end builder.span 'Params:' vars = log.vars || {} - builder << CodeRay.scan(JSON.pretty_generate(vars), :json).div(:line_numbers => nil) + builder << CodeRay.scan(JSON.pretty_generate(replaces(vars)), :json).div(:line_numbers => nil) builder.span 'Response:' body = JSON.parse(log.body) || {} builder << CodeRay.scan(JSON.pretty_generate(body), :json).div(:line_numbers => nil)
Replace uploaded files in params
diff --git a/lib/generators/forem/views_generator.rb b/lib/generators/forem/views_generator.rb index abc1234..def5678 100644 --- a/lib/generators/forem/views_generator.rb +++ b/lib/generators/forem/views_generator.rb @@ -9,6 +9,7 @@ def copy_views view_directory :admin + view_directory :categories view_directory :forums view_directory :posts view_directory :topics
Copy categories views in views generator
diff --git a/lib/open_project/revisions/git/hooks.rb b/lib/open_project/revisions/git/hooks.rb index abc1234..def5678 100644 --- a/lib/open_project/revisions/git/hooks.rb +++ b/lib/open_project/revisions/git/hooks.rb @@ -4,7 +4,7 @@ class RoleUpdater < Redmine::Hook::Listener def roles_changed(context) message = context[:message] - projects = Project.active.includes(:repositories).all + projects = Project.active.includes(:repository).all if projects.length > 0 OpenProject::Revisions::Git::GitoliteWrapper.logger.info("Role has been #{message}, resync all projects...") OpenProject::Revisions::Git::GitoliteWrapper.update(:update_all_projects, projects.length)
Fix for dangling association on role update.
diff --git a/Casks/sopcast.rb b/Casks/sopcast.rb index abc1234..def5678 100644 --- a/Casks/sopcast.rb +++ b/Casks/sopcast.rb @@ -2,6 +2,7 @@ version '1.3.5' sha256 'aa463ff35f3a920d03615d44fc27003c7cdc79880910a9f8eebd9e8a97e26532' + # easetuner.com was verified as official when first introduced to the cask url "http://download.easetuner.com/download/SopCast-#{version}.dmg" name 'SopCast' homepage 'http://www.sopcast.org'
Fix `url` stanza comment for SopCast.
diff --git a/cookbooks/meniscus-middleman/attributes/default.rb b/cookbooks/meniscus-middleman/attributes/default.rb index abc1234..def5678 100644 --- a/cookbooks/meniscus-middleman/attributes/default.rb +++ b/cookbooks/meniscus-middleman/attributes/default.rb @@ -1,2 +1,2 @@ normal[:cloudpassage][:server_tag] = "#{node.environment}-middleman" -normal[:middleman][:uwsgi_socket] = node[:rackspace][:private_ip] +normal[:middleman][:uwsgi_socket] = "#{node[:rackspace][:private_ip]}:9200"
Set private IP and port
diff --git a/lib/imports.rb b/lib/imports.rb index abc1234..def5678 100644 --- a/lib/imports.rb +++ b/lib/imports.rb @@ -6,6 +6,7 @@ #TODO: Deal with circular dependancies ::IMPORTS_MODULES = {} +::IMPORTS_ANONYMOUS_MODULES = {} def import(path) base_path = caller_locations.first.absolute_path @@ -26,6 +27,7 @@ raise RuntimeError.new('Doubly imported file') end + ::IMPORTS_ANONYMOUS_MODULES[absolute_path] = self ::IMPORTS_MODULES[absolute_path] = objects end
Store a reference to the calling anonymous module
diff --git a/pycall.gemspec b/pycall.gemspec index abc1234..def5678 100644 --- a/pycall.gemspec +++ b/pycall.gemspec @@ -15,8 +15,15 @@ spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0").reject do |f| - f.match(%r{^(test|spec|features)/}) + case f + when %r{^Guardfile}, # NOTE: Skip symlink for Windows + %r{^(test|spec|features)/} + true + else + false + end end + spec.bindir = "exe" spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"]
Remove Guardfile symlink from gem file for Windows
diff --git a/lib/ehcache.rb b/lib/ehcache.rb index abc1234..def5678 100644 --- a/lib/ehcache.rb +++ b/lib/ehcache.rb @@ -14,7 +14,6 @@ class EhcacheError < RuntimeError; end end -require 'ehcache/extensions' require 'ehcache/java' require 'ehcache/config' require 'ehcache/cache'
Remove require of nonexistent "extensions" file.
diff --git a/app/jobs/log_job.rb b/app/jobs/log_job.rb index abc1234..def5678 100644 --- a/app/jobs/log_job.rb +++ b/app/jobs/log_job.rb @@ -2,9 +2,14 @@ queue_as :default def perform(*args) - initial_location = "log/cron.log" - final_location = "log/old_cron.log" - FileUtils.mv initial_location, final_location + log_files = %w[ cron delayed_job ] + log_files << "#{ Rails.env }" + + log_files.each do |log_file| + initial_location = "log/#{log_file}.log" + final_location = "log/old_#{log_file}.log" + FileUtils.mv initial_location, final_location + end end end
Extend old log stashing to more logs // i.e. prod
diff --git a/lib/kashime.rb b/lib/kashime.rb index abc1234..def5678 100644 --- a/lib/kashime.rb +++ b/lib/kashime.rb @@ -2,4 +2,11 @@ require 'kashime/cli' module Kashime + RC_FILE = "~/.kashimerc" + + def self.init + eval(File.read(File.expand_path(RC_FILE))) + end end + +Kashime.init
Load yao configuration from rc file
diff --git a/app/models/visit.rb b/app/models/visit.rb index abc1234..def5678 100644 --- a/app/models/visit.rb +++ b/app/models/visit.rb @@ -16,8 +16,12 @@ validate :validate_amount_of_adults, on: :visitors_set def validate_amount_of_adults - errors.add(:base, "There must be at least one adult visitor") unless visitors.any? { |v| v.age && v.age >= 18 } - errors.add(:base, "You can book a maximum of 3 visitors over the age of #{adult_age} on this visit") if visitors.count { |v| v.age && v.age >= adult_age } > 3 + if visitors.none? { |v| v.age && v.age >= 18 } + errors.add :base, "There must be at least one adult visitor" + end + if visitors.count { |v| v.age && v.age >= adult_age } > 3 + errors.add :base, "You can book a maximum of 3 visitors over the age of #{adult_age} on this visit" + end end def adult_age
Improve clarity of postconditions on long lines It's easier to see conditions that aren't hidden at the end of a long string of text. Furthermore, 'if none?' is (in my opinion) clearer than 'unless any?'
diff --git a/app/models/votes.rb b/app/models/votes.rb index abc1234..def5678 100644 --- a/app/models/votes.rb +++ b/app/models/votes.rb @@ -1,17 +1,18 @@ class Votes < ActiveRecord::Base unloadable - def add_vote(message_id, user_id, point = 0) - votes = Votes.where('message_id = %d and user_id = %d' % [message_id, user_id]).limit(1) + def add_vote(message_id, user_id, point = "0") + votes = Votes.where('message_id = %d and user_id = %d' % [message_id, user_id]).first - unless votes.count == 0 - votes.point = point.nil? ? 0 : point + point = point.to_i + if votes + votes.point = (votes.point == point)? 0 : point votes.save! else votes = Votes.new votes.message_id = message_id votes.user_id = user_id - votes.point = point.nil? ? 0 : point + votes.point = point votes.save! end @@ -27,7 +28,7 @@ "plus" => Votes.where('message_id = %d and point > 0' % message_id).sum(:point), "minus" => Votes.where('message_id = %d and point < 0' % message_id).sum(:point), "zero" => Votes.where('message_id = %d and point = 0' % message_id).sum(:point), - "vote" => Votes.where('message_id = %d and user_id = %d' % [message_id, user_id]).count(:point), + "vote" => Votes.where('message_id = %d and user_id = %d' % [message_id, user_id]).sum(:point), } end end
Undo vote by clicking same button ... as same as stackoverflow
diff --git a/lib/logging.rb b/lib/logging.rb index abc1234..def5678 100644 --- a/lib/logging.rb +++ b/lib/logging.rb @@ -6,6 +6,11 @@ def logger @logger ||= Logging.logger_for self.class.name + end + + def log_error(error) + logger.error "Error: #{error.message}" + error.backtrace.each { |line| logger.error line } end def self.logger_for(class_name)
Add log_error to log ruby errors
diff --git a/lib/mq-sass.rb b/lib/mq-sass.rb index abc1234..def5678 100644 --- a/lib/mq-sass.rb +++ b/lib/mq-sass.rb @@ -14,6 +14,6 @@ end end - mqsass_path = File.expand_path("../../_sass/mq-sass", __FILE__) + mqsass_path = File.expand_path("../../stylesheets", __FILE__) ENV["SASS_PATH"] = [ENV["SASS_PATH"], mqsass_path].compact.join(File::PATH_SEPARATOR) end
Fix Ruby gem incorrect path.
diff --git a/lib/comma.rb b/lib/comma.rb index abc1234..def5678 100644 --- a/lib/comma.rb +++ b/lib/comma.rb @@ -1,5 +1,5 @@ # conditional loading of activesupport -if defined? Rails and Rails.version < '2.3.5' +if defined? Rails and (Rails.version.split('.').map(&:to_i) <=> [2,3,5]) < 0 require 'activesupport' else require 'active_support/core_ext/class/inheritable_attributes'
Fix deprecation warning when upgrading to Rails 2.3.10
diff --git a/test/factories/status.rb b/test/factories/status.rb index abc1234..def5678 100644 --- a/test/factories/status.rb +++ b/test/factories/status.rb @@ -1,7 +1,7 @@ FactoryBot.define do factory :status do mastodon_client - tweet_id { Faker::Number.number(18) } - masto_id { Faker::Number.number(18) } + tweet_id { Faker::Number.number(digits: 18) } + masto_id { Faker::Number.number(digits: 18) } end end
Fix tests after faker update
diff --git a/spec/helpers.rb b/spec/helpers.rb index abc1234..def5678 100644 --- a/spec/helpers.rb +++ b/spec/helpers.rb @@ -12,7 +12,7 @@ else d = given - expected_narray difference = ( d * d ).sum / d.size - if difference > 1e-10 + if difference > 1e-9 @error = "Numerical difference with mean square error #{difference}" end end
Allow slightly larger error due to some test convolves resolving to single large number with rounding error in e.g. 8th decimal place
diff --git a/spec/codeclimate_ci/cli_spec.rb b/spec/codeclimate_ci/cli_spec.rb index abc1234..def5678 100644 --- a/spec/codeclimate_ci/cli_spec.rb +++ b/spec/codeclimate_ci/cli_spec.rb @@ -0,0 +1,69 @@+require 'spec_helper' + +describe CodeclimateCi::CLI do + let(:cli) { CodeclimateCi::CLI.new } + let(:api_requester) { double(CodeclimateCi::ApiRequester) } + let(:configuration) { double(CodeclimateCi::Configuration, retry_count: '3', sleep_time: '5') } + let(:compare_gpa) { double(CodeclimateCi::CompareGpa) } + + before do + allow(CodeclimateCi::ApiRequester).to receive(:new) { api_requester } + allow(CodeclimateCi::CompareGpa).to receive(:new) { compare_gpa } + allow(CodeclimateCi).to receive(:configuration) { configuration } + allow(CodeclimateCi.configuration).to receive(:load_from_options) + allow(CodeclimateCi.configuration).to receive(:codeclimate_api_token) + allow(CodeclimateCi.configuration).to receive(:repo_id) + end + + context 'when connection is not established' do + before do + allow(api_requester).to receive(:connection_established?) { false } + end + + it 'exites from script' do + -> { expect(cli.check).to raise_error SystemExit } + end + end + + context 'when connection is established' do + before do + allow(api_requester).to receive(:connection_established?) { true } + allow(compare_gpa).to receive(:diff) + allow(CodeclimateCi.configuration).to receive(:branch_name) + allow(cli).to receive(:exit) + end + + context 'when code in branch worse than master' do + before do + allow(compare_gpa).to receive(:worse?) { true } + allow(CodeclimateCi::Report).to receive(:rounded_diff_value) + allow(CodeclimateCi::Report).to receive(:worse_code) + end + + it 'reports about worse code' do + expect(CodeclimateCi::Report).to receive(:worse_code) + + cli.check + end + + it 'exites from script' do + expect(cli).to receive(:exit) + + cli.check + end + end + + context 'when code in branch worse than master' do + before do + allow(compare_gpa).to receive(:worse?) { false } + allow(CodeclimateCi::Report).to receive(:good_code) + end + + it 'reports about good code' do + expect(CodeclimateCi::Report).to receive(:good_code) + + cli.check + end + end + end +end
Add specs for CLI class
diff --git a/spec/models/spree/asset_spec.rb b/spec/models/spree/asset_spec.rb index abc1234..def5678 100644 --- a/spec/models/spree/asset_spec.rb +++ b/spec/models/spree/asset_spec.rb @@ -5,7 +5,7 @@ describe Spree::Asset do describe "#viewable" do it "touches association" do - product = create(:custom_product) + product = create(:product) asset = Spree::Asset.create! { |a| a.viewable = product.master } product.update_column(:updated_at, 1.day.ago)
Use existing product factory, the custom product is not needed here
diff --git a/spec/plugins/source/git_spec.rb b/spec/plugins/source/git_spec.rb index abc1234..def5678 100644 --- a/spec/plugins/source/git_spec.rb +++ b/spec/plugins/source/git_spec.rb @@ -0,0 +1,49 @@+require 'spec_helper' + +describe Cyclid::API::Plugins::Git do + it 'creates a new instance' do + expect{ Cyclid::API::Plugins::Git.new }.to_not raise_error + end + + class TestTransport + attr_reader :cmd, :path + + def exec(cmd, path = nil) + @cmd = cmd + @path = path + true + end + end + + it 'clones a git repository' do + transport = TestTransport.new + sources = { url: 'https://test.example.com/example/test' } + + git = nil + expect{ git = Cyclid::API::Plugins::Git.new }.to_not raise_error + expect(git.checkout(transport, nil, sources)).to be true + expect(transport.cmd).to eq('git clone https://test.example.com/example/test') + end + + it 'clones a git repository with an OAuth token' do + transport = TestTransport.new + sources = { url: 'https://test.example.com/example/test', token: 'abcxyz' } + + git = nil + expect{ git = Cyclid::API::Plugins::Git.new }.to_not raise_error + expect(git.checkout(transport, nil, sources)).to be true + expect(transport.cmd).to eq('git clone https://abcxyz@test.example.com/example/test') + end + + it 'clones a git repository with a branch' do + transport = TestTransport.new + sources = { url: 'https://test.example.com/example/test', branch: 'test' } + ctx = { workspace: '/test' } + + git = nil + expect{ git = Cyclid::API::Plugins::Git.new }.to_not raise_error + expect(git.checkout(transport, ctx, sources)).to be true + expect(transport.path).to eq('/test/test') + expect(transport.cmd).to eq('git checkout test') + end +end
Add tests for the Git Source plugin
diff --git a/test/coverband/integrations/resque_worker_test.rb b/test/coverband/integrations/resque_worker_test.rb index abc1234..def5678 100644 --- a/test/coverband/integrations/resque_worker_test.rb +++ b/test/coverband/integrations/resque_worker_test.rb @@ -23,7 +23,7 @@ end test 'resque job coverage' do - relative_job_file = './unit/test_resque_job.rb' + relative_job_file = './integrations/test_resque_job.rb' resque_job_file = File.expand_path('./test_resque_job.rb', File.dirname(__FILE__)) require resque_job_file
Fix resque worker file name issue
diff --git a/lib/gdata.rb b/lib/gdata.rb index abc1234..def5678 100644 --- a/lib/gdata.rb +++ b/lib/gdata.rb @@ -18,5 +18,7 @@ require 'gdata/client' require 'gdata/auth' # This is for Unicode "support" -require 'jcode' -$KCODE = 'UTF8'+if RUBY_VERSION < '1.9' + require 'jcode' + $KCODE = 'UTF8' +end
Fix for newer ruby versions
diff --git a/lib/guard.rb b/lib/guard.rb index abc1234..def5678 100644 --- a/lib/guard.rb +++ b/lib/guard.rb @@ -21,7 +21,7 @@ r = Regexp.new(@pattern) r.match(request.get_response_field(@field, @target)) expiration = DateTime.now + @timeout - while !Regexp.last_match && DateTime.now < expiration && request.succeeded? + while !Regexp.last_match && DateTime.now < expiration && request.failures.empty? sleep period request.send r.match(request.get_response_field(@field, @target))
Use new API request interface correctly
diff --git a/wateringServer/spec/models/plant_spec.rb b/wateringServer/spec/models/plant_spec.rb index abc1234..def5678 100644 --- a/wateringServer/spec/models/plant_spec.rb +++ b/wateringServer/spec/models/plant_spec.rb @@ -1,20 +1,48 @@ require 'rails_helper' describe Plant do - let(:plant) { Plant.new } + let(:plant) { Plant.new(name: "Test Name", + species: "Test Species", + days_per_watering: 10, + start_date: Date.today() + )} + let(:user) { User.create(email: "test.user@place.com", + password: "testPassword")} + let(:watering) { Watering.new()} + + describe 'validations' do + it 'can save' do + expect(plant.save).to eq true + end + + it 'wont save if the name is blank' do + plant.name = nil + expect(plant.save).to eq false + expect(plant.errors.full_messages).to eq ["Name can't be blank"] + end + + it 'wont save if the species is blank' do + plant.species = nil + expect(plant.save).to eq false + expect(plant.errors.full_messages).to eq ["Species can't be blank"] + end + + it 'wont save if the days_per_watering is blank' do + plant.days_per_watering = nil + expect(plant.save).to eq false + expect(plant.errors.full_messages).to eq ["Days per watering can't be blank", "Days per watering is not a number"] + end + + it 'wont save if the days_per_watering is negative' do + plant.days_per_watering = -1 + expect(plant.save).to eq false + expect(plant.errors.full_messages).to eq ["Days per watering must be greater than 0"] + end + end + + + describe '#latest_watering' do it 'can return the latest watering' do - plant = Plant.create(name: "test", species: 'test', days_per_watering: 2) - watering1 = Watering.create(amount: 200, date: Date.today()) - watering2 = Watering.create(amount: 200, date: Date.today()) - plant.waterings << watering1 - plant.waterings << watering2 - puts '-------------------------------------------' - puts watering1.object_id - puts watering2.object_id - puts plant.latest_watering.object_id - puts plant.latest_watering.class - puts '-------------------------------------------' - # expect(plant.latest_watering) end end end
Add tests for validations for Plants
diff --git a/lib/humus.rb b/lib/humus.rb index abc1234..def5678 100644 --- a/lib/humus.rb +++ b/lib/humus.rb @@ -3,26 +3,38 @@ # Helper module for all projects in Strata that need # Database access and management. # +# Load this in Strata via '../Humus/lib/humus'. +# Then use the Humus helper methods: +# * Humus.with_snapshot(name, options = {}) +# module Humus # Load a specific snapshot into the database. # + # Use this in integration tests in a CP project. + # + # Note: Does not ROLLBACK yet! + # + # @param [String] name The name of the snapshot. + # @param [Hash] options Options: env, seed, rollback (not implemented yet). + # # @example # Humus.with_snapshot('b008') do - # # Do something for which you needs snapshot b008. + # # Do something for which you need snapshot b008. # end # def self.with_snapshot name, options = {} - environment = options[:env] || ENV['RACK_ENV'] || 'test' - load_dump = options[:load_dump] || true + environment = options[:env] || ENV['RACK_ENV'] || 'test' + seed = options[:seed] || true + rollback = options[:rollback] && raise("Option :rollback not implemented yet.") # Currently, we only want this for tests. # return unless environment == 'test' - # If load_dump is falsy, just yield. + # If seed is falsy, just yield. # - if load_dump + if seed # Load Rakefile tasks. # load 'Rakefile'
Add docs and helpful info to Humus.with_snapshot.
diff --git a/lib/jsonl.rb b/lib/jsonl.rb index abc1234..def5678 100644 --- a/lib/jsonl.rb +++ b/lib/jsonl.rb @@ -4,6 +4,18 @@ module JSONL module_function + # Generate a string formatted as JSONL from an array. + # + # ==== Attributes + # + # * +objs+ - an array consists of objects + # * +opts+ - options passes to `JSON.generate` + # + # ==== Exapmles + # + # users = User.all.map(&:attributes) #=> [{"id"=>1, "name"=>"Gilbert", ...}, {"id"=>2, "name"=>"Alexa", ...}, ...] + # generated = JSONL.generate(users) + # def generate(objs, opts = nil) unless objs.is_a?(Array) raise TypeError, "can't generate from #{objs.class}" @@ -16,6 +28,18 @@ generated.join("\n") end + # Parse JSONL string and return as an array. + # + # ==== Attributes + # + # * +source+ - a string formatted as JSONL + # * +opts+ - options passes to `JSON.parse` + # + # ==== Examples + # + # source = File.read('source.jsonl') + # parsed = JSONL.parse(source) + # def parse(source, opts = {}) parsed = [] source.each_line do |line|
Write document comment by RDoc
diff --git a/lib/rambo.rb b/lib/rambo.rb index abc1234..def5678 100644 --- a/lib/rambo.rb +++ b/lib/rambo.rb @@ -6,7 +6,7 @@ file ||= raml_file @options ||= yaml_options - DocumentGenerator.generate!(file, options) + DocumentGenerator.generate!(file, @options) end private
Use instance variable instead of accessor method
diff --git a/db/migrate/20141003124525_reslug_content_design_manual.rb b/db/migrate/20141003124525_reslug_content_design_manual.rb index abc1234..def5678 100644 --- a/db/migrate/20141003124525_reslug_content_design_manual.rb +++ b/db/migrate/20141003124525_reslug_content_design_manual.rb @@ -0,0 +1,33 @@+class ReslugContentDesignManual < Mongoid::Migration + @manual_records = Class.new do + include Mongoid::Document + store_in :manual_records + end + + @editions = Class.new do + include Mongoid::Document + store_in :specialist_document_editions + end + + OLD_SLUG = "guidance/content-design-1" + NEW_SLUG = "guidance/content-design" + + def self.up + manual = @manual_records.where(slug: OLD_SLUG).first + + manual.update_attribute :slug, NEW_SLUG + + manual.editions.each do |edition| + edition["document_ids"].each do |document_id| + @editions.where(document_id: document_id).each do |specialist_document| + new_sd_slug = specialist_document.slug.sub(OLD_SLUG, NEW_SLUG) + specialist_document.update_attribute :slug, new_sd_slug + end + end + end + end + + def self.down + raise IrreversibleMigration + end +end
Add migration to change slug for content-design manual This script depends on the old content design manual having been removed first. Once it has been and the slug is available, the migration can be run to rename the content-design-manual's slug.
diff --git a/db/migrate/20171213050734_open_closed_discussion_count.rb b/db/migrate/20171213050734_open_closed_discussion_count.rb index abc1234..def5678 100644 --- a/db/migrate/20171213050734_open_closed_discussion_count.rb +++ b/db/migrate/20171213050734_open_closed_discussion_count.rb @@ -2,9 +2,8 @@ def change add_column :groups, :open_discussions_count, :integer, default: 0, null: false add_column :groups, :closed_discussions_count, :integer, default: 0, null: false - add_column :discussions, :closed_at, :datetime + rename_column :discussions, :archived_at, :closed_at remove_column :discussions, :is_deleted, :boolean - remove_column :discussions, :archived_at, :datetime remove_column :discussions, :closed, :boolean end end
Rename rather than drop/add closed_at
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.2.0' + s.version = '2.2.3.0' s.description = ' ' s.authors = ['The Eventide Project']
Package version is increased from 2.2.2.0 to 2.2.3.0
diff --git a/recipes/fast_remote_cache.rb b/recipes/fast_remote_cache.rb index abc1234..def5678 100644 --- a/recipes/fast_remote_cache.rb +++ b/recipes/fast_remote_cache.rb @@ -8,7 +8,7 @@ a new machine. It is also necessary to invoke when you are switching to the fast_remote_cache strategy for the first time. DESC - task :setup do + task :setup, :except => { :no_release => true } do if deploy_via == :fast_remote_cache strategy.setup! else @@ -16,6 +16,17 @@ end end + desc <<-DESC + Make sure the cached-copy is group writable. This ensures that when used + in a team environment, multiple individuals may deploy using this + strategy. + DESC + task :make_cache_writable, :except => { :no_release => true } do + cache = File.join(shared_path, fetch(:repository_cache, "cached-copy")) + sudo "chmod -R g+w #{cache}; true" + end + end -after "deploy:setup", "fast_remote_cache:setup"+after "deploy:setup", "fast_remote_cache:setup" +before "deploy:update_code", "fast_remote_cache:make_cache_writable"
Make cache group-writable before deploy.
diff --git a/lib/oga.rb b/lib/oga.rb index abc1234..def5678 100644 --- a/lib/oga.rb +++ b/lib/oga.rb @@ -9,9 +9,11 @@ require_relative 'liboga' +#:nocov: if RUBY_PLATFORM == 'java' org.liboga.Liboga.load(JRuby.runtime) end +#:nocov: require_relative 'oga/xml/node' require_relative 'oga/xml/element'
Disable code coverage for JRuby specific code.
diff --git a/mathbot.rb b/mathbot.rb index abc1234..def5678 100644 --- a/mathbot.rb +++ b/mathbot.rb @@ -1,5 +1,5 @@ require 'cinch' -require 'cgi' +require 'uri' require 'patron' require 'configru' @@ -21,7 +21,7 @@ helpers do def mathtex_url(code) - "http://www.forkosh.com/mathtex.cgi?" + CGI.escape(code) + "http://www.forkosh.com/mathtex.cgi?" + URI.escape(code) end def shorten_url(url) @@ -30,7 +30,7 @@ sess.base_url = "http://da.gd" sess.headers['User-Agent'] = 'mathbot/1.0' - resp = sess.get("/s?url=#{CGI.escape(url)}&text=1&strip=1") + resp = sess.get("/s?url=#{URI.escape(url)}&text=1&strip=1") return "Could not shorten URL. Oops!" if resp.status >= 400
Use URI.escape instead of CGI.escape, which changes spaces to plus signs.
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -15,5 +15,7 @@ # config.middleware.use I18n::JS::Middleware # I18n-js config.logger = Logger.new(STDOUT) + + config.time_zone = 'Berlin' end end
Set time zone to Berlin
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -17,5 +17,8 @@ # Timezone config.time_zone = 'Asia/Tokyo' + + # Default I18n locale + config.i18n.default_locale = :ja end end
Set Japanese as default locale
diff --git a/hot_bunnies.gemspec b/hot_bunnies.gemspec index abc1234..def5678 100644 --- a/hot_bunnies.gemspec +++ b/hot_bunnies.gemspec @@ -8,7 +8,7 @@ Gem::Specification.new do |s| s.name = 'hot_bunnies' s.version = HotBunnies::VERSION - s.platform = Gem::Platform::RUBY + s.platform = 'java' s.authors = ['Theo Hultberg'] s.email = ['theo@burtcorp.com'] s.homepage = 'http://github.com/iconara/hot_bunnies'
Set gem platform to "java"
diff --git a/money.gemspec b/money.gemspec index abc1234..def5678 100644 --- a/money.gemspec +++ b/money.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = "money" - s.version = "2.1.3" + s.version = "2.1.4" s.summary = "Money and currency exchange support library" s.email = "hongli@phusion.nl" s.homepage = "http://money.rubyforge.org/" @@ -15,6 +15,7 @@ "lib/money/core_extensions.rb", "lib/money/errors.rb", "lib/money/money.rb", + "lib/money/symbols.rb", "lib/money/variable_exchange_bank.rb", "test/core_extensions_spec.rb", "test/exchange_bank_spec.rb",
Add symbols.rb to gem specification and bump version to 2.1.4.
diff --git a/cmd/lib/spree_cmd/templates/extension/extension.gemspec b/cmd/lib/spree_cmd/templates/extension/extension.gemspec index abc1234..def5678 100644 --- a/cmd/lib/spree_cmd/templates/extension/extension.gemspec +++ b/cmd/lib/spree_cmd/templates/extension/extension.gemspec @@ -21,7 +21,7 @@ s.require_path = 'lib' s.requirements << 'none' - spree_version = '>= 4.2.0', '< 6.0' + spree_version = '>= 4.2.0' s.add_dependency 'spree_core', spree_version s.add_dependency 'spree_api', spree_version s.add_dependency 'spree_backend', spree_version
Drop upper limit in gemfiles gemspecs
diff --git a/lib/Tray/calculator/fees/ticket_fee.rb b/lib/Tray/calculator/fees/ticket_fee.rb index abc1234..def5678 100644 --- a/lib/Tray/calculator/fees/ticket_fee.rb +++ b/lib/Tray/calculator/fees/ticket_fee.rb @@ -8,12 +8,15 @@ registers.each do |reg| total_fees = 0 reg.line_items.each do |item| - if item.entity.is_a?(TicketType) - total_fees += item.entity.fee_for_amount_in_cents(item.entity.price_for_level_in_cents_without_fee(item.options[:price_level]) - item.discount_total) - elsif item.entity.is_a?(TicketPackage) - total_fees += item.entity.package_fee_in_cents - elsif item.entity.is_a?(Membership) || item.entity.is_a?(GiftCard) - total_fees += item.entity.fee_in_cents + entity = item.entity + entity = entity.ticket_type if entity.is_a?(EventTicketType) + + if entity.respond_to?(:processing_fee) + total_fees += entity.processing_fee(entity.price_for_level_in_cents_without_fee(item.options[:price_level]) - item.discount_total) + elsif entity.is_a?(TicketPackage) + total_fees += entity.package_fee_in_cents + elsif entity.is_a?(Membership) || entity.is_a?(GiftCard) + total_fees += entity.fee_in_cents end end reg.ticket_fees = total_fees @@ -23,4 +26,4 @@ end end end -end+end
Include merchant processing when computing fees for non-ticket items [#167375164]
diff --git a/models.rb b/models.rb index abc1234..def5678 100644 --- a/models.rb +++ b/models.rb @@ -15,9 +15,6 @@ has n, :restaurants, { :child_key => [:creator_id] } has n, :created_restrictions, "Restriction", { :child_key => [:creator_id] } - # We're naming this relationship "created_restrictions" instead of just - # "restrictions" because I want a users `restrictions` as a way to filter - # search results (i.e. don't show me restaurants that's not gluten free) def password=(password) self.attribute_set(:password, BCrypt::Password.create(password))
Delete comments from previous commit
diff --git a/test/helper.rb b/test/helper.rb index abc1234..def5678 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -10,10 +10,11 @@ module TestHelper DATA_DIR = File.join(File.dirname(__FILE__), 'data') + DATA_FILES = Dir.glob("#{DATA_DIR}/*.jpg") def run_in_temp_dir &block - Dir.tmpdir do |tmpdir| - FileUtils.cp_r DATA_DIR, tmpdir + Dir.mktmpdir do |tmpdir| + FileUtils.cp_r DATA_FILES, tmpdir Dir.chdir tmpdir do block.call end
Fix test suite (bundle exec rake). Would always pass regardless of how you modified the assertions.
diff --git a/memoizable.gemspec b/memoizable.gemspec index abc1234..def5678 100644 --- a/memoizable.gemspec +++ b/memoizable.gemspec @@ -18,7 +18,7 @@ gem.test_files = Dir.glob('spec/{unit,integration}/**/*.rb') gem.extra_rdoc_files = Dir.glob('**/*.md') - gem.add_runtime_dependency('thread_safe', '~> 0.3.1') + gem.add_runtime_dependency('thread_safe', '~> 0.3', '>= 0.3.1') gem.add_development_dependency('bundler', '~> 1.5', '>= 1.5.3') end
Change thread_safe to use a version compatible with semantic versioning
diff --git a/Casks/appcode-eap.rb b/Casks/appcode-eap.rb index abc1234..def5678 100644 --- a/Casks/appcode-eap.rb +++ b/Casks/appcode-eap.rb @@ -1,8 +1,8 @@ cask :v1 => 'appcode-eap' do - version '3.1.0' - sha256 'e642a32107c9b6f0d2a9923ece6c50875f0fc66f6341ca8765af4c1696d65f65' + version '3.2.0' + sha256 '2dd8a0a9246067ae6e092b9934cbadac6730a74fe400c8929b09792a0c0cda83' - url 'http://download.jetbrains.com/objc/AppCode-139.261.dmg' + url 'http://download.jetbrains.com/objc/AppCode-141.1399.2.dmg' homepage 'http://confluence.jetbrains.com/display/OBJC/AppCode+EAP' license :commercial
Update AppCode EAP to 3.2.0 This commit updates the version, sha256 and url stanzas
diff --git a/Casks/light-table.rb b/Casks/light-table.rb index abc1234..def5678 100644 --- a/Casks/light-table.rb +++ b/Casks/light-table.rb @@ -1,7 +1,7 @@ class LightTable < Cask - url 'https://d35ac8ww5dfjyg.cloudfront.net/playground/bins/0.6.2/LightTableMac.zip' + url 'https://d35ac8ww5dfjyg.cloudfront.net/playground/bins/0.6.3/LightTableMac.zip' homepage 'http://www.lighttable.com/' - version '0.6.2' - sha1 '9ed8a47bf7c7f73eafa551637f78652c6de818ca' + version '0.6.3' + sha1 'c655e6a86fc262ee1b49b4bff04af5516f0d8748' link 'LightTable/LightTable.app' end
Update Light Table to 0.6.3
diff --git a/lib/rip/packages/remote_gem_package.rb b/lib/rip/packages/remote_gem_package.rb index abc1234..def5678 100644 --- a/lib/rip/packages/remote_gem_package.rb +++ b/lib/rip/packages/remote_gem_package.rb @@ -18,7 +18,7 @@ Dir.chdir cache_path do @@remotes.each do |remote| - ui.puts "Searching %s for %s..." % [ remote, source ] + ui.vputs "Searching %s for %s..." % [ remote, source ] source_flag = "--source=http://#{remote}/" if Rip::Gems.rgem("fetch #{source} #{source_flag}") =~ /Downloaded (.+)/
Use vputs in remote gem fetching
diff --git a/lib/aasm/rspec/transition_from.rb b/lib/aasm/rspec/transition_from.rb index abc1234..def5678 100644 --- a/lib/aasm/rspec/transition_from.rb +++ b/lib/aasm/rspec/transition_from.rb @@ -2,8 +2,7 @@ match do |obj| @state_machine_name ||= :default obj.aasm(@state_machine_name).current_state = from_state.to_sym - # expect(obj).to receive(:broadcast_event).with(@event.to_s, obj, from_state, @to_state) - obj.send(@event) && obj.aasm(@state_machine_name).current_state == @to_state.to_sym + obj.send(@event, *@args) && obj.aasm(@state_machine_name).current_state == @to_state.to_sym end chain :on do |state_machine_name| @@ -14,12 +13,13 @@ @to_state = state end - chain :on_event do |event| + chain :on_event do |event, *args| @event = event + @args = args end description do - "transition state to :#{@to_state} from :#{expected} on event :#{@event} (on :#{@state_machine_name})" + "transition state to :#{@to_state} from :#{expected} on event :#{@event}, with params: #{@args} (on :#{@state_machine_name})" end failure_message do |obj|
Add posibility to pass arguments to on_event rspec custom matcher function
diff --git a/lib/active_admin/editor/engine.rb b/lib/active_admin/editor/engine.rb index abc1234..def5678 100644 --- a/lib/active_admin/editor/engine.rb +++ b/lib/active_admin/editor/engine.rb @@ -7,20 +7,11 @@ def editor; ActiveAdmin::Editor.configuration end end - initializer 'active_admin.editor', :group => :all do |app| + initializer 'active_admin.editor', group: :all do |app| app.config.assets.precompile += [ 'active_admin/editor.js', 'active_admin/editor.css' ] + ActiveAdmin::Editor.configuration.stylesheets - - ActiveAdmin.application.tap do |config| - config.register_javascript 'active_admin/editor.js' - config.register_stylesheet 'active_admin/editor.css' - - ActiveAdmin::Editor.configuration.stylesheets.each do |stylesheet| - config.register_stylesheet stylesheet - end - end end end end
Remove deprecated register_javascript and register_stylesheet
diff --git a/lib/appsignal/integrations/que.rb b/lib/appsignal/integrations/que.rb index abc1234..def5678 100644 --- a/lib/appsignal/integrations/que.rb +++ b/lib/appsignal/integrations/que.rb @@ -4,9 +4,6 @@ def self.included(base) base.class_eval do def _run_with_appsignal - cls = attrs[:job_class] - cls = attrs[:args].last["job_class"] if cls == "ActiveJob::QueueAdapters::QueAdapter::JobWrapper" - env = { :metadata => { :id => attrs[:job_id], @@ -32,7 +29,7 @@ transaction.set_error(error) raise error ensure - transaction.set_action "#{cls}#run" + transaction.set_action "#{attrs[:job_class]}#run" Appsignal::Transaction.complete_current! end end
Remove ActiveJob support in QuePlugin
diff --git a/lib/discordrb/webhooks/builder.rb b/lib/discordrb/webhooks/builder.rb index abc1234..def5678 100644 --- a/lib/discordrb/webhooks/builder.rb +++ b/lib/discordrb/webhooks/builder.rb @@ -1,5 +1,13 @@ module Discordrb::Webhooks # A class that acts as a builder for a webhook message object. class Builder + def initialize(content: '', username: nil, avatar_url: nil, tts: false, file: nil, embeds: []) + @content = content + @username = username + @avatar_url = avatar_url + @tts = tts + @file = file + @embeds = embeds + end end end
:anchor: Create an initializer for Builder that initializes everything with default values
diff --git a/spec/default/sample_spec.rb b/spec/default/sample_spec.rb index abc1234..def5678 100644 --- a/spec/default/sample_spec.rb +++ b/spec/default/sample_spec.rb @@ -3,3 +3,7 @@ describe command('defaults read'), :if => os[:family] == 'darwin' do its(:exit_status) { should eq 0 } end + +describe command('pip list') do + its(:exit_status) { should eq 0 } +end
Add test for `pip list` command