diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/app/controllers/map_controller.rb b/app/controllers/map_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/map_controller.rb
+++ b/app/controllers/map_controller.rb
@@ -1,6 +1,6 @@ class MapController < ApplicationController
def index
- @current_trends = Trend.most_popular
+ @current_trends = Trend.most_popular(30)
@mapped_trend = @current_trends.first
end
|
Change trend count on page to 30 instead of 10
|
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1,4 +1,10 @@ module ApplicationHelper
+ class MarkdownHTML < Redcarpet::Render::HTML
+ def header(text, level)
+ slug = text.parameterize
+ "<h#{level} id=\"#{slug}\">#{text}</h#{level}>"
+ end
+ end
def gravatar_image_url(email, size = 16)
hash = Digest::MD5.hexdigest(email.strip.downcase)
@@ -14,9 +20,7 @@ end
def markdown(text)
- options = {
- :fenced_code_blocks => true
- }
- Redcarpet::Markdown.new(Redcarpet::Render::HTML, options).render(text).html_safe
+ opts = { :fenced_code_blocks => true }
+ Redcarpet::Markdown.new(MarkdownHTML, opts).render(text).html_safe
end
end
|
Add linkable headings to markdown
|
diff --git a/app/helpers/project_nav_helper.rb b/app/helpers/project_nav_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/project_nav_helper.rb
+++ b/app/helpers/project_nav_helper.rb
@@ -1,6 +1,6 @@ module ProjectNavHelper
- def next_project_id project
+ def next_project_id(project)
return if is_last_project? project
all_keys = chapter_projects_keys(project)
@@ -8,7 +8,7 @@ all_keys[index_next_project]
end
- def prev_project_id project
+ def prev_project_id(project)
return if is_first_project? project
all_keys = chapter_projects_keys(project)
@@ -22,11 +22,11 @@ project.chapter.projects.order('funded_on DESC').pluck(:id)
end
- def is_last_project? project
+ def is_last_project?(project)
chapter_projects_keys(project).last == project.id
end
- def is_first_project? project
+ def is_first_project?(project)
chapter_projects_keys(project).first == project.id
end
end
|
Fix code style (parenthesized method arguments)
|
diff --git a/config/initializers/devise_custom_flash_messages.rb b/config/initializers/devise_custom_flash_messages.rb
index abc1234..def5678 100644
--- a/config/initializers/devise_custom_flash_messages.rb
+++ b/config/initializers/devise_custom_flash_messages.rb
@@ -11,7 +11,7 @@ if kind == :signed_up || (kind == :signed_in && resource.completeness_progress < 100)
options = { link: edit_user_path(resource) }
end
- kind = :signed_in_custom if kind == :signed_in
+ kind = :signed_in_custom if kind == :signed_in && resource.completeness_progress < 100
orifinal_find_message kind, options
end
|
Fix devise custom flash messages
|
diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb
index abc1234..def5678 100644
--- a/app/mailers/application_mailer.rb
+++ b/app/mailers/application_mailer.rb
@@ -1,4 +1,5 @@ class ApplicationMailer < ActionMailer::Base
- default from: ENV["MAILER_FROM"] || "no-reply@queens-awards-enterprise.service.gov.uk"
+ default from: ENV["MAILER_FROM"] || "no-reply@queens-awards-enterprise.service.gov.uk",
+ reply_to: "info@queensawards.org.uk"
layout "mailer"
end
|
Add a reply_to field for the helpdesk email
|
diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb
index abc1234..def5678 100644
--- a/app/mailers/application_mailer.rb
+++ b/app/mailers/application_mailer.rb
@@ -1,4 +1,4 @@ class ApplicationMailer < ActionMailer::Base
- default from: "support@gadz.org"
+ default from: "emails@gadz.org"
layout 'mailer'
end
|
Change mailer from address Jira GORGMAIL-227
|
diff --git a/app/models/survey_response_map.rb b/app/models/survey_response_map.rb
index abc1234..def5678 100644
--- a/app/models/survey_response_map.rb
+++ b/app/models/survey_response_map.rb
@@ -1,7 +1,7 @@ # this class has 2 sub-classes: CourseSurveyResponseMap and AssignmentSurveyResponseMap
# The reviewed_object id is either assignment or course id;
# The reviewer_id is either assignment participant id or course participant id;
-# The reviewee_id is questionnaire id.
+# The reviewee_id is survey_deployment id.
class SurveyResponseMap < ResponseMap
def survey?
true
|
Fix a mistake in the comment.
|
diff --git a/boot/fancy_ext.rb b/boot/fancy_ext.rb
index abc1234..def5678 100644
--- a/boot/fancy_ext.rb
+++ b/boot/fancy_ext.rb
@@ -16,3 +16,12 @@ require base + "delegator"
require base + "symbol"
require base + "array"
+
+unless Rubinius::VERSION =~ /^1\./
+ begin
+ Rubinius::Compiler = Rubinius::ToolSet.current::TS::Compiler
+ Rubinius::AST = Rubinius::ToolSet.current::TS::AST
+ Rubinius::Generator = Rubinius::ToolSet.current::TS::Generator
+ rescue NameError
+ end
+end
|
Revert "cleanup: rely on rubinius-compiler gem"
This reverts commit 03e3c6294bd59882e925775918bedfbe05fe52ed.
|
diff --git a/app/lib/exceptions.rb b/app/lib/exceptions.rb
index abc1234..def5678 100644
--- a/app/lib/exceptions.rb
+++ b/app/lib/exceptions.rb
@@ -9,4 +9,6 @@ end
class CanvasApiTokenRequired < LMS::Canvas::CanvasException
end
+ class UnAuthorizedGraphQLCanvasRequest < GraphQL::ExecutionError
+ end
end
|
fix: Add definition for custom exception class
In `app/controllers/api/graphql_controller.rb` on line 24, we raise an
`Exceptions::UnAuthorizedGraphQLCanvasRequest` error. However,
this exception class isn't defined.
|
diff --git a/lib/codeclimate_ci/get_gpa.rb b/lib/codeclimate_ci/get_gpa.rb
index abc1234..def5678 100644
--- a/lib/codeclimate_ci/get_gpa.rb
+++ b/lib/codeclimate_ci/get_gpa.rb
@@ -1,5 +1,3 @@-require 'timeout'
-
module CodeclimateCi
class GetGpa
RETRY_COUNT = ENV['RETRY_COUNT'] || 3
|
Remove unnecessary timeout requiring from GetGpa
|
diff --git a/app/models/ability.rb b/app/models/ability.rb
index abc1234..def5678 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -10,8 +10,9 @@ can :manage, User, id: user.id
can :manage, Authentication, user_id: user.id
- if user.is_curator? && defined? RailsAdmin
-
+ if user.is_curator?
+ can :manage, Curation
+ can :manage, CurationPosts
end
if user.is_admin? && defined? RailsAdmin
|
Create the responsibility for the curation
|
diff --git a/lib/docker-provider/plugin.rb b/lib/docker-provider/plugin.rb
index abc1234..def5678 100644
--- a/lib/docker-provider/plugin.rb
+++ b/lib/docker-provider/plugin.rb
@@ -1,7 +1,7 @@ # TODO: Switch to Vagrant.require_version before 1.0.0
# see: https://github.com/mitchellh/vagrant/blob/bc55081e9ffaa6820113e449a9f76b293a29b27d/lib/vagrant.rb#L202-L228
unless Gem::Requirement.new('>= 1.4.0').satisfied_by?(Gem::Version.new(Vagrant::VERSION))
- raise 'vagrant-cachier requires Vagrant >= 1.4.0 in order to work!'
+ raise 'docker-provider requires Vagrant >= 1.4.0 in order to work!'
end
I18n.load_path << File.expand_path(File.dirname(__FILE__) + '/../../locales/en.yml')
|
Copy & paste is evil
|
diff --git a/bucketkit.gemspec b/bucketkit.gemspec
index abc1234..def5678 100644
--- a/bucketkit.gemspec
+++ b/bucketkit.gemspec
@@ -19,6 +19,6 @@
spec.add_development_dependency 'bundler', '~> 1.5'
spec.add_development_dependency 'rake'
- spec.add_dependency 'sawyer', '~> 0.5.4'
- spec.add_dependency 'faraday_middleware', '~> 0.9.1'
+ spec.add_dependency 'sawyer', '~> 0.5', '>= 0.5.4'
+ spec.add_dependency 'faraday_middleware', '~> 0.9', '>= 0.9.1'
end
|
Modify gemspec to prepare for publishing.
|
diff --git a/lib/magick/functions/effects.rb b/lib/magick/functions/effects.rb
index abc1234..def5678 100644
--- a/lib/magick/functions/effects.rb
+++ b/lib/magick/functions/effects.rb
@@ -5,16 +5,39 @@ module Effects
extend self
- # Lowers the intensity of a color, by lowering its alpha by a given
- # factor.
+ # Adjusts the intensity of a color by changing its alpha by a given
+ # value.
#
- # @param [Sass::Script::Number] factor Fade factor as a float between
+ # @param [Sass::Script::Number] adjust Fade value as a float between
# 0.0 and 1.0.
# @return {Effect} A command which applies the fade to the canvas.
- def fade(factor = nil)
- Compass::Magick::Utils.assert_type 'factor', factor, Sass::Script::Number
- fade_factor = 255 - (255 * Compass::Magick::Utils.value_of(factor, 1.0, 0.5)).to_i
- Effect.new { |pixel| ChunkyPNG::Color.fade(pixel, fade_factor) }
+ def fade(adjust = nil)
+ Compass::Magick::Utils.assert_type 'adjust', adjust, Sass::Script::Number
+ fade_adjust = 255 - (255 * Compass::Magick::Utils.value_of(adjust, 1.0, 0.5)).to_i
+ Effect.new { |pixel| ChunkyPNG::Color.fade(pixel, fade_adjust) }
+ end
+
+ # Adjusts the brightness of a color by changing its [R, G, B]
+ # components by a given value.
+ #
+ # Copyright (c) 2010, Ryan LeFevre
+ # http://www.camanjs.com
+ #
+ # @param [Sass::Script::Number] adjust Brightness value as a float
+ # between -1.0 and 1.0.
+ # @return {Effect} A command which applies the Brightness to the
+ # canvas.
+ def brightness(adjust = nil)
+ Compass::Magick::Utils.assert_type 'adjust', adjust, Sass::Script::Number
+ brightness_adjust = (255 * Compass::Magick::Utils.value_of(adjust, 1.0, 0.5)).to_i
+ Effect.new do |pixel|
+ ChunkyPNG::Color.rgba(
+ [0, [ChunkyPNG::Color.r(pixel) + brightness_adjust, 255].min].max,
+ [0, [ChunkyPNG::Color.g(pixel) + brightness_adjust, 255].min].max,
+ [0, [ChunkyPNG::Color.b(pixel) + brightness_adjust, 255].min].max,
+ ChunkyPNG::Color.a(pixel)
+ )
+ end
end
end
end
|
Add 'brightness' effect (borrowed from CamanJS).
|
diff --git a/gem-search.gemspec b/gem-search.gemspec
index abc1234..def5678 100644
--- a/gem-search.gemspec
+++ b/gem-search.gemspec
@@ -18,7 +18,7 @@ gem.add_dependency 'json', '~>1.8.1'
gem.add_development_dependency 'webmock', '~>1.17.4'
- gem.add_development_dependency 'rake'
+ gem.add_development_dependency 'rake', '~>10.3.1'
gem.add_development_dependency 'rspec', '~> 2.14.1'
gem.add_development_dependency 'simplecov', '~> 0.8.2'
|
Remove rake version becaouse 0.9.2 is out of date
|
diff --git a/lib/cc/engine/analyzers/php/main.rb b/lib/cc/engine/analyzers/php/main.rb
index abc1234..def5678 100644
--- a/lib/cc/engine/analyzers/php/main.rb
+++ b/lib/cc/engine/analyzers/php/main.rb
@@ -14,7 +14,7 @@ "**/*.inc",
"**/*.module"
]
- DEFAULT_MASS_THRESHOLD = 10
+ DEFAULT_MASS_THRESHOLD = 28
POINTS_PER_OVERAGE = 100_000
private
|
Move PHP default threshold to 28
When analyzing the WordPress project at the current default mass
threshold of 10, it was observed that Duplications found only by
Platform had masses of 27 or less, while Duplications found by both
Platform and Classic had masses of 28 or greater. Note: there were no
Duplications found only by Classic.
Therefore, a threshold of 28 should ensure an analysis on Platform emits
the same Duplication issues as on Classic.
|
diff --git a/example/config.ru b/example/config.ru
index abc1234..def5678 100644
--- a/example/config.ru
+++ b/example/config.ru
@@ -1,5 +1,7 @@ require 'bundler'
Bundler.require
+$stdout.sync = true
+
use Rack::HTTPLogger
run lambda { [404, {'Content-Type' => 'text/html'}, ['Page Not Found']] }
|
Set .sync to true, so notifications are logged in development
|
diff --git a/lib/auto_html/filters/flickr.rb b/lib/auto_html/filters/flickr.rb
index abc1234..def5678 100644
--- a/lib/auto_html/filters/flickr.rb
+++ b/lib/auto_html/filters/flickr.rb
@@ -9,7 +9,7 @@ params = { :url => match, :format => "json" }
[:maxwidth, :maxheight].each { |p| params[p] = options[p] unless options[p].nil? or not options[p] > 0 }
- uri = URI("http://www.flickr.com/services/oembed")
+ uri = URI("https://www.flickr.com/services/oembed")
uri.query = URI.encode_www_form(params)
response = JSON.parse(Net::HTTP.get(uri))
|
Use https for Flickr oembed API
|
diff --git a/test/controllers/aliases_controller_test.rb b/test/controllers/aliases_controller_test.rb
index abc1234..def5678 100644
--- a/test/controllers/aliases_controller_test.rb
+++ b/test/controllers/aliases_controller_test.rb
@@ -1,3 +1,4 @@+# Encoding: utf-8
require 'test_helper'
class AliasesControllerTest < ActionController::TestCase
|
Clean up alias test script
|
diff --git a/formulate.gemspec b/formulate.gemspec
index abc1234..def5678 100644
--- a/formulate.gemspec
+++ b/formulate.gemspec
@@ -9,11 +9,11 @@
gem.required_ruby_version = '>= 1.9'
- gem.add_dependency 'actionpack', '>= 3.0'
- gem.add_dependency 'activesupport', '>= 3.0'
+ gem.add_dependency 'actionpack', '~> 3.0'
+ gem.add_dependency 'activesupport', '~> 3.0'
gem.add_dependency 'carmen', '~> 0.2.0'
- gem.add_dependency 'haml', '>= 3.0'
- gem.add_dependency 'sass-rails', '>= 3.0'
+ gem.add_dependency 'haml', '~> 3.0'
+ gem.add_dependency 'sass-rails', '~> 3.0'
gem.files = `git ls-files`.split($\)
gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
Switch to pessimistic version constraints.
|
diff --git a/test/integrations/views_integration_test.rb b/test/integrations/views_integration_test.rb
index abc1234..def5678 100644
--- a/test/integrations/views_integration_test.rb
+++ b/test/integrations/views_integration_test.rb
@@ -19,6 +19,11 @@ get @errdo.error_path(Errdo::Error.last)
assert_response :success
end
+
+ should "be able to get an error's page with a specific instance selected" do
+ get @errdo.error_path(Errdo::Error.last, occurence_id: Errdo::ErrorOccurrence.last)
+ assert_response :success
+ end
end
end
|
Add test for error occurrence selecting on error page
|
diff --git a/features/step_definitions/save_occupations_steps.rb b/features/step_definitions/save_occupations_steps.rb
index abc1234..def5678 100644
--- a/features/step_definitions/save_occupations_steps.rb
+++ b/features/step_definitions/save_occupations_steps.rb
@@ -12,7 +12,7 @@ end
Then(/^I should see a confirmation that the occupation is saved$/) do
- confirmation_message = %(#{specific_search_result.fetch(:title)} saved)
+ confirmation_message = "#{specific_search_result.fetch(:title)} saved"
expect(page).to have_content(confirmation_message)
end
|
Change what should be changed to protect the innocent
|
diff --git a/lib/booking_requests/api.rb b/lib/booking_requests/api.rb
index abc1234..def5678 100644
--- a/lib/booking_requests/api.rb
+++ b/lib/booking_requests/api.rb
@@ -24,11 +24,11 @@ end
def open_timeout
- ENV.fetch('BOOKING_REQUESTS_API_OPEN_TIMEOUT', 10)
+ ENV.fetch('BOOKING_REQUESTS_API_OPEN_TIMEOUT', 2)
end
def read_timeout
- ENV.fetch('BOOKING_REQUESTS_API_READ_TIMEOUT', 10)
+ ENV.fetch('BOOKING_REQUESTS_API_READ_TIMEOUT', 2)
end
def retries
|
Drop timeouts to sane defaults
|
diff --git a/lib/date-parser/datetime.rb b/lib/date-parser/datetime.rb
index abc1234..def5678 100644
--- a/lib/date-parser/datetime.rb
+++ b/lib/date-parser/datetime.rb
@@ -14,7 +14,7 @@ date = Date.new(date)
return if date.nil?
- if time =~ /^(0[0-9]|1[0-9]|2[0-4])[\.\:]?([0-5][0-9])([\.\:]?([0-5][0-9]))?(Z|(\+|-)(0[0-9]|1[0-2])(:[0-5][0-9])?)?$/
+ if time =~ /^(0[0-9]|1[0-9]|2[0-4])[\.\:]?([0-5][0-9])([\.\:]?([0-5][0-9]))?( ?[A-Z]+|(\+|-)(0[0-9]|1[0-2])(:[0-5][0-9])?)?$/
DateTime.new date.year, date.mon, date.day, $1.to_i, $2.to_i, ($4 || 0).to_i, $5 || ''
else
nil
|
Add support for named timezones
|
diff --git a/kitchen-tests/cookbooks/end_to_end/recipes/_snap.rb b/kitchen-tests/cookbooks/end_to_end/recipes/_snap.rb
index abc1234..def5678 100644
--- a/kitchen-tests/cookbooks/end_to_end/recipes/_snap.rb
+++ b/kitchen-tests/cookbooks/end_to_end/recipes/_snap.rb
@@ -36,4 +36,4 @@ action :remove
end
-snap_package %w(hello black)+snap_package %w{hello black}
|
Fix lint issue in snap test
Signed-off-by: Gene Wood <554b3cd6285944658d6dcd5ab0d58c8e35cd6701@cementhorizon.com>
|
diff --git a/lib/dotter/configuration.rb b/lib/dotter/configuration.rb
index abc1234..def5678 100644
--- a/lib/dotter/configuration.rb
+++ b/lib/dotter/configuration.rb
@@ -35,5 +35,10 @@ package_conf['public'] = false
self.save()
end
+ def set_type(package, type)
+ package_conf = self.package_config(package)
+ package_conf['type'] = 'git_repo'
+ self.save()
+ end
end
end
|
Add method for setting the type of a package in the config. This will be used for importing repositories as packages.
|
diff --git a/features/steps/project/builds/summary.rb b/features/steps/project/builds/summary.rb
index abc1234..def5678 100644
--- a/features/steps/project/builds/summary.rb
+++ b/features/steps/project/builds/summary.rb
@@ -13,7 +13,7 @@ end
step 'I see button to CI Lint' do
- page.within('.controls') do
+ page.within('.nav-controls') do
ci_lint_tool_link = page.find_link('CI Lint')
expect(ci_lint_tool_link[:href]).to eq ci_lint_path
end
|
Update test after changes build page css
Signed-off-by: Dmitriy Zaporozhets <be23d75b156792e5acab51b196a2deb155d35d6a@gmail.com>
|
diff --git a/features/support/app_life_cycle_hooks.rb b/features/support/app_life_cycle_hooks.rb
index abc1234..def5678 100644
--- a/features/support/app_life_cycle_hooks.rb
+++ b/features/support/app_life_cycle_hooks.rb
@@ -7,7 +7,7 @@
After do |scenario|
if scenario.failed?
- screenshot_embed
+ #screenshot_embed
end
shutdown_test_server
end
|
Disable screenshots when calabash tests fail to increase speed of test run
|
diff --git a/lib/fog/aws/requests/storage/get_bucket_location.rb b/lib/fog/aws/requests/storage/get_bucket_location.rb
index abc1234..def5678 100644
--- a/lib/fog/aws/requests/storage/get_bucket_location.rb
+++ b/lib/fog/aws/requests/storage/get_bucket_location.rb
@@ -12,7 +12,7 @@ # * body [Hash]:
# * LocationConstraint [String] - Location constraint of the bucket
#
- # @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTBucketGETlocation.html
+ # @see https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETlocation.html
def get_bucket_location(bucket_name)
request({
@@ -22,8 +22,7 @@ :idempotent => true,
:method => 'GET',
:parser => Fog::Parsers::AWS::Storage::GetBucketLocation.new,
- :query => {'location' => nil},
- :path_style => true
+ :query => {'location' => nil}
})
end
end
|
Use host for get bucket location operation
|
diff --git a/lib/patches/ruport_patch.rb b/lib/patches/ruport_patch.rb
index abc1234..def5678 100644
--- a/lib/patches/ruport_patch.rb
+++ b/lib/patches/ruport_patch.rb
@@ -6,36 +6,9 @@ module Ruport::Data
class Table
def sort_rows_by(col_names = nil, options = {}, &block)
- # stabilizer is needed because of
- # http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/170565
- stabilizer = 0
- nil_rows, sortable = partition do |r|
- Array(col_names).any? { |c| r[c].nil? }
- end
-
- data_array =
- if col_names
- sortable.sort_by do |r|
- stabilizer += 1
- [Array(col_names).map do |col|
- val = r[col]
- val = val.downcase if val.kind_of?(String)
- val = val.to_s if val.kind_of?(FalseClass) || val.kind_of?(TrueClass)
- val
- end, stabilizer]
- end
- else
- sortable.sort_by(&block)
- end
-
- data_array += nil_rows
- data_array.reverse! if options[:order] == :descending
-
- table = self.class.new(:data => data_array,
- :column_names => @column_names,
- :record_class => record_class)
-
- table
+ self.class.new(:data => stable_sort_by(col_names, options[:order], &block),
+ :column_names => @column_names,
+ :record_class => record_class)
end
end
end
|
Use stable_sort_by from more_core_extensions repo in Ruport::Data::Table
|
diff --git a/adapters/sinatra_adapter.rb b/adapters/sinatra_adapter.rb
index abc1234..def5678 100644
--- a/adapters/sinatra_adapter.rb
+++ b/adapters/sinatra_adapter.rb
@@ -4,6 +4,10 @@ extend Forwardable
def initialize(sinatra_app)
@sinatra_app = sinatra_app
+ end
+
+ def params
+ sinatra_app.request.params
end
def success(content)
@@ -24,7 +28,7 @@
attr_reader :sinatra_app
- def_delegators :sinatra_app, :status, :params
+ def_delegators :sinatra_app, :status
def json_body(content)
sinatra_app.content_type :json
|
Remove junk params added by Sinatra
|
diff --git a/lib/fotoramajs.rb b/lib/fotoramajs.rb
index abc1234..def5678 100644
--- a/lib/fotoramajs.rb
+++ b/lib/fotoramajs.rb
@@ -2,7 +2,9 @@ module Fotoramajs
class Railtie < Rails::Railtie
initializer 'fotorama.config' do |app|
- app.config.assets.precompile += ['fotorama.png', 'fotorama@2x.png']
+ if Gem::Version.new(::Rails.version) >= Gem::Version.new("4.0.0")
+ app.config.assets.precompile += ['fotorama.png', 'fotorama@2x.png']
+ end
end
end
|
Add pngs to precompile only in Rails 4
|
diff --git a/lib/stash_merge_executor.rb b/lib/stash_merge_executor.rb
index abc1234..def5678 100644
--- a/lib/stash_merge_executor.rb
+++ b/lib/stash_merge_executor.rb
@@ -30,7 +30,7 @@ begin
Rails.logger.info("Trying to delete branch using Stash REST api")
remote_server.delete_branch(@build.branch)
- rescue StashAPIError => e
+ rescue RemoteServer::StashAPIError => e
Rails.logger.warn("Deletion of branch #{@build.branch} failed")
Rails.logger.warn(e.message)
super
|
Remove minor bug in delete branch
|
diff --git a/lib/accounting/core_ext/rounding.rb b/lib/accounting/core_ext/rounding.rb
index abc1234..def5678 100644
--- a/lib/accounting/core_ext/rounding.rb
+++ b/lib/accounting/core_ext/rounding.rb
@@ -15,6 +15,18 @@ end
end
end
+
+ module BigDecimal
+ module Rounding
+ def currency_round
+ if self.nil?
+ return BigDecimal.new("0")
+ else
+ return (self * 20).round / 20
+ end
+ end
+ end
+ end
end
end
@@ -23,7 +35,7 @@ end
class BigDecimal #:nodoc:
- include Accounting::CoreExtensions::Rounding
+ include Accounting::CoreExtensions::BigDecimal::Rounding
end
class Fixnum #:nodoc:
|
Use CoreExtention Rounding based on BigDecimal.
|
diff --git a/lib/custodian/samplers/linux/ram.rb b/lib/custodian/samplers/linux/ram.rb
index abc1234..def5678 100644
--- a/lib/custodian/samplers/linux/ram.rb
+++ b/lib/custodian/samplers/linux/ram.rb
@@ -0,0 +1,21 @@+module Custodian
+ module Samplers
+
+ class RAM < Custodian::Samplers::Sampler
+ describe "RAM usage"
+
+ def sample
+ free = `free`.match /Mem: +([0-9]+) +([0-9]+) +([0-9]+) +([0-9]+) +([0-9]+) +([0-9]+)/
+
+ {
+ "Total" => "#{free[1]} MB",
+ "Used" => "#{free[2]} MB",
+ "Free" => "#{free[3]} MB",
+ "Buffers" => "#{free[4]} MB",
+ "Cached" => "#{free[5]} MB"
+ }
+ end
+ end
+
+ end
+end
|
Add RAM sampler for Linux
|
diff --git a/app/models/post_searcher.rb b/app/models/post_searcher.rb
index abc1234..def5678 100644
--- a/app/models/post_searcher.rb
+++ b/app/models/post_searcher.rb
@@ -0,0 +1,25 @@+class PostSearcher
+ def initialize
+ @posts = Groonga['Posts']
+ end
+
+ def related_post_ids(post, limit: 5)
+ related_posts = @posts.select do |record|
+ conditions = (record.index('Words.Posts_title').similar_search(post.title))
+ conditions |= (record.index('Words.Posts_content').similar_search(post.body))
+ if post.author
+ conditions |= (record.author._key == post.author.id)
+ end
+ if post.category
+ conditions |= (record.category._key == post.category.id)
+ end
+ conditions &
+ (record.published_at <= Time.now) &
+ (record.site._key == post.site_id) &
+ (record._key != post.id)
+ end
+ related_posts.sort([["_score", :desc]], limit: limit).map do |related_post|
+ related_post._key
+ end
+ end
+end
|
Implement related posts by Groonga
|
diff --git a/lib/market_bot.rb b/lib/market_bot.rb
index abc1234..def5678 100644
--- a/lib/market_bot.rb
+++ b/lib/market_bot.rb
@@ -1,4 +1,5 @@ require 'uri'
+require 'cgi'
require 'typhoeus'
require 'nokogiri'
|
Add missing require for 'cgi'
|
diff --git a/spec/jobs/submission_job_spec.rb b/spec/jobs/submission_job_spec.rb
index abc1234..def5678 100644
--- a/spec/jobs/submission_job_spec.rb
+++ b/spec/jobs/submission_job_spec.rb
@@ -0,0 +1,18 @@+require "rails_helper"
+
+RSpec.describe SubmissionJob, type: :job do
+ include ActiveJob::TestHelper
+
+ let(:aru){ FactoryGirl.create(:annual_report_upload) }
+ let(:submitter) { FactoryGirl.create(:epix_user) }
+ subject(:job) { described_class.perform_later(aru.id, submitter.id, 'Epix') }
+
+ it 'queues the job' do
+ expect { job }
+ .to change(ActiveJob::Base.queue_adapter.enqueued_jobs, :size).by(1)
+ end
+
+ it 'is in default queue' do
+ expect(SubmissionJob.new.queue_name).to eq('default')
+ end
+end
|
Add specs for submission job
|
diff --git a/lib/gitlab/backend/grack_helpers.rb b/lib/gitlab/backend/grack_helpers.rb
index abc1234..def5678 100644
--- a/lib/gitlab/backend/grack_helpers.rb
+++ b/lib/gitlab/backend/grack_helpers.rb
@@ -1,7 +1,7 @@ module Grack
module Helpers
def project_by_path(path)
- if m = /^\/([\w\.\/-]+)\.git/.match(path).to_a
+ if m = /^([\w\.\/-]+)\.git/.match(path).to_a
path_with_namespace = m.last
path_with_namespace.gsub!(/\.wiki$/, '')
|
Fix project lookup for git over http + rails4
Signed-off-by: Dmitriy Zaporozhets <be23d75b156792e5acab51b196a2deb155d35d6a@gmail.com>
|
diff --git a/lib/nehm/commands/select_command.rb b/lib/nehm/commands/select_command.rb
index abc1234..def5678 100644
--- a/lib/nehm/commands/select_command.rb
+++ b/lib/nehm/commands/select_command.rb
@@ -34,6 +34,7 @@ end
def usage
+ "#{program_name} ARGUMENT [OPTIONS]"
end
protected
|
Add usage to 'select' command
|
diff --git a/lib/paper_trail_scrapbook/config.rb b/lib/paper_trail_scrapbook/config.rb
index abc1234..def5678 100644
--- a/lib/paper_trail_scrapbook/config.rb
+++ b/lib/paper_trail_scrapbook/config.rb
@@ -20,6 +20,7 @@ :scrub_columns,
:drop_id_suffix,
:unknown_whodunnit,
+ :invalid_whodunnit,
:filter_non_changes
def initialize
@@ -28,6 +29,7 @@ @events = DEFAULT_EVENTS
@scrub_columns = SCRUB_COLUMNS
@unknown_whodunnit = UNKNOWN_WHODUNNIT
+ @invalid_whodunnit = INVALID_WHODUNNIT
@drop_id_suffix = true
@filter_non_changes = true
end
|
Set @invalid_whodunnit and define getter/setter for it
|
diff --git a/lib/noyes_java.rb b/lib/noyes_java.rb
index abc1234..def5678 100644
--- a/lib/noyes_java.rb
+++ b/lib/noyes_java.rb
@@ -14,3 +14,8 @@ require 'java_impl/bent_cent_marker'
require 'java_impl/speech_trimmer'
require 'noyes.jar'
+
+# The NoyesJava module encapsulates the Java implementation of the Noyes
+# library. It is otherwise identical to the Noyes and NoyesC modules.
+module NoyesJava
+end
|
Add some overview documentation for the NoyesJava module.
|
diff --git a/lib/travis/sidekiq/build_request.rb b/lib/travis/sidekiq/build_request.rb
index abc1234..def5678 100644
--- a/lib/travis/sidekiq/build_request.rb
+++ b/lib/travis/sidekiq/build_request.rb
@@ -1,5 +1,4 @@ require 'sidekiq/worker'
-require 'travis/services/requests/receive'
module Travis
module Sidekiq
@@ -18,7 +17,7 @@ end
def service
- @service ||= Travis::Core::Services::Requests::Receive.new(nil, payload)
+ @service ||= Travis::Services::Requests::Receive.new(nil, payload)
end
end
end
|
Remove direct require for now.
Have to figure out how to deal with these circular dependencies
better. For now, it relies on the file being loaded by gatekeeper.
|
diff --git a/lib/vcr/util/internet_connection.rb b/lib/vcr/util/internet_connection.rb
index abc1234..def5678 100644
--- a/lib/vcr/util/internet_connection.rb
+++ b/lib/vcr/util/internet_connection.rb
@@ -13,7 +13,7 @@ module Ping
def pingecho(host, timeout=5, service="echo")
begin
- timeout(timeout) do
+ Timeout.timeout(timeout) do
s = TCPSocket.new(host, service)
s.close
end
|
Fix Ruby 2.3 deprecation, timeout=>Timeout.timeout
|
diff --git a/app/helpers/feeds_helper.rb b/app/helpers/feeds_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/feeds_helper.rb
+++ b/app/helpers/feeds_helper.rb
@@ -1,2 +1,5 @@ module FeedsHelper
+ def prayer_request_path(prayer_request)
+ group_prayer_request_path(prayer_request.group, prayer_request)
+ end
end
|
Fix bug showing Prayer Request in activity feed.
|
diff --git a/app/jobs/get_top_ten_job.rb b/app/jobs/get_top_ten_job.rb
index abc1234..def5678 100644
--- a/app/jobs/get_top_ten_job.rb
+++ b/app/jobs/get_top_ten_job.rb
@@ -1,11 +1,11 @@ class GetTopTenJob < ActiveJob::Base
- after_perform do |job|
+ after_perform do
GetTopTenJob.set(wait: 5.minute).perform_later
end
queue_as :default
- def perform(*args)
+ def perform(*)
Subscriber.save_top_ten
end
end
-GetTopTenJob.perform_now+GetTopTenJob.perform_now
|
Refactor Get Top Ten job
|
diff --git a/app/models/build/convert.rb b/app/models/build/convert.rb
index abc1234..def5678 100644
--- a/app/models/build/convert.rb
+++ b/app/models/build/convert.rb
@@ -1,63 +1,43 @@ module Build
- module Convert
- def convert!(opts = {}, &block)
- Rails.logger.tagged("build") do
- @opts = opts
+ module Convert # extends BowerComponent
- if @opts[:debug]
- dir = "/tmp/build"
- FileUtils.rm_rf(dir)
- FileUtils.mkdir_p(dir)
- build_in_dir(dir, &block)
- else
- Dir.mktmpdir do |dir|
- build_in_dir(dir, &block)
+ def convert!(options = {}, &block)
+ Dir.mktmpdir do |dir|
+ Rails.logger.debug "Building in #{dir}"
+
+ file_store.with_lock(file_store.bower_lock) do
+ Bower.install(self.full, dir)
+ end
+
+ results = Dir[File.join(dir, "bower_components", "*")].map do |file|
+ name = File.basename(file)
+
+ if name == self.name && self.github?
+ name = self.github_name
+ end
+
+ GemBuilder.new(dir, name).build!(options)
+ end
+
+ results.each do |result|
+ if result[:pkg]
+ file_store.save(result[:gem_component], result[:pkg])
end
end
+
+ Reindex.perform_async
+
+ block.call(dir) if block
+
+ results.find { |r| r[:bower_component].name == self.name }
end
end
- def try_convert(opts = {})
- convert!(opts)
- rescue Build::BuildError => ex
- Rails.logger.error ex.message
- nil
- end
+ protected
def file_store
@file_store ||= FileStore.new
end
- protected
-
- def build_in_dir(dir, &block)
- Rails.logger.debug "Building in #{dir}"
-
- file_store.with_lock(file_store.bower_lock) do
- Bower.install(self.full, dir)
- end
-
- results = Dir[File.join(dir, "bower_components", "*")].map do |file|
- name = File.basename(file)
-
- if name == self.name && self.github?
- name = self.github_name
- end
-
- GemBuilder.new(dir, name).build!(@opts)
- end
-
- results.each do |result|
- if result[:pkg]
- file_store.save(result[:gem_component], result[:pkg])
- end
- end
-
- Reindex.perform_async
-
- block.call(dir) if block
-
- results.find { |r| r[:bower_component].name == self.name }
- end
end
end
|
Remove mutation variables from Convert
|
diff --git a/lib/rails_config/integration/rails.rb b/lib/rails_config/integration/rails.rb
index abc1234..def5678 100644
--- a/lib/rails_config/integration/rails.rb
+++ b/lib/rails_config/integration/rails.rb
@@ -11,7 +11,7 @@ end
# Parse the settings before any of the initializers
- ActiveSupport.on_load :before_configuration, :yield => true do
+ initializer :load_rails_config_settings, :after => :load_custom_rails_config do
RailsConfig.load_and_set_settings(
Rails.root.join("config", "settings.yml").to_s,
Rails.root.join("config", "settings", "#{Rails.env}.yml").to_s,
|
Load files only after requiring initializer
|
diff --git a/lib/safe_yaml/transform/to_integer.rb b/lib/safe_yaml/transform/to_integer.rb
index abc1234..def5678 100644
--- a/lib/safe_yaml/transform/to_integer.rb
+++ b/lib/safe_yaml/transform/to_integer.rb
@@ -9,7 +9,8 @@ ])
def transform?(value)
- MATCHERS.each do |matcher|
+ MATCHERS.each_with_index do |matcher, idx|
+ value = value.gsub("_", "") if idx == 0
return true, Integer(value.gsub(",", "")) if matcher.match(value)
end
try_edge_cases?(value)
|
[bugfix] Substitute _ for decimal values
|
diff --git a/lib/tasks/copy_taxon_title.rake b/lib/tasks/copy_taxon_title.rake
index abc1234..def5678 100644
--- a/lib/tasks/copy_taxon_title.rake
+++ b/lib/tasks/copy_taxon_title.rake
@@ -4,8 +4,12 @@ taxons = RemoteTaxons.new.search(per_page: total).taxons
taxons.each do |taxon|
- next unless taxon.internal_name.empty?
+ unless taxon.internal_name == taxon.title
+ puts "Skipping #{taxon.title}..."
+ next
+ end
+ puts "Updating #{taxon.title}'s internal name..."
taxon.internal_name = taxon.title
Taxonomy::PublishTaxon.call(taxon: taxon)
end
|
Make sure we update existing taxons' internal name
The Publishing API returns both a details hash containing the internal
name, and an internal name field in the content item.
We use the latter throughout the code base.
The behaviour on the publishing API is as follows: if there is an
internal name in the details hash, return it; otherwise, return the
title instead.
The previous condition would not let us update the taxons, because
internal name was never empty.
This commit makes sure we only update taxons' internal names when the
internal name is the same as the title (i.e., there is no internal name
in the details hash yet).
|
diff --git a/lib/tasks/cpi.rake b/lib/tasks/cpi.rake
index abc1234..def5678 100644
--- a/lib/tasks/cpi.rake
+++ b/lib/tasks/cpi.rake
@@ -0,0 +1,38 @@+# rubocop:disable Metrics/BlockLength
+
+namespace :cpi do
+ desc "Import OpenStack Cloud Proivider options"
+ task :openstack, [:config] => :environment do |_, args|
+ config_file = args[:config] || "/etc/caasp/openstack.conf"
+ unless File.exist?(config_file)
+ puts "OpenStack Cloud Provider config file doesn't exist"
+ exit(1)
+ end
+ cfg = {}
+ File.open(config_file, "r").each do |line|
+ cfg["cloud:provider"] = "openstack"
+ line.chomp!
+ key, value = line.delete('"').split("=")
+ case key
+ when /^[\[#]/ then puts "Skipping the line"
+ when "auth-url" then cfg["cloud:openstack:auth_url"] = value
+ when "domain-name" then cfg["cloud:openstack:domain_name"] = value
+ when "tenant-name" then cfg["cloud:openstack:tenant_name"] = value
+ when "region" then cfg["cloud:openstack:region"] = value
+ when "username" then cfg["cloud:openstack:username"] = value
+ when "password" then cfg["cloud:openstack:password"] = value
+ when "subnet-id" then cfg["cloud:openstack:subnet_id"] = value
+ when "floating-network-id" then cfg["cloud:openstack:floating_id"] = value
+ when "monitor-max-retries" then cfg["cloud:openstack:lb_mon_retries"] = value
+ when "bs-version" then cfg["cloud:openstack:bs_version"] = value
+ when /^./ then puts "Unknown option: #{key}"
+ end
+ end
+ cfg.each do |pillar, value|
+ Pillar.find_or_create_by!(pillar: pillar) do |p|
+ p.value = value
+ end
+ end
+ end
+end
+# rubocop:enable Metrics/BlockLength
|
Add rake task to import CPI config
|
diff --git a/lib/tasks/job.rake b/lib/tasks/job.rake
index abc1234..def5678 100644
--- a/lib/tasks/job.rake
+++ b/lib/tasks/job.rake
@@ -2,7 +2,7 @@
namespace :job do
ruby_exec = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'])
- job_controller = "#{Rails.root}/script/daemons/job_task_processor_ctl.rb"
+ job_controller = Rails.root.join('script', 'daemons', 'job_task_processor_ctl.rb').to_s
desc 'Retart the job task processor'
task :restart => :environment do
|
Use Rails.root.join instead of string concatenation.
|
diff --git a/lib/arel/algebra/core_extensions/object.rb b/lib/arel/algebra/core_extensions/object.rb
index abc1234..def5678 100644
--- a/lib/arel/algebra/core_extensions/object.rb
+++ b/lib/arel/algebra/core_extensions/object.rb
@@ -12,19 +12,6 @@ yield(self)
end
- # TODO remove this when ActiveSupport beta1 is out.
- # Returns the object's singleton class.
- def singleton_class
- class << self
- self
- end
- end unless respond_to?(:singleton_class)
-
- # class_eval on an object acts like singleton_class_eval.
- def class_eval(*args, &block)
- singleton_class.class_eval(*args, &block)
- end
-
Object.send(:include, self)
end
end
|
Remove unnecessary code since AS beta1 is out.
|
diff --git a/config/application.rb b/config/application.rb
index abc1234..def5678 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -7,7 +7,6 @@ require "action_mailer/railtie"
require "action_view/railtie"
require "sprockets/railtie"
-# require "rails/test_unit/railtie"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
@@ -26,5 +25,6 @@ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
config.i18n.default_locale = 'pt-BR'
+ config.serve_static_assets = true
end
end
|
Set configs for heroku to compile assets.
According to heroku, Rails 4 dont serve my assets :eyes:
|
diff --git a/config/application.rb b/config/application.rb
index abc1234..def5678 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -21,11 +21,6 @@
config.middleware.use OmniAuth::Builder do
provider :github, ENV['GITHUB_APP_ID'], ENV['GITHUB_SECRET'],
- client_options: {
- site: "#{Gyoza::GITHUB_HOST}/api/v3",
- authorize_url: "#{Gyoza::GITHUB_HOST}/login/oauth/authorize",
- token_url: "#{Gyoza::GITHUB_HOST}/login/oauth/access_token"
- },
scope: 'user:email'
end
end
|
Simplify OAuth setup - unlikely that we'll need to handle GitHub Enterprise again.
|
diff --git a/config/application.rb b/config/application.rb
index abc1234..def5678 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -31,7 +31,7 @@ provider :developer unless Rails.env.production?
provider :github, ENV['GITHUB_CLIENT_ID'], ENV['GITHUB_CLIENT_SECRET'],
request_path: "/api/v1/authorize", callback_path: "/api/v1/authorize/callback",
- provider_ignores_state: true, scope: 'repo'
+ provider_ignores_state: true, scope: 'repo user:email'
end
config.secret_key_base = 'ghcr-web'
|
Add email permission to github
|
diff --git a/Library/Homebrew/cmd/--cellar.rb b/Library/Homebrew/cmd/--cellar.rb
index abc1234..def5678 100644
--- a/Library/Homebrew/cmd/--cellar.rb
+++ b/Library/Homebrew/cmd/--cellar.rb
@@ -3,7 +3,7 @@ if ARGV.named.empty?
puts HOMEBREW_CELLAR
else
- puts ARGV.formulae.map{ |f| HOMEBREW_CELLAR+f.name }
+ puts ARGV.formulae.map(&:rack)
end
end
end
|
Use rack accessor instead of building pathname manually
|
diff --git a/core/app/models/spree/return_item/exchange_variant_eligibility/same_product.rb b/core/app/models/spree/return_item/exchange_variant_eligibility/same_product.rb
index abc1234..def5678 100644
--- a/core/app/models/spree/return_item/exchange_variant_eligibility/same_product.rb
+++ b/core/app/models/spree/return_item/exchange_variant_eligibility/same_product.rb
@@ -1,13 +1,8 @@ module Spree
module ReturnItem::ExchangeVariantEligibility
class SameProduct
-
def self.eligible_variants(variant)
- if variant.is_master?
- Spree::Variant.where(product_id: variant.product_id, is_master: true).in_stock
- else
- Spree::Variant.where(product_id: variant.product_id, is_master: false).in_stock
- end
+ Spree::Variant.where(product_id: variant.product_id, is_master: variant.is_master?).in_stock
end
end
end
|
Make same product eligible variants DRY.
|
diff --git a/lib/goblin/sheet.rb b/lib/goblin/sheet.rb
index abc1234..def5678 100644
--- a/lib/goblin/sheet.rb
+++ b/lib/goblin/sheet.rb
@@ -31,14 +31,14 @@ def each
@cells.each do |rows|
rows.each do |cell|
- yield Goblin::Cell.new(cell)
+ yield cell
end
end
end
def each_row
@cells.each do |rows|
- yield rows.map{ |i| Goblin::Cell.new(i) }
+ yield rows
end
end
|
Change @cells elements from Nokogiri::NodeSet to Goblin::Cell in Goblin::Sheet
|
diff --git a/lib/lita/handler.rb b/lib/lita/handler.rb
index abc1234..def5678 100644
--- a/lib/lita/handler.rb
+++ b/lib/lita/handler.rb
@@ -23,7 +23,7 @@ @routes.each do |route|
if route_applies?(route, instance)
instance.public_send(
- route[:method_name],
+ route.method_name,
matches_for_route(route, instance)
)
end
|
Use method syntax for accessing struct attributes.
|
diff --git a/lib/munge/system.rb b/lib/munge/system.rb
index abc1234..def5678 100644
--- a/lib/munge/system.rb
+++ b/lib/munge/system.rb
@@ -5,20 +5,22 @@ @config = config
end
+ def item_factory
+ @item_factory ||=
+ ItemFactory.new(
+ text_extensions: @config[:items_text_extensions],
+ ignore_extensions: @config[:items_ignore_extensions]
+ )
+ end
+
def items
return @items if @items
source_path = File.expand_path(@config[:source_path], @root_path)
- source_item_factory =
- ItemFactory.new(
- text_extensions: @config[:items_text_extensions],
- ignore_extensions: @config[:items_ignore_extensions]
- )
-
@items =
Collection.new(
- item_factory: source_item_factory,
+ item_factory: item_factory,
items: Readers::Filesystem.new(source_path)
)
end
@@ -28,15 +30,9 @@
layouts_path = File.expand_path(@config[:layouts_path], @root_path)
- layouts_item_factory =
- ItemFactory.new(
- text_extensions: @config[:layouts_text_extensions],
- ignore_extensions: %w(.+)
- )
-
@layouts ||=
Collection.new(
- item_factory: layouts_item_factory,
+ item_factory: item_factory,
items: Readers::Filesystem.new(layouts_path)
)
end
|
Use only one ItemFactory for both items and layouts
|
diff --git a/lib/tasks/cron.rake b/lib/tasks/cron.rake
index abc1234..def5678 100644
--- a/lib/tasks/cron.rake
+++ b/lib/tasks/cron.rake
@@ -10,6 +10,6 @@ end
task refresh_users: :environment do
- User.refresh_shard(Time.now.hour % 6, 6)
+ User.refresh_shard(Time.now.hour % 24, 24)
end
end
|
Refresh user profiles less often
|
diff --git a/motion/spree.rb b/motion/spree.rb
index abc1234..def5678 100644
--- a/motion/spree.rb
+++ b/motion/spree.rb
@@ -10,18 +10,8 @@ # Spree::API::Zone
#
module Spree
- #
- # Getter for the endpoint URL
- #
- def self.endpoint
- @endpoint
- end
-
- #
- # Setter for the endpoint URL
- #
- def self.endpoint=(uri)
- @endpoint = uri
+ class << self
+ attr_accessor :endpoint
end
extend Spree::API::Country
|
Use Ruby idioms to create the Spree module accessors
for endpoint
|
diff --git a/app/controllers/active_waiter/jobs_controller.rb b/app/controllers/active_waiter/jobs_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/active_waiter/jobs_controller.rb
+++ b/app/controllers/active_waiter/jobs_controller.rb
@@ -3,6 +3,7 @@ module ActiveWaiter
class JobsController < ApplicationController
def show
+ @retries = nil
data = ActiveWaiter.read(params[:id])
return on_not_found(data) unless data.respond_to?(:[])
return on_error(data) if data[:error]
|
Fix instance varialble not initialize warning
|
diff --git a/app/presenters/assertion_browse_row_presenter.rb b/app/presenters/assertion_browse_row_presenter.rb
index abc1234..def5678 100644
--- a/app/presenters/assertion_browse_row_presenter.rb
+++ b/app/presenters/assertion_browse_row_presenter.rb
@@ -8,7 +8,7 @@ id: @assertion.id,
gene_name: @assertion.gene_name,
gene_id: @assertion.gene_id,
- disease: @assertion.disease,
+ disease: @assertion.disease_name,
variant_name: @assertion.variant_name,
variant_id: @assertion.variant_id,
}
|
Fix disease field in AssertionBrowseRowPresenter
|
diff --git a/app/services/sms_broker/incoming_message_hook.rb b/app/services/sms_broker/incoming_message_hook.rb
index abc1234..def5678 100644
--- a/app/services/sms_broker/incoming_message_hook.rb
+++ b/app/services/sms_broker/incoming_message_hook.rb
@@ -6,6 +6,7 @@ # This method should be overriden
#
def self.execute(message)
+ raises
end
end
|
Raise error if IncomingMessageHook not overridden
|
diff --git a/spec/views/ops/_rbac_user_details.html.haml_spec.rb b/spec/views/ops/_rbac_user_details.html.haml_spec.rb
index abc1234..def5678 100644
--- a/spec/views/ops/_rbac_user_details.html.haml_spec.rb
+++ b/spec/views/ops/_rbac_user_details.html.haml_spec.rb
@@ -0,0 +1,19 @@+describe 'ops/_rbac_user_details.html.haml' do
+ context "edit user" do
+ before do
+ user = FactoryGirl.build(:user_with_group, :name => "Joe Test", :userid => "tester")
+ allow(view).to receive(:current_tenant).and_return(Tenant.seed)
+ allow(view).to receive(:session).and_return(:assigned_filters => [])
+ edit = {:new => {:name => user.name,
+ :email => user.email,
+ :userid => user.userid},
+ :groups => []}
+ view.instance_variable_set(:@edit, edit)
+ end
+
+ it "displays full name" do
+ render
+ expect(rendered).to have_field("name", :with => "Joe Test")
+ end
+ end
+end
|
Add test for user edit form to test Full Name field
|
diff --git a/spec/features/author_creation_spec.rb b/spec/features/author_creation_spec.rb
index abc1234..def5678 100644
--- a/spec/features/author_creation_spec.rb
+++ b/spec/features/author_creation_spec.rb
@@ -1,5 +1,5 @@-require "spec_helper"
-feature "Creating Authors" do
+require 'rails_helper'
+feature 'Creating Authors' do
let(:user) { create :user }
let(:author) { attributes_for :author }
@@ -7,11 +7,11 @@ sign_in user
end
- scenario "Visiting the author page" do
+ scenario 'Visiting the author page' do
visit new_admin_author_path
- expect(page).to have_link t("authors.pluralized_title")
- fill_in "author_name", with: author
- click_button "Create Author"
+ expect(page).to have_link t('authors.pluralized_title')
+ fill_in 'author_name', with: author
+ click_button 'Create Author'
expect(page).to have_content create_message_for :author
end
end
|
Swap spec helper for correct one
|
diff --git a/LUFontIconControls.podspec b/LUFontIconControls.podspec
index abc1234..def5678 100644
--- a/LUFontIconControls.podspec
+++ b/LUFontIconControls.podspec
@@ -6,7 +6,7 @@ s.summary = 'Easy way to use icon fonts to replace images in your iOS app.'
s.homepage = 'https://github.com/rjyo/LUFontIconControls'
s.author = { 'Rakuraku Jyo' => 'jyo.rakuraku@gmail.com' }
- s.source = { :git => 'https://github.com/rjyo/LUFontIconControls.git' }
+ s.source = { :git => 'https://github.com/rjyo/LUFontIconControls.git', :tag => '0.1' }
s.description = 'Easy way to use icon fonts to replace images in your iOS app. Using icon fonts in iOS will make you life easier. You can do the following to your icon: Choose any color / Choose any size / Auto scale up for retina display'
|
Change podspec to specify the version
|
diff --git a/app/controllers/api/v1/stories_controller.rb b/app/controllers/api/v1/stories_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/v1/stories_controller.rb
+++ b/app/controllers/api/v1/stories_controller.rb
@@ -2,12 +2,28 @@ module V1
class StoriesController < ApiController
def index
- stories = Story.limit(stories_limit).order(:published_at)
-
+ stories = storiesFilter(params[:tags])
render json: stories, each_serializer: Api::V1::StorySerializer
end
private
+
+ def storiesFilter tags
+ taggedStories = taggedStories(tags)
+ return taggedStories if taggedStories.length >= 5
+ moreStories = untaggedStories
+ return (taggedStories + moreStories).first(5) if taggedStories
+ return moreStories
+ end
+
+ def taggedStories tags
+ tagsArray = tags.split(',')
+ Story.where("tags && ARRAY[?]::varchar[]", tagsArray).order(published_at: :desc).limit(stories_limit)
+ end
+
+ def untaggedStories
+ Story.order(published_at: :desc).limit(stories_limit)
+ end
def stories_limit
params[:limit] || 5
|
Add filtering logic to stories controller
|
diff --git a/app/controllers/authorizations_controller.rb b/app/controllers/authorizations_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/authorizations_controller.rb
+++ b/app/controllers/authorizations_controller.rb
@@ -8,8 +8,8 @@ u.username = auth_hash["info"]["nickname"]
end
- if user.access_token != request.env["omniauth.auth"]
- user.update_attribute(:access_token, request.env["omniauth.auth"])
+ if user.access_token != auth_hash["credentials"]["token"]
+ user.update_attribute(:access_token, auth_hash["credentials"]["token"])
end
redirect_to URI(redirect_uri).tap do |url|
|
fix: Access token is in different place
|
diff --git a/app/models/concerns/find_or_create_locked.rb b/app/models/concerns/find_or_create_locked.rb
index abc1234..def5678 100644
--- a/app/models/concerns/find_or_create_locked.rb
+++ b/app/models/concerns/find_or_create_locked.rb
@@ -16,7 +16,7 @@ # SELECT would succeed.
# So if this actually throws an exception here we probably have a
# weird underlying problem.
- retry if (retries += 1) == 1
+ (retries += 1) == 1 ? retry : raise
end
end
end
|
Raise an error if retries are exhausted
This code would have accidentally been concealing errors.
|
diff --git a/google-spreadsheet-ruby.gemspec b/google-spreadsheet-ruby.gemspec
index abc1234..def5678 100644
--- a/google-spreadsheet-ruby.gemspec
+++ b/google-spreadsheet-ruby.gemspec
@@ -18,5 +18,6 @@ s.add_dependency("nokogiri", [">= 1.4.4", "< 1.5.1"])
s.add_dependency("oauth", [">= 0.3.6"])
s.add_dependency("oauth2", [">= 0.5.0"])
+ s.add_development_dependency("rake", [">= 0.8.0"])
end
|
Add development dependency rake for bundle exec rake test
|
diff --git a/install.rb b/install.rb
index abc1234..def5678 100644
--- a/install.rb
+++ b/install.rb
@@ -56,5 +56,11 @@
puts ""
puts "==========================================================================="
+puts ""
+puts " Check that the plugin is installed correctly using:"
+puts ""
+puts " rake postage:test"
+puts ""
+puts "==========================================================================="
puts " http://postageapp.com/"
puts "==========================================================================="
|
Include mention of rake tasks in welcome message
|
diff --git a/pakyow-presenter/lib/presenter/bindings.rb b/pakyow-presenter/lib/presenter/bindings.rb
index abc1234..def5678 100644
--- a/pakyow-presenter/lib/presenter/bindings.rb
+++ b/pakyow-presenter/lib/presenter/bindings.rb
@@ -18,7 +18,7 @@ end
def value_for_prop(prop)
- return unless binding = @bindings[prop]
+ return @bindable[prop] unless binding = @bindings[prop]
self.instance_exec(&binding)
end
end
|
Fix nil value bug when no binding for prop
|
diff --git a/test/api/teaching_period_test.rb b/test/api/teaching_period_test.rb
index abc1234..def5678 100644
--- a/test/api/teaching_period_test.rb
+++ b/test/api/teaching_period_test.rb
@@ -14,9 +14,42 @@ get '/api/teaching_periods'
expected_data = TeachingPeriod.all
- puts last_response_body
+ assert_equal expected_data.count, last_response_body.count
- assert_equal expected_data.count, last_response_body.count
+ # What are the keys we expect in the data that match the model - so we can check these
+ response_keys = %w(start_date year period end_date active_until)
+
+ # Loop through all of the responses
+ last_response_body.each do | data |
+ # Find the matching teaching period, by id from response
+ tp = TeachingPeriod.find(data['id'])
+ # Match json with object
+ assert_json_matches_model(data, tp, response_keys)
+ end
+ end
+
+ def test_update_break_from_teaching_period
+ tp = TeachingPeriod.first
+ to_update = tp.breaks.first
+
+ # The api call we are testing
+ put_json with_auth_token("/api/teaching_periods/#{tp.id}/breaks/#{to_update.id}"), { number_of_weeks: 5 }
+
+ to_update.reload
+ assert_equal 5, to_update.number_of_weeks
+ end
+
+ def test_update_break_must_be_from_teaching_period
+ tp = TeachingPeriod.first
+ to_update = TeachingPeriod.last.breaks.first
+ num_weeks = to_update.number_of_weeks
+ # The api call we are testing
+ put_json with_auth_token("/api/teaching_periods/#{tp.id}/breaks/#{to_update.id}"), { number_of_weeks: num_weeks + 1 }
+
+ assert_equal 404, last_response.status
+
+ to_update.reload
+ assert_equal num_weeks, to_update.number_of_weeks
end
end
|
TEST: Add checks to get teaching and update breaks
|
diff --git a/rails/app/models/policy_division.rb b/rails/app/models/policy_division.rb
index abc1234..def5678 100644
--- a/rails/app/models/policy_division.rb
+++ b/rails/app/models/policy_division.rb
@@ -8,10 +8,6 @@ delegate :name, :australian_house, :australian_house_name, to: :division
def division
- divisions = Division.where(division_date: division_date,
- division_number: division_number,
- house: house)
- raise 'Multiple divisions found' if divisions.size > 1
- divisions.first
+ Division.find_by!(division_date: division_date, division_number: division_number, house: house)
end
end
|
Use a much simpler way of finding the division
|
diff --git a/lib/actionmailer_with_request.rb b/lib/actionmailer_with_request.rb
index abc1234..def5678 100644
--- a/lib/actionmailer_with_request.rb
+++ b/lib/actionmailer_with_request.rb
@@ -17,7 +17,7 @@ module MailerDefaultUrlOptions
def self.included(base)
- base.class_eval do
+ base.class_eval <<-RUBY, __FILE__, __LINE__ + 1
# Extends ActionMailer#default_url_options capabilities
# by merging the latest request context into the default url options.
#
@@ -32,7 +32,7 @@ end
alias_method_chain :default_url_options, :current_request
- end
+ RUBY
end
end
end
|
Use a String for better performance
|
diff --git a/SwiftDecimalNumber.podspec b/SwiftDecimalNumber.podspec
index abc1234..def5678 100644
--- a/SwiftDecimalNumber.podspec
+++ b/SwiftDecimalNumber.podspec
@@ -25,6 +25,6 @@
s.platform = :ios, '9.2'
- s.source_files = ['Package.swift', 'Sources/**/*.swift']
+ s.source_files = 'Sources/**/*.swift'
end
|
Remove SPM Package file from Cocoapod sources
|
diff --git a/thread_local.gemspec b/thread_local.gemspec
index abc1234..def5678 100644
--- a/thread_local.gemspec
+++ b/thread_local.gemspec
@@ -8,9 +8,9 @@ spec.version = ThreadLocal::VERSION
spec.authors = ["Yusuke KUOKA"]
spec.email = ["yusuke.kuoka@crowdworks.co.jp"]
- spec.summary = %q{TODO: Write a short summary. Required.}
- spec.description = %q{TODO: Write a longer description. Optional.}
- spec.homepage = ""
+ spec.summary = %q{An implementation of the thread-local variable.}
+ spec.description = %q{An implementation of the thread-local variable provided in many programming languages like Java.}
+ spec.homepage = "https://github.com/mumoshu/thread_local"
spec.license = "MIT"
spec.files = `git ls-files -z`.split("\x0")
|
Update gemspec to allow releasing it ti rubygems.org
|
diff --git a/lib/blimp/sources/disk_source.rb b/lib/blimp/sources/disk_source.rb
index abc1234..def5678 100644
--- a/lib/blimp/sources/disk_source.rb
+++ b/lib/blimp/sources/disk_source.rb
@@ -8,15 +8,15 @@ end
def get_file(path)
- raise SourceFile::NotFound if hidden?(path)
+ raise SourceFile::NotFound, path if hidden?(path)
contents = File.read(disk_path(path))
SourceFile.new(path, contents)
rescue
- raise SourceFile::NotFound
+ raise SourceFile::NotFound, path
end
def get_dir(path)
- raise SourceDir::NotFound if hidden?(path)
+ raise SourceDir::NotFound, path if hidden?(path)
entries = []
Dir.entries(disk_path(path)).each do |entry|
entry_path = File.join(path, entry)
@@ -26,7 +26,7 @@ entries.sort!
SourceDir.new(path, entries)
rescue
- raise SourceDir::NotFound
+ raise SourceDir::NotFound, path
end
def is_file?(path)
|
Raise with path, so we can see whats going wrong
|
diff --git a/lib/gov_kit/transparency_data.rb b/lib/gov_kit/transparency_data.rb
index abc1234..def5678 100644
--- a/lib/gov_kit/transparency_data.rb
+++ b/lib/gov_kit/transparency_data.rb
@@ -0,0 +1,18 @@+module GovKit
+ class TransparencyDataResource < Resource
+ default_params :apikey => GovKit::configuration.sunlight_apikey
+ base_uri GovKit::configuration.transparency_data_base_url
+ end
+
+ module TransparencyData
+ # See http://transparencydata.com/api/contributions/
+ # for complete query options
+ class Contribution < TransparencyDataResource
+ def self.find(ops = {})
+ response = get('/contributions.json', :query => ops)
+ parse(response)
+ end
+ end
+ end
+
+end
|
Add TransparencyData API Campaign Contributions support
|
diff --git a/lib/letsencrypt/configuration.rb b/lib/letsencrypt/configuration.rb
index abc1234..def5678 100644
--- a/lib/letsencrypt/configuration.rb
+++ b/lib/letsencrypt/configuration.rb
@@ -16,6 +16,10 @@ config_accessor :save_to_redis
config_accessor :redis_url
+ config_accessor :certificate_model do
+ 'LetsEncrypt::Certificate'
+ end
+
# Returns true if enabled `save_to_redis` feature
def use_redis?
save_to_redis == true
|
Add certificate_model for user to customize model
|
diff --git a/lib/liquid/pagination_filters.rb b/lib/liquid/pagination_filters.rb
index abc1234..def5678 100644
--- a/lib/liquid/pagination_filters.rb
+++ b/lib/liquid/pagination_filters.rb
@@ -5,7 +5,9 @@ def paginate(pagination_info)
pagination_html = ""
if pagination_info.is_a?(Hash) && (pagination_info["current_page"] && pagination_info["per_page"] && pagination_info["total_entries"])
-
+
+ pagination_html += "<div class=\"pagination\">"
+
# Previous link, if appropriate
pagination_html += "<a href=\"?page=#{pagination_info["current_page"].to_i - 1}\" class=\"prev_page\" rel=\"prev\">« Previous</a>" if pagination_info["current_page"].to_i > 1
@@ -15,6 +17,8 @@ pagination_html += "<a href=\"?page=#{pagination_info["current_page"].to_i + 1}\" class=\"next_page\" rel=\"next\">Next »</a>"
end
+ pagination_html += "</div>"
+
end
pagination_html
end
|
Add pagination div to filter.
|
diff --git a/lib/nrser/core_ext/enumerable.rb b/lib/nrser/core_ext/enumerable.rb
index abc1234..def5678 100644
--- a/lib/nrser/core_ext/enumerable.rb
+++ b/lib/nrser/core_ext/enumerable.rb
@@ -1,3 +1,4 @@+require 'nrser/functions/enumerable/associate'
require_relative './enumerable/find_map'
|
Add a missing dep req
|
diff --git a/lib/nikeplusgem/activity_data.rb b/lib/nikeplusgem/activity_data.rb
index abc1234..def5678 100644
--- a/lib/nikeplusgem/activity_data.rb
+++ b/lib/nikeplusgem/activity_data.rb
@@ -1,14 +1,14 @@ module NikePlusGem
class Client
- ACTIVITY_DATA = []
+ ACTIVITY_DATA = ["activityId"]
def activity_data(params={})
params = params.only(ACTIVITY_DATA)
activity_id = params["activityId"]
- get("/me/sport/activities/" << activity_data, params)
+ get("/me/sport/activities/" << activity_id, params)
end
end
|
Fix issue in Activity Data endpoint.
- Must include the required activityId parameter.
- Append the activity_id value instead of the required params.
|
diff --git a/lib/thincloud/postmark/engine.rb b/lib/thincloud/postmark/engine.rb
index abc1234..def5678 100644
--- a/lib/thincloud/postmark/engine.rb
+++ b/lib/thincloud/postmark/engine.rb
@@ -17,15 +17,8 @@ config.thincloud.postmark ||= Thincloud::Postmark.configure
end
- # Require the config initializer in advance so it is available for
- # the "thincloud.postmark.action_mailer" initializer
- initializer "thincloud.postmark.configuration", before: "thincloud.postmark.action_mailer" do
- config_initializer = File.expand_path("config/initializers/thincloud_postmark.rb")
- require config_initializer if File.exists?(config_initializer)
- end
-
# Apply the postmark settings just before ActionMailer applies them
- initializer "thincloud.postmark.action_mailer", before: "action_mailer.set_configs" do |app|
+ initializer "thincloud.postmark.action_mailer", after: "finisher_hook" do |app|
if configuration.api_key
app.config.action_mailer.delivery_method = :postmark
app.config.action_mailer.postmark_settings = { api_key: configuration.api_key }
|
Use different hook for action_mailer config
By using the `after: "finisher_hook"` we are
alleviated from the specific load order of the
initializers. ActionMailer allows the addition
of delivery methods at any point during app
execution as long as it's there before you send
mail.
Now we can lose the specific initializer path
tests, the generated initializer is unneeded
in a standard application, and the app can use
any method to set the configuration during
initialization and it's picked up at the end.
|
diff --git a/lib/plotly/offline/exportable.rb b/lib/plotly/offline/exportable.rb
index abc1234..def5678 100644
--- a/lib/plotly/offline/exportable.rb
+++ b/lib/plotly/offline/exportable.rb
@@ -20,6 +20,11 @@ Launchy.open(File.absolute_path(path)) if open
end
+ def to_html
+ html = create_html(@data, layout: @layout, embedded: true)
+ html.render
+ end
+
private
def create_html(data, layout: {}, embedded: false)
|
Add feature to generate embeddable html string
|
diff --git a/lib/rubocop/cop/lint/debugger.rb b/lib/rubocop/cop/lint/debugger.rb
index abc1234..def5678 100644
--- a/lib/rubocop/cop/lint/debugger.rb
+++ b/lib/rubocop/cop/lint/debugger.rb
@@ -7,14 +7,15 @@ class Debugger < Cop
MSG = 'Remove debugger entry point `%s`.'
- def_node_matcher :debugger_call?,
- '{(send nil {:debugger :byebug} ...)
- (send (send nil :binding)
- {:pry :remote_pry :pry_remote} ...)
- (send (const nil :Pry) :rescue ...)
- (send nil {:save_and_open_page
- :save_and_open_screenshot
- :save_screenshot} ...)}'
+ def_node_matcher :debugger_call?, <<-END
+ {(send nil {:debugger :byebug} ...)
+ (send (send nil :binding)
+ {:pry :remote_pry :pry_remote} ...)
+ (send (const nil :Pry) :rescue ...)
+ (send nil {:save_and_open_page
+ :save_and_open_screenshot
+ :save_screenshot} ...)}
+ END
def on_send(node)
return unless debugger_call?(node)
|
Adjust formatting of NodePattern in Lint/Debugger
I find that using multiline strings to keep the node patterns on separate lines
from Ruby code makes them read better.
|
diff --git a/db/migrate/20140626080142_create_contacts.rb b/db/migrate/20140626080142_create_contacts.rb
index abc1234..def5678 100644
--- a/db/migrate/20140626080142_create_contacts.rb
+++ b/db/migrate/20140626080142_create_contacts.rb
@@ -2,8 +2,8 @@ def change
create_table :contacts do |t|
t.string :email, unique: true
-
t.timestamps
end
+ add_index :contacts, :email, :unique => true
end
end
|
Add unique index to contacts email
|
diff --git a/search-engine/lib/ban_list/pioneer.rb b/search-engine/lib/ban_list/pioneer.rb
index abc1234..def5678 100644
--- a/search-engine/lib/ban_list/pioneer.rb
+++ b/search-engine/lib/ban_list/pioneer.rb
@@ -7,4 +7,12 @@ "Windswept Heath" => "banned",
"Wooded Foothills" => "banned",
)
+
+ change(
+ "2019-11-04",
+ "https://magic.wizards.com/en/articles/archive/news/november-4-2019-pioneer-banned-announcement",
+ "Felidar Guardian" => "banned",
+ "Leyline of Abundance" => "banned",
+ "Oath of Nissa" => "banned",
+ )
end
|
Add yesterday's Pioneer B&R changes
|
diff --git a/test/integration/sign_in_flow_test.rb b/test/integration/sign_in_flow_test.rb
index abc1234..def5678 100644
--- a/test/integration/sign_in_flow_test.rb
+++ b/test/integration/sign_in_flow_test.rb
@@ -13,22 +13,28 @@ Warden.test_reset!
end
+ def sign_out
+ visit '/'
+ within("div#above-header") do
+ click_on("Logout")
+ end
+ end
+
test "a browser should be able to sign in and be shown the home page" do
sign_in
assert_equal '/en', current_path
+ sign_out
end
test "an admin should be able to sign in and be shown the admin page" do
- sign_in_admin
- assert_equal '/admin', path
+ sign_in("admin@test.com")
+ assert_equal '/admin', current_path
+ sign_out
end
- # TODO: for some reason I could not get the admin login with the regular sign_in method to work
- # The current path never changed from /en so I had to resort to doing it this way:
- def sign_in_admin
- get "/en/users/sign_in"
- post '/en/users/sign_in', 'user[email]' => 'admin@test.com', 'user[password]' => '12345678'
- follow_redirect!
+ test "a browser visiting an admin page should be redirected to login in their locale" do
+ visit '/admin'
+ assert_equal '/en/users/sign_in', current_path
end
end
|
Add new sign in test if browse direct to admin
|
diff --git a/test/integration/users_signup_test.rb b/test/integration/users_signup_test.rb
index abc1234..def5678 100644
--- a/test/integration/users_signup_test.rb
+++ b/test/integration/users_signup_test.rb
@@ -7,12 +7,25 @@
assert_no_difference 'User.count' do
post signup_path, params: { user: { name: "",
- email: "user@invalid",
- password: "foo",
- password_confirmation: "bar" } }
+ email: "user@invalid",
+ password: "foo",
+ password_confirmation: "bar" } }
end
assert_template 'users/new'
assert_select 'div#error_explanation'
assert_select 'div.field_with_errors'
end
+
+ test "valid signup information" do
+ get signup_path
+ assert_difference 'User.count', 1 do
+ post users_path, params: { user: { name: "Example User",
+ email: "user@example.com",
+ password: "password",
+ password_confirmation: "password" } }
+ end
+ follow_redirect!
+ assert_template 'users/show'
+ assert_not flash.empty?
+ end
end
|
Add valid signup information test
|
diff --git a/app/models/audit.rb b/app/models/audit.rb
index abc1234..def5678 100644
--- a/app/models/audit.rb
+++ b/app/models/audit.rb
@@ -1,6 +1,6 @@ class Audit < Sequel::Model
- many_to_one :auditable, reciprocal: :audits,
+ many_to_one :auditable, reciprocal: :audits, reciprocal_type: :many_to_one,
setter: (proc do |auditable|
self[:auditable_id] = (auditable.pk if auditable)
self[:auditable_type] = (auditable.class.name if auditable)
@@ -24,4 +24,15 @@ end
end
end)
+
+
+ def before_create
+ set_version_number
+ super
+ end
+
+ def set_version_number
+ max = Audit.where(auditable_id: auditable_id, auditable_type: auditable_type).reverse(:version).first.try(:version) || 0
+ self.version = max + 1
+ end
end
|
Fix polymorphic association and set version number
|
diff --git a/app/models/order.rb b/app/models/order.rb
index abc1234..def5678 100644
--- a/app/models/order.rb
+++ b/app/models/order.rb
@@ -17,10 +17,10 @@ :currency_code => 'EUR'
}
values.merge!({
- "Cena" => 1,
- "Ime artikla" => 'Kontakt',
- "Št. artikla" => id,
- "Količina" => 1
+ "amount" => 10,
+ "item_name" => 'Kontakt',
+ "item_number" => 4144,
+ "quantity" => 1
})
"https://www.paypal.com/cgi-bin/webscr?" + values.to_query
end
|
Change back on Order.rb to english and 10eur price
|
diff --git a/lib/puppet/parser/functions/ldapquery.rb b/lib/puppet/parser/functions/ldapquery.rb
index abc1234..def5678 100644
--- a/lib/puppet/parser/functions/ldapquery.rb
+++ b/lib/puppet/parser/functions/ldapquery.rb
@@ -1,4 +1,4 @@-require 'puppet_x/ldapquery'
+require_relative '../../../puppet_x/ldapquery'
begin
require 'net/ldap'
|
Update require for puppet_x to use relative path
This work should allow the code to be loaded in the puppetserver.
|
diff --git a/lib/sequent/core/base_command_handler.rb b/lib/sequent/core/base_command_handler.rb
index abc1234..def5678 100644
--- a/lib/sequent/core/base_command_handler.rb
+++ b/lib/sequent/core/base_command_handler.rb
@@ -27,7 +27,7 @@ end
def handles_message?(command)
- self.class.message_mapping.keys.find { |x| command.is_a? x }
+ self.class.message_mapping.keys.include? command.class
end
protected
|
Fix inconsistency; no CommandHandler inheritance
|
diff --git a/spec/controllers/groups_controller_spec.rb b/spec/controllers/groups_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/groups_controller_spec.rb
+++ b/spec/controllers/groups_controller_spec.rb
@@ -0,0 +1,67 @@+require 'rails_helper'
+
+describe GroupsController do
+ let(:user) { FactoryGirl.create(:user) }
+
+ before(:each) do
+ allow_any_instance_of(GroupsController).to receive(:current_user).and_return(user)
+ end
+
+ describe "GET inquire" do
+ it "should render the inquire template" do
+ get (:inquire)
+ expect(response).to render_template(:inquire)
+ end
+ end
+
+ describe "GET reassign" do
+ it "should update the user's group to nil" do
+ get :reassign
+ expect(user.group_id).to be_nil
+ end
+
+ it "should redirect to groups_assign_path" do
+ get :reassign
+ expect(response).to redirect_to(groups_assign_path)
+ end
+ end
+
+ describe "POST assign" do
+ let(:group) { FactoryGirl.create(:group) }
+
+ before(:each) { user.group_id = nil }
+
+
+ context "valid address provided by user" do
+ before(:each) do
+ allow_any_instance_of(GroupsController).to receive(:find_group_id).and_return(group.id)
+ end
+
+ it "should assign the user to a group" do
+ post :assign, { address: "123 Main Street" }
+ expect(user.group_id).to eq(group.id)
+ end
+
+ it "should set a flash[:success] message" do
+ post :assign, { address: "123 Main Street" }
+ expect(flash[:success]).to eq("Welcome to #{group.name}")
+ end
+
+ it "should redirect to root_path" do
+ post :assign, { address: "123 Main Street" }
+ expect(response).to redirect_to(root_path)
+ end
+ end
+
+ context "invalid address provided by user" do
+ before(:each) do
+ allow_any_instance_of(GroupsController).to receive(:find_group_id).and_return(nil)
+ end
+
+ it "should set a flash[:now] message" do
+ post :assign, { address: "123 Main Street" }
+ expect(flash[:now]).to eq("We couldn't find your building. Can you be more specific?")
+ end
+ end
+ end
+end
|
Add a basic test suite for the Groups Controller.
Test coverage is currently at 57%. This needs to be improved.
|
diff --git a/spec/importers/rows/attendance_row_spec.rb b/spec/importers/rows/attendance_row_spec.rb
index abc1234..def5678 100644
--- a/spec/importers/rows/attendance_row_spec.rb
+++ b/spec/importers/rows/attendance_row_spec.rb
@@ -44,10 +44,5 @@ expect { row.build.save! }.not_to change(Tardy, :count)
end
end
-
- it 'creates the appropriate school year' do
- expect { row.build }.to change(SchoolYear, :count).by(1)
- expect(SchoolYear.last.name).to eq('1981-1982')
- end
end
end
|
Remove extra attendance row spec
|
diff --git a/spec/lib/hipaa-crypt/configuration_spec.rb b/spec/lib/hipaa-crypt/configuration_spec.rb
index abc1234..def5678 100644
--- a/spec/lib/hipaa-crypt/configuration_spec.rb
+++ b/spec/lib/hipaa-crypt/configuration_spec.rb
@@ -4,7 +4,7 @@
describe '#extractable_options' do
it 'should be true' do
- expect(HipaaCrypt::Configuration.extractable_options?).to be_true
+ expect(HipaaCrypt::Configuration.new.extractable_options?).to be_true
end
end
|
Fix calling instance instead of class method
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.