diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/command_line/dash_upper_i_spec.rb b/command_line/dash_upper_i_spec.rb
index abc1234..def5678 100644
--- a/command_line/dash_upper_i_spec.rb
+++ b/command_line/dash_upper_i_spec.rb
@@ -21,3 +21,20 @@ ruby_exe(@script, options: "-I not_exist/not_exist").lines[0].should == "#{Dir.pwd}/not_exist/not_exist\n"
end
end
+
+describe "The -I command line option" do
+ before :each do
+ @script = fixture __FILE__, "loadpath.rb"
+ @fixtures = File.dirname(@script)
+ @symlink = tmp("loadpath_symlink")
+ File.symlink(@fixtures, @symlink)
+ end
+
+ after :each do
+ rm_r @symlink
+ end
+
+ it "does not expand symlinks" do
+ ruby_exe(@script, options: "-I #{@symlink}").lines[0].should == "#{@symlink}\n"
+ end
+end
|
Add spec for -I with symlinks
|
diff --git a/app/controllers/api/search_controller.rb b/app/controllers/api/search_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/search_controller.rb
+++ b/app/controllers/api/search_controller.rb
@@ -1,6 +1,6 @@ class Api::SearchController < ApplicationController
def show
- @searches = Line.search(params[:term]).joins(:quote).includes(:character, :quote).map(&:quote)
+ @searches = Line.search(params[:term]).joins(:quote).includes(:character, :quote).map(&:quote).uniq!
render json: @searches, root: :searches
end
end
|
Call uniq! to get unique searches deal with perf later
|
diff --git a/app/reports/research_matters_exporter.rb b/app/reports/research_matters_exporter.rb
index abc1234..def5678 100644
--- a/app/reports/research_matters_exporter.rb
+++ b/app/reports/research_matters_exporter.rb
@@ -0,0 +1,94 @@+require 'csv'
+
+class ResearchMattersExporter
+
+ STUDENT_INCLUDES = %w[school absences discipline_incidents event_notes]
+
+ def initialize
+ @school = School.find_by_local_id('HEA')
+ @students = @school.students.includes(STUDENT_INCLUDES)
+
+ @focal_time_period_start = DateTime.new(2017, 8, 28)
+ @focal_time_period_end = DateTime.new(2017, 12, 24)
+ end
+
+ def student_file
+ [student_file_headers, student_rows]
+ end
+
+ def export_teacher_file
+
+ end
+
+ private
+
+ def student_file_headers
+ %w[
+ student_id
+ school_id
+ absence_indicator
+ discipline_indicator
+ sst_indicator
+ notes_added
+ notes_revised
+ notes_total
+ ].join(',')
+ end
+
+ def student_rows
+ @students.map do |student|
+ absence_indicator = student_to_indicator(student.id, Absence, 12)
+ discipline_indicator = student_to_indicator(student.id, DisciplineIncident, 5)
+ sst_indicator = student_to_sst_indicator(absence_indicator, discipline_indicator)
+ notes_added = student_to_notes_added(student.id)
+ notes_revised = student_to_notes_revised(student.id)
+ notes_total = notes_added + notes_revised
+
+ [
+ student.local_id,
+ 'HEA',
+ absence_indicator,
+ discipline_indicator,
+ sst_indicator,
+ notes_added,
+ notes_revised,
+ notes_total,
+ ].join(',')
+ end
+ end
+
+ def filter_event_occurred_at(event, attribute_name)
+ occurred_at = event.send(attribute_name)
+ filter_from = @focal_time_period_start
+ filter_to = @focal_time_period_end
+
+ (occurred_at > filter_from) && (occurred_at < filter_to)
+ end
+
+ def student_to_indicator(student_id, focal_class, limit)
+ count = focal_class.where(student_id: student_id)
+ .select { |event| filter_event_occurred_at(event, 'occurred_at') }
+ .count
+
+ (count >= limit) ? '1' : 0
+ end
+
+ def student_to_notes_added(student_id)
+ EventNote.where(student_id: student_id, event_note_type_id: 300)
+ .select { |event| filter_event_occurred_at(event, 'recorded_at') }
+ .count
+ end
+
+ def student_to_notes_revised(student_id)
+ EventNoteRevision.where(student_id: student_id, event_note_type_id: 300)
+ .select { |event| filter_event_occurred_at(event, 'created_at') }
+ .count
+ end
+
+ def student_to_sst_indicator(absence_indicator, discipline_indicator)
+ return '1' if absence_indicator == '1' || discipline_indicator == '1'
+
+ return '0'
+ end
+
+end
|
Create data export code for Research Matters
|
diff --git a/lib/scorm2004/sequencing/rollup_rule.rb b/lib/scorm2004/sequencing/rollup_rule.rb
index abc1234..def5678 100644
--- a/lib/scorm2004/sequencing/rollup_rule.rb
+++ b/lib/scorm2004/sequencing/rollup_rule.rb
@@ -6,6 +6,8 @@ module Sequencing
class RollupRule
include RollupRuleDescription
+
+ attr_reader :rule
def initialize(rule)
@rule = rule
|
Fix the missing attribute reader.
RollupRule should have attr_reader :rule.
|
diff --git a/lib/vagrant-chef-zero/server_helpers.rb b/lib/vagrant-chef-zero/server_helpers.rb
index abc1234..def5678 100644
--- a/lib/vagrant-chef-zero/server_helpers.rb
+++ b/lib/vagrant-chef-zero/server_helpers.rb
@@ -32,7 +32,7 @@ end
def get_chef_zero_server_pid(port)
- pid = %x[ lsof -i tcp:#{port} | grep ruby | awk '{print $2}' ]
+ pid = %x[ lsof -i tcp:#{port} | grep -E 'ruby|chef-zero' | awk '{print $2}' ]
if pid && pid != ""
return pid
end
|
Add second search term when grepping for PID of Chef-Zero
|
diff --git a/lib/versioneye/services/http_service.rb b/lib/versioneye/services/http_service.rb
index abc1234..def5678 100644
--- a/lib/versioneye/services/http_service.rb
+++ b/lib/versioneye/services/http_service.rb
@@ -1,8 +1,24 @@ class HttpService < Versioneye::Service
def self.fetch_response url, timeout = 60
+
+ env = Settings.instance.environment
+ proxy_addr = GlobalSetting.get env, 'proxy_addr'
+ proxy_port = GlobalSetting.get env, 'proxy_port'
+ proxy_user = GlobalSetting.get env, 'proxy_user'
+ proxy_pass = GlobalSetting.get env, 'proxy_pass'
+
uri = URI.parse url
- http = Net::HTTP.new uri.host, uri.port
+ http = nil
+
+ if proxy_addr.to_s.empty?
+ http = Net::HTTP.new uri.host, uri.port
+ elsif !proxy_addr.to_s.empty? && !proxy_user.to_s.empty? && !proxy_pass.to_s.empty?
+ http = Net::HTTP.new uri.host, uri.port, proxy_addr, proxy_port, proxy_user, proxy_pass
+ elsif !proxy_addr.to_s.empty? && proxy_user.to_s.empty?
+ http = Net::HTTP.new uri.host, uri.port, proxy_addr, proxy_port
+ end
+
http.read_timeout = timeout # in seconds
if uri.port == 443
http.use_ssl = true
|
Add Proxy Settings to HTTP connections.
|
diff --git a/config/initializers/wicked_pdf.rb b/config/initializers/wicked_pdf.rb
index abc1234..def5678 100644
--- a/config/initializers/wicked_pdf.rb
+++ b/config/initializers/wicked_pdf.rb
@@ -1,7 +1,7 @@ require 'wicked_pdf'
WickedPdf.config = if Rails.env.production?
- { exe_path: '/u/apps/handy/shared/bin/wkhtmltopdf' }
+ { exe_path: '/app/usr/local/bin/wkhtmltopdf' }
else
{ exe_path: '/usr/local/bin/wkhtmltopdf' }
end
|
Update wkhtmltopdf executable path for Heroku
|
diff --git a/Casks/cacoo-ninja.rb b/Casks/cacoo-ninja.rb
index abc1234..def5678 100644
--- a/Casks/cacoo-ninja.rb
+++ b/Casks/cacoo-ninja.rb
@@ -8,7 +8,6 @@ license :gratis
installer :script => 'Install Cacoo Ninja.app/Contents/MacOS/Install Cacoo Ninja',
- :args => %w[-silent],
:sudo => true
uninstall :script => { :executable => 'Install Cacoo Ninja.app/Contents/MacOS/Install Cacoo Ninja' }
|
Remove silent option to update successfully
|
diff --git a/simple_sitemap.gemspec b/simple_sitemap.gemspec
index abc1234..def5678 100644
--- a/simple_sitemap.gemspec
+++ b/simple_sitemap.gemspec
@@ -13,7 +13,7 @@ gem.email = ['rpjlower@gmail.com']
gem.description = 'A simple sitemap generator'
gem.summary = 'Simple sitemap generator'
- gem.homepage = ''
+ gem.homepage = 'https://github.com/academia-edu/simple-sitemap'
gem.files = `git ls-files`.split($\)
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
Add github source URL as homepage
|
diff --git a/spec/command/trunk/addowner_spec.rb b/spec/command/trunk/addowner_spec.rb
index abc1234..def5678 100644
--- a/spec/command/trunk/addowner_spec.rb
+++ b/spec/command/trunk/addowner_spec.rb
@@ -4,7 +4,36 @@ describe Command::Trunk::AddOwner do
describe 'CLAide' do
it 'registers it self' do
- Command.parse(%w( trunk add-owner )).should.be.instance_of Command::Trunk::AddOwner
+ Command.parse(%w( trunk add-owner )).should.be.instance_of Command::Trunk::AddOwner
+ end
+ end
+
+ describe 'validation' do
+ it "should error if we don't have a token" do
+ Netrc.any_instance.stubs(:[]).returns(nil)
+ command = Command.parse(%w( trunk push ))
+ exception = lambda { command.validate! }.should.raise CLAide::Help
+ exception.message.should.include 'register a session'
+ end
+
+ it 'should error if pod name is not supplied' do
+ command = Command.parse(%w( trunk add-owner ))
+ command.stubs(:token).returns('token')
+ exception = lambda { command.validate! }.should.raise CLAide::Help
+ exception.message.should.include 'pod name'
+ end
+
+ it 'should error if new owners email is not supplied' do
+ command = Command.parse(%w( trunk add-owner QueryKit ))
+ command.stubs(:token).returns('token')
+ exception = lambda { command.validate! }.should.raise CLAide::Help
+ exception.message.should.include 'email'
+ end
+
+ it 'should should validate with valid pod and email' do
+ command = Command.parse(%w( trunk add-owner QueryKit kyle@cocoapods.org ))
+ command.stubs(:token).returns('token')
+ lambda { command.validate! }.should.not.raise CLAide::Help
end
end
end
|
[Specs] Test input validation in `trunk add-owner`
|
diff --git a/spec/correios/sro_validator_spec.rb b/spec/correios/sro_validator_spec.rb
index abc1234..def5678 100644
--- a/spec/correios/sro_validator_spec.rb
+++ b/spec/correios/sro_validator_spec.rb
@@ -18,6 +18,20 @@ it { expect(subject.valid?).to be false }
end
+ context "given a random string" do
+ let(:sro) { '31231231231231' }
+
+ it { expect(subject.valid?).to be false }
+ end
+
+ context "given a valid SRO with diff suffix" do
+ subject { described_class.new(sro, 'CN') }
+
+ let(:sro) { 'LX473124829CN' }
+
+ it { expect(subject.valid?).to be true }
+ end
+
end
end
|
Add more spec to cover latest improvements on the validator
- Spec to cover any random String should not break the validator
- Given a SRO with a specific suffix we could validate passing the suffix to the validator
|
diff --git a/spec/helpers/sidebar_helper_spec.rb b/spec/helpers/sidebar_helper_spec.rb
index abc1234..def5678 100644
--- a/spec/helpers/sidebar_helper_spec.rb
+++ b/spec/helpers/sidebar_helper_spec.rb
@@ -0,0 +1,55 @@+require 'spec_helper'
+
+class TestBrokenSidebar < Sidebar
+ description "Invalid test sidebar"
+ def parse_request(contents, request_params)
+ raise "I'm b0rked!"
+ end
+end
+
+
+describe SidebarHelper do
+ before do
+ @blog = Factory(:blog)
+ end
+
+ def content_array
+ []
+ end
+
+ def params
+ {}
+ end
+
+ def this_blog
+ @blog
+ end
+
+ # XXX: Ugh. Needed to break tight coupling :-(.
+ def render_to_string(options)
+ "Rendered #{options[:file] || options[:partial]}."
+ end
+
+ describe "#render_sidebars" do
+ describe "with an invalid sidebar" do
+ before do
+ TestBrokenSidebar.new.save
+ end
+
+ it "should return a friendly error message" do
+ render_sidebars.should =~ /It seems something went wrong/
+ end
+ end
+
+ describe "with a valid sidebar" do
+ before do
+ Sidebar.new.save
+ end
+
+ it "should render the sidebar" do
+ render_sidebars.should =~ /Rendered/
+ end
+ end
+ end
+end
+
|
Add some specs for sidebar helper. Not pretty.
|
diff --git a/omniauth-medpass.gemspec b/omniauth-medpass.gemspec
index abc1234..def5678 100644
--- a/omniauth-medpass.gemspec
+++ b/omniauth-medpass.gemspec
@@ -20,7 +20,7 @@
gem.add_development_dependency 'rack-test'
gem.add_development_dependency 'rake'
- gem.add_development_dependency 'rspec', '~> 2.8.0'
+ gem.add_development_dependency 'rspec', '~> 2.9.0.rc2'
gem.add_development_dependency 'simplecov'
gem.add_development_dependency 'webmock'
end
|
Update rspec to ~> 2.9.0.rc2
|
diff --git a/activesupport/lib/active_support/core_ext/kernel/debugger.rb b/activesupport/lib/active_support/core_ext/kernel/debugger.rb
index abc1234..def5678 100644
--- a/activesupport/lib/active_support/core_ext/kernel/debugger.rb
+++ b/activesupport/lib/active_support/core_ext/kernel/debugger.rb
@@ -7,6 +7,7 @@ end
end
+ undef :breakpoint if respond_to?(:breakpoint)
def breakpoint
message = "\n***** The 'breakpoint' command has been renamed 'debugger' -- please change *****\n"
defined?(Rails) ? Rails.logger.info(message) : $stderr.puts(message)
|
Fix Ruby warning: method redefined; discarding old breakpoint
|
diff --git a/app/controllers/active_storage/representations_controller.rb b/app/controllers/active_storage/representations_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/active_storage/representations_controller.rb
+++ b/app/controllers/active_storage/representations_controller.rb
@@ -8,23 +8,11 @@ def show
expires_in 1.year, public: true
- type = @blob.content_type || DEFAULT_SEND_FILE_TYPE
-
- if webp?
- variant = @blob.variant({convert: 'web'}).processed
- type = 'image/webp'
- else
- variant = @blob.representation(params[:variation_key]).processed
- end
+ variant = @blob.representation(params[:variation_key]).processed
send_data @blob.service.download(variant.key),
- type: type, disposition: 'inline'
- end
-
- private
-
- def webp?
- request.headers['Accept'] =~ /image\/webp/
+ type: @blob.content_type || DEFAULT_SEND_FILE_TYPE,
+ disposition: 'inline'
end
end
end
|
Revert "Return webp if browser supports it"
This reverts commit a7127f132a007839a63a912cdcdba2ac7dfcd780.
|
diff --git a/spec/lib/board_spec.rb b/spec/lib/board_spec.rb
index abc1234..def5678 100644
--- a/spec/lib/board_spec.rb
+++ b/spec/lib/board_spec.rb
@@ -0,0 +1,34 @@+require 'spec_helper'
+
+describe Tavern::Board do
+
+ let(:status_list) { [:todo, :done] }
+ let(:priorities) { [:low, :normal, :high] }
+
+ subject(:board) { Tavern::Board.new }
+
+ its(:tasks) { should be_empty }
+
+ context "#add" do
+
+ let(:task) { double }
+
+ it "should add a new task" do
+ expect { board.add(task) }.to change { board.tasks.count }.by(1)
+ end
+
+ end
+
+ it "should respond to each possible status" do
+ status_list.each do |status|
+ should respond_to(status)
+ end
+ end
+
+ it "should respond to each possible priority" do
+ priorities.each do |priority|
+ should respond_to(priority)
+ end
+ end
+
+end
|
Add first Board class spec
|
diff --git a/lib/dimma/version.rb b/lib/dimma/version.rb
index abc1234..def5678 100644
--- a/lib/dimma/version.rb
+++ b/lib/dimma/version.rb
@@ -1,5 +1,5 @@ module Dimma
# Dimmas’ version.
# @see http://semver.org/
- VERSION = %w(1 0 1).join(".")
+ VERSION = %w(1 1 0).join(".")
end
|
Bump to v1.1.0 (added Dimma::VERSION)
|
diff --git a/lib/identity/main.rb b/lib/identity/main.rb
index abc1234..def5678 100644
--- a/lib/identity/main.rb
+++ b/lib/identity/main.rb
@@ -20,8 +20,7 @@ domain: Config.heroku_cookie_domain,
expire_after: 2592000,
http_only: true,
- key: 'rack.session.heroku',
- secret: Config.cookie_encryption_key
+ key: 'rack.session.heroku'
end
use Rack::Csrf, skip: ["POST:/oauth/.*"]
|
Remove secret from Heroku cookie
|
diff --git a/lib/model_patches.rb b/lib/model_patches.rb
index abc1234..def5678 100644
--- a/lib/model_patches.rb
+++ b/lib/model_patches.rb
@@ -16,14 +16,24 @@ end
end
- # Add intro paragraph to new request template
OutgoingMessage.class_eval do
+ # Add intro paragraph to new request template
def default_letter
return nil if self.message_type == 'followup'
_("Under the right of access to documents in the EU treaties, as developed in "+
"Regulation 1049/2001, I am requesting documents which contain the following "+
"information:\n\n")
+ end
+
+ # Modify the search snippet to hide the intro paragraph.
+ # XXX: Need to have locale information in the model to improve this (issue #255)
+ def get_text_for_indexing
+ text = self.body.strip
+ text.sub!(/Dear .+,/, "")
+ text.sub!(/[^\n]+1049\/2001[^\n]+/, "") # XXX: can't be more specific without locale
+ self.remove_privacy_sensitive_things!(text)
+ return text
end
end
|
Hide legal intro paragraph from request search listing
|
diff --git a/lib/mollie/amount.rb b/lib/mollie/amount.rb
index abc1234..def5678 100644
--- a/lib/mollie/amount.rb
+++ b/lib/mollie/amount.rb
@@ -1,6 +1,10 @@ module Mollie
class Amount < Base
attr_accessor :value, :currency
+
+ def initialize(attributes)
+ super unless attributes.nil?
+ end
def value=(net)
@value = BigDecimal.new(net.to_s)
|
Return empty Amount object when API returns null
|
diff --git a/buildserver/cookbooks/fdroidbuild-general/recipes/default.rb b/buildserver/cookbooks/fdroidbuild-general/recipes/default.rb
index abc1234..def5678 100644
--- a/buildserver/cookbooks/fdroidbuild-general/recipes/default.rb
+++ b/buildserver/cookbooks/fdroidbuild-general/recipes/default.rb
@@ -5,7 +5,7 @@ command "apt-get update"
end
-%w{ant ant-contrib autoconf autoconf2.13 autopoint bison cmake expect flex gperf libarchive-zip-perl libtool libsaxonb-java libssl1.0.0 libssl-dev maven openjdk-7-jdk javacc python python-magic python-setuptools git-core mercurial subversion bzr git-svn make perlmagick pkg-config zip yasm inkscape imagemagick gettext realpath transfig texinfo curl librsvg2-bin xsltproc vorbis-tools swig quilt faketime optipng python-gnupg python3-gnupg nasm unzip}.each do |pkg|
+%w{ant ant-contrib autoconf autoconf2.13 autopoint bison cmake expect flex gperf libarchive-zip-perl libtool libsaxonb-java libssl1.0.0 libssl-dev maven openjdk-7-jdk javacc python python-magic python-setuptools git-core mercurial subversion bzr git-svn make perlmagick pkg-config zip yasm inkscape imagemagick gettext realpath transfig texinfo curl librsvg2-bin xsltproc vorbis-tools swig quilt faketime optipng python-gnupg python3-gnupg nasm unzip scons}.each do |pkg|
package pkg do
action :install
end
|
Add scons, make-like tool used by godot
|
diff --git a/web-services/tests/common/cache_test.rb b/web-services/tests/common/cache_test.rb
index abc1234..def5678 100644
--- a/web-services/tests/common/cache_test.rb
+++ b/web-services/tests/common/cache_test.rb
@@ -1,7 +1,32 @@-cache_test.rb - Unit Tests
+ #cache_test.rb - Unit Tests
require 'test/unit'
+require_relative '../../rupees/common/cache.rb'
class CacheTest < Test::Unit::TestCase
+ def test_initialize_should_instantiate_caches
+ assert_false(Cache.instance.disks_cache.nil?)
+ assert_false(Cache.instance.smart_cache.nil?)
+ end
+
+ def test_clear_all_should_remove_all_files
+ #given
+ cache_path = "#{Configuration::get.app_cache_directory}/*.cache"
+ Cache.instance.disks_cache.cache(Cache::CACHE_KEY_DISKS) do
+ []
+ end
+ for i in 1..10 do
+ Cache.instance.smart_cache.cache("#{Cache::CACHE_KEY_SMART_PREFIX}#{i}") do
+ []
+ end
+ end
+ assert_false(Dir.glob(cache_path).empty?)
+
+ #when
+ Cache.instance.clear_all
+
+ #then
+ assert_true(Dir.glob(cache_path).empty?)
+ end
end
|
[16] Add unit tests for cache manager
|
diff --git a/web.rb b/web.rb
index abc1234..def5678 100644
--- a/web.rb
+++ b/web.rb
@@ -11,6 +11,7 @@ property :region, String
property :realm, String
property :character, String
+ property :img_url, String
property :created_at, DateTime
property :updated_at, DateTime
end
|
Add image URL to Character model
|
diff --git a/app/controllers/api/items_controller.rb b/app/controllers/api/items_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/items_controller.rb
+++ b/app/controllers/api/items_controller.rb
@@ -1,12 +1,14 @@ class Api::ItemsController < ApiController
def index
item_type_id = params[:item_type_id]
+ number = params[:number]
agenda_id = params[:agenda_id]
@items = Item.all
@items = @items.where("lower(title) LIKE ? OR lower(origin_type) = ?", @@query, @@query.gsub("%", "")) unless @@query.empty?
@items = @items.where("item_type_id = ?", item_type_id) if item_type_id.present?
+ @items = @items.where("lower(number) = ?", number.downcase) if number.present?
@items = @items.where("origin_id = ? AND origin_type = 'Agenda'", agenda_id) if agenda_id.present?
paginate json: @items.order(change_query_order), per_page: change_per_page
|
Add Search For Number In API Item
|
diff --git a/blog.rb b/blog.rb
index abc1234..def5678 100644
--- a/blog.rb
+++ b/blog.rb
@@ -1,4 +1,5 @@ require 'sinatra'
+require 'sinatra/reloader' if development?
require 'haml'
require_relative 'lib/config'
|
Use sinatra/reloader in development mode
|
diff --git a/bigpanda.gemspec b/bigpanda.gemspec
index abc1234..def5678 100644
--- a/bigpanda.gemspec
+++ b/bigpanda.gemspec
@@ -7,7 +7,7 @@ s.authors = ["BigPanda"]
s.email = 'support@bigpanda.io'
s.files = ["lib/bigpanda.rb", "lib/bigpanda/capistrano.rb", "lib/bigpanda/bp-api.rb"]
- s.homepage = 'https://github.com/bigpandaio/integrations/bigpanda-rb'
+ s.homepage = 'https://github.com/bigpandaio/bigpanda-rb'
s.add_runtime_dependency 'json'
end
|
Update homepage of the gem
|
diff --git a/lib/sub_diff/gsub.rb b/lib/sub_diff/gsub.rb
index abc1234..def5678 100644
--- a/lib/sub_diff/gsub.rb
+++ b/lib/sub_diff/gsub.rb
@@ -8,6 +8,16 @@
def diff_method
:gsub
+ end
+
+ def prefix
+ super.sub(last_prefix, '')
+ end
+
+ def suffix
+ unless super.send(matcher, args.first)
+ super
+ end
end
private
@@ -23,16 +33,6 @@ last_prefix << prefix << match
end
- def prefix
- super.sub(last_prefix, '')
- end
-
- def suffix
- unless super.send(matcher, args.first)
- super
- end
- end
-
def matcher
if args.first.is_a?(Regexp)
:match
|
Change visiblity of a couple methods in `Gsub`
|
diff --git a/lib/taxonomy/tree.rb b/lib/taxonomy/tree.rb
index abc1234..def5678 100644
--- a/lib/taxonomy/tree.rb
+++ b/lib/taxonomy/tree.rb
@@ -1,5 +1,6 @@-# This has been copied into Content Tagger, pending a decision on where it should live.
-# If you're changing it, please consider handling the common case.
+# This has been copied into Content Tagger, pending a decision on
+# where it should live. If you're changing it, please consider
+# handling the common case.
# Recursive parser for publishing-api Taxon data
module Taxonomy
@@ -17,11 +18,15 @@ private
def build_taxon(taxon_hash)
- Taxon.new(title: taxon_hash['title'],
- base_path: taxon_hash['base_path'],
- content_id: taxon_hash['content_id'],
- phase: taxon_hash['phase'],
- visible_to_departmental_editors: !!taxon_hash.dig('details', 'visible_to_departmental_editors'))
+ Taxon.new(
+ title: taxon_hash['title'],
+ base_path: taxon_hash['base_path'],
+ content_id: taxon_hash['content_id'],
+ phase: taxon_hash['phase'],
+ visible_to_departmental_editors: !!taxon_hash.dig(
+ 'details', 'visible_to_departmental_editors'
+ )
+ )
end
def parse_taxons(parent, item_hash)
|
Change indentation in Tree class
To remove the long lines.
|
diff --git a/lib/woodhouse/job.rb b/lib/woodhouse/job.rb
index abc1234..def5678 100644
--- a/lib/woodhouse/job.rb
+++ b/lib/woodhouse/job.rb
@@ -3,6 +3,9 @@
class Woodhouse::Job
attr_accessor :worker_class_name, :job_method, :arguments
+ extend Forwardable
+
+ def_delegators :arguments, :each
def initialize(class_name = nil, method = nil, args = nil)
self.worker_class_name = class_name
|
Allow Woodhouse::Job to mimic a hash of its arguments.
|
diff --git a/minc.rb b/minc.rb
index abc1234..def5678 100644
--- a/minc.rb
+++ b/minc.rb
@@ -7,13 +7,17 @@
head 'https://github.com/BIC-MNI/minc.git'
- #fails_with_clang "Throws 'non-void function 'miget_real_value_hyperslab' should return a value' error during build.", :build => 318
-
depends_on 'netcdf'
if MacOS.xcode_version >= "4.3"
depends_on "automake" => :build
depends_on "libtool" => :build
+ end
+
+ fails_with :clang do
+ # TODO This is an easy fix, someone send it upstream!
+ build 318
+ cause "Throws 'non-void function 'miget_real_value_hyperslab' should return a value'"
end
def install
|
Use new fails_with DSL syntax
Signed-off-by: Jack Nagel <43386ce32af96f5c56f2a88e458cb94cebee3751@gmail.com>
|
diff --git a/week-4/simple_substrings/my_solution.rb b/week-4/simple_substrings/my_solution.rb
index abc1234..def5678 100644
--- a/week-4/simple_substrings/my_solution.rb
+++ b/week-4/simple_substrings/my_solution.rb
@@ -6,7 +6,7 @@ # Your Solution Below
def welcome(address)
- if address.include?('CA') == true
+ if address.include?(' CA') == true
return 'Welcome to California'
else
return 'You should move to California'
|
Add space in front of CA for include method
|
diff --git a/spec/features/experiment_create_spec.rb b/spec/features/experiment_create_spec.rb
index abc1234..def5678 100644
--- a/spec/features/experiment_create_spec.rb
+++ b/spec/features/experiment_create_spec.rb
@@ -5,7 +5,7 @@ it 'is able to display a new experiment form' do
visit '/experiment/index'
click_on 'Post A New Experiment'
- expect(page).to have_content "Post A New Experiment"
+ expect(page).to have_current_path new_experiment_path
end
it 'is able to fill out the new experiment form'
|
Refactor test to redirect to new experiment path
|
diff --git a/spec/helpers/user_and_repo_from_spec.rb b/spec/helpers/user_and_repo_from_spec.rb
index abc1234..def5678 100644
--- a/spec/helpers/user_and_repo_from_spec.rb
+++ b/spec/helpers/user_and_repo_from_spec.rb
@@ -5,11 +5,11 @@ @helper = GitHub::Helper.new
end
- it "should return defunkt and github.git" do
+ it "should parse a git:// url" do
@helper.user_and_repo_from("git://github.com/defunkt/github.git").should == ["defunkt", "github.git"]
end
- it "should return mojombo and god.git" do
+ it "should parse a ssh-based url" do
@helper.user_and_repo_from("git@github.com:mojombo/god.git").should == ["mojombo", "god.git"]
end
end
|
Increase the descriptiveness of the examples
|
diff --git a/app/mailers/comment_mailer.rb b/app/mailers/comment_mailer.rb
index abc1234..def5678 100644
--- a/app/mailers/comment_mailer.rb
+++ b/app/mailers/comment_mailer.rb
@@ -10,6 +10,6 @@ @campaign = idea.campaign
end
- mail(to: @user.email, subject: "You have new comment in #{@campaign.name} : #{@game.name}")
+ mail(to: @user.email, subject: "You have new comment in #{@campaign.name}")
end
end
|
Remove game from email title.
|
diff --git a/app/models/query_condition.rb b/app/models/query_condition.rb
index abc1234..def5678 100644
--- a/app/models/query_condition.rb
+++ b/app/models/query_condition.rb
@@ -17,6 +17,6 @@ attribute :object, Types::Strict::String.maybe
attribute :element, Types::Strict::String
attribute :operator, Operators
- attribute :value, Types::Coercible::String
+ attribute :value, Types::Any
attribute :optional, Types::Strict::Bool.default(false)
end
|
Allow the condition value to accept any type
|
diff --git a/app/controllers/educations_controller.rb b/app/controllers/educations_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/educations_controller.rb
+++ b/app/controllers/educations_controller.rb
@@ -1,4 +1,9 @@ class EducationsController < MyplaceonlineController
+ def index
+ @graduated = param_bool(:graduated)
+ super
+ end
+
def may_upload
true
end
@@ -11,6 +16,16 @@ Myp.display_date_month_year(obj.education_end, User.current_user)
end
+ def index_filters
+ super +
+ [
+ {
+ :name => :graduated,
+ :display => "myplaceonline.educations.graduated"
+ }
+ ]
+ end
+
protected
def insecure
true
@@ -35,4 +50,15 @@ education_files_attributes: FilesController.multi_param_names
)
end
+
+ def all_additional_sql(strict)
+ result = super(strict)
+ if !strict && @graduated
+ if result.nil?
+ result = ""
+ end
+ result += " and #{model.table_name}.graduated is not null"
+ end
+ result
+ end
end
|
Add education filter for only graduated degrees
|
diff --git a/app/controllers/operations_controller.rb b/app/controllers/operations_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/operations_controller.rb
+++ b/app/controllers/operations_controller.rb
@@ -0,0 +1,19 @@+class OperationsController < ApplicationController
+ skip_before_filter :require_login
+
+ def new
+ @operation = Operation.new
+ end
+
+ def create
+ @operation = Operation.new(operation_params)
+ if @operation.save
+ flash[:success] = 'Operación registrada exitosamente.'
+ redirect_to user_property_operations_path(current_user.id, params[:property_id])
+ else
+ flash[:error] = @operation.errors.full_messages.join(',')
+ render 'new'
+ end
+ end
+
+end
|
Add OperationsController and create - new actions.
|
diff --git a/app/sweepers/route_sweeper.rb b/app/sweepers/route_sweeper.rb
index abc1234..def5678 100644
--- a/app/sweepers/route_sweeper.rb
+++ b/app/sweepers/route_sweeper.rb
@@ -24,13 +24,13 @@ :action => 'show_route_region',
:id => route.region,
:only_path => true)
- expire_fragment(main_url(route_path, { :skip_protocol => true }))
+ expire_fragment(@controller.main_url(route_path,{ :skip_protocol => true }))
if route.previous_version and (route.previous_version.region_id != route.region_id)
route_path = url_for(:controller => '/locations',
:action => 'show_route_region',
:id => route.previous_version.region,
:only_path => true)
- expire_fragment(main_url(route_path, { :skip_protocol => true }))
+ expire_fragment(@controller.main_url(route_path, { :skip_protocol => true }))
end
end
|
Add explicit reference to controller to prevent namespace clash.
|
diff --git a/week-4/shortest-string/my_solution.rb b/week-4/shortest-string/my_solution.rb
index abc1234..def5678 100644
--- a/week-4/shortest-string/my_solution.rb
+++ b/week-4/shortest-string/my_solution.rb
@@ -21,5 +21,4 @@ end
result
-
end
|
Complete 4.6.4. Small formatting change on prev commit
|
diff --git a/FreeStreamer.podspec b/FreeStreamer.podspec
index abc1234..def5678 100644
--- a/FreeStreamer.podspec
+++ b/FreeStreamer.podspec
@@ -1,6 +1,6 @@ Pod::Spec.new do |s|
s.name = 'FreeStreamer'
- s.version = '1.3.1'
+ s.version = '1.3.2'
s.license = 'BSD'
s.summary = 'A low-memory footprint streaming audio client for iOS and OS X.'
s.homepage = 'https://github.com/muhku/FreeStreamer'
|
Bump the version to 1.3.2.
|
diff --git a/spec/utilities_spec.rb b/spec/utilities_spec.rb
index abc1234..def5678 100644
--- a/spec/utilities_spec.rb
+++ b/spec/utilities_spec.rb
@@ -0,0 +1,48 @@+require 'spec_helper'
+
+include GitHubArchiveParser
+
+describe Utilities do
+ describe "#time_from_natural_language" do
+ it "should raise an error with an invalid time" do
+ expect { Utilities.time_from_natural_language('nil') }.to raise_error(RuntimeError)
+ end
+
+ it "should return a Time object" do
+ time = Utilities.time_from_natural_language('August 1 2013 at 4am')
+ time.should be_a(Time)
+ end
+
+ it "should return a UTC time" do
+ time = Utilities.time_from_natural_language('August 1 2013 at 4am')
+ time.utc?.should be_true
+ end
+
+ it "should return the correct time" do
+ time = Utilities.time_from_natural_language('August 1 2013 at 4am')
+ time.year.should eq(2013)
+ time.month.should eq(8)
+ time.day.should eq(1)
+ time.hour.should eq(8) # +4 hours due to UTC
+ end
+ end
+
+ describe "#class_from_string" do
+ it "should return a valid name of a module" do
+ Utilities.class_from_string('Utilities').should eq(Utilities)
+ end
+
+ it "should return a valid name of a class" do
+ Utilities.class_from_string('Processor').should eq(Processor)
+ end
+
+ it "should return a valid name of a class using full path" do
+ Utilities.class_from_string('GitHubArchiveParser::Processor').should eq(Processor)
+ end
+
+ it "should return nil if class cannot be found" do
+ Utilities.class_from_string('SpecialApplication::MassUnit').should be_nil
+ end
+ end
+end
+
|
Add specs for Utilities module
Add:
* Specs for time_from_natural_language method
* Specs for class_from_string method
|
diff --git a/features/lib/support/normalise_output.rb b/features/lib/support/normalise_output.rb
index abc1234..def5678 100644
--- a/features/lib/support/normalise_output.rb
+++ b/features/lib/support/normalise_output.rb
@@ -19,8 +19,10 @@ elements = feature.fetch('elements') { [] }
elements.each do |scenario|
scenario['steps'].each do |step|
- expect(step['result']['duration']).to be >= 0
- step['result']['duration'] = 1
+ if step['result']
+ expect(step['result']['duration']).to be >= 0
+ step['result']['duration'] = 1
+ end
end
end
end
|
Handle that scenario outline steps do not contain result
|
diff --git a/app/controllers/spree/checkout_controller_decorator.rb b/app/controllers/spree/checkout_controller_decorator.rb
index abc1234..def5678 100644
--- a/app/controllers/spree/checkout_controller_decorator.rb
+++ b/app/controllers/spree/checkout_controller_decorator.rb
@@ -2,13 +2,13 @@ CheckoutController.class_eval do
before_filter :remove_payments_attributes_if_total_is_zero
- [:store_credit_amount, :remove_store_credits].each do |attrib|
+ [:store_credit_amount, :remove_store_credits].each do |attrib|
Spree::PermittedAttributes.checkout_attributes << attrib unless Spree::PermittedAttributes.checkout_attributes.include?(attrib)
end
private
def remove_payments_attributes_if_total_is_zero
- load_order
+ load_order_with_lock
return unless params[:order] && params[:order][:store_credit_amount]
parsed_credit = Spree::Price.new
|
Rename method load_order to load_order_with_lock
Fixes #59
|
diff --git a/config/initializers/question_cookies.rb b/config/initializers/question_cookies.rb
index abc1234..def5678 100644
--- a/config/initializers/question_cookies.rb
+++ b/config/initializers/question_cookies.rb
@@ -1,2 +1,3 @@ # This hash will contain the type of the question as a key and value will be number of cookies
H_COOKIES = {"Simple" => 1, "Medium" => 3, "Hard" => 5}
+H_COOKIES.default = 0
|
Set default Cookie value at 0
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -8,14 +8,14 @@
get '/search', :to => 'search#index'
- get '/dictionary', :to => redirect('/dictionaries')
- get '/dictionaries', :to => 'dictionaries#index'
+ get '/dictionary', :to => redirect('dictionaries/')
+ get '/dictionaries/', :to => 'dictionaries#index', :trailing_slash => true
resources :dictionary, :controller => 'dictionaries', :only => [:index, :show] do
- get '/lemma', :to => redirect { |params, req| "/dictionary/#{params[:dictionary_id]}/lemmas" }
+ get '/lemma', :to => redirect { |params, req| "dictionary/#{params[:dictionary_id]}/lemmas" }
get '/lemmas', :to => 'lemmas#index'
resources :lemma, :controller => 'lemmas', :only => [:index, :show]
- get '/scan', :to => redirect { |params, req| "/dictionary/#{params[:dictionary_id]}/scans" }
+ get '/scan', :to => redirect { |params, req| "dictionary/#{params[:dictionary_id]}/scans" }
get '/scans', :to => 'scans#index'
resources :scan, :controller => 'scans', :only => [:index, :show]
end
|
Make redirects robust enough to cope with a relative root URL
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -8,17 +8,15 @@ patch 'stories/:id/upvote', to: 'votes#upvote', as: 'vote_up'
delete '/vote/:id', to: 'votes#destroy', as: 'vote_delete'
-
resources :users, only: [:show, :edit, :update, :delete]
-
+ get 'stories/search', to: 'stories#search', as: 'stories_search'
resources :stories
resources :tags
get '/tags/:id/stories', to: 'tags#show', as: 'tags_show'
# get '/stories/:id/tags', to: 'stories#show_tags', as: 'show_tags'
resources :storytags
- resources :badges
root "welcome#index"
@@ -27,7 +25,9 @@ get '/logout', to: 'sessions#destroy'
+
patch 'snippets/:id/flag', to: 'snippets#flag', as: 'snippet_flag'
patch 'stories/:id/flag', to: 'stories#flag', as: 'story_flag'
+
end
|
Create route to searched stories view
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -2,7 +2,7 @@
# Frontend routes
namespace :elasticsearch, :path => '' do
- match "/search", :to => 'search#show', :as => 'search'
+ get '/search', to: 'search#show', as: 'search'
end
end
|
Use rails 4 route syntax
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -34,4 +34,5 @@ resources :recruiters, only: :show
get '/:id', to: 'developers#show', as: :developer
+ get '/:id/edit', to: 'developers#edit', as: :edit_developer
end
|
Add edit route for developer
|
diff --git a/config/sentry.rb b/config/sentry.rb
index abc1234..def5678 100644
--- a/config/sentry.rb
+++ b/config/sentry.rb
@@ -8,4 +8,4 @@
# Overwrite excluded exceptions
config.excluded_exceptions = []
-en+end
|
Correct the end in raven configuration
|
diff --git a/lib/bodega/engine.rb b/lib/bodega/engine.rb
index abc1234..def5678 100644
--- a/lib/bodega/engine.rb
+++ b/lib/bodega/engine.rb
@@ -4,17 +4,13 @@
initializer "bodega.hookses" do
ActiveSupport.on_load :action_controller do
- #require 'bodega/action_controller'
+ helper 'bodega/cart'
include Bodega::CartHelper
end
ActiveSupport.on_load :active_record do
require 'bodega/monetize'
end
-
- ActiveSupport.on_load :paypal_express do
- raise 'w0tf'
- end
end
end
end
|
Include helper automatically in all controllers
|
diff --git a/test/unit/presenters/completed_transaction_presenter_test.rb b/test/unit/presenters/completed_transaction_presenter_test.rb
index abc1234..def5678 100644
--- a/test/unit/presenters/completed_transaction_presenter_test.rb
+++ b/test/unit/presenters/completed_transaction_presenter_test.rb
@@ -0,0 +1,11 @@+require "test_helper"
+
+class CompletedTransactionPresenterTest < ActiveSupport::TestCase
+ def subject(content_item)
+ CompletedTransactionPresenter.new(content_item.deep_stringify_keys!)
+ end
+
+ test "#promotion" do
+ assert_equal 'organ-donation', subject(details: { promotion: 'organ-donation' }).promotion
+ end
+end
|
Add a presenter test for CompletedTransactionPresenter
|
diff --git a/lib/roda/plugins/delete_empty_headers.rb b/lib/roda/plugins/delete_empty_headers.rb
index abc1234..def5678 100644
--- a/lib/roda/plugins/delete_empty_headers.rb
+++ b/lib/roda/plugins/delete_empty_headers.rb
@@ -13,18 +13,18 @@ module ResponseMethods
# Delete any empty headers when calling finish
def finish
- delelete_empty_headers(super)
+ delete_empty_headers(super)
end
# Delete any empty headers when calling finish_with_body
def finish_with_body(_)
- delelete_empty_headers(super)
+ delete_empty_headers(super)
end
private
# Delete any empty headers from response
- def delelete_empty_headers(res)
+ def delete_empty_headers(res)
res[1].delete_if{|_, v| v.is_a?(String) && v.empty?}
res
end
|
Fix a typo in DeleteEmptyHeaders plugin
|
diff --git a/lib/sepa/banks/danske/danske_response.rb b/lib/sepa/banks/danske/danske_response.rb
index abc1234..def5678 100644
--- a/lib/sepa/banks/danske/danske_response.rb
+++ b/lib/sepa/banks/danske/danske_response.rb
@@ -1,31 +1,28 @@ module Sepa
class DanskeResponse < Response
- # Namespace used in danske bank certificate responses and requests
- TNS = 'http://danskebank.dk/PKI/PKIFactoryService/elements'
-
def bank_encryption_cert
- extract_cert(doc, 'BankEncryptionCert', TNS)
+ @bank_encryption_cert ||= extract_cert(doc, 'BankEncryptionCert', DANSKE_PKI)
end
def bank_signing_cert
- extract_cert(doc, 'BankSigningCert', TNS)
+ @bank_signing_cert ||= extract_cert(doc, 'BankSigningCert', DANSKE_PKI)
end
def bank_root_cert
- extract_cert(doc, 'BankRootCert', TNS)
+ @bank_root_cert ||= extract_cert(doc, 'BankRootCert', DANSKE_PKI)
end
def own_encryption_cert
- extract_cert(doc, 'EncryptionCert', TNS)
+ @own_encryption_cert ||= extract_cert(doc, 'EncryptionCert', DANSKE_PKI)
end
def own_signing_cert
- extract_cert(doc, 'SigningCert', TNS)
+ @own_signing_cert ||= extract_cert(doc, 'SigningCert', DANSKE_PKI)
end
def ca_certificate
- extract_cert(doc, 'CACert', TNS)
+ @ca_certificate ||= extract_cert(doc, 'CACert', DANSKE_PKI)
end
end
|
Use xml namespace constant from sepafm.rb and add memoization to methods
|
diff --git a/db/seeds/demo/160_patients_bookmarks.rb b/db/seeds/demo/160_patients_bookmarks.rb
index abc1234..def5678 100644
--- a/db/seeds/demo/160_patients_bookmarks.rb
+++ b/db/seeds/demo/160_patients_bookmarks.rb
@@ -5,10 +5,20 @@ roger_rabbit = Patient.find_by(family_name: 'RABBIT', given_name: 'Roger')
User.all.each do |user|
logcount += 1
-
patients_user = Patients.cast_user(user)
patients_user.bookmarks.create!(patient: roger_rabbit)
end
log "#{logcount} Roger RABBIT Bookmarks seeded"
+
+ logcount=0
+ jessica_rabbit = Patient.find_by(family_name: 'RABBIT', given_name: 'Jessica')
+ User.all.each do |user|
+ logcount += 1
+ patients_user = Patients.cast_user(user)
+ patients_user.bookmarks.create!(patient: jessica_rabbit)
+ end
+
+ log "#{logcount} Jessica RABBIT Bookmarks seeded"
+
end
|
Add 'Jessica RABBIT' bookmarks to each user
|
diff --git a/serp_metrics.gemspec b/serp_metrics.gemspec
index abc1234..def5678 100644
--- a/serp_metrics.gemspec
+++ b/serp_metrics.gemspec
@@ -10,7 +10,7 @@ gem.email = ["kristinalim.ph@gmail.com"]
gem.description = %q{Ruby interface to the SERP Metrics API}
gem.summary = %q{Ruby interface to the SERP Metrics API}
- gem.homepage = "https://github.com/wearetribe/serp_metrics.git"
+ gem.homepage = "https://github.com/wearetribe/serp_metrics"
gem.files = `git ls-files`.split($/)
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
Fix homepage to not use git URI.
|
diff --git a/lib/katgut/engine.rb b/lib/katgut/engine.rb
index abc1234..def5678 100644
--- a/lib/katgut/engine.rb
+++ b/lib/katgut/engine.rb
@@ -6,9 +6,5 @@ g.test_framework :rspec, fixture: false
g.fixture_replacement :factory_girl, dir: "spec/factories"
end
-
- initializer "static assets" do |app|
- app.middleware.insert_before(::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public")
- end
end
end
|
Remove unnecessary settings for loading of static assets
* It brokes 'rake assets:precompile' when the host app
is set not to serve static assets
|
diff --git a/lib/matross/nginx.rb b/lib/matross/nginx.rb
index abc1234..def5678 100644
--- a/lib/matross/nginx.rb
+++ b/lib/matross/nginx.rb
@@ -22,6 +22,7 @@ run "#{sudo} sed -i /auth_basic/d /etc/nginx/sites-available/#{application}"
nginx_lock = " auth_basic \"Restricted\";\n auth_basic_user_file #{shared_path.gsub('/', '\\/')}\\/.htpasswd;"
run "#{sudo} sed -i 's/.*location @#{application}.*/&\n#{nginx_lock}/' /etc/nginx/sites-available/#{application}"
+ run "echo #{htpasswd} > #{shared_path}/.htpasswd"
end
task :unlock, :roles => :web do
|
Put the htpasswd file in shared path
|
diff --git a/spec/memory_spec.rb b/spec/memory_spec.rb
index abc1234..def5678 100644
--- a/spec/memory_spec.rb
+++ b/spec/memory_spec.rb
@@ -2,6 +2,10 @@
describe Memory do
describe Memory::Sources::GitHubSource do
+ subject(:github_source) {
+ Memory::Sources::GitHubSource.new(username: 'svankmajer')
+ }
+
describe '#new' do
it 'requires a GitHub username' do
expect {
@@ -11,17 +15,13 @@
describe '#feed_url' do
it 'is built from the configured username' do
- source = Memory::Sources::GitHubSource.new(username: 'svankmajer')
-
- expect(source.feed_url).to include(source.username)
+ expect(github_source.feed_url).to include(github_source.username)
end
end
describe '#update' do
it 'updates the store returning the latest events' do
- source = Memory::Sources::GitHubSource.new(username: 'svankmajer')
-
- expect(source.update).to be_an(Array)
+ expect(github_source.update).to be_an(Array)
end
end
end
|
Introduce subject to GitHubSource specs.
This commits adds a _named_ subject to Memory::Sources::GitHubSource specs to
avoid code duplication.
|
diff --git a/app/controllers/api/status_controller.rb b/app/controllers/api/status_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/status_controller.rb
+++ b/app/controllers/api/status_controller.rb
@@ -4,7 +4,7 @@ def check
if params[:projects].any?
@projects = params[:projects].group_by{|project| project[:platform] }.map do |platform, projects|
- Project.lookup_multiple(find_platform_by_name(platform), projects.map{|project| project[:name] }).records.includes(:github_repository, :versions)
+ Project.lookup_multiple(find_platform_by_name(platform), projects.map{|project| project[:name] }).paginate(page: 1, per_page: 1000).records.includes(:github_repository, :versions)
end.flatten.compact
else
@projects = []
|
Enable checking up to 1000 projects at a time
|
diff --git a/app/controllers/localities_controller.rb b/app/controllers/localities_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/localities_controller.rb
+++ b/app/controllers/localities_controller.rb
@@ -41,8 +41,9 @@ end
def destroy
+ locality_name = @locality.city
if @locality.destroy
- flash[:notice] = "Locality #{ @locality.name } deleted successfully."
+ flash[:notice] = "Locality #{locality_name} deleted successfully."
redirect_to localities_url
else
flash[:error] = 'Locality could not be deleted.'
|
Fix bug - trying to access locality name after it had been deleted.
|
diff --git a/lib/readme_tester.rb b/lib/readme_tester.rb
index abc1234..def5678 100644
--- a/lib/readme_tester.rb
+++ b/lib/readme_tester.rb
@@ -10,6 +10,9 @@ Deject self, :interaction
dependency(:interpreter_class) { Interpreter }
dependency(:file_class) { File }
+
+ SUCCESS_STATUS = 0
+ FAILURE_STATUS = 1
def initialize(argv)
self.argv = argv
@@ -28,25 +31,25 @@ def missing_input_file
return if filename
interaction.declare_failure 'Please provide an input file'
- 1
+ FAILURE_STATUS
end
def invalid_filename
return if filename =~ suffix_regex
interaction.declare_failure "#{filename.inspect} does not end in .testable_readme"
- 1
+ FAILURE_STATUS
end
def nonexistent_file
return if file_class.exist? filename
interaction.declare_failure "#{File.expand_path(filename).inspect} does not exist."
- 1
+ FAILURE_STATUS
end
def execute!
- return 1 unless interpreter.tests_pass?
+ return FAILURE_STATUS unless interpreter.tests_pass?
file_class.write output_filename_for(filename), interpreter.result
- 0
+ SUCCESS_STATUS
end
def filename
|
Set exit statuses into constants instead of hard coding them
|
diff --git a/app/helpers/application_helper/button/utilization_download.rb b/app/helpers/application_helper/button/utilization_download.rb
index abc1234..def5678 100644
--- a/app/helpers/application_helper/button/utilization_download.rb
+++ b/app/helpers/application_helper/button/utilization_download.rb
@@ -1,7 +1,7 @@ class ApplicationHelper::Button::UtilizationDownload < ApplicationHelper::Button::Basic
def disabled?
# to enable the button we are in the "Utilization" and have trend report
- return false if @layout == 'miq_capacity_utilization' && @sb[:active_tab] == 'report' && !@sb.fetch_path(:trend_rpt).table.data.empty?
+ return false if @layout == 'miq_capacity_utilization' && @sb[:active_tab] == 'report' && @sb.fetch_path(:trend_rpt, :table, :data).present?
# otherwise the button is off
@error_message = _('No records found for this report')
|
Fix error about empty? called on nil object
|
diff --git a/app/serializers/lite_paper_serializer.rb b/app/serializers/lite_paper_serializer.rb
index abc1234..def5678 100644
--- a/app/serializers/lite_paper_serializer.rb
+++ b/app/serializers/lite_paper_serializer.rb
@@ -5,8 +5,7 @@ scoped_user.paper_roles.where(paper: object).order(created_at: :desc).pluck(:created_at).first
end
- # TODO: should we modify this to show new task participants on their dashboard?
- # it only looks at paper_roles right now
+ #TODO: this method does not include a tooltip if user is related to paper by just being a task participant (see pivotal #82588944)
def roles
# rocking this in memory because eager-loading
roles = object.paper_roles.select { |role|
|
Update todo to point to open pivotal card
|
diff --git a/app/services/csvlint_validate_service.rb b/app/services/csvlint_validate_service.rb
index abc1234..def5678 100644
--- a/app/services/csvlint_validate_service.rb
+++ b/app/services/csvlint_validate_service.rb
@@ -0,0 +1,13 @@+class CsvlintValidateService
+
+ require 'csvlint'
+
+ def self.validate_csv(dataset_files)
+ dataset_files.each do |file|
+ @s3_string = FileStorageService.get_string_io(file.storage_key)
+ validator = Csvlint::Validator.new(@s3_string)
+ validator.valid?
+ end
+ end
+
+end
|
Add service CsvlintValidateService - validate s3 csv string with csvlint.rb
|
diff --git a/spec/features/override_sendgrid_spec.rb b/spec/features/override_sendgrid_spec.rb
index abc1234..def5678 100644
--- a/spec/features/override_sendgrid_spec.rb
+++ b/spec/features/override_sendgrid_spec.rb
@@ -29,4 +29,26 @@
expect(page).to have_content('Your request is being processed')
end
+
+ scenario 'overriding bounce' do
+ allow(SendgridHelper).to receive(:bounced?).and_return(true)
+
+ visit '/prisoner-details'
+ enter_prisoner_information
+ enter_visitor_information
+ click_button 'Continue'
+
+ expect(page).to have_text('returned in the past')
+ check 'Tick this box to confirm you’d like us to try sending messages to you again'
+ click_button 'Continue'
+
+ expect(page).to have_content('When do you want to visit?')
+ select_a_slot
+ click_button 'Continue'
+
+ expect(page).to have_content('Check your request')
+ click_button 'Send request'
+
+ expect(page).to have_content('Your request is being processed')
+ end
end
|
Add end-to-end bounce override spec
|
diff --git a/lib/session_token.rb b/lib/session_token.rb
index abc1234..def5678 100644
--- a/lib/session_token.rb
+++ b/lib/session_token.rb
@@ -1,17 +1,19 @@ class SessionToken
- PASSWORD = Rails.application.secrets.secret_key_base
- EXPIRY = 4.days
- ISSUER = 'farmbot-web-app'
+ EXPIRY = 4.days
+ ISSUER = 'farmbot-web-app'
+ PRIVATE_KEY = KeyGen.current
+ PUBLIC_KEY = KeyGen.current.public_key
+ ALG = 'RS256'
attr_accessor :encoded, :unencoded
def initialize(payload)
@unencoded = payload
- @encoded = JWT.encode(payload, PASSWORD)
+ @encoded = JWT.encode(payload, PRIVATE_KEY, ALG)
end
def self.decode!(token)
- self.new JWT.decode(token, PASSWORD)
+ self.new JWT.decode(token, PUBLIC_KEY, true, algorithm: ALG)
end
def self.issue_to(user, iat = Time.now.to_i, exp = EXPIRY.from_now.to_i)
@@ -20,6 +22,6 @@ jti: SecureRandom.uuid, # TODO: Add ability to revoke.
iss: ISSUER,
exp: exp,
- alg: "RS256")
+ alg: ALG)
end
end
|
Change JWT encrytion to RS256
|
diff --git a/app/uploaders/pulitzer/image_uploader.rb b/app/uploaders/pulitzer/image_uploader.rb
index abc1234..def5678 100644
--- a/app/uploaders/pulitzer/image_uploader.rb
+++ b/app/uploaders/pulitzer/image_uploader.rb
@@ -5,4 +5,8 @@ def resize_image
self.class.process resize_to_fit: [model.height, model.width]
end
+
+ version :thumb do
+ process resize_to_fill: [200,200]
+ end
end
|
Add thumb version for images
|
diff --git a/lib/time_zone_ext.rb b/lib/time_zone_ext.rb
index abc1234..def5678 100644
--- a/lib/time_zone_ext.rb
+++ b/lib/time_zone_ext.rb
@@ -5,9 +5,9 @@ module TimeZoneExt
def strptime(date, format)
if format =~ /%z/i
- Time.strptime(date, format).in_time_zone
+ DateTime.strptime(date, format).in_time_zone
else
- Time.strptime("#{date} zone#{name}", "#{format} zone%z").in_time_zone
+ DateTime.strptime("#{date} zone#{name}", "#{format} zone%z").in_time_zone
end
end
end
|
Use DateTime instaed of Time to support ruby 1.8
|
diff --git a/lib/usesthis/page.rb b/lib/usesthis/page.rb
index abc1234..def5678 100644
--- a/lib/usesthis/page.rb
+++ b/lib/usesthis/page.rb
@@ -20,11 +20,11 @@ end
end
- def write(output_path)
+ def write(output_path, filename = 'index.html')
if @path
- path = File.join(output_path, File.dirname(@path).gsub(@site.paths[:pages], ''), 'index.html')
+ path = File.join(output_path, File.dirname(@path).gsub(@site.paths[:pages], ''), filename)
else
- path = File.join(output_path, 'index.html')
+ path = File.join(output_path, filename)
end
FileUtils.mkdir_p(File.dirname(path))
|
Support passing in a custom filename to write().
|
diff --git a/db/migrate/20171113180900_add_dry_to_user_migration_import.rb b/db/migrate/20171113180900_add_dry_to_user_migration_import.rb
index abc1234..def5678 100644
--- a/db/migrate/20171113180900_add_dry_to_user_migration_import.rb
+++ b/db/migrate/20171113180900_add_dry_to_user_migration_import.rb
@@ -4,7 +4,7 @@
migration(
Proc.new do
- add_column :user_migration_imports, :dry, :boolean, default: true
+ add_column :user_migration_imports, :dry, :boolean, default: false
end,
Proc.new do
drop_column :user_migration_imports, :dry
|
Change default value for migration
|
diff --git a/spec/bench_helper.rb b/spec/bench_helper.rb
index abc1234..def5678 100644
--- a/spec/bench_helper.rb
+++ b/spec/bench_helper.rb
@@ -58,7 +58,7 @@ $__benchmarks__ = []
at_exit do
- reports = Benchmark.ips(time = 2) do |x|
+ reports = Benchmark.ips(time = 1) do |x|
$__benchmarks__.each do |bench|
5.times { bench.run_initial }
x.report(bench.name, &bench)
|
Make running benchmarks TWICE AS FAST!
|
diff --git a/postrank-uri.gemspec b/postrank-uri.gemspec
index abc1234..def5678 100644
--- a/postrank-uri.gemspec
+++ b/postrank-uri.gemspec
@@ -15,7 +15,7 @@
s.rubyforge_project = "postrank-uri"
- s.add_dependency "addressable", "~> 2.3.0"
+ s.add_dependency "addressable", ">= 2.3.0", "< 2.6"
s.add_dependency "public_suffix", ">= 2.0.0", "< 2.1"
s.add_dependency "nokogiri", ">= 1.6.1", "< 1.8"
|
Allow newer versions of addressable
Tested and working with addressable 2.5.0
|
diff --git a/spec/support/auto_load_turnip.rb b/spec/support/auto_load_turnip.rb
index abc1234..def5678 100644
--- a/spec/support/auto_load_turnip.rb
+++ b/spec/support/auto_load_turnip.rb
@@ -1,47 +1,22 @@-# See https://github.com/jnicklas/turnip/pull/96
-# with a tweak to group features into acceptance/features/ alongside
-# acceptance/steps/
+RSpec.configure do |config|
+ config.before(turnip: true) do
+ example = Turnip::RSpec.fetch_current_example(self)
+ feature_file = example.metadata[:file_path]
-module Turnip
- module RSpec
- class << self
- def run(feature_file)
- Turnip::Builder.build(feature_file).features.each do |feature|
- describe feature.name, feature.metadata_hash do
- before do
- # This is kind of a hack, but it will make RSpec throw way nicer exceptions
- example.metadata[:file_path] = feature_file
+ # turnip_file_path = Pathname.new(File.expand_path(feature_file)).realpath
+ turnip_file_path = Pathname.new(feature_file).realpath
- turnip_file_path = Pathname.new(feature_file)
- root_acceptance_folder = Pathname.new(Dir.pwd).join("spec", "acceptance")
+ # sadly Dir.pwd might have changed because of aprescott/serif#71, so we need
+ # to find the equivalent of Rails.root
+ root_app_folder = Pathname.new(Dir.pwd)
+ root_app_folder = root_app_folder.parent until root_app_folder.children(false).map(&:to_s).include?("serif.gemspec")
- default_steps_file = root_acceptance_folder + turnip_file_path.relative_path_from(root_acceptance_folder).to_s.gsub(/^features/, "steps").gsub(/\.feature$/, "_steps.rb")
- default_steps_module = [turnip_file_path.basename.to_s.sub(".feature", "").split("_").collect(&:capitalize), "Steps"].join
+ root_acceptance_folder = root_app_folder.join("spec", "acceptance")
- if File.exists?(default_steps_file)
- require default_steps_file
- if Module.const_defined?(default_steps_module)
- extend Module.const_get(default_steps_module)
- end
- end
+ default_steps_file = root_acceptance_folder + turnip_file_path.relative_path_from(root_acceptance_folder).to_s.gsub(/^features/, "steps").gsub(/\.feature$/, "_steps.rb")
+ default_steps_module = [turnip_file_path.basename.to_s.sub(".feature", "").split("_").collect(&:capitalize), "Steps"].join
- feature.backgrounds.map(&:steps).flatten.each do |step|
- run_step(feature_file, step)
- end
- end
- feature.scenarios.each do |scenario|
- instance_eval <<-EOS, feature_file, scenario.line
- describe scenario.name, scenario.metadata_hash do it(scenario.steps.map(&:description).join(" -> ")) do
- scenario.steps.each do |step|
- run_step(feature_file, step)
- end
- end
- end
- EOS
- end
- end
- end
- end
- end
+ require default_steps_file.to_s
+ extend Module.const_get(default_steps_module)
end
end
|
Switch away from patched Turnip autoloading.
|
diff --git a/tasks/user_system_has_accounts_tasks.rake b/tasks/user_system_has_accounts_tasks.rake
index abc1234..def5678 100644
--- a/tasks/user_system_has_accounts_tasks.rake
+++ b/tasks/user_system_has_accounts_tasks.rake
@@ -18,7 +18,7 @@
desc "Run migrations for the UserSystemHasAccounts Extension"
task :migrate do
- require 'environment'
+ require 'config/environment'
ActiveRecord::Base.establish_connection
require File.join(File.dirname(__FILE__), '..', 'ext_lib', 'plugin_migrator')
ActiveRecord::PluginMigrator.migrate(File.join(File.dirname(__FILE__), '..', 'db', 'migrate'), ENV['VERSION'] ? ENV['VERSION'].to_i : nil)
@@ -26,7 +26,7 @@
desc 'Test the UserSystemHasAccounts Extension.'
Rake::TestTask.new(:test) do |t|
- require 'environment'
+ require 'config/environment'
t.ruby_opts << "-r#{RAILS_ROOT}/test/test_helper"
t.libs << File.join(File.dirname(__FILE__), '..', 'lib')
t.pattern = File.join(File.dirname(__FILE__), '..', 'test/**/*_test.rb')
|
Fix require 'environment' => 'config/environment'
|
diff --git a/test/controllers/store_controller_test.rb b/test/controllers/store_controller_test.rb
index abc1234..def5678 100644
--- a/test/controllers/store_controller_test.rb
+++ b/test/controllers/store_controller_test.rb
@@ -4,6 +4,10 @@ test "should get index" do
get :index
assert_response :success
+ assert_select '#columns #side a', minimum: 4
+ assert_select '#main .entry', 3
+ assert_select 'h3', 'Programming Ruby 2.0'
+ assert_select '.price', /\$[,\d]+\.\d\d/
end
end
|
Store Controller Test for navigation, record number, sample title, and price formatting
|
diff --git a/lib/identificamex/normalizador_cadena.rb b/lib/identificamex/normalizador_cadena.rb
index abc1234..def5678 100644
--- a/lib/identificamex/normalizador_cadena.rb
+++ b/lib/identificamex/normalizador_cadena.rb
@@ -16,13 +16,22 @@ end
def normalizar
- if nombres.count > 1
- nombre_principal = nombres.find{ |n| !(nombres_ignorados.member?(n)) }
- end
- nombre_principal || nombres.first
+ nombre_aceptado || primer_nombre
end
private
+
+ def nombre_aceptado
+ nombres.find{|nombre| no_ignorado?(nombre) } if nombres.count > 1
+ end
+
+ def no_ignorado?(nombre)
+ !nombres_ignorados.member?(nombre)
+ end
+
+ def primer_nombre
+ nombres.first
+ end
def nombres_ignorados
raise NotImplementedError
|
Refactor to reduce method length.
|
diff --git a/core/config/initializers/secret_token.rb b/core/config/initializers/secret_token.rb
index abc1234..def5678 100644
--- a/core/config/initializers/secret_token.rb
+++ b/core/config/initializers/secret_token.rb
@@ -4,4 +4,4 @@ # If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
-FactlinkUI::Application.config.secret_token = 'aoVyP6MmVjps2Mq2Qdph7KZlfomR87qS98CHMHmd72kVSebHLTymdxZv40Ob1WHJmchLuyVuE2WLtbnXfOc03jrDwaGST4BmfzA1fhtH2WmFbXEUf5lWm4ZNBdDJuBxIcpwIwrOcPLTIJkeWc460WVPFoGgOk9Lc33A000I5NiHIRHLeHpXO0k3mySVaVED7qzyRkhmv'
+FactlinkUI::Application.config.secret_token = 'aoVyP6MmVjps2Mq2Qdph7KZlfomR87qS98CHMHmd72kVSebHLTymdxZv40Ob1sdasdasdWHJmchLuyVuE2WLtbnXfOc03jrDwaGST4BmfzA1fhtH2WmFbXEUf5lWm4ZNBdDJuBxIcpwIwrOcPLTIJkeWc460WVPFoGgOk9Lc33A000I5NiHIRHLeHpXO0k3mySVaVED7qzyRkhmv'
|
Update secret token to fix current sessions
|
diff --git a/lib/tasks/compute_match_percentages.rake b/lib/tasks/compute_match_percentages.rake
index abc1234..def5678 100644
--- a/lib/tasks/compute_match_percentages.rake
+++ b/lib/tasks/compute_match_percentages.rake
@@ -0,0 +1,13 @@+desc "Compute the match percentages for all of the user pairs in a section"
+task :compute_match_percentages => :environment do
+ ("A".."J").each do |section|
+ puts "Section #{section}"
+ User.in_section(section).each do |u1|
+ m = MatchPercentageService.new(u1)
+
+ User.in_section(section).each do |u2|
+ m.compute_score(u2)
+ end
+ end
+ end
+end
|
Add a rake task to compute the match percentages
|
diff --git a/app/controllers/feedback_controller.rb b/app/controllers/feedback_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/feedback_controller.rb
+++ b/app/controllers/feedback_controller.rb
@@ -7,7 +7,7 @@ def create
@seo_carrier ||= OpenStruct.new(title: I18n.t('defaults.page_titles.feedback'))
@feedback = Feedback.new(feedback_params)
-
+
# robots detections with fake surname field
robot_detected = params[:feedback] && params[:feedback][:surname].present?
@@ -16,8 +16,12 @@ # flag to show success message instead feedback form in the view
@success_feedback = true
+ # Can be raised error during email delivery, as example:
+ # Net::SMTPFatalError (550 Message was not accepted -- invalid mailbox.
+ # Local mailbox nefedova.polina@list.ru is unavailable: user is terminated)
+ # use begin..rescue..end if you need continue execution any way
FeedbackMailer.feedback_message(@feedback).deliver unless robot_detected
-
+
format.html { render action: 'new' }
format.json { render json: @feedback, status: :created }
else
|
Add usefull comment about email devilery
|
diff --git a/app/controllers/invoices_controller.rb b/app/controllers/invoices_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/invoices_controller.rb
+++ b/app/controllers/invoices_controller.rb
@@ -32,7 +32,7 @@ cl.quantity)
end
- piwik += piwik_ecommerce_order(order.document_id, order.taxed_price.rounded.to_f, order.products_taxed_price.rounded.to_f, order.taxes.rounded.to_f, order.taxed_price.rounded.to_f)
+ piwik += piwik_ecommerce_order(order.document_id, order.taxed_price.rounded.to_f, order.products_taxed_price.rounded.to_f, order.taxes.rounded.to_f, order.total_taxed_shipping_price.rounded.to_f)
return piwik
end
|
Fix shipping reporting in Piwik
|
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/sessions_controller.rb
+++ b/app/controllers/sessions_controller.rb
@@ -5,6 +5,7 @@ def set_logged_in
if (user_signed_in?)
# Sets a "permanent" cookie (which expires in 20 years from now).
+ # This is exclusively used to never cache content for logged in users
cookies.permanent[:logged_in] = "I <3 EFF"
end
end
|
Add comment to clarify logged_in cookie
|
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/sessions_controller.rb
+++ b/app/controllers/sessions_controller.rb
@@ -5,9 +5,9 @@ end
def create
- @user = User.find_by(email: user_params[:email])
- if @user.password == params[:password]
- session[:user_id] = @user.id
+ user = User.find_by(username: user_params[:username])
+ if user && user.authenticate(user_params[:password])
+ session[:user_id] = user.id
redirect_to root_path
else
flash[:notice] = "Invalid Username or Password"
@@ -17,6 +17,7 @@
def destroy
session[:user_id] = nil
+ redirect_to root_path
end
private
|
Fix logging in validation for user
|
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/sessions_controller.rb
+++ b/app/controllers/sessions_controller.rb
@@ -0,0 +1,19 @@+class SessionsController < ApplicationController
+
+ def new
+ @user = User.new
+ end
+
+ def create
+ if user = User.find_by(username: params[:session][:username]).try(:authenticate, params[:session][:password])
+ session[:user_id] = user.id
+ redirect_to "/"
+ else
+ end
+ end
+
+ def destroy
+ session.clear
+ redirect_to '/'
+ end
+end
|
Add new and create routes
|
diff --git a/app/jobs/promo/email_breakdowns_job.rb b/app/jobs/promo/email_breakdowns_job.rb
index abc1234..def5678 100644
--- a/app/jobs/promo/email_breakdowns_job.rb
+++ b/app/jobs/promo/email_breakdowns_job.rb
@@ -12,8 +12,12 @@ is_geo: true,
include_ratios: false
).perform)
- csv.delete("Day")
+ new_csv = []
+ csv.each do |row|
+ row.delete_at(2) # delete Day column
+ new_csv << row.join(",")
+ end
publisher = Publisher.find_by(id: publisher_id)
- PublisherMailer.promo_breakdowns(publisher, csv.to_csv).deliver_now
+ PublisherMailer.promo_breakdowns(publisher, new_csv.join("\n")).deliver_now
end
end
|
Fix the columns being selected
|
diff --git a/spec/controllers/home_controller_spec.rb b/spec/controllers/home_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/home_controller_spec.rb
+++ b/spec/controllers/home_controller_spec.rb
@@ -1,12 +1,13 @@ require 'spec_helper'
describe HomeController do
+ render_views
describe "GET 'index'" do
it "returns http success" do
get 'index'
response.should be_success
+ response.should have_selector("title", :content => "Circle - Continuous Integration made easy")
end
end
-
end
|
Add a test for the title of the homepage.
|
diff --git a/db/migrate/20151114201151_add_project_name_to_teams.rb b/db/migrate/20151114201151_add_project_name_to_teams.rb
index abc1234..def5678 100644
--- a/db/migrate/20151114201151_add_project_name_to_teams.rb
+++ b/db/migrate/20151114201151_add_project_name_to_teams.rb
@@ -4,7 +4,7 @@
Project.joins(:team).each do |project|
project.team.update_column :project_name, project.name
- end
+ end if Project.new.respond_to? :team
end
def down
|
Allow running migrations when association is gone
|
diff --git a/db/migrate/20160721152111_change_explicit_to_string.rb b/db/migrate/20160721152111_change_explicit_to_string.rb
index abc1234..def5678 100644
--- a/db/migrate/20160721152111_change_explicit_to_string.rb
+++ b/db/migrate/20160721152111_change_explicit_to_string.rb
@@ -0,0 +1,17 @@+class ChangeExplicitToString < ActiveRecord::Migration
+ def up
+ rename_column :podcasts, :explicit, :explicit_boolean
+ add_column :podcasts, :explicit, :string
+ execute "update podcasts set explicit = 'clean' where explicit_boolean is null or explicit_boolean = false"
+ execute "update podcasts set explicit = 'yes' where explicit_boolean = true"
+ remove_column :podcasts, :explicit_boolean
+ end
+
+ def down
+ rename_column :podcasts, :explicit, :explicit_string
+ add_column :podcasts, :explicit, :boolean
+ execute "update podcasts set explicit = false where explicit_string = 'clean'"
+ execute "update podcasts set explicit = true where explicit_string = 'yes'"
+ remove_column :podcasts, :explicit_string
+ end
+end
|
Change podcast explicit to a string not a boolean
|
diff --git a/modules/nagios/lib/facter/nagios_pci.rb b/modules/nagios/lib/facter/nagios_pci.rb
index abc1234..def5678 100644
--- a/modules/nagios/lib/facter/nagios_pci.rb
+++ b/modules/nagios/lib/facter/nagios_pci.rb
@@ -1,20 +1,22 @@ # Create nagios_pci_<modname> facts for these modules, if found
modnames = [ "megaraid", "megaraid_sas", "mptsas" ]
-File.open("/proc/bus/pci/devices") do |io|
- io.each do |line|
- line.chomp!
- # Search for lines ending with tab + module name
- modnames.each do |modname|
- if line.end_with? "\t" + modname
- # Create the fact for the found device
- Facter.add("nagios_pci_" + modname) do
- setcode do
- "true"
+if File.exist?("/proc/bus/pci/devices")
+ File.open("/proc/bus/pci/devices") do |io|
+ io.each do |line|
+ line.chomp!
+ # Search for lines ending with tab + module name
+ modnames.each do |modname|
+ if line.end_with? "\t" + modname
+ # Create the fact for the found device
+ Facter.add("nagios_pci_" + modname) do
+ setcode do
+ "true"
+ end
end
+ # Stop looking for it, to avoid useless duplicates
+ modnames.delete(modname)
end
- # Stop looking for it, to avoid useless duplicates
- modnames.delete(modname)
end
end
end
|
Fix warning on virtual machines with no PCI bus
|
diff --git a/subscriptionManager.rb b/subscriptionManager.rb
index abc1234..def5678 100644
--- a/subscriptionManager.rb
+++ b/subscriptionManager.rb
@@ -28,7 +28,8 @@ end
#Class that handles the mailing operations
-class Mailer
+class Mailer
+
@@sender
@@recipient
@@subject
@@ -44,9 +45,30 @@ FAILURE: "Unfortunately the payment method [post]method[/post] identified by [post]account[/post] was unsuccessful for [post]amount[/post] for your [post]interval[/post] payment. Please correct payment or contact our support at [post]supportEmail[/post]"
}
+ def sendMail(from, to, sub, msg)
+
+ #Build message
+ email = <<EMAIL_END
+ From: %s
+ To: %s
+ Subject: %s
+
+ %s
+EMAIL_END
+
+ # Insert message params
+ email = email % [from, to, sub, msg]
+
+ # Send it from our mail server
+
+ # Todo add authentication/security/TLS
+ Net::SMTP.start('localhost') do |smtp|
+ smtp.send_message email, from, to
+ end
+ end
end
+
class User
end
-
|
Add method to send email.
Requires a mailserver (postfix on localhost will work)
|
diff --git a/recipes/configure.rb b/recipes/configure.rb
index abc1234..def5678 100644
--- a/recipes/configure.rb
+++ b/recipes/configure.rb
@@ -5,3 +5,18 @@ variables :config => node['chef-grafana']['config']
notifies :restart, "service[grafana-server]"
end
+
+# Make data/log dirs if we changed them from the defaults
+directory node['chef-grafana']['config']['paths']['data'] do
+ owner "grafana"
+ group "grafana"
+ mode "0755"
+ recursive true
+end
+
+directory node['chef-grafana']['config']['paths']['logs'] do
+ owner "grafana"
+ group "grafana"
+ mode "0755"
+ recursive true
+end
|
Create data/log dirs if we change them from defaults
|
diff --git a/spec/support/matchers/gitaly_matchers.rb b/spec/support/matchers/gitaly_matchers.rb
index abc1234..def5678 100644
--- a/spec/support/matchers/gitaly_matchers.rb
+++ b/spec/support/matchers/gitaly_matchers.rb
@@ -9,6 +9,6 @@
RSpec::Matchers.define :gitaly_request_with_params do |params|
match do |actual|
- params.reduce(true) { |r, (key, val)| r && actual.send(key) == val }
+ params.reduce(true) { |r, (key, val)| r && actual[key.to_s] == val }
end
end
|
Fix order-dependent Gitaly specs failing
If `spec/tasks/gitlab/cleanup_rake_spec.rb` preceded any of the Gitaly
request specs, it would import the `cleanup.rake` and the global
function `limit`. For some reason, the Protobuf implementation would use
the global function instead of the getter method. For example:
```
def limit
puts "hi"
end
req = Gitaly::WikiGetAllPagesRequest.new
req.send(:limit)
hi
=> nil
```
To fix this problem, access the field value using the [] operator
instead.
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/64006
|
diff --git a/spec/traders_spec.rb b/spec/traders_spec.rb
index abc1234..def5678 100644
--- a/spec/traders_spec.rb
+++ b/spec/traders_spec.rb
@@ -7,7 +7,7 @@ trader.fetch
expect(trader.rates).not_to be_empty
- expect(trader.rates).to be == expected_rates(short_name)
+ expect(trader.rates).to eq(expected_rates(short_name))
end
end
|
Use `eq` instead of `be ==`
|
diff --git a/app/helpers/budget_investments_helper.rb b/app/helpers/budget_investments_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/budget_investments_helper.rb
+++ b/app/helpers/budget_investments_helper.rb
@@ -1,6 +1,8 @@ module BudgetInvestmentsHelper
def budget_investments_sorting_options
- Budget::Investment::SORTING_OPTIONS.map { |so| [t("admin.budget_investments.index.sort_by.#{so}"), so] }
+ Budget::Investment::SORTING_OPTIONS.map do |so|
+ [t("admin.budget_investments.index.sort_by.#{so}"), so]
+ end
end
def budget_investments_advanced_filters(params)
|
Fix line length at budget investments helper
|
diff --git a/app/models/solidus_easypost/estimator.rb b/app/models/solidus_easypost/estimator.rb
index abc1234..def5678 100644
--- a/app/models/solidus_easypost/estimator.rb
+++ b/app/models/solidus_easypost/estimator.rb
@@ -3,48 +3,38 @@ module SolidusEasypost
class Estimator
def shipping_rates(package, _frontend_only = true)
- shipment = package.easypost_shipment
- rates = shipment.rates.sort_by { |r| r.rate.to_i }
+ easypost_rates = package.easypost_shipment.rates.sort_by(&:rate)
- shipping_rates = []
+ shipping_rates = easypost_rates.map(&method(:build_shipping_rate)).compact
+ shipping_rates.min_by(&:cost)&.selected = true
- if rates.any?
- rates.each do |rate|
- spree_rate = ::Spree::ShippingRate.new(
- name: "#{rate.carrier} #{rate.service}",
- cost: rate.rate,
- easy_post_shipment_id: rate.shipment_id,
- easy_post_rate_id: rate.id,
- shipping_method: find_or_create_shipping_method(rate)
- )
-
- shipping_rates << spree_rate if spree_rate.shipping_method.available_to_users?
- end
-
- # Sets cheapest rate to be selected by default
- if shipping_rates.any?
- shipping_rates.min_by(&:cost).selected = true
- end
-
- shipping_rates
- else
- []
- end
+ shipping_rates
end
private
- # Cartons require shipping methods to be present, This will lookup a
- # Shipping method based on the admin(internal)_name. This is not user facing
- # and should not be changed in the admin.
- def find_or_create_shipping_method(rate)
- method_name = "#{rate.carrier} #{rate.service}"
- ::Spree::ShippingMethod.find_or_create_by(admin_name: method_name) do |r|
- r.name = method_name
- r.available_to_users = false
- r.code = rate.service
- r.calculator = ::Spree::Calculator::Shipping::FlatRate.create
- r.shipping_categories = [::Spree::ShippingCategory.first]
+ def build_shipping_rate(rate)
+ shipping_method = build_shipping_method(rate)
+ return unless shipping_method.available_to_users?
+
+ ::Spree::ShippingRate.new(
+ name: "#{rate.carrier} #{rate.service}",
+ cost: rate.rate,
+ easy_post_shipment_id: rate.shipment_id,
+ easy_post_rate_id: rate.id,
+ shipping_method: shipping_method,
+ )
+ end
+
+ def build_shipping_method(rate)
+ name = "#{rate.carrier} #{rate.service}"
+
+ ::Spree::ShippingMethod.find_or_create_by(admin_name: name) do |shipping_method|
+ shipping_method.name = name
+ shipping_method.available_to_users = false
+ shipping_method.code = rate.service
+ shipping_method.calculator = ::Spree::Calculator::Shipping::FlatRate.create
+ shipping_method.shipping_categories = [::Spree::ShippingCategory.first]
end
end
end
|
Split SolidusEasypost::Estimator logic into multiple methods
|
diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb
index abc1234..def5678 100644
--- a/spec/support/capybara.rb
+++ b/spec/support/capybara.rb
@@ -1,20 +1,30 @@ require 'capybara/poltergeist'
-# disable logger
-module NullPoltergeistLogger
- def self.puts(*)
+class ActionDispatch::IntegrationTest
+ # Make the Capybara DSL available in all integration tests
+ include Capybara::DSL
+
+ # disable logger
+ module NullPoltergeistLogger
+ def self.puts(*)
+ end
+ end
+
+ # Reset sessions and driver between tests
+ # Use super wherever this method is redefined in your individual test classes
+ def teardown
+ Capybara.reset_sessions!
+ end
+
+ # Driver setup to not fill output with logging
+ Capybara.register_driver :poltergeist do |app, options|
+ Capybara::Poltergeist::Driver.new(
+ app, options = { timeout: 180, phantomjs_logger: NullPoltergeistLogger })
+ end
+
+ Capybara.configure do |config|
+ config.javascript_driver = :poltergeist
+ config.server_port = 3000
+ config.default_max_wait_time = 15 # in seconds
end
end
-
-# Driver setup to not fill output with logging
-Capybara.register_driver :poltergeist do |app|
- Capybara::Poltergeist::Driver.new(
- app,
- phantomjs_logger: NullPoltergeistLogger)
-end
-
-Capybara.configure do |config|
- config.javascript_driver = :poltergeist
- config.server_port = 8881
- config.default_wait_time = 3 # in seconds
-end
|
Increase default waiting time and add timeout for poltergeist
|
diff --git a/spec/tic_tac_toe_spec.rb b/spec/tic_tac_toe_spec.rb
index abc1234..def5678 100644
--- a/spec/tic_tac_toe_spec.rb
+++ b/spec/tic_tac_toe_spec.rb
@@ -5,7 +5,7 @@ expect(TicTacToe::VERSION).not_to be nil
end
- it 'does something useful' do
- expect(false).to eq(true)
+ it 'has a game' do
+ game = TicTacToe::Game.new
end
end
|
Add a better failing test
|
diff --git a/spec/tic_tac_toe_spec.rb b/spec/tic_tac_toe_spec.rb
index abc1234..def5678 100644
--- a/spec/tic_tac_toe_spec.rb
+++ b/spec/tic_tac_toe_spec.rb
@@ -7,5 +7,6 @@
it 'has a game' do
game = TicTacToe::Game.new
+ expect(game).to be_an_instance_of TicTacToe::Game
end
end
|
Add an expectation of type
|
diff --git a/spec/toy/plugins_spec.rb b/spec/toy/plugins_spec.rb
index abc1234..def5678 100644
--- a/spec/toy/plugins_spec.rb
+++ b/spec/toy/plugins_spec.rb
@@ -9,12 +9,19 @@
describe ".plugin" do
before do
- class_methods_mod = Module.new { def foo; 'foo' end }
- instance_methods_mod = Module.new { def bar; 'bar' end }
+ @mod = Module.new {
+ extend ActiveSupport::Concern
- @mod = Module.new { extend ActiveSupport::Concern }
- @mod.const_set(:ClassMethods, class_methods_mod)
- @mod.const_set(:InstanceMethods, instance_methods_mod)
+ module ClassMethods
+ def foo
+ 'foo'
+ end
+ end
+
+ def bar
+ 'bar'
+ end
+ }
Toy.plugin(@mod)
end
|
Tweak plugin spec to not use InstanceMethods
|
diff --git a/spec/update/path_spec.rb b/spec/update/path_spec.rb
index abc1234..def5678 100644
--- a/spec/update/path_spec.rb
+++ b/spec/update/path_spec.rb
@@ -12,7 +12,7 @@ build_lib "activesupport", "3.0", :path => lib_path("rails/activesupport")
bundle "update --source activesupport"
- expect(out).to include("Using activesupport 3.0 (was 2.3.5) from source at #{lib_path("rails/activesupport")}")
+ expect(out).to include("Using activesupport 3.0 (was 2.3.5) from source at `#{lib_path("rails/activesupport")}`")
end
end
end
|
[Path] Update spec for wrapping path in backticks
|
diff --git a/lib/optimus_prime.rb b/lib/optimus_prime.rb
index abc1234..def5678 100644
--- a/lib/optimus_prime.rb
+++ b/lib/optimus_prime.rb
@@ -14,6 +14,7 @@ require 'optimus_prime/destinations/rdbms_writer'
require 'optimus_prime/sources/flurry_helpers/flurry_connector'
require 'optimus_prime/transformers/expand_json'
+require 'optimus_prime/sources/app_annie'
# Load all Sources and Destinations
Dir[File.dirname(__FILE__) + '/optimus_prime/**/*.rb'].each do |file|
|
Load AppAnnie source before loading AppAnnieProductSales source.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.