diff stringlengths 65 26.7k | message stringlengths 7 9.92k |
|---|---|
diff --git a/app/models/concerns/gobierto_common/acts_as_api_token.rb b/app/models/concerns/gobierto_common/acts_as_api_token.rb
index abc1234..def5678 100644
--- a/app/models/concerns/gobierto_common/acts_as_api_token.rb
+++ b/app/models/concerns/gobierto_common/acts_as_api_token.rb
@@ -19,5 +19,9 @@ end
end
+ def to_s
+ token
+ end
+
end
end
| Define to_s method in api tokens
|
diff --git a/epinfo.gemspec b/epinfo.gemspec
index abc1234..def5678 100644
--- a/epinfo.gemspec
+++ b/epinfo.gemspec
@@ -16,4 +16,5 @@ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.require_paths = ["lib"]
+ gem.add_dependency "epubinfo"
end
| Add a dependency of epubinfo in gemspec
|
diff --git a/app/models/jobs/states.rb b/app/models/jobs/states.rb
index abc1234..def5678 100644
--- a/app/models/jobs/states.rb
+++ b/app/models/jobs/states.rb
@@ -26,7 +26,9 @@
def add_state_change(attrs)
transaction do
- self.state_changes.create(attrs)
+ unless self.state_changes.find_by_state_and_created_at(attrs[:state], Time.now)
+ self.state_changes.create(attrs)
+ end
end
end
| Create a state change unless one occured at the same time with the same state
|
diff --git a/letter_opener_web.gemspec b/letter_opener_web.gemspec
index abc1234..def5678 100644
--- a/letter_opener_web.gemspec
+++ b/letter_opener_web.gemspec
@@ -11,6 +11,7 @@ gem.description = %q{Gives letter_opener an interface for browsing sent emails}
gem.summary = gem.description
gem.homepage = "https://github.com/fgrehm/letter_opener_web"
+ gem.license = 'MIT'
gem.files = `git ls-files`.split($/)
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
| Add license to gemspec (closes GH-16)
|
diff --git a/db/migrate/20151012154512_rename_east_of_england_area.rb b/db/migrate/20151012154512_rename_east_of_england_area.rb
index abc1234..def5678 100644
--- a/db/migrate/20151012154512_rename_east_of_england_area.rb
+++ b/db/migrate/20151012154512_rename_east_of_england_area.rb
@@ -0,0 +1,20 @@+class RenameEastOfEnglandArea < Mongoid::Migration
+ def self.up
+ # Editing of an edition with an Archived artefact is not allowed
+ Edition.skip_callback(:save, :before, :check_for_archived_artefact)
+
+ BusinessSupportEdition.where(areas: "east-of-england").each do |edition|
+ edition.areas = edition.areas.map { |area_slug|
+ area_slug == "east-of-england" ? "eastern" : area_slug
+ }
+
+ edition.save!(validate: false) # Published editions can't be edited.
+ end
+ end
+
+ def self.down
+ # This was a lossy migration. There were already plenty of
+ # BusinessSupportEditions with the area "eastern", which we now can't
+ # differentiate from our updated fields :)
+ end
+end
| Rename "east-of-england" area to "eastern"
Our MapIt doesn't recognise the "east-of-england" area, it has data for the
"eastern" area.
This migration updates those editions that don't already use the "eastern" area
to use it.
|
diff --git a/db/migrate/20140220031800_create_skr_locations.rb b/db/migrate/20140220031800_create_skr_locations.rb
index abc1234..def5678 100644
--- a/db/migrate/20140220031800_create_skr_locations.rb
+++ b/db/migrate/20140220031800_create_skr_locations.rb
@@ -12,6 +12,8 @@ default: Skr.config.default_branch_code,
null: false,
limit: 2
+ t.string "logo"
+ t.jsonb "options"
t.skr_track_modifications
end
| Add logo and options to locations
|
diff --git a/db/migrate/20151214011800_create_code_snippets.rb b/db/migrate/20151214011800_create_code_snippets.rb
index abc1234..def5678 100644
--- a/db/migrate/20151214011800_create_code_snippets.rb
+++ b/db/migrate/20151214011800_create_code_snippets.rb
@@ -2,6 +2,7 @@ def change
create_table :code_snippets do |t|
t.string :code_url
+ t.text :code_content
t.integer :collection_id
t.timestamps null: false
| Add code_content to code-snippet migration
|
diff --git a/examples/blink_led.rb b/examples/blink_led.rb
index abc1234..def5678 100644
--- a/examples/blink_led.rb
+++ b/examples/blink_led.rb
@@ -1,16 +1,18 @@ require 'bundler/setup'
require 'firmata'
-board = Firmata::Board.new('/dev/tty.usbmodemfa131')
+board = Firmata::Board.new('/dev/tty.usbmodemfd13131')
board.connect
+pin_number = 3
+
10.times do
- board.digital_write 13, Firmata::Board::HIGH
+ board.digital_write pin_number, Firmata::Board::HIGH
puts '+'
board.delay 0.5
- board.digital_write 13, Firmata::Board::LOW
+ board.digital_write pin_number, Firmata::Board::LOW
puts '-'
board.delay 0.5
end | Move example to pin 3.
|
diff --git a/Casks/appcode.rb b/Casks/appcode.rb
index abc1234..def5678 100644
--- a/Casks/appcode.rb
+++ b/Casks/appcode.rb
@@ -1,6 +1,6 @@ cask :v1 => 'appcode' do
- version '3.1.2'
- sha256 'ab3c261c02d183d9783ea79458ea2b3c4588c28e1e30e791c59f4fb20094b9c1'
+ version '3.1.3'
+ sha256 '36a7429ae57d7855a83b2d7d461c3ccf2d61b125249c532a254e6625746561c6'
url "http://download.jetbrains.com/objc/AppCode-#{version}.dmg"
name 'AppCode'
| Update AppCode to version 3.1.3
This commit updates the version number to 3.1.3 and the SHA.
|
diff --git a/Casks/trailer.rb b/Casks/trailer.rb
index abc1234..def5678 100644
--- a/Casks/trailer.rb
+++ b/Casks/trailer.rb
@@ -1,6 +1,6 @@ cask :v1 => 'trailer' do
- version '1.3.5'
- sha256 '906b13316d243c7791c1258f5b895a1528148808c9c3cc1e9dc7a36c50495ebe'
+ version '1.3.6'
+ sha256 'e42dabd6b7759fdd9a816f0c04c2eb6f7dd15c21de47048d8228f6bffd6dc41d'
url "https://ptsochantaris.github.io/trailer/trailer#{version.gsub('.','')}.zip"
appcast 'https://ptsochantaris.github.io/trailer/appcast.xml',
| Update Trailer to version 1.3.6
This commit updates the version and sha256 stanzas.
|
diff --git a/lib/diaspora/relayable.rb b/lib/diaspora/relayable.rb
index abc1234..def5678 100644
--- a/lib/diaspora/relayable.rb
+++ b/lib/diaspora/relayable.rb
@@ -36,7 +36,6 @@ end
end
- # @deprecated This is only needed for pre 0.6 pods
def sender_for_dispatch
parent.author.owner if parent.author.local?
end
| Send Relayables with parent author when the parent is local
Needed for diaspora/diaspora_federation#64
|
diff --git a/lib/iso_tex_2_utf8_tex.rb b/lib/iso_tex_2_utf8_tex.rb
index abc1234..def5678 100644
--- a/lib/iso_tex_2_utf8_tex.rb
+++ b/lib/iso_tex_2_utf8_tex.rb
@@ -25,7 +25,14 @@ end
def replace_tex_escapes(text)
- LaTeX.decode(text)
+ lines = text.split("\n").collect do |line|
+ if line.start_with? "\\"
+ then line
+ else
+ LaTeX.decode(line)
+ end
+ end
+ lines.join("\n")
end
end
| Exclude latex commands from latex Escaping
|
diff --git a/acceptance/tests/apply/fact_storage.rb b/acceptance/tests/apply/fact_storage.rb
index abc1234..def5678 100644
--- a/acceptance/tests/apply/fact_storage.rb
+++ b/acceptance/tests/apply/fact_storage.rb
@@ -1,33 +1,31 @@ require 'json'
test_name "facts should be available through facts terminus when using apply" do
-
- with_master_running_on master, "--autosign true", :preserve_ssl => true do
-
- create_remote_file(master, '/tmp/routes-apply.yaml', <<-EOS)
+ create_remote_file(master, '/tmp/routes-apply.yaml', <<-EOS)
apply:
facts:
terminus: facter
cache: puppetdb_apply
- EOS
+ EOS
- step "Run apply on host to populate database" do
- result = on(master, "FACTER_foo='testfoo' puppet apply --route_file /tmp/routes-apply.yaml -e 'notice($foo)'")
- assert_match(/testfoo/, result.output)
- end
+ step "Run apply on host to populate database" do
+ result = on(master, "FACTER_foo='testfoo' puppet apply --route_file /tmp/routes-apply.yaml -e 'notice($foo)'")
+ assert_match(/testfoo/, result.output)
+ end
- step "Run again to ensure we aren't using puppetdb for the answer" do
- result = on(master, "FACTER_foo='second test' puppet apply --route_file /tmp/routes-apply.yaml -e 'notice($foo)'")
- assert_match(/second test/, result.output)
- end
+ step "Run again to ensure we aren't using puppetdb for the answer" do
+ result = on(master, "FACTER_foo='second test' puppet apply --route_file /tmp/routes-apply.yaml -e 'notice($foo)'")
+ assert_match(/second test/, result.output)
+ end
- # Wait until all the commands have been processed
- sleep_until_queue_empty database
+ # Wait until all the commands have been processed
+ sleep_until_queue_empty database
- step "Run facts face to find facts for master" do
- result = on master, "puppet facts find #{master.node_name} --terminus puppetdb"
+ step "Run facts face to find facts for each node" do
+ hosts.each do |host|
+ result = on master, "puppet facts find #{host.node_name} --terminus puppetdb"
facts = JSON.parse(result.stdout.strip)
- assert_equal('second test', facts['values']['foo'], "Failed to retrieve facts for '#{master.node_name}' via inventory service!")
+ assert_equal('second test', facts['values']['foo'], "Failed to retrieve facts for '#{host.node_name}' via inventory service!")
end
end
end
| Remove need for starting master in apply test
Starting the master during the apply test was unnecessary. It may be that this
also causes an ordering issue on some platforms, that has been hard to
reproduce.
Signed-off-by: Ken Barber <470bc578162732ac7f9d387d34c4af4ca6e1b6f7@bob.sh>
|
diff --git a/GEOSwift.podspec b/GEOSwift.podspec
index abc1234..def5678 100644
--- a/GEOSwift.podspec
+++ b/GEOSwift.podspec
@@ -1,6 +1,6 @@ Pod::Spec.new do |s|
s.name = 'GEOSwift'
- s.version = '7.2.0'
+ s.version = '8.0.0'
s.swift_version = '5.1'
s.cocoapods_version = '>= 1.4.0'
s.summary = 'The Swift Geometry Engine.'
| Increment version number for CocoaPods
|
diff --git a/lib/ramom/mom/entity_builder.rb b/lib/ramom/mom/entity_builder.rb
index abc1234..def5678 100644
--- a/lib/ramom/mom/entity_builder.rb
+++ b/lib/ramom/mom/entity_builder.rb
@@ -38,7 +38,8 @@ end
def mapped_name(attr_name, mapper_name)
- attr_name.to_s.sub("#{::Mom.singularize(mapper_name)}_", EMPTY_STRING).to_sym
+ prefix = "#{::Mom.singularize(mapper_name)}_"
+ attr_name.to_s.sub(prefix, EMPTY_STRING).to_sym
end
end # EntityBuilder
end # Mom
| Introduce an lvar to enhance readability
|
diff --git a/lib/reddit/base/client.rb b/lib/reddit/base/client.rb
index abc1234..def5678 100644
--- a/lib/reddit/base/client.rb
+++ b/lib/reddit/base/client.rb
@@ -17,7 +17,7 @@ nocache = options.delete(:nocache)
response = connection.delete(url, **options)
- Mash.new response.body
+ mash response
end
def get(url, **options)
@@ -29,21 +29,29 @@ req.params = options
end
- Mash.new response.body
+ mash response
end
def post(url, **options)
nocache = options.delete(:nocache)
response = connection.post(url, **options)
- Mash.new response.body
+ mash response
end
def put(url, **options)
nocache = options.delete(:nocache)
response = connection.put(url, **options)
- Mash.new response.body
+ mash response
+ end
+
+ def mash(response)
+ if response.body.is_a? Array
+ response.body.map { |x| Mash.new x }
+ else
+ Mash.new response.body
+ end
end
end
end
| Fix for reddit's split listings on links.
|
diff --git a/app/controllers/problems_controller.rb b/app/controllers/problems_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/problems_controller.rb
+++ b/app/controllers/problems_controller.rb
@@ -21,7 +21,7 @@ @title = t :multiple_locations
render :choose_location_list
else
- # @locations = Stop.find_all_by_placename
+ @locations = Gazeteer.find(params[:problem][:location_attributes][:area])
@title = t :multiple_locations_area
render :choose_location_area
end
| Use the gazetteer to look up the area
|
diff --git a/lib/rom/memory/storage.rb b/lib/rom/memory/storage.rb
index abc1234..def5678 100644
--- a/lib/rom/memory/storage.rb
+++ b/lib/rom/memory/storage.rb
@@ -1,4 +1,9 @@-require 'thread_safe'
+begin
+ require 'thread_safe'
+rescue LoadError
+ raise LoadError, 'Please install the `thread_safe` gem.'
+end
+
require 'rom/memory/dataset'
module ROM
| Improve LoadError on missing thread_safe gem.
|
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
@@ -8,7 +8,7 @@ #Log the user in and redirect to the user's show page (for now)
# render new_user_path
else
- flash[:danger] = 'Invalid username/password combination'
+ flash.now[:danger] = 'Invalid username/password combination'
render 'new'
end
end
| Update flash error so it only appears once when the error occured, rather than a persisting message
|
diff --git a/app/controllers/versions_controller.rb b/app/controllers/versions_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/versions_controller.rb
+++ b/app/controllers/versions_controller.rb
@@ -1,4 +1,5 @@ class VersionsController < ApplicationController
+ before_action :authenticate_user!, only: [:rollback]
before_action :set_word, only: [:show, :rollback, :index, :destroy]
def rollback
| Add authenticate to versions controller
|
diff --git a/foodr-backend/app/controllers/users_controller.rb b/foodr-backend/app/controllers/users_controller.rb
index abc1234..def5678 100644
--- a/foodr-backend/app/controllers/users_controller.rb
+++ b/foodr-backend/app/controllers/users_controller.rb
@@ -1,11 +1,11 @@ class UsersController < ApplicationController
def show
user = User.find_by(id: params[:id])
- searches = user.products
- saved_product_ids = user.searches.where(is_saved: true).pluck(:product_id)
- saved_products = Product.find(saved_product_ids)
if user
+ searches = user.products
+ saved_product_ids = user.searches.where(is_saved: true).pluck(:product_id)
+ saved_products = Product.find(saved_product_ids)
render json: {
found: true,
user: user,
| Fix user show by moving subsquent calls on user only if user is found
|
diff --git a/lib/tasks/versionius.rake b/lib/tasks/versionius.rake
index abc1234..def5678 100644
--- a/lib/tasks/versionius.rake
+++ b/lib/tasks/versionius.rake
@@ -1,4 +1,7 @@ require 'versionius'
+require 'rake'
+
+include Rake::DSL if defined?(Rake::DSL)
namespace :versionius do
| Include rake dsl methods for rake tasks
|
diff --git a/lib/vagrant-ca-certificates/cap/redhat/helpers.rb b/lib/vagrant-ca-certificates/cap/redhat/helpers.rb
index abc1234..def5678 100644
--- a/lib/vagrant-ca-certificates/cap/redhat/helpers.rb
+++ b/lib/vagrant-ca-certificates/cap/redhat/helpers.rb
@@ -7,7 +7,7 @@ # bundles must be managed manually.
def self.legacy_certificate_bundle?(sh)
command = %q(R=$(sed -E "s/.* ([0-9])\.([0-9]+) .*/\\1.\\2/" /etc/redhat-release))
- sh.test(%Q(#{command} && [[ $R =~ ^5 || $R =~ ^6\.[0-4]+ ]]), shell: '/bin/bash') || !sh.test("rpm -q --verify --nomtime ca-certificates", shell:'/bin/bash')
+ sh.test(%Q(#{command} && [[ $R =~ ^5 || $R =~ ^6\.[0-4]+ ]]), shell: '/bin/bash') || !sh.test("rpm -q ca-certificates", shell:'/bin/bash')
end
end
end
| Make legacy check on RedHat idempotent
|
diff --git a/modules/icinga/spec/defines/pager_contact_spec.rb b/modules/icinga/spec/defines/pager_contact_spec.rb
index abc1234..def5678 100644
--- a/modules/icinga/spec/defines/pager_contact_spec.rb
+++ b/modules/icinga/spec/defines/pager_contact_spec.rb
@@ -3,11 +3,15 @@
describe 'icinga::pager_contact', :type => :define do
let(:title) { 'pager_nonworkhours' }
+ let(:params) {{
+ :pagerduty_apikey => '1234554321',
+ }}
it { should contain_file('/etc/icinga/conf.d/contact_pager_nonworkhours.cfg').
with_content(/command_name\s+notify-host-by-pagerduty/).
with_content(/command_line\s+\/usr\/local\/bin\/pagerduty_nagios.pl\senqueue\s-f\spd_nagios_object=host/).
with_content(/command_name\s+notify-service-by-pagerduty/).
- with_content(/command_line\s+\/usr\/local\/bin\/pagerduty_nagios.pl\senqueue\s-f\spd_nagios_object=service/).
- with_content(/service_notification_period\s+24x7/)
+ with_content(/command_line\s+\/usr\/local\/bin\/pagerduty_nagios.pl\senqueue\s-f\spd_nagios_object=service/).
+ with_content(/service_notification_period\s+24x7/).
+ with_content(/pager\s+1234554321/)
}
end
| Test for icinga::pager_contact api key
|
diff --git a/src/old.rb b/src/old.rb
index abc1234..def5678 100644
--- a/src/old.rb
+++ b/src/old.rb
@@ -12,6 +12,7 @@ opt.parse! ARGV
end
+article = ""
begin
item_no = ARGV[0]
subject = SCPArticleLoader.new(item_no, option)
@@ -24,14 +25,15 @@ builder.hr_width = `tput cols`.chomp.to_i
builder.name = subject.title
roff = builder.build
- puts roff
+ article = roff
rescue
- puts <<-"EOS"
+ article = <<-"EOS"
.TH "SCP-#{item_no}" 7 "#{Time.now.strftime("%Y-%m-%d")}" "SCP Foundation" "SCP Database"
.ce 1
[ACCESS DENIED]
.brp
EOS
+end
-end
+puts article
| Save article as variable before `puts`
To write the article into a file in manpath
|
diff --git a/spec/gc_spec.rb b/spec/gc_spec.rb
index abc1234..def5678 100644
--- a/spec/gc_spec.rb
+++ b/spec/gc_spec.rb
@@ -20,5 +20,14 @@ }.should.raise(RuntimeError)
end
+ it 'should accurately count Lua interpreter memory usage' do
+
+ @s = Rufus::Lua::State.new
+
+ before_usage = @s.gc_count
+ @s.eval("return table.concat({ 'hello', 'from', 'Lua' }, ' ')")
+ after_usage = @s.gc_count
+
+ after_usage.should.> before_usage
+ end
end
-
| Add a spec for GC count
|
diff --git a/spotify.gemspec b/spotify.gemspec
index abc1234..def5678 100644
--- a/spotify.gemspec
+++ b/spotify.gemspec
@@ -17,7 +17,7 @@ gem.version = Spotify::VERSION
gem.platform = Gem::Platform::RUBY
- gem.requirements << 'libspotify, v0.0.7'
+ gem.requirements << 'libspotify, v0.0.8'
gem.add_dependency 'ffi', '~> 1.0.0'
gem.add_development_dependency 'yard'
gem.add_development_dependency 'rbgccxml'
| Change from 0.0.7 to 0.0.8 in gem requirements
|
diff --git a/app/policies/defence_request_policy.rb b/app/policies/defence_request_policy.rb
index abc1234..def5678 100644
--- a/app/policies/defence_request_policy.rb
+++ b/app/policies/defence_request_policy.rb
@@ -13,7 +13,7 @@ elsif user.cco?
scope.all
elsif user.solicitor?
- []
+ scope.none
end
end
end
| Return a an empty relation for solicitor Drs
Because we are now calling an additional scope in
the controller we need to return a relation, as
the DefenceRequest scope methods do not exist on
Array. |
diff --git a/irc2hipchat.rb b/irc2hipchat.rb
index abc1234..def5678 100644
--- a/irc2hipchat.rb
+++ b/irc2hipchat.rb
@@ -17,7 +17,7 @@
# Only log channel messages
on :channel do |m|
- msg = "<b>#{m.user.nick}</b>: #{m.message}"
+ msg = "<em>#{m.user.nick}</em>: #{m.message}"
$hipchat_cli[$hc_room].send('irc2hipchat', msg, { :notify => true, :color => 'green', :message_format => 'html' })
end
end
| Use <em> instead of <b> since it's 2014.
|
diff --git a/bin/validate.rb b/bin/validate.rb
index abc1234..def5678 100644
--- a/bin/validate.rb
+++ b/bin/validate.rb
@@ -5,7 +5,7 @@ out = JSON::Validator.fully_validate(ARGV[0], ARGV[1])
iter=0
-out.each { |msg| puts "#{iter += 1}.\t#{msg}\n" }
+out.each { |msg| puts "\##{iter += 1}:\t#{msg}\n" }
out.count
| Align enumeration format with validator output.
|
diff --git a/svgeez.gemspec b/svgeez.gemspec
index abc1234..def5678 100644
--- a/svgeez.gemspec
+++ b/svgeez.gemspec
@@ -15,16 +15,19 @@ spec.homepage = 'https://github.com/jgarber623/svgeez'
spec.license = 'MIT'
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(bin|spec)/}) }
- end
+ spec.files = Dir['exe/**/*', 'lib/**/*'].reject { |f| File.directory?(f) }
+ spec.files += %w[LICENSE CHANGELOG.md CODE_OF_CONDUCT.md CONTRIBUTING.md README.md]
+ spec.files += %w[svgeez.gemspec]
spec.bindir = 'exe'
spec.executables = ['svgeez']
spec.require_paths = ['lib']
- spec.metadata['bug_tracker_uri'] = "#{spec.homepage}/issues"
- spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/v#{spec.version}/CHANGELOG.md"
+ spec.metadata = {
+ 'bug_tracker_uri' => "#{spec.homepage}/issues",
+ 'changelog_uri' => "#{spec.homepage}/blob/v#{spec.version}/CHANGELOG.md",
+ 'rubygems_mfa_required' => 'true'
+ }
spec.add_runtime_dependency 'listen', '~> 3.5'
spec.add_runtime_dependency 'mercenary', '~> 0.4.0'
| Update gemspec with RuboCop recommendations
|
diff --git a/ruboty.gemspec b/ruboty.gemspec
index abc1234..def5678 100644
--- a/ruboty.gemspec
+++ b/ruboty.gemspec
@@ -20,7 +20,7 @@ spec.add_dependency "bundler"
spec.add_dependency "dotenv"
spec.add_dependency "mem"
- spec.add_dependency "slop", ">= 4.0.0"
+ spec.add_dependency "slop"
spec.add_development_dependency "codeclimate-test-reporter", ">= 0.3.0"
spec.add_development_dependency "rake"
spec.add_development_dependency "rspec", "2.14.1"
| Revert "Use slop v4 or higher because some options couldn't work"
This reverts commit 399ad42a711431af134bb9e8e960a7aebb098367.
|
diff --git a/spec/models/stop_area_type_spec.rb b/spec/models/stop_area_type_spec.rb
index abc1234..def5678 100644
--- a/spec/models/stop_area_type_spec.rb
+++ b/spec/models/stop_area_type_spec.rb
@@ -29,7 +29,9 @@ fixtures default_fixtures
it 'should return conditions specifying a set of stop types for buses' do
- StopAreaType.conditions_for_transport_mode(1).should == ['area_type in (?)', [["GBCS", "GPBS", "GCLS"]]]
+ query_string, parameters = StopAreaType.conditions_for_transport_mode(1)
+ query_string.should == 'area_type in (?)'
+ parameters[0].to_set.should == ["GBCS", "GPBS", "GCLS"].to_set
end
it 'should return conditions specifying area type "GTMU" tram/metro stations (excluding the on-street area types)' do
| Fix a test where the order of the parameters is unimportant
|
diff --git a/spec/shipkit/fedex/request_spec.rb b/spec/shipkit/fedex/request_spec.rb
index abc1234..def5678 100644
--- a/spec/shipkit/fedex/request_spec.rb
+++ b/spec/shipkit/fedex/request_spec.rb
@@ -10,12 +10,14 @@
it "adds the key" do
key = Shipkit::Fedex.config.key
- expect(subject.search("UserCredential > Key").first.content).to eql(key)
+ selector = "/WebAuthenticationDetail/UserCredential/Key"
+ expect(subject.search(selector).first.text).to eql(key)
end
it "adds the password" do
password = Shipkit::Fedex.config.password
- expect(subject.search("UserCredential > Password").first.content).to eql(password)
+ selector = "/WebAuthenticationDetail/UserCredential/Password"
+ expect(subject.search(selector).first.text).to eql(password)
end
end
@@ -24,12 +26,14 @@
it "adds the account number" do
account_number = Shipkit::Fedex.config.account_number
- expect(subject.search("ClientDetail > AccountNumber").first.content).to eql(account_number)
+ selector = "/ClientDetail/AccountNumber"
+ expect(subject.search(selector).first.text).to eql(account_number)
end
it "adds the meter number" do
meter_number = Shipkit::Fedex.config.meter_number
- expect(subject.search("ClientDetail > MeterNumber").first.content).to eql(meter_number)
+ selector = "/ClientDetail/MeterNumber"
+ expect(subject.search(selector).first.text).to eql(meter_number)
end
end
end
| Use xpath instead of css selectors in request spec
|
diff --git a/gir_ffi-pango.gemspec b/gir_ffi-pango.gemspec
index abc1234..def5678 100644
--- a/gir_ffi-pango.gemspec
+++ b/gir_ffi-pango.gemspec
@@ -17,7 +17,7 @@ s.files = Dir['{lib,test}/**/*.rb', 'README.md', 'Rakefile', 'COPYING.LIB']
s.test_files = Dir['test/**/*.rb']
- s.add_runtime_dependency('gir_ffi', ['~> 0.13.0'])
+ s.add_runtime_dependency('gir_ffi', ['~> 0.14.0'])
s.add_development_dependency('minitest', ['~> 5.0'])
s.add_development_dependency('rake', ['~> 12.0'])
| Update gir_ffi to version 0.14.0 |
diff --git a/app/models/promo_registration.rb b/app/models/promo_registration.rb
index abc1234..def5678 100644
--- a/app/models/promo_registration.rb
+++ b/app/models/promo_registration.rb
@@ -2,7 +2,6 @@ has_paper_trail
belongs_to :channel, validate: true, autosave: true
- # belongs_to :publisher, polymorphic: true, validate: true, autosave: true
validates :channel_id, presence: true
| Remove commented `belongs_to` in PromoRegistration model
|
diff --git a/httmultiparty.gemspec b/httmultiparty.gemspec
index abc1234..def5678 100644
--- a/httmultiparty.gemspec
+++ b/httmultiparty.gemspec
@@ -13,7 +13,8 @@ s.homepage = "http://github.com/jwagener/httmultiparty"
s.summary = "HTTMultiParty is a thin wrapper around HTTParty to provide multipart uploads."
s.description = "HTTMultiParty is a thin wrapper around HTTParty to provide multipart uploads."
-
+ s.license = 'MIT'
+
s.required_rubygems_version = ">= 1.3.6"
s.add_dependency 'httparty', ">= 0.7.3"
@@ -24,4 +25,4 @@
s.files = Dir.glob("{lib}/**/*") + %w(README.md)
s.require_path = 'lib'
-end+end
| Add MIT license to gemspec
|
diff --git a/spec/math24_spec.rb b/spec/math24_spec.rb
index abc1234..def5678 100644
--- a/spec/math24_spec.rb
+++ b/spec/math24_spec.rb
@@ -19,4 +19,10 @@ math24.numbers = ["1", "1", "1", "1"]
expect(math24.solve).to eq("No solution found")
end
+
+ it "only accepts integers" do
+ math24 = Math24.new()
+ math24.numbers = ["1", "1", "1", "1.5"]
+ expect(math24.solve).to eq("Please only enter integers between 1 and 9")
+ end
end | Test checking for integers fails
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -8,7 +8,9 @@ end
# require spec support files and shared behavior
-Dir[File.expand_path('../shared/**/*.rb', __FILE__)].each { |file| require file }
+Dir[File.expand_path('../shared/**/*.rb', __FILE__)].each do |file|
+ require file
+end
RSpec.configure do |config|
end
| Change code formatting in spec helper
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,7 +1,5 @@ require "codeclimate-test-reporter"
CodeClimate::TestReporter.start
-
-WebMock.disable_net_connect!(:allow => "codeclimate.com")
ENV["RACK_ENV"] ||= 'test'
@@ -32,3 +30,5 @@ Support::Webmock.mock!
end
end
+
+WebMock.disable_net_connect!(:allow => "codeclimate.com")
| Call Webmock after requiring it
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,9 +1,11 @@ require 'simplecov'
+SimpleCov.start
+
require 'rspec'
ENV["RACK_ENV"] ||= 'test'
-require_relative '../lib/rainforest_auth'
+require_relative '../lib/rainforest/auth'
# Configure rspec
RSpec.configure do |config|
| Update folder names, enable coverage
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -18,6 +18,7 @@ require 'capybara/poltergeist'
Capybara.javascript_driver = :poltergeist
+Excon.defaults[:ssl_verify_peer] = false
Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f }
RSpec.configure do |config|
| Set Excon SSL Verification To False During Tests
No SSL Verification is required during the testing runs. Clients
however, should be running SSL on their store fronts.
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,5 +1,5 @@ require 'jekyll'
-require File.expand_path('../lib/jekyll-sitemap', __dir__)
+require File.expand_path('../lib/jekyll-sitemap', File.dirname(__FILE__))
Jekyll.logger.log_level = 5
| Use File.dirname(__FILE__) instead of __dir__ |
diff --git a/tests/tests.rb b/tests/tests.rb
index abc1234..def5678 100644
--- a/tests/tests.rb
+++ b/tests/tests.rb
@@ -1,15 +1,16 @@ #! /usr/bin/env ruby
# -*- coding: UTF-8 -*-
-
-require "coveralls"
-Coveralls.wear!
require "test/unit"
require "simplecov"
test_dir = File.expand_path(File.dirname(__FILE__))
-SimpleCov.formatter = Coveralls::SimpleCov::Formatter
+if ENV["TRAVIS"]
+ require "coveralls"
+ Coveralls.wear!
+ SimpleCov.formatter = Coveralls::SimpleCov::Formatter
+end
SimpleCov.start { add_filter "/tests/" }
require "yop"
| Send to coveralls only if run in Travis-CI environment
|
diff --git a/covenant.gemspec b/covenant.gemspec
index abc1234..def5678 100644
--- a/covenant.gemspec
+++ b/covenant.gemspec
@@ -15,4 +15,6 @@ s.platform = Gem::Platform::RUBY
s.require_paths = ['lib']
s.rubyforge_project = '[none]'
+
+ s.add_development_dependency 'rspec', '>= 2.11'
end
| Add rspec as a development dependency.
|
diff --git a/cruise_config.rb b/cruise_config.rb
index abc1234..def5678 100644
--- a/cruise_config.rb
+++ b/cruise_config.rb
@@ -1,5 +1,5 @@ Project.configure do |project|
project.email_notifier.emails = ['scott@butlerpress.com']
project.build_command = "./script/cruise_build.rb #{project.name}"
- project.triggered_by ChangeInLocalTrigger.new(project)
+ # project.triggered_by ChangeInLocalTrigger.new(project)
end
| Disable custom trigger we may not need
|
diff --git a/app/presenters/promotional_feature_presenter.rb b/app/presenters/promotional_feature_presenter.rb
index abc1234..def5678 100644
--- a/app/presenters/promotional_feature_presenter.rb
+++ b/app/presenters/promotional_feature_presenter.rb
@@ -3,7 +3,7 @@ decorates_association :promotional_feature_items, with: PromotionalFeatureItemPresenter
def width
- promotional_feature_items.inject(0) {|sum, item| sum + item.width }
+ promotional_feature_items.sum { |item| item.width }
end
def position
| Use ActiveSupport goodies where possible
|
diff --git a/backend/app/controllers/spree/admin/tax_rates_controller.rb b/backend/app/controllers/spree/admin/tax_rates_controller.rb
index abc1234..def5678 100644
--- a/backend/app/controllers/spree/admin/tax_rates_controller.rb
+++ b/backend/app/controllers/spree/admin/tax_rates_controller.rb
@@ -2,9 +2,6 @@ module Admin
class TaxRatesController < ResourceController
before_filter :load_data
-
- update.after :update_after
- create.after :create_after
private
| Remove callbacks to now-non-existant methods in TaxRatesController
|
diff --git a/app/controllers/abuse_report_statuses_controller.rb b/app/controllers/abuse_report_statuses_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/abuse_report_statuses_controller.rb
+++ b/app/controllers/abuse_report_statuses_controller.rb
@@ -3,7 +3,7 @@ class AbuseReportStatusesController < ApplicationController
before_action :verify_core, except: [:index, :show]
before_action :set_status, except: [:index, :create]
- before_action :verify_admin, only: [:edit, :update, :destroy]
+ before_action :verify_admin, only: destroy
def index
@statuses = AbuseReportStatus.all
| Allow all core to edit abuse reports - 2 |
diff --git a/app/controllers/api/v1/authentication_controller.rb b/app/controllers/api/v1/authentication_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/v1/authentication_controller.rb
+++ b/app/controllers/api/v1/authentication_controller.rb
@@ -5,7 +5,7 @@ skip_authorization
user = User.find_by(email: params[:user][:email])
if user && user.valid_password?(params[:user][:password])
- if params[:durable] == ENV['DURABLE_JWT_CODE']
+ if ENV['DURABLE_JWT_CODE'] && params[:durable] == ENV['DURABLE_JWT_CODE']
render json: {token: JsonWebToken.encode({sub: user.id}, duration: Rails.application.secrets.jwt_duration_long)}
elsif params[:durable]
render json: {errors: ['Invalid durable code']}, status: :bad_request
| Update Api::V1::AuthenticationController to handle instances where environment has no DURABLE_JWT_CODE defined.
|
diff --git a/stretch.gemspec b/stretch.gemspec
index abc1234..def5678 100644
--- a/stretch.gemspec
+++ b/stretch.gemspec
@@ -18,6 +18,9 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
+ spec.add_dependency "faraday", "~> 0.8.7"
+ spec.add_dependency "multi_json", "~> 1.7.2"
+
spec.add_development_dependency "bundler", "~> 1.3"
spec.add_development_dependency "minitest", "~> 4.0"
spec.add_development_dependency "rake"
| Add faraday and multi_json as dependencies
|
diff --git a/spec/views/booking_imports/edit.html.haml_spec.rb b/spec/views/booking_imports/edit.html.haml_spec.rb
index abc1234..def5678 100644
--- a/spec/views/booking_imports/edit.html.haml_spec.rb
+++ b/spec/views/booking_imports/edit.html.haml_spec.rb
@@ -10,8 +10,7 @@ it "renders the edit importer form" do
render
- # Run the generator again with the --webrat-matchers flag if you want to use webrat matchers
- assert_select "form", :action => booking_import_path(@booking_import), :method => "post" do
+ rendered.should have_selector("form", :action => booking_import_path(@booking_import), :method => "post") do |form|
end
end
end
| Use webrat matcher in booking_imports edit view spec.
|
diff --git a/app/controllers/api/v1/api_controller.rb b/app/controllers/api/v1/api_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/v1/api_controller.rb
+++ b/app/controllers/api/v1/api_controller.rb
@@ -22,7 +22,7 @@ render json: { online: true }
end
- def render_error(_exception)
+ def render_error(exception)
logger.error(exception) # Report to your error managment tool here
render json: { error: 'An error ocurred' }, status: 500 unless performed?
end
| Fix wrong parameter after add error logging
|
diff --git a/app/controllers/jmd/venues_controller.rb b/app/controllers/jmd/venues_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/jmd/venues_controller.rb
+++ b/app/controllers/jmd/venues_controller.rb
@@ -9,7 +9,7 @@ # @venue is fetched by CanCan
@contest_categories = @contest.contest_categories.includes(:category)
@performances = @contest.performances
- .includes(:predecessor, :participants, { contest_category: :category })
+ .includes(:predecessor, :participants, :pieces, { contest_category: :category })
.venueless_or_at_stage_venue(@venue.id)
.browsing_order
end
| Reduce n+1 queries in performance scheduler
|
diff --git a/app/models/pulitzer/free_form_section.rb b/app/models/pulitzer/free_form_section.rb
index abc1234..def5678 100644
--- a/app/models/pulitzer/free_form_section.rb
+++ b/app/models/pulitzer/free_form_section.rb
@@ -3,6 +3,10 @@ belongs_to :version
belongs_to :free_form_section_type
has_many :partials, -> { order :sort_order}
+
+ def partial(name)
+ self.partials.to_a.detect{|ffs| ffs.name == name}
+ end
def clone_me
clone_attrs = self.attributes.dup
@@ -14,7 +18,7 @@ cloned_partial = partial.clone_me
my_clone.partials << cloned_partial
end
- my_clone
+ my_clone
end
end
end
| Add partial method for free form section |
diff --git a/vendor/refinerycms/refinerycms.rb b/vendor/refinerycms/refinerycms.rb
index abc1234..def5678 100644
--- a/vendor/refinerycms/refinerycms.rb
+++ b/vendor/refinerycms/refinerycms.rb
@@ -1,9 +1,12 @@ require 'refinery'
-require 'core/lib/core'
-require 'dashboard/lib/dashboard'
-require 'images/lib/images'
-require 'pages/lib/pages'
-require 'resources/lib/resources'
-require 'settings/lib/settings'
-require 'authentication/lib/authentication'
+# Load all dependencies generically using the same name as the folder they're in.
+# This is the naming convention we'll have to stick to and it also happens
+# to be the standard naming convention.
+Dir[File.expand_path("../**", __FILE__).to_s].each do |dir|
+ if (dir = Pathname.new(dir)).directory?
+ if (require_file = dir.join('lib', "#{dir.split.last}.rb")).file?
+ require require_file
+ end
+ end
+end
| Load in the engines that we're using dynamically rather than writing out each one.
|
diff --git a/cookbooks/wt_heatmap/recipes/import.rb b/cookbooks/wt_heatmap/recipes/import.rb
index abc1234..def5678 100644
--- a/cookbooks/wt_heatmap/recipes/import.rb
+++ b/cookbooks/wt_heatmap/recipes/import.rb
@@ -3,7 +3,7 @@ directory "/home/hadoop/log-drop" do
owner "hadoop"
group "hadoop"
- mode "0744"
+ mode "0755"
end
# script to import data into hive
| Modify the permissions on the data-drop directory from 744 to 755 so Nagios can monitor this dir
Former-commit-id: 910ccd58f438cbe44b0810274147c3af6ca14931 [formerly a2686546cf21493051a82822218c4d7fe26098c8] [formerly 88b8bab7c78ce1e88dc6be6d0c2ae558c5868618 [formerly 5fa721e6c831163613cd04875db63f717f9ad755]]
Former-commit-id: f027e65f3b61269f86e8e8d160a192db0d46729b [formerly 585a737e7e82e5213d8575e80fbf7d907b982fe4]
Former-commit-id: 2263d737c34b6dba6a3df3d607fee4ba8749534a |
diff --git a/db/migrate/20091123175137_add_single_access_token.rb b/db/migrate/20091123175137_add_single_access_token.rb
index abc1234..def5678 100644
--- a/db/migrate/20091123175137_add_single_access_token.rb
+++ b/db/migrate/20091123175137_add_single_access_token.rb
@@ -0,0 +1,9 @@+class AddSingleAccessToken < ActiveRecord::Migration
+ def self.up
+ add_column :users, :single_access_token, :string
+ end
+
+ def self.down
+ drop_column :users, :single_access_token
+ end
+end
| Add sing_access_token field in users table.
|
diff --git a/app/controllers/api/v1/procedures_controller.rb b/app/controllers/api/v1/procedures_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/v1/procedures_controller.rb
+++ b/app/controllers/api/v1/procedures_controller.rb
@@ -1,16 +1,4 @@ class API::V1::ProceduresController < APIController
-
- swagger_controller :procedures, "Procédure API"
-
- swagger_api :show do
- summary "Récupérer les informations d'une procédure"
- param :path, :id, :integer, :required
- param :path, :token, :string, :required
- response :ok, "Success", :Procedure
- response :unauthorized
- response :not_found
- end
-
def show
@procedure = current_administrateur.procedures.find(params[:id]).decorate
| Fix test : desactivate swagger
|
diff --git a/db/migrate/20171028230429_create_median_function.rb b/db/migrate/20171028230429_create_median_function.rb
index abc1234..def5678 100644
--- a/db/migrate/20171028230429_create_median_function.rb
+++ b/db/migrate/20171028230429_create_median_function.rb
@@ -1,21 +1,6 @@ class CreateMedianFunction < ActiveRecord::Migration
def up
ActiveMedian.create_function
-
- say "Calculating lifespan of known finished plantings"
- Planting.where.not(planted_at: nil, finished_at: nil).each do |planting|
- planting.calculate_lifespan
- planting.save!
- if planting.crop.median_lifespan.present?
- say "#{planting.crop.name} median lifespan #{planting.crop.median_lifespan} days"
- end
- end
-
- say 'Calculating median lifespan of crops'
- # Crop.all.each do |crop|
- # crop.update_medians
- # say "#{crop.name} median lifespan #{crop.median_lifespan} days" if crop.median_lifespan.present?
- # end
end
def down
| Remove duplicate setting of medians in migration
|
diff --git a/chainer.gemspec b/chainer.gemspec
index abc1234..def5678 100644
--- a/chainer.gemspec
+++ b/chainer.gemspec
@@ -19,4 +19,5 @@ s.add_development_dependency 'rubocop-rspec', '~> 1.12'
s.add_development_dependency 'rspec', '~> 3.5'
s.add_development_dependency 'yard', '~> 0.9.8'
+ s.add_development_dependency 'pry', '~> 0.10.0'
end
| Add ;pry' as development dependency
|
diff --git a/chatrix.gemspec b/chatrix.gemspec
index abc1234..def5678 100644
--- a/chatrix.gemspec
+++ b/chatrix.gemspec
@@ -22,6 +22,8 @@ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ['lib']
+ spec.required_ruby_version = '>= 2.0.0'
+
spec.add_runtime_dependency 'httparty', '~> 0.13'
spec.add_runtime_dependency 'wisper', '~> 1.6'
| Add required Ruby version to gemspec
|
diff --git a/BHCDatabase/app/controllers/feedbacks_controller.rb b/BHCDatabase/app/controllers/feedbacks_controller.rb
index abc1234..def5678 100644
--- a/BHCDatabase/app/controllers/feedbacks_controller.rb
+++ b/BHCDatabase/app/controllers/feedbacks_controller.rb
@@ -8,16 +8,12 @@
def new
@feedback = Feedback.new
- @feedbacks = Feedback.all
@questions = Question.where(:visible => true)
- @user = User.find(@current_user)
@questions.count.times {@feedback.answers.build}
end
def create
@feedback = Feedback.new(feedback_params)
- @user = User.find(@current_user)
- @feedbacks = Feedback.all
@questions = Question.where(:visible => true)
if @feedback.save
flash[:success] = 'Created a new feedback!'
| Remove redunant code from feedback_controller.
|
diff --git a/Casks/tactor.rb b/Casks/tactor.rb
index abc1234..def5678 100644
--- a/Casks/tactor.rb
+++ b/Casks/tactor.rb
@@ -7,7 +7,7 @@ name 'Tactor'
appcast 'https://onflapp.appspot.com/tactor',
:sha256 => 'de6620c8fd971681e356f2c24280ae9d38d09b78cafd2f25593fe50a235fd997'
- homepage 'http://onflapp.wordpress.com/tactor/'
+ homepage 'https://onflapp.wordpress.com/tactor/'
license :unknown # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder
app 'Tactor.app'
| Fix homepage to use SSL in Tactor Cask
The HTTP URL is already getting redirected to HTTPS. Using the HTTPS URL directly
makes it more secure and saves a HTTP round-trip.
|
diff --git a/Casks/zotero.rb b/Casks/zotero.rb
index abc1234..def5678 100644
--- a/Casks/zotero.rb
+++ b/Casks/zotero.rb
@@ -4,7 +4,7 @@
url "https://download.zotero.org/standalone/#{version}/Zotero-#{version}.dmg"
name 'Zotero'
- homepage 'http://www.zotero.org/'
+ homepage 'https://www.zotero.org/'
license :affero
app 'Zotero.app'
| Fix homepage to use SSL in Zotero Cask
The HTTP URL is already getting redirected to HTTPS. Using the HTTPS URL directly
makes it more secure and saves a HTTP round-trip.
|
diff --git a/lib/cqp_query_context.rb b/lib/cqp_query_context.rb
index abc1234..def5678 100644
--- a/lib/cqp_query_context.rb
+++ b/lib/cqp_query_context.rb
@@ -25,7 +25,9 @@
# registry path as a string
# must be set for all CQP operations
- @registry = opts[:registry] || nil
+ @registry = opts[:registry] ||
+ (CQPQueryContext.const_defined?('DEFAULT_REGISTRY') && DEFAULT_REGISTRY)
+ Rails.logger.warn('WARNING: No registry specified!') unless @registry
@case_insensitive = opts[:case_insensitive] || nil
end
| Use CQPQueryContext::DEFAULT_REGISTRY if no registry specified in request
|
diff --git a/lib/generators/active_record/templates/migration.rb b/lib/generators/active_record/templates/migration.rb
index abc1234..def5678 100644
--- a/lib/generators/active_record/templates/migration.rb
+++ b/lib/generators/active_record/templates/migration.rb
@@ -1,12 +1,12 @@ class DeviseInvitableAddTo<%= table_name.camelize %> < ActiveRecord::Migration
def self.up
change_table :<%= table_name %> do |t|
- t.string :invitation_token, :limit => 60
- t.datetime :invitation_sent_at
- t.integer :invitation_limit
- t.integer :invited_by_id
- t.index :invitation_token # for invitable
- t.index :invited_by_id
+ t.string :invitation_token, :limit => 60
+ t.datetime :invitation_sent_at
+ t.integer :invitation_limit
+ t.references :invited_by, :polymorphic => true
+ t.index :invitation_token # for invitable
+ t.index :invited_by_id
end
# And allow null encrypted_password and password_salt:
@@ -17,9 +17,9 @@ end
def self.down
- remove_column :<%= table_name %>, :invited_by_id
- remove_column :<%= table_name %>, :invitation_limit
- remove_column :<%= table_name %>, :invitation_sent_at
- remove_column :<%= table_name %>, :invitation_token
+ change_table :<%= table_name %> do |t|
+ remove_references :invited_by, :polymorphic => true
+ remove :invitation_limit, :invitation_sent_at, :invitation_token
+ end
end
end
| Fix invited_by creation in generator
|
diff --git a/lib/github_api/scopes.rb b/lib/github_api/scopes.rb
index abc1234..def5678 100644
--- a/lib/github_api/scopes.rb
+++ b/lib/github_api/scopes.rb
@@ -9,8 +9,9 @@ # github = Github.new :oauth_token => 'token'
# github.scopes.all
#
- def list(params={})
- response = get_request("/user", params)
+ def list(*args)
+ arguments(args)
+ response = get_request("/user", arguments.params)
response.headers.oauth_scopes ? response.headers.oauth_scopes.split(',') : response
end
alias :all :list
| Change to use argument parser.
|
diff --git a/lib/http/timeout/null.rb b/lib/http/timeout/null.rb
index abc1234..def5678 100644
--- a/lib/http/timeout/null.rb
+++ b/lib/http/timeout/null.rb
@@ -20,27 +20,29 @@
# Starts a SSL connection on a socket
def connect_ssl
- socket.connect
+ @socket.connect
end
# Configures the SSL connection and starts the connection
def start_tls(host, ssl_socket_class, ssl_context)
@socket = ssl_socket_class.new(socket, ssl_context)
- socket.sync_close = true
+ @socket.sync_close = true if @socket.respond_to? :sync_close=
connect_ssl
- socket.post_connection_check(host) if ssl_context.verify_mode == OpenSSL::SSL::VERIFY_PEER
+ return unless ssl_context.verify_mode == OpenSSL::SSL::VERIFY_PEER
+
+ @socket.post_connection_check(host)
end
# Read from the socket
def readpartial(size)
- socket.readpartial(size)
+ @socket.readpartial(size)
end
# Write to the socket
def write(data)
- socket << data
+ @socket << data
end
alias_method :<<, :write
| Check if socket responds to sync_close=
|
diff --git a/lib/laziness/registry.rb b/lib/laziness/registry.rb
index abc1234..def5678 100644
--- a/lib/laziness/registry.rb
+++ b/lib/laziness/registry.rb
@@ -10,8 +10,8 @@ observers.clear
end
- def notify(topic)
- observers.select { |o| o.topic == topic }.map(&:execute)
+ def notify(topic, *args)
+ observers.select { |o| o.topic == topic }.map { |o| o.execute(*args) }
end
def register(topic=nil, observer=nil, func=:update, &blk)
| Allow arguments with the notify method
|
diff --git a/data_objects/tasks/spec.rake b/data_objects/tasks/spec.rake
index abc1234..def5678 100644
--- a/data_objects/tasks/spec.rake
+++ b/data_objects/tasks/spec.rake
@@ -1,11 +1,11 @@ require 'rspec/core/rake_task'
-RSpec::Core::RakeTask.new(:spec => [:clean, :compile]) do |spec|
+RSpec::Core::RakeTask.new(:spec) do |spec|
spec.pattern = './spec/**/*_spec.rb'
spec.skip_bundler = true
end
-RSpec::Core::RakeTask.new(:rcov => [:clean, :compile]) do |rcov|
+RSpec::Core::RakeTask.new(:rcov) do |rcov|
rcov.pattern = "./spec/**/*_spec.rb"
rcov.rcov = true
rcov.rcov_opts = File.read('spec/rcov.opts').split(/\s+/)
| [data_objects][ci] Fix regression from prev. commit
* Spec task for data_objects doesn't need compilation.
Signed-off-by: Alex Coles <60c6d277a8bd81de7fdde19201bf9c58a3df08f4@alexbcoles.com>
|
diff --git a/lib/dm-polymorphic.rb b/lib/dm-polymorphic.rb
index abc1234..def5678 100644
--- a/lib/dm-polymorphic.rb
+++ b/lib/dm-polymorphic.rb
@@ -20,7 +20,12 @@ if (self.#{name}_class.class == Class)
self.#{name}_class.get(self.#{name}_id)
else
- Kernel.const_get(self.#{name}_class.to_s).get(self.#{name}_id)
+ klass = Kernel.const_get(self.#{name}_class.to_s)
+ if klass.ancestors.include? DataMapper::Resource
+ klass.get(self.#{name}_id)
+ else
+ nil
+ end
end
end
| Fix for nil class value loading.
|
diff --git a/lib/two_factor_authentication/controllers/helpers.rb b/lib/two_factor_authentication/controllers/helpers.rb
index abc1234..def5678 100644
--- a/lib/two_factor_authentication/controllers/helpers.rb
+++ b/lib/two_factor_authentication/controllers/helpers.rb
@@ -20,9 +20,14 @@ end
def handle_failed_second_factor(scope)
- if request.format.present? and request.format.html?
- session["#{scope}_return_to"] = request.original_fullpath if request.get?
- redirect_to two_factor_authentication_path_for(scope)
+ if request.format.present?
+ if request.format.html?
+ session["#{scope}_return_to"] = request.original_fullpath if request.get?
+ redirect_to two_factor_authentication_path_for(scope)
+ elsif request.format.json?
+ session["#{scope}_return_to"] = root_path(format: :html)
+ render json: { redirect_to: two_factor_authentication_path_for(scope) }, status: :unauthorized
+ end
else
render nothing: true, status: :unauthorized
end
| Return JSON with 'redirect_to' when handle_failed_second_factor |
diff --git a/knife-cloudstack.gemspec b/knife-cloudstack.gemspec
index abc1234..def5678 100644
--- a/knife-cloudstack.gemspec
+++ b/knife-cloudstack.gemspec
@@ -1,7 +1,7 @@ Gem::Specification.new do |s|
s.name = %q{knife-cloudstack}
- s.version = "0.0.19"
- s.date = %q{2015-03-19}
+ s.version = "0.0.20"
+ s.date = %q{2015-04-24}
s.authors = ['Ryan Holmes', 'KC Braunschweig', 'John E. Vincent', 'Chirag Jog', 'Sander Botman']
s.email = ['rholmes@edmunds.com', 'kcbraunschweig@gmail.com', 'lusis.org+github.com@gmail.com', 'chirag.jog@me.com', 'sbotman@schubergphilis.com']
s.summary = %q{A knife plugin for the CloudStack API}
@@ -11,7 +11,7 @@ s.has_rdoc = false
s.extra_rdoc_files = ["README.rdoc", "CHANGES.rdoc", "LICENSE" ]
- s.add_dependency "chef", "~> 11.0"
+ s.add_dependency "chef", ">= 11.0.0"
s.add_dependency "knife-windows", ">= 0"
s.require_path = 'lib'
s.files = ["CHANGES.rdoc","README.rdoc", "LICENSE"] + Dir.glob("lib/**/*")
| Make plugin work with chef 12 |
diff --git a/spec/helpers/case_workers/claims_helper_spec.rb b/spec/helpers/case_workers/claims_helper_spec.rb
index abc1234..def5678 100644
--- a/spec/helpers/case_workers/claims_helper_spec.rb
+++ b/spec/helpers/case_workers/claims_helper_spec.rb
@@ -0,0 +1,50 @@+require 'rails_helper'
+
+describe CaseWorkers::ClaimsHelper do
+
+ # before(:each) do
+ # @case_worker = create :case_worker
+ # allow(helper).to receive(:current_user).and_return(@case_worker.user)
+ # end
+
+ describe '#current_claims_count' do
+ it 'returns a collection of claims in assessment_states for the current user' do
+ @case_worker = create :case_worker
+ allow(helper).to receive(:current_user).and_return(@case_worker.user)
+ assessment_claims = double('Current user claims under assessment', count: 22)
+ claims = double('Current user claims collection', caseworker_dashboard_under_assessment: assessment_claims)
+ expect(@case_worker.user).to receive(:claims).and_return(claims)
+
+ expect(helper.current_claims_count).to eq 22
+ end
+ end
+
+ describe '#completed_claims_count' do
+
+ context 'current user is admin' do
+ it 'gets the count for all claims' do
+ admin_case_worker = create :case_worker, :admin
+ allow(helper).to receive(:current_user).and_return(admin_case_worker.user)
+ completed_claims = double('Completed Claims', count: 34)
+ active_claims = double('Active claims', caseworker_dashboard_completed: completed_claims)
+ expect(Claim::BaseClaim).to receive(:active).and_return(active_claims)
+
+ expect(helper.completed_claims_count).to eq 34
+ end
+ end
+
+ context 'current user is not admin' do
+ it 'gets the count for current users claims' do
+ case_worker = create :case_worker
+ completed_claims = double('Completed Claims', count: 71)
+ user_claims = double('user claims', caseworker_dashboard_completed: completed_claims)
+
+ allow(helper).to receive(:current_user).and_return(case_worker.user)
+ allow(case_worker.user).to receive(:claims).and_return(user_claims)
+ expect(helper.completed_claims_count).to eq 71
+ end
+ end
+
+ end
+
+end
| Add specs for CaseWorker claims helper
|
diff --git a/config/deploy/production.rb b/config/deploy/production.rb
index abc1234..def5678 100644
--- a/config/deploy/production.rb
+++ b/config/deploy/production.rb
@@ -6,4 +6,4 @@ }
server '54.72.161.42', user: 'ubuntu', roles: %w{app}
-server '54.72.167.118', user: 'ubuntu', roles: %w{amqp}
+#server '54.72.167.118', user: 'ubuntu', roles: %w{amqp}
| Comment amqp server so as not to interfere on deploy
|
diff --git a/lib/mountebank/helper.rb b/lib/mountebank/helper.rb
index abc1234..def5678 100644
--- a/lib/mountebank/helper.rb
+++ b/lib/mountebank/helper.rb
@@ -2,6 +2,8 @@
module Mountebank
class Helper
+ # Convert Ruby Hash keys into symbols
+ # Source: https://gist.github.com/Integralist/9503099
def self.symbolize(obj)
return obj.reduce({}) do |memo, (k, v)|
memo.tap { |m| m[k.to_sym] = symbolize(v) }
| Add attribution for the symbolize keys method.
|
diff --git a/lib/scenic/definition.rb b/lib/scenic/definition.rb
index abc1234..def5678 100644
--- a/lib/scenic/definition.rb
+++ b/lib/scenic/definition.rb
@@ -8,7 +8,7 @@ def to_sql
File.read(full_path).tap do |content|
if content.empty?
- raise "Define view query in #{@path} before migrating."
+ raise "Define view query in #{path} before migrating."
end
end
end
| Remove errant instance variable reference
This commit removes an errant instance variable reference in favor of a method call in the same name. |
diff --git a/activestorage/test/dummy/config/application.rb b/activestorage/test/dummy/config/application.rb
index abc1234..def5678 100644
--- a/activestorage/test/dummy/config/application.rb
+++ b/activestorage/test/dummy/config/application.rb
@@ -19,7 +19,7 @@
module Dummy
class Application < Rails::Application
- config.load_defaults 5.1
+ config.load_defaults 5.2
config.active_storage.service = :local
end
| Load 5.2 defaults in ASt dummy app
|
diff --git a/EDColor.podspec b/EDColor.podspec
index abc1234..def5678 100644
--- a/EDColor.podspec
+++ b/EDColor.podspec
@@ -1,5 +1,5 @@ Pod::Spec.new do |s|
- s.name = "color"
+ s.name = "EDColor"
s.version = "0.0.2"
s.summary = "A collection of categories and utilities that extend UIColor."
s.homepage = "https://github.com/thisandagain/color"
| Fix naming issue in podspec |
diff --git a/lib/url_normalization.rb b/lib/url_normalization.rb
index abc1234..def5678 100644
--- a/lib/url_normalization.rb
+++ b/lib/url_normalization.rb
@@ -2,7 +2,7 @@ def normalize_url(field_name)
define_method "#{field_name}=" do |val|
val = "http://#{val}" if !val.blank? && !(val =~ /^http/)
- write_attribute(field_name, val)
+ super(val)
end
end
end
| Call super instead of write_attribute
|
diff --git a/config/initializers/paperclip.rb b/config/initializers/paperclip.rb
index abc1234..def5678 100644
--- a/config/initializers/paperclip.rb
+++ b/config/initializers/paperclip.rb
@@ -1,5 +1,13 @@+# frozen_string_literal: true
+
Paperclip::Attachment.default_options[:url] = ":s3_domain_url"
-Paperclip::Attachment.default_options[:path] = ":rails_root/public/system/:class/:attachment/:id_partition/:style/:filename"
+if Rails.env == "test"
+ Paperclip::Attachment.default_options[:path] =
+ ":rails_root/public/system/:class/:attachment/:id_partition/:style/:filename"
+else
+ Paperclip::Attachment.default_options[:path] =
+ "/:class/:attachment/:id_partition/:style/:filename"
+end
module Paperclip
class MediaTypeSpoofDetector
| Configure Paperclip path to use public/system in test env
|
diff --git a/lib/plugins/soundk.rb b/lib/plugins/soundk.rb
index abc1234..def5678 100644
--- a/lib/plugins/soundk.rb
+++ b/lib/plugins/soundk.rb
@@ -8,12 +8,12 @@ match /(help soundk)$/, method: :help, prefix: /^(\.)/
def execute(m)
- page = Nokogiri::HTML(open('http://www.arirang.co.kr/Radio/Radio_Announce.asp?PROG_CODE=RADR0147&MENU_CODE=101562&code=Be4'))
+ page = Nokogiri::HTML(open('http://www.arirang.co.kr/Radio/Radio_MessageBoard.asp?PROG_CODE=RADR0147&MENU_CODE=101865&code=Be6'))
lineup = []
- i = 1
- 2.times do
- lineup << page.css('td')[i].text unless page.css('td')[i].text[0].to_i == 0
- i += 4
+ i = 0
+ while i < page.css('tr.ntce td.subjt').size
+ lineup << page.css('tr.ntce td.subjt')[i].text unless page.css('tr.ntce td.subjt')[i].text[0].to_i == 0
+ i += 1
end
m.reply "[#{lineup.join('], [')}] 20:00 ~ 22:00KST"
end
| Change source url and modify script accordingly
|
diff --git a/lib/rack/xrevision.rb b/lib/rack/xrevision.rb
index abc1234..def5678 100644
--- a/lib/rack/xrevision.rb
+++ b/lib/rack/xrevision.rb
@@ -1,9 +1,10 @@ module Rack
class Xrevision
+ REVISION_FILE_NAME = 'REVISION'
def initialize(app, options={})
@app = app
- @app_path = options.delete(:app_path) || Dir.pwd
- @revision_file_name = options.delete(:file_name) || 'REVISION'
+ @app_path = options[:app_path] || Dir.pwd
+ @revision_file_name = options[:file_name] || REVISION_FILE_NAME
end
def call(env)
| Use constant to identify revision file name
|
diff --git a/lib/shield/helpers.rb b/lib/shield/helpers.rb
index abc1234..def5678 100644
--- a/lib/shield/helpers.rb
+++ b/lib/shield/helpers.rb
@@ -9,7 +9,7 @@
def authenticated(model)
@_authenticated ||= {}
- @_authenticated[model] ||= model[session[model.to_s]]
+ @_authenticated[model] ||= session[model.to_s] && model[session[model.to_s]]
end
def redirect_to_login
| Check for the existence of the id before calling Model::[].
|
diff --git a/lib/graphql/client/fragment_definition.rb b/lib/graphql/client/fragment_definition.rb
index abc1234..def5678 100644
--- a/lib/graphql/client/fragment_definition.rb
+++ b/lib/graphql/client/fragment_definition.rb
@@ -9,7 +9,7 @@ class FragmentDefinition < Definition
def new(obj, *args)
if obj.is_a?(Hash)
- GraphQL::Client::Deprecation.warn("constructing fragment wrapper from Hash is deprecated")
+ raise TypeError, "constructing fragment wrapper from Hash is deprecated"
end
super
| Raise error when fragment definitions are used with hashes
|
diff --git a/lib/html_mockup/release/finalizers/dir.rb b/lib/html_mockup/release/finalizers/dir.rb
index abc1234..def5678 100644
--- a/lib/html_mockup/release/finalizers/dir.rb
+++ b/lib/html_mockup/release/finalizers/dir.rb
@@ -1,10 +1,11 @@ require 'fileutils'
-# Finalizes the release into a directory in target_path
-#
-# The directory name will have the format PREFIX-VERSION
-#
module HtmlMockup::Release::Finalizers
+
+ # Finalizes the release into a directory in target_path
+ #
+ # The directory name will have the format PREFIX-VERSION
+ #
class Dir < Base
# @option options :prefix Prefix to put before the version (default = "html")
def call(release, options = {})
| Move documentation to the class instead of module |
diff --git a/lib/super_settings.rb b/lib/super_settings.rb
index abc1234..def5678 100644
--- a/lib/super_settings.rb
+++ b/lib/super_settings.rb
@@ -1,7 +1,5 @@-current_directory = File.dirname(__FILE__)
-
-%w(/super_settings/*.rb /super_settings/feature_set_parsers/*.rb).each do |dir|
- Dir[current_directory + dir].each { |file| require file }
+Dir["#{File.dirname(__FILE__)}/super_settings/**/*.rb"].each do |file|
+ require(file)
end
# This is the main SuperSettings module.
| Load all ruby files automatically
|
diff --git a/lib/travis/addons/pusher/event_handler.rb b/lib/travis/addons/pusher/event_handler.rb
index abc1234..def5678 100644
--- a/lib/travis/addons/pusher/event_handler.rb
+++ b/lib/travis/addons/pusher/event_handler.rb
@@ -42,6 +42,14 @@ end
end
+ def repository_id
+ if payload && payload['repository'] && payload['repository']['id']
+ payload['repository']['id']
+ elsif object && object.repository && object.repository.id
+ object.repository.id
+ end
+ end
+
Instruments::EventHandler.attach_to(self)
end
end
| Use object for repo id if payload is not available in pusher handler
For some reason payload is not always available in pusher event handler.
We will now fallback to object.repository.id if that's the case.
|
diff --git a/lib/conway/ascii_life.rb b/lib/conway/ascii_life.rb
index abc1234..def5678 100644
--- a/lib/conway/ascii_life.rb
+++ b/lib/conway/ascii_life.rb
@@ -0,0 +1,51 @@+require "conway"
+
+Signal.trap("TERM") do
+ puts "Exiting..."
+ exit
+end
+
+Signal.trap("INT") do
+ puts "Exiting..."
+ exit
+end
+
+START = Time.now
+MAX_X = 30
+MAX_Y = 30
+
+points = [Point.new(1,4),
+ Point.new(3,3),
+ Point.new(4,3),
+ Point.new(4,4),
+ Point.new(6,4),
+ Point.new(7,4)]
+
+generation = Generation.new(points)
+
+begin
+ new_points = generation.cell_coordinates
+ #max_x = new_points.collect {|p| p.x}.max
+ #max_y = new_points.collect {|p| p.y}.max
+
+ grid = ""
+ (1..MAX_Y).each do |y|
+ (1..MAX_X).each do |x|
+ char = new_points.detect {|p| p == Point.new(x, y)} ? "X" : " "
+ grid << "|#{char}"
+ end
+ grid << "|\n"
+ end
+
+ puts grid
+
+ object_stats = "Total objects: #{ObjectSpace.count_objects[:TOTAL]} "
+ object_stats << "Total LiveCells: #{new_points.count}"
+ puts object_stats
+
+ elapsed_minutes, elapsed_seconds = ((Time.now - START).to_i).divmod 60
+ puts "Elapsed time: #{elapsed_minutes} min, #{elapsed_seconds} secs"
+
+ puts ''
+ sleep(0.25)
+end while(generation = generation.next)
| Add silly ASCII test interface
|
diff --git a/lib/crepe/application.rb b/lib/crepe/application.rb
index abc1234..def5678 100644
--- a/lib/crepe/application.rb
+++ b/lib/crepe/application.rb
@@ -8,12 +8,7 @@
def initialize
@config = Configuration.new
-
- # Support multiple Crepe applications like Rails, but by default set
- # Crepe.application to be the first application initialized.
- Crepe.application ||= self
-
- @app = Class.new(Crepe::API)
+ @app = Class.new(Crepe::API)
end
def configure(&block)
| Fix circular reference to Crepe::Application
Signed-off-by: David Celis <b1c1d8736f20db3fb6c1c66bb1455ed43909f0d8@davidcel.is>
|
diff --git a/require_callbacks.gemspec b/require_callbacks.gemspec
index abc1234..def5678 100644
--- a/require_callbacks.gemspec
+++ b/require_callbacks.gemspec
@@ -8,8 +8,17 @@ spec.version = RequireCallbacks::VERSION
spec.authors = ['smudge']
spec.email = ['nathan@ngriffith.com']
- spec.summary = %w(TODO: Write a short summary. Required.)
- spec.description = %w(TODO: Write a longer description. Optional.)
+ spec.summary = <<-END.gsub("\n", ' ').gsub!(/[[:space:]]+/, ' ').strip
+ Convenient hooks to help prevent loading unnecessary gems and
+ configuration code.
+ END
+ spec.description = <<-END.gsub("\n", ' ').gsub!(/[[:space:]]+/, ' ').strip
+ This gem gives you convenient hooks around calls to `load`, `require`, and
+ `require_relative`, which can be used to define configuration or setup code
+ that will eventually be run when the library is actually loaded. This helps
+ prevent loading unnecessary gems and configuration code in contexts where
+ they are not needed.
+ END
spec.homepage = ''
spec.license = 'MIT'
| Copy gem summary over from README
|
diff --git a/test/cookbooks/test/recipes/helloworld_example.rb b/test/cookbooks/test/recipes/helloworld_example.rb
index abc1234..def5678 100644
--- a/test/cookbooks/test/recipes/helloworld_example.rb
+++ b/test/cookbooks/test/recipes/helloworld_example.rb
@@ -12,6 +12,7 @@ owner 'root'
group 'root'
mode '0644'
+ notifies :restart, 'tomcat_service[helloworld]'
end
remote_file '/opt/tomcat_helloworld/webapps/sample.war' do
| Add a restart on config change to the test cookbook
|
diff --git a/lib/gunit/test_runner.rb b/lib/gunit/test_runner.rb
index abc1234..def5678 100644
--- a/lib/gunit/test_runner.rb
+++ b/lib/gunit/test_runner.rb
@@ -25,7 +25,7 @@ end
def tests
- @tests || []
+ @tests ||= []
end
def run
| Fix bug with TestRunner tests()
|
diff --git a/lib/makefolio/helpers.rb b/lib/makefolio/helpers.rb
index abc1234..def5678 100644
--- a/lib/makefolio/helpers.rb
+++ b/lib/makefolio/helpers.rb
@@ -3,7 +3,7 @@ module Makefolio
class Helpers
# selects the text between '---' lines
- @@front_matter_pattern = /[\n]*[-]{3}[\n]([\s\S]*)[\n]*[-]{3}[\n]/
+ FRONT_MATTER_PATTERN = /[\n]*[-]{3}[\n]([\s\S]*)[\n]*[-]{3}[\n]/
def self.parse_front_matter(content)
match = content.match(@@front_matter_pattern)
@@ -16,11 +16,11 @@ end
def self.strip_front_matter(content)
- content.gsub(@@front_matter_pattern, '').strip
+ content.gsub(FRONT_MATTER_PATTERN, '').strip
end
def self.large_image_filename(filename)
File.basename(filename, '.*') + '-lg' + File.extname(filename)
end
end
-end+end
| Change class variable to constant
|
diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/polls_controller.rb
+++ b/app/controllers/polls_controller.rb
@@ -19,8 +19,7 @@
def show
@questions = @poll.questions.for_render.sort_for_list
- @commentable = @poll
- @comment_tree = CommentTree.new(@commentable, params[:page], @current_order)
+ @comment_tree = CommentTree.new(@poll, params[:page], @current_order)
end
def stats
| Remove instance variable as it is not used
|
diff --git a/lib/number_recognizer.rb b/lib/number_recognizer.rb
index abc1234..def5678 100644
--- a/lib/number_recognizer.rb
+++ b/lib/number_recognizer.rb
@@ -14,10 +14,7 @@ end
def valid?
- if match = KNOWN_FORMATS.find {|name, pattern| number =~ /^0{0,2}#{pattern.first}\d{#{pattern.last},#{pattern.last}}$/}
- match
- else
- false
- end
+ return false unless match = KNOWN_FORMATS.find {|name, pattern| number =~ /^0{0,2}#{pattern.first}\d{#{pattern.last},#{pattern.last}}$/}
+ match
end
end | Use a guard clause to shorten the method
|
diff --git a/lib/sales_tax/receipt.rb b/lib/sales_tax/receipt.rb
index abc1234..def5678 100644
--- a/lib/sales_tax/receipt.rb
+++ b/lib/sales_tax/receipt.rb
@@ -13,8 +13,8 @@ total = BigDecimal('0')
sales_taxes_total = BigDecimal('0')
items.each do |item|
- total += item[:total_unit_price]
- sales_taxes_total += item[:unit_sales_tax]
+ total += BigDecimal(item[:total_unit_price])
+ sales_taxes_total += BigDecimal(item[:unit_sales_tax])
_print << print_item(item)
end
_print << "\n"
@@ -28,26 +28,22 @@ attr_accessor :items
def print_total(bd)
- total = format_bd_to_price_string(bd)
+ total = format_to_money_string(bd.to_s('F'))
"Total: #{total}\n"
end
def print_sales_taxes_total(bd)
- total = format_bd_to_price_string(bd)
+ total = format_to_money_string(bd.to_s('F'))
"Sales Taxes: #{total}\n"
end
def print_item(item)
- taxed_price_str = format_bd_to_price_string(item[:total_unit_price])
+ taxed_price_str = format_to_money_string(item[:total_unit_price])
"#{item[:quantity]}, #{item[:description]}, #{taxed_price_str}\n"
end
- def format_bd_to_price_string(bd)
- sprintf("%.2f", bd_to_float_str(bd))
- end
-
- def bd_to_float_str(bd)
- bd.to_s('F')
+ def format_to_money_string(str)
+ sprintf("%.2f", str)
end
end
end
| Update Receipt class to deal with money strings.
Since the Taxable role interface changed, and this class
depends upon it, it has been updated to reflect this.
|
diff --git a/lib/sms_sender_tester.rb b/lib/sms_sender_tester.rb
index abc1234..def5678 100644
--- a/lib/sms_sender_tester.rb
+++ b/lib/sms_sender_tester.rb
@@ -1,6 +1,6 @@ module SmsSenderTester
def self.send_sms(credentials, mobile_number, message, sender, options = nil)
- debug('SmsSenderTester::send_sms method. ' +
+ Rails.logger.debug('SmsSenderTester::send_sms method. ' +
'Credentials: ' + credentials.to_s +
'Mobile number: ' + mobile_number.to_s +
'Message: ' + message +
@@ -10,13 +10,13 @@ end
def self.get_balance(credentials)
- debug('SmsSenderTester::get_balance method. ' +
+ Rails.logger.debug('SmsSenderTester::get_balance method. ' +
'Credentials: ' + credentials.to_s
)
end
def self.query_message(credentials, msgid)
- debug('SmsSenderTester::query_message method. ' +
+ Rails.logger.debug('SmsSenderTester::query_message method. ' +
'Credentials: ' + credentials.to_s +
'Message id: ' + msgid.to_s
)
| Use rails logger for debug
|
diff --git a/lib/tasks/skip_prod.rake b/lib/tasks/skip_prod.rake
index abc1234..def5678 100644
--- a/lib/tasks/skip_prod.rake
+++ b/lib/tasks/skip_prod.rake
@@ -4,8 +4,8 @@ desc 'Raises exception if used in production'
task skip_prod: [:environment] do
if Rails.env.production?
- puts "Are you sure you want to run this on production? (Yes to confirm)"
- response = gets.chomp
+ puts "Are you sure you want to run this on production? (Yes to confirm): "
+ response = STDIN.gets.chomp
raise 'You chose not to run this in production' unless response == 'Yes'
end
| fix: Correct request in skip prod to use STDIN
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.