diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/lib/trawler/sources/json_fetcher.rb b/lib/trawler/sources/json_fetcher.rb
index abc1234..def5678 100644
--- a/lib/trawler/sources/json_fetcher.rb
+++ b/lib/trawler/sources/json_fetcher.rb
@@ -9,11 +9,13 @@ class << self
extend Memoist
- def get(url)
+ def get(url, &error_block)
+ error_block ||= -> r { raise "Fetch of #{url} failed. #{error_response}" }
+
puts "Fetching #{url} ..."
response = RestClient.get(url, { accepts: :json })
- yield(response) unless response.code == 200
+ error_block.call(response) unless response.code == 200
JSON.parse(response.body)
end
|
Add default error handler to fetch
|
diff --git a/lib/uniara_virtual_parser/client.rb b/lib/uniara_virtual_parser/client.rb
index abc1234..def5678 100644
--- a/lib/uniara_virtual_parser/client.rb
+++ b/lib/uniara_virtual_parser/client.rb
@@ -9,7 +9,7 @@
class << self
def get_with_token(path, token)
- uri = URI("#{ENDPOINT}#{path}")
+ uri = URI("#{endpoint}#{path}")
req = Net::HTTP::Get.new(uri)
req['Cookie'] = "PHPSESSID=#{token};"
res = Net::HTTP.start(uri.hostname, uri.port) do |http|
@@ -18,8 +18,18 @@ end
def post(path, body=nil)
- uri = URI("#{ENDPOINT}#{path}")
+ uri = URI("#{endpoint}#{path}")
Net::HTTP.post_form(uri, body)
+ end
+
+ def configure_endpoint(endpoint)
+ @endpoint = endpoint
+ end
+
+ private
+
+ def endpoint
+ @endpoint || ENDPOINT
end
end
end
|
Allow configure a custom endpoint
|
diff --git a/lib/ups/builders/shipper_builder.rb b/lib/ups/builders/shipper_builder.rb
index abc1234..def5678 100644
--- a/lib/ups/builders/shipper_builder.rb
+++ b/lib/ups/builders/shipper_builder.rb
@@ -10,6 +10,10 @@ def initialize(opts = {})
self.name = name
self.opts = opts
+ end
+
+ def shipper_name
+ element_with_value('Name', opts[:company_name])
end
def company_name
@@ -30,6 +34,7 @@
def to_xml
Element.new('Shipper').tap do |org|
+ org << shipper_name
org << company_name
org << phone_number
org << shipper_number unless shipper_number.nil?
|
Add Shipper Name to Shipper Builder
|
diff --git a/lib/core/repositories/vcr.rb b/lib/core/repositories/vcr.rb
index abc1234..def5678 100644
--- a/lib/core/repositories/vcr.rb
+++ b/lib/core/repositories/vcr.rb
@@ -0,0 +1,17 @@+require 'vcr'
+
+module Core::Repositories
+ class VCR < SimpleDelegator
+ def method_missing(method_name, *args, &block)
+ klass = if __getobj__.class.superclass == SimpleDelegator
+ __getobj__.__getobj__.class
+ else
+ __getobj__.class
+ end
+
+ cassette_name = [klass.name.underscore, method_name, *args].join('/')
+
+ ::VCR.use_cassette(cassette_name) { super }
+ end
+ end
+end
|
Introduce a VCR repository for acceptance tests
We'll use our VCR repository to wrap HTTP backed repositories at
runtime to provide us with fast, deterministic repositories when we
perform our acceptance tests.
|
diff --git a/hijri_date.gemspec b/hijri_date.gemspec
index abc1234..def5678 100644
--- a/hijri_date.gemspec
+++ b/hijri_date.gemspec
@@ -8,8 +8,8 @@ spec.version = HijriDate::VERSION
spec.authors = ["Murtaza Gulamali"]
spec.email = ["mygulamali@gmail.com"]
- spec.description = %q{TODO: Write a gem description}
- spec.summary = %q{TODO: Write a gem summary}
+ spec.description = %q{Class to store Hijri dates and convert them to/from Astronomical Julian Date.}
+ spec.summary = %q{Hijri date object}
spec.homepage = ""
spec.license = "MIT"
|
Complete description and summary in gemspec.
|
diff --git a/lib/kobol/requests/issues.rb b/lib/kobol/requests/issues.rb
index abc1234..def5678 100644
--- a/lib/kobol/requests/issues.rb
+++ b/lib/kobol/requests/issues.rb
@@ -5,7 +5,7 @@ def search(properties, page)
updated_after_date = Date.today << 3
- set_response(client.search_issues("#{search_params(properties)} type:issue state:open updated:>#{updated_after_date}", page: page, per_page: 100))
+ set_response(client.search_issues("#{search_params(properties)} type:issue archived:false state:open updated:>#{updated_after_date}", page: page, per_page: 100))
end
def total
|
Exclude archived repositories from search
Resolves #141
|
diff --git a/lib/cache_comment/comment_formatter.rb b/lib/cache_comment/comment_formatter.rb
index abc1234..def5678 100644
--- a/lib/cache_comment/comment_formatter.rb
+++ b/lib/cache_comment/comment_formatter.rb
@@ -3,7 +3,7 @@
def initialize key, options
@key = key
- @options = options.symbolize_keys
+ @options = (options || {}).symbolize_keys
@time = Time.now
end
|
Fix formatter for options that are nil
|
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/application_controller_spec.rb
+++ b/spec/controllers/application_controller_spec.rb
@@ -0,0 +1,14 @@+require "spec_helper"
+
+describe ApplicationController do
+ let(:instance) { ApplicationController.new }
+
+ describe "#default_url_options" do
+ let(:locale) { :pirate }
+ before { I18n.stub(:locale) { locale } }
+
+ it "sets the locale" do
+ instance.default_url_options[:locale].should eq(locale)
+ end
+ end
+end
|
Add locale support to URLs
|
diff --git a/ios/RNSqlite2.podspec b/ios/RNSqlite2.podspec
index abc1234..def5678 100644
--- a/ios/RNSqlite2.podspec
+++ b/ios/RNSqlite2.podspec
@@ -10,7 +10,7 @@ s.license = "Apache 2.0"
s.author = { "author" => "hi@craftz.dog" }
s.platform = :ios, "7.0"
- s.source = { :git => "https://github.com/craftzdog/RNSqlite2.git", :tag => "master" }
+ s.source = { :git => "https://github.com/craftzdog/react-native-sqlite-2.git", :tag => "master" }
s.source_files = "**/*.{h,m}"
s.requires_arc = true
s.library = "sqlite3"
|
fix(ios): Fix source URI in podspec
RNSqlite2.git doesn't exist #55
|
diff --git a/lib/praxis/tasks/api_docs.rb b/lib/praxis/tasks/api_docs.rb
index abc1234..def5678 100644
--- a/lib/praxis/tasks/api_docs.rb
+++ b/lib/praxis/tasks/api_docs.rb
@@ -7,9 +7,8 @@ generator = Praxis::RestfulDocGenerator.new(Dir.pwd)
end
- desc "API Documenation Browser"
desc "API Documentation Browser"
- task :doc_browser => [:api_docs] do
+ task :doc_browser => [:api_docs] do |t, args|
public_folder = File.expand_path("../../../", __FILE__) + "/api_browser/app"
app = Rack::Builder.new do
map "/docs" do # application JSON docs
@@ -22,6 +21,8 @@ run lambda { |env| [404, {'Content-Type' => 'text/plain'}, ['Not Found']] }
end
- Rack::Server.start app: app, Port: 4567
+ port = args[:port] || 4567
+ Rack::Server.start app: app, port: port
end
+
end
|
Add 'port' argument to doc_browser rake task.
Closes #75
|
diff --git a/lib/ransack/configuration.rb b/lib/ransack/configuration.rb
index abc1234..def5678 100644
--- a/lib/ransack/configuration.rb
+++ b/lib/ransack/configuration.rb
@@ -35,9 +35,9 @@ end
# default search_key that, it can be overridden on sort_link level
- def set_search_key_name(name)
+ def search_key=(name)
self.options[:search_key] = name
end
end
-end+end
|
Change set_search_key_name Configuration method to be a true setter, renamed to search_key=
Related to #81
|
diff --git a/lib/engineyard-cloud-client/version.rb b/lib/engineyard-cloud-client/version.rb
index abc1234..def5678 100644
--- a/lib/engineyard-cloud-client/version.rb
+++ b/lib/engineyard-cloud-client/version.rb
@@ -1,7 +1,7 @@ # This file is maintained by a herd of rabid monkeys with Rakes.
module EY
class CloudClient
- VERSION = '1.0.5'
+ VERSION = '1.0.6.pre'
end
end
# Please be aware that the monkeys like tho throw poo sometimes.
|
Add .pre for next release
|
diff --git a/spec/controllers/products_controller_spec.rb b/spec/controllers/products_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/products_controller_spec.rb
+++ b/spec/controllers/products_controller_spec.rb
@@ -14,7 +14,7 @@
it 'returns the correct content type' do
subject
- expect(response.content_type).to eq 'application/rss+xml'
+ expect(response.content_type.split(';').first).to eq 'application/rss+xml'
end
end
end
|
Fix content type spec on Rails 6
Rails 6 appends the charset to the content type of the response,
so we need to parse the content type properly in our test.
|
diff --git a/spec/fixtures/dummy_rails_app/application.rb b/spec/fixtures/dummy_rails_app/application.rb
index abc1234..def5678 100644
--- a/spec/fixtures/dummy_rails_app/application.rb
+++ b/spec/fixtures/dummy_rails_app/application.rb
@@ -1,5 +1,5 @@ Rails = Class.new do
- require "#{File.dirname(__FILE__)}/dummy_app/fake"
+ require_relative 'fake'
def self.root
Pathname.new(File.dirname(__FILE__))
|
Fix test which did not work in all cases.
|
diff --git a/spec/views/mentorships/show.html.erb_spec.rb b/spec/views/mentorships/show.html.erb_spec.rb
index abc1234..def5678 100644
--- a/spec/views/mentorships/show.html.erb_spec.rb
+++ b/spec/views/mentorships/show.html.erb_spec.rb
@@ -12,6 +12,8 @@ end
it "renders attributes in <p>" do
+ pending "I don't spec views"
+
render
response.should have_text(/1/)
response.should have_text(/1/)
|
Change another view spec to pending
|
diff --git a/files/chef-marketplace-cookbooks/chef-marketplace/recipes/enable.rb b/files/chef-marketplace-cookbooks/chef-marketplace/recipes/enable.rb
index abc1234..def5678 100644
--- a/files/chef-marketplace-cookbooks/chef-marketplace/recipes/enable.rb
+++ b/files/chef-marketplace-cookbooks/chef-marketplace/recipes/enable.rb
@@ -1,4 +1,13 @@ include_recipe 'chef-marketplace::config'
+
+# Setup the MOTD first so that the user doesn't see old data if the shell in
+# before the chef-client has finished converging
+motd '50-chef-marketplace-appliance' do
+ source 'motd.erb'
+ cookbook 'chef-marketplace'
+ variables motd_variables
+ action motd_action
+end
include_recipe 'chef-marketplace::_register_plugin'
@@ -13,10 +22,3 @@
# Setup omnibus-ctl commands
include_recipe 'chef-marketplace::_omnibus_commands'
-
-motd '50-chef-marketplace-appliance' do
- source 'motd.erb'
- cookbook 'chef-marketplace'
- variables motd_variables
- action motd_action
-end
|
Update MOTD at the beginning of the chef-client run
|
diff --git a/spec/support/custom_matchers/response_matchers.rb b/spec/support/custom_matchers/response_matchers.rb
index abc1234..def5678 100644
--- a/spec/support/custom_matchers/response_matchers.rb
+++ b/spec/support/custom_matchers/response_matchers.rb
@@ -1,7 +1,89 @@-RSpec::Matchers.define :respond_with_redirect_to do |path|
- match do |actual|
- response = actual.call
- response.redirect? && response.location =~ /#{path}$/
+RSpec::Matchers.define :respond_with_status do |status|
+ match do |block|
+ block.call
+
+ if Symbol === status
+ if [:success, :missing, :redirect, :error].include?(status)
+ response.send("#{status}?")
+ else
+ code = Rack::Utils::SYMBOL_TO_STATUS_CODE[status]
+ code == response.response_code
+ end
+ else
+ status == response.response_code
+ end
+ end
+
+ failure_message_for_should do |actual|
+ "expected a #{status} response, but response was #{response.status}"
+ end
+
+ description do
+ "respond with status"
end
end
+class RespondWithRedirectMatcher
+ def initialize(rspec, response, target_path, &target_path_block)
+ @rspec = rspec
+ @response = response
+ @target_path = target_path
+ @target_path_block = target_path_block
+ end
+
+ def matches?(block)
+ block.call
+ target_path = @target_path_block.try(:call) || @target_path
+ @response.should @rspec.redirect_to(target_path)
+ end
+
+ def failure_message_for_should
+ "expected a redirect to #{@target_path}"
+ end
+
+ def description
+ "respond with redirect"
+ end
+end
+
+define_method :respond_with_redirect_to do |*target_paths, &target_path_block|
+ target_path = target_paths.first
+ RespondWithRedirectMatcher.new(self, response, target_path, &target_path_block)
+end
+
+RSpec::Matchers.define :respond_with_template do |template_name|
+ match do |block|
+ block.call
+ response.should render_template(template_name)
+ true
+ end
+end
+
+RSpec::Matchers.define :assign do |*vars|
+ match do |block|
+ block.call
+ vars.all? { |var| assigns(var) }
+ end
+end
+
+RSpec::Matchers.define :set_flash do |type|
+ chain :to do |message|
+ @message = message
+ end
+
+ match do |block|
+ block.call
+ flash[type].should_not be_nil
+ (flash[type].match(@message)).should be_true if @message
+ end
+
+ failure_message_for_should do |actual|
+ message = "Expected flash[#{type}] to "
+ if @message
+ message += "match '#{@message}', but was '#{flash[type]}'"
+ else
+ message += "be set, but it was not"
+ end
+ end
+end
+
|
Add custom controller matchers for status
|
diff --git a/app/helpers/dashboard_helper.rb b/app/helpers/dashboard_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/dashboard_helper.rb
+++ b/app/helpers/dashboard_helper.rb
@@ -9,21 +9,8 @@ end
if defined?(Graphite)
- def elective_block_enrollment_status(elective_mod)
- if current_user.student.has_pending_enrollments_for_module?(elective_mod)
- content_tag :span do
- I18n.t(:label_elective_block_enrollment_pending)
- end
- elsif elective_mod.student_enrolled?(current_user.verifable)
- content_tag :span, :class => "text-success" do
- I18n.t(:label_elective_block_enrollment_accepted)
- end
- else
- content_tag :span, :class => "text-danger" do
- I18n.t(:label_elective_block_student_enroll)
- end
- end
- end
+ require 'graphite/enrollment/status_info'
+ include Graphite::Enrollment::StatusInfo
end
CONTEXT_FILTERS = [:newest, :recently_accepted, :recently_updated, :recently_created, :unaccepted, :newest_enrollments].freeze
|
Move enrollment_info method into separate module
Change-Id: I74102b677b097a105fb472c6f2c1aea35ed06ee0
|
diff --git a/KeenClientTD.podspec b/KeenClientTD.podspec
index abc1234..def5678 100644
--- a/KeenClientTD.podspec
+++ b/KeenClientTD.podspec
@@ -2,7 +2,7 @@ spec.name = 'KeenClientTD'
spec.version = '3.2.28'
spec.license = { :type => 'MIT' }
- spec.platforms = { :ios => "", :tvos => "" }
+ spec.platforms = { :ios => "5.0", :tvos => "5.0" }
spec.homepage = 'https://github.com/treasure-data/KeenClient-iOS'
spec.authors = { 'Mitsunori Komatsu' => 'mitsu@treasure-data.com' }
spec.summary = 'Keen iOS client library forked by TD.'
|
Set minimum iOS version on `platform` in the podspec file
|
diff --git a/app/models/flexibility_order.rb b/app/models/flexibility_order.rb
index abc1234..def5678 100644
--- a/app/models/flexibility_order.rb
+++ b/app/models/flexibility_order.rb
@@ -1,7 +1,9 @@ class FlexibilityOrder
def self.all
%w(power_to_power
+ mv_batteries
electric_vehicle
+ opac
pumped_storage
power_to_heat
power_to_heat_industry
|
Update flexibility order with new flex options
|
diff --git a/lib/file_blobs_rails/action_controller_data_streaming_extensions.rb b/lib/file_blobs_rails/action_controller_data_streaming_extensions.rb
index abc1234..def5678 100644
--- a/lib/file_blobs_rails/action_controller_data_streaming_extensions.rb
+++ b/lib/file_blobs_rails/action_controller_data_streaming_extensions.rb
@@ -28,6 +28,7 @@ send_data proxy.data, send_options
end
end
+ protected :send_file_blob
end # module FileBlobs::ActionControllerDataStreamingExtensions
end # namespace FileBlobs
|
Make send_file_blob protected, because send_data is also protected.
|
diff --git a/app/commands/v2/put_link_set.rb b/app/commands/v2/put_link_set.rb
index abc1234..def5678 100644
--- a/app/commands/v2/put_link_set.rb
+++ b/app/commands/v2/put_link_set.rb
@@ -4,22 +4,17 @@ def call
validate!
- content_id = links_params.fetch(:content_id)
+ content_id = link_params.fetch(:content_id)
- if (link_set = LinkSet.find_by(content_id: content_id))
- link_set.links = link_set.links
- .merge(links_params.fetch(:links))
- .reject {|_, links| links.empty? }
+ link_set = LinkSet.find_or_initialize_by(content_id: content_id)
- link_set.save!
+ link_set.links = link_set.links
+ .merge(link_params.fetch(:links))
+ .reject {|_, links| links.empty? }
- Success.new(links: link_set.links)
- else
- raise CommandError.new(
- code: 404,
- message: "Link set with content_id '#{content_id}' not found"
- )
- end
+ link_set.save!
+
+ Success.new(links: link_set.links)
end
private
@@ -36,10 +31,10 @@ }
}
}
- ) unless links_params[:links].present?
+ ) unless link_params[:links].present?
end
- def links_params
+ def link_params
payload
end
end
|
Allow the creation of linksets without a content item.
We can only currently speculate about the exact
workflows, i.e. whether links might be sent to the
publishing API before the main content item.
Since we don't have a confirmed need for constraining
the order of the pushes, we've opted to leave the
system open (and wrote less code in the process).
|
diff --git a/.chef/cookbook/_box/recipes/module_igbinary.rb b/.chef/cookbook/_box/recipes/module_igbinary.rb
index abc1234..def5678 100644
--- a/.chef/cookbook/_box/recipes/module_igbinary.rb
+++ b/.chef/cookbook/_box/recipes/module_igbinary.rb
@@ -10,5 +10,9 @@ end
link '/etc/php5/conf.d/20-igbinary.ini' do
- to '/etc/php5/mods-available/igbinary.ini'
+ to '../mods-available/igbinary.ini'
end
+
+service "php5-fpm" do
+ action :restart
+end
|
Make final optimizations for the igbinary recipe
|
diff --git a/lib/bandicoot.rb b/lib/bandicoot.rb
index abc1234..def5678 100644
--- a/lib/bandicoot.rb
+++ b/lib/bandicoot.rb
@@ -7,10 +7,10 @@
# Your code goes here...
module Bandicoot
- attr_reader :config
+ mattr_accessor :config
def self.included(receiver)
- config = Config.new
+ self.config = Config.new
receiver.extend Bandicoot::DSL
receiver.include Bandicoot::Processor
end
|
Add mattr accessor to main module
|
diff --git a/lib/bak-shell.rb b/lib/bak-shell.rb
index abc1234..def5678 100644
--- a/lib/bak-shell.rb
+++ b/lib/bak-shell.rb
@@ -11,8 +11,7 @@ require "rainbow/ext/string"
module BakShell
- # BACKUP_DIR = File.expand_path(File.join(ENV["HOME"], "bak"))
- BACKUP_DIR = File.expand_path(File.join(ENV["HOME"], "tmp", "bak"))
+ BACKUP_DIR = File.expand_path(File.join(ENV["HOME"], "bak"))
end
require_relative "./bak-shell/version"
|
Change the default backup dir
|
diff --git a/app/adapters/alma_adapter/marc_response.rb b/app/adapters/alma_adapter/marc_response.rb
index abc1234..def5678 100644
--- a/app/adapters/alma_adapter/marc_response.rb
+++ b/app/adapters/alma_adapter/marc_response.rb
@@ -6,15 +6,34 @@ # @param bibs [Alma::BibSet]
def initialize(bibs:)
@bibs = bibs
- remove_suppressed!
end
def unsuppressed_marc
- return [] unless bibs.present?
- MARC::XMLReader.new(bib_marc_xml).to_a
+ marc_records.reject(&:suppressed?)
+ end
+
+ class MarcRecord < SimpleDelegator
+ attr_reader :bib
+ def initialize(bib, marc_record)
+ super(marc_record)
+ @bib = bib
+ end
+
+ def suppressed?
+ bib["suppress_from_publishing"] == "true"
+ end
end
private
+
+ def marc_records
+ @marc_records ||=
+ begin
+ MARC::XMLReader.new(bib_marc_xml).to_a.each_with_index.map do |record, idx|
+ MarcRecord.new(bibs[idx], record)
+ end
+ end
+ end
def bib_marc_xml
StringIO.new(
@@ -23,11 +42,5 @@ end.join("")
)
end
-
- def remove_suppressed!
- bibs.reject! do |bib|
- bib["suppress_from_publishing"] == "true"
- end
- end
end
end
|
Refactor MARCResponse to return objects we control.
This should allow us to enrich the output in an OO way.
|
diff --git a/app/controllers/api/editions_controller.rb b/app/controllers/api/editions_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/editions_controller.rb
+++ b/app/controllers/api/editions_controller.rb
@@ -1,7 +1,11 @@ class Api::EditionsController < ApplicationController
-
+ only_allow_access_to :show,
+ :when => [:admin],
+ :denied_url => { :controller => 'admin/pages', :action => 'index' },
+ :denied_message => 'You must have admin privileges to perform this action.'
+
def show
- @edition = FabulatorEdition.find(:first, :conditions => [ "name = ?", params[:id] ])
+ @edition = FabulatorEdition.find(params[:id])
respond_to do |format|
format.json {
render :json => {
|
Add authz - only admin can download an edition
|
diff --git a/lib/cuba/mote.rb b/lib/cuba/mote.rb
index abc1234..def5678 100644
--- a/lib/cuba/mote.rb
+++ b/lib/cuba/mote.rb
@@ -1,31 +1,7 @@-# borrowed from:
-# https://github.com/harmoni-io/mote-render/blob/master/lib/mote/render.rb
module Mout
module Render
- include ::Mote::Helpers
-
def self.setup(app)
- app.settings[:template_engine] = "mote"
- end
-
- def render(template, locals = {}, layout = settings[:render][:layout])
- res.write(view(template, locals, layout))
- end
-
- def view(template, locals = {}, layout = settings[:render][:layout])
- partial(layout, locals.merge(content: partial(template, locals)))
- end
-
- def partial(template, locals = {})
- mote(mote_path(template), locals.merge(app: self), TOPLEVEL_BINDING)
- end
-
- def mote_path(template)
- if template.end_with?(".mote")
- template
- else
- File.join(settings[:render][:views], "#{template}.mote")
- end
+ app.settings[:render][:template_engine] = "mote"
end
end
end
|
Set the Cuba application templating engine to Mote.
That is really all the plugin should do. Nothing more.
|
diff --git a/lib/gothonweb.rb b/lib/gothonweb.rb
index abc1234..def5678 100644
--- a/lib/gothonweb.rb
+++ b/lib/gothonweb.rb
@@ -1,3 +1,5 @@+gem 'sinatra', '1.3.6'
+
require_relative "gothonweb/version"
require_relative "map"
require "sinatra"
|
Add gem dependency at the top
|
diff --git a/lib/onix/name.rb b/lib/onix/name.rb
index abc1234..def5678 100644
--- a/lib/onix/name.rb
+++ b/lib/onix/name.rb
@@ -6,19 +6,21 @@
xml_name "Name"
- xml_accessor :person_name_type, :from => "PersonNameType", :as => Fixnum, :to_xml => ONIX::Formatters.two_digit
- xml_accessor :person_name, :from => "PersonName"
- xml_accessor :person_name_inverted, :from => "PersonNameInverted"
- xml_accessor :titles_before_names, :from => "TitlesBeforeNames"
- xml_accessor :names_before_key, :from => "NamesBeforeKey"
- xml_accessor :prefix_to_key, :from => "PrefixToKey"
- xml_accessor :key_names, :from => "KeyNames"
- xml_accessor :names_after_key, :from => "NamesAfterKey"
- xml_accessor :suffix_to_key, :from => "SuffixToKey"
- xml_accessor :letters_after_names, :from => "LettersAfterNames"
- xml_accessor :titles_after_names, :from => "TitlesAfterNames"
- xml_accessor :person_name_id_type, :from => "PersonNameIDType", :as => Fixnum, :to_xml => ONIX::Formatters.two_digit
- xml_accessor :id_type_name, :from => "IDTypeName"
- xml_accessor :id_value, :from => "IDValue"
+ xml_accessor :person_name_type, :from => "PersonNameType", :as => Fixnum, :to_xml => ONIX::Formatters.two_digit
+ xml_accessor :person_name, :from => "PersonName"
+ xml_accessor :person_name_inverted, :from => "PersonNameInverted"
+ xml_accessor :titles_before_names, :from => "TitlesBeforeNames"
+ xml_accessor :names_before_key, :from => "NamesBeforeKey"
+ xml_accessor :prefix_to_key, :from => "PrefixToKey"
+ xml_accessor :key_names, :from => "KeyNames"
+ xml_accessor :names_after_key, :from => "NamesAfterKey"
+ xml_accessor :suffix_to_key, :from => "SuffixToKey"
+ xml_accessor :letters_after_names, :from => "LettersAfterNames"
+ xml_accessor :titles_after_names, :from => "TitlesAfterNames"
+ xml_accessor :person_name_identifiers, :from => "PersonNameIdentifier", :as => [ONIX::PersonNameIdentifier]
+
+ def initialize
+ self.person_name_identifiers = []
+ end
end
end
|
Correct mapping of PersonNameIdentifier under Name
|
diff --git a/lib/opencl/cl.rb b/lib/opencl/cl.rb
index abc1234..def5678 100644
--- a/lib/opencl/cl.rb
+++ b/lib/opencl/cl.rb
@@ -48,8 +48,8 @@ queues.first
end
- def create_buffer(type, size, options = 0)
- options ||= CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR
+ def create_buffer(type, size, options = nil)
+ options ||= CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR
buffer = Buffer.new(self, default_context, options, type, size)
@buffers << buffer
buffer
|
Use the host pointer over copying by default when creating a buffer
This continues to make the contents at the buffer's host pointer
modifiable until a kernel actually uses it.
|
diff --git a/lib/active_job/queue_adapters/sidekiq_adapter.rb b/lib/active_job/queue_adapters/sidekiq_adapter.rb
index abc1234..def5678 100644
--- a/lib/active_job/queue_adapters/sidekiq_adapter.rb
+++ b/lib/active_job/queue_adapters/sidekiq_adapter.rb
@@ -5,8 +5,11 @@ class SidekiqAdapter
class << self
def queue(job, *args)
- item = { 'class' => JobWrapper, 'queue' => job.queue_name, 'args' => [job, *args] }
- Sidekiq::Client.push(job.get_sidekiq_options.merge(item))
+ item = { 'class' => JobWrapper,
+ 'queue' => job.queue_name,
+ 'args' => [job, *args],
+ 'retry' => true }
+ Sidekiq::Client.push(item)
end
end
@@ -15,14 +18,9 @@
def perform(job_name, *args)
instance = job_name.constantize.new
- instance.jid = self.jid
instance.perform *Parameters.deserialize(args)
end
end
end
end
end
-
-class ActiveJob::Base
- include Sidekiq::Worker
-end
|
Remove all Sidekiq-specific stuff from job, enable retries by default
|
diff --git a/lib/log/event.rb b/lib/log/event.rb
index abc1234..def5678 100644
--- a/lib/log/event.rb
+++ b/lib/log/event.rb
@@ -3,7 +3,7 @@ module Log
class Event
- def initialize(name, monitored=false, context={})
+ def initialize(name, context, monitored: false)
@name = name
@monitored = monitored
@context = context
|
Make monitored a keyword argument
|
diff --git a/app/models/link.rb b/app/models/link.rb
index abc1234..def5678 100644
--- a/app/models/link.rb
+++ b/app/models/link.rb
@@ -4,7 +4,7 @@
field :url, :type => String
- references_many :comments
+ references_many :comments, :dependent => :destroy
referenced_in :user
validates :url, :presence => true
|
Add deletion dependency to comments
|
diff --git a/lib/rom/model.rb b/lib/rom/model.rb
index abc1234..def5678 100644
--- a/lib/rom/model.rb
+++ b/lib/rom/model.rb
@@ -1,3 +1,5 @@+require 'charlatan'
+
module ROM
module Model
class ValidationError < CommandError
|
Add charlatan as a dep
|
diff --git a/app/models/user.rb b/app/models/user.rb
index abc1234..def5678 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -17,6 +17,29 @@ has_gravatar :size => '80', :secure => false
+ # Public: Determine whether this user has voted on a given object before.
+ #
+ # This method examines the collection of votes associated with this user,
+ # returning true if the collection includes a vote on the object, and false if not.
+ #
+ # voteable - The voteable object (currently either question or answer) that should
+ # be checked for in the votes collection
+ #
+ # Returns true if the voteable exists in the collection of votes, and false if not
+ def voted_on?(voteable)
+ self.votes.where(:voteable => voteable)
+ end
+
+ # Public: Find the user record based on conditions passed to us by a devise controller.
+ #
+ # This method overrides a devise method to find the user record when logging in or resetting
+ # password. This method is overridden because we need to find the user by username OR email.
+ # This is done by querying on a virtual attribute named 'login'.
+ #
+ # conditions - The conditions passed to us by a devise controller - a hash of keys (attribute mames)
+ # and values (user-entered values)
+ #
+ # Returns the found user, or nil
def self.find_for_database_authentication(conditions)
where('email = ? OR username = ?', conditions[:login], conditions[:login]).first
end
|
Add voted_on? method and tomdoc all methods
|
diff --git a/app/models/user.rb b/app/models/user.rb
index abc1234..def5678 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -1,9 +1,9 @@ class User < ApplicationRecord
HONORIFICS = %w(
- Miss
Mr.
+ Ms.
Mrs.
- Ms.
+ Dr.
).freeze
# Include default devise modules. Others available are:
|
Remove Miss and add Dr to honorifics
|
diff --git a/lib/srvrouter.rb b/lib/srvrouter.rb
index abc1234..def5678 100644
--- a/lib/srvrouter.rb
+++ b/lib/srvrouter.rb
@@ -25,6 +25,6 @@ answers.each do |ans|
ret << "#{ans.target}:#{ans.port}"
end
- return ret
+ return ret.sort
end
end
|
Sort DNS results for less config file updates
|
diff --git a/app/decorators/author_decorator.rb b/app/decorators/author_decorator.rb
index abc1234..def5678 100644
--- a/app/decorators/author_decorator.rb
+++ b/app/decorators/author_decorator.rb
@@ -20,6 +20,10 @@ source.try :image
end
+ def link
+ author_path(source)
+ end
+
def large_image
source.avatar.large.url
end
|
Add link to author decorator
|
diff --git a/lib/cuba/render.rb b/lib/cuba/render.rb
index abc1234..def5678 100644
--- a/lib/cuba/render.rb
+++ b/lib/cuba/render.rb
@@ -34,7 +34,7 @@ #
def render(template, locals = {}, options = {}, &block)
_cache.fetch(template) {
- Tilt.new(template, 1, options)
+ Tilt.new(template, 1, options.merge(outvar: '@_output')
}.render(self, locals, &block)
end
|
Add output variable for Tilt (tizoc).
|
diff --git a/config/initializers/themenap.rb b/config/initializers/themenap.rb
index abc1234..def5678 100644
--- a/config/initializers/themenap.rb
+++ b/config/initializers/themenap.rb
@@ -7,7 +7,7 @@ :text => '<%= render "layouts/css_includes" %>',
:mode => :append },
{ :css => 'body',
- :mode => :setattr, :key => 'id', :value => 'social_science' },
+ :mode => :setattr, :key => 'class', :value => 'social_science' },
{ :css => 'html',
:text => '<%= render "layouts/js_includes" %>',
:mode => :append },
|
Set ADA colour theme correctly.
|
diff --git a/lib/car_guard.rb b/lib/car_guard.rb
index abc1234..def5678 100644
--- a/lib/car_guard.rb
+++ b/lib/car_guard.rb
@@ -20,7 +20,7 @@ end
post "/map/:api_key" do
- Location.create(JSON.parse(request.body.read))
+ Location.create(JSON.parse(request.body.read).merge(api_key: params[:api_key]))
"ok"
end
|
Save api key as well.
|
diff --git a/lib/dynadot/api.rb b/lib/dynadot/api.rb
index abc1234..def5678 100644
--- a/lib/dynadot/api.rb
+++ b/lib/dynadot/api.rb
@@ -20,10 +20,14 @@ data = response.parsed_response.split("\n")
data.delete_at(1)
- return {
- error: data[0, 2] != 'ok' ? data.shift.split(",")[1] : nil,
- results: data.map { |line| line.split(",") }
- }
+ error = data[0, 2] != 'ok' ? data.shift.split(",")[1] : nil
+ results = data.map { |line| line.split(",") }
+
+ if error
+ raise error
+ else
+ return results
+ end
end
end
end
|
Raise an exception if API call returns an error
|
diff --git a/Library/Homebrew/compat/tap.rb b/Library/Homebrew/compat/tap.rb
index abc1234..def5678 100644
--- a/Library/Homebrew/compat/tap.rb
+++ b/Library/Homebrew/compat/tap.rb
@@ -22,13 +22,13 @@ new_path = path
new_remote = default_remote
- ohai "Migrating Tap #{old_name} to #{new_name} …"
+ ohai "Migrating tap #{old_name} to #{new_name}..." if $stdout.tty?
- puts "Moving #{old_path} to #{new_path} …"
+ puts "Moving #{old_path} to #{new_path}..." if $stdout.tty?
path.dirname.mkpath
FileUtils.mv old_path, new_path
- puts "Changing remote from #{old_remote} to #{new_remote} …"
+ puts "Changing remote from #{old_remote} to #{new_remote}..." if $stdout.tty?
new_path.git_origin = new_remote
end
end
|
Use `...` instead of ellipsis and only output if TTY.
|
diff --git a/lib/githubber.rb b/lib/githubber.rb
index abc1234..def5678 100644
--- a/lib/githubber.rb
+++ b/lib/githubber.rb
@@ -10,7 +10,7 @@ module Githubber
# Your code goes here...
class App
-
+ attr_reader :teams, :issues
def initialize
puts "What is your auth token?"
token = gets.chomp
@@ -38,5 +38,6 @@ end
app = App.new
+
binding.pry
end
|
Add attr_reader for team and issues
|
diff --git a/lib/gui/event.rb b/lib/gui/event.rb
index abc1234..def5678 100644
--- a/lib/gui/event.rb
+++ b/lib/gui/event.rb
@@ -0,0 +1,94 @@+# Copyright 2014 Noel Cower
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# -----------------------------------------------------------------------------
+#
+# event.rb
+# Basic event class
+
+
+module GUI
+
+class EventCancellationError < StandardError ; end
+
+class Event
+
+ __Target__ = Struct.new(:p)
+
+ attr_reader :sender
+ attr_reader :kind
+ attr_reader :info
+ attr_accessor :target
+
+ class << self ; alias_method :[], :new ; end
+
+ def initialize(sender, kind, **info)
+ @sender = sender
+ @kind = kind
+ @info = info.freeze
+ @cancelled = false
+ @propagating = true
+ @target = info[target]
+ end
+
+ def method_missing(meth, *args)
+ if info.include?(meth) && args.empty?
+ info[meth]
+ else
+ raise NoMethodError, "No such method #{meth}"
+ end
+ end
+
+ def original_target
+ info[:target]
+ end
+
+ def cancellable?
+ true
+ end
+
+ def cancelled?
+ @cancelled
+ end
+
+ def propagating?
+ @propagating
+ end
+
+ def stop_propagation!
+ @propagating = false
+ self
+ end
+
+ def cancel!
+ if cancellable?
+ @cancelled = true
+ else
+ raise EventCancellationError, "Unable to cancel event"
+ end
+ self
+ end
+
+ def to_s
+ "(event (sender #{sender}) (kind #{kind})#{
+ ' ' unless @info.empty?
+ }#{
+ @info.map { |k,v| "(#{k} #{v})"}.join ' '
+ })"
+ end
+
+end # Event
+
+end # GUI
+
|
Add a basic Event class.
|
diff --git a/config/boot.rb b/config/boot.rb
index abc1234..def5678 100644
--- a/config/boot.rb
+++ b/config/boot.rb
@@ -6,6 +6,11 @@ require 'rubygems' unless defined?(Gem)
require 'bundler/setup'
Bundler.require(:default, RACK_ENV)
+
+if File.exist? 'config/app-cfg-params.yml'
+ conf_params = YAML.load_file 'config/app-cfg-params.yml'
+ conf_params.each {|key, value| ENV[key.gsub('.', '_').upcase] = value.to_s }
+end
Padrino.before_load do
I18n.enforce_available_locales = true
|
Load application configuration parameters from file.
|
diff --git a/font-awesome-rails.gemspec b/font-awesome-rails.gemspec
index abc1234..def5678 100644
--- a/font-awesome-rails.gemspec
+++ b/font-awesome-rails.gemspec
@@ -15,7 +15,7 @@ gem.require_paths = ["lib"]
gem.version = FontAwesome::Rails::VERSION
- gem.add_dependency "railties", ">= 3.2", "< 5.0"
+ gem.add_dependency "railties", ">= 3.2", "< 5.1"
gem.add_development_dependency "activesupport"
gem.add_development_dependency "sass-rails"
|
Raise railties dependency to be compatible with Rails 5
Signed-off-by: Clemens Gruber <dda41f46a19317797d2fa2442dc67d1578f8ace9@gmail.com>
|
diff --git a/lib/pcap/dumper.rb b/lib/pcap/dumper.rb
index abc1234..def5678 100644
--- a/lib/pcap/dumper.rb
+++ b/lib/pcap/dumper.rb
@@ -6,19 +6,28 @@ module PCap
class Dumper < FFI::MemoryPointer
- def self.open(path)
+ def initialize(dumper)
+ @dumper = dumper
end
def tell
- PCap.pcap_dump_ftell(self)
+ PCap.pcap_dump_ftell(@dumper)
end
def flush
- PCap.pcap_dump_flush(self)
+ PCap.pcap_dump_flush(@dumper)
end
def close
- PCap.pcap_dump_close(self)
+ PCap.pcap_dump_close(@dumper)
+ end
+
+ def to_ptr
+ @dumper
+ end
+
+ def inspect
+ "#<#{self.class}: 0x#{@dumper.to_s(16)}>"
end
end
|
Make Dumper more like Handler in how it wraps around a pointer.
|
diff --git a/lib/skyed/git.rb b/lib/skyed/git.rb
index abc1234..def5678 100644
--- a/lib/skyed/git.rb
+++ b/lib/skyed/git.rb
@@ -14,7 +14,7 @@ ENV['GIT_SSH'] = '/tmp/ssh-git'
path = "/tmp/skyed.#{SecureRandom.hex}"
r = ::Git.clone(stack[:custom_cookbooks_source][:url], path)
- puts repo_path(r)
+ puts Skyed::Init.repo_path(r)
path
end
end
|
INF-941: Add check if remore is cloned
|
diff --git a/lib/spinach/dsl.rb b/lib/spinach/dsl.rb
index abc1234..def5678 100644
--- a/lib/spinach/dsl.rb
+++ b/lib/spinach/dsl.rb
@@ -37,8 +37,6 @@
# @return [String] this feature's name
#
- def feature_name
- @feature_name
- end
+ attr_reader :feature_name
end
end
|
Refactor DSL to use attr_reader instead of defining a method
|
diff --git a/app/synchronizers/solidus_mailchimp_sync/product_synchronizer.rb b/app/synchronizers/solidus_mailchimp_sync/product_synchronizer.rb
index abc1234..def5678 100644
--- a/app/synchronizers/solidus_mailchimp_sync/product_synchronizer.rb
+++ b/app/synchronizers/solidus_mailchimp_sync/product_synchronizer.rb
@@ -13,12 +13,10 @@ end
def sync
- # We go ahead and try to create it. If it already existed, mailchimp
- # doesn't let us do an update, but we can update all variants.
post
rescue SolidusMailchimpSync::Error => e
if e.status == 400 && e.detail =~ /already exists/
- sync_all_variants
+ patch
else
raise e
end
|
Allow patch for updating products
|
diff --git a/lib/tic_tac_toe.rb b/lib/tic_tac_toe.rb
index abc1234..def5678 100644
--- a/lib/tic_tac_toe.rb
+++ b/lib/tic_tac_toe.rb
@@ -13,6 +13,14 @@ end
class Board
+ @@win_places = [[0, 1, 2],
+ [3, 4, 5],
+ [6, 7, 8],
+ [0, 3, 6],
+ [1, 4, 7],
+ [2, 5, 8],
+ [0, 4, 8],
+ [2, 4, 6]]
def initialize
@_marks = Array.new(9, " ")
|
Add data about winning index sets to Board
|
diff --git a/spec/lib/commands/edit_command_spec.rb b/spec/lib/commands/edit_command_spec.rb
index abc1234..def5678 100644
--- a/spec/lib/commands/edit_command_spec.rb
+++ b/spec/lib/commands/edit_command_spec.rb
@@ -6,23 +6,27 @@ it 'edits the Markdo root in your preferred editor' do
skip 'Shellwords not supported' unless defined?(Shellwords)
- out, err = build_command_support
- env = { 'EDITOR' => 'aneditor', 'MARKDO_ROOT' => 'spec/fixtures/' }
+ command_support = build_command_support_object({
+ 'EDITOR' => 'aneditor',
+ 'MARKDO_ROOT' => 'spec/fixtures/'
+ })
expect(Kernel).to receive(:system).with('aneditor spec/fixtures/')
- EditCommand.new(out, err, env).run
+ EditCommand.new(command_support).run
end
it 'does not allow unsafe values for MARKDO_ROOT' do
skip 'Shellwords not supported' unless defined?(Shellwords)
- out, err = build_command_support
- env = { 'EDITOR' => 'aneditor', 'MARKDO_ROOT' => '`ruin everything`' }
+ command_support = build_command_support_object({
+ 'EDITOR' => 'aneditor',
+ 'MARKDO_ROOT' => '`ruin everything`'
+ })
expect(Kernel).to receive(:system).with('aneditor \`ruin\ everything\`')
- EditCommand.new(out, err, env).run
+ EditCommand.new(command_support).run
end
end
end
|
Refactor: Replace data clump with class (in EditCommand)
|
diff --git a/spec/models/course/achievement_spec.rb b/spec/models/course/achievement_spec.rb
index abc1234..def5678 100644
--- a/spec/models/course/achievement_spec.rb
+++ b/spec/models/course/achievement_spec.rb
@@ -2,15 +2,12 @@
RSpec.describe Course::Achievement, type: :model do
it { is_expected.to have_many :conditions }
+ it { is_expected.to validate_presence_of :title }
+ it { is_expected.to belong_to(:creator).class_name User.name }
+ it { is_expected.to belong_to(:course).inverse_of :achievements }
let!(:instance) { create(:instance) }
with_tenant(:instance) do
- context 'when title is not present' do
- subject { build(:course_achievement, title: '') }
-
- it { is_expected.not_to be_valid }
- end
-
describe '.default_scope' do
before { Course::Achievement.delete_all }
|
Use shoulda to test achievement validations and its associations.
|
diff --git a/spec/features/public_access_spec.rb b/spec/features/public_access_spec.rb
index abc1234..def5678 100644
--- a/spec/features/public_access_spec.rb
+++ b/spec/features/public_access_spec.rb
@@ -0,0 +1,42 @@+require "rails_helper"
+
+feature "Public access to pages", type: :feature do
+ scenario "visitor can access the home page and datasets" do
+
+ visit root_path
+
+ expect(page).to have_content "Publish data easily, quickly and correctly"
+ expect(page).to have_content "Sign in with Github"
+
+ click_link "All datasets"
+
+ expect(page).to have_content "You currently have no datasets"
+ end
+
+ scenario "visitor can access the home page, API page and can see a list of datasets" do
+
+ FactoryGirl.create(:dataset, name: 'Woof', url: 'https://meow.com', owner_avatar: 'https://meow.com')
+
+ visit root_path
+
+ expect(page).to have_content "Publish data easily, quickly and correctly"
+ expect(page).to have_content "Sign in with Github"
+
+ click_link "All datasets"
+
+ expect(page).to have_content "Woof"
+ end
+
+
+ # scenario "visitor can access the home page API page" do
+ # # requires Javascript capybara...
+ # pending "awaiting set up for Javascript"
+
+ # # visit root_path
+
+ # # click_link "API"
+ # # wait_for_ajax
+
+ # # expect(page).to have_content 'Octopub API'
+ # end
+end
|
Test to check you can access pages when not signed in
|
diff --git a/spec/support/integration_context.rb b/spec/support/integration_context.rb
index abc1234..def5678 100644
--- a/spec/support/integration_context.rb
+++ b/spec/support/integration_context.rb
@@ -1,9 +1,13 @@ shared_context "integration" do
let :api do
+ ENV['API_URL'] = ENV['API_URL'] || 'https://store-vnh06c71.mybigcommerce.com'
+ ENV['API_USER'] = ENV['API_USER'] || 'apiuser'
+ ENV['API_PASS'] = ENV['API_PASS'] || '123456'
+
Bigcommerce::Api.new({
- store_url: ENV['API_URL'],
- username: ENV['API_USER'],
- api_key: ENV['API_PASS']
+ :store_url => ENV['API_URL'],
+ :username => ENV['API_USER'],
+ :api_key => ENV['API_PASS']
})
end
end
|
Set default environment vars to run recorded tests without config
Also fixes the 1.8.7 killing syntax that was exploding Travis CI.
|
diff --git a/lib/inherited_resources/dumb_responder.rb b/lib/inherited_resources/dumb_responder.rb
index abc1234..def5678 100644
--- a/lib/inherited_resources/dumb_responder.rb
+++ b/lib/inherited_resources/dumb_responder.rb
@@ -6,7 +6,7 @@ class DumbResponder
instance_methods.each do |m|
- undef_method m unless m =~ /^__/
+ undef_method m unless m =~ /^(__|object_id)/
end
# This is like a good husband, he will just listen everything that his wife
|
Fix warning message on DumbResponder
Signed-off-by: José Valim <0c2436ea76ed86e37cc05f66dea18d48ef390882@gmail.com>
|
diff --git a/db/migrate/20110902203823_add_allowed_children_cache_to_pages.rb b/db/migrate/20110902203823_add_allowed_children_cache_to_pages.rb
index abc1234..def5678 100644
--- a/db/migrate/20110902203823_add_allowed_children_cache_to_pages.rb
+++ b/db/migrate/20110902203823_add_allowed_children_cache_to_pages.rb
@@ -1,6 +1,6 @@ class AddAllowedChildrenCacheToPages < ActiveRecord::Migration
def self.up
- add_column :pages, :allowed_children_cache, :string, :default => ''
+ add_column :pages, :allowed_children_cache, :string, :limit => 1500, :default => ''
Page.reset_column_information
Page.find_each do |page|
page.save # update the allowed_children_cache
|
Set a sensible limit to the allowed_children_cache column (esp important for DB/2). Fixes GH-309.
|
diff --git a/db/migrate/20210312061728_add_replica_identity_for_pseudonyms.rb b/db/migrate/20210312061728_add_replica_identity_for_pseudonyms.rb
index abc1234..def5678 100644
--- a/db/migrate/20210312061728_add_replica_identity_for_pseudonyms.rb
+++ b/db/migrate/20210312061728_add_replica_identity_for_pseudonyms.rb
@@ -0,0 +1,32 @@+# frozen_string_literal: true
+#
+# Copyright (C) 2021 - present Instructure, Inc.
+#
+# This file is part of Canvas.
+#
+# Canvas is free software: you can redistribute it and/or modify it under
+# the terms of the GNU Affero General Public License as published by the Free
+# Software Foundation, version 3 of the License.
+#
+# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Affero General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+
+class AddReplicaIdentityForPseudonyms < ActiveRecord::Migration[6.0]
+ tag :postdeploy
+ disable_ddl_transaction!
+
+ def up
+ add_replica_identity 'Pseudonym', :account_id, 0
+ remove_index :pseudonyms, name: 'index_pseudonyms_on_account_id', if_exists: true
+ end
+
+ def down
+ add_index :pseudonyms, :account_id, algorithm: :concurrently, if_not_exists: true
+ remove_replica_identity 'Pseudonym'
+ end
+end
|
Set up replica identity index for Pseudonym
refs FOO-1171
flag=none
test plan:
- migration works up and down
- tests pass
Change-Id: I523528da85d0e3170e7b9d32b9e0a011987ae5d8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260533
Tested-by: Service Cloud Jenkins <9144042a601061f88f1e1d7a1753ea3e2972119d@instructure.com>
Reviewed-by: Cody Cutrer <c4fe2b1d90ef8f2548c8aeabfa633434316f0305@instructure.com>
QA-Review: Cody Cutrer <c4fe2b1d90ef8f2548c8aeabfa633434316f0305@instructure.com>
Product-Review: Cody Cutrer <c4fe2b1d90ef8f2548c8aeabfa633434316f0305@instructure.com>
|
diff --git a/spec/bulk_processor/row_chunker/boundary_spec.rb b/spec/bulk_processor/row_chunker/boundary_spec.rb
index abc1234..def5678 100644
--- a/spec/bulk_processor/row_chunker/boundary_spec.rb
+++ b/spec/bulk_processor/row_chunker/boundary_spec.rb
@@ -11,13 +11,15 @@
context 'when values differ on either side of the balanced boundary' do
let(:csv_str) do
- "user_id\n" \
- "1\n" \
- "2\n" \
- "3\n" \
- "4\n" \
- "5\n" \
- "6\n" \
+ %w[
+ user_id
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ ].join("\n")
end
it 'breaks the main array into the correct number of ranges' do
@@ -32,13 +34,15 @@
context 'when values are the same on either side of a balanced boundary' do
let(:csv_str) do
- "user_id\n" \
- "1\n" \
- "2\n" \
- "3\n" \
- "3\n" \
- "4\n" \
- "5\n" \
+ %w[
+ user_id
+ 1
+ 2
+ 3
+ 3
+ 4
+ 5
+ ].join("\n")
end
it 'breaks the main array into the correct number of ranges' do
|
Clean up CSV construction in specs
|
diff --git a/spec/features/admin/promotion_rule_store_spec.rb b/spec/features/admin/promotion_rule_store_spec.rb
index abc1234..def5678 100644
--- a/spec/features/admin/promotion_rule_store_spec.rb
+++ b/spec/features/admin/promotion_rule_store_spec.rb
@@ -9,7 +9,11 @@ it "Can add a store rule to a promotion" do
visit spree.edit_admin_promotion_path(promotion)
- select2 "Store", from: "Add rule of type"
+ if SolidusSupport.solidus_gem_version < Gem::Version.new('2.3.x')
+ select2 "Store", from: "Add rule of type"
+ else
+ select "Store", from: "Add rule of type"
+ end
within("#rules_container") { click_button "Add" }
select2_search store.name, from: "Choose Stores"
|
Fix for removed select2 on Solidus 2.3+
|
diff --git a/test/integration/woeid_test.rb b/test/integration/woeid_test.rb
index abc1234..def5678 100644
--- a/test/integration/woeid_test.rb
+++ b/test/integration/woeid_test.rb
@@ -18,10 +18,10 @@ end
end
- it "returns a hard 404 error if woeid is not a valid woeid" do
+ it "returns a hard 404 error if woeid does not exist" do
mocking_yahoo_woeid_info(222222) do
assert_raise(ActionController::RoutingError) do
- get '/es/woeid/222222/give' #woeid does not exist
+ get '/es/woeid/222222/give'
end
end
end
|
Remove the need for a comment by rewording test
|
diff --git a/mygithub.gemspec b/mygithub.gemspec
index abc1234..def5678 100644
--- a/mygithub.gemspec
+++ b/mygithub.gemspec
@@ -16,4 +16,8 @@ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.require_paths = ["lib"]
+
+ gem.add_dependency 'thor'
+ gem.add_dependency 'milkode'
+ gem.add_dependency 'github_api'
end
|
Add dependency 'thor', 'milkode', 'github_api'
|
diff --git a/app/models/fluentd/setting/in_forward.rb b/app/models/fluentd/setting/in_forward.rb
index abc1234..def5678 100644
--- a/app/models/fluentd/setting/in_forward.rb
+++ b/app/models/fluentd/setting/in_forward.rb
@@ -20,6 +20,13 @@ :bind, :port
]
end
+
+ def hidden_options
+ [
+ # We don't support TLS configuration via fluentd-ui for now.
+ :transport
+ ]
+ end
end
end
end
|
Drop TLS support for now
Signed-off-by: Kenji Okimoto <7a4b90a0a1e6fc688adec907898b6822ce215e6c@clear-code.com>
|
diff --git a/i18n-hygiene.gemspec b/i18n-hygiene.gemspec
index abc1234..def5678 100644
--- a/i18n-hygiene.gemspec
+++ b/i18n-hygiene.gemspec
@@ -9,4 +9,5 @@ s.homepage ='https://github.com/conversation/i18n-hygiene'
s.add_dependency 'i18n', ['~> 0.6', '>= 0.6.9']
+ s.add_development_dependency 'rspec', '~> 3.0'
end
|
Add development dependency on rspec
|
diff --git a/app/controllers/application.rb b/app/controllers/application.rb
index abc1234..def5678 100644
--- a/app/controllers/application.rb
+++ b/app/controllers/application.rb
@@ -10,6 +10,7 @@
before_filter :can_create?, :only => [:new, :create]
before_filter :can_edit?, :only => [:edit, :update, :destroy]
+ before_filter :current_network
map_resource :profile, :singleton => true, :class => "User", :find => :current_user
|
Load current_network in an ApplicationController before_filter
|
diff --git a/app/helpers/markdown_helper.rb b/app/helpers/markdown_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/markdown_helper.rb
+++ b/app/helpers/markdown_helper.rb
@@ -7,7 +7,7 @@ #TODO
if local_resources
# Local photo embeds
- markdown.gsub!(/!\[([^\[\]]*)\] ?\[([1-9]+)(:[A-Za-z]+)?\]/) {
+ markdown.gsub!(/!\[([^\[\]]*)\] ?\[([0-9]+)(:[A-Za-z]+)?\]/) {
if Photo.exists?($2.to_i)
image = Photo.find($2.to_i).image
url = image.thumb.url
@@ -17,7 +17,7 @@ }
# Link to person
- markdown.gsub!(/\[([^\[\]]+)\] ?\[@([1-9]+)\]/) {
+ markdown.gsub!(/\[([^\[\]]+)\] ?\[@([0-9]+)\]/) {
if Person.exists?($2.to_i)
person = Person.find($2.to_i)
url = url_for(person)
|
Update other regexes to work
|
diff --git a/files/private-chef-cookbooks/private-chef/recipes/show_config.rb b/files/private-chef-cookbooks/private-chef/recipes/show_config.rb
index abc1234..def5678 100644
--- a/files/private-chef-cookbooks/private-chef/recipes/show_config.rb
+++ b/files/private-chef-cookbooks/private-chef/recipes/show_config.rb
@@ -5,9 +5,9 @@ # All Rights Reserved
#
-if File.exists?("/etc/opscode/private-chef.rb")
+if File.exists?("/etc/opscode/chef-server.rb")
PrivateChef[:node] = node
- PrivateChef.from_file("/etc/opscode/private-chef.rb")
+ PrivateChef.from_file("/etc/opscode/chef-server.rb")
end
config = PrivateChef.generate_config(node['fqdn'])
|
Change of show-config recipe to point at new chef-server.rb
|
diff --git a/app/models/sighting_adapter.rb b/app/models/sighting_adapter.rb
index abc1234..def5678 100644
--- a/app/models/sighting_adapter.rb
+++ b/app/models/sighting_adapter.rb
@@ -0,0 +1,36 @@+class SightingAdapter
+ class << self
+ HOST = ENV['API_URL']
+ PATH = '/biomap/sightings'
+
+ def all
+ conn = Faraday.new(url: HOST)
+ response = conn.get do |req|
+ req.url PATH
+ req.params['sighting_id'] = '*'
+ req.params['user_id'] = '*'
+ end
+ response.body
+ end
+
+ def find_by_sighting_id(sighting_id)
+ conn = Faraday.new(url: HOST)
+ response = conn.get do |req|
+ req.url PATH
+ req.params['sighting_id'] = sighting_id
+ req.params['user_id'] = '*'
+ end
+ response.body
+ end
+
+ def find_by_user_id(user_id)
+ conn = Faraday.new(url: HOST)
+ response = conn.get do |req|
+ req.url PATH
+ req.params['sighting_id'] = '*'
+ req.params['user_id'] = user_id
+ end
+ response.body
+ end
+ end
+end
|
Add adapter class to get data from server
Parsing will be a separate class.
|
diff --git a/lib/rusic/cli.rb b/lib/rusic/cli.rb
index abc1234..def5678 100644
--- a/lib/rusic/cli.rb
+++ b/lib/rusic/cli.rb
@@ -1,6 +1,8 @@ require 'thor'
require 'pathname'
require 'filewatcher'
+require 'json'
+require 'awesome_print'
module Rusic
class CLI < Thor
@@ -36,6 +38,20 @@ end
end
+
+ desc "settings", "Display settings from a .rusic file"
+
+ def settings
+ filename = '.rusic'
+
+ if File.file?(filename)
+ file = IO.read filename
+ ap JSON.parse file
+ else
+ puts "The current directory does not contain an #{filename} file"
+ end
+ end
+
desc "version", "Display version of Rusic gem"
def version
puts Rusic::VERSION
|
Add a settings action to print .rusic file
|
diff --git a/jekyll_prism.gemspec b/jekyll_prism.gemspec
index abc1234..def5678 100644
--- a/jekyll_prism.gemspec
+++ b/jekyll_prism.gemspec
@@ -13,7 +13,7 @@ s.files = `git ls-files`.split
s.test_files = `git ls-files spec/*`.split
- s.add_dependency 'liquid', '~> 2.6.1'
+ s.add_dependency 'liquid', '~> 2.5.5'
s.add_development_dependency 'rubocop', '~> 0.24.0'
s.add_development_dependency 'rake', '~> 10.3.2'
|
Revert "jekyll joins the future"
This reverts commit 19b7d2a77a425456425f6aa04e6c3aba02e81785.
|
diff --git a/attributes/source.rb b/attributes/source.rb
index abc1234..def5678 100644
--- a/attributes/source.rb
+++ b/attributes/source.rb
@@ -17,7 +17,9 @@ # limitations under the License.
#
-default['git']['version'] = "1.7.12"
-default['git']['url'] = "https://github.com/gitster/git/tarball/v#{node['git']['version']}"
-default['git']['checksum'] = "382a4627ea79"
-default['git']['prefix'] = "/usr/local"
+git_version = '1.8.0'
+
+default['git']['version'] = git_version
+default['git']['url'] = "https://github.com/gitster/git/tarball/v#{git_version}"
+default['git']['checksum'] = '5d0ce3dacfd4'
+default['git']['prefix'] = '/usr/local'
|
Update Git to version 1.8.0
|
diff --git a/auth/app/controllers/users_controller.rb b/auth/app/controllers/users_controller.rb
index abc1234..def5678 100644
--- a/auth/app/controllers/users_controller.rb
+++ b/auth/app/controllers/users_controller.rb
@@ -21,8 +21,7 @@ end
update.wants.html { redirect_to account_url }
-
- update.flash I18n.t("account_updated")
+ update.flash { I18n.t("account_updated") }
private
def object
|
Fix flash message in users controller, it should be fetched in block, otherwise message is fetched while loading controller, before any locales are loaded.
|
diff --git a/boot.rb b/boot.rb
index abc1234..def5678 100644
--- a/boot.rb
+++ b/boot.rb
@@ -1,3 +1,5 @@+ENV['RACK_ENV'] ||= 'development'
+
$LOAD_PATH << File.dirname(__FILE__)
require 'bundler/setup'
|
Set rack env to dev by default
|
diff --git a/app/models/issue_trackers/cloudfuji_tracker.rb b/app/models/issue_trackers/cloudfuji_tracker.rb
index abc1234..def5678 100644
--- a/app/models/issue_trackers/cloudfuji_tracker.rb
+++ b/app/models/issue_trackers/cloudfuji_tracker.rb
@@ -7,6 +7,12 @@ :placeholder => "Ido ID of project to create task on"
}]
]
+
+ def check_params
+ if Fields.detect {|f| self[f[0]].blank? }
+ errors.add :base, 'You must specify your Project Ido ID'
+ end
+ end
def create_issue(problem, reported_by)
if ::Cloudfuji::Platform.on_cloudfuji?
@@ -32,12 +38,19 @@ ::Cloudfuji::Event.publish(event)
# Display 'pending' message until tracker responds with url
- problem.update_attribute :issue_link, "pending"
+ problem.update_attributes(
+ :issue_link => "pending",
+ :issue_type => Label
+ )
end
end
def body_template
@@body_template ||= ERB.new(File.read(File.expand_path("../../../views/issue_trackers/cloudfuji_body.txt.erb", __FILE__)).gsub(/^\s*/, ''))
end
+
+ def url
+ "http://cloudfuji.com"
+ end
end
end
|
Validate project Ido ID, store issue_type, provide url.
|
diff --git a/config/software/loom-ui.rb b/config/software/loom-ui.rb
index abc1234..def5678 100644
--- a/config/software/loom-ui.rb
+++ b/config/software/loom-ui.rb
@@ -8,7 +8,7 @@
build do
command "mkdir -p #{install_dir}/ui/bin"
- command "cp -fpPR bin/loom-ui.sh #{install_dir}/ui/bin"
+ command "sed -e 's:ui/embedded/bin:embedded/bin:g' bin/loom-ui.sh > #{install_dir}/ui/bin/loom-ui.sh"
command "mkdir -p #{install_dir}/ui/etc/logrotate.d"
command "cp -f /var/cache/omnibus/src/node*/LICENSE #{install_dir}/ui/LICENSE.node"
command "cp -f distribution/etc/logrotate.d/loom-ui #{install_dir}/ui/etc/logrotate.d"
|
Update UI build to fix path to node
|
diff --git a/rspec-exercise/calculator.rb b/rspec-exercise/calculator.rb
index abc1234..def5678 100644
--- a/rspec-exercise/calculator.rb
+++ b/rspec-exercise/calculator.rb
@@ -23,7 +23,7 @@ until tokens.empty?
case tokens.first
when /\d+/ # Integer
- value = tokens.shift.to_i # consume the token, then...
+ value = tokens.consume.to_i
case
when accumulator.nil? # should only be the first time through
accumulator = value
@@ -33,7 +33,7 @@ accumulator = accumulator.send(operator, value)
end
when /[\+\-\*\/]/ # Operator
- operator = tokens.shift.to_sym # consume the token
+ operator = tokens.consume.to_sym
else
raise "I don't understand #{expression.inspect}"
end
@@ -47,7 +47,11 @@ end
extend Forwardable
- def_delegators :tokens, :empty?, :first, :shift
+ def_delegators :tokens, :empty?, :first
+
+ def consume
+ tokens.shift
+ end
private
|
Make comments unnecessary by making Tokenizer's API more expressive
|
diff --git a/lib/how_is/config.rb b/lib/how_is/config.rb
index abc1234..def5678 100644
--- a/lib/how_is/config.rb
+++ b/lib/how_is/config.rb
@@ -3,14 +3,14 @@ require "yaml"
module HowIs
- HOME_CONFIG = File.join(Dir.home, '.config', 'how_is', 'config.yml')
+ HOME_CONFIG = File.join(Dir.home, ".config", "how_is", "config.yml")
# Usage:
# HowIs::Config
- # .with_site_configs('/path/to/config1.yml', '/path/to/config2.yml')
- # .load_file('./repo-config.yml')
+ # .with_site_configs("/path/to/config1.yml", "/path/to/config2.yml")
+ # .load_file("./repo-config.yml")
# Or:
- # HowIs::Config.with_defaults.load_file('./repo-config.yml')
+ # HowIs::Config.with_defaults.load_file("./repo-config.yml")
# Or:
# HowIs::Config.with_defaults.load({
# "repository" => "how-is/example-repository",
|
Use double quotes instead of single quotes.
|
diff --git a/lib/mollie/method.rb b/lib/mollie/method.rb
index abc1234..def5678 100644
--- a/lib/mollie/method.rb
+++ b/lib/mollie/method.rb
@@ -1,20 +1,22 @@ module Mollie
class Method < Base
- BANCONTACT = 'bancontact'.freeze
- BANKTRANSFER = 'banktransfer'.freeze
- BELFIUS = 'belfius'.freeze
- BITCOIN = 'bitcoin'.freeze
- CREDITCARD = 'creditcard'.freeze
- DIRECTDEBIT = 'directdebit'.freeze
- EPS = 'eps'.freeze
- GIFTCARD = 'giftcard'.freeze
- GIROPAY = 'giropay'.freeze
- IDEAL = 'ideal'.freeze
- INGHOMEPAY = 'inghomepay'.freeze
- KBC = 'kbc'.freeze
- PAYPAL = 'paypal'.freeze
- PAYSAFECARD = 'paysafecard'.freeze
- SOFORT = 'sofort'.freeze
+ BANCONTACT = 'bancontact'.freeze
+ BANKTRANSFER = 'banktransfer'.freeze
+ BELFIUS = 'belfius'.freeze
+ BITCOIN = 'bitcoin'.freeze
+ CREDITCARD = 'creditcard'.freeze
+ DIRECTDEBIT = 'directdebit'.freeze
+ EPS = 'eps'.freeze
+ GIFTCARD = 'giftcard'.freeze
+ GIROPAY = 'giropay'.freeze
+ IDEAL = 'ideal'.freeze
+ INGHOMEPAY = 'inghomepay'.freeze
+ KBC = 'kbc'.freeze
+ PAYPAL = 'paypal'.freeze
+ PAYSAFECARD = 'paysafecard'.freeze
+ SOFORT = 'sofort'.freeze
+ KLARNASLICEIT = 'klarnasliceit'.freeze
+ KLARNAPAYLATER = 'klarnapaylater'.freeze
attr_accessor :id,
:description,
|
Add klarnasliceit and klarnapaylater constants in Mollie::Methods
|
diff --git a/cookbooks/wt_monitoring/recipes/email_heartbeat.rb b/cookbooks/wt_monitoring/recipes/email_heartbeat.rb
index abc1234..def5678 100644
--- a/cookbooks/wt_monitoring/recipes/email_heartbeat.rb
+++ b/cookbooks/wt_monitoring/recipes/email_heartbeat.rb
@@ -11,5 +11,5 @@
cron "email_heartbeat" do
hour "*/6"
- command "echo \"At the tone the time will be $(date \\+\\%k:\\%M` on $(date \\+\\%Y-\\%m-\\%d)\" | /bin/mail -s \"Nagios 4hr Heartbeat - $(date \\+\\%k:\\%M)\" #{node['wt_common']['admin_email']}"
+ command "echo \"At the tone the time will be $(date \\+\\%k:\\%M) on $(date \\+\\%Y-\\%m-\\%d)\" | /bin/mail -s \"Nagios 4hr Heartbeat - $(date \\+\\%k:\\%M)\" #{node['wt_common']['admin_email']}"
end
|
Tweak the cron job for the nagios heartbeat
|
diff --git a/ci_environment/docker/recipes/default.rb b/ci_environment/docker/recipes/default.rb
index abc1234..def5678 100644
--- a/ci_environment/docker/recipes/default.rb
+++ b/ci_environment/docker/recipes/default.rb
@@ -11,15 +11,15 @@ include_recipe 'travis_build_environment'
apt_repository 'docker' do
- uri 'https://get.docker.io/ubuntu'
- distribution 'docker'
+ uri 'https://apt.dockerproject.org/repo'
+ distribution 'ubuntu-trusty'
components ['main']
- key 'https://get.docker.io/gpg'
+ key 'https://apt.dockerproject.org/gpg'
action :add
end
-docker_pkg = 'lxc-docker'
-docker_pkg += "-#{node['docker']['version']}" if node['docker']['version']
+docker_pkg = 'docker-engine'
+# TODO docker_pkg += "-#{node['docker']['version']}" if node['docker']['version']
package %W(linux-image-extra-#{`uname -r`.chomp} lxc #{docker_pkg})
|
Switch from get.docker.io over to apt.dockerproject.org
|
diff --git a/ci_environment/sbt/attributes/default.rb b/ci_environment/sbt/attributes/default.rb
index abc1234..def5678 100644
--- a/ci_environment/sbt/attributes/default.rb
+++ b/ci_environment/sbt/attributes/default.rb
@@ -1,4 +1,4 @@ # 5 minutes to install sbt's own dependencies under ~/.sbt/boot. MK.
default[:sbt][:boot][:timeout] = 300
-default[:sbt][:scala][:versions] = ["2.9.1", "2.8.2"]
+default[:sbt][:scala][:versions] = ["2.9.1", "2.9.0-1", "2.8.2", "2.8.1"]
|
Add two more Scala versions we pre-download
People seem to be testing against them
|
diff --git a/lib/rspec-sidekiq.rb b/lib/rspec-sidekiq.rb
index abc1234..def5678 100644
--- a/lib/rspec-sidekiq.rb
+++ b/lib/rspec-sidekiq.rb
@@ -3,5 +3,4 @@ require "rspec/sidekiq/configuration"
require "rspec/sidekiq/matchers"
require "rspec/sidekiq/sidekiq"
-require "rspec/sidekiq/batch"
-require "rspec/sidekiq/version"
+require "rspec/sidekiq/batch"
|
Revert "require version file to make spec pass"
This reverts commit 72ac8df5f937803c6668a87f39a6bb4b18509072.
|
diff --git a/lib/tasks/specs.rake b/lib/tasks/specs.rake
index abc1234..def5678 100644
--- a/lib/tasks/specs.rake
+++ b/lib/tasks/specs.rake
@@ -10,7 +10,7 @@ end
def execute_rspec_for_engine(engine_path)
- system "cd #{engine_path.expand_path} && bundle exec rspec"
+ system "cd #{engine_path.expand_path} && DISABLE_KNAPSACK=true bundle exec rspec"
end
engine_paths = detect_engine_paths
|
Disable Knapsack when running engine RSpec tests
|
diff --git a/lib/webtail/stdin.rb b/lib/webtail/stdin.rb
index abc1234..def5678 100644
--- a/lib/webtail/stdin.rb
+++ b/lib/webtail/stdin.rb
@@ -6,6 +6,7 @@ "<" => "<",
">" => ">",
}
+ ENTITY_KEYS_REGEXP = Regexp.union(ENTITY_MAP.keys)
def run
STDIN.each do |line|
@@ -22,7 +23,7 @@ end
def unescape_entity(str)
- str.gsub(Regexp.union(ENTITY_MAP.keys)) {|key| ENTITY_MAP[key] }
+ str.gsub(ENTITY_KEYS_REGEXP) {|key| ENTITY_MAP[key] }
end
end
end
|
Improve unefficient regexp in Webtail::Stdin
|
diff --git a/db/migrate/20151008212543_migrate_news_to_posts.rb b/db/migrate/20151008212543_migrate_news_to_posts.rb
index abc1234..def5678 100644
--- a/db/migrate/20151008212543_migrate_news_to_posts.rb
+++ b/db/migrate/20151008212543_migrate_news_to_posts.rb
@@ -17,13 +17,15 @@
activities = RecentActivity.where(trackable_type: 'News', trackable_id: n[NEWS_ID])
activities.each do |act|
- act.update_attributes trackable_type: 'Post', trackable_id: post.id
+ act.update_attributes trackable_type: 'Post', trackable_id: post.id, key: 'post.create'
# add the creator of the activity as the post author
post.update_attributes author: act.recipient, created_at: n[NEWS_CREATED_AT], updated_at: n[NEWS_UPDATED_AT]
end
end
Post.record_timestamps = true
+ # in case there are still activities for news that were removed, remove them
+ RecentActivity.destroy_all(key: 'news.create')
end
def down
|
Fix migrating recent activities for news, keys were not being updated
refs #1046
|
diff --git a/db/migrate/20180416223444_update_meeting_scores.rb b/db/migrate/20180416223444_update_meeting_scores.rb
index abc1234..def5678 100644
--- a/db/migrate/20180416223444_update_meeting_scores.rb
+++ b/db/migrate/20180416223444_update_meeting_scores.rb
@@ -0,0 +1,8 @@+class UpdateMeetingScores < ActiveRecord::Migration[5.1]
+ def change
+ StanceChoice.joins(:poll)
+ .where("polls.poll_type": :meeting)
+ .where(score: 1)
+ .update_all(score: 2)
+ end
+end
|
Migrate meeting stances to 'yes'
|
diff --git a/recipes/default.rb b/recipes/default.rb
index abc1234..def5678 100644
--- a/recipes/default.rb
+++ b/recipes/default.rb
@@ -18,6 +18,8 @@ # limitations under the License.
#
+Chef::Log.error('The default rundeck recipe is for testing purposes only. Caveat emptor.')
+
rundeck node['rundeck']['node_name'] do
cli_password 'password'
end
|
Add an message about only using this for testing (for now).
|
diff --git a/spec/lib/project_statuses_trimmer_spec.rb b/spec/lib/project_statuses_trimmer_spec.rb
index abc1234..def5678 100644
--- a/spec/lib/project_statuses_trimmer_spec.rb
+++ b/spec/lib/project_statuses_trimmer_spec.rb
@@ -14,7 +14,7 @@ end
it 'reduces the number of project statuses to the newest N requested amount for each project' do
- subject.run(10)
+ ProjectStatusesTrimmer.run(10)
expect(ProjectStatus.count).to eq(35)
end
end
|
Fix broken test for payload_log_entry trimming
[#92367008]
|
diff --git a/lib/rrj/janus/type_data.rb b/lib/rrj/janus/type_data.rb
index abc1234..def5678 100644
--- a/lib/rrj/janus/type_data.rb
+++ b/lib/rrj/janus/type_data.rb
@@ -0,0 +1,21 @@+# frozen_string_literal: true
+
+module RubyRabbitmqJanus
+ # Format data with type corresponding
+ class TypeData
+ def initialize(type, value)
+ @type = type
+ @value = value
+ end
+
+ # Cast a string
+ def format
+ case @type
+ when '<number>'
+ @value.to_i
+ when '<string>'
+ @value.to_s
+ end
+ end
+ end
+end
|
Add class for casting a format to string
|
diff --git a/lib/seed_scatter/engine.rb b/lib/seed_scatter/engine.rb
index abc1234..def5678 100644
--- a/lib/seed_scatter/engine.rb
+++ b/lib/seed_scatter/engine.rb
@@ -5,7 +5,12 @@ paths["db/seeds.rb"].each do |seed_file|
puts seed_file
load(seed_file)
+ if ActiveRecord::Base.connection.adapter_nameeql?('PostgreSQL')
+ table_name = seed_file.gsub(/\.rb$/,'')
+ ActiveRecord::Base.connection.reset_pk_sequence!(table_name)
+ end
end
+
end
end
end
|
Reset sequences after running creates for Postgres.
|
diff --git a/lib/suppliers/tib/order.rb b/lib/suppliers/tib/order.rb
index abc1234..def5678 100644
--- a/lib/suppliers/tib/order.rb
+++ b/lib/suppliers/tib/order.rb
@@ -12,11 +12,14 @@ tib_prefix = 3
end
+ logger.debug "------------ Prefix = #{config.order_prefix}"
+ logger.debug "------------ tib_prefix = #{tib_prefix}"
+
request = current_request
SendIt.tib_request self, {
:not_available_link => @path_controller.order_url(self),
- :order_id => "#{config.tib_prefix}#{'%09d' % self.id}",
+ :order_id => "#{tib_prefix}#{'%09d' % self.id}",
:from => config.tib.from_mail,
:to => config.tib.order_mail
}
|
TIB: Add logger info for tib_prefix
|
diff --git a/lib/tasks/backend_ids.rake b/lib/tasks/backend_ids.rake
index abc1234..def5678 100644
--- a/lib/tasks/backend_ids.rake
+++ b/lib/tasks/backend_ids.rake
@@ -1,7 +1,13 @@ namespace :backend_ids do
task fix: :environment do
affected_base_paths = %w(
- /government/statistics/announcements/farming-statistics-provisional-crop-areas-yields-and-livestock-populations-at-1-june-2019-uk
+ /government/statistics/labour-market-statistics-may-2015
+ /government/statistics/equality-statistics-for-the-northern-ireland-civil-service-1-jan-2017
+ /government/statistics/personnel-statistics-for-the-nics-based-on-staff-in-post-at-1-april-2017
+ /government/statistics/announcements/animal-feed-production-for-great-britain-august-2016
+ /government/statistics/announcements/vocational-and-other-qualifications-quarterly-january-to-march-2017
+ /government/statistics/announcements/weekly-all-cause-mortality-surveillance-weeks-ending-6-august-2017-and-13-august-2017
+ /government/publications/information-on-plans-for-payment-by-results-in-2013-to-2014
)
affected_base_paths.each do |base_path|
|
Revert "Correct backend_id for statistics pages"
|
diff --git a/test/integration/search_test.rb b/test/integration/search_test.rb
index abc1234..def5678 100644
--- a/test/integration/search_test.rb
+++ b/test/integration/search_test.rb
@@ -35,6 +35,33 @@ end
end
+ test 'no published posts should be hide' do
+ create_post(site: @current_site,
+ title: 'post1 is published',
+ body: 'body...')
+ create_post(site: @current_site,
+ title: 'post2 is not published',
+ body: 'body...',
+ published_at: Time.now.since(1.hour))
+ create_post(site: @current_site,
+ title: 'post3 is published',
+ body: 'body...')
+
+ visit '/'
+
+ fill_in 'query[keywords]', with: 'body'
+
+ click_on 'search'
+
+ within('main') do
+ assert_equal '「body」を含む記事は2件見つかりました。', find('p').text
+ within('ol') do
+ assert find_link('post1 is published')
+ assert find_link('post3 is published')
+ end
+ end
+ end
+
private
def create_post(attributes)
|
Add a test for not published post
|
diff --git a/lib/timestamp_api/utils.rb b/lib/timestamp_api/utils.rb
index abc1234..def5678 100644
--- a/lib/timestamp_api/utils.rb
+++ b/lib/timestamp_api/utils.rb
@@ -1,7 +1,7 @@ module TimestampAPI
module Utils
def camelize(symbol)
- symbol.to_s.split('_').each_with_index.map{ |chunk, idx| idx == 0 ? chunk : chunk.capitalize }.join
+ symbol.to_s.split('_').each_with_index.map{ |chunk, idx| idx == 0 ? chunk : chunk.capitalize }.join.gsub(/^\w/, &:downcase)
end
end
end
|
Fix a bug where camelization did not properly force first letter to be lowercase
|
diff --git a/test/lib/tasks/code_quality_html_reports_test.rb b/test/lib/tasks/code_quality_html_reports_test.rb
index abc1234..def5678 100644
--- a/test/lib/tasks/code_quality_html_reports_test.rb
+++ b/test/lib/tasks/code_quality_html_reports_test.rb
@@ -0,0 +1,26 @@+# frozen_string_literal: true
+require 'test_helper'
+class CodeQualityHtmlReportsRakeTaskTest < ActiveSupport::TestCase
+
+ setup do
+ require 'rake'
+ Rake::Task.define_task :environment
+ Rails.application.load_tasks
+ end
+
+ teardown do
+ Rake::Task.clear
+ FileUtils.rm_rf(Rails.root + 'public/reports')
+ end
+
+ test 'rake pc_reports:html is generating reports' do
+ Rake::Task['pc_reports:html'].reenable
+ Rake::Task['pc_reports:html'].invoke
+ assert File.exist?(Rails.root + 'public/reports/rubocop.html')
+ assert File.exist?(Rails.root + 'public/reports/ruby_critic/overview.html')
+ assert File.exist?(Rails.root + 'public/reports/tests/index.html')
+ assert File.exist?(Rails.root + 'public/reports/rails_best_practices.html')
+ assert File.exist?(Rails.root + 'public/reports/brakeman.html')
+ assert File.exist?(Rails.root + 'public/reports/simplecov/index.html')
+ end
+end
|
Cover rake tasks with tests
|
diff --git a/test/rubygems/comparator/test_spec_comparator.rb b/test/rubygems/comparator/test_spec_comparator.rb
index abc1234..def5678 100644
--- a/test/rubygems/comparator/test_spec_comparator.rb
+++ b/test/rubygems/comparator/test_spec_comparator.rb
@@ -19,6 +19,15 @@ end
def test_licenses_comparison
- assert_equal @report['licenses'].header.data, 'DIFFERENT licenses:'
+ assert_equal 'DIFFERENT license:', @report['license'].header.data
+ assert_equal 'DIFFERENT licenses:', @report['licenses'].header.data
+ assert_equal '0.0.1: MIT', @report['license'].all_messages[1].data
+ assert_equal '0.0.2: GPLv2', @report['license'].all_messages[2].data
+ assert_equal '0.0.3: GPLv2', @report['license'].all_messages[3].data
+ assert_equal '0.0.4: GPLv2', @report['license'].all_messages[4].data
+ assert_equal '0.0.1: MIT', @report['licenses'].all_messages[1].data
+ assert_equal '0.0.2: GPLv2', @report['licenses'].all_messages[2].data
+ assert_equal '0.0.3: GPLv2', @report['licenses'].all_messages[3].data
+ assert_equal '0.0.4: GPLv2', @report['licenses'].all_messages[4].data
end
end
|
Test the full license report
|
diff --git a/core/app/models/spree/stock/splitter/weight.rb b/core/app/models/spree/stock/splitter/weight.rb
index abc1234..def5678 100644
--- a/core/app/models/spree/stock/splitter/weight.rb
+++ b/core/app/models/spree/stock/splitter/weight.rb
@@ -2,8 +2,6 @@ module Stock
module Splitter
class Weight < Spree::Stock::Splitter::Base
- attr_reader :packer, :next_splitter
-
cattr_accessor :threshold do
150
end
|
Remove redundant attr_reader from Splitter::Weight
These attributes were already declared on the superclass
|
diff --git a/test/the_community_farm_test.rb b/test/the_community_farm_test.rb
index abc1234..def5678 100644
--- a/test/the_community_farm_test.rb
+++ b/test/the_community_farm_test.rb
@@ -1,11 +1,7 @@ require 'test_helper'
-class TheCommunityFarmTest < Minitest::Test
- def test_that_it_has_a_version_number
- refute_nil ::TheCommunityFarm::VERSION
- end
-
- def test_it_does_something_useful
- assert false
+describe TheCommunityFarm do
+ it 'has a version number' do
+ ::TheCommunityFarm::VERSION.wont_be_nil
end
end
|
Switch to describe syntax in tests
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.