diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/app/jobs/import_job.rb b/app/jobs/import_job.rb index abc1234..def5678 100644 --- a/app/jobs/import_job.rb +++ b/app/jobs/import_job.rb @@ -7,4 +7,9 @@ def max_attempts 1 end + + def max_run_time + 6.hours + end + end
Increase max run time to 6 hours + https://github.com/studentinsights/studentinsights/issues/1023#issuecomment-330038945
diff --git a/app/models/spid/idp.rb b/app/models/spid/idp.rb index abc1234..def5678 100644 --- a/app/models/spid/idp.rb +++ b/app/models/spid/idp.rb @@ -12,7 +12,8 @@ 'poste_test' => 'http://spidposte.test.poste.it/jod-fs/metadata/idp.xml', 'spiditalia' => 'https://spid.register.it/login/metadata', 'sielte' => 'https://identity.sieltecloud.it/simplesaml/metadata.xml', - 'tim' => 'https://login.id.tim.it/spid-services/MetadataBrowser/idp' + 'tim' => 'https://login.id.tim.it/spid-services/MetadataBrowser/idp', + 'testenv2' => 'http://spid-testenv:8088/metadata' } end
Add local testenv2 to available providers
diff --git a/app/models/question.rb b/app/models/question.rb index abc1234..def5678 100644 --- a/app/models/question.rb +++ b/app/models/question.rb @@ -2,4 +2,5 @@ belongs_to :user has_many :responses + validates :image_path, presence: true end
Add Validation to Question for Specs Testing
diff --git a/lib/flipper/middleware/setup_env.rb b/lib/flipper/middleware/setup_env.rb index abc1234..def5678 100644 --- a/lib/flipper/middleware/setup_env.rb +++ b/lib/flipper/middleware/setup_env.rb @@ -1,7 +1,7 @@ module Flipper module Middleware class SetupEnv - # Public: Initializes an instance of the SetEnv middleware. Allows for + # Public: Initializes an instance of the SetupEnv middleware. Allows for # lazy initialization of the flipper instance being set in the env by # providing a block. # @@ -14,10 +14,10 @@ # flipper = Flipper.new(...) # # # using with a normal flipper instance - # use Flipper::Middleware::SetEnv, flipper + # use Flipper::Middleware::SetupEnv, flipper # # # using with a block that yields a flipper instance - # use Flipper::Middleware::SetEnv, lambda { Flipper.new(...) } + # use Flipper::Middleware::SetupEnv, lambda { Flipper.new(...) } # def initialize(app, flipper_or_block, options = {}) @app = app
Fix typo in setup env docs
diff --git a/lib/json_api/response/middleware.rb b/lib/json_api/response/middleware.rb index abc1234..def5678 100644 --- a/lib/json_api/response/middleware.rb +++ b/lib/json_api/response/middleware.rb @@ -2,7 +2,9 @@ module Response class Middleware < Faraday::Middleware - def initialize(app, directory:) + attr_reader :directory + + def initialize(app, directory: JSONApi::Response::TypeDirectory.new) super(app) @directory = directory end @@ -13,10 +15,6 @@ end end - def directory - @directory || JSONApi::Response::TypeDirectory.new - end - end end end
Use Ruby's built-in default param support This is terser.
diff --git a/spec/unit/veritas/adapter/arango/visitor/wrappable/limit/root_spec.rb b/spec/unit/veritas/adapter/arango/visitor/wrappable/limit/root_spec.rb index abc1234..def5678 100644 --- a/spec/unit/veritas/adapter/arango/visitor/wrappable/limit/root_spec.rb +++ b/spec/unit/veritas/adapter/arango/visitor/wrappable/limit/root_spec.rb @@ -0,0 +1,14 @@+require 'spec_helper' + +describe Veritas::Adapter::Arango::Visitor::Wrappable::Limit, '#root' do + subject { object.root } + + let(:node) { base.sort_by { |r| [r.foo.asc, r.bar.asc] }.take(5) } + + expect_aql <<-AQL + FOR `local_name` IN `name` + SORT `local_name`.`foo` ASC, `local_name`.`bar` ASC + LIMIT 0, 5 + RETURN {\"foo\": `local_name`.`foo`, \"bar\": `local_name`.`bar`} + AQL +end
Add specs for limit operation
diff --git a/lib/oauth/request_proxy/rack_request.rb b/lib/oauth/request_proxy/rack_request.rb index abc1234..def5678 100644 --- a/lib/oauth/request_proxy/rack_request.rb +++ b/lib/oauth/request_proxy/rack_request.rb @@ -7,7 +7,7 @@ proxies Rack::Request def method - request.request_method + request.env["rack.methodoverride.original_method"] || request.request_method end def uri @@ -37,4 +37,4 @@ request.params end end -end+end
Fix for applications using the MethodOverride middleware
diff --git a/lib/boletosimples/resources/bank_billet.rb b/lib/boletosimples/resources/bank_billet.rb index abc1234..def5678 100644 --- a/lib/boletosimples/resources/bank_billet.rb +++ b/lib/boletosimples/resources/bank_billet.rb @@ -2,6 +2,8 @@ module BoletoSimples class BankBillet < BaseModel + custom_put :pay + def cancel self.class.request(_method: :put, _path: self.class.build_request_path('bank_billets/:id/cancel', { self.class.primary_key => id })) do |parsed_data, response| assign_attributes(self.class.parse(parsed_data[:data])) if parsed_data[:data].any? @@ -11,15 +13,5 @@ end @response.success? end - - def pay - self.class.request(_method: :put, _path: self.class.build_request_path('bank_billets/:id/pay', { self.class.primary_key => id })) do |parsed_data, response| - assign_attributes(self.class.parse(parsed_data[:data])) if parsed_data[:data].any? - @metadata = parsed_data[:metadata] - @response_errors = parsed_data[:errors] - @response = response - end - @response.success? - end end end
Test cutom method from Her
diff --git a/lib/bugherd_client/resources/v1/comment.rb b/lib/bugherd_client/resources/v1/comment.rb index abc1234..def5678 100644 --- a/lib/bugherd_client/resources/v1/comment.rb +++ b/lib/bugherd_client/resources/v1/comment.rb @@ -13,6 +13,14 @@ end # + # Get a single comment of a Task + # + def find(project_id, task_id, comment_id) + raw_response = get_request("projects/#{project_id}/tasks/#{task_id}/comments/#{comment_id}") + parse_response(raw_response, :comment) + end + + # # Create a comment # attributes: text, user_id or email def create(project_id, task_id, attributes={})
Add Comment.find for v1 of api
diff --git a/lib/tasks/load_additional_record_data.rake b/lib/tasks/load_additional_record_data.rake index abc1234..def5678 100644 --- a/lib/tasks/load_additional_record_data.rake +++ b/lib/tasks/load_additional_record_data.rake @@ -32,7 +32,7 @@ print "\e[32m.\e[0m" begin newitem.save! unless newitem.nil? - rescue Postgres::PGError => e + rescue ActiveRecord::RecordNotUnique => e print 'duplicate barcode ', barcode end end
Correct error handling for duplicates.
diff --git a/config/initializers/meta_tags.rb b/config/initializers/meta_tags.rb index abc1234..def5678 100644 --- a/config/initializers/meta_tags.rb +++ b/config/initializers/meta_tags.rb @@ -0,0 +1,10 @@+# frozen_string_literal: true + +# Module contains helpers that normalize text meta tag values. +module MetaTags + module TextNormalizer + def self.strip_tags(string) + ERB::Util.html_escape helpers.sanitize(string) + end + end +end
Fix bug with some special chars being escaped in page title
diff --git a/config/initializers/paperclip.rb b/config/initializers/paperclip.rb index abc1234..def5678 100644 --- a/config/initializers/paperclip.rb +++ b/config/initializers/paperclip.rb @@ -7,10 +7,8 @@ fog_credentials: { aws_access_key_id: ENV['AWS_ACCESS_KEY_ID'], aws_secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'], - provider: 'AWS', - region: 'us-west-1' + provider: 'AWS' }, - fog_host: "s3.amazonaws.com", fog_directory: ENV['AWS_BUCKET'] || "afdev-#{Rails.env}", fog_public: :public }
Remove us-west-1 from the S3 bucket
diff --git a/core/objectspace/_id2ref_spec.rb b/core/objectspace/_id2ref_spec.rb index abc1234..def5678 100644 --- a/core/objectspace/_id2ref_spec.rb +++ b/core/objectspace/_id2ref_spec.rb @@ -7,16 +7,43 @@ r.should == s end - it "retrieves an Integer by object_id" do - f = 1 - r = ObjectSpace._id2ref(f.object_id) - r.should == f + it "retrieves true by object_id" do + ObjectSpace._id2ref(true.object_id).should == true + end + + it "retrieves false by object_id" do + ObjectSpace._id2ref(false.object_id).should == false + end + + it "retrieves nil by object_id" do + ObjectSpace._id2ref(nil.object_id).should == nil + end + + it "retrieves a small Integer by object_id" do + ObjectSpace._id2ref(1.object_id).should == 1 + ObjectSpace._id2ref((-42).object_id).should == -42 + end + + it "retrieves a large Integer by object_id" do + obj = 1 << 88 + ObjectSpace._id2ref(obj.object_id).should.equal?(obj) end it "retrieves a Symbol by object_id" do - s = :sym - r = ObjectSpace._id2ref(s.object_id) - r.should == s + ObjectSpace._id2ref(:sym.object_id).should.equal?(:sym) + end + + it "retrieves a String by object_id" do + obj = "str" + ObjectSpace._id2ref(obj.object_id).should.equal?(obj) + end + + it "retrieves a frozen literal String by object_id" do + ObjectSpace._id2ref("frozen string literal _id2ref".freeze.object_id).should.equal?("frozen string literal _id2ref".freeze) + end + + it "retrieves an Encoding by object_id" do + ObjectSpace._id2ref(Encoding::UTF_8.object_id).should.equal?(Encoding::UTF_8) end it 'raises RangeError when an object could not be found' do
Cover more cases for ObjectSpace._id2ref
diff --git a/recipes/source.rb b/recipes/source.rb index abc1234..def5678 100644 --- a/recipes/source.rb +++ b/recipes/source.rb @@ -3,3 +3,13 @@ reference node["taskwarrior"]["source"]["git_revision"] action :sync end + +bash "Install taskwarrior" do + user "root" + cwd "#{Chef::Config[:file_cache_path]}/task.git" + code <<-EOH + cmake . + make + make install + EOH +end
Build taskwarrior with a bash block.
diff --git a/app/coin_calculator.rb b/app/coin_calculator.rb index abc1234..def5678 100644 --- a/app/coin_calculator.rb +++ b/app/coin_calculator.rb @@ -45,7 +45,7 @@ unless @result.empty? erb :result else - flash[:error] = "You must enter an amount" + flash[:warning] = "You must enter an amount" redirect to('/') end end
Change from error to warning for blank amount - probably a warning and not an alert (fatal error)
diff --git a/app/models/document.rb b/app/models/document.rb index abc1234..def5678 100644 --- a/app/models/document.rb +++ b/app/models/document.rb @@ -1,8 +1,7 @@ class Document < ActiveRecord::Base belongs_to :user - has_attached_file :doc_pdf, styles: {:thumb => "100x100#", - :small => "150x150>", - :medium => "200x200" } + has_attached_file :doc_pdf - validates_attachment_content_type :doc_pdf, content_type: ['image/jpeg', 'image/png', 'image/gif', 'application/pdf'] + validates_attachment_content_type :doc_pdf, content_type: "application/pdf" end +
Remove attachment styles and unnecessary content type
diff --git a/app/models/notifier.rb b/app/models/notifier.rb index abc1234..def5678 100644 --- a/app/models/notifier.rb +++ b/app/models/notifier.rb @@ -10,7 +10,7 @@ end def occurence_report(user, occurence, sent_at = Time.now) - subject "[#{occurence.error.project.name}] An error occured" + subject "[#{occurence.error.project.name}] An error occured (@#{@occurence.error_id})" recipients user.email from 'donotreply@failtale.be' sent_on sent_at
Include the error id in the mail title
diff --git a/kiwi/app/controllers/questions_controller.rb b/kiwi/app/controllers/questions_controller.rb index abc1234..def5678 100644 --- a/kiwi/app/controllers/questions_controller.rb +++ b/kiwi/app/controllers/questions_controller.rb @@ -1,6 +1,4 @@ class QuestionsController < ApplicationController - - # before_filter def index @questions = Question.all @@ -9,8 +7,7 @@ elsif params[:sort] == "most-recent" @question = @questions.order(:created_at) elsif params[:sort] == "rate" - binding.pry - @question = @questions.sort_by { |question| question.votes.count }.reverse + @question = @questions.sort_by { |question| question.sum_of_votes }.reverse else end
Add Sorting filter in question controller
diff --git a/holiday_japan.gemspec b/holiday_japan.gemspec index abc1234..def5678 100644 --- a/holiday_japan.gemspec +++ b/holiday_japan.gemspec @@ -13,6 +13,8 @@ gem.homepage = "https://masa16.github.io/holiday_japan/" gem.license = "MIT" + gem.metadata['source_code_uri'] = 'https://github.com/masa16/holiday_japan' + gem.files = `git ls-files`.split($/) gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
Add source code URI to gemspec
diff --git a/spec/nyny_spec.rb b/spec/nyny_spec.rb index abc1234..def5678 100644 --- a/spec/nyny_spec.rb +++ b/spec/nyny_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe NYNY do - its 'root points to pwd' do + it 'root points to pwd' do NYNY.root.should == Pathname.pwd end @@ -9,7 +9,7 @@ NYNY.env.should be_test end - its 'root can join a path' do + it 'root can join a path' do NYNY.root.join("foo").should == Pathname.pwd + "foo" end end
Use it instead of its, fails on Travis for some reason
diff --git a/spec/test_xmpp.rb b/spec/test_xmpp.rb index abc1234..def5678 100644 --- a/spec/test_xmpp.rb +++ b/spec/test_xmpp.rb @@ -4,20 +4,10 @@ include XMPPTestHelper - before(:all) { require '' } - - before :each do - - end - - after :each do - XMPP.stop - end - - - - - + before(:all) { } + + # TODO: Actually test something + after do XMPP.stop end
Remove nonsense from XMPP tests
diff --git a/lib/kaminari/models/data_mapper_extension.rb b/lib/kaminari/models/data_mapper_extension.rb index abc1234..def5678 100644 --- a/lib/kaminari/models/data_mapper_extension.rb +++ b/lib/kaminari/models/data_mapper_extension.rb @@ -5,8 +5,10 @@ module Paginatable class_eval <<-RUBY, __FILE__, __LINE__ + 1 def #{Kaminari.config.page_method_name}(num = 1) + model = self + model = self.model if self.is_a? DataMapper::Collection num = [num.to_i, 1].max - 1 - all(:limit => default_per_page, :offset => default_per_page * num).extend Paginating + all(:limit => model.default_per_page, :offset => model.default_per_page * num).extend Paginating end RUBY end
Fix for Model.all.page in DataMapper
diff --git a/lib/parsley_simple_form/simple_form_adapt.rb b/lib/parsley_simple_form/simple_form_adapt.rb index abc1234..def5678 100644 --- a/lib/parsley_simple_form/simple_form_adapt.rb +++ b/lib/parsley_simple_form/simple_form_adapt.rb @@ -0,0 +1,26 @@+module ParsleySimpleForm + class SimpleFormAdapt < SimpleForm::FormBuilder + + def input(attribute_name, options = {}, &block) + options[:input_html] ||= {} + parsley_validations = validations_for(attribute_name) + + options[:input_html].merge!(parsley_validations) + super + end + + private + + def validations_for(attribute_name) + object._validators[attribute_name].each_with_object({}) do |validate, attributes| + next unless klass = validate_constantize(validate.kind) + + attributes.merge!(klass.new(validate).attribute_validate) + end + end + + def validate_constantize(validate_kind) + ('parsley_simple_form/validators/' + validate_kind.to_s).camelize.constantize rescue false + end + end +end
Add simple form adapt implementation
diff --git a/spec/javascripts/support/jasmine_helper.rb b/spec/javascripts/support/jasmine_helper.rb index abc1234..def5678 100644 --- a/spec/javascripts/support/jasmine_helper.rb +++ b/spec/javascripts/support/jasmine_helper.rb @@ -14,7 +14,8 @@ # pin chromedriver version to latest compatible found # see https://chromedriver.storage.googleapis.com/index.html # Webdrivers.logger.level = :DEBUG -Webdrivers::Chromedriver.required_version = '79.0.3945.36' +# Webdrivers::Chromedriver.required_version = '79.0.3945.36' +Webdrivers::Chromedriver.required_version = '71.0.3578.137' Jasmine.configure do |config| config.runner = lambda { |formatter, jasmine_server_url|
Downgrade chrome driver for jasmine Inline with feature test chromedirver version and version 79 may not work for some local test envs.
diff --git a/spec/provider/bluemix_cloudfoundry_spec.rb b/spec/provider/bluemix_cloudfoundry_spec.rb index abc1234..def5678 100644 --- a/spec/provider/bluemix_cloudfoundry_spec.rb +++ b/spec/provider/bluemix_cloudfoundry_spec.rb @@ -0,0 +1,23 @@+require 'spec_helper' +require 'dpl/provider/bluemix_cloudfoundry' + +describe DPL::Provider::BluemixCF do + subject :provider do + described_class.new(DummyContext.new, region: 'eu-gb', username: 'Moonpie', + password: 'myexceptionallyaveragepassword', + organization: 'myotherorg', + space: 'inner', + manifest: 'worker-manifest.yml', + skip_ssl_validation: true) + end + + describe "#check_auth" do + example do + expect(provider.context).to receive(:shell).with('wget \'https://cli.run.pivotal.io/stable?release=linux64-binary&source=github\' -qO cf-linux-amd64.tgz && tar -zxvf cf-linux-amd64.tgz && rm cf-linux-amd64.tgz') + expect(provider.context).to receive(:shell).with('./cf api api.eu-gb.bluemix.net --skip-ssl-validation') + expect(provider.context).to receive(:shell).with('./cf login -u Moonpie -p myexceptionallyaveragepassword -o myotherorg -s inner') + provider.check_auth + end + end + +end
Add Bluemix deploy provider test coverage Add spec class to test Bluemix deploy provider Signed-off-by: Adam King <a74e182e49abf6252c9b13e1b94c4c5a47f8da9a@us.ibm.com>
diff --git a/event_store-entity_store.gemspec b/event_store-entity_store.gemspec index abc1234..def5678 100644 --- a/event_store-entity_store.gemspec +++ b/event_store-entity_store.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'event_store-entity_store' - s.version = '0.3.3' + s.version = '0.3.4' s.summary = 'Store of entities that are projected from EventStore streams' s.description = ' '
Package version is increased from 0.3.3 to 0.3.4
diff --git a/auto_time_zone.gemspec b/auto_time_zone.gemspec index abc1234..def5678 100644 --- a/auto_time_zone.gemspec +++ b/auto_time_zone.gemspec @@ -16,5 +16,5 @@ s.files = Dir['{app,lib}/**/*', 'MIT-LICENSE', 'Rakefile', 'README.rdoc'] s.test_files = Dir['test/**/*'] - s.add_dependency 'rails', '~> 4.0' + s.add_dependency 'rails', '>= 4.0' end
Update gemspec to work with higher versions of rails
diff --git a/spec/sprinkle/installers/pear_spec.rb b/spec/sprinkle/installers/pear_spec.rb index abc1234..def5678 100644 --- a/spec/sprinkle/installers/pear_spec.rb +++ b/spec/sprinkle/installers/pear_spec.rb @@ -4,16 +4,11 @@ before do @package = mock(Sprinkle::Package, :name => 'spec') - end - - def create_rake(names, options = {}, &block) - Sprinkle::Installers::Pear.new(@package, names, options, &block) + @installer = Sprinkle::Installers::Pear.new(@package, 'spec') end describe 'during installation' do - it 'should invoke the pear executer for all specified tasks' do - @installer = create_pear 'spec' @install_commands = @installer.send :install_commands @install_commands.should == "pear install --alldeps spec" end
[FIX] Fix up build failure in pear installer spec
diff --git a/spec/support/save_feature_failures.rb b/spec/support/save_feature_failures.rb index abc1234..def5678 100644 --- a/spec/support/save_feature_failures.rb +++ b/spec/support/save_feature_failures.rb @@ -9,7 +9,7 @@ example_filename += '.html' if RSpec.current_example.exception.present? save_page(example_filename) - save_page(example_screenshotname) + save_screenshot(example_screenshotname) # remove the file if the test starts working again else File.unlink(example_filename) if File.exist?(example_filename)
Fix bug in logging of screenshots of failed tests Presumably this was a typo.
diff --git a/spec/ldap-relations/integration_spec.rb b/spec/ldap-relations/integration_spec.rb index abc1234..def5678 100644 --- a/spec/ldap-relations/integration_spec.rb +++ b/spec/ldap-relations/integration_spec.rb @@ -0,0 +1,42 @@+require 'spec_helper' +require 'ldap-relations' + +# Example ActiveRecord style usage for LRel +# +# eg. Directory.where(sAMAccountName: 'test').all +class Directory + def self.where params + new.where(params) + end + + def initialize params={} + self.manager = LRel::RelationManager.new + manager.relations << LRel::Relation.new(objectCategory: 'person') + end + + attr_accessor :manager + + def where params + params.each do |k, v| + manager.relations << LRel::Relation.new("#{k}" => v) + end + self + end + + def all + perform + end + + private + def perform + manager.to_filter + end +end + +describe "integration" do + let(:directory) { Directory.where givenname: 'test' } + + it 'combines the provided the filter with the default' do + directory.all.should == "(&(objectCategory=person)(givenname=test))" + end +end
Add integration spec to test use with an ActiveRecord still interface
diff --git a/spec/routing/market_price_route_spec.rb b/spec/routing/market_price_route_spec.rb index abc1234..def5678 100644 --- a/spec/routing/market_price_route_spec.rb +++ b/spec/routing/market_price_route_spec.rb @@ -0,0 +1,19 @@+require 'spec_helper' + +describe "routing to market_prices" do + it { {:get, "/game/1/market_prices"}.should route_to(:action => :index, + :game => 1, :controller => "market_prices") } + + it { {:get, "/game/1/zone/2/market_prices"}.should route_to(:action => :index, + :game => 1, :zone => 2, :controller => "market_prices") } + + it { {:get, "/game/1/market_price/1"}.should route_to(:action => :show, + :game => 1, :id => 1, :controller => "market_prices") } + + it { {:get, "/game/1/zone/2/market_price/1"}.should route_to(:action => :show, + :game => 1, :zone => 2, :id => 1, :controller => "market_prices") } + + it "does not expose a list of all market_prices" do + {:get => "/market_prices"}.should_not be_routable + end +end
Add market price route specs.
diff --git a/app/controllers/api/committees_controller.rb b/app/controllers/api/committees_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/committees_controller.rb +++ b/app/controllers/api/committees_controller.rb @@ -5,7 +5,7 @@ @committees = Committee.all @committees = @committees.where("lower(name) LIKE ?", @@query) unless @@query.empty? - @committees = @committees.where("lower(name) = ?", name.downcase) if name.present? + @committees = @committees.where("lower(name) LIKE ?", "%#{name.downcase}%") if name.present? @committees = @committees.joins(:committees_councillors).where("councillor_id = ?", councillor_id) if councillor_id.present? paginate json: @committees.order(change_query_order), per_page: change_per_page
Add LIKE To API Committee Name Search Add LIKE instead of API Committee name search because the user should not type in the whole name of what they are looking for.
diff --git a/app/controllers/spree/comments_controller.rb b/app/controllers/spree/comments_controller.rb index abc1234..def5678 100644 --- a/app/controllers/spree/comments_controller.rb +++ b/app/controllers/spree/comments_controller.rb @@ -4,12 +4,11 @@ # Spree::StoreController already has authenticaiton methods # like you can see here # https://github.com/spree/spree/blob/v2.3.1/core/lib/spree/core/controller_helpers/auth.rb#L12 - authorize!(:create, Comment) @comment = Spree::Comment.new(permitted_params) @comment.user = try_spree_current_user # Set the message depending on the state of the .save method @comment.save ? (flash[:success] = t('spree.comment.success')) : (flash[:error] = t('spree.comment.failure')) - redirect_to spree.product_path(@comment.product_id || @comment.commentable.product_id) + redirect_to product_path(@comment.product.slug || @comment.commentable.product.slug) end protected
Remove problematic authorize! & redirect to slug instead of product id
diff --git a/bootstrap-sass.gemspec b/bootstrap-sass.gemspec index abc1234..def5678 100644 --- a/bootstrap-sass.gemspec +++ b/bootstrap-sass.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = "bootstrap-sass" - s.version = '2.0.4.1' + s.version = '2.1.0.0' s.authors = ["Thomas McDonald"] s.email = 'tom@conceptcoding.co.uk' s.summary = "Twitter's Bootstrap, converted to Sass and ready to drop into Rails or Compass"
Bump working version to 2.1.0.0
diff --git a/FTWebViewController.podspec b/FTWebViewController.podspec index abc1234..def5678 100644 --- a/FTWebViewController.podspec +++ b/FTWebViewController.podspec @@ -1,12 +1,16 @@ Pod::Spec.new do |s| s.name = "FTWebViewController" - s.version = "0.0.1" + s.version = "0.0.2" s.summary = "A paginated iOS UIWebView controller with simple interactivity support." s.homepage = "https://github.com/Fingertips/FTWebViewController" - s.license = { :type => 'MIT', :file => 'LICENSE' } - s.author = { "Eloy Durán" => "eloy.de.enige@gmail.com" } - s.source = { :git => "https://github.com/Fingertips/FTWebViewController.git" } - s.platform = :ios, '5.0' + s.license = { type: 'MIT', file: 'LICENSE' } + s.authors = [ + { "Eloy Durán" => "eloy.de.enige@gmail.com" }, + { "Thíjs van der Vossen" => "thijs@fngtps.com" }, + { "Manfred Stienstrá" => "manfred@fngtps.com" } + ] + s.source = { git: "https://github.com/Fingertips/FTWebViewController.git" } + s.platform = :ios, '7.0' s.requires_arc = true s.source_files = 'Source/*.{h,m}' end
Add authors and bump version to 0.0.2.
diff --git a/lib/bmff/box/track.rb b/lib/bmff/box/track.rb index abc1234..def5678 100644 --- a/lib/bmff/box/track.rb +++ b/lib/bmff/box/track.rb @@ -0,0 +1,12 @@+# coding: utf-8 +# vim: set expandtab tabstop=2 shiftwidth=2 softtabstop=2 autoindent: + +class BMFF::Box::Track < BMFF::Box::Base + register_box "trak" + include(BMFF::Box::Container) + + def parse_data + super + parse_children + end +end
Add BMFF::Box::Track class which represents Track Box.
diff --git a/plugins/guests/haiku/cap/change_host_name.rb b/plugins/guests/haiku/cap/change_host_name.rb index abc1234..def5678 100644 --- a/plugins/guests/haiku/cap/change_host_name.rb +++ b/plugins/guests/haiku/cap/change_host_name.rb @@ -11,18 +11,18 @@ # Ensure exit on command error set -e - SYS_CONFIG_DIR=$(finddir B_SYSTEM_SETTINGS_DIRECTORY) + export SYS_SETTINGS_DIR=$(finddir B_SYSTEM_SETTINGS_DIRECTORY) # Set the hostname - echo '#{basename}' > $SYS_CONFIG_DIR/network/hostname + echo '#{basename}' > $SYS_SETTINGS_DIR/network/hostname hostname '#{basename}' # Remove comments and blank lines from /etc/hosts - sed -i'' -e 's/#.*$//' -e '/^$/d' $SYS_CONFIG_DIR/network/hosts + sed -i'' -e 's/#.*$//' -e '/^$/d' $SYS_SETTINGS_DIR/network/hosts - # Prepend ourselves to /etc/hosts - grep -w '#{name}' /etc/hosts || { - sed -i'' '1i 127.0.0.1\\t#{name}\\t#{basename}' $SYS_CONFIG_DIR/network/hosts + # Prepend ourselves to $SYS_SETTINGS_DIR/network/hosts + grep -w '#{name}' $SYS_SETTINGS_DIR/network/hosts || { + sed -i'' '1i 127.0.0.1\\t#{name}\\t#{basename}' $SYS_SETTINGS_DIR/network/hosts } EOH end
plugins/guest: Fix a few typos for Haiku
diff --git a/cookbooks/rs_utils/recipes/setup_hostname.rb b/cookbooks/rs_utils/recipes/setup_hostname.rb index abc1234..def5678 100644 --- a/cookbooks/rs_utils/recipes/setup_hostname.rb +++ b/cookbooks/rs_utils/recipes/setup_hostname.rb @@ -25,6 +25,5 @@ rs_utils_hostname "set_system_hostname" do short_hostname node['rs_utils']['short_hostname'] domain_name node['rs_utils']['domain_name'] - provider "rs_utils_hostname" action :set end
Remove uneeded provider option ref.
diff --git a/lib/tasks/tmp_migrate_hmrc_manuals_rendering_to_government_frontend.rake b/lib/tasks/tmp_migrate_hmrc_manuals_rendering_to_government_frontend.rake index abc1234..def5678 100644 --- a/lib/tasks/tmp_migrate_hmrc_manuals_rendering_to_government_frontend.rake +++ b/lib/tasks/tmp_migrate_hmrc_manuals_rendering_to_government_frontend.rake @@ -0,0 +1,19 @@+# As part of decommissioning manuals-frontend we are moving all previously published +# manuals to government-frontend as the rendering app. As hnmrc-manuals-api has no DB +# itself to update and republish from, we are instead updating the rendering app directly +# in the publishing_api via this temporary Rake task. It will only update editions that are currently +# live in the content-store, drafts will be updated when published from the API. + +desc "Migrate HMRC manuals rendering app to government-frontend" +task tmp_migrate_hmrc_manuals_rendering_to_government_frontend: :environment do + hmrc_manuals = Document.presented.where(editions: { publishing_app: "hmrc-manuals-api" }) + + hmrc_manuals.each do |document| + edition = document.live + + next if edition.blank? + + edition.update!(rendering_app: "government-frontend") + Commands::V2::RepresentDownstream.new.call(document.content_id) + end +end
Add temporary Rake task to migrate hmrc_manuals rendering to goverment-frontend
diff --git a/lib/line/bot/utils.rb b/lib/line/bot/utils.rb index abc1234..def5678 100644 --- a/lib/line/bot/utils.rb +++ b/lib/line/bot/utils.rb @@ -7,7 +7,7 @@ return false unless mids.is_a?(String) || mids.is_a?(Array) mids = [mids] if mids.is_a?(String) - return false unless mids.size > 0 && mids.all? {|item| item.is_a?(String)} + return false unless mids.size > 0 true end
Delete to check `String` in validation for mid
diff --git a/lib/magnum/payload.rb b/lib/magnum/payload.rb index abc1234..def5678 100644 --- a/lib/magnum/payload.rb +++ b/lib/magnum/payload.rb @@ -1,12 +1,10 @@-require 'magnum/payload/version' +require "magnum/payload/version" +require "magnum/payload/errors" module Magnum module Payload SOURCES = %w(custom github gitlab gitslice bitbucket beanstalk) - - class ParseError < StandardError ; end - class PayloadError < StandardError ; end - + autoload :Base, 'magnum/payload/base' autoload :Custom, 'magnum/payload/custom' autoload :Github, 'magnum/payload/github'
Move error classes definitions into separate file
diff --git a/spec/controllers/profiles_controller_spec.rb b/spec/controllers/profiles_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/profiles_controller_spec.rb +++ b/spec/controllers/profiles_controller_spec.rb @@ -8,7 +8,7 @@ context "an user logged in station in demo mode" do before(:each) do - login(Station.make!(:demo => true)) + login(create(:station, :demo => true)) end describe "GET :edit" do
Move profils controller spec to factory_girl.
diff --git a/spec/controllers/sessions_controller_spec.rb b/spec/controllers/sessions_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/sessions_controller_spec.rb +++ b/spec/controllers/sessions_controller_spec.rb @@ -32,14 +32,34 @@ end describe '#create' do - let(:valid_user) { User.create(username: "Jimmy Dean", password: '5au5ag3l1nk')} + let!(:valid_user) { User.create(username: "Jimmy Dean", password: '5au5ag3l1nk')} context 'with valid login credentials' do - post :create, login_form: {:username => "Jimmy Dean", :password => "5au5ag3l1nk"} - expect(response).to have_http_status(:ok) + before(:each) do + post :create, login_form: {:username => "Jimmy Dean", :password => "5au5ag3l1nk"} + end + + it 'accepts the route' do + expect(response).to have_http_status(:redirect) + end + + it 'redirects to the user profile' do + expect(response).to redirect_to(User.last) + end + end context 'with invalid login credentials' do + + it 'renders the form again with empty fields' do + post :create, login_form: {username: "", password: ""} + expect(response).to render_template(:new) + end + + it 'renders the form again with an incorrect password' do + post :create, login_form: {username: "Jimmy Dean", password: "sausagelink"} + expect(response).to render_template(:new) + end end
Test for session controller pass, 100% coverage
diff --git a/spec/system/method_precedence_system_spec.rb b/spec/system/method_precedence_system_spec.rb index abc1234..def5678 100644 --- a/spec/system/method_precedence_system_spec.rb +++ b/spec/system/method_precedence_system_spec.rb @@ -0,0 +1,48 @@+describe "Fortitude method precedence", :type => :system do + it "should have widget methods > need methods > helper methods > tag methods" do + helpers_class = Class.new do + def foo + "helper_foo" + end + + def bar + "helper_bar" + end + + def baz + "helper_baz" + end + + def quux + "helper_quux" + end + end + + helpers_object = helpers_class.new + + wc = widget_class do + tag :foo + tag :bar + tag :baz + tag :quux + + helper :foo, :bar, :baz + + needs :foo => 'need_foo', :bar => 'need_bar' + + def foo + "method foo" + end + + def content + text "foo: #{foo}, " + text "bar: #{bar}, " + text "baz: #{baz}, " + quux + end + end + + expect(render(wc, :rendering_context => rc( + :helpers_object => helpers_object))).to eq("foo: method foo, bar: need_bar, baz: helper_baz, <quux/>") + end +end
Add spec to make sure method precedence works correctly in Fortitude.
diff --git a/lib/mindbody-api/models/visit.rb b/lib/mindbody-api/models/visit.rb index abc1234..def5678 100644 --- a/lib/mindbody-api/models/visit.rb +++ b/lib/mindbody-api/models/visit.rb @@ -12,6 +12,7 @@ attribute :web_signup, Boolean attribute :signed_in, Boolean attribute :make_up, Boolean + attribute :late_cancelled, Boolean attribute :service, ClientService end end
Add late_cancelled field to Visit model
diff --git a/lib/action_web_service/protocol/discovery.rb b/lib/action_web_service/protocol/discovery.rb index abc1234..def5678 100644 --- a/lib/action_web_service/protocol/discovery.rb +++ b/lib/action_web_service/protocol/discovery.rb @@ -4,18 +4,20 @@ def self.included(base) base.extend(ClassMethods) base.send(:include, ActionWebService::Protocol::Discovery::InstanceMethods) + base.send(:class_attribute, :web_service_protocols) + base.send(:web_service_protocols=, []) end module ClassMethods # :nodoc: def register_protocol(klass) - write_inheritable_array("web_service_protocols", [klass]) + self.web_service_protocols += [klass] end end module InstanceMethods # :nodoc: private def discover_web_service_request(action_pack_request) - (self.class.read_inheritable_attribute("web_service_protocols") || []).each do |protocol| + (self.class.web_service_protocols || []).each do |protocol| protocol = protocol.create(self) request = protocol.decode_action_pack_request(action_pack_request) return request unless request.nil?
Make web_service_protocols an class attribute
diff --git a/config/requirements.rb b/config/requirements.rb index abc1234..def5678 100644 --- a/config/requirements.rb +++ b/config/requirements.rb @@ -2,7 +2,7 @@ include FileUtils require 'rubygems' -%w[rake hoe newgem rubigen].each do |req_gem| +%w[hanna/rdoctask rake hoe newgem rubigen].each do |req_gem| begin require req_gem rescue LoadError
Use the hanna rdoc template
diff --git a/lib/puppet/util/network_device/pure/facts.rb b/lib/puppet/util/network_device/pure/facts.rb index abc1234..def5678 100644 --- a/lib/puppet/util/network_device/pure/facts.rb +++ b/lib/puppet/util/network_device/pure/facts.rb @@ -11,10 +11,10 @@ def retrieve Puppet.debug("Fetching facts from Pure Array") array_info = @transport.getRestCall('/array') - Puppet.debug("Returned array info = #{array_info.inspect}") + Puppet.debug("Returned array info: #{array_info.inspect}") controller_info = @transport.getRestCall('/array?controllers=true') - Puppet.debug("Returned controller info =#{controller_info.inspect}") + Puppet.debug("Returned controller info: #{controller_info.inspect}") @facts = {} @facts['array_name'] = array_info[:array_name]
Format tweak on Debug logging
diff --git a/lib/suspenders/generators/views_generator.rb b/lib/suspenders/generators/views_generator.rb index abc1234..def5678 100644 --- a/lib/suspenders/generators/views_generator.rb +++ b/lib/suspenders/generators/views_generator.rb @@ -36,6 +36,7 @@ end def create_application_layout + remove_file "app/views/layouts/application.html.erb" template "suspenders_layout.html.slim", "app/views/layouts/application.html.slim", force: true
Remove application.html.erb, we use slim
diff --git a/app/models/photo_request.rb b/app/models/photo_request.rb index abc1234..def5678 100644 --- a/app/models/photo_request.rb +++ b/app/models/photo_request.rb @@ -32,7 +32,13 @@ end def presigned_post - AWS::S3::PresignedPost.new(bucket, :key => key, :secure => false) + AWS::S3::PresignedPost.new( + bucket, + :key => key, + :secure => false, + :content_type => "image/jpeg", + :acl => "public-read" + ) end def form_fields
Set the content type and ACL
diff --git a/app/decorators/optional_module_decorator.rb b/app/decorators/optional_module_decorator.rb index abc1234..def5678 100644 --- a/app/decorators/optional_module_decorator.rb +++ b/app/decorators/optional_module_decorator.rb @@ -10,7 +10,7 @@ color = model.enabled? ? 'green' : 'red' arbre do - status_tag(I18n.t("online.#{model.enabled}"), color) + status_tag(I18n.t("enabled.#{model.enabled}"), color) end end end
Update translation for enabled/disabled OptionalModules
diff --git a/app/uploaders/shoppe/attachment_uploader.rb b/app/uploaders/shoppe/attachment_uploader.rb index abc1234..def5678 100644 --- a/app/uploaders/shoppe/attachment_uploader.rb +++ b/app/uploaders/shoppe/attachment_uploader.rb @@ -37,6 +37,8 @@ def watermark return unless file.content_type.include? 'image' + return unless File.readable?("#{Rails.root}/public/watermark.png") + manipulate! do |img| mark = MiniMagick::Image.open("#{Rails.root}/public/watermark.png") img = img.composite(mark) do |c|
Watermark applyes only if watermark file presents
diff --git a/test/obix_test.rb b/test/obix_test.rb index abc1234..def5678 100644 --- a/test/obix_test.rb +++ b/test/obix_test.rb @@ -0,0 +1,36 @@+require "obix" +require "minitest/unit" +require "minitest/autorun" +require "active_support/all" + +require "test_helper" + +class OBIXTest < MiniTest::Unit::TestCase + def test_parses_from_string + xml = fixture "thermostat.xml" + + object = OBIX.parse string: xml + + assert_instance_of OBIX::Objects::Object, object + end + + def test_parses_from_url + xml = fixture "thermostat.xml" + + Net::HTTP.get.stubs(:get).returns(xml) + + object = OBIX.parse url: "http://domain/thermostat" + + assert_instance_of OBIX::Objects::Object, object + end + + def test_parses_from_url + xml = fixture "thermostat.xml" + + File.stubs(:read).returns(xml) + + object = OBIX.parse file: "thermostat.xml" + + assert_instance_of OBIX::Objects::Object, object + end +end
Add tests for OBIX module
diff --git a/activejob/test/cases/timezones_test.rb b/activejob/test/cases/timezones_test.rb index abc1234..def5678 100644 --- a/activejob/test/cases/timezones_test.rb +++ b/activejob/test/cases/timezones_test.rb @@ -32,5 +32,7 @@ end assert_equal "Happy New Year!", JobBuffer.last_value + ensure + Time.zone = nil end end
Reset Time.zone to avoid leaking into other tests https://buildkite.com/rails/rails/builds/72478#93358e11-6e26-4588-a791-26f9512157c2/1074-1087 https://buildkite.com/rails/rails/builds/72747#10657eba-2359-47ca-9914-49a48b3f2d3c/967-976 https://buildkite.com/rails/rails/builds/72795#3f4bff27-3f42-4678-b643-08cc811c8954/999-1012
diff --git a/spec/controllers/contacts_controller_spec.rb b/spec/controllers/contacts_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/contacts_controller_spec.rb +++ b/spec/controllers/contacts_controller_spec.rb @@ -0,0 +1,59 @@+require 'spec_helper' + +describe ContactsController do + describe 'GET #index' do + context 'with params[:letter]' do + it "populates an array of contacts starting with the letter" + it "render the :index template" + end + + context 'without params[:letter' do + it "populates an array of all contacts" + it "renders the :index template" + end + end + + describe 'GET #show' do + it "assigns the requested contact to @contact" + it "renders the :show template" + end + + describe 'GET #new' do + it "assigns a new Contact to @contact" + it "renders the :new template" + end + + describe 'GET #edit' do + it "assigns the requested contact to @contact" + it "renders the :edit template" + end + + describe 'POST #create' do + context 'with valid attributes' do + it "saves the new contact in the database" + it "redirects to contacts#show" + end + + context 'with invalid attributes' do + it "does not save the new contact in the database" + it "re-renders the :new template" + end + end + + describe 'PATCH #update' do + context 'with valid attributes' do + it "updates the contact in the database" + it "redirects to the contact" + end + + context 'without valid attributes' do + it "does not update the contact in the database" + it "re-renders the #edit template" + end + end + + describe 'DELETE #destroy' do + it "deletes the contact from the database" + it "redirects to users#index" + end +end
Add ContactsController spec - 05_controller_basics Rspec tests outlined for ContactsController but not yet implemented. Specs organized to flesh out the expectation for happy path and unhappy path.
diff --git a/app/controllers/hr/users_controller.rb b/app/controllers/hr/users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/hr/users_controller.rb +++ b/app/controllers/hr/users_controller.rb @@ -22,11 +22,11 @@ def get_user @user = User.find(params[:id]) - authorize @user, :edit? + authorize [:hr, @user] end def user_params - params.require(:user).permit(:employee_number) + params.require(:user).permit(:name, :employee_number) end end
Allow HR to change name, fix user authorisation
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 @@ -1,7 +1,7 @@ class SessionsController < Devise::SessionsController def destroy - current_user.is_logged_in = false + current_user.is_logged_in = false if current_user super end end
Make sure we have a valid session before trying to log the user out.
diff --git a/config/deploy/production.rb b/config/deploy/production.rb index abc1234..def5678 100644 --- a/config/deploy/production.rb +++ b/config/deploy/production.rb @@ -10,17 +10,12 @@ server "50.57.155.246", :web, :app, :db, :primary => true, :memcached => true -before 'uploads:symlink', 'uploads:create_shared' namespace :uploads do desc "Symlink the uploads directory to the shared uploads directory." task :symlink do + run "mkdir -p #{shared_path}/imagebank/originals; chmod -R 775 #{shared_path}/imagebank" run "rm -rf #{release_path}/public/images/uploads" - run "ln -fs #{shared_path}/images/uploads #{current_release}/public/images/" - end - - desc "Create the shared image uploads directory if it doesn't exist, and set the correct permissions." - task :create_shared do - run "mkdir -p #{shared_path}/images/uploads/originals; chmod -R 777 #{shared_path}/images/uploads" + run "ln -fs #{shared_path}/imagebank #{current_release}/public/images/uploads" end end
Change the image upload symlinking behavior.
diff --git a/app/mailers/woodlock_welcome_mailer.rb b/app/mailers/woodlock_welcome_mailer.rb index abc1234..def5678 100644 --- a/app/mailers/woodlock_welcome_mailer.rb +++ b/app/mailers/woodlock_welcome_mailer.rb @@ -8,6 +8,6 @@ @greeting = "Hi #{user.first_name}! Thanks for registering with #{provider_name}." - mail to: user.email, subject: "#{provider_name} registration success" + mail to: user.email, subject: "Apiflat registration success" end end
Change Google and Facebook registration mailer subject
diff --git a/has_breadcrumb.gemspec b/has_breadcrumb.gemspec index abc1234..def5678 100644 --- a/has_breadcrumb.gemspec +++ b/has_breadcrumb.gemspec @@ -8,9 +8,9 @@ gem.version = HasBreadcrumb::VERSION gem.authors = ["Tim Harvey", "Matt Outten"] gem.email = ["developers@squaremouth.com"] - gem.description = %q{Provide breadcrumb links.} - gem.summary = %q{Provide links for the current page in a breadcrumb format.} - gem.homepage = "" + gem.description = %q{Provides a simple and flexible way to create breadcrumbs with Rails active record models.} + gem.summary = %q{Setting has_breadcrumb on a model will enable a view method, breadcrumb(), which will show the links to the page and its parents in a breadcrumb format.} + gem.homepage = "https://github.com/sqm/has_breadcrumb" gem.files = `git ls-files`.split($/) gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } @@ -20,6 +20,6 @@ gem.add_dependency 'activerecord', ['>= 3.0', '< 5.0'] gem.add_dependency 'activesupport', ['>= 3.0', '< 5.0'] - gem.add_development_dependency 'rspec-rails' - gem.add_development_dependency 'sqlite3' + gem.add_development_dependency 'rspec-rails', '~> 2.13' + gem.add_development_dependency 'sqlite3', '~> 1.3' end
Add gem dependencies and meta info to gemspec This commit adds semantic versions to the rails-spec and sqlite3 gems. Also added was a home page pointed to the gem source code hosted at Github.com. Lastly, the description and summary was improved to be more descriptive of the gem and what it does. This commit was in response to warnings encountered during the gem build process.
diff --git a/brain/spec/lib/humanity_neuron_spec.rb b/brain/spec/lib/humanity_neuron_spec.rb index abc1234..def5678 100644 --- a/brain/spec/lib/humanity_neuron_spec.rb +++ b/brain/spec/lib/humanity_neuron_spec.rb @@ -12,7 +12,7 @@ ['Hi', 'Why hello there!'], ['hi', 'Why hello there!'], ['Hi Adam', 'Why hello there!'] - ].each do |message_body, confidence, response| + ].each do |message_body, response| it { should handle_message(message_body).with_confidence(1).and_respond_with(response) } end end
[BRAIN] Fix a bug in assertions
diff --git a/app/api/better_doctor/error_formatter.rb b/app/api/better_doctor/error_formatter.rb index abc1234..def5678 100644 --- a/app/api/better_doctor/error_formatter.rb +++ b/app/api/better_doctor/error_formatter.rb @@ -0,0 +1,16 @@+module BetterDoctor + module ErrorFormatter + + # ----------------------------------------------------------------------- # + # Error Formatter # + # ----------------------------------------------------------------------- # + + def self.call(message, backtrace, options, env) + { + :response_type => 'error', + :response => message + }.to_json + end + + end +end
Implement base API error formatter
diff --git a/app/controllers/admin/base_controller.rb b/app/controllers/admin/base_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/base_controller.rb +++ b/app/controllers/admin/base_controller.rb @@ -1,16 +1,23 @@-class Admin::BaseController < ApplicationController - inherit_resources - before_filter do - authorize! :access, :admin +module Admin + def self.policy_class + AdminPolicy end - def update - update! do |format| - if resource.errors.empty? - format.json { respond_with_bip(resource) } - else - format.html { render action: "edit" } - format.json { respond_with_bip(resource) } + class BaseController < ApplicationController + inherit_resources + + before_filter do + authorize Admin, :access? + end + + def update + update! do |format| + if resource.errors.empty? + format.json { respond_with_bip(resource) } + else + format.html { render action: 'edit' } + format.json { respond_with_bip(resource) } + end end end end
Use admin policy class on admin
diff --git a/app/controllers/v2/actions_controller.rb b/app/controllers/v2/actions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/v2/actions_controller.rb +++ b/app/controllers/v2/actions_controller.rb @@ -4,7 +4,9 @@ TimedFeature.check!(owner: "Tijmen", expires: "2017-04-22") actions = Action + .order("created_at DESC") .where(content_id: params[:content_id]) + .limit(100) .as_json(only: %i[action user_uid created_at]) render json: actions
Return at most 100 items in the actions This is to prevent super-large payloads.
diff --git a/app/views/campaigns/alerts.json.jbuilder b/app/views/campaigns/alerts.json.jbuilder index abc1234..def5678 100644 --- a/app/views/campaigns/alerts.json.jbuilder +++ b/app/views/campaigns/alerts.json.jbuilder @@ -1,6 +1,6 @@ # frozen_string_literal: true -json.alerts @campaign.public_alerts do |alert| +json.alerts @campaign.public_alerts.includes(:course, :user, article: :wiki) do |alert| json.id alert.id json.type alert.type json.created_at alert.created_at
Fix N+1 queries on campaign alerts
diff --git a/lib/liftoff/dependency_managers/carthage.rb b/lib/liftoff/dependency_managers/carthage.rb index abc1234..def5678 100644 --- a/lib/liftoff/dependency_managers/carthage.rb +++ b/lib/liftoff/dependency_managers/carthage.rb @@ -18,7 +18,7 @@ [ { "file" => "copy_frameworks.sh", - "name" => "Copy framworks (Carthage)", + "name" => "Copy frameworks (Carthage)", } ] end
Fix "framworks" typo in Carthage copy phase.
diff --git a/lib/pushing/adapters/fcm/andpush_adapter.rb b/lib/pushing/adapters/fcm/andpush_adapter.rb index abc1234..def5678 100644 --- a/lib/pushing/adapters/fcm/andpush_adapter.rb +++ b/lib/pushing/adapters/fcm/andpush_adapter.rb @@ -13,7 +13,9 @@ def push!(notification) FcmResponse.new(self.class.client(@server_key).push(notification.payload)) rescue => e - raise Pushing::FcmDeliveryError.new("Error while trying to send push notification: #{e.message}", FcmResponse.new(e.response)) + response = e.respond_to?(:response) ? FcmResponse.new(e.response) : nil + + raise Pushing::FcmDeliveryError.new("Error while trying to send push notification: #{e.message}", response) end @@semaphore = Mutex.new
Make sure to not create a response wrapepr object if not present If the exception is a conneciton error (e.g. Timeout, SSL error), the response object ends up being nil and it doesn't make sense to wrap a nil object. In case of network/connection error, just skip wrapping it so we can save work and things will be less buggy.
diff --git a/Casks/earlybird.rb b/Casks/earlybird.rb index abc1234..def5678 100644 --- a/Casks/earlybird.rb +++ b/Casks/earlybird.rb @@ -7,6 +7,7 @@ name 'Thunderbird Nightly' homepage 'https://www.mozilla.org/en-US/thunderbird/channel/' license :mpl + tags :vendor => 'Mozilla' app 'Earlybird.app' end
Add tags stanza to Earlybird
diff --git a/lib/action_profiler.rb b/lib/action_profiler.rb index abc1234..def5678 100644 --- a/lib/action_profiler.rb +++ b/lib/action_profiler.rb @@ -3,7 +3,7 @@ module ActionController module ActionProfiler - MODES = Set.new(%w(process_time wall_time cpu_time allocated_objects memory)) + MODES = Set.new(%w(process_time wall_time cpu_time allocations memory gc_runs gc_time)) # Pass profile=1 query param to profile the page load. def action_profiler(&block)
Update available profile modes for current ruby-prof
diff --git a/lib/database_config.rb b/lib/database_config.rb index abc1234..def5678 100644 --- a/lib/database_config.rb +++ b/lib/database_config.rb @@ -13,7 +13,8 @@ { host: config["host"], database: config["database"], username: config["username"], - password: config["password"] + password: config["password"], + reconnect: true } end end
Reconnect to the database server if the connection goes away.
diff --git a/lib/dawanda/request.rb b/lib/dawanda/request.rb index abc1234..def5678 100644 --- a/lib/dawanda/request.rb +++ b/lib/dawanda/request.rb @@ -13,12 +13,11 @@ # Perform a GET request for the resource with optional parameters - returns # A Response object with the payload data + # def self.get(resource_path, parameters = {}) parameters = {:format => 'json'}.update(parameters) request = Request.new(resource_path, parameters) - puts request.inspect - response = Response.new(request.get) - response + Response.new(request.get) end # Create a new request for the resource with optional parameters @@ -30,7 +29,13 @@ # Perform a GET request against the API endpoint and return the raw # response data def get - Net::HTTP.get(endpoint_uri) + response = Net::HTTP.get_response(endpoint_uri) + case response + when Net::HTTPSuccess, Net::HTTPRedirection + return response.body + else + raise response.body + end end def parameters # :nodoc:
Raise exception if HTTP status is not successful
diff --git a/lib/helios/listener.rb b/lib/helios/listener.rb index abc1234..def5678 100644 --- a/lib/helios/listener.rb +++ b/lib/helios/listener.rb @@ -5,6 +5,7 @@ end def listen! + puts "Beginning polling..." @aws.queues.named('helios').poll do |message| begin puts "Received message:"
Add message to indicate polling has begun
diff --git a/lib/honyomi/web/app.rb b/lib/honyomi/web/app.rb index abc1234..def5678 100644 --- a/lib/honyomi/web/app.rb +++ b/lib/honyomi/web/app.rb @@ -16,7 +16,7 @@ results = @database.search(@params[:query]) page_entries = results.paginate([["_score", :desc]], :page => 1, :size => 20) - snippet = GrnMini::Util::html_snippet_from_selection_results(results) + snippet = results.expression.snippet([["<strong>", "</strong>"]], {html_escape: true, normalize: true, max_results: 10}) r = page_entries.map do |page| <<EOF
Change snippet max_results: 3 -> 10
diff --git a/lib/omnibus/logging.rb b/lib/omnibus/logging.rb index abc1234..def5678 100644 --- a/lib/omnibus/logging.rb +++ b/lib/omnibus/logging.rb @@ -17,18 +17,43 @@ module Omnibus module Logging def self.included(base) - base.send(:include, Methods) - base.send(:extend, Methods) + base.send(:include, InstanceMethods) + base.send(:extend, ClassMethods) end - module Methods + module ClassMethods + private + # # A helpful DSL method for logging an action. # # @return [Logger] # def log - Omnibus.log + Omnibus.logger + end + + # + # The key to log with. + # + # @return [String] + # + def log_key + @log_key ||= name.split('::')[1..-1].join('::') + end + end + + module InstanceMethods + private + + # @see (ClassMethods#log) + def log + self.class.send(:log) + end + + # @see (ClassMethods#log_key) + def log_key + self.class.send(:log_key) end end end
Update Logger mixin to add a log_key method
diff --git a/lib/table_for/table.rb b/lib/table_for/table.rb index abc1234..def5678 100644 --- a/lib/table_for/table.rb +++ b/lib/table_for/table.rb @@ -13,7 +13,7 @@ def render builder = TableBuilder.new(self) - body = if block_given? then capture(builder, &block) else builder end + body = if block then capture(builder, &block) else builder end content_tag(:table, caption + body, :class => css_class) end @@ -36,4 +36,4 @@ model_class.model_name.human.pluralize end end -end+end
Fix incorrect usage of block_given?
diff --git a/lib/rubygems_plugin.rb b/lib/rubygems_plugin.rb index abc1234..def5678 100644 --- a/lib/rubygems_plugin.rb +++ b/lib/rubygems_plugin.rb @@ -1,5 +1,11 @@-require 'rubygems' +Gem.post_install do |gem| -Gem.post_install do - puts 'this is a test' + spec = gem.spec + files = spec.files - spec.test_files - spec.extra_rdoc_files + + files.each do |file| + next unless file.match /\.rb$/ + puts "Compiling #{file} to #{file}o" + end + end
Add code to find the files that need to be compiled The trick now is going to be getting the correct path.
diff --git a/lib/rubygems_plugin.rb b/lib/rubygems_plugin.rb index abc1234..def5678 100644 --- a/lib/rubygems_plugin.rb +++ b/lib/rubygems_plugin.rb @@ -1,7 +1,7 @@ require 'rubygems' Gem.post_install do |installer| - clone_dir = "#{installer.gem_dir}/src" + clone_dir = ENV['GEMSRC_CLONE_ROOT'] ? "#{ENV['GEMSRC_CLONE_ROOT']}/#{installer.spec.name}" : "#{installer.gem_dir}/src" if (repo = installer.spec.homepage) && !repo.empty? && !File.exists?(clone_dir) if repo =~ /\Ahttps?:\/\/([^.]+)\.github.com\/(.+)/
Enable to set root directory to clone gems with an environment var
diff --git a/lib/tasks/testing.rake b/lib/tasks/testing.rake index abc1234..def5678 100644 --- a/lib/tasks/testing.rake +++ b/lib/tasks/testing.rake @@ -2,7 +2,7 @@ begin require 'rspec/core/rake_task' task(:spec).clear - RSpec::Core::RakeTask.new(:spec) do |t| + RSpec::Core::RakeTask.new(:spec => 'db:test:prepare') do |t| t.verbose = false end rescue LoadError
Make "rake" depend on "rake db:test:prepare". This also tests for pending migrations.
diff --git a/lib/same_boat/crews.rb b/lib/same_boat/crews.rb index abc1234..def5678 100644 --- a/lib/same_boat/crews.rb +++ b/lib/same_boat/crews.rb @@ -1,6 +1,6 @@ module SameBoat class Crews - def initialize(crews, journal_path:) + def initialize(crews, journal_path: SameBoat::DEFAULT_JOURNAL) @crews, @journal_path = crews, journal_path end
Add default value for keyword argument
diff --git a/license_finder.gemspec b/license_finder.gemspec index abc1234..def5678 100644 --- a/license_finder.gemspec +++ b/license_finder.gemspec @@ -15,6 +15,7 @@ s.rubyforge_project = "license_finder" s.add_development_dependency 'rspec', '~>2.3' s.add_development_dependency 'rr' + s.add_development_dependency 'rake' s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
Add rake to development dependencies
diff --git a/db/migrate/20120723144115_add_render_as_partial_for_layout_for_spree_pages.rb b/db/migrate/20120723144115_add_render_as_partial_for_layout_for_spree_pages.rb index abc1234..def5678 100644 --- a/db/migrate/20120723144115_add_render_as_partial_for_layout_for_spree_pages.rb +++ b/db/migrate/20120723144115_add_render_as_partial_for_layout_for_spree_pages.rb @@ -0,0 +1,13 @@+class AddRenderAsPartialForLayoutForSpreePages < ActiveRecord::Migration + def up + unless column_exists? :spree_pages, :render_layout_as_partial + add_column :spree_pages, :render_layout_as_partial, :boolean, :default => false + end + end + + def down + if column_exists? :spree_pages, :render_layout_as_partial + remove_column :spree_pages, :render_layout_as_partial + end + end +end
Add migration for render_as_partial_for_layout toggle
diff --git a/core/spec/models/spree/line_item_spec.rb b/core/spec/models/spree/line_item_spec.rb index abc1234..def5678 100644 --- a/core/spec/models/spree/line_item_spec.rb +++ b/core/spec/models/spree/line_item_spec.rb @@ -49,3 +49,4 @@ end end end +
Remove all references to on_hand
diff --git a/link_to_action.gemspec b/link_to_action.gemspec index abc1234..def5678 100644 --- a/link_to_action.gemspec +++ b/link_to_action.gemspec @@ -19,4 +19,5 @@ s.add_development_dependency "rails", "~> 3.2.8" s.add_development_dependency "sqlite3" s.add_development_dependency "simplecov" + s.add_development_dependency "debugger" end
Add debugger as development dependency.
diff --git a/spec/helpers/home_helper_spec.rb b/spec/helpers/home_helper_spec.rb index abc1234..def5678 100644 --- a/spec/helpers/home_helper_spec.rb +++ b/spec/helpers/home_helper_spec.rb @@ -8,25 +8,30 @@ subject { HomeClass.new } describe "#get_completed_test_runs" do - let(:time1) { Time.new(2012,12,21,5,12,21) } - let(:time2) { Time.new(2012,12,21,1,12,21) } - let(:time3) { Time.new(2012,12,22,1,12,22) } - let(:tr1) { FactoryGirl.create :test_run, completed_at: time1, state: "complete" } - let(:tr2) { FactoryGirl.create :test_run, completed_at: time2, state: "complete" } - let(:tr3) { FactoryGirl.create :test_run, completed_at: time3, state: "complete_with_errors" } before do - @tr1 = FactoryGirl.create :test_run, completed_at: time1, state: "complete" - @tr2 = FactoryGirl.create :test_run, completed_at: time2, state: "complete" - @tr3 = FactoryGirl.create :test_run, completed_at: time3, state: "complete" - @ability = Object.new - @ability.extend(CanCan::Ability) - subject.stub(:current_ability) { @ability } + ability = Object.new + ability.extend(CanCan::Ability) + ability.can :read, TestRun + subject.stub(:current_ability) { ability } + + [ + Time.new(2012,12,21,5,12,21), + Time.new(2012,12,21,1,12,21), + Time.new(2012,12,22,1,12,22), + ].each { |time| FactoryGirl.create :test_run, completed_at: time, state: "complete" } end + it "should return the proper data structure" do - @ability.can :read, TestRun - subject.get_completed_test_runs.should == [{key: "Completed Successfully", - values: [["2012-12-21", 2], ["2012-12-22", 1]] }].to_json + subject.get_completed_test_runs.should == [ + { + key: "Completed Successfully", + values: [ + ["2012-12-21", 2], + ["2012-12-22", 1], + ] + } + ].to_json end end end -end+end
Refactor the mess out of a test
diff --git a/spec/routing/calculators_spec.rb b/spec/routing/calculators_spec.rb index abc1234..def5678 100644 --- a/spec/routing/calculators_spec.rb +++ b/spec/routing/calculators_spec.rb @@ -0,0 +1,6 @@+RSpec.describe 'Calculator routing', type: :routing do + it 'routes /take-whole-pot/estimate to calculators/take_whole_pot#show' do + expect(get('/take-whole-pot/estimate')) + .to route_to(controller: 'calculators/take_whole_pot', action: 'show') + end +end
Add routing spec for calculators
diff --git a/spec/support/test_environment.rb b/spec/support/test_environment.rb index abc1234..def5678 100644 --- a/spec/support/test_environment.rb +++ b/spec/support/test_environment.rb @@ -9,7 +9,6 @@ end require "action_controller/railtie" -require "active_resource/railtie" require 'active_model' # Create a simple rails application for use in testing the viewhelper
Remove active resource require because we are not using it
diff --git a/TSMessages.podspec b/TSMessages.podspec index abc1234..def5678 100644 --- a/TSMessages.podspec +++ b/TSMessages.podspec @@ -14,7 +14,7 @@ s.author = { "Felix Krause" => "krausefx@gmail.com" } - s.source = { :git => "https://github.com/toursprung/TSMessages.git" :tag => "0.9.4"} + s.source = { :git => "https://github.com/toursprung/TSMessages.git", :tag => "#{spec.version}"} s.platform = :ios, '5.0'
Fix syntax error in podspec.
diff --git a/lib/geocoder/lookups/ovi.rb b/lib/geocoder/lookups/ovi.rb index abc1234..def5678 100644 --- a/lib/geocoder/lookups/ovi.rb +++ b/lib/geocoder/lookups/ovi.rb @@ -13,7 +13,7 @@ end def query_url(query) - "#{protocol}://lbs.ovi.com/search/6.2/geocode.json?" + url_query_string(query) + "#{protocol}://lbs.ovi.com/search/6.2/#{if query.reverse_geocode? then 'reverse' end}geocode.json?" + url_query_string(query) end private # --------------------------------------------------------------- @@ -29,12 +29,22 @@ end def query_url_params(query) - super.merge( - :searchtext=>query.sanitized_text, + options = { :gen=>1, :app_id=>api_key, :app_code=>api_code - ) + } + + if query.reverse_geocode? + super.merge(options).merge( + :prox=>query.sanitized_text, + :mode=>:retrieveAddresses + ) + else + super.merge(options).merge( + :searchtext=>query.sanitized_text, + ) + end end def api_key
Add reversed geocoding support for Ovi/Nokia
diff --git a/lib/git_hooks/checkstyle.rb b/lib/git_hooks/checkstyle.rb index abc1234..def5678 100644 --- a/lib/git_hooks/checkstyle.rb +++ b/lib/git_hooks/checkstyle.rb @@ -30,7 +30,7 @@ violations['files'] ||= [] file_violation = { - 'path' => fix_path(file[:name]), + 'path' => fix_path(file.attributes['name']), 'offenses' => [] } @@ -38,11 +38,11 @@ file.elements.each('error') do |error| file_violation['offenses'] << { - 'severity' => error[:severity], - 'message' => error[:message], + 'severity' => error.attributes['severity'], + 'message' => error.attributes['message'], 'location' => { - 'line' => error[:line].to_i, - 'column' => error[:column].to_i + 'line' => error.attributes['line'].to_i, + 'column' => error.attributes['column'].to_i } } end
Use the pre-Ruby 2.4 method for element attribute access for backwards compatibility.
diff --git a/lib/jmespath/nodes/index.rb b/lib/jmespath/nodes/index.rb index abc1234..def5678 100644 --- a/lib/jmespath/nodes/index.rb +++ b/lib/jmespath/nodes/index.rb @@ -13,6 +13,40 @@ nil end end + + def chains_with?(other) + other.is_a?(Index) + end + + def chain(other) + ChainedIndex.new([*indexes, *other.indexes]) + end + + protected + + def indexes + [@index] + end + end + + class ChainedIndex < Index + def initialize(indexes) + @indexes = indexes + end + + def visit(value) + @indexes.reduce(value) do |v, index| + if Array === v + v[index] + else + nil + end + end + end + + private + + attr_reader :indexes end end end
Optimize runs of Index to ChainIndex
diff --git a/lib/kekomi/content_types.rb b/lib/kekomi/content_types.rb index abc1234..def5678 100644 --- a/lib/kekomi/content_types.rb +++ b/lib/kekomi/content_types.rb @@ -23,6 +23,7 @@ klass.class_eval &block klass.before_save :serialize_fields klass.validates_presence_of klass.represented_with unless klass.represented_with.nil? + klass.defined if klass.respond_to? :defined Store.instance.content_types << klass unless Store.instance.content_types.map(&:to_s).include? klass.to_s klass end
Add defined hook when content type is created
diff --git a/lib/openlogi/base_object.rb b/lib/openlogi/base_object.rb index abc1234..def5678 100644 --- a/lib/openlogi/base_object.rb +++ b/lib/openlogi/base_object.rb @@ -18,9 +18,9 @@ super(@attributes, &block) end - property :error + property :error, coerce: String property :errors, coerce: Openlogi::Errors - property :error_description + property :error_description, coerce: String def valid? error.nil? && (errors.nil? || errors.empty?)
Add missing coercions to error-related properties on base object
diff --git a/lib/daimon_skycrawlers/url_consumer.rb b/lib/daimon_skycrawlers/url_consumer.rb index abc1234..def5678 100644 --- a/lib/daimon_skycrawlers/url_consumer.rb +++ b/lib/daimon_skycrawlers/url_consumer.rb @@ -22,6 +22,7 @@ def process(message) url = message[:url] + # XXX When several crawlers are registed, how should they behave? self.class.crawlers.each do |crawler| crawler.fetch(url) end
Add comment for unresolved behavior I don't know now.
diff --git a/lib/shell/build-protobox.rb b/lib/shell/build-protobox.rb index abc1234..def5678 100644 --- a/lib/shell/build-protobox.rb +++ b/lib/shell/build-protobox.rb @@ -2,10 +2,10 @@ ansible_version_file = protobox_dir + '/ansible_version' # Ansible version - ansible_version = '1.6.8' - #if !yaml['protobox'].nil? and !yaml['protobox']['ansible'].nil? and !yaml['protobox']['ansible']['version'].nil? - # ansible_version = yaml['protobox']['ansible']['version'].to_s - #end + ansible_version = 'latest' + if !yaml['protobox'].nil? and !yaml['protobox']['ansible'].nil? and !yaml['protobox']['ansible']['version'].nil? + ansible_version = yaml['protobox']['ansible']['version'].to_s + end # Dump out the contents File.open(ansible_version_file, "w") do |f|
Move ansible version back to latest since release of 1.7
diff --git a/lib/tasks/tag_from_csv.rake b/lib/tasks/tag_from_csv.rake index abc1234..def5678 100644 --- a/lib/tasks/tag_from_csv.rake +++ b/lib/tasks/tag_from_csv.rake @@ -0,0 +1,6 @@+desc "Perform taggings from a csv file" +task :tag_from_csv, [:csv_url] => :environment do |_, args| + Tagging::CsvTagger.do_tagging(args[:csv_url]) do |tagging| + puts "Tagging #{tagging[:content_id]} to [#{tagging[:taxon_ids].join(',')}]" + end +end
Add rake task to tag content from a remote CSV file
diff --git a/lib/yard/generators/class_generator.rb b/lib/yard/generators/class_generator.rb index abc1234..def5678 100644 --- a/lib/yard/generators/class_generator.rb +++ b/lib/yard/generators/class_generator.rb @@ -10,7 +10,10 @@ DocstringGenerator, AttributesGenerator, ConstantsGenerator, - ConstructorGenerator + ConstructorGenerator, + MethodSummaryGenerator.new(options, :ignore_serializer => true, + :scope => :instance, :visibility => :public + ) ] ] end
Add public instance method summary view to class generator
diff --git a/lib/cucumber/events/test_run_finished.rb b/lib/cucumber/events/test_run_finished.rb index abc1234..def5678 100644 --- a/lib/cucumber/events/test_run_finished.rb +++ b/lib/cucumber/events/test_run_finished.rb @@ -3,8 +3,9 @@ module Cucumber module Events - # Event fired after aall test cases have finished executing - TestRunFinished = Class.new(Core::Event.new) + # Event fired after all test cases have finished executing + class TestRunFinished < Core::Event.new + end end end
Make event parsable by yardoc
diff --git a/app/models/post.rb b/app/models/post.rb index abc1234..def5678 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -1,3 +1,12 @@ class Post < ActiveRecord::Base belongs_to :author, class_name: :user, foreign_key: :author_id + scope :ordered, :order => "created_at DESC" + + def self.published + Post.where(is_published: true) + end + + def self.unpublished + Post.where(is_published: false) + end end
Add published and unpublished functions
diff --git a/lib/intrinsic/intrinsicism/validation.rb b/lib/intrinsic/intrinsicism/validation.rb index abc1234..def5678 100644 --- a/lib/intrinsic/intrinsicism/validation.rb +++ b/lib/intrinsic/intrinsicism/validation.rb @@ -24,6 +24,9 @@ private def validate(property, validator) + begin + rescue + end end def check_for_property(property)
Make begin, rescue, end blocks
diff --git a/app/models/stop.rb b/app/models/stop.rb index abc1234..def5678 100644 --- a/app/models/stop.rb +++ b/app/models/stop.rb @@ -24,6 +24,6 @@ def self.find_legacy(id) # This is to support the case where a user has a favorite saved from # before the switch to postres generated ids - Stop.where(id: id).first || Stop.find_by(remote_id: id) + Stop.where(id: id).first || Stop.find_by!(remote_id: id) end end
Raise an RecordNotFound error on Stop.find_legacy