diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/mongo_followable.gemspec b/mongo_followable.gemspec
index abc1234..def5678 100644
--- a/mongo_followable.gemspec
+++ b/mongo_followable.gemspec
@@ -14,6 +14,7 @@ s.rubyforge_project = "mongo_followable"
s.add_development_dependency('rspec', '> 2.7.0')
+ s.add_development_dependency('rake')
s.add_development_dependency('mongoid')
s.add_development_dependency('mongo_mapper')
s.add_development_dependency('bson_ext', '> 1.5.0')
|
Add rake to gemspec dev dependencies for travis.
|
diff --git a/test/integration/default/serverspec/default_spec.rb b/test/integration/default/serverspec/default_spec.rb
index abc1234..def5678 100644
--- a/test/integration/default/serverspec/default_spec.rb
+++ b/test/integration/default/serverspec/default_spec.rb
@@ -2,7 +2,7 @@
# Write integration tests with Serverspec - http://serverspec.org/
describe "drupal-solr::default" do
- it "does something" do
- pending "Replace this with meaningful tests"
+ describe port(8080) do
+ it { should be_listening }
end
end
|
Add test to check port 8080
|
diff --git a/test/integration/default/serverspec/default_spec.rb b/test/integration/default/serverspec/default_spec.rb
index abc1234..def5678 100644
--- a/test/integration/default/serverspec/default_spec.rb
+++ b/test/integration/default/serverspec/default_spec.rb
@@ -17,16 +17,48 @@ end
end
-describe command('/usr/local/bin/ruby --version') do
- it { should return_stdout(/^ruby 2\.1\.1(.+)/) }
+context 'ccache' do
+ describe file('/usr/local/bin/ccache') do
+ it { should be_executable }
+ end
+
+ describe command('/usr/local/bin/ccache --version') do
+ it { should return_stdout(/3\.1\.9/) }
+ end
+
+ %w[gcc g++ cc c++].each do |compiler|
+ describe file("/usr/local/bin/#{compiler}") do
+ it { should be_linked_to '/usr/local/bin/ccache' }
+ end
+ end
end
-describe file('/usr/local/bin/ccache') do
- it { should be_executable }
+context 'ruby' do
+ describe command('which ruby') do
+ it { should return_stdout('/bin/ruby') }
+ end
+
+ describe command('/usr/local/bin/ruby --version') do
+ it { should return_stdout(/^ruby 2\.1\.1(.+)/) }
+ end
end
-%w[gcc g++ cc c++].each do |compiler|
- describe file("/usr/local/bin/#{compiler}") do
- it { should be_linked_to '/usr/local/bin/ccache' }
+context 'bash' do
+ describe command('which bash') do
+ it { should return_stdout('/bin/bash') }
+ end
+
+ describe command('/usr/local/bin/bash --version') do
+ it { should return_stdout(/4\.3/) }
end
end
+
+context 'git' do
+ describe command('which git') do
+ it { should return_stdout('/bin/git') }
+ end
+
+ describe command('/usr/local/bin/git --version') do
+ it { should return_stdout(/1\.9\.0/) }
+ end
+end
|
Add more ServerSpec tests for git, bash, and ccache
|
diff --git a/spec/generators/views/views_generator_spec.rb b/spec/generators/views/views_generator_spec.rb
index abc1234..def5678 100644
--- a/spec/generators/views/views_generator_spec.rb
+++ b/spec/generators/views/views_generator_spec.rb
@@ -0,0 +1,30 @@+require 'spec_helper'
+
+require 'generators/model_base/views/views_generator'
+
+describe ModelBase::Generators::ViewsGenerator, type: :generator do
+ destination File.expand_path('../../../tmp', File.dirname(__FILE__))
+ arguments %w(verbose)
+
+ before { prepare_destination }
+
+ it 'creates a test initializer' do
+ run_generator %w(projects)
+
+ assert_file 'app/views/projects/_form.html.erb', /\<\%\= form_for.*\%\>/
+ assert_file 'app/views/projects/edit.html.erb', /render 'projects\/form'/
+ assert_file 'app/views/projects/index.html.erb', /\<table.*\>/
+ assert_file 'app/views/projects/new.html.erb', /render 'projects\/form'/
+ assert_file 'app/views/projects/show.html.erb', /\<dl .*\>/
+ end
+
+ it 'creates a test initializer' do
+ run_generator %w(issues)
+
+ assert_file 'app/views/issues/_form.html.erb', /\<\%\= form_for.*\%\>/
+ assert_file 'app/views/issues/edit.html.erb', /render 'issues\/form'/
+ assert_file 'app/views/issues/index.html.erb', /\<table.*\>/
+ assert_file 'app/views/issues/new.html.erb', /render 'issues\/form'/
+ assert_file 'app/views/issues/show.html.erb', /\<dl .*\>/
+ end
+end
|
Add spec for model_base:views generator
|
diff --git a/spec/github_cli/commands/repositories_spec.rb b/spec/github_cli/commands/repositories_spec.rb
index abc1234..def5678 100644
--- a/spec/github_cli/commands/repositories_spec.rb
+++ b/spec/github_cli/commands/repositories_spec.rb
@@ -0,0 +1,38 @@+# encoding: utf-8
+
+require 'spec_helper'
+
+describe GithubCLI::Commands::Repositories do
+ let(:format) { 'table' }
+ let(:user) { 'peter-murach' }
+ let(:repo) { 'github_cli' }
+ let(:org) { 'rails' }
+ let(:api_class) { GithubCLI::Repository }
+
+ it "invokes repo:list" do
+ api_class.should_receive(:all).with({}, format)
+ subject.invoke "repo:list", []
+ end
+
+ it "invokes repo:list --org" do
+ api_class.should_receive(:all).with({"org" => org}, format)
+ subject.invoke "repo:list", [], :org => org
+ end
+
+ it "invokes repo:list --user" do
+ api_class.should_receive(:all).with({"user" => user}, format)
+ subject.invoke "repo:list", [], :user => user
+ end
+
+ it "invokes repo:list --user --type --sort --direction" do
+ api_class.should_receive(:all).with({"user" => user, "type" => "owner",
+ "sort" => "created", "direction" => "asc"}, format)
+ subject.invoke "repo:list", [], :user => user, :type => "owner",
+ :sort => "created", :direction => "asc"
+ end
+
+ it "invokes repo:get" do
+ api_class.should_receive(:get).with(user, repo, {}, format)
+ subject.invoke "repo:get", [user, repo]
+ end
+end
|
Add repo listing command specs.
|
diff --git a/spec/system/shared_examples/redis_instance.rb b/spec/system/shared_examples/redis_instance.rb
index abc1234..def5678 100644
--- a/spec/system/shared_examples/redis_instance.rb
+++ b/spec/system/shared_examples/redis_instance.rb
@@ -21,7 +21,7 @@ else
expect {
service_client.run(command)
- }.to raise_error(/unknown command '#{command}'/)
+ }.to raise_error(/unknown command `#{command}`/)
end
end
end
|
Update error message to reflect switch from single quotes to backticks
[#159764090]
Signed-off-by: Sarah Connor <df3768d6ee4349d41e20c7bd8dfa6947d0a1c2b9@pivotal.io>
|
diff --git a/lib/redditkit/response/parse_json.rb b/lib/redditkit/response/parse_json.rb
index abc1234..def5678 100644
--- a/lib/redditkit/response/parse_json.rb
+++ b/lib/redditkit/response/parse_json.rb
@@ -13,7 +13,7 @@ # an application/json header, we want to return the body itself if the
# JSON parsing fails, because the response is still likely useful.
def parse(body)
- MultiJson.load(body, :symbolize_names => true) unless body.nil?
+ MultiJson.load(body, :symbolize_keys => true) unless body.nil?
rescue MultiJson::LoadError
body
end
|
Correct option for MultiJSON is :symbolize_keys not :symbolize_name
|
diff --git a/packages/react-native/BugsnagReactNative.podspec b/packages/react-native/BugsnagReactNative.podspec
index abc1234..def5678 100644
--- a/packages/react-native/BugsnagReactNative.podspec
+++ b/packages/react-native/BugsnagReactNative.podspec
@@ -1,5 +1,7 @@ require "json"
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
+bugsnag_cocoa_podspec = JSON.parse(File.read(File.join(__dir__, "ios", "vendor", "bugsnag-cocoa", "Bugsnag.podspec.json")))
+
Pod::Spec.new do |s|
s.name = "BugsnagReactNative"
s.version = package["version"]
@@ -12,7 +14,10 @@ s.source = { :git => "https://github.com/bugsnag/bugsnag-js.git", :tag => "v#{s.version}" }
s.source_files = "ios/BugsnagReactNative/**/*.{h,m}",
"ios/vendor/bugsnag-cocoa/**/*.{h,mm,m,cpp,c}",
- s.public_header_files = "ios/vendor/bugsnag-cocoa/Bugsnag/**/*.h"
+ s.public_header_files =
+ bugsnag_cocoa_podspec["public_header_files"]
+ .map { |str| "ios/vendor/bugsnag-cocoa/#{str}" }
+ .join(',')
s.header_dir = 'Bugsnag'
s.requires_arc = true
s.dependency "React"
|
feat(react-native): Copy public_header_paths from bugsnag-cocoa podspec
|
diff --git a/lib/talia_core/macro_contribution.rb b/lib/talia_core/macro_contribution.rb
index abc1234..def5678 100644
--- a/lib/talia_core/macro_contribution.rb
+++ b/lib/talia_core/macro_contribution.rb
@@ -1,22 +1,32 @@-module TaliaCore
-
- # This represents a macrocontribution.
- #
- # Everything valid for a normal source is also valid here
- #
- # It offers some methods for dealing with Macrocontributions
+module TaliaCore #:nodoc:
+ # A +MacroContribution+ is a generic collection of sources.
class MacroContribution < Source
-
- def initialize(uri, *types)
+ SOURCE_PREDICATE = N::HYPER::hasAsPart
+
+ def initialize(uri, *types) #:nodoc:
super(uri, *types)
self.primary_source = false
end
- # Used to add a new source to this macrcontribution.
- # The adding is done by just creating a new RDF triple.
- def add_source(new_source_uri)
- new_source = Source.new(new_source_uri)
- new_source[N::HYPER::isPartOfMacrocontribution] << self
- new_source.save!
+
+ def sources #:nodoc:
+ @sources ||= self[SOURCE_PREDICATE]
+ end
+
+ # Add a +Source+ to the collection
+ def add(source)
+ raise ArgumentError unless source
+ case source
+ when String
+ self.add Source.new(source)
+ else
+ sources << source
+ end
+ end
+ alias_method :<<, :add
+
+ # Remove the given +Source+ from the collection.
+ def remove(source)
+ sources.remove source
end
def title=(title)
@@ -42,9 +52,5 @@ def macrocontribution_type
self.hyper::macrocontributionType
end
-
end
-
-
-end
-
+end
|
Make sure has_many_polymorphs gem is loaded if missing in local paths
git-svn-id: 0c007ce6f683c3a50607bc1a0b961fa833bb4e37@735 2960d7dc-a92c-0410-a2fe-c68badc242c0
|
diff --git a/lib/x-editable-rails/view_helpers.rb b/lib/x-editable-rails/view_helpers.rb
index abc1234..def5678 100644
--- a/lib/x-editable-rails/view_helpers.rb
+++ b/lib/x-editable-rails/view_helpers.rb
@@ -5,6 +5,9 @@ def editable(object, method, options = {})
data_url = polymorphic_path(object)
object = object.last if object.kind_of?(Array)
+
+ value = object.send(method)
+ value = value.html_safe if value.respond_to? :html_safe
if xeditable? and can?(:edit, object)
model_param = object.class.name.split('::').last.underscore
@@ -22,10 +25,10 @@ }.merge options.fetch(:data, {})
content_tag tag, class: 'editable', title: title, data: data do
- object.send(method).try(:html_safe)
+ value
end
else
- options.fetch(:e, object.send(method)).try(:html_safe)
+ options.fetch(:e, value)
end
end
end
|
Handle non-strings a little better?
|
diff --git a/app/models/notification_services/slack_service.rb b/app/models/notification_services/slack_service.rb
index abc1234..def5678 100644
--- a/app/models/notification_services/slack_service.rb
+++ b/app/models/notification_services/slack_service.rb
@@ -14,7 +14,7 @@ end
def message_for_slack(problem)
- "*#{problem.app.name}:* #{problem.message.to_s.lines.first} #{problem_url(problem)}"
+ "*#{problem.app.name}:* #{problem.message.to_s.lines.first} #{problem.url}"
end
def post_payload(problem)
@@ -23,7 +23,7 @@ {
:fallback => message_for_slack(problem),
:title => problem.message.to_s.lines.first.truncate(100),
- :title_link => problem_url(problem),
+ :title_link => problem.url,
:text => "*#{problem.app.name}* (#{problem.notices_count} times)",
:mrkdwn_in => ["text"],
:color => "#D00000"
|
Use problem.url in Slack notification service.
|
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
@@ -4,6 +4,9 @@ super
return unless user == "caskroom"
+
+ old_initial_revision_var = "HOMEBREW_UPDATE_BEFORE#{repo_var}"
+ old_current_revision_var = "HOMEBREW_UPDATE_AFTER#{repo_var}"
new_user = "Homebrew"
new_repo = (repo == "cask") ? repo : "cask-#{repo}"
@@ -13,6 +16,12 @@ old_remote = path.git_origin
super(new_user, new_repo)
+
+ new_initial_revision_var = "HOMEBREW_UPDATE_BEFORE#{repo_var}"
+ new_current_revision_var = "HOMEBREW_UPDATE_AFTER#{repo_var}"
+
+ ENV[new_initial_revision_var] ||= ENV[old_initial_revision_var]
+ ENV[new_current_revision_var] ||= ENV[old_current_revision_var]
return unless old_path.git?
|
Add compatibility layer for `brew update` revisions.
|
diff --git a/app/controllers/api/v1/message_controller.rb b/app/controllers/api/v1/message_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/v1/message_controller.rb
+++ b/app/controllers/api/v1/message_controller.rb
@@ -1,7 +1,46 @@+require 'json'
+
module Api
module V1
- class MessageController < ApplicationController
- respond_to :json
+ class MessageController < ApiApplicationController
+ before_filter :set_gcm_api_key
+ def message_technician
+ @technician = Technician.find(params[:technician_id])
+ message = params[:msg]
+ collapse_key = params[:collapse_key]
+ notification_id = [@technician.gcm_id]
+
+ options = { collapse_key: collapse_key, data: { msg: message } } # dry_run: true
+ response = send_gcm_message(notification_id,options)
+ render json: response.to_json( only: [:body,:status_code]), status: :ok
+ end
+
+ def message_customer
+ @customer = Customer.find(params[:customer_id])
+ message = params[:msg]
+ collapse_key = params[:collapse_key]
+ notification_id = [@customer.gcm_id]
+
+ options = { collapse_key: collapse_key, data: { msg: message } } # dry_run: true
+ response = send_gcm_message(notification_id,options)
+ render json: response.to_json( only: [:body,:status_code]), status: :ok
+ end
+
+ private
+ def send_gcm_message(gcm_id, payload)
+ gcm = GCM.new(@api_key)
+ response = gcm.send_notification(gcm_id,payload)
+ return response
+ end
+
+ # Never trust parameters from the scary internet, only allow the white list through.
+ def message_params
+ params.require(:message).permit(:technician_id, :customer_id, :msg, :collapse_key)
+ end
+
+ def set_gcm_api_key
+ @api_key = GCM_API_KEY
+ end
end
end
end
|
Add API version for MessageController
|
diff --git a/app/helpers/application_helper/button/cockpit_console.rb b/app/helpers/application_helper/button/cockpit_console.rb
index abc1234..def5678 100644
--- a/app/helpers/application_helper/button/cockpit_console.rb
+++ b/app/helpers/application_helper/button/cockpit_console.rb
@@ -4,6 +4,7 @@ def disabled?
record_type = @record.respond_to?(:current_state) ? _('VM') : _('Container Node')
@error_message = _("The web-based console is not available because the %{record_type} is not powered on" % {:record_type => record_type}) unless on?
+ @error_message = _("The web-based console is not available because the %{record_platform} platform is not supported" % {:record_platform => @record.platform.capitalize}) unless platform_supported?
@error_message.present?
end
@@ -13,4 +14,8 @@ return @record.current_state == 'on' if @record.respond_to?(:current_state) # VM status
@record.ready_condition_status == 'True' if @record.respond_to?(:ready_condition_status) # Container status
end
+
+ def platform_supported?
+ @record.platform != 'windows'
+ end
end
|
Disable Web Console button when platform is Windows
https://bugzilla.redhat.com/show_bug.cgi?id=1447100
|
diff --git a/lib/nmea_plus/message/ais/vdm_payload/vdm_msg8d366f56.rb b/lib/nmea_plus/message/ais/vdm_payload/vdm_msg8d366f56.rb
index abc1234..def5678 100644
--- a/lib/nmea_plus/message/ais/vdm_payload/vdm_msg8d366f56.rb
+++ b/lib/nmea_plus/message/ais/vdm_payload/vdm_msg8d366f56.rb
@@ -4,6 +4,10 @@ module Message
module AIS
module VDMPayload
+
+ # Basic decoding of "blue force" encrypted binary messages.
+ # Note that this module is incapable of decrypting the messages. It can only deocde and return
+ # the encrypted payload to be decrypted elsewhere.
class VDMMsg8USCGEncrypted < NMEAPlus::Message::AIS::VDMPayload::VDMMsg
payload_reader :encrypted_data_2b, 56, 952, :_d
payload_reader :encrypted_data_6b, 56, 952, :_6b_string
@@ -11,18 +15,11 @@ end
# Type 8: Binary Broadcast Message Subtype: US Coast Guard (USCG) blue force encrypted position report
- class VDMMsg8d366f56 < VDMMsg8USCGEncrypted
- payload_reader :encrypted_data_2b, 56, 952, :_d
- payload_reader :encrypted_data_6b, 56, 952, :_6b_string
- payload_reader :encrypted_data_8b, 56, 952, :_8b_data_string
- end
+ class VDMMsg8d366f56 < VDMMsg8USCGEncrypted; end
# Type 8: Binary Broadcast Message Subtype: US Coast Guard (USCG) blue force encrypted data
- class VDMMsg8d366f57 < VDMMsg8USCGEncrypted
- payload_reader :encrypted_data_2b, 56, 952, :_d
- payload_reader :encrypted_data_6b, 56, 952, :_6b_string
- payload_reader :encrypted_data_8b, 56, 952, :_8b_data_string
- end
+ class VDMMsg8d366f57 < VDMMsg8USCGEncrypted; end
+
end
end
end
|
Remove redundant code and add message about (lack of) decryption capability
|
diff --git a/config/initializers/simplificator_infrastructure_assets.rb b/config/initializers/simplificator_infrastructure_assets.rb
index abc1234..def5678 100644
--- a/config/initializers/simplificator_infrastructure_assets.rb
+++ b/config/initializers/simplificator_infrastructure_assets.rb
@@ -0,0 +1,3 @@+Rails.application.config.assets.precompile += %w( simplificator_infrastructure/errors/logo.png )
+Rails.application.config.assets.precompile += %w( simplificator_infrastructure/errors/error_404.png )
+Rails.application.config.assets.precompile += %w( simplificator_infrastructure/errors/error_generic.png )
|
Add images to assets precompile list
Unless you overwrite the images in your app, you will get the following error:
Error during failsafe response: Asset was not declared to be precompiled in production.
|
diff --git a/racket.gemspec b/racket.gemspec
index abc1234..def5678 100644
--- a/racket.gemspec
+++ b/racket.gemspec
@@ -3,12 +3,12 @@ Gem::Specification.new do |s|
s.name = 'racket'
s.homepage = 'https://github.com/lasso/racket'
- s.license = 'GPL3'
+ s.license = 'GNU AFFERO GENERAL PUBLIC LICENSE, version 3'
s.authors = ['Lars Olsson']
s.version = '0.0.1'
s.date = '2015-04-06'
- s.summary = 'Racket - a tiny rack framework'
- s.description = 'Racket - a tiny rack framework'
+ s.summary = 'Racket - The noisy Rack MVC framework'
+ s.description = 'Racket - The noisy Rack MVC framework'
s.files = FileList['lib/**/*.rb', '[A-Z]*'].to_a
s.platform = Gem::Platform::RUBY
s.require_path = 'lib'
|
Update gemspec with licence info.
|
diff --git a/rapido.gemspec b/rapido.gemspec
index abc1234..def5678 100644
--- a/rapido.gemspec
+++ b/rapido.gemspec
@@ -1,6 +1,6 @@ Gem::Specification.new do |s|
# Release Specific Information
- s.version = "0.2.1"
+ s.version = "0.2.2"
s.date = "2014-03-15"
# Gem Details
|
Fix version number in .gemspec
|
diff --git a/nokia2droid.rb b/nokia2droid.rb
index abc1234..def5678 100644
--- a/nokia2droid.rb
+++ b/nokia2droid.rb
@@ -5,8 +5,8 @@ require 'nokogiri'
require 'vcardigan'
-def forward_convert in_filename
- src = File.open(in_filename)
+def forward_convert options
+ src = File.open(options.filename)
doc = Nokogiri::XML(src)
dst = VCardigan.create(:version => '4.0')
@@ -19,6 +19,13 @@ dst.fullname doc.at_xpath("//c:GivenName").children.to_s + doc.at_xpath("//c:FamilyName").children.to_s
# FN mandatory for vcard?
+ if options.dump
+ print "Surname: ", doc.at_xpath("//c:FamilyName").children.to_s, "\n"
+ print "Name: ", doc.at_xpath("//c:GivenName").children.to_s, "\n"
+ print "Number: ", doc.at_xpath("//c:Number").children.to_s, "\n\n"
+ end
+
+ # puts dst
src.close
end
@@ -29,6 +36,9 @@ opts.on("-f", "--file NAME", "File to convert") do |f|
options.filename = f
end
+ opts.on("-d", "--dump", "Show the contact data on stdout") do |x|
+ options.dump = x
+ end
end.parse!
-forward_convert options.filename
+forward_convert options
|
Add option to dump contact information to stdout
|
diff --git a/recipes/nfs.rb b/recipes/nfs.rb
index abc1234..def5678 100644
--- a/recipes/nfs.rb
+++ b/recipes/nfs.rb
@@ -22,7 +22,7 @@ network '192.168.22.0/24'
writeable true
sync true
- options ['no_root_squash', 'async']
+ options ['no_root_squash', 'async', 'fsid=1']
end
# Enable and start rpcbind
|
Add fsid=1 to allow export over tmpfs filesystem.
|
diff --git a/config/initializers/postgres_required_versions.rb b/config/initializers/postgres_required_versions.rb
index abc1234..def5678 100644
--- a/config/initializers/postgres_required_versions.rb
+++ b/config/initializers/postgres_required_versions.rb
@@ -5,14 +5,13 @@ end
def check_version
- msg = "The version of PostgreSQL being connected to is incompatible with #{Vmdb::Appliance.PRODUCT_NAME} (13 required)"
+ msg = "The version of PostgreSQL being connected to (#{postgresql_version}) is incompatible with #{Vmdb::Appliance.PRODUCT_NAME} (130000 / 13 required)"
- if postgresql_version < 100000
+ if postgresql_version < 10_00_00
raise msg
end
- if postgresql_version < 130000 || postgresql_version >= 140000
- raise msg if Rails.env.production? && !ENV["UNSAFE_PG_VERSION"]
+ if postgresql_version >= 14_00_00
$stderr.puts msg
end
end
|
Allow PG 10-13, disallow 9 and lower, warn on 14+
|
diff --git a/test/test_metrics.rb b/test/test_metrics.rb
index abc1234..def5678 100644
--- a/test/test_metrics.rb
+++ b/test/test_metrics.rb
@@ -2,11 +2,49 @@ require 'fintop/metrics'
class MetricsTest < Test::Unit::TestCase
- def test_process_ostrich_json
- json_str = %q{{"counters":{"srv\/http\/received_bytes":37,"srv\/http\/requests":4},"gauges":{"jvm_uptime":219,"srv\/http\/connections":1}}}
- expected = {'srv'=>{'http/received_bytes'=>37,'http/requests'=>4,'http/connections'=>1},'jvm'=>{'uptime'=>219}}
+ def test_process_ostrich_json_parses_valid_json_string
+ json_str = %q{{"counters":{"srv\/http\/received_bytes":37},"gauges":{"jvm_uptime":219,"srv\/http\/connections":1}}}
+ expected = {
+ 'srv'=>{'http/received_bytes'=>37,'http/connections'=>1},
+ 'jvm'=>{'uptime'=>219}
+ }
output = Fintop::Metrics.process_ostrich_json(json_str)
assert_equal(output, expected)
end
+
+ def test_process_ostrich_json_throws_on_empty_string
+ assert_raise JSON::ParserError do
+ Fintop::Metrics.process_ostrich_json("")
+ end
+ end
+
+ def test_process_ostrich_json_throws_on_invalid_json_string
+ assert_raise JSON::ParserError do
+ Fintop::Metrics.process_ostrich_json("{j")
+ end
+ end
+
+ def test_process_metrics_tm_json_parses_valid_json_string
+ json_str = %q{{"jvm\/uptime":183.0,"srv\/http\/connections":1.0,"srv\/http\/received_bytes":96}}
+ expected = {
+ 'srv'=>{'http/received_bytes'=>96,'http/connections'=>1.0},
+ 'jvm'=>{'uptime'=>183.0}
+ }
+ output = Fintop::Metrics.process_metrics_tm_json(json_str)
+
+ assert_equal(output, expected)
+ end
+
+ def test_process_metrics_tm_json_throws_on_empty_string
+ assert_raise JSON::ParserError do
+ Fintop::Metrics.process_metrics_tm_json("")
+ end
+ end
+
+ def test_process_metrics_tm_json_throws_on_invalid_json_string
+ assert_raise JSON::ParserError do
+ Fintop::Metrics.process_metrics_tm_json("{j")
+ end
+ end
end
|
Add tests for Fintop::Metrics JSON string parsing functions.
|
diff --git a/db/migrate/20170301101006_add_ci_runner_groups.rb b/db/migrate/20170301101006_add_ci_runner_groups.rb
index abc1234..def5678 100644
--- a/db/migrate/20170301101006_add_ci_runner_groups.rb
+++ b/db/migrate/20170301101006_add_ci_runner_groups.rb
@@ -11,11 +11,9 @@ t.integer :group_id
end
- add_concurrent_index :ci_runner_groups, :runner_id
- add_concurrent_foreign_key :ci_runner_groups, :ci_runners, column: :runner_id, on_delete: :cascade
-
add_concurrent_index :ci_runner_groups, :group_id
add_concurrent_index :ci_runner_groups, [:runner_id, :group_id], unique: true
+ add_concurrent_foreign_key :ci_runner_groups, :ci_runners, column: :runner_id, on_delete: :cascade
add_concurrent_foreign_key :ci_runner_groups, :namespaces, column: :group_id, on_delete: :cascade
end
|
Remove unecessary index on ci_runner_groups.runner_id
|
diff --git a/rubocop-fatsoma.gemspec b/rubocop-fatsoma.gemspec
index abc1234..def5678 100644
--- a/rubocop-fatsoma.gemspec
+++ b/rubocop-fatsoma.gemspec
@@ -27,8 +27,8 @@ spec.extra_rdoc_files = ['MIT-LICENSE.md', 'README.md']
spec.add_dependency 'version', '~> 1.0'
+ spec.add_dependency('rubocop', '~> 0.49')
- spec.add_development_dependency('rubocop', '0.49.0')
spec.add_development_dependency('rake', '~> 10.1')
spec.add_development_dependency('rspec', '~> 3.0')
spec.add_development_dependency('simplecov', '~> 0.8')
|
Set rubocop as a standard dependency
|
diff --git a/buildserver/cookbooks/android-ndk/recipes/default.rb b/buildserver/cookbooks/android-ndk/recipes/default.rb
index abc1234..def5678 100644
--- a/buildserver/cookbooks/android-ndk/recipes/default.rb
+++ b/buildserver/cookbooks/android-ndk/recipes/default.rb
@@ -8,7 +8,7 @@ code "
wget http://dl.google.com/android/ndk/android-ndk-r8b-linux-x86.tar.bz2
tar jxvf android-ndk-r8b-linux-x86.tar.bz2
- mv android-ndk-r8 #{ndk_loc}
+ mv android-ndk-r8b #{ndk_loc}
"
not_if do
File.exists?("#{ndk_loc}")
|
Correct ndk-r8b install for build server
|
diff --git a/adash.gemspec b/adash.gemspec
index abc1234..def5678 100644
--- a/adash.gemspec
+++ b/adash.gemspec
@@ -19,8 +19,8 @@ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
- spec.add_development_dependency "bundler", "~> 1.13"
- spec.add_development_dependency "rake", "~> 12.0"
+ spec.add_development_dependency "bundler"
+ spec.add_development_dependency "rake"
spec.add_dependency "amazon-drs"
spec.add_dependency "launchy"
end
|
Remove dependency versions for bundler and rake
|
diff --git a/lib/capistrano/mailer.rb b/lib/capistrano/mailer.rb
index abc1234..def5678 100644
--- a/lib/capistrano/mailer.rb
+++ b/lib/capistrano/mailer.rb
@@ -14,7 +14,7 @@ class Configuration
module CapistranoMailer
def send_notification_email(cap, config = {}, *args)
- CapMailer.deliver_notification_email(cap, config, args)
+ CapMailer.deliver_notification_email(cap, config, *args)
end
end
|
Make sure we are passing the pointer of args to 'CapMailer.deliver_notification_email'. Otherwise, notifcation_email will see args as a double array so it will ignore any parameters.
|
diff --git a/lib/detectify/railtie.rb b/lib/detectify/railtie.rb
index abc1234..def5678 100644
--- a/lib/detectify/railtie.rb
+++ b/lib/detectify/railtie.rb
@@ -1,7 +1,7 @@ module Detectify
class Railtie < Rails::Railtie
initializer 'detectify' do |app|
- app.config.middleware.use 'Detectify::Middleware'
+ app.config.middleware.use Detectify::Middleware
end
end
end
|
Fix 'Passing strings or symbols to the middleware builder' Rails 5 deprecation warning
|
diff --git a/lib/dino/tx_rx/telnet.rb b/lib/dino/tx_rx/telnet.rb
index abc1234..def5678 100644
--- a/lib/dino/tx_rx/telnet.rb
+++ b/lib/dino/tx_rx/telnet.rb
@@ -21,7 +21,7 @@ io.waitfor("\n") do |text|
@read_buffer += text
while line = @read_buffer.slice!(/^.*\n/) do
- pin, message = line.chop.split(/::/)
+ pin, message = line.chomp.split(/::/)
pin && message && changed && notify_observers(pin, message)
end
end
|
Use chomp instead of chop for lines in TxRx::Telnet
|
diff --git a/lib/hash_diff_builder.rb b/lib/hash_diff_builder.rb
index abc1234..def5678 100644
--- a/lib/hash_diff_builder.rb
+++ b/lib/hash_diff_builder.rb
@@ -22,7 +22,9 @@ attr_reader :presenter, :previous_item, :current_item
def create_diff(previous_item, current_item)
- HashDiff.diff(previous_item, current_item, array_path: true)
+ HashDiff.diff(
+ previous_item, current_item, array_path: true, use_lcs: false
+ )
end
class MissingItemError < RuntimeError; end
|
Disable LCS in HashDiff for faster performance
|
diff --git a/lib/onliest/snowflake.rb b/lib/onliest/snowflake.rb
index abc1234..def5678 100644
--- a/lib/onliest/snowflake.rb
+++ b/lib/onliest/snowflake.rb
@@ -28,8 +28,6 @@
def time
while (t = time_now) < @older_time
- #puts @older_time
- #puts t
sleep((@older_time - t) / 1000)
end
@older_time = t
|
Remove some commented out debugging junk.
|
diff --git a/resources/application.rb b/resources/application.rb
index abc1234..def5678 100644
--- a/resources/application.rb
+++ b/resources/application.rb
@@ -3,6 +3,7 @@ CFG_PATH = '/etc/profile.d/rails.sh'
attribute :directory, kind_of: [String], name_attribute: true
+attribute :user, kind_of: [String], default: 'app'
attribute :repo, kind_of: [String]
attribute :revision, kind_of: [String]
attribute :keep_releases, kind_of: [Fixnum]
|
Add the user attribute. D'oh
|
diff --git a/app/decorators/optional_modules/newsletter_user_decorator.rb b/app/decorators/optional_modules/newsletter_user_decorator.rb
index abc1234..def5678 100644
--- a/app/decorators/optional_modules/newsletter_user_decorator.rb
+++ b/app/decorators/optional_modules/newsletter_user_decorator.rb
@@ -4,4 +4,21 @@ class NewsletterUserDecorator < ApplicationDecorator
include Draper::LazyHelpers
delegate_all
+
+ def role
+ color = 'orange' if tester?
+ color = 'green' if subscriber?
+
+ arbre do
+ status_tag I18n.t("role.#{model.role}"), color
+ end
+ end
+
+ def tester?
+ model.role == 'tester'
+ end
+
+ def subscriber?
+ model.role == 'subscriber'
+ end
end
|
Add status_tag for newsletter_users role
|
diff --git a/lib/knife_cookbook_doc/documenting_lwrp_base.rb b/lib/knife_cookbook_doc/documenting_lwrp_base.rb
index abc1234..def5678 100644
--- a/lib/knife_cookbook_doc/documenting_lwrp_base.rb
+++ b/lib/knife_cookbook_doc/documenting_lwrp_base.rb
@@ -16,9 +16,9 @@ end
NOT_PASSED = defined?(::Chef::NOT_PASSED) ? ::Chef::NOT_PASSED : "NOT_PASSED"
- def property(name, type = NOT_PASSED, *options)
+ def property(name, type = NOT_PASSED, **options)
attribute_specifications[name] = options
- super(name, type, *options) if defined?(super)
+ super(name, type, **options) if defined?(super)
end
end
|
Revert "Restore support for ruby pre-2.0 versions."
This reverts commit 04763e3abcacd209b5cf281be6e0cec80912ab12.
|
diff --git a/lib/netsuite/records/journal_entry_line_list.rb b/lib/netsuite/records/journal_entry_line_list.rb
index abc1234..def5678 100644
--- a/lib/netsuite/records/journal_entry_line_list.rb
+++ b/lib/netsuite/records/journal_entry_line_list.rb
@@ -1,31 +1,11 @@ module NetSuite
module Records
- class JournalEntryLineList
- include Support::Fields
+ class JournalEntryLineList < Support::Sublist
include Namespaces::TranGeneral
-
- fields :line
- def initialize(attributes = {})
- initialize_from_attributes_hash(attributes)
- end
+ sublist :line, JournalEntryLine
- def line=(lines)
- case lines
- when Hash
- self.lines << JournalEntryLine.new(lines)
- when Array
- lines.each { |line| self.lines << JournalEntryLine.new(line) }
- end
- end
-
- def lines
- @items ||= []
- end
-
- def to_record
- { "#{record_namespace}:line" => lines.map(&:to_record) }
- end
+ alias :lines :line
end
end
|
Refactor JournalEntryLineList to use Support::Sublist
|
diff --git a/lib/sections/pvp_data.rb b/lib/sections/pvp_data.rb
index abc1234..def5678 100644
--- a/lib/sections/pvp_data.rb
+++ b/lib/sections/pvp_data.rb
@@ -12,11 +12,11 @@ end
end
- @character.data['max_2v2_rating'] = @data.achievement_statistics.statistics[9].sub_categories[0].statistics.select do |stat|
+ @character.data['max_2v2_rating'] = @data.achievement_statistics.categories[9].sub_categories[0].statistics.select do |stat|
stat.name == "Highest 2 man personal rating"
end.first&.quantity&.to_i rescue 0
- @character.data['max_3v3_rating'] = @data.achievement_statistics.statistics[9].sub_categories[0].statistics.select do |stat|
+ @character.data['max_3v3_rating'] = @data.achievement_statistics.categories[9].sub_categories[0].statistics.select do |stat|
stat.name == "Highest 3 man personal rating"
end.first&.quantity&.to_i rescue 0
end
|
Fix highest PvP rating tracking.
|
diff --git a/ipaddresslabs.gemspec b/ipaddresslabs.gemspec
index abc1234..def5678 100644
--- a/ipaddresslabs.gemspec
+++ b/ipaddresslabs.gemspec
@@ -6,11 +6,10 @@ Gem::Specification.new do |spec|
spec.name = "ipaddresslabs"
spec.version = Ipaddresslabs::VERSION
- spec.authors = ["TODO: Write your name"]
- spec.email = ["nicolas@engage.is"]
- spec.summary = %q{TODO: Write a short summary. Required.}
- spec.description = %q{TODO: Write a longer description. Optional.}
- spec.homepage = ""
+ spec.authors = ["Nícolas Iensen"]
+ spec.email = ["nicolas@iensen.me"]
+ spec.summary = %q{Gem wrapper for the ipaddresslabs.com API}
+ spec.homepage = "https://github.com/nicolasiensen/ipaddresslabs"
spec.license = "MIT"
spec.files = `git ls-files -z`.split("\x0")
@@ -20,4 +19,6 @@
spec.add_development_dependency "bundler", "~> 1.5"
spec.add_development_dependency "rake"
+
+ spec.add_runtime_dependency 'httparty'
end
|
Add gem data and HTTParty dependency
|
diff --git a/lib/swagger_yard/type.rb b/lib/swagger_yard/type.rb
index abc1234..def5678 100644
--- a/lib/swagger_yard/type.rb
+++ b/lib/swagger_yard/type.rb
@@ -29,7 +29,8 @@ @schema ||= TypeParser.new.json_schema(source)
end
- def schema_with(model_path: MODEL_PATH)
+ def schema_with(options = {})
+ model_path = options && options[:model_path] || MODEL_PATH
if model_path != MODEL_PATH
TypeParser.new(model_path).json_schema(source)
else
|
Switch to options hash for 1.9 compat
|
diff --git a/core/spec/controllers/users/confirmations_controller_spec.rb b/core/spec/controllers/users/confirmations_controller_spec.rb
index abc1234..def5678 100644
--- a/core/spec/controllers/users/confirmations_controller_spec.rb
+++ b/core/spec/controllers/users/confirmations_controller_spec.rb
@@ -28,7 +28,7 @@ it "doesn't allow tokens of more than a month old" do
user = create :user
- Timecop.freeze(Date.today + 40) do
+ Timecop.travel(40.months) do
get :show, confirmation_token: user.confirmation_token
end
|
Use travel instead of freeze, and use 40.months for clarity
|
diff --git a/lib/generators/mini_test/feature/templates/feature_spec.rb b/lib/generators/mini_test/feature/templates/feature_spec.rb
index abc1234..def5678 100644
--- a/lib/generators/mini_test/feature/templates/feature_spec.rb
+++ b/lib/generators/mini_test/feature/templates/feature_spec.rb
@@ -1,8 +1,8 @@ require "minitest_helper"
# To be handled correctly by Capybara this spec must end with "Feature Test"
-describe "<%= class_name %> Feature Test" do
- it "sanity" do
+feature "<%= class_name %> Feature Test" do
+ scenario "the test is sound" do
visit root_path
page.must_have_content "Hello World"
page.wont_have_content "Goobye All!"
|
Update feature generator to use the Capybara spec DSL
|
diff --git a/lib/active_set/processors/paginate_processor.rb b/lib/active_set/processors/paginate_processor.rb
index abc1234..def5678 100644
--- a/lib/active_set/processors/paginate_processor.rb
+++ b/lib/active_set/processors/paginate_processor.rb
@@ -6,7 +6,8 @@ class ActiveSet
class PaginateProcessor < BaseProcessor
def process
- adapter.new(@set, instruction).process
+ output = adapter.new(@set, instruction).process
+ output[:set]
end
private
|
Fix bug where Paginator wasn’t returning the proper result
Wasn’t extracting the set from the processed result
|
diff --git a/app/controllers/doc_controller.rb b/app/controllers/doc_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/doc_controller.rb
+++ b/app/controllers/doc_controller.rb
@@ -3,6 +3,10 @@ # Simple controller for serving documentation
class DocController < ApplicationController
def index
+ @view_state = LanguageState.new(UserLanguageSelection.new(params))
+ end
+
+ def ukhpi
@view_state = LanguageState.new(UserLanguageSelection.new(params))
end
|
Fix view-rendering regression in 'about UKHPI'
|
diff --git a/app/models/survey_field.rb b/app/models/survey_field.rb
index abc1234..def5678 100644
--- a/app/models/survey_field.rb
+++ b/app/models/survey_field.rb
@@ -3,10 +3,18 @@ belongs_to :survey_template
has_many :field_responses, :dependent => :destroy
serialize :field_options, JSON
+ before_save :pepper_up
# def is_valid? (response)
# {:value => true}
# end
+
+
+ def pepper_up
+ if self.field_options.nil?
+ self.field_options = []
+ end
+ end
def self.descendants
ObjectSpace.each_object(Class).select { |klass| klass < self }
|
Set field_options to [] if not set - pepperup
|
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index abc1234..def5678 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -1,5 +1,22 @@ require 'rails_helper'
RSpec.describe User, type: :model do
- pending "add some examples to (or delete) #{__FILE__}"
+
+ let(:user){User.new(username: 'derrick', email: 'derrick@derrick.com', password: 'aaa', verified: true )}
+ describe "it has attributes" do
+ it "has a username" do
+ expect( user.username ).to_not eq nil
+ expect( user.username ).to eq 'derrick'
+ end
+
+ it "has an email" do
+ expect( user.email ).to_not eq nil
+ expect( user.email ).to eq 'derrick@derrick.com'
+ end
+
+ it "has a password_digest" do
+ expect( user.password_digest ).to_not eq nil
+ expect( user.password_digest ).to eq 'aaa'
+ end
+ end
end
|
Add attribute tests for user model.
|
diff --git a/app/validators/email_validator.rb b/app/validators/email_validator.rb
index abc1234..def5678 100644
--- a/app/validators/email_validator.rb
+++ b/app/validators/email_validator.rb
@@ -1,7 +1,7 @@ class EmailValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
unless value =~ /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
- record.errors[attribute] << (options[:message] || "is not an email")
+ record.errors[attribute] << (options[:message] || I18n.t('activerecord.errors.models.user.attributes.email.invalid'))
end
end
end
|
Replace static error message with I18n text.
|
diff --git a/app/models/export/base.rb b/app/models/export/base.rb
index abc1234..def5678 100644
--- a/app/models/export/base.rb
+++ b/app/models/export/base.rb
@@ -6,7 +6,7 @@ # remove any existing tmp file
path = Base.tmp_path basename
path.unlink if path.exist?
- path.dirname.mkdir_p unless path.dirname.exist?
+ FileUtils.mkdir_p path.dirname unless path.dirname.exist?
FileUtils.chmod 0777, path.dirname
# ensure the /public/export directory exists
|
Use FileUtils, not Pathname to create export dirs
|
diff --git a/engines/adva_user/app/controllers/user_controller.rb b/engines/adva_user/app/controllers/user_controller.rb
index abc1234..def5678 100644
--- a/engines/adva_user/app/controllers/user_controller.rb
+++ b/engines/adva_user/app/controllers/user_controller.rb
@@ -1,5 +1,5 @@ class UserController < BaseController
- authentication_required :except => [:new, :create, :vertify]
+ authentication_required :except => [:new, :create]
renders_with_error_proc :below_field
filter_parameter_logging :password
|
Revert "user: vertify method was under authentication_required". Authentication is done via URL token and is needed for verification.
This reverts commit 96b23c01b3c4f8cd0efa57868bab9ab5a2433beb.
|
diff --git a/db/migrate/20140119103212_topics_field_lengths.rb b/db/migrate/20140119103212_topics_field_lengths.rb
index abc1234..def5678 100644
--- a/db/migrate/20140119103212_topics_field_lengths.rb
+++ b/db/migrate/20140119103212_topics_field_lengths.rb
@@ -0,0 +1,7 @@+class TopicsFieldLengths < ActiveRecord::Migration
+ def change
+ change_column :topics, :subject_area, :string, :limit => 10
+ change_column :topics, :semester, :string, :limit => 5
+ change_column :topics, :topic_number, :string, :limit => 8
+ end
+end
|
Change semester, subject_area and topic_number max lengths of topics table
Allows Adelaide Uni Support
|
diff --git a/softwareplanet-cms/app/helpers/cms/source_code_helper.rb b/softwareplanet-cms/app/helpers/cms/source_code_helper.rb
index abc1234..def5678 100644
--- a/softwareplanet-cms/app/helpers/cms/source_code_helper.rb
+++ b/softwareplanet-cms/app/helpers/cms/source_code_helper.rb
@@ -11,6 +11,7 @@ editor_name = "head_editor" if (sourceObj.type == Cms::SourceType::HEAD)
"
editorManager.getEditor('#{ editor_name }').setSourceWithSeparator('#{ sourceObj.get_id }', '#{ sourceObj.get_source_name }', '#{escape_javascript(sourceObj.data) }');
+ editorManager.getEditor('#{ editor_name }').clearHistory();
".html_safe
end
end
|
Clear history of newly created editors
|
diff --git a/db/migrate/20171028230429_create_median_function.rb b/db/migrate/20171028230429_create_median_function.rb
index abc1234..def5678 100644
--- a/db/migrate/20171028230429_create_median_function.rb
+++ b/db/migrate/20171028230429_create_median_function.rb
@@ -2,10 +2,11 @@
class CreateMedianFunction < ActiveRecord::Migration[4.2]
def up
- ActiveMedian.create_function
+ # commented out, because we upgraded the gem later and this function was removed
+ # ActiveMedian.create_function
end
def down
- ActiveMedian.drop_function
+ # ActiveMedian.drop_function
end
end
|
Comment out a migration that needs an old gem to work
|
diff --git a/lib/executors/configurators/yaml/validator.rb b/lib/executors/configurators/yaml/validator.rb
index abc1234..def5678 100644
--- a/lib/executors/configurators/yaml/validator.rb
+++ b/lib/executors/configurators/yaml/validator.rb
@@ -1,3 +1,6 @@+require "executors/configurators/yaml/validation_warn"
+
+# YAML validator.
module Executors
module Configurators
module Yaml
@@ -15,7 +18,7 @@ when EXECUTOR_RULE_NAME
unless Configurator::SIZE_REQUIRING_TYPES.include? value[Configurator::TYPE_KEY].downcase
if value[Configurator::SIZE_KEY]
- errors << Kwalify::ValidationError.new("\"size\" is not required.", path)
+ errors << ValidationWarn.new("\"size\" is not required.", path, rule, value)
end
end
end
|
Switch to warn validation class.
|
diff --git a/Casks/plex-media-server.rb b/Casks/plex-media-server.rb
index abc1234..def5678 100644
--- a/Casks/plex-media-server.rb
+++ b/Casks/plex-media-server.rb
@@ -1,7 +1,7 @@ class PlexMediaServer < Cask
- url 'http://downloads.plexapp.com/plex-media-server/0.9.9.5.411-da1d892/PlexMediaServer-0.9.9.5.411-da1d892-OSX.zip'
+ url 'http://downloads.plexapp.com/plex-media-server/0.9.9.7.429-f80a8d6/PlexMediaServer-0.9.9.7.429-f80a8d6-OSX.zip'
homepage 'http://plexapp.com'
- version '0.9.9.5.411'
- sha256 '2f1a436ff9c5c494d7a55c4c2138fa2febde5431243c97de1e643d3d50c6b875'
+ version '0.9.9.7.429'
+ sha256 '7c74eab9da4cd4ecbb8b27595ff6f5b0df006aba8333263471ccf27790dad27d'
link 'Plex Media Server.app'
end
|
Update Plex Media Server version from 0.9.9.5.411 to 0.9.9.7.429
|
diff --git a/lib/rspec/support/spec/deprecation_helpers.rb b/lib/rspec/support/spec/deprecation_helpers.rb
index abc1234..def5678 100644
--- a/lib/rspec/support/spec/deprecation_helpers.rb
+++ b/lib/rspec/support/spec/deprecation_helpers.rb
@@ -18,6 +18,10 @@ allow(RSpec.configuration.reporter).to receive(:deprecation)
end
+ def expect_no_deprecations
+ expect(RSpec.configuration.reporter).not_to receive(:deprecation)
+ end
+
def expect_warning_without_call_site(expected = //)
expect(::Kernel).to receive(:warn) do |message|
expect(message).to match expected
|
Add another deprecation helper method.
|
diff --git a/app/models/catarse_pagarme/fee_calculator_concern.rb b/app/models/catarse_pagarme/fee_calculator_concern.rb
index abc1234..def5678 100644
--- a/app/models/catarse_pagarme/fee_calculator_concern.rb
+++ b/app/models/catarse_pagarme/fee_calculator_concern.rb
@@ -9,7 +9,7 @@ transaction = PagarMe::Transaction.find(self.payment.gateway_id)
payables = transaction.payables
cost = transaction.cost.to_f / 100.00
- payables_fee = payables_fee.to_a.sum(&:fee).to_f / 100.00
+ payables_fee = payables.to_a.sum(&:fee).to_f / 100.00
if self.payment.payment_method == ::CatarsePagarme::PaymentType::SLIP
cost + payables_fee
|
Fix typo in fee calculator
|
diff --git a/clock.gemspec b/clock.gemspec
index abc1234..def5678 100644
--- a/clock.gemspec
+++ b/clock.gemspec
@@ -2,7 +2,7 @@ Gem::Specification.new do |s|
s.name = 'clock'
s.summary = 'Clock interface with support for dependency configuration for real and null object implementations'
- s.version = '0.1.1'
+ s.version = '0.1.2'
s.description = ' '
s.authors = ['Obsidian Software, Inc']
|
Package version is increased from 0.1.1 to 0.1.2
|
diff --git a/lib/ember-cli/engine.rb b/lib/ember-cli/engine.rb
index abc1234..def5678 100644
--- a/lib/ember-cli/engine.rb
+++ b/lib/ember-cli/engine.rb
@@ -5,10 +5,8 @@ end
initializer "ember-cli-rails.inflector" do
- if Rails.version > "3.2"
- ActiveSupport::Inflector.inflections :en do |inflect|
- inflect.acronym "CLI"
- end
+ ActiveSupport::Inflector.inflections do |inflect|
+ inflect.acronym "CLI" if inflect.respond_to?(:acronym)
end
end
|
Fix inflector initializer for older Rails
Fix #115 Fix #117
|
diff --git a/lib/securer_randomer/monkeypatch/secure_random.rb b/lib/securer_randomer/monkeypatch/secure_random.rb
index abc1234..def5678 100644
--- a/lib/securer_randomer/monkeypatch/secure_random.rb
+++ b/lib/securer_randomer/monkeypatch/secure_random.rb
@@ -17,6 +17,8 @@ case n
when nil
0
+ when Numeric
+ n > 0 ? n : 0
when Range
if n.end < n.begin
0
@@ -25,8 +27,6 @@ else
n
end
- when Numeric
- n > 0 ? n : 0
end
raise TypeError unless arg
|
Check for Numeric before Range
|
diff --git a/lib/gattica/asserter.rb b/lib/gattica/asserter.rb
index abc1234..def5678 100644
--- a/lib/gattica/asserter.rb
+++ b/lib/gattica/asserter.rb
@@ -1,3 +1,5 @@+require 'google/api_client'
+
module Gattica
# Represents a user to be authenticated by GA
|
Fix 1.9.3 Asserter error issue
|
diff --git a/rbvppc.gemspec b/rbvppc.gemspec
index abc1234..def5678 100644
--- a/rbvppc.gemspec
+++ b/rbvppc.gemspec
@@ -11,7 +11,7 @@ spec.summary = %q{Remote access for IBM P-Series}
spec.description = %q{This gem provides remote access to IBM P-Series}
spec.homepage = ""
- spec.license = "IBM"
+ spec.license = "MIT"
spec.files = `git ls-files -z`.split("\x0")
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
Change spec.license to MIT in gemspec
|
diff --git a/railties/configs/initializers/new_rails_defaults.rb b/railties/configs/initializers/new_rails_defaults.rb
index abc1234..def5678 100644
--- a/railties/configs/initializers/new_rails_defaults.rb
+++ b/railties/configs/initializers/new_rails_defaults.rb
@@ -1,8 +1,5 @@ # These settings change the behavior of Rails 2 apps and will be defaults
# for Rails 3. You can remove this initializer when Rails 3 is released.
-
-# Only save the attributes that have changed since the record was loaded.
-ActiveRecord::Base.partial_updates = true
# Include ActiveRecord class name as root for JSON serialized output.
ActiveRecord::Base.include_root_in_json = true
|
Return Partial Updates to be purely opt in to prevent users from inadvertently corrupting data.
|
diff --git a/scripts/purge_staging.rb b/scripts/purge_staging.rb
index abc1234..def5678 100644
--- a/scripts/purge_staging.rb
+++ b/scripts/purge_staging.rb
@@ -1,6 +1,8 @@ # Use Rails runner to execute this script:
#
# rails r scripts/purge_staging.rb
+
+USER = 'feeder'.freeze
posts_count = 0
@@ -9,22 +11,26 @@
result = RestClient::Request.execute(
method: :get,
- url: 'https://candy.freefeed.net/v2/timelines/feeder',
+ url: 'https://candy.freefeed.net/v2/timelines/home?offset=0',
headers: {
'X-Authentication-Token' => ENV.fetch('FREEFEED_TOKEN')
}
)
posts = JSON.parse(result.body)['posts']
+ users = JSON.parse(result.body)['users']
+ user_id = users.find { |user| user['username'] == USER }['id']
+ own_posts = posts.select { |post| post['createdBy'] == user_id }
- unless posts.present? && posts.any?
+ unless own_posts.any?
puts "#{posts_count} deleted"
exit
end
- puts "#{posts.length} posts loaded"
+ puts "#{own_posts.length} posts loaded"
- posts.each do |post|
+
+ own_posts.each do |post|
post_id = post['id']
puts "deleting #{post_id}"
|
Check post author name during purging
|
diff --git a/sequel-collation.gemspec b/sequel-collation.gemspec
index abc1234..def5678 100644
--- a/sequel-collation.gemspec
+++ b/sequel-collation.gemspec
@@ -14,4 +14,6 @@ gem.name = "sequel-collation"
gem.require_paths = ["lib"]
gem.version = Sequel::Collation::VERSION
+
+ gem.add_dependency("sequel")
end
|
Add sequel as a dependency
|
diff --git a/ext/hitimes/c/extconf.rb b/ext/hitimes/c/extconf.rb
index abc1234..def5678 100644
--- a/ext/hitimes/c/extconf.rb
+++ b/ext/hitimes/c/extconf.rb
@@ -4,7 +4,7 @@ if RbConfig::CONFIG['host_os'] =~ /darwin/ then
$CFLAGS += " -DUSE_INSTANT_OSX=1 -Wall"
$LDFLAGS += " -framework CoreServices"
-elsif RbConfig::CONFIG['host_os'] =~ /win32/ or RbConfig::CONFIG['host_os'] =~ /mingw/ then
+elsif RbConfig::CONFIG['host_os'] =~ /win(32|64)/ or RbConfig::CONFIG['host_os'] =~ /mingw/ then
$CFLAGS += " -DUSE_INSTANT_WINDOWS=1"
else
if have_library("rt", "clock_gettime") then
|
Add support for 64-bit Windows rubies.
|
diff --git a/lib/ffi-glib/bytes.rb b/lib/ffi-glib/bytes.rb
index abc1234..def5678 100644
--- a/lib/ffi-glib/bytes.rb
+++ b/lib/ffi-glib/bytes.rb
@@ -32,15 +32,6 @@ end
end
- class << self
- undef new
- end
-
- def self.new(arr)
- data = GirFFI::SizedArray.from :guint8, arr.size, arr
- wrap Lib.g_bytes_new data.to_ptr, data.size
- end
-
private
def data
|
Remove obsolete override for GLib::Bytes.new
|
diff --git a/config.ru b/config.ru
index abc1234..def5678 100644
--- a/config.ru
+++ b/config.ru
@@ -1 +1,7 @@-run lambda{|env| [200, {'Content-Type' => 'text/plain'}, ["heroku-modular"]]}
+require 'first_app/app'
+require 'second_app/app'
+
+run Rack::URLMap.new(
+ '/first_app' => FirstApp::App,
+ '/second_app' => SecondApp::App
+)
|
Use Rack::URLMap to run either FirstApp or SecondApp
|
diff --git a/config.ru b/config.ru
index abc1234..def5678 100644
--- a/config.ru
+++ b/config.ru
@@ -4,7 +4,10 @@ Bundler.require(:default)
$LOAD_PATH.unshift(::File.expand_path('lib', ::File.dirname(__FILE__)))
+
require 'nesta/env'
+Nesta::Env.root = ::File.expand_path('.', ::File.dirname(__FILE__))
+
require 'nesta/app'
run Nesta::App
|
Set Nesta root for local dev/testing.
|
diff --git a/lib/poke/constants.rb b/lib/poke/constants.rb
index abc1234..def5678 100644
--- a/lib/poke/constants.rb
+++ b/lib/poke/constants.rb
@@ -2,8 +2,8 @@
module Dimensions
GRID = 32
- HEIGHT = 15 * GRID
- WIDTH = 10 * GRID
+ HEIGHT = 10 * GRID
+ WIDTH = 15 * GRID
end
module Color
|
Change window size back to landscape
|
diff --git a/ruote-postges.gemspec b/ruote-postges.gemspec
index abc1234..def5678 100644
--- a/ruote-postges.gemspec
+++ b/ruote-postges.gemspec
@@ -27,7 +27,7 @@ s.add_runtime_dependency 'ruote'
s.add_dependency 'rake'
- s.add_dependency 'pg', '0.14.1'
+ s.add_dependency 'pg'
s.add_dependency 'yajl-ruby'
s.add_dependency 'json'
|
Remove explicit PG gem version requirement
|
diff --git a/lib/caprese/adapter/json_api/resource_identifier.rb b/lib/caprese/adapter/json_api/resource_identifier.rb
index abc1234..def5678 100644
--- a/lib/caprese/adapter/json_api/resource_identifier.rb
+++ b/lib/caprese/adapter/json_api/resource_identifier.rb
@@ -41,7 +41,7 @@ end
def id_for(serializer)
- serializer.read_attribute_for_serialization(:id).to_s
+ serializer.read_attribute_for_serialization(Caprese.config.resource_primary_key).to_s
end
end
end
|
Allow choosing of primary key for JSON API resource identifiers
|
diff --git a/lib/vagrant-proxyconf/action/configure_git_proxy.rb b/lib/vagrant-proxyconf/action/configure_git_proxy.rb
index abc1234..def5678 100644
--- a/lib/vagrant-proxyconf/action/configure_git_proxy.rb
+++ b/lib/vagrant-proxyconf/action/configure_git_proxy.rb
@@ -21,8 +21,12 @@ end
def configure_machine
- @machine.communicate.sudo(
- "git config --system http.proxy #{config.http}")
+ if config.http
+ command = "git config --system http.proxy #{config.http}"
+ else
+ command = "git config --system --unset-all http.proxy"
+ end
+ @machine.communicate.sudo(command)
end
end
end
|
Fix git proxy config with falsy values
|
diff --git a/features/step_definitions/error_handling_steps.rb b/features/step_definitions/error_handling_steps.rb
index abc1234..def5678 100644
--- a/features/step_definitions/error_handling_steps.rb
+++ b/features/step_definitions/error_handling_steps.rb
@@ -5,10 +5,6 @@
When /^I try to use Yacht( with a whitelist)?$/ do |whitelist|
@last_yacht = use_yacht(!!whitelist)
-end
-
-Then /^Yacht should raise an error$/ do
- @last_yacht.class.should <= Exception
end
Then /^Yacht should not raise an error$/ do
|
Remove redundant cucumber step definition
|
diff --git a/src/bosh_openstack_cpi/spec/integration/lifecycle_v2_spec.rb b/src/bosh_openstack_cpi/spec/integration/lifecycle_v2_spec.rb
index abc1234..def5678 100644
--- a/src/bosh_openstack_cpi/spec/integration/lifecycle_v2_spec.rb
+++ b/src/bosh_openstack_cpi/spec/integration/lifecycle_v2_spec.rb
@@ -4,8 +4,6 @@ before do
@config = IntegrationConfig.new(:v2)
end
-
- after(:each) { File.delete(@ca_cert_path) if @ca_cert_path }
let(:boot_from_volume) { false }
let(:config_drive) { nil }
|
Remove non-working and unnecessary file deletion
[#134444111](https://www.pivotaltracker.com/story/show/134444111)
Signed-off-by: Felix Riegger <9c2aa7530239a330bbac6ac4f56e0946781dfd29@sap.com>
|
diff --git a/sipXconfig/bin/sipx-upgrade-3.6-mailstore-report.rb b/sipXconfig/bin/sipx-upgrade-3.6-mailstore-report.rb
index abc1234..def5678 100644
--- a/sipXconfig/bin/sipx-upgrade-3.6-mailstore-report.rb
+++ b/sipXconfig/bin/sipx-upgrade-3.6-mailstore-report.rb
@@ -15,7 +15,7 @@ def report(mailstore, output)
output.puts "following emails will not be preserved after first user edit:"
Find.find(mailstore) do |path|
- if File.basename(path) =~ /mailboxprefs.xml/
+ if File.basename(path) == 'mailboxprefs.xml'
File.open(path) do |prefs_stream|
doc = REXML::Document.new(prefs_stream)
contacts = doc.get_elements('//notification/contact')
|
FIX BUILD : look for mailboxprefs.xml exactly, not a pattern match (was picking up subversion metadata files)
git-svn-id: f26ccc5efe72c2bd8e1c40f599fe313f2692e4de@9012 a612230a-c5fa-0310-af8b-88eea846685b
|
diff --git a/test/integration/default/serverspec/default_spec.rb b/test/integration/default/serverspec/default_spec.rb
index abc1234..def5678 100644
--- a/test/integration/default/serverspec/default_spec.rb
+++ b/test/integration/default/serverspec/default_spec.rb
@@ -0,0 +1,18 @@+require 'serverspec'
+
+set :backend, :exec
+
+describe service('sssd') do
+ it { should be_enabled }
+ it { should be_running }
+end
+
+describe package('sssd') do
+ it { should be_installed }
+end
+
+if ['debian', 'ubuntu'].include?(os[:family])
+ describe package('libsss-sudo') do
+ it { should be_installed }
+ end
+end
|
Add chefspec for the package / service
|
diff --git a/db/data_migrations/20190121163911_resolve_zero_percent_measure_cigarettes_further_measures.rb b/db/data_migrations/20190121163911_resolve_zero_percent_measure_cigarettes_further_measures.rb
index abc1234..def5678 100644
--- a/db/data_migrations/20190121163911_resolve_zero_percent_measure_cigarettes_further_measures.rb
+++ b/db/data_migrations/20190121163911_resolve_zero_percent_measure_cigarettes_further_measures.rb
@@ -0,0 +1,22 @@+TradeTariffBackend::DataMigrator.migration do
+ name "Remove 0% measures on further cigarette types"
+
+ up do
+ applicable {
+ Measure::Operation.where(measure_sid: -491538).where(measure_type_id: 'FAA').where(goods_nomenclature_item_id: '2402900000').any?
+ Measure::Operation.where(measure_sid: -491539).where(measure_type_id: 'FAA').where(goods_nomenclature_item_id: '2402201000').any?
+ }
+
+ apply {
+ Measure::Operation.where(measure_sid: -491538).where(measure_type_id: 'FAA').where(goods_nomenclature_item_id: '2402900000').delete
+ Measure::Operation.where(measure_sid: -491539).where(measure_type_id: 'FAA').where(goods_nomenclature_item_id: '2402201000').delete
+ Measure::Operation.where(measure_sid: -490646).update(validity_end_date: nil)
+ Measure::Operation.where(measure_sid: -490647).update(validity_end_date: nil)
+ }
+ end
+
+ down do
+ applicable { false }
+ apply {} # noop
+ end
+end
|
Add data migration to resolve further 0% measure
It was reported that the Erga Omnes value for further cigarette
commodities was showing as 0%. Upon investigation we discovered an
incorrect measures had been supplied in the CHIEF file on 28/11/2018,
to resolve this we've implemented a data migration that removes the
incorrect measures and sets the `validity_end_date` on the preceding
ones to NULL to restore them.
|
diff --git a/mobu.gemspec b/mobu.gemspec
index abc1234..def5678 100644
--- a/mobu.gemspec
+++ b/mobu.gemspec
@@ -25,6 +25,6 @@ spec.add_development_dependency "minitest"
spec.add_development_dependency "mocha", "~> 1.0"
- spec.add_dependency "rack", "~> 1.4"
+ spec.add_dependency "rack", ">= 1.4"
spec.add_dependency "actionpack", ">= 3.2"
end
|
Allow Rack version 1.4 or higher, to support Rails 5 upgrade
|
diff --git a/slack-gamebot/api/presenters/status_presenter.rb b/slack-gamebot/api/presenters/status_presenter.rb
index abc1234..def5678 100644
--- a/slack-gamebot/api/presenters/status_presenter.rb
+++ b/slack-gamebot/api/presenters/status_presenter.rb
@@ -11,8 +11,14 @@
property :games_count
property :games
+ property :gc
private
+
+ def gc
+ GC.start
+ GC.stat
+ end
def games_count
Game.count
|
Return GC stats after a GC.start.
|
diff --git a/voting_booth.gemspec b/voting_booth.gemspec
index abc1234..def5678 100644
--- a/voting_booth.gemspec
+++ b/voting_booth.gemspec
@@ -19,6 +19,6 @@ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
- s.add_dependency("rails", "~> 3.0.0")
+ s.add_dependency("rails", "~> 3.0")
s.add_dependency("rubystats", "~> 0.2.3")
end
|
Allow any version of Rails 3.x.
|
diff --git a/spec/controllers/applications_controller_spec.rb b/spec/controllers/applications_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/applications_controller_spec.rb
+++ b/spec/controllers/applications_controller_spec.rb
@@ -1,5 +1,60 @@ require 'spec_helper'
describe ApplicationsController do
+ render_views
+
+ context 'as an anonymous user' do
+ describe 'GET new' do
+ it 'renders the "sign_in" template' do
+ get :new
+ expect(response).to render_template 'sign_in'
+ end
+ end
+ end
+
+ context 'as an authenticated user' do
+ let(:user) { FactoryGirl.build(:user) }
+
+ before do
+ controller.stub(authenticate_user!: true)
+ controller.stub(signed_in?: true)
+ controller.stub(current_user: user)
+ end
+
+ describe 'GET new' do
+ it 'renders the "new" template' do
+ get :new
+ expect(response).to render_template 'new'
+ expect(assigns(:application_form).student_name).to eq user.name
+ expect(assigns(:application_form).student_email).to eq user.email
+ end
+ end
+
+ describe 'POST create' do
+ before { user.save}
+
+ it 'fails to create invalid record' do
+ expect do
+ post :create, application: { student_name: nil }
+ end.not_to change { user.applications.count }
+ expect(flash.now[:alert]).to be_present
+ expect(response).to render_template 'new'
+ end
+
+ it 'creates a new application' do
+ allow_any_instance_of(ApplicationForm).
+ to receive(:valid?).and_return(true)
+ valid_attributes = FactoryGirl.attributes_for(:application).merge(
+ student_name: user.name,
+ student_email: user.email
+ )
+ expect do
+ post :create, application: valid_attributes
+ puts assigns(:application_form).errors.full_messages
+ end.to change { user.applications.count }.by(1)
+ expect(response).to render_template 'create'
+ end
+ end
+ end
end
|
Add functional tests for ApplicationsController
|
diff --git a/spec/features/admin/configuration/general_settings_spec.rb b/spec/features/admin/configuration/general_settings_spec.rb
index abc1234..def5678 100644
--- a/spec/features/admin/configuration/general_settings_spec.rb
+++ b/spec/features/admin/configuration/general_settings_spec.rb
@@ -30,4 +30,19 @@ expect(find("#site_name").value).to eq("OFN Demo Site99")
end
end
+
+ context 'editing currency symbol position' do
+ it 'updates its position' do
+ expect(page).to have_content('Currency Settings')
+
+ within('.currency') do
+ find("[for='currency_symbol_position_after']").click
+ end
+
+ click_button 'Update'
+
+ expect(page).to have_content(Spree.t(:successfully_updated, resource: Spree.t(:general_settings)))
+ expect(page).to have_checked_field('10.00 $')
+ end
+ end
end
|
Test that currency symbol position can be changed
|
diff --git a/Library/Homebrew/unpack_strategy/executable.rb b/Library/Homebrew/unpack_strategy/executable.rb
index abc1234..def5678 100644
--- a/Library/Homebrew/unpack_strategy/executable.rb
+++ b/Library/Homebrew/unpack_strategy/executable.rb
@@ -1,17 +1,9 @@ require_relative "uncompressed"
-
-require "vendor/macho/macho"
module UnpackStrategy
class Executable < Uncompressed
def self.can_extract?(path:, magic_number:)
- return true if magic_number.match?(/\A#!\s*\S+/n)
-
- begin
- path.file? && MachO.open(path).header.executable?
- rescue MachO::NotAMachOError
- false
- end
+ magic_number.match?(/\A#!\s*\S+/n)
end
end
end
|
Remove `MachO` check for `Executable`.
|
diff --git a/lib/fog/google/models/storage_json/directories.rb b/lib/fog/google/models/storage_json/directories.rb
index abc1234..def5678 100644
--- a/lib/fog/google/models/storage_json/directories.rb
+++ b/lib/fog/google/models/storage_json/directories.rb
@@ -18,16 +18,7 @@ :max_keys => "max-keys",
:prefix => "prefix")
data = service.get_bucket(key, options).body
- directory = new(:key => data["name"])
- # options = {}
- # for k, v in data
- # if %w(commonPrefixes delimiter IsTruncated Marker MaxKeys Prefix).include?(k)
- # options[k] = v
- # end
- # end
- # directory.files.merge_attributes(options)
- # directory.files.load(data["contents"])
- directory
+ new(:key => data["name"])
rescue Excon::Errors::NotFound
nil
end
|
Remove handler for unused options and unused file loading in directory
|
diff --git a/spec/factories/sequences.rb b/spec/factories/sequences.rb
index abc1234..def5678 100644
--- a/spec/factories/sequences.rb
+++ b/spec/factories/sequences.rb
@@ -4,5 +4,6 @@ factory :sequence do
title "MyString"
description "MyText"
+ abstract "short abstract"
end
end
|
Add abstract to sequence factory.
|
diff --git a/spec/support/service.rb b/spec/support/service.rb
index abc1234..def5678 100644
--- a/spec/support/service.rb
+++ b/spec/support/service.rb
@@ -46,3 +46,10 @@ attribute :id, :integer
attribute :text, :string
end
+
+# DRAFT: Singular resource
+#class Singular < Acfs::Resource
+# service UserService, singular: true
+#
+# attribute :name, :string
+#end
|
Add spec draft for singular resources.
|
diff --git a/lib/arel/session.rb b/lib/arel/session.rb
index abc1234..def5678 100644
--- a/lib/arel/session.rb
+++ b/lib/arel/session.rb
@@ -35,12 +35,10 @@
def update(update)
update.call
- update
end
def delete(delete)
delete.call
- delete
end
end
include CRUD
|
Return delete result instead Arel object
|
diff --git a/lib/geo_redirect.rb b/lib/geo_redirect.rb
index abc1234..def5678 100644
--- a/lib/geo_redirect.rb
+++ b/lib/geo_redirect.rb
@@ -4,6 +4,8 @@ module GeoRedirect
# Load rake tasks
- require 'geo_redirect/railtie' if defined?(Rails)
+ if defined? Rails
+ require 'geo_redirect/railtie'
+ end
end
|
Convert inline if to block
This was the simplecov coverage is no longer 100%,
because we don't test the railtie (see issue #14).
|
diff --git a/config/schedule.rb b/config/schedule.rb
index abc1234..def5678 100644
--- a/config/schedule.rb
+++ b/config/schedule.rb
@@ -21,7 +21,7 @@
set :output, 'log/cron.log'
-every 30.minutes do
+every 5.minutes do
rake "batch:update_constantly"
end
|
Change update_constantly back to every 5 minutes
|
diff --git a/lib/slatan/mouth.rb b/lib/slatan/mouth.rb
index abc1234..def5678 100644
--- a/lib/slatan/mouth.rb
+++ b/lib/slatan/mouth.rb
@@ -1,11 +1,33 @@+require 'slatan/spirit'
+require 'slatan/api_wrapper/chat'
+
+require 'net/http'
+
module Slatan
- class Mouth
- def initialize(heart)
- @heart = heart
- end
+ module Mouth
+ include Chat
- # send message just as it is.
- def say(msg)
+ class << self
+ def send(method, msg)
+ base_url = 'https://slack.com/api'
+ msg = {
+ channel: 'C04QLLWR6',
+ as_user: true,
+ token: Spirit.see[:slack_token]
+ }.merge(msg)
+
+ uri = URI.parse("#{base_url}/#{method}?#{URI.encode_www_form(msg)}")
+ request = Net::HTTP::Post.new(uri.request_uri, {
+ 'Content-Type' =>'application/json'
+ })
+ http = Net::HTTP.new(uri.host, uri.port)
+ http.use_ssl = true
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
+
+ http.start do |h|
+ response = h.request(request)
+ end
+ end
end
end
end
|
Create post system using Slack Web API
|
diff --git a/lib/sorty/params.rb b/lib/sorty/params.rb
index abc1234..def5678 100644
--- a/lib/sorty/params.rb
+++ b/lib/sorty/params.rb
@@ -1,33 +1,55 @@ module Sorty
class Params
- attr_reader :column, :direction, :declared
+ attr_reader :column, :direction, :defined_cols, :collection
DEFAULT_SORT_KEY = :updated_at
DEFAULT_SORT_DIR = :desc
# TODO: Maybe set some default sort columns
- def initialize(col, dir, declared)
+ def initialize(col, dir, collection)
@column = :"#{col}"
@direction = :"#{dir}"
- @declared = declared
+ @collection = collection
+ @defined_cols = collection.sort_columns
end
def options
Hash[sort_col, sort_dir]
end
+ def options!
+ Hash[sort_col!, sort_dir!]
+ end
+
private
- # TODO: Check if existing table column is given
def sort_col
- return DEFAULT_SORT_KEY if column.blank?
- declared.fetch(:"#{column}", {}).keys.first || DEFAULT_SORT_KEY
+ sort_col!
+ rescue
+ DEFAULT_SORT_KEY
end
def sort_dir
+ sort_dir!
+ rescue
+ DEFAULT_SORT_DIR
+ end
+
+ def sort_col!
+ fail Sorty::Errors::InvalidColumnDefined.new(column) if column.blank?
+ col = defined_cols.fetch(:"#{column}").keys.first
+ fail Sorty::Errors::ColumnDoesNotExist.new(col.to_s) unless collection.column_names.include?(col.to_s)
+ col
+ rescue KeyError
+ fail Sorty::Errors::InvalidExposedAttribute.new(column)
+ end
+
+ def sort_dir!
return direction if %i(desc asc).include?(direction)
- declared.fetch(:"#{column}", {}).values.first || DEFAULT_SORT_DIR
+ defined_cols.fetch(:"#{column}").values.first
+ rescue KeyError
+ fail Sorty::Errors::InvalidDirectionDefined
end
end
end
|
Add bang methods and handle errors
|
diff --git a/lib/vimentor/cli.rb b/lib/vimentor/cli.rb
index abc1234..def5678 100644
--- a/lib/vimentor/cli.rb
+++ b/lib/vimentor/cli.rb
@@ -1,14 +1,14 @@ module Vimentor
- LOGFILE = "/tmp/vimentor_keylog"
- SAVEROOT = Dir.home + "/vimentor";
+ SAVEROOT = Dir.home + "/vimentor"
class CLI < Thor
desc "vim ARGS", "launch Vim session"
def vim(*args)
info = MetaInfo.new()
+ logfile = Tempfile.new("vimkeylog")
- vimcmd = "vim -W #{LOGFILE} #{args.join(" ")}"
+ vimcmd = "vim -W #{logfile.path} #{args.join(" ")}"
say "Invoking: #{vimcmd}"
system(vimcmd)
say "End vim session."
@@ -16,7 +16,7 @@ info.set_end_time()
# Parse keylog
- log = Keylog.new(File.read(LOGFILE))
+ log = Keylog.new(logfile.read)
say log.to_a.frequency
# Create directory
@@ -28,7 +28,8 @@ fn_r = d + "/" + unix_t
# Save keylog
- FileUtils.mv(LOGFILE, fn_r + ".keylog")
+ FileUtils.cp(logfile.path, fn_r + ".keylog")
+ logfile.close
# Save meta info
info.store(fn_r + ".meta")
|
Use unique temp file for log data (to allow multiple sessions)
|
diff --git a/spec/unit/client/active_record/notification_spec.rb b/spec/unit/client/active_record/notification_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/client/active_record/notification_spec.rb
+++ b/spec/unit/client/active_record/notification_spec.rb
@@ -18,4 +18,11 @@ expect(notification.app).to be_valid
expect(notification).to be_valid
end
+
+ it 'does not mix notification and data payloads' do
+ notification.data = { key: 'this is data' }
+ notification.notification = { key: 'this is notification' }
+ expect(notification.data).to eq('key' => 'this is data')
+ expect(notification.notification).to eq('key' => 'this is notification')
+ end
end if active_record?
|
Add test showing incorrect behaviour
|
diff --git a/spec/unit/facter/util/fact_rabbitmq_version_spec.rb b/spec/unit/facter/util/fact_rabbitmq_version_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/facter/util/fact_rabbitmq_version_spec.rb
+++ b/spec/unit/facter/util/fact_rabbitmq_version_spec.rb
@@ -19,6 +19,15 @@ expect(Facter.fact(:rabbitmq_version).value).to eq('3.6.0')
end
end
+ context 'with invalid value' do
+ before do
+ allow(Facter::Util::Resolution).to receive(:which).with('rabbitmqadmin') { true }
+ allow(Facter::Core::Execution).to receive(:execute).with('rabbitmqadmin --version 2>&1') { 'rabbitmqadmin %%VSN%%' }
+ end
+ it do
+ expect(Facter.fact(:rabbitmq_version).value).to be_nil
+ end
+ end
context 'rabbitmqadmin is not in path' do
before do
allow(Facter::Util::Resolution).to receive(:which).with('rabbitmqadmin') { false }
|
Add test for invalid version value
|
diff --git a/spec/support/mock_server.rb b/spec/support/mock_server.rb
index abc1234..def5678 100644
--- a/spec/support/mock_server.rb
+++ b/spec/support/mock_server.rb
@@ -3,8 +3,6 @@ TEST_SERVER_PORT = 65432
class MockService < WEBrick::HTTPServlet::AbstractServlet
- class << self; attr_accessor :post_handler; end
-
def do_GET(request, response)
case request.path
when "/"
@@ -31,7 +29,7 @@ response.body = "passed :)"
else
response.status = 400
- response.vody = "invalid! >:E"
+ response.body = "invalid! >:E"
end
else
response.status = 404
@@ -52,8 +50,7 @@ MockServer = WEBrick::HTTPServer.new(:Port => TEST_SERVER_PORT, :AccessLog => [])
MockServer.mount "/", MockService
-Thread.new { MockServer.start }
-trap("INT") { MockServer.shutdown; exit }
+t = Thread.new { MockServer.start }
+trap("INT") { MockServer.shutdown; exit }
-# hax: wait for webrick to start
-sleep 0.1+Thread.pass while t.status and t.status != "sleep"
|
Use Thread.pass to spin while WEBrick is starting up
|
diff --git a/spec/support/test_server.rb b/spec/support/test_server.rb
index abc1234..def5678 100644
--- a/spec/support/test_server.rb
+++ b/spec/support/test_server.rb
@@ -4,7 +4,7 @@
class TestServer < Sinatra::Base
disable :logging
- set :server, 'thin'
+ set :server, 'puma'
set :public_folder, Proc.new { File.join(root, "static") }
get '/*.rss' do
|
Update tests to use Puma
|
diff --git a/diffy.gemspec b/diffy.gemspec
index abc1234..def5678 100644
--- a/diffy.gemspec
+++ b/diffy.gemspec
@@ -19,5 +19,5 @@ spec.require_paths = ["lib"]
spec.add_development_dependency "rake"
- spec.add_development_dependency "rspec", '~> 2.14'
-end
+ spec.add_development_dependency "rspec"
+end
|
Fix RSpec and Rake conflict
At 2.3.3 version specs are already failing.
```
$ bundle exec rake
rake aborted!
NoMethodError: undefined method `last_comment' for #<Rake::Application:0x007fcc8bbf3858>
/Users/abinoam/.rvm/gems/ruby-2.3.3/gems/rspec-core-2.99.2/lib/rspec/core/rake_task.rb:143:in `initialize'
/Users/abinoam/diffy/Rakefile:6:in `new'
/Users/abinoam/diffy/Rakefile:6:in `<top (required)>'
/Users/abinoam/.rvm/gems/ruby-2.3.3/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/Users/abinoam/.rvm/gems/ruby-2.3.3/bin/ruby_executable_hooks:15:in `eval'
/Users/abinoam/.rvm/gems/ruby-2.3.3/bin/ruby_executable_hooks:15:in `<main>'
(See full trace by running task with --trace)
```
Travis has already issued a warning.
See: https://travis-ci.org/samg/diffy/jobs/171993776
```
[DEPRECATION] `last_comment` is deprecated. Please use `last_description` instead.
```
Just unlocking RSpec version solves the resolution problem.
All specs keep passing green.
|
diff --git a/app/controllers/backend/articles_controller.rb b/app/controllers/backend/articles_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/backend/articles_controller.rb
+++ b/app/controllers/backend/articles_controller.rb
@@ -2,7 +2,7 @@ include Concerns::Backend::TranslatableController
include Concerns::PaginationController
- before_action :find_model, only: [:edit, :update]
+ before_action :find_model, only: [:edit, :update, :destroy]
before_action -> { breadcrumb.add t('b.articles'), backend_articles_path }
def index
@@ -33,7 +33,8 @@ end
def destroy
- # render json: { trashed: @model.destroy }
+ @model.destroy
+ redirect_to backend_articles_path, notice: translate_notice(:deleted, :article)
end
private
|
Implement the article destroy action.
|
diff --git a/app/views/products/google_merchant.rss.builder b/app/views/products/google_merchant.rss.builder
index abc1234..def5678 100644
--- a/app/views/products/google_merchant.rss.builder
+++ b/app/views/products/google_merchant.rss.builder
@@ -12,7 +12,7 @@ xml.item do
xml.id product.id.to_s
xml.title product.name
- xml.description CGI.escapeHTML(product.description)
+ xml.description CGI.escapeHTML(product.description) if product.description
xml.link production_domain + 'products/' + product.permalink
xml.tag! "g:mpn", product.sku.to_s
xml.tag! "g:id", product.id.to_s
|
Work with null description now
|
diff --git a/roles/web.rb b/roles/web.rb
index abc1234..def5678 100644
--- a/roles/web.rb
+++ b/roles/web.rb
@@ -17,9 +17,9 @@ :pool_idle_time => 0
},
:web => {
- :status => "database_offline",
- :database_host => "db",
- :readonly_database_host => "katla"
+ :status => "database_readonly",
+ :database_host => "db-slave",
+ :readonly_database_host => "db-slave"
}
)
|
Bring site back online in readonly mode on ramoth
|
diff --git a/mock_server.gemspec b/mock_server.gemspec
index abc1234..def5678 100644
--- a/mock_server.gemspec
+++ b/mock_server.gemspec
@@ -8,4 +8,7 @@
s.files = Dir['README.md', 'LICENSE', 'lib/mock_server.rb', 'lib/mock_server/record.rb', 'lib/mock_server/playback.rb', 'lib/mock_server/utils.rb', 'lib/mock_server/spec/helpers.rb']
s.require_path = 'lib'
+
+ s.add_runtime_dependency 'rack'
+ s.add_runtime_dependency 'hashie', '~> 1.2'
end
|
Include dependency in the gemspec
|
diff --git a/config/initializers/datadog.rb b/config/initializers/datadog.rb
index abc1234..def5678 100644
--- a/config/initializers/datadog.rb
+++ b/config/initializers/datadog.rb
@@ -3,9 +3,7 @@ c.use :rails, service_name: 'rails'
c.use :delayed_job, service_name: 'delayed_job'
c.use :dalli, service_name: 'memcached'
-
c.analytics_enabled = true
c.runtime_metrics_enabled = true
- c.request_queuing = true
end
end
|
Revert "Enable request queuing tracking in Datadog"
This reverts commit 91e527614002377e4dfcf360522a6244fa530a37.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.