diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/Casks/opera-beta.rb b/Casks/opera-beta.rb
index abc1234..def5678 100644
--- a/Casks/opera-beta.rb
+++ b/Casks/opera-beta.rb
@@ -1,6 +1,6 @@ cask :v1 => 'opera-beta' do
- version '30.0.1835.18'
- sha256 '7c27bfd506a5d3a9a41eabd27908344269d1d4f5a85d451d2d2ce0a9ee602993'
+ version '30.0.1835.47'
+ sha256 '97817b3a4bbf6eb7e92493f241665012f42592b3b404e888ad3cb05f61c8b39c'
url "http://get.geo.opera.com/pub/opera-beta/#{version}/mac/Opera_beta_#{version}_Setup.dmg"
homepage 'http://www.opera.com/computer/beta'
|
Upgrade Opera Beta.app to v30.0.1835.47
|
diff --git a/app/controllers/api/materials_controller.rb b/app/controllers/api/materials_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/materials_controller.rb
+++ b/app/controllers/api/materials_controller.rb
@@ -1,22 +1,35 @@-class Api::MaterialsController < ApplicationController
- skip_before_action :verify_authenticity_token
+class Api::MaterialsController < ApiController
+ before_action :set_material, only: [:show, :update, :destroy]
def index
+ @materials = Material.all
+ json_response(@todos)
end
def create
+ @material = Material.create!(material_params)
+ json_response(@material, :created)
+ end
+
+ def show
+ json_response(@material)
end
def update
+ @material.update(material_params)
+ head :no_content
end
def destroy
- end
-
- def show
+ @material.destroy
+ head :no_content
end
private
+
+ def set_material
+ @material = Material.find(params[:id])
+ end
def material_params
params.permit(
|
Create CRUD methods for materials controller
|
diff --git a/app/views/gitlab_client_identities/_gitlab_client_identity.json.jbuilder b/app/views/gitlab_client_identities/_gitlab_client_identity.json.jbuilder
index abc1234..def5678 100644
--- a/app/views/gitlab_client_identities/_gitlab_client_identity.json.jbuilder
+++ b/app/views/gitlab_client_identities/_gitlab_client_identity.json.jbuilder
@@ -2,5 +2,6 @@ json.user_id gitlab_client_identity.user_id
json.host gitlab_client_identity.host
json.gitlab_user_id gitlab_client_identity.gitlab_user_id
+json.gitlab_user_name gitlab_client_identity.gitlab_user_name
json.created_at gitlab_client_identity.created_at
json.updated_at gitlab_client_identity.updated_at
|
Add missing gitlab_user_name attribute to attributes reported for gitlab_client_identity.
|
diff --git a/app/controllers/health_checks_controller.rb b/app/controllers/health_checks_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/health_checks_controller.rb
+++ b/app/controllers/health_checks_controller.rb
@@ -4,11 +4,12 @@ @health_checks = HealthChecks.all
respond_to do |format|
- if HealthChecks.ok?
- format.html { render :action => :index, :layout => false }
- else
- format.html { render :action => :index, :layout => false , :status => 500 }
- end
+ response_hash = { :action => :index, :layout => false }
+ format.html do
+ render HealthChecks.ok? ? response_hash :
+ response_hash.merge(:status => 500)
+ end
+ format.json { render json: { health_checks: HealthChecks.ok? } }
end
end
|
Include a JSON healthcheck for ELB which does not 500 if the app is up
|
diff --git a/lib/active_cmis/ns.rb b/lib/active_cmis/ns.rb
index abc1234..def5678 100644
--- a/lib/active_cmis/ns.rb
+++ b/lib/active_cmis/ns.rb
@@ -8,11 +8,11 @@ ATOM = "http://www.w3.org/2005/Atom"
COMBINED = {
- "c" => CMIS_CORE,
- "cra" => CMIS_REST,
- "cm" => CMIS_MESSAGING,
- "app" => APP,
- "at" => ATOM
+ "xmlns:c" => CMIS_CORE,
+ "xmlns:cra" => CMIS_REST,
+ "xmlns:cm" => CMIS_MESSAGING,
+ "xmlns:app" => APP,
+ "xmlns:at" => ATOM
}
end
end
|
Allow NS::COMBINED to be used in building xml
|
diff --git a/lib/capybara/rspec.rb b/lib/capybara/rspec.rb
index abc1234..def5678 100644
--- a/lib/capybara/rspec.rb
+++ b/lib/capybara/rspec.rb
@@ -9,6 +9,8 @@ RSpec.configure do |config|
config.include Capybara::DSL, type: :feature
config.include Capybara::RSpecMatchers, type: :feature
+ config.include Capybara::DSL, type: :system
+ config.include Capybara::RSpecMatchers, type: :system
config.include Capybara::RSpecMatchers, type: :view
# The before and after blocks must run instantaneously, because Capybara
|
Include DSL and RSpecMatchers into system specs by default
|
diff --git a/lib/grabble/vertex.rb b/lib/grabble/vertex.rb
index abc1234..def5678 100644
--- a/lib/grabble/vertex.rb
+++ b/lib/grabble/vertex.rb
@@ -1,12 +1,9 @@ module Grabble
class Vertex
+ attr_reader :data
+
def initialize(data)
@data = data
end
-
- def data
- @data
- end
-
end
end
|
Use attr_reader instead of manual getter method
|
diff --git a/lib/kahuna/handler.rb b/lib/kahuna/handler.rb
index abc1234..def5678 100644
--- a/lib/kahuna/handler.rb
+++ b/lib/kahuna/handler.rb
@@ -4,24 +4,6 @@ module Kahuna
class Handler
attr_reader :event, :members
-
- # def self.build
- # klass = Class.new(BasicObject) do
- # def inspect
- # "<handler>"
- # end
-
- # klass = self
- # define_method(:class) { klass }
- # end
-
- # builder = ActionClassBuilder.new(klass)
- # yield(builder) if block_given?
- # unless builder.interface_defined?
- # builder.respond_to_missing_with_nil
- # end
- # klass
- # end
def initialize(data, &block)
@event = Event.new data
@@ -31,19 +13,9 @@ @action = block_given? ? block : ->(event, members) {}
end
- # def to_string
- # <<-EOF
- # DATA: #@data
- # EVENT: #@event
- # NAME: #@name
- # ROLE: #@role
- # USER EVENT: #@user_event
- # LAMPORT TIME: #@lamport_time
- # EOF
- # end
-
- def execute
- @action.call(event, members)
+ def execute &block
+ block_to_call = block_given? ? block : @action
+ block_to_call.call(event, members)
end
end
end
|
Remove stupid comments from experiments
|
diff --git a/lib/poke/character.rb b/lib/poke/character.rb
index abc1234..def5678 100644
--- a/lib/poke/character.rb
+++ b/lib/poke/character.rb
@@ -3,6 +3,16 @@ # contains various methods for moving, updating, drawing, and collision
# detection.
class Character
+
+ PARAMS_REQUIRED = [:window, :x, :y]
+
+ attr_reader :x
+ attr_reader :y
+ attr_reader :direction
+
+ def initialize(params = {})
+ end
+
end
end
|
Add base skeleton structure to Character
|
diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/organizations_controller.rb
+++ b/app/controllers/organizations_controller.rb
@@ -11,7 +11,13 @@ :organization_id => params[:id] })
return forbidden unless membership
- membership.organization.update_attributes pick(params, :language)
+ if membership.organization.language != params[:language]
+ Document.find(:all,:conditions=>{:organization_id=>membership.organization_id}).each do | doc |
+ expire_page doc.canonical_cache_path if doc.cacheable?
+ end
+ end
+
+ membership.organization.update_attributes pick(params, :language, :document_language)
json membership.organization.canonical
end
|
Clear Doc cache when Organization language changes
|
diff --git a/app/controllers/relationships_controller.rb b/app/controllers/relationships_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/relationships_controller.rb
+++ b/app/controllers/relationships_controller.rb
@@ -2,15 +2,11 @@ before_filter :authenticate_user!
#TODO: Use ajax?
+ #TODO: Add conditional to make sure a contact cannot be requestd twice
def create
- relationship = Relationship.new(status: "pending")
-
- student = Student.find(params[:student_id])
- relationship.student = student
- relationship.partner_id = current_user.partner_id
- relationship.save
-
- flash[:notice] = "You successfully requested contact with #{student.name}."
+ Relationship.pending!(current_user.partner.id, params[:student_id])
+ flash[:notice] = "You successfully requested contact with #{Student.find(params[:student_id]).name}."
redirect_to students_path
end
+
end
|
Refactor controller to include new connection creating methods
|
diff --git a/lib/vagrant-mirror.rb b/lib/vagrant-mirror.rb
index abc1234..def5678 100644
--- a/lib/vagrant-mirror.rb
+++ b/lib/vagrant-mirror.rb
@@ -36,4 +36,7 @@ Vagrant.actions[:start].use Vagrant::Mirror::Middleware::Sync
# Add the mirror middleware to the standard stacks
-Vagrant.actions[:start].insert Vagrant::VM::Provision, Vagrant::Mirror::Middleware::Mirror+Vagrant.actions[:start].insert Vagrant::Action::VM::Provision, Vagrant::Mirror::Middleware::Mirror
+
+# Abort on unhandled exceptions in any thread
+Thread.abort_on_exception = true
|
Fix syntax errors, abort on any thread exception
|
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
index abc1234..def5678 100644
--- a/config/initializers/session_store.rb
+++ b/config/initializers/session_store.rb
@@ -5,4 +5,5 @@ :cookie_store,
key: '_nippo_session',
secure: Rails.env.production?,
+ expire_after: 30.days,
)
|
Set expiration date to session cookie
|
diff --git a/Casks/beatport-pro.rb b/Casks/beatport-pro.rb
index abc1234..def5678 100644
--- a/Casks/beatport-pro.rb
+++ b/Casks/beatport-pro.rb
@@ -1,12 +1,12 @@ cask :v1 => 'beatport-pro' do
- version '2.1.1_137'
- sha256 '62526d08723e5a54953473a2c1530e5b298ab2a50a491dd2a846bf7c0b9499cb'
+ version '2.1.4_150'
+ sha256 'b7e6e330d77d242a30783141aad8c9a9a9f9d1e67da3afe4cb8daefa6e5545d2'
url "http://pro.beatport.com/mac/#{version}/beatportpro_#{version}.dmg"
name 'Beatport'
name 'Beatport Pro'
homepage 'http://pro.beatport.com/'
- license :unknown # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder
+ license :closed
app 'Beatport Pro.app'
end
|
Update Beatport Pro to 2.1.4
|
diff --git a/spec/workers/download_manuscript_worker_spec.rb b/spec/workers/download_manuscript_worker_spec.rb
index abc1234..def5678 100644
--- a/spec/workers/download_manuscript_worker_spec.rb
+++ b/spec/workers/download_manuscript_worker_spec.rb
@@ -8,14 +8,14 @@ paper.create_manuscript!
end
- it "downloads the attachment" do
+ pending "downloads the attachment" do
with_aws_cassette('manuscript') do
DownloadManuscriptWorker.new.perform(paper.manuscript.id, url, nil)
expect(paper.manuscript.reload.source.url).to match(%r{manuscript/source\.docx})
end
end
- it "updates the paper title" do
+ pending "updates the paper title" do
with_aws_cassette('manuscript') do
DownloadManuscriptWorker.new.perform(paper.manuscript.id, url, nil)
expect(paper.reload.title).to eq("Technical Writing Information Sheets")
|
Mark DownloadManuscriptWorker spec as pending
|
diff --git a/core/encoding/locale_charmap_spec.rb b/core/encoding/locale_charmap_spec.rb
index abc1234..def5678 100644
--- a/core/encoding/locale_charmap_spec.rb
+++ b/core/encoding/locale_charmap_spec.rb
@@ -7,22 +7,31 @@ end
# FIXME: Get this working on Windows
- platform_is :os => [:darwin, :linux] do
- # FIXME: This spec fails on Mac OS X because it doesn't have ANSI_X3.4-1968 locale.
- # FIXME: If ENV['LC_ALL'] is already set, it comes first.
- it "returns a value based on the LANG environment variable" do
- old_lang = ENV['LANG']
- ENV['LANG'] = 'C'
+ platform_is :linux do
+ it "returns a value based on the LC_ALL environment variable" do
+ old_lc_all = ENV['LC_ALL']
+ ENV['LC_ALL'] = 'C'
ruby_exe("print Encoding.locale_charmap").should == 'ANSI_X3.4-1968'
- ENV['LANG'] = old_lang
+ ENV['LC_ALL'] = old_lc_all
end
+ end
- it "is unaffected by assigning to ENV['LANG'] in the same process" do
+ platform_is :bsd, :darwin do
+ it "returns a value based on the LC_ALL environment variable" do
+ old_lc_all = ENV['LC_ALL']
+ ENV['LC_ALL'] = 'C'
+ ruby_exe("print Encoding.locale_charmap").should == 'US-ASCII'
+ ENV['LC_ALL'] = old_lc_all
+ end
+ end
+
+ platform_is :os => [:bsd, :darwin, :linux] do
+ it "is unaffected by assigning to ENV['LC_ALL'] in the same process" do
old_charmap = Encoding.locale_charmap
- old_lang = ENV['LANG']
- ENV['LANG'] = 'C'
+ old_lc_all = ENV['LC_ALL']
+ ENV['LC_ALL'] = 'C'
Encoding.locale_charmap.should == old_charmap
- ENV['LANG'] = old_lang
+ ENV['LC_ALL'] = old_lc_all
end
end
end
|
Fix for *BSD and Darwin about locale charmap.
* The result of locale charmap is not standardized.
So even if LANG=C, locale charmap name is not predictable.
* LC_ALL is prior to LANG, so we use LC_ALL.
|
diff --git a/DSSparseArray.podspec b/DSSparseArray.podspec
index abc1234..def5678 100644
--- a/DSSparseArray.podspec
+++ b/DSSparseArray.podspec
@@ -6,6 +6,6 @@ s.source = { :git => "https://github.com/LavaSlider/DSSparseArray.git", :tag => "1.0.0" }
s.summary = "Objective C Sparse Array Implementation"
s.homepage = "https://github.com/LavaSlider/DSSparseArray"
- s.source_files = 'DSSparseArray/*.{h,m}'
+ s.source_files = 'DSSparseArray/DS*SparseArray*.{h,m}'
s.requires_arc = true
end
|
Change file pattern in pod
|
diff --git a/fcc_reboot.gemspec b/fcc_reboot.gemspec
index abc1234..def5678 100644
--- a/fcc_reboot.gemspec
+++ b/fcc_reboot.gemspec
@@ -7,8 +7,8 @@ gem.add_dependency 'hashie', '~> 1.2'
gem.add_dependency 'json', '~> 1.6'
gem.add_dependency 'multi_json', '~> 1.3'
+ gem.add_development_dependency 'maruku'
gem.add_development_dependency 'rake'
- gem.add_development_dependency 'rdiscount'
gem.add_development_dependency 'rspec'
gem.add_development_dependency 'simplecov'
gem.add_development_dependency 'webmock'
|
Use maruku instead of rdiscount for compatibility with JRuby and Rubinius in 1.9 mode
|
diff --git a/lib/cacheable_flash/rspec_matchers.rb b/lib/cacheable_flash/rspec_matchers.rb
index abc1234..def5678 100644
--- a/lib/cacheable_flash/rspec_matchers.rb
+++ b/lib/cacheable_flash/rspec_matchers.rb
@@ -1,33 +1,36 @@-require 'cacheable_flash/test_helpers'
+require 'stackable_flash/test_helpers' # Used in the definition of these matchers
+require 'stackable_flash/rspec_matchers' # Not used here, but for convenience
+require 'cacheable_flash/test_helpers' # Used in the definition of these matchers
module CacheableFlash
module RspecMatchers
+ include StackableFlash::TestHelpers
include CacheableFlash::TestHelpers
RSpec::Matchers.define :have_flash_cookie do |flash_status, expecting|
define_method :has_flash_cookie? do |response|
- flash = testable_flash(response)[flash_status]
- if flash.kind_of?(Array)
- if expecting.kind_of?(Array)
- flash == expecting
- else
- matches = flash.select do |to_check|
- to_check == expecting
- end
- matches.length > 0
- end
- else
- flash == expecting
- end
+ flash_in_stack(testable_flash(response)[flash_status], expecting)
end
-
match{|response| has_flash_cookie?(response)}
-
failure_message_for_should do |actual|
- "expected that flash cookie :#{expected[0]} #{testable_flash(actual)[expected[0]]} would include #{expected[1].inspect}"
+ "expected flash[:#{expected[0]}] to be or include #{expected[1].inspect}, but got #{testable_flash(actual)[expected[0]]}"
end
failure_message_for_should_not do |actual|
- "expected that flash cookie :#{expected[0]} #{testable_flash(actual)[expected[0]]} would not include #{expected[1].inspect}"
+ "expected flash[:#{expected[0]}] to not be and not include #{expected[1].inspect}, but got #{testable_flash(actual)[expected[0]]}"
end
end
+
+ RSpec::Matchers.define :have_cacheable_flash do |flash_status, expecting|
+ define_method :has_cacheable_flash? do |response|
+ flash_in_stack(testable_flash(response)[flash_status], expecting)
+ end
+ match{|response| has_cacheable_flash?(response)}
+ failure_message_for_should do |actual|
+ "expected flash[:#{expected[0]}] to be or include #{expected[1].inspect}, but got #{testable_flash(actual)[expected[0]]}"
+ end
+ failure_message_for_should_not do |actual|
+ "expected flash[:#{expected[0]}] to not be and not include #{expected[1].inspect}, but got #{testable_flash(actual)[expected[0]]}"
+ end
+ end
+
end
end
|
Use stackable_flash/test_helpers instead of reinventing the wheel
|
diff --git a/app/controllers/internal_change_notes_controller.rb b/app/controllers/internal_change_notes_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/internal_change_notes_controller.rb
+++ b/app/controllers/internal_change_notes_controller.rb
@@ -1,6 +1,6 @@ class InternalChangeNotesController < ApplicationController
def create
- InternalChangeNote.create(internal_change_note_params.merge(step_by_step_page_id: step_by_step_page.id, created_at: Time.now, author: current_user.name))
+ InternalChangeNote.create(required_fields.merge(other_fields))
redirect_to step_by_step_page_internal_change_notes_path, notice: 'Change note was successfully added.'
end
@@ -10,7 +10,15 @@ StepByStepPage.find(params[:step_by_step_page_id])
end
- def internal_change_note_params
+ def required_fields
params.require(:internal_change_note).permit(:description)
end
+
+ def other_fields
+ {
+ step_by_step_page_id: step_by_step_page.id,
+ created_at: Time.now,
+ author: current_user.name
+ }
+ end
end
|
Refactor how an InternalChangeNote is stored
This refactor will make it easier to optionally add a value for edition_number to the `other_fields` in the next commit.
|
diff --git a/lib/kosmos/packages/deadly_reentry.rb b/lib/kosmos/packages/deadly_reentry.rb
index abc1234..def5678 100644
--- a/lib/kosmos/packages/deadly_reentry.rb
+++ b/lib/kosmos/packages/deadly_reentry.rb
@@ -0,0 +1,9 @@+class DeadlyReentry < Kosmos::Package
+ title 'Deadly Reentry'
+ url 'https://github.com/NathanKell/DeadlyReentry/releases/download/v4.7/DeadlyReentryCont_v4.7.zip'
+
+ def install
+ merge_directory 'DeadlyReentry', into: 'GameData'
+ merge_directory 'ModuleManager.2.1.0.dll', into: 'GameData'
+ end
+end
|
Add package for Deadly Reentry.
|
diff --git a/test/integration/ad_creation_test.rb b/test/integration/ad_creation_test.rb
index abc1234..def5678 100644
--- a/test/integration/ad_creation_test.rb
+++ b/test/integration/ad_creation_test.rb
@@ -8,7 +8,7 @@
it 'can have pictures of 5 megabytes or less' do
with_file_of_size(5.megabytes) do |path|
- fill_ad_form(path)
+ submit_ad_form(path)
page.assert_no_text('Imagen debe estar entre 0 Bytes y 5 MB')
end
@@ -16,7 +16,7 @@
it 'cannot have pictures bigger than 5 megabytes' do
with_file_of_size(6.megabytes) do |path|
- fill_ad_form(path)
+ submit_ad_form(path)
page.assert_text('Imagen debe estar entre 0 Bytes y 5 MB')
end
@@ -24,7 +24,7 @@
private
- def fill_ad_form(file_path)
+ def submit_ad_form(file_path)
visit new_ad_path
attach_file :image, file_path
fill_in 'Título de tu anuncio:', with: 'File'
|
Rename helper method for clarity
The method also submits the form so `fill_form` was not accurate.
|
diff --git a/islay_blog.gemspec b/islay_blog.gemspec
index abc1234..def5678 100644
--- a/islay_blog.gemspec
+++ b/islay_blog.gemspec
@@ -16,7 +16,7 @@ s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.md"]
s.test_files = Dir["test/**/*"]
- s.add_dependency 'islay', '~> 1.0.4'
+ s.add_dependency 'islay', '~> 1.0.3'
s.add_dependency 'rdiscount', '~> 1.6.8'
s.add_dependency 'htmlentities', '~> 4.3.1'
s.add_dependency 'friendly_id', '~> 4.0.8'
|
Update Islay dependency to 1.0.3 (which actually exists)
|
diff --git a/db/seeds.rb b/db/seeds.rb
index abc1234..def5678 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -15,8 +15,7 @@ # so read line and split by myself.
open('db/commits.txt') do |file|
file.each do |line|
- repo_full_name, sha, *message_array = line.split(',').map(&:strip)
- message = message_array.join(', ')
+ repo_full_name, sha, message = line.split(', ', 3)
Commit.create(:repo_full_name => repo_full_name,
:sha => sha,
:message => message)
|
Improve method for data load
|
diff --git a/phantomjs-binaries.gemspec b/phantomjs-binaries.gemspec
index abc1234..def5678 100644
--- a/phantomjs-binaries.gemspec
+++ b/phantomjs-binaries.gemspec
@@ -7,7 +7,7 @@ s.version = Phantomjs::Binaries::VERSION
s.authors = ["Anton Vaynshtok"]
s.email = ["avaynshtok@gmail.com"]
- s.homepage = ""
+ s.homepage = "https://github.com/avaynshtok/phantomjs-binaries"
s.summary = %q{phantom.js binaries wrapped as a ruby gem}
s.description = %q{This package prevents you from having to install phantom.js independently outside your app.}
|
Make it so people can find the source from the Gemspec
|
diff --git a/lib/chamber.rb b/lib/chamber.rb
index abc1234..def5678 100644
--- a/lib/chamber.rb
+++ b/lib/chamber.rb
@@ -23,8 +23,12 @@ load_file(self.basepath + 'settings.yml')
end
- def [](key)
- settings[key]
+ def method_missing(name, *args)
+ settings.public_send(name, *args) if settings.respond_to?(name)
+ end
+
+ def respond_to_missing(name)
+ settings.respond_to?(name)
end
private
|
Use method missing to delegate any message sent to Chamber as a message for the underlying Hash
|
diff --git a/lib/bulk/engine.rb b/lib/bulk/engine.rb
index abc1234..def5678 100644
--- a/lib/bulk/engine.rb
+++ b/lib/bulk/engine.rb
@@ -16,7 +16,9 @@ require 'bulk/sproutcore'
end
- config.paths.add "app/bulk", :eager_load => true
- config.paths.add "app/sproutcore"
+ initializer "config paths" do |app|
+ app.config.paths.add "app/bulk", :eager_load => true
+ app.config.paths.add "app/sproutcore"
+ end
end
end
|
Fix setting paths for Rails 3.1
|
diff --git a/lib/konacha.rb b/lib/konacha.rb
index abc1234..def5678 100644
--- a/lib/konacha.rb
+++ b/lib/konacha.rb
@@ -40,7 +40,7 @@ Rails.application.assets.content_type_of(pathname) == 'application/javascript'
}.map { |pathname|
pathname.to_s.gsub(File.join(spec_root, ''), '')
- }
+ }.sort
end
end
end
|
Sort the spec_paths to avoid undefined ordering
I think that it's good practice to keep file lists sorted. Otherwise we
can get file-system dependent (undefined) file ordering, and we'll have
order-dependent tests showing up as unreproducible failures on the build
server, which is worse than having them pass silently.
Rails.application.assets seems to sort already, but let's be on the safe
side and treat it like a Dir[] call.
|
diff --git a/lib/ews/types/calendar_item.rb b/lib/ews/types/calendar_item.rb
index abc1234..def5678 100644
--- a/lib/ews/types/calendar_item.rb
+++ b/lib/ews/types/calendar_item.rb
@@ -8,15 +8,21 @@ recurring?: [:is_recurring, :text],
meeting?: [:is_meeting, :text],
cancelled?: [:is_cancelled, :text],
- }
+ duration: [:duration, :text],
+ time_zone: [:time_zone, :text],
+ start: [:start, :text],
+ end: [:end, :text],
+ location: [:location, :text],
+ all_day?: [:is_all_day_event, :text]
+ }
CALENDAR_ITEM_KEY_TYPES = {
recurring?: ->(str){str.downcase == 'true'},
meeting?: ->(str){str.downcase == 'true'},
cancelled?: ->(str){str.downcase == 'true'},
+ all_day?: ->(str){str.downcase == 'true'}
}
CALENDAR_ITEM_KEY_ALIAS = {}
-
private
|
Add duration, time zone, start, end, location and all day attributes to the calendar item
|
diff --git a/lib/gitlab/current_settings.rb b/lib/gitlab/current_settings.rb
index abc1234..def5678 100644
--- a/lib/gitlab/current_settings.rb
+++ b/lib/gitlab/current_settings.rb
@@ -41,6 +41,9 @@ use_db && ActiveRecord::Base.connection.active? &&
!ActiveRecord::Migrator.needs_migration? &&
ActiveRecord::Base.connection.table_exists?('application_settings')
+
+ rescue ActiveRecord::NoDatabaseError
+ false
end
end
end
|
Handle missing DBs in connect_to_db?
This ensures CurrentSettings#connect_to_db? returns "false" in the event
of a database not existing, instead of raising an error.
|
diff --git a/lib/scube/cli/commands/base.rb b/lib/scube/cli/commands/base.rb
index abc1234..def5678 100644
--- a/lib/scube/cli/commands/base.rb
+++ b/lib/scube/cli/commands/base.rb
@@ -17,9 +17,10 @@
attr_reader :client
- # FIXME: implement this correctly (arity errors)
def setup_arguments args
send :setup, *args if respond_to? :setup
+ rescue ::ArgumentError
+ fail ArgumentError
end
def ask prompt
|
Handle command arguments arity errors
|
diff --git a/lib/coordinates.rb b/lib/coordinates.rb
index abc1234..def5678 100644
--- a/lib/coordinates.rb
+++ b/lib/coordinates.rb
@@ -2,7 +2,7 @@
def initialize(window, user)
@window, @user = window, user
- @coordinate_text = Gosu::Font.new(@window, Media::Font, 16)
+ @coordinate_text = Gosu::Font.new(@window, Media::FONT, 16)
end
def update
@@ -11,7 +11,7 @@
def draw
@coordinate_text.draw("#{@x.to_s}, #{@y.to_s}", 416, 300, 1, 1, 1,
- Color::White, :default)
+ Color::WHITE, :default)
end
end
|
Update Coordinates to use new uppercase constants
|
diff --git a/lib/kaleidoscope/instance_methods.rb b/lib/kaleidoscope/instance_methods.rb
index abc1234..def5678 100644
--- a/lib/kaleidoscope/instance_methods.rb
+++ b/lib/kaleidoscope/instance_methods.rb
@@ -4,9 +4,11 @@ end
def generate_colors
+ Kaleidoscope.log("Generating colors.")
end
def destroy_colors
+ Kaleidoscope.log("Deleting colors.")
end
end
end
|
Add log messages to instance methods
|
diff --git a/activesupport/test/load_paths_test.rb b/activesupport/test/load_paths_test.rb
index abc1234..def5678 100644
--- a/activesupport/test/load_paths_test.rb
+++ b/activesupport/test/load_paths_test.rb
@@ -10,7 +10,7 @@ }
load_paths_count[File.expand_path('../../lib', __FILE__)] -= 1
- filtered = load_paths_count.select { |k, v| v > 1 }
- assert filtered.empty?, filtered.inspect
+ load_paths_count.select! { |k, v| v > 1 }
+ assert load_paths_count.empty?, load_paths_count.inspect
end
end
|
Drop extra variable from test
|
diff --git a/activesupport/test/subscriber_test.rb b/activesupport/test/subscriber_test.rb
index abc1234..def5678 100644
--- a/activesupport/test/subscriber_test.rb
+++ b/activesupport/test/subscriber_test.rb
@@ -23,6 +23,7 @@
# Monkey patch subscriber to test that only one subscriber per method is added.
class TestSubscriber
+ remove_method :open_party
def open_party(event)
events << event
end
|
Remove warning remeving the method before redefining
We need to test if the same method defined more than once only register
one subscriber for it. We can safelly remove because the method body is
the same and Subscriber use method_added hook for register the
subscriber.
|
diff --git a/ruby/spec/support/shared_examples.rb b/ruby/spec/support/shared_examples.rb
index abc1234..def5678 100644
--- a/ruby/spec/support/shared_examples.rb
+++ b/ruby/spec/support/shared_examples.rb
@@ -12,22 +12,30 @@
shared_examples_for "a bson element" do
- subject { (defined? obj) ? obj : described_class.new }
- its(:bson_type) { should eq(type) }
+ let(:element) do
+ obj || described_class.new
+ end
+
+ it "has the correct single byte BSON type" do
+ expect(element.bson_type).to eq(type)
+ end
end
shared_examples_for "a serializable bson element" do
it "serializes to bson" do
- obj.to_bson.should == bson
+ expect(obj.to_bson).to eq(bson)
end
end
shared_examples_for "a deserializable bson element" do
+ let(:io) do
+ StringIO.new(bson)
+ end
+
it "deserializes from bson" do
- io = StringIO.new(bson)
- described_class.from_bson(io).should == obj
+ expect(described_class.from_bson(io)).to eq(obj)
end
end
|
Change shared examples to proper conventions
|
diff --git a/lib/find_chrome.rb b/lib/find_chrome.rb
index abc1234..def5678 100644
--- a/lib/find_chrome.rb
+++ b/lib/find_chrome.rb
@@ -14,6 +14,7 @@ CHROMEDRIVER_PATHS = [
"/usr/local/bin/chromedriver",
"/usr/lib/chromium-browser/chromedriver",
+ "/app/.chromedriver/bin/chromedriver",
ENV["CHROMEDRIVER_PATH"],
find_executable("chromedriver"),
].compact.freeze
|
Add binary paths to chrome(driver) finder(s)
With the buildpacks we've now added to our heroku apps, we now have two
binaries available that we can use when we drive our applications. The
changes here point to the location of both of those binaries.
|
diff --git a/lib/gocd_client.rb b/lib/gocd_client.rb
index abc1234..def5678 100644
--- a/lib/gocd_client.rb
+++ b/lib/gocd_client.rb
@@ -27,7 +27,7 @@ next unless stage['result'] == 'Failed'
stage_url = "#{@gocd_addr}/go/pipelines/#{pipe_name}/#{event['counter']}/#{stage['name']}/#{stage['counter']}"
stage_display_name = "#{pipe_name} - #{event['label']} Stage #{stage['name']} = #{stage['result']}"
- status_html += "<a href=\"#{stage_url}\" target=\"_blank\">#{stage_display_name}</a>\n"
+ status_html += "<a href=\"#{stage_url}\" target=\"_blank\" style=\"color:white\" >#{stage_display_name}</a><br>\n"
end
end
status_html
|
Improve status report for GoCD issues
|
diff --git a/lib/alchemy_api.rb b/lib/alchemy_api.rb
index abc1234..def5678 100644
--- a/lib/alchemy_api.rb
+++ b/lib/alchemy_api.rb
@@ -5,6 +5,14 @@ Dir.glob(File.dirname(__FILE__) + "/**/*.rb").each do |f|
require f
end
+
+$LOAD_PATH.unshift(File.dirname(__FILE__))
+require 'alchemy_api/base'
+require 'alchemy_api/categorization'
+require 'alchemy_api/concept_tagging'
+require 'alchemy_api/language_detection'
+require 'alchemy_api/term_extraction'
+require 'alchemy_api/text_extraction'
module AlchemyApi
@api_key = nil
|
Make sure files require in the correct order.
|
diff --git a/lib/spidr/spidr.rb b/lib/spidr/spidr.rb
index abc1234..def5678 100644
--- a/lib/spidr/spidr.rb
+++ b/lib/spidr/spidr.rb
@@ -16,6 +16,7 @@ # @since 0.5.0
#
def self.robots?
+ @robots ||= false
@robots
end
|
Fix warning instance variable @robots not initialized
|
diff --git a/lib/tasks/eve.rake b/lib/tasks/eve.rake
index abc1234..def5678 100644
--- a/lib/tasks/eve.rake
+++ b/lib/tasks/eve.rake
@@ -36,4 +36,13 @@ AncestriesImporter.new.import
end
end
+
+ desc 'Import EveOnline Alliances'
+ task alliances: :environment do
+ ActiveRecord::Base.transaction do
+ Eve::Alliance.destroy_all
+
+ AlliancesImporter.new.import
+ end
+ end
end
|
Add rake task for import alliances
|
diff --git a/spec/support/browser_spec_helper.rb b/spec/support/browser_spec_helper.rb
index abc1234..def5678 100644
--- a/spec/support/browser_spec_helper.rb
+++ b/spec/support/browser_spec_helper.rb
@@ -46,7 +46,6 @@ $spec_app = Thread.new do
Rack::Server.new(:app => Hdo::Application,
:environment => Rails.env,
- :server => 'puma',
:Port => port_to_use).start
end
|
Revert "Use puma for browser specs"
This reverts commit a4ff77f90abbe84d1f14ddd3520c217b7e5510ab.
|
diff --git a/spec/unit/template_variable_spec.rb b/spec/unit/template_variable_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/template_variable_spec.rb
+++ b/spec/unit/template_variable_spec.rb
@@ -7,16 +7,16 @@
it "requires a variable name" do
expect { TemplateVariable.new }.to raise_error(KeyError)
- expect { TemplateVariable.new(:name => "Variable") }.to_not raise_error
+ expect { TemplateVariable.new(:name => "variable") }.to_not raise_error
end
it "exposes its variable name" do
- data = TemplateVariable.new(:name => "Variable")
- expect(data.name).to eq("Variable")
+ data = TemplateVariable.new(:name => "variable")
+ expect(data.name).to eq("variable")
end
it "can accept a list of filters applied to the variable" do
- data = TemplateVariable.new(:name => "Variable", :filters => [:downcase])
+ data = TemplateVariable.new(:name => "variable", :filters => [:downcase])
expect(data.filters).to match_array([:downcase])
end
|
Use standard variable casing in specs
|
diff --git a/musical-pitch-classes/pitch_class.rb b/musical-pitch-classes/pitch_class.rb
index abc1234..def5678 100644
--- a/musical-pitch-classes/pitch_class.rb
+++ b/musical-pitch-classes/pitch_class.rb
@@ -1,31 +1,14 @@ NATURAL_NOTES = {
- 'C' => 0,
- 'D' => 2,
- 'E' => 4,
- 'F' => 5,
- 'G' => 7,
- 'A' => 9,
- 'B' => 11
+ 'C' => 0, 'D' => 2, 'E' => 4, 'F' => 5, 'G' => 7, 'A' => 9, 'B' => 11
}.freeze
-
-MODIFIERS = {
- '#' => 1,
- 'b' => -1,
- 'B#' => -11,
- 'Cb' => 11
-}
-
+MODIFIERS = { '#' => 1, 'b' => 11 }.freeze
NOTE_REGEX = /\A[A-G][#b]?\z/
+CEILING = 12
def pitch_class(note)
return nil unless note =~ NOTE_REGEX
natural_note = note[0]
- NATURAL_NOTES[natural_note] + modifier(note)
+ suffix = note[1]
+ modifier = MODIFIERS[suffix] || 0
+ (NATURAL_NOTES[natural_note] + modifier) % CEILING
end
-
-private
-
-def modifier(note)
- suffix = note[1]
- MODIFIERS[note] || MODIFIERS[suffix] || 0
-end
|
Refactor to use ceiling and modulus
|
diff --git a/config/initializers/gds_api.rb b/config/initializers/gds_api.rb
index abc1234..def5678 100644
--- a/config/initializers/gds_api.rb
+++ b/config/initializers/gds_api.rb
@@ -5,3 +5,6 @@ GdsApi::Base.default_options = {disable_timeout: true}
Frontend.detailed_guidance_content_api = GdsApi::ContentApi.new(Plek.current.environment, endpoint_url: "#{Plek.current.find('whitehall')}/api/specialist/")
+
+# Note that copies of this exist in both preview and production
+# to_upload directories, so make sure your changes propagate there.
|
Make note of copies existing in preview/production
|
diff --git a/lib/genome/online_updaters/go/api_client.rb b/lib/genome/online_updaters/go/api_client.rb
index abc1234..def5678 100644
--- a/lib/genome/online_updaters/go/api_client.rb
+++ b/lib/genome/online_updaters/go/api_client.rb
@@ -21,7 +21,7 @@ end
def gene_lookup_base_url(id)
- "http://api.geneontology.org/api/bioentity/function/GO:#{id}"
+ "http://api.geneontology.org/api/bioentity/function/%22GO:#{id}%22"
end
def params(start, rows)
|
Add quotes around GO ID in API call to only get exact matches
|
diff --git a/lib/json_schema/artesano/tools/data_type.rb b/lib/json_schema/artesano/tools/data_type.rb
index abc1234..def5678 100644
--- a/lib/json_schema/artesano/tools/data_type.rb
+++ b/lib/json_schema/artesano/tools/data_type.rb
@@ -0,0 +1,33 @@+#
+# The DataType strategy uses the data type of any primitive or enum property as the generated data.
+#
+# This strategy DOES NOT GENERATE VALID DATA agains the given JSON schema
+#
+
+module JsonSchema
+ module Artesano
+ module Tools
+ class DataType
+ def initialize
+ end
+
+ def shape_object(material)
+ material
+ end
+
+ def shape_array(material)
+ material
+ end
+
+ def shape_primitive(material)
+ type = material.type[0]
+ material.enum.nil? ? type : "enum[#{type}]"
+ end
+
+ def shape_enum(material)
+ 'enum'
+ end
+ end
+ end
+ end
+end
|
Add data type strategy (Tools::DataType)
The DataType strategy uses the data type of any primitive or enum property as the generated data.
Might help you to visually understand a JSON Schema better (maybe).
|
diff --git a/locationer.gemspec b/locationer.gemspec
index abc1234..def5678 100644
--- a/locationer.gemspec
+++ b/locationer.gemspec
@@ -9,7 +9,7 @@ s.version = Locationer::VERSION
s.authors = ["Tomasz Grabowski"]
s.email = ["belike81@gmail.com"]
- s.homepage = "www.tomaszgrabowski.com"
+ s.homepage = "http://www.tomaszgrabowski.com"
s.summary = "Library to provide an API for giving nearby cities in US based on the given city."
s.description = "Locationer is an mountable API that provides functionality of providing results of cities nearby a given city based on the provided range."
|
Add http protocol to homepage URI in gemspec
|
diff --git a/app/controllers/contact_controller.rb b/app/controllers/contact_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/contact_controller.rb
+++ b/app/controllers/contact_controller.rb
@@ -5,7 +5,7 @@ end
def create
- if params[:value].blank? then
+ if params[:value].blank? && !params[:to_whom].blank? then
contact_params = params[:contact]
mail_array = contact_params[:to_whom] << contact_params[:email]
|
Make sure message does not get sent when no commitee has been selected
|
diff --git a/spec/aws/ssm/console/options_spec.rb b/spec/aws/ssm/console/options_spec.rb
index abc1234..def5678 100644
--- a/spec/aws/ssm/console/options_spec.rb
+++ b/spec/aws/ssm/console/options_spec.rb
@@ -0,0 +1,59 @@+require 'spec_helper'
+
+RSpec.describe Aws::SSM::Console::Options, type: :lib do
+ describe '#new' do
+ subject { described_class.new(argv) }
+
+ describe '--instance-id' do
+ context '--instance-id aaa,bbb' do
+ let(:argv) { %w(--instance-id aaa,bbb) }
+
+ it 'set instance_id' do
+ expect(subject.instance_ids).to eq %w(aaa bbb)
+ end
+ end
+
+ context '--instance-id' do
+ let(:argv) { %w(--instance-id) }
+
+ it 'raise ArgumentError' do
+ expect { subject }.to raise_error(OptionParser::MissingArgument)
+ end
+ end
+
+ context 'not specified' do
+ let(:argv) { %w() }
+
+ it 'raise ArgumentError' do
+ expect { subject }.to raise_error(ArgumentError, '--instance-ids is required')
+ end
+ end
+ end
+
+ describe '-c' do
+ context '-c ls' do
+ let(:argv) { %w(--instance-ids aaa -c ls) }
+
+ it 'set command_id' do
+ expect(subject.command).to eq 'ls'
+ end
+ end
+
+ context '-c' do
+ let(:argv) { %w(--instance-ids aaa -c) }
+
+ it 'set nil to command' do
+ expect { subject }.to raise_error(OptionParser::MissingArgument)
+ end
+ end
+
+ context 'not specified' do
+ let(:argv) { %w(--instance-ids aaa) }
+
+ it 'set nil to command' do
+ expect(subject.command).to be_nil
+ end
+ end
+ end
+ end
+end
|
Add examples for command line options.
|
diff --git a/app/helpers/admin/users_helper.rb b/app/helpers/admin/users_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/admin/users_helper.rb
+++ b/app/helpers/admin/users_helper.rb
@@ -5,10 +5,10 @@
def render_options_for_display_name
options = "<option value='#{@user.login}' #{get_select(@user.name, @user.login)}>#{@user.login}</option>"
- options << "<option value='#{@user.nickname}' #{get_select(@user.name, @user.nickname)}>#{@user.nickname}</option>" unless @user.nickname.nil?
- options << "<option value='#{@user.firstname}' #{get_select(@user.name, @user.firstname)}>#{@user.firstname}</option>" unless @user.firstname.nil?
- options << "<option value='#{@user.lastname}' #{get_select(@user.name, @user.lastname)}>#{@user.lastname}</option>" unless @user.lastname.nil?
- options << "<option value='#{@user.firstname} #{@user.lastname}' #{get_select(@user.name, @user.firstname + @user.lastname)}>#{@user.firstname} #{@user.lastname}</option>" unless (@user.firstname.nil? or @user.lastname.nil?)
+ options << "<option value='#{@user.nickname}' #{get_select(@user.name, @user.nickname)}>#{@user.nickname}</option>" unless @user.nickname.blank?
+ options << "<option value='#{@user.firstname}' #{get_select(@user.name, @user.firstname)}>#{@user.firstname}</option>" unless @user.firstname.blank?
+ options << "<option value='#{@user.lastname}' #{get_select(@user.name, @user.lastname)}>#{@user.lastname}</option>" unless @user.lastname.blank?
+ options << "<option value='#{@user.firstname} #{@user.lastname}' #{get_select(@user.name, @user.firstname + @user.lastname)}>#{@user.firstname} #{@user.lastname}</option>" unless (@user.firstname.blank? or @user.lastname.blank?)
return options
end
end
|
Hide Display Name option choices in profile edit if blank
It's possible the user name options for setting Display Name
are blank or empty strings so let's check for that in addition
to if they're set in the first place.
|
diff --git a/app/helpers/allocations_helper.rb b/app/helpers/allocations_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/allocations_helper.rb
+++ b/app/helpers/allocations_helper.rb
@@ -1,12 +1,3 @@ module AllocationsHelper
- def start_time_form_column(record, options)
- options[:class] += " time_picker"
- text_field :record, :start_time, {
- }.merge(options)
- end
- def end_time_form_column(record, options)
- options[:class] += " time_picker"
- text_field :record, :start_time, {
- }.merge(options)
- end
+
end
|
Remove timepicker from allocation views
|
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -10,7 +10,7 @@
# Escape text for inclusion in Latex documents
def lesc(text)
- # Use gsub to remove any characters that are not printable
- LatexToPdf.escape_latex(text.gsub(/[^[:print:]]/,''))
+ # Convert to latex text, then use gsub to remove any characters that are not printable
+ LatexToPdf.escape_latex(text).gsub(/[^[:print:]]/,'')
end
end
|
FIX: Switch gsub in lesc to ensure running on text
|
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -8,7 +8,7 @@ :description => description,
:type => page_type,
:url => url_for(:only_path => false),
- :image => image
+ :image => [image, { :width => 200, :height => 200 }]
}
end
|
Add width and height to opengraph image
|
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -6,12 +6,12 @@
def event_host?
event_host = nil
- unless admin?
- else
+ unless @event.nil?
+ unless admin?
event_host = EventHost.where("user_id = ? and event_id = ?", current_user.id, @event.id)
end
end
- admin? || !event_host.nil?
+ !@event.nil? && (admin? || !event_host.nil?)
end
@@ -38,5 +38,5 @@ end
unpaid_payments
end
+end
-end
|
Correct `event_host?` with nil check on `@event`
`@event` will be nil if we aren't in an event's scope!
|
diff --git a/test/integration/config/serverspec/auth_spec.rb b/test/integration/config/serverspec/auth_spec.rb
index abc1234..def5678 100644
--- a/test/integration/config/serverspec/auth_spec.rb
+++ b/test/integration/config/serverspec/auth_spec.rb
@@ -1,10 +1,6 @@ require 'spec_helper'
describe file('/etc/rundeck/realm.properties') do
- it { should be_file }
- it { should be_mode 644 }
- it { should be_owned_by 'rundeck' }
- it { should be_grouped_into 'rundeck' }
its(:content) { should match /^admin:admin,user,admin$/ }
its(:content) { should match /^user:passwd,user$/ }
end
|
Remove unrelated specs from the config suite
|
diff --git a/test/lib/pc_rails_code_quality/analysis_test.rb b/test/lib/pc_rails_code_quality/analysis_test.rb
index abc1234..def5678 100644
--- a/test/lib/pc_rails_code_quality/analysis_test.rb
+++ b/test/lib/pc_rails_code_quality/analysis_test.rb
@@ -1,35 +1,29 @@ # frozen_string_literal: true
require 'test_helper'
class PcRailsCodeQuality::Analysis::Test < ActiveSupport::TestCase
- teardown do
- FileUtils.rm_rf('public')
- FileUtils.rm_rf('coverage')
- FileUtils.rm_rf(Rails.root + 'public/reports')
+
+
+ test '#run_html_reports' do
+ assert_respond_to(PcRailsCodeQuality::Analysis, :run_html_reports)
end
- test '#run_html_reports' do
- assert_send([PcRailsCodeQuality::Analysis, :run_html_reports])
+ test '#run_rubocop_html_report' do
+ assert_respond_to(PcRailsCodeQuality::Analysis, :run_rubocop_html_report)
end
- test '#run_rubocop_html_report generate a file' do
- PcRailsCodeQuality::Analysis.run_rubocop_html_report
- assert File.open('public/reports/rubocop.html')
+ test '#run_rubycritic_html_report' do
+ assert_respond_to(PcRailsCodeQuality::Analysis, :run_rubycritic_html_report)
end
- test '#run_rubycritic_html_report generate a file' do
- PcRailsCodeQuality::Analysis.run_rubycritic_html_report
- assert File.open('public/reports/ruby_critic/overview.html')
+ test '#run_simplecov_html_report' do
+ assert_respond_to(PcRailsCodeQuality::Analysis, :run_simplecov_html_report)
end
- # PcRailsCodeQuality::Analysis.run_rubycritic_html_report
- # is running rake test on engine so it going in to loop
- test '#run_simplecov_html_report generate a file based on rake task' do
- `cd test/dummy/ && bundle exec rake pc_reports:simplecov_html`
- assert File.open(Rails.root + 'public/reports/simplecov/index.html')
+ test '#run_rails_best_practices_html' do
+ assert_respond_to(PcRailsCodeQuality::Analysis, :run_rails_best_practices_html_report)
end
- test '#run_rails_best_practices_html_report generate a file' do
- PcRailsCodeQuality::Analysis.run_rails_best_practices_html_report
- assert File.open('public/reports/rails_best_practices.html')
+ test '#run_brakeman_html_report' do
+ assert_respond_to(PcRailsCodeQuality::Analysis, :run_brakeman_html_report)
end
end
|
Adjust tests for analisys module
- check only if response to methods
|
diff --git a/railties/lib/rails/generators/rails/plugin/templates/rails/application.rb b/railties/lib/rails/generators/rails/plugin/templates/rails/application.rb
index abc1234..def5678 100644
--- a/railties/lib/rails/generators/rails/plugin/templates/rails/application.rb
+++ b/railties/lib/rails/generators/rails/plugin/templates/rails/application.rb
@@ -6,10 +6,12 @@ # Pick the frameworks you want:
<%= comment_if :skip_active_record %>require "active_record/railtie"
require "action_controller/railtie"
+require "action_view/railtie"
<%= comment_if :skip_action_mailer %>require "action_mailer/railtie"
-require "action_view/railtie"
+require "active_job/railtie"
+<%= comment_if :skip_action_cable %>require "action_cable/engine"
+<%= comment_if :skip_test %>require "rails/test_unit/railtie"
<%= comment_if :skip_sprockets %>require "sprockets/railtie"
-<%= comment_if :skip_test %>require "rails/test_unit/railtie"
<% end -%>
Bundler.require(*Rails.groups)
|
Add ActionCable require statement to plugin
When generating a plugin without ActiveRecord (-O),
ActionCable wasn't include, which causes problems with the
require action_cable statement in cable.js
add active_job require statement
also updated order of require statements to match with all.rb
|
diff --git a/app/models/concerns/boolean_fields.rb b/app/models/concerns/boolean_fields.rb
index abc1234..def5678 100644
--- a/app/models/concerns/boolean_fields.rb
+++ b/app/models/concerns/boolean_fields.rb
@@ -21,7 +21,7 @@ extend ActiveSupport::Concern
def boolean_regex
- "(Yes|No|Y|N|TickYes|TickNo)+"
+ "(Yes|No|Y|N|T|F|TickYes|TickNo)+"
end
def boolean_field boolean_field_component
@@ -30,7 +30,7 @@ case boolean_field_component
when /Yes/
"Yes"
- when /Y/
+ when /Y|T/
"Y"
else
""
@@ -39,7 +39,7 @@ case boolean_field_component
when /No/
"No"
- when /N/
+ when /N|F/
"N"
else
""
|
Support T and F as boolean suffixes
|
diff --git a/app/models/spree/variant_decorator.rb b/app/models/spree/variant_decorator.rb
index abc1234..def5678 100644
--- a/app/models/spree/variant_decorator.rb
+++ b/app/models/spree/variant_decorator.rb
@@ -1,20 +1,8 @@ Spree::Variant.class_eval do
-
has_many :digitals, :dependent => :destroy
- after_save :destroy_digital, :if => :deleted?
# Is this variant to be downloaded by the customer?
def digital?
digitals.present?
end
-
- private
-
- # Spree never deleted Digitals, that's why ":dependent => :destroy" won't work on Digital.
- # We need to delete the Digital manually here as soon as the Variant is nullified.
- # Otherwise you'll have orphan Digitals (and their attached files!) associated with unused Variants.
- def destroy_digital
- digitals.map &:destroy
- end
-
end
|
Remove delete digitals on soft delete of variant
|
diff --git a/abstract_class.gemspec b/abstract_class.gemspec
index abc1234..def5678 100644
--- a/abstract_class.gemspec
+++ b/abstract_class.gemspec
@@ -12,7 +12,7 @@
s.author = 'Sean Huber'
s.email = 'github@shuber.io'
- s.homepage = 'http://github.com/shuber/abstract_class'
+ s.homepage = 'https://github.com/shuber/abstract_class'
s.require_paths = ['lib']
|
Use https in the gemspec homepage
|
diff --git a/scripts/scan_categories.rb b/scripts/scan_categories.rb
index abc1234..def5678 100644
--- a/scripts/scan_categories.rb
+++ b/scripts/scan_categories.rb
@@ -8,7 +8,7 @@
puts("Total number of categories: " + arr.length.to_s)
-key_words = ["medizin"]
+key_words = ["medizin", "gesundheit", "krankheit", "epidemiologie", "psychologie", "diagnostik", "therapie", "anatomie"]
c = 0
File.open(ARGV[1], "w+") do |f|
|
Add keywords for category selection.
~ 800 categories / 10'000 articles with these key words.
|
diff --git a/0_code_wars/extract_the_ids_from_the_data_set.rb b/0_code_wars/extract_the_ids_from_the_data_set.rb
index abc1234..def5678 100644
--- a/0_code_wars/extract_the_ids_from_the_data_set.rb
+++ b/0_code_wars/extract_the_ids_from_the_data_set.rb
@@ -0,0 +1,17 @@+# http://www.codewars.com/kata/5158bfce931c51b69b000001
+# ---- iteration 1 ---
+def extract_ids(data)
+ result_ids = []
+ result_ids << data[:id]
+ if data[:items]
+ data[:items].each do |item|
+ result_ids << extract_ids(item)
+ end
+ end
+ result_ids.flatten
+end
+
+# --- iteration 2 ---
+def extract_ids(data)
+ data.to_s.scan(/id=>(\d+)/).flatten.map(&:to_i)
+end
|
Add code wars (6) - extract ids from data set
|
diff --git a/assets/filter.d/rel_changes_of.rb b/assets/filter.d/rel_changes_of.rb
index abc1234..def5678 100644
--- a/assets/filter.d/rel_changes_of.rb
+++ b/assets/filter.d/rel_changes_of.rb
@@ -3,7 +3,7 @@ # changes than the whole site had lines before.
WCC::Filters.add 'rel_changes_of' do |data,args|
- next true if data.diffnil?
+ next true if data.diff.nil?
case args['percent_of']
when 'all_lines',nil
percent = data.diff.nlinesc.to_f / data.site.content.count("\n").+(1).to_f * 100
|
Fix another typo in filter
-.-
|
diff --git a/lib/github/repo.rb b/lib/github/repo.rb
index abc1234..def5678 100644
--- a/lib/github/repo.rb
+++ b/lib/github/repo.rb
@@ -34,7 +34,7 @@ end
def from_api_response(api_response)
- new(api_response[:full_name], api_response[:ssh_url])
+ new(api_response[:full_name], api_response[:html_url])
end
end
end
|
Revert using SSH URL to HTML URL so it can be opened in the browser
|
diff --git a/app/models/document.rb b/app/models/document.rb
index abc1234..def5678 100644
--- a/app/models/document.rb
+++ b/app/models/document.rb
@@ -33,7 +33,7 @@ end
def description
- @desc ||= exists? ? self.content.lines.reject{|l| l =~ /^(\n|<)/ }.second.delete('<br>').strip : ''
+ @desc ||= exists? ? self.content.lines.reject{|l| l =~ /^(\n|<)/ }.second.gsub('<br>', '').strip : ''
end
def content
|
Use gsub instead of delete method to fetch OGP description
|
diff --git a/app/models/identity.rb b/app/models/identity.rb
index abc1234..def5678 100644
--- a/app/models/identity.rb
+++ b/app/models/identity.rb
@@ -3,6 +3,6 @@
validates :name, presence: true
validates :email, presence: true, uniqueness: true, allow_blank: true, format:
- { with: /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i }
+ { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i }
validates :password, confirmation: true, length: { in: 6..20 }
end
|
Fix regular expression of email
> The provided regular expression is using multiline anchors (^ or $), which may present a security risk. Did you mean to use \A and \z, or forgot to add the :multiline => true option?
|
diff --git a/lib/semantology.rb b/lib/semantology.rb
index abc1234..def5678 100644
--- a/lib/semantology.rb
+++ b/lib/semantology.rb
@@ -1,5 +1,7 @@ require 'rdf'
require 'linkeddata'
+
+require_relative 'semantology/reader/rdfa'
# The module that contains everything Semantology-related
module Semantology
@@ -12,7 +14,7 @@ def self.translate(input_path, input_format, output_path, output_format)
case input_format
when :rdfa
- fail NotImplementedError, 'RDFa is not implemented'
+ graph = Semantology::Reader::RDFa.read(input_path)
when :microdata
fail NotImplementedError, 'Microdata is not implemented'
when :microformat
|
Read RDFa data in convinience method
|
diff --git a/lib/shoes/check.rb b/lib/shoes/check.rb
index abc1234..def5678 100644
--- a/lib/shoes/check.rb
+++ b/lib/shoes/check.rb
@@ -15,8 +15,6 @@
@gui = Shoes.configuration.backend_for(self, @parent.gui, blk)
@parent.add_child self
-
- click(&opts[:click]) if opts[:click]
end
def checked?
|
Remove click option for Check temporarily
|
diff --git a/lib/tasks/dev.rake b/lib/tasks/dev.rake
index abc1234..def5678 100644
--- a/lib/tasks/dev.rake
+++ b/lib/tasks/dev.rake
@@ -27,6 +27,6 @@ end
task :console do
- exec("ssh tps@sgmap_production1 -t 'source /etc/profile && cd current && bundle exec rails c production'")
+ exec("ssh tps@sgmap_production1 -t 'source /etc/profile && cd current && bundle exec rails c -e production'")
end
end
|
Remove a warning in the console task
Passing the environment's name as a regular
argument is deprecated and will be removed in the
next Rails version. Please, use the -e option
instead.
|
diff --git a/app/api/api/spam_domains_api.rb b/app/api/api/spam_domains_api.rb
index abc1234..def5678 100644
--- a/app/api/api/spam_domains_api.rb
+++ b/app/api/api/spam_domains_api.rb
@@ -6,7 +6,8 @@ std_result SpamDomain.all.order(id: :desc), filter: FILTERS[:domains]
end
- get 'name/:name' do
+ # We are not using name/:name, because otherwise it will not allow literal '.' in :name
+ get 'name/(*name)' do
std_result SpamDomain.where(domain: params[:name]).order(id: :desc), filter: FILTERS[:domains]
end
|
Allow literal '.' in /api/v2/domains/name
fixes #832
|
diff --git a/app/controllers/registration.rb b/app/controllers/registration.rb
index abc1234..def5678 100644
--- a/app/controllers/registration.rb
+++ b/app/controllers/registration.rb
@@ -3,7 +3,7 @@ puts "*"*50
if user
session[:user_id] = user.id
- redirect "users/#{user.id}"
+ redirect "users/#{user.id}/tweets"
else
redirect '/'
end
|
Update login page to redirect to users profile tweets page
|
diff --git a/app/jobs/fetch_link_data_job.rb b/app/jobs/fetch_link_data_job.rb
index abc1234..def5678 100644
--- a/app/jobs/fetch_link_data_job.rb
+++ b/app/jobs/fetch_link_data_job.rb
@@ -9,7 +9,7 @@ FetchLinkDataJob.set(wait: 1.minute).
perform_later(post_id, url, retry_count+1) unless retry_count > 3
rescue LinkThumbnailer::Exceptions
- FetchLinkDataJob.set(wait: 1.minute).
+ FetchLinkDataJob.set(wait: retry_count * 1.minute).
perform_later(post_id, url, retry_count+1) unless retry_count > 3
end
end
|
Update wait time on LinkThumbnailer::Exceptions
|
diff --git a/db/migrate/20130910184823_create_index_on_builds_id_desc_and_repository_id_and_event_type.rb b/db/migrate/20130910184823_create_index_on_builds_id_desc_and_repository_id_and_event_type.rb
index abc1234..def5678 100644
--- a/db/migrate/20130910184823_create_index_on_builds_id_desc_and_repository_id_and_event_type.rb
+++ b/db/migrate/20130910184823_create_index_on_builds_id_desc_and_repository_id_and_event_type.rb
@@ -1,4 +1,6 @@ class CreateIndexOnBuildsIdDescAndRepositoryIdAndEventType < ActiveRecord::Migration
+ self.disable_ddl_transaction!
+
def up
execute "CREATE INDEX CONCURRENTLY index_builds_on_id_repository_id_and_event_type_desc ON builds (id DESC, repository_id, event_type);"
end
|
Disable ddl transaction for index added concurrently
|
diff --git a/app/models/concerns/runnable.rb b/app/models/concerns/runnable.rb
index abc1234..def5678 100644
--- a/app/models/concerns/runnable.rb
+++ b/app/models/concerns/runnable.rb
@@ -28,7 +28,7 @@ end
def can_rerun?
- state.aborted? || status == :failure
+ state.completed? || state.aborted?
end
def run
|
Revert "restric the rerun for failure or aborted only"
This reverts commit cd159fdf1e447191ccf11d80281c75700f8770c2.
|
diff --git a/spec/nanoc/regressions/gh_913_spec.rb b/spec/nanoc/regressions/gh_913_spec.rb
index abc1234..def5678 100644
--- a/spec/nanoc/regressions/gh_913_spec.rb
+++ b/spec/nanoc/regressions/gh_913_spec.rb
@@ -0,0 +1,24 @@+describe 'GH-891', site: true, stdio: true do
+ before do
+ File.write('content/hello.html', 'hi!')
+
+ File.write('Rules', <<EOS)
+ postprocess do
+ items.map(&:compiled_content)
+ end
+
+ compile '/**/*' do
+ write item.identifier.without_ext + '.html'
+ end
+
+ layout '/foo.*', :erb
+EOS
+ end
+
+ example do
+ 2.times do
+ Nanoc::CLI.run(%w(compile))
+ expect(File.read('output/hello.html')).to eq('hi!')
+ end
+ end
+end
|
Add regression spec for GH-913
|
diff --git a/email_format_validator.gemspec b/email_format_validator.gemspec
index abc1234..def5678 100644
--- a/email_format_validator.gemspec
+++ b/email_format_validator.gemspec
@@ -1,6 +1,5 @@ # -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
-require "email_format_validator/version"
Gem::Specification.new do |s|
s.name = "email_format_validator"
|
Delete module version from gemspec file
|
diff --git a/spec/build_process_spec.rb b/spec/build_process_spec.rb
index abc1234..def5678 100644
--- a/spec/build_process_spec.rb
+++ b/spec/build_process_spec.rb
@@ -32,7 +32,7 @@ watcher = Juici::Watcher.instance.start
build = Juici::Build.new(parent: "test project",
environment: {},
- command: "lol command not found")
+ command: "exit 3")
$build_queue << build
# Wait a reasonable time for build to finish
|
Make failed build spec saner
|
diff --git a/spec/defile/spec_helper.rb b/spec/defile/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/defile/spec_helper.rb
+++ b/spec/defile/spec_helper.rb
@@ -2,16 +2,10 @@ require "defile"
require "defile/backend_examples"
-tmp_path = File.expand_path("tmp", Dir.pwd)
+tmp_path = Dir.mktmpdir
-if File.exist?(tmp_path)
- raise "temporary path #{tmp_path} already exists, refusing to run tests"
-else
- RSpec.configure do |config|
- config.after :suite do
- FileUtils.rm_rf(tmp_path)
- end
- end
+at_exit do
+ FileUtils.remove_entry_secure(tmp_path)
end
Defile.store = Defile::Backend::FileSystem.new(File.expand_path("default_store", tmp_path))
|
Use tmpdir instead of ./tmp
|
diff --git a/spec/features/main_spec.rb b/spec/features/main_spec.rb
index abc1234..def5678 100644
--- a/spec/features/main_spec.rb
+++ b/spec/features/main_spec.rb
@@ -1,11 +1,21 @@ # frozen_string_literal: true
describe 'main process', type: :feature, js: true do
+ before do
+ FakeS3Server.restart
+ s3 = Aws::S3::Client.new
+ s3.create_bucket(bucket: 'my-bucket')
+ Tempfile.open('file') do |file|
+ file.puts 'body'
+ file.flush
+ s3.put_object(
+ bucket: 'my-bucket',
+ key: 'my-folder/my-file',
+ body: file
+ )
+ end
+ end
+
it "html includes content 'Listing buckets' and 'my-bucket'" do
- Aws.config[:s3] = {
- stub_responses: {
- list_buckets: { buckets: [{ name: 'my-bucket' }] }
- }
- }
visit '/buckets'
expect(page).to have_content 'Listing buckets'
expect(page).to have_content 'my-bucket'
|
Modify feature spec to use FakeS3Server
|
diff --git a/spec/models/origin_spec.rb b/spec/models/origin_spec.rb
index abc1234..def5678 100644
--- a/spec/models/origin_spec.rb
+++ b/spec/models/origin_spec.rb
@@ -1,12 +1,6 @@ # -*- encoding : utf-8 -*-
require File.expand_path(File.dirname(__FILE__) + '../../spec_helper')
require 'uwdc'
-
-# AfricaFocus - Hyena Wrestler with Muzzled Hyena
-def get_africa_focus_mets
- @get = Nokogiri::XML.parse("../fixtures/africa_focus_mets.xml")
- @id = 'ECJ6ZXEYWUE7B8W'
-end
describe UWDC::Origin do
|
Remove UWDC sample items from Origin specs
|
diff --git a/spec/subtime/timer_spec.rb b/spec/subtime/timer_spec.rb
index abc1234..def5678 100644
--- a/spec/subtime/timer_spec.rb
+++ b/spec/subtime/timer_spec.rb
@@ -3,6 +3,10 @@ require 'kernel/kernel'
describe Timer do
+
+ before do
+ $stdout = StringIO.new
+ end
let(:timer_output) { double('timer_output').as_null_object }
|
Add override for $stdout to make rspec output pretty
|
diff --git a/test/models/concerns/storied_test.rb b/test/models/concerns/storied_test.rb
index abc1234..def5678 100644
--- a/test/models/concerns/storied_test.rb
+++ b/test/models/concerns/storied_test.rb
@@ -0,0 +1,21 @@+require 'test_helper'
+require 'active_record'
+
+describe Storied do
+
+ class StoriedTestModel
+ include ActiveModel::Model
+ include Storied
+
+ def stories
+ Story.all
+ end
+ end
+
+ let(:model) { StoriedTestModel.new }
+
+ it 'can get relation to public stories' do
+ StoriedTestModel.new.public_stories.wont_be_nil
+ StoriedTestModel.new.public_stories.must_be_instance_of Story::ActiveRecord_Relation
+ end
+end
|
Add basic test for concern
|
diff --git a/kartograph.gemspec b/kartograph.gemspec
index abc1234..def5678 100644
--- a/kartograph.gemspec
+++ b/kartograph.gemspec
@@ -19,7 +19,7 @@ spec.require_paths = ["lib"]
spec.add_development_dependency "bundler", "~> 1.6"
- spec.add_development_dependency "rake", '< 11.0'
- spec.add_development_dependency "rspec", "~> 3.0.0"
+ spec.add_development_dependency "rake", [">= 12.3.3", "< 13.0.0"]
+ spec.add_development_dependency "rspec", "~> 3.9"
spec.add_development_dependency "pry"
end
|
Update rake and rspec for CVE-2020-8130
|
diff --git a/app/controllers/answers_controller.rb b/app/controllers/answers_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/answers_controller.rb
+++ b/app/controllers/answers_controller.rb
@@ -13,6 +13,12 @@
def show
@question = Question.find(params[:question_id])
+ end
+
+ def edit
+ @question = Question.find(params[:question_id])
+ @answer = Answer.find(params[:id])
+ verify_answer_ownership
end
|
Add edit action for answers
|
diff --git a/app/controllers/auth/remote_header.rb b/app/controllers/auth/remote_header.rb
index abc1234..def5678 100644
--- a/app/controllers/auth/remote_header.rb
+++ b/app/controllers/auth/remote_header.rb
@@ -4,6 +4,13 @@ # Fetches the user from the REMOTE_USER header set by the FreeIPA module of
# the web server.
class RemoteHeader < Base
+
+ REMOTE_USER_HEADERS = %w[
+ REMOTE_USER
+ REMOTE_USER_GROUPS
+ REMOTE_USER_FIRST_NAME
+ REMOTE_USER_LAST_NAME
+ ]
def fetch_user
fetch_user_and_update_user(*remote_user_params)
@@ -25,11 +32,10 @@
def remote_user_params
h = request.headers
- [h['REMOTE_USER'],
- h['REMOTE_USER_GROUPS'],
- h['REMOTE_USER_FIRST_NAME'],
- h['REMOTE_USER_LAST_NAME']]
- .map { |str| str&.force_encoding('UTF-8') }
+ REMOTE_USER_HEADERS.map do |key|
+ str = h[key] || h[key.gsub('_', '-')]
+ str&.force_encoding('UTF-8')
+ end
end
end
|
Make remote header handling more flexible
|
diff --git a/app/controllers/uploads_controller.rb b/app/controllers/uploads_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/uploads_controller.rb
+++ b/app/controllers/uploads_controller.rb
@@ -1,4 +1,7 @@ class UploadsController < ApplicationController
+ skip_before_filter :authenticate_user!, :reject_blocked
+ before_filter :authorize_access
+
def show
model = params[:model].camelize.constantize.find(params[:id])
uploader = model.send(params[:mounted_as])
@@ -14,4 +17,10 @@ redirect_to uploader.url
end
end
+
+ def authorize_access
+ unless params[:mounted_as] == 'avatar'
+ authenticate_user! && reject_blocked
+ end
+ end
end
|
Allow non authenticated access to avatars
|
diff --git a/app/models/invoice_addon_line_item.rb b/app/models/invoice_addon_line_item.rb
index abc1234..def5678 100644
--- a/app/models/invoice_addon_line_item.rb
+++ b/app/models/invoice_addon_line_item.rb
@@ -2,9 +2,10 @@ belongs_to :invoice
belongs_to :package_addon_type
- validates_presence_of :invoice
- validates_presence_of :package_addon_type
+ validates_presence_of :invoice, :package_addon_type, :quantity
+
validates_uniqueness_of :package_addon_type, scope: :invoice
+ validates_numericality_of :quantity, greater_than: 0
def price
quantity * package_addon_type.price
|
Fix validations on invoice line items
|
diff --git a/lib/ch05/eliza1.rb b/lib/ch05/eliza1.rb
index abc1234..def5678 100644
--- a/lib/ch05/eliza1.rb
+++ b/lib/ch05/eliza1.rb
@@ -0,0 +1,90 @@+require 'pat5'
+
+module Enumerable
+ def some?
+ self.each do |v|
+ result = yield v
+ return result if result
+ end
+ nil
+ end
+end
+
+class Array
+ def random_elt
+ self[rand(self.length)]
+ end
+end
+
+class Rule
+ attr_reader :pattern, :responses
+
+ def initialize(pattern, *responses)
+ @pattern, @responses = pattern, responses
+ end
+
+ ELIZA_RULES =
+ [
+ Rule.new(Pattern.new(%w(*x hello *y)),
+ "How do you do. Please state your problem"),
+ Rule.new(Pattern.new(%w(*x I want *y)),
+ "What would it mean if you got ?y?",
+ "Why do you want ?y?",
+ "Suppose you got ?y soon"),
+ Rule.new(Pattern.new(%w(*x if *y)),
+ "Do you really think it's likely that ?y? ",
+ "Do you wish that ?y?",
+ "What do you think about ?y?",
+ "Really-- if ?y?"),
+ Rule.new(Pattern.new(%w(*x no *y)),
+ "Why not?",
+ "You are being a bit negative",
+ "Are you saying \"NO\" just to be negative?"),
+ Rule.new(Pattern.new(%w(*x I was *y)),
+ "Were you really?",
+ "Perhaps I already knew you were ?y?",
+ "Why do you tell me you were ?y now?"),
+ Rule.new(Pattern.new(%w(*x I feel *y)),
+ "Do you often feel ?y?"),
+ Rule.new(Pattern.new(%w(*x I felt *y)),
+ "What other feelings do you have?")
+ ]
+end
+
+module Eliza
+ class << self
+ def run
+ while true
+ print "eliza> "
+ puts eliza_rule(gets.split)
+ end
+ end
+
+ def eliza_rule(input)
+ Rule::ELIZA_RULES.some? do |rule|
+ result = rule.pattern.match(input)
+ if result
+ switch_viewpoint(result).inject(rule.responses.random_elt) do |sum, repl|
+ sum.gsub(repl[0], repl[1].join(" "))
+ end
+ end
+ end
+ end
+
+ def switch_viewpoint(words)
+ replacements = [%w(I you),
+ %w(you I),
+ %w(me you),
+ %w(am are)]
+ hash = {}
+ words.each do |key, val|
+ hash[key] = replacements.inject(val) do |sum, repl|
+ sum.map { |val| val == repl[0] ? repl[1] : val}
+ end
+ end
+ hash
+ end
+ end
+end
+
+Eliza.run
|
Add simple implementation of Eliza
|
diff --git a/lib/multibinder.rb b/lib/multibinder.rb
index abc1234..def5678 100644
--- a/lib/multibinder.rb
+++ b/lib/multibinder.rb
@@ -2,7 +2,7 @@ require 'json'
module MultiBinder
- def self.bind(address, port)
+ def self.bind(address, port, options={})
abort 'MULTIBINDER_SOCK environment variable must be set' if !ENV['MULTIBINDER_SOCK']
binder = UNIXSocket.open(ENV['MULTIBINDER_SOCK'])
@@ -14,7 +14,7 @@ :params => [{
:address => address,
:port => port,
- }]
+ }.merge(options)]
}, 0, nil)
# get the response
|
Allow overriding bind options in client library.
|
diff --git a/lib/neptune/api.rb b/lib/neptune/api.rb
index abc1234..def5678 100644
--- a/lib/neptune/api.rb
+++ b/lib/neptune/api.rb
@@ -8,21 +8,11 @@
module Neptune
module Api
- NAMES = {
- consumer_metadata: ConsumerMetadata,
- fetch: Fetch,
- metadata: Metadata,
- offset: Offset,
- offset_fetch: OffsetFetch,
- offset_commit: OffsetCommit,
- produce: Produce
- }
-
class << self
# Look up the Api module with the given name
# @return [Module]
def get(name)
- NAMES.fetch(name)
+ @names.fetch(name)
end
# Look up the Api module that the given class belongs to
@@ -34,8 +24,23 @@ # Look up the Api name for the given module
# @return [Symbol]
def name_for(api)
- NAMES.key(api) || raise(KeyError.new("key not found: #{api.name}"))
+ @names.key(api) || raise(KeyError.new("key not found: #{api.name}"))
+ end
+
+ # Registers an Api module with the given name
+ def register(name, api)
+ @names[name] = api
end
end
+
+ @names = {}
+
+ register(:consumer_metadata, ConsumerMetadata)
+ register(:fetch, Fetch)
+ register(:metadata, Metadata)
+ register(:offset, Offset)
+ register(:offset_fetch, OffsetFetch)
+ register(:offset_commit, OffsetCommit)
+ register(:produce, Produce)
end
end
|
Refactor Api registration to be more similar to Compression registration
|
diff --git a/lib/source_code.rb b/lib/source_code.rb
index abc1234..def5678 100644
--- a/lib/source_code.rb
+++ b/lib/source_code.rb
@@ -1,6 +1,6 @@-require "source_code/method"
-require "source_code/monkey_patch"
-require "source_code/version"
+require_relative "source_code/method"
+require_relative "source_code/monkey_patch"
+require_relative "source_code/version"
module SourceCode
|
Fix how these are required.
|
diff --git a/lib/bike.rb b/lib/bike.rb
index abc1234..def5678 100644
--- a/lib/bike.rb
+++ b/lib/bike.rb
@@ -1,6 +1,4 @@ class Bike
- attr_reader :color
-
def initialize(color)
@color = color
end
@@ -8,4 +6,10 @@ def is_cool?
color == "red"
end
+
+ # This is the same as:
+ # attr_reader :color
+ def color
+ @color
+ end
end
|
Make color method more explicit
There was some confusion about where the color method was
coming from
|
diff --git a/resque-multi-job-forks.gemspec b/resque-multi-job-forks.gemspec
index abc1234..def5678 100644
--- a/resque-multi-job-forks.gemspec
+++ b/resque-multi-job-forks.gemspec
@@ -11,7 +11,7 @@ s.description = "When your resque jobs are frequent and fast, the overhead of forking and running your after_fork might get too big."
# Depends on minor version, due to monkeypatches Resque::Worker internals.
- s.add_runtime_dependency("resque", ">= 1.27.0", "< 2.3")
+ s.add_runtime_dependency("resque", ">= 1.27.0", "< 2.5")
s.add_runtime_dependency("json")
s.add_development_dependency("test-unit")
|
Allow Resque 2.3 and 2.4
|
diff --git a/db/migrate/20131118115555_add_customer_number.rb b/db/migrate/20131118115555_add_customer_number.rb
index abc1234..def5678 100644
--- a/db/migrate/20131118115555_add_customer_number.rb
+++ b/db/migrate/20131118115555_add_customer_number.rb
@@ -20,9 +20,10 @@ customer = Customer.where(source_id_name => item.customer_id).last
if customer.nil?
puts "Customer #{item.customer_id} not found!"
- next
+ item.customer_id = nil
+ else
+ item.customer_id = customer.send(target_id_name)
end
- item.customer_id = customer.send(target_id_name)
item.save!(validate: false)
end
end
|
Fix customer with not-existing customer
|
diff --git a/spec/features/article_viewer_spec.rb b/spec/features/article_viewer_spec.rb
index abc1234..def5678 100644
--- a/spec/features/article_viewer_spec.rb
+++ b/spec/features/article_viewer_spec.rb
@@ -0,0 +1,25 @@+# frozen_string_literal: true
+
+require 'rails_helper'
+
+describe 'Article Viewer', type: :feature, js: true do
+ let(:course) { create(:course, start: '2017-01-01', end: '2020-01-01') }
+ let(:user) { create(:user, username: 'Ragesoss') }
+ let(:article) { create(:article, title: 'Nancy_Tuana') }
+
+ before do
+ course.campaigns << Campaign.first
+ create(:courses_user, course: course, user: user)
+ create(:revision, article: article, user: user, date: '2019-01-01')
+ create(:articles_course, course: course, article: article, user_ids: [user.id])
+ end
+
+ it 'shows list of students who edited the article' do
+ visit "/courses/#{course.slug}/articles"
+ find('button.icon-article-viewer').click
+ expect(page).to have_content("Edits by:\nRagesoss")
+ within(:css, '.user-legend.user-highlight-1', wait: 20) do # once authorship date loads
+ find('img.user-legend-hover').click # click to scroll to next highlight
+ end
+ end
+end
|
Add simple browser test of ArticleViewer with WhoColor data
|
diff --git a/spec/features/votes_features_spec.rb b/spec/features/votes_features_spec.rb
index abc1234..def5678 100644
--- a/spec/features/votes_features_spec.rb
+++ b/spec/features/votes_features_spec.rb
@@ -0,0 +1,54 @@+require 'spec_helper'
+
+describe "VoteFeatures" do
+ before(:all) do
+ @idea = create(:idea)
+ @user = create(:user)
+ @user.confirm!
+ visit new_user_session_path
+ fill_in "Email", :with => "#{@user.email}"
+ fill_in "Password", :with => "#{@user.password}"
+ click_button "Sign in"
+ end
+
+ before(:each) do
+ visit idea_path(@idea)
+ end
+
+ describe "Vote on an idea" do
+ it "creates a new vote on an idea" do
+ # puts Vote.find(@idea.id, @user.id).inspect
+
+ click_link "Vote Up"
+ expect(page).to have_content("Your vote was saved")
+ end
+
+ # it "changes a vote's value down" do
+ # puts Vote.find(@idea.id, @user.id).inspect
+
+ # click_link "Vote Down"
+ # expect(page).to have_content("Your vote was saved")
+ # end
+
+ # it "changes a vote's value up" do
+ # puts Vote.find(@idea.id, @user.id).inspect
+
+ # click_link "Vote Up"
+ # expect(page).to have_content("Your vote was saved")
+ # end
+ # end
+
+ # describe "Remove a vote on an idea" do
+
+ # before(:all) do
+ # create(:vote, :user_id => @user.id, :idea_id => @idea.id)
+ # end
+
+ # it "removes a vote" do
+ # puts Vote.find(@idea.id, @user.id).inspect
+
+ # click_link "Delete Vote"
+ # expect(page).to have_content("Your vote was removed")
+ # end
+ end
+end
|
Add some (breaking) Vote feature specs
Create some feature specs for testing voting functionality. Currently,
tests break for one reason or another when all four are enabled.
One issue is that these specs expect to be executed in a particulr
order, which they shouldn't be so they'll have to be adjusted.
Additionally, the votes controller appears to be behaving a little
strangely. The view rendered after voting doesn't always appear to be
up to date and needs to be refreshed.
TODO:
* Fix Votes controller/Idea vote counting to render correct content
* Fix Vote feature specs to perform the correct actions for testing
|
diff --git a/spec/lita/handlers/ascii_art_spec.rb b/spec/lita/handlers/ascii_art_spec.rb
index abc1234..def5678 100644
--- a/spec/lita/handlers/ascii_art_spec.rb
+++ b/spec/lita/handlers/ascii_art_spec.rb
@@ -1,12 +1,25 @@ require "spec_helper"
describe Lita::Handlers::AsciiArt, lita_handler: true do
- it { routes_command("ascii FRIDAY").to(:ascii_from_text) }
+ it { is_expected.to route_command("ascii FRIDAY").to(:ascii_from_text) }
describe "#ascii_from_text" do
it "responds with ASCII art generated from the given text" do
send_command "ascii FRIDAY"
expect(replies.first).to match(" _____ ____ ___ ____ _ __ __\n | ___| _ \\|_ _| _ \\ / \\\\ \\ / /\n | |_ | |_) || || | | |/ _ \\\\ V / \n | _| | _ < | || |_| / ___ \\| | \n |_| |_| \\_\\___|____/_/ \\_\\_| \n ")
end
+
+ it "formats the response with a code block if the Slack adapter is in use" do
+ registry.config.robot.adapter = :slack
+ send_command 'ascii FRIDAY'
+ expect(replies.first).to start_with("```")
+ expect(replies.first).to end_with("```")
+ end
+
+ it "formats the response with a quote if the HipChat adapter is in use" do
+ registry.config.robot.adapter = :hipchat
+ send_command 'ascii FRIDAY'
+ expect(replies.first).to start_with("/quote")
+ end
end
end
|
spec: Test Slack and HipChat formatting
|
diff --git a/spec/models/batch_update_job_spec.rb b/spec/models/batch_update_job_spec.rb
index abc1234..def5678 100644
--- a/spec/models/batch_update_job_spec.rb
+++ b/spec/models/batch_update_job_spec.rb
@@ -0,0 +1,42 @@+require 'spec_helper'
+
+describe BatchUpdateJob do
+ before(:all) do
+ GenericFile.any_instance.stubs(:terms_of_service).returns('1')
+ @user = FactoryGirl.find_or_create(:user)
+ @batch = Batch.new
+ @batch.save
+ @file = GenericFile.new(:batch=>@batch)
+ @file.apply_depositor_metadata(@user.login)
+ @file.save
+ @file2 = GenericFile.new(:batch=>@batch)
+ @file2.apply_depositor_metadata('otherUser')
+ @file2.save
+ end
+ after(:all) do
+ # clear any existing messages
+ @batch.delete
+ @user.delete
+ @file.delete
+ @file2.delete
+ end
+ describe "failing update" do
+ it "should check permissions for each file before updating" do
+ BatchUpdateJob.any_instance.stubs(:get_permissions_solr_response_for_doc_id).returns(["","mock solr permissions"])
+ User.any_instance.expects(:can?).with(:edit, "mock solr permissions").times(2)
+ params = {'generic_file' => {'terms_of_service' => '1', 'read_groups_string' => '', 'read_users_string' => 'archivist1, archivist2', 'tag' => ['']}, 'id' => @batch.pid, 'controller' => 'batch', 'action' => 'update'}
+ BatchUpdateJob.perform(@user.login, params)
+ #b = Batch.find(@batch.pid)
+ end
+ end
+ describe "passing update" do
+ it "should log a content update event" do
+ BatchUpdateJob.any_instance.stubs(:get_permissions_solr_response_for_doc_id).returns(["","mock solr permissions"])
+ User.any_instance.expects(:can?).with(:edit, "mock solr permissions").times(2).returns(true)
+ Resque.expects(:enqueue).with(ContentUpdateEventJob, @file.pid, @user.login).once
+ Resque.expects(:enqueue).with(ContentUpdateEventJob, @file2.pid, @user.login).once
+ params = {'generic_file' => {'terms_of_service' => '1', 'read_groups_string' => '', 'read_users_string' => 'archivist1, archivist2', 'tag' => ['']}, 'id' => @batch.pid, 'controller' => 'batch', 'action' => 'update'}
+ BatchUpdateJob.perform(@user.login, params)
+ end
+ end
+end
|
Add specs for new BatchUpdateJob
|
diff --git a/recipes/default.rb b/recipes/default.rb
index abc1234..def5678 100644
--- a/recipes/default.rb
+++ b/recipes/default.rb
@@ -4,6 +4,13 @@ #
# Copyright (c) 2015 The Authors, All Rights Reserved.
-service node[:quickservice][:service] do
- action node[:quickservice][:action]
+services = [node[:quickservice][:service]] unless node[:quickservice][:service].kind_of(Array)
+actions = [node[:quickservice][:action]] unless node[:quickservice][:action].kind_of(Array)
+
+actions.fill(actions.last, actions.length..services.length-1)
+
+services.each_index do |i|
+ service services[i] do
+ action actions[i]
+ end
end
|
Support multiple services and actions.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.