diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/config/mapping.rb b/config/mapping.rb
index abc1234..def5678 100644
--- a/config/mapping.rb
+++ b/config/mapping.rb
@@ -19,7 +19,9 @@ 1 => "gmontard",
5 => "petrachi",
20 => "jennyfer",
- 19 => "Oliv75"
+ 19 => "Oliv75",
+ 45 => "djtal",
+ 46 => "freiden"
}
end
|
Update Mapping for Charles && GuillaumeG
|
diff --git a/config/unicorn.rb b/config/unicorn.rb
index abc1234..def5678 100644
--- a/config/unicorn.rb
+++ b/config/unicorn.rb
@@ -1,3 +1,3 @@ worker_processes Integer(ENV["WEB_CONCURRENCY"] || 3)
-timeout 15
+timeout 60
preload_app true
|
Increase Unicorn timeout -- many requests are able to complete in the
original time
|
diff --git a/lib/uwdc/mets.rb b/lib/uwdc/mets.rb
index abc1234..def5678 100644
--- a/lib/uwdc/mets.rb
+++ b/lib/uwdc/mets.rb
@@ -17,37 +17,35 @@ end
end
- def xml
- get
- end
+ alias :nodes :get
def to_json
- Hash.from_xml(xml.to_xml).to_json
+ Hash.from_xml(nodes.to_xml).to_json
end
def to_ruby
- Hash.from_xml(xml.to_xml)
+ Hash.from_xml(nodes.to_xml)
end
def to_xml
- xml.to_xml
+ nodes.to_xml
end
end
class Mods < Mets
- def xml
+ def nodes
get.xpath("//dmdSec[contains(@ID,'#{@id}')]//mods[1]")
end
end
class Origin < Mets
- def xml
+ def nodes
get.xpath("//amdSec[contains(@ID,'#{@id}')]//origin[1]")
end
end
class RelsExt < Mets
- def xml
+ def nodes
get.xpath("//amdSec[contains(@ID,'#{@id}')]//RDF[1]")
end
end
|
Improve variable name, nodes shall be nodes not xml
|
diff --git a/lingohub.gemspec b/lingohub.gemspec
index abc1234..def5678 100644
--- a/lingohub.gemspec
+++ b/lingohub.gemspec
@@ -1,23 +1,23 @@ # -*- encoding: utf-8 -*-
-require File.expand_path("../lib/lingohub/version", __FILE__)
+require File.expand_path('../lib/lingohub/version', __FILE__)
Gem::Specification.new do |gem|
- gem.name = 'lingohub'
- gem.version = Lingohub::VERSION
- gem.authors = [ 'lingohub GmbH' ]
- gem.email = [ 'team@lingohub.com' ]
- gem.description = 'Client library and command-line tool to translate Ruby based apps with lingohub.'
- gem.summary = gem.description
- gem.homepage = 'https://lingohub.com'
- gem.executables = 'lingohub'
+ gem.name = 'lingohub'
+ gem.version = Lingohub::VERSION
+ gem.authors = ['lingohub GmbH']
+ gem.email = ['team@lingohub.com']
+ gem.description = 'Client library and command-line tool to translate Ruby based apps with lingohub.'
+ gem.summary = gem.description
+ gem.homepage = 'https://lingohub.com'
+ gem.executables = 'lingohub'
gem.require_paths = %w[lib]
- gem.files = Dir['{lib}/**/*.rb', 'bin/*', 'LICENSE', '*.md']
+ gem.files = Dir['{lib}/**/*.rb', 'bin/*', 'LICENSE', '*.md']
- gem.add_dependency('rest-client', '~> 1.6.7')
- gem.add_dependency('launchy', '~> 2.0.5')
- gem.add_dependency('stringex', '~> 1.3.2')
+ gem.add_dependency('rest-client', '2.0.2')
+ gem.add_dependency('launchy', '2.4.3')
+ gem.add_dependency('stringex', '2.7.1')
# gem.add_development_dependency('rake', '~> 0.9.2')
# gem.add_development_dependency('rspec', '~> 2.8.0')
|
Update gem dependencies to newest version.
|
diff --git a/test/git/duo/repo_test.rb b/test/git/duo/repo_test.rb
index abc1234..def5678 100644
--- a/test/git/duo/repo_test.rb
+++ b/test/git/duo/repo_test.rb
@@ -3,28 +3,25 @@ module Git::Duo
class RepoTest < MiniTest::Test
def setup
- @repo = Repo.new '~/code/mynewsdesk'
+ @repo = Repo.new '~/code/mynewsdesk', wrapper
end
attr_reader :repo
+
+ def wrapper
+ @wrapper ||= Minitest::Mock.new.
+ expect(:config, alfred_and_bruce, ['--get-regexp git-duo'])
+ end
def test_initialize_expands_directory_path
assert_equal repo.directory, File.join(ENV['HOME'], 'code', 'mynewsdesk')
end
def test_authors_returns_user_objects
- wrapper = Minitest::Mock.new
- wrapper.expect(:config, alfred_and_bruce, ['--get-regexp git-duo'])
- repo = Repo.new('~/code/mynewsdesk', wrapper)
-
assert_instance_of User, repo.authors.sample
assert wrapper.verify
end
def test_email_returns_set_group_email
- wrapper = Minitest::Mock.new
- wrapper.expect(:config, git_config, ['--get-regexp git-duo'])
- repo = Repo.new('~/code/mynewsdesk', wrapper)
-
assert_equal "batman+%names@gotham.travel", repo.email
assert wrapper.verify
end
|
Move mock logic to method to DRY up test
|
diff --git a/spec/buildr/bnd/project_extension_spec.rb b/spec/buildr/bnd/project_extension_spec.rb
index abc1234..def5678 100644
--- a/spec/buildr/bnd/project_extension_spec.rb
+++ b/spec/buildr/bnd/project_extension_spec.rb
@@ -0,0 +1,11 @@+require File.expand_path('../../../spec_helper', __FILE__)
+
+describe "project extension" do
+ it "provides an 'bnd:print' task" do
+ Rake::Task.tasks.detect{|task| task.to_s == "bnd:print"}.should_not be_nil
+ end
+
+ it "documents the 'bnd:print' task" do
+ Rake::Task.tasks.detect{|task| task.to_s == "bnd:print"}.comment.should_not be_nil
+ end
+end
|
Add start of specs for extension
|
diff --git a/homebrew/chgems.rb b/homebrew/chgems.rb
index abc1234..def5678 100644
--- a/homebrew/chgems.rb
+++ b/homebrew/chgems.rb
@@ -4,7 +4,7 @@
url 'https://github.com/downloads/postmodern/chgems/chgems-0.2.4.tar.gz'
homepage 'https://github.com/postmodern/chgems#readme'
- md5 '51fd2c6021d95495d41f3a2c4594ccc3'
+ sha1 '12346202c21f0b0ecb91cb9f74abd10ab3fc5384'
head 'https://github.com/postmodern/chgems.git'
def install
|
Use sha1 instead of md5 (deprecated).
|
diff --git a/test/zohoprojects_test.rb b/test/zohoprojects_test.rb
index abc1234..def5678 100644
--- a/test/zohoprojects_test.rb
+++ b/test/zohoprojects_test.rb
@@ -0,0 +1,32 @@+require File.expand_path('../helper', __FILE__)
+
+class ZohoProjectsTest < Service::TestCase
+
+ def setup
+ @stubs = Faraday::Adapter::Test::Stubs.new
+ end
+
+ def data
+ {
+ "project_id" => "1234",
+ "token" => "a13d",
+ }
+ end
+
+ def test_push
+ url = "/serviceHook"
+ @stubs.post url do |env|
+ assert_match /(^|\&)pId=1234($|\&)/, env[:body]
+ assert_match /(^|\&)authtoken=a13d($|\&)/, env[:body]
+ [200, {}, '']
+ end
+
+ svc = service :push, data , payload
+ svc.receive
+ end
+
+ def service(*args)
+ super Service::ZohoProjects, *args
+ end
+end
+
|
Test script for integration with ZohoProjects
|
diff --git a/spec/unit/converters/convert_hash_spec.rb b/spec/unit/converters/convert_hash_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/converters/convert_hash_spec.rb
+++ b/spec/unit/converters/convert_hash_spec.rb
@@ -0,0 +1,12 @@+# frozen_string_literal: true
+
+RSpec.describe TTY::Prompt::Question, "convert to hash" do
+ subject(:prompt) { TTY::Prompt::Test.new }
+
+ it "converts answer to a hash" do
+ prompt.input << "a:1 b:2 c:3"
+ prompt.input.rewind
+ answer = prompt.ask("Options?", convert: :map)
+ expect(answer).to eq({a: "1", b: "2", c: "3"})
+ end
+end
|
Add check to ensure ask prompt converts answer to hash type
|
diff --git a/features/step_definitions/invoicer_steps.rb b/features/step_definitions/invoicer_steps.rb
index abc1234..def5678 100644
--- a/features/step_definitions/invoicer_steps.rb
+++ b/features/step_definitions/invoicer_steps.rb
@@ -1,9 +1,10 @@ # Invoice queue
When /^the attendee invoicer runs$/ do
+ # Set some things that must exist, if they don't already
+ @invoice_description ||= SecureRandom.hex(32)
+ @base_price ||= SecureRandom.random_number(9999)
# Invoice
- @invoice_description ||= SecureRandom.hexdigest(32)
- @base_price ||= SecureRandom.number(9999)
Invoicer.perform(create_invoice_to_hash, create_invoice_details_hash)
end
@@ -20,6 +21,9 @@ end
Then /^the attendee invoicer should be requeued$/ do
+ # Set some things that must exist, if they don't already
+ @invoice_description ||= SecureRandom.hex(32)
+ @base_price ||= SecureRandom.random_number(9999)
# Set expectation
Resque.should_receive(:enqueue).with(Invoicer, create_invoice_to_hash, create_invoice_details_hash).once
end
|
Fix default setting of base price and description
|
diff --git a/make-sponsors.rb b/make-sponsors.rb
index abc1234..def5678 100644
--- a/make-sponsors.rb
+++ b/make-sponsors.rb
@@ -0,0 +1,19 @@+require "yaml"
+print "Enter the event in YYYY-city format: "
+cityname = gets.chomp
+config = YAML.load_file("data/events/#{cityname}.yml")
+sponsors = config['sponsors']
+sponsors.each {|s|
+ if File.exist?("data/sponsors/#{s['id']}.yml")
+ puts "The file for #{s['id']} totally exists already"
+ else
+ puts "I need to make a file for #{s['id']}"
+ puts "What is the sponsor URL?"
+ sponsor_url = gets.chomp
+ sponsorfile = File.open("data/sponsors/#{s['id']}.yml", "w")
+ sponsorfile.write "name: #{s['id']}\n"
+ sponsorfile.write "url: #{sponsor_url}\n"
+ sponsorfile.close
+ puts "It will be data/sponsors/#{s['id']}.yml"
+ end
+}
|
Create script for generating sponsor files
This ruby script basically reads in a city config file and creates the sponsor file associated with it. It will NOT create the images, naturally, but this will make it somewhat easier.
|
diff --git a/rusic.gemspec b/rusic.gemspec
index abc1234..def5678 100644
--- a/rusic.gemspec
+++ b/rusic.gemspec
@@ -20,6 +20,7 @@
spec.add_runtime_dependency 'thor', '~> 0.14.6'
spec.add_runtime_dependency 'rest-client', '~> 1.6'
+ spec.add_runtime_dependency 'filewatcher', '~> 0.3'
spec.add_development_dependency 'rake', '~> 0.9.0'
spec.add_development_dependency 'rspec', '~> 2.6.0'
|
Add file watcher as dependency
|
diff --git a/ember-dev.gemspec b/ember-dev.gemspec
index abc1234..def5678 100644
--- a/ember-dev.gemspec
+++ b/ember-dev.gemspec
@@ -6,7 +6,7 @@ gem.email = ["peter.wagenet@gmail.com"]
gem.description = "Ember Package Development Tooling"
gem.summary = "Tooling for developing Ember packages."
- gem.homepage = ""
+ gem.homepage = "https://github.com/emberjs/ember-dev"
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
gem.files = `git ls-files`.split("\n")
|
Add homepage to avoid warning on `gem build`
On `gem build ember-dev.gemspec` the following warning is shown:
```
WARNING: no homepage specified
```
|
diff --git a/ext/balance_tags_c/extconf.rb b/ext/balance_tags_c/extconf.rb
index abc1234..def5678 100644
--- a/ext/balance_tags_c/extconf.rb
+++ b/ext/balance_tags_c/extconf.rb
@@ -1,5 +1,4 @@ require 'mkmf'
dir_config("balance_tags_c")
-puts "here we are"
create_makefile("balance_tags_c")
|
Remove random debug message. Oops.
|
diff --git a/lib/active_record/connection_adapters/sqlserver/type/char.rb b/lib/active_record/connection_adapters/sqlserver/type/char.rb
index abc1234..def5678 100644
--- a/lib/active_record/connection_adapters/sqlserver/type/char.rb
+++ b/lib/active_record/connection_adapters/sqlserver/type/char.rb
@@ -24,6 +24,10 @@ "'#{@value}'"
end
+ def to_s
+ @value
+ end
+
end
end
|
Add to_s method to SQLServer::Type::Char::Data object
|
diff --git a/lib/overriaktion/vcr.rb b/lib/overriaktion/vcr.rb
index abc1234..def5678 100644
--- a/lib/overriaktion/vcr.rb
+++ b/lib/overriaktion/vcr.rb
@@ -2,8 +2,12 @@
require 'vcr'
-VCR.config do |c|
- c.stub_with :webmock
- c.cassette_library_dir = 'fixtures/vcr_cassettes'
- c.default_cassette_options = { :record => :none }
+if ENV['RAILS_ENV'] == 'test'
+ PROJECT_ROOT = File.expand_path("../../..", __FILE__)
+
+ VCR.config do |c|
+ c.stub_with :webmock
+ c.cassette_library_dir = "#{PROJECT_ROOT}/fixtures/vcr_cassettes"
+ c.default_cassette_options = { :record => :none }
+ end
end
|
Load VCR if running in the test environment.
|
diff --git a/spec/features/musics_spec.rb b/spec/features/musics_spec.rb
index abc1234..def5678 100644
--- a/spec/features/musics_spec.rb
+++ b/spec/features/musics_spec.rb
@@ -35,6 +35,10 @@ it 'redirects musics_path' do
expect(current_path).to eq musics_path
end
+
+ it 'have a search box' do
+ expect(page).to have_selector('input[name="q"]')
+ end
end
end
end
|
Add spec for search box
|
diff --git a/app/models/kalibro_range.rb b/app/models/kalibro_range.rb
index abc1234..def5678 100644
--- a/app/models/kalibro_range.rb
+++ b/app/models/kalibro_range.rb
@@ -8,8 +8,8 @@ validates :beginning, :end, :reading, :metric_configuration, presence: true
validates :beginning, uniqueness: {scope: :metric_configuration_id, message: "Should be unique within a Metric Configuration"}
validates :beginning, :end, numericality: true
- validates_with IntervalValidator, fields: [:beginning, :end], if: "beginning && self.end"
- validates_with RangeOverlappingValidator, fields: [:beginning, :end], if: "beginning && self.end"
+ validates_with IntervalValidator, fields: [:beginning, :end], if: "beginning && self.end && beginning.is_a?(Numeric) && self.end.is_a?(Numeric)"
+ validates_with RangeOverlappingValidator, fields: [:beginning, :end], if: "beginning && self.end && beginning.is_a?(Numeric) && self.end.is_a?(Numeric)"
def as_json(options={})
options[:except] = [:beginning, :end]
|
Add constraints for running custom range validators
In spite of having the numericality validator the IntervalValidator and
RangeOverlappingValidtor would always run, due to rails conventions.
When the beginning or end of the range were not numerical, an exception
was risen. We now prevent our custom validators to run when the
beginning or the end of the range are not numerical.
|
diff --git a/app/services/weather_man.rb b/app/services/weather_man.rb
index abc1234..def5678 100644
--- a/app/services/weather_man.rb
+++ b/app/services/weather_man.rb
@@ -2,17 +2,21 @@ @w_api = Wunderground.new(ENV["WUNDERGROUND_API_KEY"])
def self.current_outdoor_temp(zip_code)
- Rails.cache.fetch("current_outdoor_temp", :expires_in => 15.minutes) do
+ key = "current_outdoor_temp_for_#{zip_code}"
+ Rails.cache.fetch(key, :expires_in => 15.minutes) do
json_object = @w_api.conditions_for(zip_code)
json_object["current_observation"]["temp_f"]
end
end
def self.outdoor_temp_for(time, zip_code)
- observations = @w_api.history_for(time, zip_code)['history']['observations']
- observations.each do |o|
- if o['date']['hour'] == time.hour.to_s
- return o['tempi']
+ key = "outdoor_temp_for_#{zip_code}_at_#{time.strftime '%Y-%m-%dT%I'}"
+ Rails.cache.fetch(key, :expires_in => 1.day) do
+ observations = @w_api.history_for(time, zip_code)['history']['observations']
+ observations.each do |o|
+ if o['date']['hour'] == time.hour.to_s
+ return o['tempi'].to_i
+ end
end
end
end
|
Implement caching to minimize weather underground API calls
|
diff --git a/server.rb b/server.rb
index abc1234..def5678 100644
--- a/server.rb
+++ b/server.rb
@@ -1,4 +1,8 @@ class HelloWorldApp < Sinatra::Base
+ configure do
+ set :protection, :except => :frame_options
+ end
+
get '/' do
"Hello, world!"
end
|
Allow iframes to use the button
-This removes restrictions that set X-Frame-Options
to ‘SAMEORIGIN’.
|
diff --git a/ffi-proj4.gemspec b/ffi-proj4.gemspec
index abc1234..def5678 100644
--- a/ffi-proj4.gemspec
+++ b/ffi-proj4.gemspec
@@ -11,6 +11,7 @@ s.description = "An ffi wrapper for the PROJ.4 Cartographic Projections library."
s.summary = s.description
s.email = "dark.panda@gmail.com"
+ s.license = "MIT"
s.files = `git ls-files`.split($\)
s.executables = s.files.grep(%r{^bin/}).map { |f| File.basename(f) }
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
Add license details to gemspec.
|
diff --git a/spec/overcommit/hook/pre_commit/berksfile_check_spec.rb b/spec/overcommit/hook/pre_commit/berksfile_check_spec.rb
index abc1234..def5678 100644
--- a/spec/overcommit/hook/pre_commit/berksfile_check_spec.rb
+++ b/spec/overcommit/hook/pre_commit/berksfile_check_spec.rb
@@ -13,45 +13,51 @@ it { should warn }
end
- context 'when Berksfile.lock is ignored' do
- around do |example|
- repo do
- `touch Berksfile.lock`
- `echo Berksfile.lock > .gitignore`
- `git add .gitignore`
- `git commit -m "Ignore Berksfile.lock"`
- example.run
- end
+ context 'when Berkshelf is installed' do
+ before do
+ subject.stub(:in_path?).and_return(true)
end
- it { should pass }
- end
-
- context 'when Berksfile.lock is not ignored' do
- let(:result) { double('result') }
-
- around do |example|
- repo do
- example.run
+ context 'when Berksfile.lock is ignored' do
+ around do |example|
+ repo do
+ `touch Berksfile.lock`
+ `echo Berksfile.lock > .gitignore`
+ `git add .gitignore`
+ `git commit -m "Ignore Berksfile.lock"`
+ example.run
+ end
end
- end
-
- before do
- result.stub(:success? => success, :stderr => 'Berkshelf error message')
- subject.stub(:execute).and_call_original
- subject.stub(:execute).with(%w[berks list --quiet]).and_return(result)
- end
-
- context 'and `berks list` exits unsuccessfully' do
- let(:success) { false }
-
- it { should fail_hook }
- end
-
- context 'and `berks list` exits successfully' do
- let(:success) { true }
it { should pass }
end
+
+ context 'when Berksfile.lock is not ignored' do
+ let(:result) { double('result') }
+
+ around do |example|
+ repo do
+ example.run
+ end
+ end
+
+ before do
+ result.stub(:success? => success, :stderr => 'Berkshelf error message')
+ subject.stub(:execute).and_call_original
+ subject.stub(:execute).with(%w[berks list --quiet]).and_return(result)
+ end
+
+ context 'and `berks list` exits unsuccessfully' do
+ let(:success) { false }
+
+ it { should fail_hook }
+ end
+
+ context 'and `berks list` exits successfully' do
+ let(:success) { true }
+
+ it { should pass }
+ end
+ end
end
end
|
Fix BerksfileCheck spec to stub in_path?
This spec would pass locally but fail on Travis because it didn't stub
the `in_path?` call. Fix it.
Change-Id: I359f69518eae2f108761c6e48f2273a9b8cc146e
Reviewed-on: http://gerrit.causes.com/37940
Tested-by: jenkins <d95b56ce41a2e1ac4cecdd398defd7414407cc08@causes.com>
Reviewed-by: Shane da Silva <6f6e68d1df92f30cb4b3ce35260ddf94a402f33d@causes.com>
|
diff --git a/CareerCup/convertstring_to_perm.rb b/CareerCup/convertstring_to_perm.rb
index abc1234..def5678 100644
--- a/CareerCup/convertstring_to_perm.rb
+++ b/CareerCup/convertstring_to_perm.rb
@@ -0,0 +1,29 @@+# Convert string to permutations using only adjacent swaps
+#
+# Example: CAT TAC
+#
+# CAT CTA TCA TAC
+#
+
+class String
+ def perms(target)
+ result = []
+ for i in 0..self.size - 1
+ j = i
+ while self[i] != target[j]
+ j += 1
+ end
+ while j > i
+ self[j], self[j - 1] = self[j - 1], self[j]
+ result << self.dup
+ j -= 1
+ end
+ end
+
+ result
+ end
+end
+
+[["CAT", "TAC"]].each { |x|
+ puts "#{x[0]} #{x[0].perms(x[1])}"
+}
|
Convert a string to its permutation using only neighbor swaps
|
diff --git a/web/app/admin/endpoint.rb b/web/app/admin/endpoint.rb
index abc1234..def5678 100644
--- a/web/app/admin/endpoint.rb
+++ b/web/app/admin/endpoint.rb
@@ -17,6 +17,23 @@ permitted = [:name, :url]
end
+ show do
+ panel "Endpoint Details" do
+ attributes_table_for endpoint do
+ row :id
+ row :name
+ row :url
+ row :created_at
+ row :updated_at
+ row :issue_id
+ row :prefixes do
+ link_to 'import prefixes data from CSV file', "/admin/endpoints/#{endpoint.id}/prefixes"
+ end
+ end
+ end
+ active_admin_comments
+ end
+
member_action :prefixes, method: [:get, :post] do
if request.post?
Prefix::import_csv(params)
|
Add link to prefixes page
|
diff --git a/test/models/optional_modules/mailings/mailing_setting_test.rb b/test/models/optional_modules/mailings/mailing_setting_test.rb
index abc1234..def5678 100644
--- a/test/models/optional_modules/mailings/mailing_setting_test.rb
+++ b/test/models/optional_modules/mailings/mailing_setting_test.rb
@@ -4,7 +4,27 @@ # == MailingSettingTest Model
#
class MailingSettingTest < ActiveSupport::TestCase
- # test "the truth" do
- # assert true
- # end
-end
+ test 'should save mailing setting if email is nil' do
+ mailing_user = MailingSetting.new
+ assert mailing_user.valid?
+ assert mailing_user.errors.keys.empty?
+ end
+
+ test 'should save mailing setting if email is blank' do
+ mailing_user = MailingSetting.new(email: '')
+ assert mailing_user.valid?
+ assert mailing_user.errors.keys.empty?
+ end
+
+ test 'should save mailing setting if email is correct' do
+ mailing_user = MailingSetting.new(email: 'mailing@test.com')
+ assert mailing_user.valid?
+ assert mailing_user.errors.keys.empty?
+ end
+
+ test 'should not save mailing setting if email is not correct' do
+ mailing_user = MailingSetting.new(email: 'mailing')
+ assert_not mailing_user.valid?
+ assert_equal [:email], mailing_user.errors.keys
+ end
+end
|
Add tests for email validator
|
diff --git a/RedditKit.podspec b/RedditKit.podspec
index abc1234..def5678 100644
--- a/RedditKit.podspec
+++ b/RedditKit.podspec
@@ -14,6 +14,6 @@ s.source_files = 'Classes/*.{h,m}', 'Classes/**/*.{h,m}'
s.header_mappings_dir = 'Classes'
- s.dependency 'AFNetworking/NSURLSession', '~> 2.0'
+ s.dependency 'AFNetworking', '~> 2.0'
s.dependency 'Mantle', '~> 1.3'
end
|
Switch back to having AFNetworking as a dependency instead of just the subspec AFNetworking/NSURLSession
There are bugs in AFNetworking/NSURLSession which requires it to use
other files not included in the subspec.
|
diff --git a/rb/spec/integration/selenium/webdriver/chrome/driver_spec.rb b/rb/spec/integration/selenium/webdriver/chrome/driver_spec.rb
index abc1234..def5678 100644
--- a/rb/spec/integration/selenium/webdriver/chrome/driver_spec.rb
+++ b/rb/spec/integration/selenium/webdriver/chrome/driver_spec.rb
@@ -0,0 +1,24 @@+module Selenium
+ module WebDriver
+ module Firefox
+
+ describe Driver do
+ it "should accept an array of custom command line switches" do
+ begin
+ driver = Selenium::WebDriver.for :chrome, :switches => ["--disable-translate"]
+ ensure
+ driver.quit if driver
+ end
+ end
+
+ it "should raise ArgumentError if :switches is not an Array" do
+ lambda {
+ Selenium::WebDriver.for(:chrome, :switches => "--foo")
+ }.should raise_error(ArgumentError)
+ end
+ end
+
+ end # Chrome
+ end # WebDriver
+end # Selenium
+
|
JariBakken: Add missing file from last commit.
git-svn-id: aa1aa1384423cb28c2b1e29129bb3a91de1d9196@12313 07704840-8298-11de-bf8c-fd130f914ac9
|
diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb
index abc1234..def5678 100644
--- a/test/controllers/users_controller_test.rb
+++ b/test/controllers/users_controller_test.rb
@@ -5,7 +5,6 @@ include Devise::Test::ControllerHelpers
setup do
- @ad = create(:ad)
@user = create(:user, email: 'jaimito@gmail.com', username: 'jaimito')
end
|
Remove unused variable from test
|
diff --git a/app/views/renalware/api/ukrdc/patients/diagnoses/_cause_of_death.xml.builder b/app/views/renalware/api/ukrdc/patients/diagnoses/_cause_of_death.xml.builder
index abc1234..def5678 100644
--- a/app/views/renalware/api/ukrdc/patients/diagnoses/_cause_of_death.xml.builder
+++ b/app/views/renalware/api/ukrdc/patients/diagnoses/_cause_of_death.xml.builder
@@ -9,7 +9,7 @@ xml.CauseOfDeath do
xml.DiagnosisType "final"
xml.Diagnosis do
- xml.CodingStandard "EDTA"
+ xml.CodingStandard "EDTA_COD"
xml.Code cause_code
end
xml.EnteredOn cause.created_at.to_datetime
|
Change CauseOfDeath CodingStandard to EDTA_COD
|
diff --git a/core/db/migrate/20150731201146_add_spree_user_addresses.rb b/core/db/migrate/20150731201146_add_spree_user_addresses.rb
index abc1234..def5678 100644
--- a/core/db/migrate/20150731201146_add_spree_user_addresses.rb
+++ b/core/db/migrate/20150731201146_add_spree_user_addresses.rb
@@ -5,7 +5,7 @@ t.integer :address_id, null: false
t.boolean :default, default: false
t.boolean :archived, default: false
- t.timestamps
+ t.timestamps null: false
end
add_index :spree_user_addresses, :user_id
|
Add missing null: false on user addresses
|
diff --git a/dashboard/db/migrate/20150804174622_change_phase_to_int.rb b/dashboard/db/migrate/20150804174622_change_phase_to_int.rb
index abc1234..def5678 100644
--- a/dashboard/db/migrate/20150804174622_change_phase_to_int.rb
+++ b/dashboard/db/migrate/20150804174622_change_phase_to_int.rb
@@ -1,25 +1,25 @@ class ChangePhaseToInt < ActiveRecord::Migration
def change
- Workshops.find_each do |workshop|
+ Workshop.find_each do |workshop|
phase = workshop.phase
new_phase = 0
- if phase == 'Phase 1'
- new_phase = 1
- elsif phase == 'Phase 2'
- new_phase = 2
- elsif phase == 'Phase 2 Online'
- new_phase = 3
- elsif phase == 'Phase 3A'
- new_phase = 4
- elsif phase == 'Phase 3B'
- new_phase = 5
- elsif phase == 'Phase 3C'
- new_phase = 6
- elsif phase == 'Phase 3D'
- new_phase = 7
- elsif phase == 'Phase 4'
- new_phase = 8
- end
+ if phase == 'Phase 1'
+ new_phase = 1
+ elsif phase == 'Phase 2'
+ new_phase = 2
+ elsif phase == 'Phase 2 Online'
+ new_phase = 3
+ elsif phase == 'Phase 3A'
+ new_phase = 4
+ elsif phase == 'Phase 3B'
+ new_phase = 5
+ elsif phase == 'Phase 3C'
+ new_phase = 6
+ elsif phase == 'Phase 3D'
+ new_phase = 7
+ elsif phase == 'Phase 4'
+ new_phase = 8
+ end
workshop.phase = new_phase
workshop.save!
end
|
Fix indentation. Workshops to Workshop.
|
diff --git a/lib/acts_as_tenant/controller_extensions.rb b/lib/acts_as_tenant/controller_extensions.rb
index abc1234..def5678 100644
--- a/lib/acts_as_tenant/controller_extensions.rb
+++ b/lib/acts_as_tenant/controller_extensions.rb
@@ -1,46 +1,52 @@ module ActsAsTenant
module ControllerExtensions
-
- # this method allows setting the current_account by reading the subdomain and looking
- # it up in the tenant-model passed to the method (defaults to Account). The method will
- # look for the subdomain in a column referenced by the second argument (defaults to subdomain).
-
- def set_current_tenant_by_subdomain(tenant = :account, column = :subdomain )
- self.class_eval do
- cattr_accessor :tenant_class, :tenant_column
- attr_accessor :current_tenant
- end
-
- self.tenant_class = tenant.to_s.capitalize.constantize
- self.tenant_column = column.to_sym
-
- self.class_eval do
- before_filter :find_tenant_by_subdomain
-
- private
- def find_tenant_by_subdomain
- ActsAsTenant.current_tenant = tenant_class.where(tenant_column => request.subdomains.first).first
- @current_tenant_instance = ActsAsTenant.current_tenant
- end
- end
+ extend ActiveSupport::Concern
+
+ included do
+ helper_method :current_tenant
end
- def set_current_tenant_to(current_tenant_object)
- self.class_eval do
- cattr_accessor :tenant_class
- attr_accessor :current_tenant
- before_filter lambda { @current_tenant_instance = ActsAsTenant.current_tenant = current_tenant_object }
+ module ClassMethods
+
+ # this method allows setting the current_account by reading the subdomain and looking
+ # it up in the tenant-model passed to the method (defaults to Account). The method will
+ # look for the subdomain in a column referenced by the second argument (defaults to subdomain).
+ def set_current_tenant_by_subdomain(tenant = :account, column = :subdomain )
+ self.class_eval do
+ cattr_accessor :tenant_class, :tenant_column
+ attr_accessor :current_tenant
+ end
+
+ self.tenant_class = tenant.to_s.capitalize.constantize
+ self.tenant_column = column.to_sym
+
+ self.class_eval do
+ before_filter :find_tenant_by_subdomain
+
+ private
+ def find_tenant_by_subdomain
+ ActsAsTenant.current_tenant = tenant_class.where(tenant_column => request.subdomains.first).first
+ @current_tenant_instance = ActsAsTenant.current_tenant
+ end
+ end
end
+
+ def set_current_tenant_to(current_tenant_object)
+ self.class_eval do
+ cattr_accessor :tenant_class
+ attr_accessor :current_tenant
+ before_filter lambda { @current_tenant_instance = ActsAsTenant.current_tenant = current_tenant_object }
+ end
+ end
+
+ # helper method to have the current_tenant available in the controller
+ def current_tenant
+ ActsAsTenant.current_tenant
+ end
+
+ #ActiveSupport.on_load(:action_controller) do
+ # helper_method :current_tenant
+ #end
end
-
- # helper method to have the current_tenant available in the controller
- def current_tenant
- ActsAsTenant.current_tenant
- end
-
- ActiveSupport.on_load(:action_controller) do
- helper_method :current_tenant
- end
-
end
end
|
Fix to get current_tenant working
|
diff --git a/lib/asciidoctor-diagram/svgbob/converter.rb b/lib/asciidoctor-diagram/svgbob/converter.rb
index abc1234..def5678 100644
--- a/lib/asciidoctor-diagram/svgbob/converter.rb
+++ b/lib/asciidoctor-diagram/svgbob/converter.rb
@@ -12,6 +12,10 @@
def supported_formats
[:svg]
+ end
+
+ def native_scaling?
+ true
end
OPTIONS = {
|
Enable native scaling for svgbob
|
diff --git a/lib/resume_generator/cli/argument_parser.rb b/lib/resume_generator/cli/argument_parser.rb
index abc1234..def5678 100644
--- a/lib/resume_generator/cli/argument_parser.rb
+++ b/lib/resume_generator/cli/argument_parser.rb
@@ -1,24 +1,24 @@ require_relative '../../resume_generator'
require_relative 'colours'
require 'optparse'
-require 'forwardable'
module ResumeGenerator
module CLI
class ArgumentParser
- extend Forwardable
include Colours
attr_reader :supported_locales, :parser
attr_accessor :locale
def initialize
- @locale = :en
@supported_locales = [:en, :ja]
@parser = initialize_parser
end
- def_delegator :@parser, :parse!
+ def parse!
+ parser.parse!(ARGV)
+ self.locale ||= :en
+ end
private
|
Refactor default locale assignment on argument parser
|
diff --git a/lib/the_community_farm/organic_boxes/box.rb b/lib/the_community_farm/organic_boxes/box.rb
index abc1234..def5678 100644
--- a/lib/the_community_farm/organic_boxes/box.rb
+++ b/lib/the_community_farm/organic_boxes/box.rb
@@ -19,7 +19,10 @@ end
def box_size
- @box_size ||= noko.at_css('option[selected]')&.text&.strip
+ @box_size ||= begin
+ size = noko.at_css('option[selected]')
+ size && size.text && size.text.strip
+ end
end
def items
|
Make code compatible with Ruby 2.1
|
diff --git a/field_types/core/tag/tag_cell.rb b/field_types/core/tag/tag_cell.rb
index abc1234..def5678 100644
--- a/field_types/core/tag/tag_cell.rb
+++ b/field_types/core/tag/tag_cell.rb
@@ -8,6 +8,16 @@ render
end
+ private
+
+ def value
+ if data
+ data['tag_list'] || @options[:default_value]
+ else
+ @options[:default_value]
+ end
+ end
+
end
end
end
|
Create Core Cells for new Field Types
|
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/application_controller_spec.rb
+++ b/spec/controllers/application_controller_spec.rb
@@ -0,0 +1,88 @@+require 'rails_helper'
+
+RSpec.describe ApplicationController, type: :controller do
+
+ controller do
+ before_action :login_required, only: [:fake_action]
+ before_action :admin_required, only: [:fake_admin_action]
+
+ def fake_action
+ head :ok
+ end
+
+ def fake_admin_action
+ head :ok
+ end
+
+ end
+
+ before do
+ routes.draw do
+ get 'fake_action' => 'anonymous#fake_action'
+ get 'fake_admin_action' => 'anonymous#fake_admin_action'
+ end
+ end
+
+ describe "#login_required" do
+
+ context "user is logged in" do
+
+ before { allow(controller).to receive(:logged_in?).and_return(true) }
+
+ it "does not invoke a redirect" do
+ get :fake_action
+ expect(response).to have_http_status(:success)
+ end
+
+ end
+
+ context "user is not logged in" do
+
+ before { allow(controller).to receive(:logged_in?).and_return(false) }
+
+ it "invokes a redirect" do
+ get :fake_action
+ expect(response).to redirect_to(login_path)
+ end
+
+ it "places a message in the flash" do
+ get :fake_action
+ expect(controller).to set_flash[:danger].to("Please sign in.")
+ end
+
+ end
+
+ end
+
+ describe "#admin_required" do
+
+ context "user is admin" do
+
+ before { allow(controller).to receive(:current_user).and_return(build(:user, :admin)) }
+
+ it "does not invoke a redirect" do
+ get :fake_admin_action
+ expect(response).to have_http_status(:success)
+ end
+
+ end
+
+ context "user is not admin" do
+
+ before { allow(controller).to receive(:current_user).and_return(build(:user)) }
+
+ it "invokes a redirect" do
+ get :fake_admin_action
+ expect(response).to redirect_to(root_url)
+ end
+
+ it "places a message in the flash" do
+ get :fake_admin_action
+ expect(controller).to set_flash[:danger].to("Admin permissions required.")
+ end
+
+ end
+
+ end
+
+end
|
Test ApplicationController methods with dedicated spec.
|
diff --git a/spec/premailer-rails3/hook_registration_spec.rb b/spec/premailer-rails3/hook_registration_spec.rb
index abc1234..def5678 100644
--- a/spec/premailer-rails3/hook_registration_spec.rb
+++ b/spec/premailer-rails3/hook_registration_spec.rb
@@ -2,8 +2,8 @@
describe 'ActionMailer::Base.register_interceptor' do
it 'should register interceptor PremailerRails::Hook' do
- ActionMailer::Base
- .expects(:register_interceptor)
+ ActionMailer::Base \
+ .expects(:register_interceptor) \
.with(PremailerRails::Hook)
load 'premailer-rails3.rb'
end
|
Make spec ruby 1.8 compatible
|
diff --git a/spec/integration/display_adapters_spec.rb b/spec/integration/display_adapters_spec.rb
index abc1234..def5678 100644
--- a/spec/integration/display_adapters_spec.rb
+++ b/spec/integration/display_adapters_spec.rb
@@ -12,6 +12,7 @@ "string",
"select",
nil,
+ [],
[],
[
[:option_values, [["c", "c"], ["f", "f"]]]
@@ -41,8 +42,8 @@ end.new
expect(form.({}).to_ary).to eq [
- [:field, [:name, "string", "custom", nil, [], []]],
- [:field, [:email, "string", "default", nil, [], []]],
+ [:field, [:name, "string", "custom", nil, [], [], []]],
+ [:field, [:email, "string", "default", nil, [], [], []]],
]
end
end
|
Update display adapters spec to match AST output
|
diff --git a/app/controllers/resources_controller.rb b/app/controllers/resources_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/resources_controller.rb
+++ b/app/controllers/resources_controller.rb
@@ -21,6 +21,7 @@ end
def show
+ @comment = @resource.comments.build
end
def edit
@@ -35,7 +36,7 @@ redirect_to user_resource_path(@resource)
else
flash[:error] = @resource.errors.full_messages
- redirect_to edit_user_resource_path(@resource)
+ redirect_to edit_resource_path(@resource)
end
end
@@ -52,7 +53,7 @@
def resource_params
params.require(:resource).permit(:title, :url, :description, :language_id,
- :favorited, :topic_ids => [], :topics_attributes => [:name])
+ :favorited, :tag_ids => [], :tags_attributes => [:name])
end
end
|
Change topic params to tag params.
|
diff --git a/lib/after_commit_action.rb b/lib/after_commit_action.rb
index abc1234..def5678 100644
--- a/lib/after_commit_action.rb
+++ b/lib/after_commit_action.rb
@@ -17,10 +17,10 @@ end
def execute_after_commit(&block)
- if ActiveRecord::Base.connection.open_transactions == 0
+ if self.class.connection.open_transactions == 0
return block.call
else
- ActiveRecord::Base.connection.add_transaction_record(self)
+ self.class.connection.add_transaction_record(self)
end
@_execute_after_commit ||= []
|
Use `self.class.connection` instead of `ActiveRecord::Base.connection`
|
diff --git a/test/integration/shareable_preview_generate_new_link_test.rb b/test/integration/shareable_preview_generate_new_link_test.rb
index abc1234..def5678 100644
--- a/test/integration/shareable_preview_generate_new_link_test.rb
+++ b/test/integration/shareable_preview_generate_new_link_test.rb
@@ -0,0 +1,63 @@+require "test_helper"
+require "capybara/rails"
+
+class ShareablePreviewGenerateNewLinkIntegrationTest < ActionDispatch::IntegrationTest
+ extend Minitest::Spec::DSL
+ include Capybara::DSL
+ include TaxonomyHelper
+
+ describe "shareable preview generate new link feature" do
+ context "for draft documents" do
+ let(:edition) { create(:draft_case_study) }
+
+ before do
+ create_setup(edition)
+ visit admin_case_study_path(edition)
+ end
+
+ test "it shows the generate new link feature" do
+ get admin_case_study_path(edition)
+ assert_selector "section", text: "Generate new link"
+ end
+
+ test "it revokes the previous links and generates a new one" do
+ get admin_case_study_path(edition)
+
+ current_preview_url = all("input").first.value
+ current_query_string = Rack::Utils.parse_query URI(current_preview_url).query
+ current_token = current_query_string["token"]
+
+ click_link "Generate new link"
+
+ new_preview_url = all("input").first.value
+ new_query_string = Rack::Utils.parse_query URI(new_preview_url).query
+ new_token = new_query_string["token"]
+
+ assert_not_equal current_token, new_token
+ end
+ end
+
+ context "for published documents" do
+ let(:edition) { create(:published_case_study) }
+
+ before do
+ create_setup(edition)
+ visit admin_case_study_path(edition)
+ end
+
+ test "it does not show the generate new link feature" do
+ get admin_case_study_path(edition)
+ assert_no_selector "section", text: "Generate new link"
+ end
+ end
+
+ def create_setup(edition)
+ @user = create(:gds_editor)
+ @user.permissions << "can share previews"
+ login_as @user
+ topic_taxon = build(:taxon_hash)
+ stub_publishing_api_expanded_links_with_taxons(edition.content_id, [])
+ stub_publishing_api_links_with_taxons(edition.content_id, [topic_taxon["content_id"]])
+ end
+ end
+end
|
Add integration test for generating new sharable link
|
diff --git a/config/initializers/gds-sso.rb b/config/initializers/gds-sso.rb
index abc1234..def5678 100644
--- a/config/initializers/gds-sso.rb
+++ b/config/initializers/gds-sso.rb
@@ -2,5 +2,5 @@ config.user_model = 'User'
config.oauth_id = ENV['OAUTH_ID']
config.oauth_secret = ENV['OAUTH_SECRET']
- config.oauth_root_url = Plek.current.find("signon")
+ config.oauth_root_url = Plek.new.external_url_for("signon")
end
|
Use an external URL for Signon
|
diff --git a/app/workers/feed_refresher_scheduler.rb b/app/workers/feed_refresher_scheduler.rb
index abc1234..def5678 100644
--- a/app/workers/feed_refresher_scheduler.rb
+++ b/app/workers/feed_refresher_scheduler.rb
@@ -6,55 +6,46 @@ include BatchJobs
sidekiq_options queue: :critical
- STRATEGY_KEY = "last_refresh:strategy".freeze
+ COUNT_KEY = "feed_refresher_scheduler:count".freeze
def perform
- if fetcher_queue_empty? && receiver_queue_empty?
+ if queue_empty?('feed_refresher_receiver') && queue_empty?('feed_refresher_fetcher')
refresh_feeds
- Librato.increment 'refresh_feeds'
end
- end
-
- def fetcher_queue_empty?
- queues['feed_refresher_fetcher'].blank? || queues['feed_refresher_fetcher'] == 0
- end
-
- def receiver_queue_empty?
- queues['feed_refresher_receiver'].blank? || queues['feed_refresher_receiver'] == 0
- end
-
- def queues
- Sidekiq::Stats.new().queues
end
def refresh_feeds
feed = Feed.last
if feed
jobs = job_args(feed.id, priority?)
- set_strategy
Sidekiq::Client.push_bulk(
'args' => jobs,
'class' => "FeedRefresher",
'queue' => 'worker_slow_critical'
)
+ increment
end
end
def priority?
- last_refresh_strategy = Sidekiq.redis {|client| client.get(STRATEGY_KEY)}
- if last_refresh_strategy.blank? || last_refresh_strategy == 'all'
- true
- else
- false
+ @priority ||= count % 2 == 0
+ end
+
+ def increment
+ Librato.increment 'refresh_feeds'
+ Sidekiq.redis {|client| client.incr(COUNT_KEY)}
+ end
+
+ def count
+ @count ||= begin
+ result = Sidekiq.redis {|client| client.get(COUNT_KEY)} || 0
+ result.to_i
end
end
- def set_strategy
- if priority?
- Sidekiq.redis {|client| client.set(STRATEGY_KEY, "partial")}
- else
- Sidekiq.redis {|client| client.set(STRATEGY_KEY, "all")}
- end
+ def queue_empty?(queue)
+ @queues ||= Sidekiq::Stats.new().queues
+ @queues[queue].blank? || @queues[queue] == 0
end
end
|
Add counter for number of feed refreshes
|
diff --git a/app/helpers/application_helper/button/container_timeline.rb b/app/helpers/application_helper/button/container_timeline.rb
index abc1234..def5678 100644
--- a/app/helpers/application_helper/button/container_timeline.rb
+++ b/app/helpers/application_helper/button/container_timeline.rb
@@ -0,0 +1,15 @@+class ApplicationHelper::Button::ContainerTimeline < ApplicationHelper::Button::Container
+ needs :@record
+
+ def disabled?
+ @error_message = _('No Timeline data has been collected for this %{entity}') %
+ {:entity => @entity} unless proper_events?
+ @error_message.present?
+ end
+
+ private
+
+ def proper_events?
+ @record.has_events? || @record.has_events?(:policy_events)
+ end
+end
|
Create button a class for container timeline buttons
|
diff --git a/app/views/api/visualizations/network_analysis.json.jbuilder b/app/views/api/visualizations/network_analysis.json.jbuilder
index abc1234..def5678 100644
--- a/app/views/api/visualizations/network_analysis.json.jbuilder
+++ b/app/views/api/visualizations/network_analysis.json.jbuilder
@@ -4,4 +4,4 @@ json.node_custom_fields @dataset.node_custom_fields
json.relation_custom_fields @dataset.relation_custom_fields
end
-json.nodes @dataset.nodes, partial: 'api/nodes/node', as: :node+json.nodes @dataset.nodes.order(:name), partial: 'api/nodes/node', as: :node
|
Fix nodes order after performing a network analysis
|
diff --git a/spec/controllers/alexa_interface_controller_spec.rb b/spec/controllers/alexa_interface_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/alexa_interface_controller_spec.rb
+++ b/spec/controllers/alexa_interface_controller_spec.rb
@@ -7,8 +7,21 @@ 'request' => { 'intent' => { 'name' => 'SetCityIntent', 'slots' => { 'city' => { 'value' => "City" } } } },
"session" => { 'user' => { 'userId' => "userId"} } }
post :recommend, json
- #expect(response).to
+ ap response
+ expect(response).to be(1)
end
+
+ it 'responds with a default if there is no intent given'
+
+ it 'responds with default if WingItIntent is the intent'
+
+ it 'responds with general help response if AMAZON.HelpIntent is the intent'
+
+ it 'responds by setting the category if SetCategryIntent is the intent'
+
+ it 'responds with category_help_response if CategoryHelpIntent is the intent'
+
+ it 'responds with the city_help_response if CityHelpIntent is the intent'
it 'will set a user location when intent is SetCityIntent' do
json = { 'format' => 'json',
|
Add currently empty tests to test the responses to different intents
|
diff --git a/spec/presenters/tree_node/custom_button_set_spec.rb b/spec/presenters/tree_node/custom_button_set_spec.rb
index abc1234..def5678 100644
--- a/spec/presenters/tree_node/custom_button_set_spec.rb
+++ b/spec/presenters/tree_node/custom_button_set_spec.rb
@@ -2,9 +2,14 @@
describe TreeNode::CustomButtonSet do
subject { described_class.new(object, nil, {}) }
- let(:object) { FactoryGirl.create(:custom_button_set) }
+ let(:object) { FactoryGirl.create(:custom_button_set, :description => "custom button set description") }
include_examples 'TreeNode::Node#key prefix', 'cbg-'
include_examples 'TreeNode::Node#image', '100/folder.png'
- include_examples 'TreeNode::Node#tooltip prefix', 'Button Group'
+
+ describe "#tooltip" do
+ it "returns the prefixed title" do
+ expect(subject.tooltip).to eq("Button Group: custom button set description")
+ end
+ end
end
|
Fix custom button set tooltip spec
This spec uses a shared example assuming that it behaves like all other
tree nodes, however:
* this attribute is based on the description of the object, not the name
as it is in others
* it just so happens that the name will equal the description if run in
isolation, because of the way the factory is defined
* incrementing the counter for the factory in another spec is sufficient
to break this one
The simplest reproduction case is:
```
bundle exec rspec ./spec/models/custom_button_set_spec.rb[1:1:1] ./spec/presenters/tree_node/custom_button_set_spec.rb[1:3:1]
```
To remedy this I've a) updated the object to set a custom description
in the setup phase, b) broken this test out of the shared examples and
verified against the description that was set. This seemed more
straightforward than trying to accomodate for this case in the shared
example, which is used in many places.
|
diff --git a/knife-ec2.gemspec b/knife-ec2.gemspec
index abc1234..def5678 100644
--- a/knife-ec2.gemspec
+++ b/knife-ec2.gemspec
@@ -13,8 +13,7 @@ s.license = "Apache-2.0"
s.files = `git ls-files`.split("\n")
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
- s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
+ s.test_files = `git ls-files spec/*`.split("\n")
s.required_ruby_version = ">= 2.3"
s.add_dependency "fog-aws", ">= 1", "< 4"
|
Remove executables from gemspec and cleanup test files
We only have specs in this repo and knife plugins never have binaries so this whole thing was unnecessary.
Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
|
diff --git a/Casks/phpstorm-eap.rb b/Casks/phpstorm-eap.rb
index abc1234..def5678 100644
--- a/Casks/phpstorm-eap.rb
+++ b/Casks/phpstorm-eap.rb
@@ -1,6 +1,6 @@ cask :v1 => 'phpstorm-eap' do
- version '139.1226'
- sha256 '7f9e55d3f5070fb5869eb7053566f21067600d11f93435074fad9cf399ea1626'
+ version '141.176'
+ sha256 'a5c70789db4aa13c938de761029b15b2348b0a39f7ac549eaa7c82434373caed'
url "http://download.jetbrains.com/webide/PhpStorm-EAP-#{version}.dmg"
homepage 'http://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Early+Access+Program'
@@ -15,6 +15,6 @@ zap :delete => [
'~/Library/Application Support/WebIde80',
'~/Library/Preferences/WebIde80',
- '~/Library/Preferences/com.jetbrains.PhpStorm.plist',
+ '~/Library/Preferences/com.jetbrains.PhpStorm-EAP.plist',
]
end
|
Update PhpStorm-EAP.app to version 141.176.
|
diff --git a/lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb b/lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb
index abc1234..def5678 100644
--- a/lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb
+++ b/lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb
@@ -7,7 +7,7 @@ module AbstractMysqlAdapter
module UseAlterIndex
def add_index(table_name, column_name, options = {})
- index_name, index_type, index_columns, index_options, _index_algorithm, index_using = add_index_options(table_name, column_name, options)
+ index_name, index_type, index_columns, index_options, _index_algorithm, index_using = add_index_options(table_name, column_name, **options)
# cannot specify index_algorithm
execute "ALTER TABLE #{quote_table_name(table_name)} ADD #{index_type} INDEX #{quote_column_name(index_name)} #{index_using} (#{index_columns})#{index_options}"
|
Fix pass hash to last argument as keyword
|
diff --git a/gir_ffi-pretty_printer.gemspec b/gir_ffi-pretty_printer.gemspec
index abc1234..def5678 100644
--- a/gir_ffi-pretty_printer.gemspec
+++ b/gir_ffi-pretty_printer.gemspec
@@ -20,7 +20,7 @@ s.add_runtime_dependency('mvz-live_ast', ['~> 1.1.3'])
s.add_runtime_dependency('binding_of_caller', ['~> 0.7.2'])
s.add_development_dependency('minitest', ['~> 5.0'])
- s.add_development_dependency('rake', ['~> 10.1'])
+ s.add_development_dependency('rake', ['~> 11.1'])
s.add_development_dependency('yard', ['~> 0.8.3'])
s.require_paths = ['lib']
|
Update development dependency on rake
|
diff --git a/DelaunaySwift.podspec b/DelaunaySwift.podspec
index abc1234..def5678 100644
--- a/DelaunaySwift.podspec
+++ b/DelaunaySwift.podspec
@@ -1,6 +1,6 @@ Pod::Spec.new do |spec|
spec.name = "DelaunaySwift"
- spec.version = "0.1.2"
+ spec.version = "1.0.0"
spec.summary = "A utility for doing Delaunay triangulations on a set of vertices."
spec.source = { :git => "https://github.com/AlexLittlejohn/DelaunaySwift.git", :tag => spec.version.to_s }
spec.requires_arc = true
|
Bump pod version to 1.0.0
|
diff --git a/app/presenters/api/v2/commodities/commodity_presenter.rb b/app/presenters/api/v2/commodities/commodity_presenter.rb
index abc1234..def5678 100644
--- a/app/presenters/api/v2/commodities/commodity_presenter.rb
+++ b/app/presenters/api/v2/commodities/commodity_presenter.rb
@@ -34,7 +34,14 @@ export_measures.map(&:measure_sid)
end
+ def heading_id
+ commodity.heading.goods_nomenclature_sid
+ end
+
+ def chapter_id
+ commodity.chapter.goods_nomenclature_sid
+ end
end
end
end
-end+end
|
Add proper heading_id and chapter_id to commodity jsonapi presenter
|
diff --git a/app/serializers/gobierto_data/dataset_meta_serializer.rb b/app/serializers/gobierto_data/dataset_meta_serializer.rb
index abc1234..def5678 100644
--- a/app/serializers/gobierto_data/dataset_meta_serializer.rb
+++ b/app/serializers/gobierto_data/dataset_meta_serializer.rb
@@ -12,7 +12,11 @@ end
attribute :columns do
- object.rails_model.column_names
+ object.rails_model.columns.inject({}) do |columns, column|
+ columns.update(
+ column.name => column.type
+ )
+ end
end
attribute :data_preview do
|
Update datasets columns attribute in meta to include data types
|
diff --git a/Casks/bittorrent-sync.rb b/Casks/bittorrent-sync.rb
index abc1234..def5678 100644
--- a/Casks/bittorrent-sync.rb
+++ b/Casks/bittorrent-sync.rb
@@ -7,7 +7,7 @@ name 'BitTorrent Sync'
# todo: response was not XML
# appcast 'http://www.usyncapp.com/cfu.php'
- homepage 'http://www.bittorrent.com/sync'
+ homepage 'https://www.getsync.com/'
license :gratis
app 'BitTorrent Sync.app'
|
Fix homepage to use SSL in BitTorrent Sync 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/koi/engine.rb b/lib/koi/engine.rb
index abc1234..def5678 100644
--- a/lib/koi/engine.rb
+++ b/lib/koi/engine.rb
@@ -9,6 +9,10 @@ app.middleware.use ::ActionDispatch::Static, "#{root}/public"
app.middleware.use Koi::UrlRedirect
app.config.assets.precompile += %w(
+ koi.js
+ koi/nav_items.js
+ koi/assets.js
+ koi/application.css
koi/modernizr.js
koi/selectivizr.js
koi/css3-mediaqueries.js
|
Revert earlier change to assets precompile list
|
diff --git a/app/controllers/atmosphere/admin/virtual_machines_controller.rb b/app/controllers/atmosphere/admin/virtual_machines_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/atmosphere/admin/virtual_machines_controller.rb
+++ b/app/controllers/atmosphere/admin/virtual_machines_controller.rb
@@ -10,7 +10,7 @@ end
def save_as_template
- if VirtualMachineTemplate.create_from_vm(@virtual_machine)
+ if Atmosphere::VirtualMachineTemplate.create_from_vm(@virtual_machine)
redirect_to admin_virtual_machine_templates_url, notice: 'Template is being saved'
else
redirect_to admin_virtual_machines_url, notice: 'Error while saving template'
|
Fix save action on admin VM view
|
diff --git a/test/unit/client_interface_sections/history_test.rb b/test/unit/client_interface_sections/history_test.rb
index abc1234..def5678 100644
--- a/test/unit/client_interface_sections/history_test.rb
+++ b/test/unit/client_interface_sections/history_test.rb
@@ -0,0 +1,19 @@+require_relative '../../test_helper'
+
+class ClientInterfaceHistoryTest < Test::Unit::TestCase
+ def client
+ @client ||= FHIR::Client.new('history-test')
+ end
+
+ def test_history_uses_default_json_dstu2
+ stub_request(:get, /history-test/).to_return(body: '{"resourceType":"Bundle"}')
+
+ temp = client
+ temp.use_dstu2
+ temp.default_json
+
+ reply = temp.all_history
+ assert_equal FHIR::Formats::ResourceFormat::RESOURCE_JSON_DSTU2, reply.request[:headers]['format']
+ end
+
+end
|
Add test for history using default json dstu2
|
diff --git a/app/controllers/api/v1/inputs_controller.rb b/app/controllers/api/v1/inputs_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/v1/inputs_controller.rb
+++ b/app/controllers/api/v1/inputs_controller.rb
@@ -1,5 +1,4 @@ class Api::V1::InputsController < ApplicationController
- protect_from_forgery :except => [:create]
def index
@inputs = current_user.inputs
|
Remove exception for protect_from_forgery for API
|
diff --git a/app/controllers/confirmations_controller.rb b/app/controllers/confirmations_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/confirmations_controller.rb
+++ b/app/controllers/confirmations_controller.rb
@@ -25,6 +25,7 @@
def permitted_params
params.require(resource_name).permit(
+ :name,
:confirmation_token,
:password,
:password_confirmation
|
Allow user name on confirmation controller
|
diff --git a/app/controllers/restaurateurs_controller.rb b/app/controllers/restaurateurs_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/restaurateurs_controller.rb
+++ b/app/controllers/restaurateurs_controller.rb
@@ -7,7 +7,7 @@
create! do |success, failure|
success.html {
- if params[:restaurateur][:restaurants]
+ if params[:restaurateur][:restaurants].present?
restaurant = Restaurant.find(params[:restaurateur][:restaurants])
restaurant.restaurateur = @restaurateur
restaurant.save
|
FIX : update restaurateur restaurant check
|
diff --git a/app/documents/renalware/patient_document.rb b/app/documents/renalware/patient_document.rb
index abc1234..def5678 100644
--- a/app/documents/renalware/patient_document.rb
+++ b/app/documents/renalware/patient_document.rb
@@ -16,6 +16,8 @@ attribute :county, String
attribute :postcode, String
attribute :country, String
+ attribute :telephone, String
+ attribute :email, String
end
class Referral < Document::Embedded
|
Add fields to patient Document
|
diff --git a/app/services/publisher_domain_normalizer.rb b/app/services/publisher_domain_normalizer.rb
index abc1234..def5678 100644
--- a/app/services/publisher_domain_normalizer.rb
+++ b/app/services/publisher_domain_normalizer.rb
@@ -30,11 +30,11 @@ # Development Gemfile group. If you run in prod move the gem to the top level.
require "domain_name"
Rails.logger.info("PublisherDomainNormalizer normalizing offline.")
- begin
- DomainName(domain).domain
- rescue => e
- raise OfflineNormalizationError.new(e)
+ domain_name = DomainName(domain)
+ unless domain_name.canonical_tld?
+ raise DomainExclusionError.new("Normalized publisher ID unavailable for #{domain}")
end
+ domain_name.hostname
end
private
|
Improve offline mode of PublisherDomainNormalizer
|
diff --git a/app/controllers/gobierto_admin/gobierto_common/api/vocabularies_controller.rb b/app/controllers/gobierto_admin/gobierto_common/api/vocabularies_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/gobierto_admin/gobierto_common/api/vocabularies_controller.rb
+++ b/app/controllers/gobierto_admin/gobierto_common/api/vocabularies_controller.rb
@@ -10,7 +10,7 @@
def show
load_vocabulary
- render json: ::GobiertoAdmin::GobiertoCommon::VocabularySerializer.new(@vocabulary)
+ render json: @vocabulary, serializer: ::GobiertoAdmin::GobiertoCommon::VocabularySerializer
end
private
|
Fix json render syntax with ActiveModelSerializer
|
diff --git a/config/initializers/slim.rb b/config/initializers/slim.rb
index abc1234..def5678 100644
--- a/config/initializers/slim.rb
+++ b/config/initializers/slim.rb
@@ -1,4 +1,4 @@ # Be sure to restart your server when you modify this file.
# Prettify html source for development only
-# Slim::Engine.set_options pretty: Rails.env.development?, sort_attrs: false, tabsize: 2, format: :html
+Slim::Engine.set_options pretty: Rails.env.development?, sort_attrs: false, tabsize: 2, format: :html
|
Revert "prettify html in dev"
This reverts commit ed6a1f30053e182091fa65d1d665dc96f1cc1dde.
|
diff --git a/db/migrate/103_really_update_existing_articles_with_nil_or_empty_post_type.rb b/db/migrate/103_really_update_existing_articles_with_nil_or_empty_post_type.rb
index abc1234..def5678 100644
--- a/db/migrate/103_really_update_existing_articles_with_nil_or_empty_post_type.rb
+++ b/db/migrate/103_really_update_existing_articles_with_nil_or_empty_post_type.rb
@@ -10,6 +10,11 @@ if art.post_type.nil? or art.post_type.empty?
say "Fixing '#{art.title}'", 1
art.post_type = "read"
+
+ # this doesn't really belong here but since this migration
+ # would otherwise reset tags, it's better than nothing.
+ art.keywords = art.tags.collect(&:name).join(" ")
+
art.save!
end
end
|
Make sure that migration 103 does not destroy tag association.
|
diff --git a/app/controllers/api/internal/tracked_resources_controller.rb b/app/controllers/api/internal/tracked_resources_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/internal/tracked_resources_controller.rb
+++ b/app/controllers/api/internal/tracked_resources_controller.rb
@@ -3,9 +3,9 @@ module Api
module Internal
class TrackedResourcesController < Api::Internal::ApplicationController
- before_action :authenticate_user!
+ def index
+ return render(json: []) unless user_signed_in?
- def index
render json: {
episode_ids: current_user.episode_records.pluck(:episode_id),
work_ids: current_user.work_records.pluck(:work_id)
|
Fix spoiler guard when visitors do not sign in
|
diff --git a/Casks/charles-beta.rb b/Casks/charles-beta.rb
index abc1234..def5678 100644
--- a/Casks/charles-beta.rb
+++ b/Casks/charles-beta.rb
@@ -1,6 +1,6 @@ cask :v1 => 'charles-beta' do
- version '3.10b9'
- sha256 '35955b18774e9b278d0db7c9cd996dee9beb3990c391ae1556f3ff5ad8aa8dbc'
+ version '3.11b1'
+ sha256 '05ebf3b95a84d16ca434d1d4611bff1373a9e90c76c8002d59607c1c78a04bed'
url "http://www.charlesproxy.com/assets/release/#{version.gsub(/b\d$/, '')}/charles-proxy-#{version}-applejava.dmg"
homepage 'http://www.charlesproxy.com/download/beta/'
|
Update Charles.app to version 3.11b1
|
diff --git a/Casks/smart-scroll.rb b/Casks/smart-scroll.rb
index abc1234..def5678 100644
--- a/Casks/smart-scroll.rb
+++ b/Casks/smart-scroll.rb
@@ -1,6 +1,6 @@ cask 'smart-scroll' do
- version '4.0.7'
- sha256 '825517a2078bda2477be58cf36a6293d157b8e1057a4f615bcc6ce8d08aafcd4'
+ version '4.0.8'
+ sha256 '77881b437ea5b90ae5889a1a94f7d11560abb84ba72696010d78163281d2fec0'
url 'http://www.marcmoini.com/SmartScroll.zip'
name 'Smart Scroll'
|
Update Smart Scroll.prefPane to v4.0.8
|
diff --git a/isms-ruby.gemspec b/isms-ruby.gemspec
index abc1234..def5678 100644
--- a/isms-ruby.gemspec
+++ b/isms-ruby.gemspec
@@ -22,4 +22,5 @@
spec.add_development_dependency "bundler", "~> 1.7"
spec.add_development_dependency "rake", "~> 10.0"
+ spec.add_development_dependency "rspec", "~> 3.2.0"
end
|
Add rspec as development dependency
|
diff --git a/lib/active_force/active_query.rb b/lib/active_force/active_query.rb
index abc1234..def5678 100644
--- a/lib/active_force/active_query.rb
+++ b/lib/active_force/active_query.rb
@@ -22,13 +22,11 @@ end
end
+ alias_method :all, :to_a
+
def count
super
sfdc_client.query(to_s).first.expr0
- end
-
- def all
- to_a
end
def limit limit
|
Implement a alias method for "all".
|
diff --git a/test/coverage_loader.rb b/test/coverage_loader.rb
index abc1234..def5678 100644
--- a/test/coverage_loader.rb
+++ b/test/coverage_loader.rb
@@ -1,5 +1,5 @@ unless ENV['COVERAGE'] == 'off'
- COVERAGE_THRESHOLD = 95
+ COVERAGE_THRESHOLD = 96
require 'simplecov'
require 'simplecov-rcov'
require 'coveralls'
@@ -16,8 +16,9 @@ SimpleCov.at_exit do
SimpleCov.result.format!
percent = SimpleCov.result.covered_percent
+ puts "Coverage is #{'%.2f' % percent}%"
unless percent >= COVERAGE_THRESHOLD
- puts "Coverage must be above #{COVERAGE_THRESHOLD}%. It is #{'%.2f' % percent}%"
+ puts "Coverage must be above #{COVERAGE_THRESHOLD}%"
Kernel.exit(1)
end
end
|
Boost coverage to current level
|
diff --git a/lib/faststep/collection.rb b/lib/faststep/collection.rb
index abc1234..def5678 100644
--- a/lib/faststep/collection.rb
+++ b/lib/faststep/collection.rb
@@ -9,7 +9,10 @@ end
def rename(new_name)
- connection["admin"].command(:renameCollection => ns, :to => "#{db.name}.#{new_name}")
+ command = BSON::OrderedHash.new
+ command[:renameCollection] = ns
+ command[:to] = "#{db.name}.#{new_name}"
+ connection["admin"].command(command)
@name = new_name
true
end
|
Fix rename to use ordered hash to run on non-1.9 Rubies
|
diff --git a/cookbooks/firefox/attributes/tarball.rb b/cookbooks/firefox/attributes/tarball.rb
index abc1234..def5678 100644
--- a/cookbooks/firefox/attributes/tarball.rb
+++ b/cookbooks/firefox/attributes/tarball.rb
@@ -1,5 +1,5 @@-default['firefox']['tarball']['version'] = '31.6.0esr'
-default['firefox']['tarball']['download_url'] = "http://releases.mozilla.org/pub/firefox/releases/#{node['firefox']['tarball']['version']}/linux-#{kernel['machine']}/en-US/firefox-#{node['firefox']['tarball']['version']}.tar.bz2"
+default['firefox']['tarball']['version'] = '38.4.0esr'
+default['firefox']['tarball']['download_url'] = "https://releases.mozilla.org/pub/firefox/releases/#{node['firefox']['tarball']['version']}/linux-#{kernel['machine']}/en-US/firefox-#{node['firefox']['tarball']['version']}.tar.bz2"
# Required distro packages, preconfigured for Ubuntu 12.04
default['firefox']['tarball']['package_dependencies'] = %w(libasound2 libatk1.0-0 libc6 libcairo2 libdbus-1-3 libdbus-glib-1-2 libfontconfig1 libfreetype6 libgcc1 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk2.0-0 libnotify4 libpango1.0-0 libstartup-notification0 libstdc++6 libx11-6 libxext6 libxrender1 libxt6 lsb-release)
|
Update Firefox ESR version and download over https
|
diff --git a/db/migrate/20190524144913_add_global_offsets_to_annotations.rb b/db/migrate/20190524144913_add_global_offsets_to_annotations.rb
index abc1234..def5678 100644
--- a/db/migrate/20190524144913_add_global_offsets_to_annotations.rb
+++ b/db/migrate/20190524144913_add_global_offsets_to_annotations.rb
@@ -6,10 +6,22 @@ add_column :content_annotations, :global_end_offset, :integer
ANNOTATABLES.each do |klass|
+ # Calculate global annotation offsets using the version of HTMLUtils
+ # sanitization in place at the time the annotation was created.
klass.annotated.find_each do |instance|
- nodes = HTMLUtils.parse(instance.content).at('body').children
- breakpoints = AnnotationConverter.nodes_to_breakpoints(nodes)
- instance.annotations.find_each do |a|
+ # cache these to reduce DB access and parsing time
+ utils = nil
+ breakpoints = nil
+
+ instance.annotations.order(created_at: :asc).find_each do |a|
+ # invalidate cached items if needed
+ date = [a.created_at, HTMLUtils::V3::EFFECTIVE_DATE].min
+ new_utils = HTMLUtils.at(date)
+ if new_utils != utils
+ utils = new_utils
+ nodes = HTMLUtils.parse(utils.sanitize(instance.raw_content.content)).at('body').children
+ breakpoints = AnnotationConverter.nodes_to_breakpoints(nodes)
+ end
# use update_columns to avoid touching the timestamps
a.update_columns [:start, :end].map { |position|
["global_#{position}_offset",
|
Update migration to calc annotation offsets relative to date created
|
diff --git a/spec/controllers/profiles/notifications_controller_spec.rb b/spec/controllers/profiles/notifications_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/profiles/notifications_controller_spec.rb
+++ b/spec/controllers/profiles/notifications_controller_spec.rb
@@ -0,0 +1,46 @@+require 'spec_helper'
+
+describe Profiles::NotificationsController do
+ describe 'GET show' do
+ it 'renders' do
+ user = create_user
+ sign_in(user)
+
+ get :show
+ expect(response).to render_template :show
+ end
+ end
+
+ describe 'POST update' do
+ it 'updates only permitted attributes' do
+ user = create_user
+ sign_in(user)
+
+ put :update, user: { notification_email: 'new@example.com', admin: true }
+
+ user.reload
+ expect(user.notification_email).to eq('new@example.com')
+ expect(user.admin).to eq(false)
+ expect(controller).to set_flash[:notice].to('Notification settings saved')
+ end
+
+ it 'shows an error message if the params are invalid' do
+ user = create_user
+ sign_in(user)
+
+ put :update, user: { notification_email: '' }
+
+ expect(user.reload.notification_email).to eq('original@example.com')
+ expect(controller).to set_flash[:alert].to('Failed to save new settings')
+ end
+ end
+
+ def create_user
+ create(:user) do |user|
+ user.emails.create(email: 'original@example.com')
+ user.emails.create(email: 'new@example.com')
+ user.update(notification_email: 'original@example.com')
+ user.save!
+ end
+ end
+end
|
Add controller spec for Profiles::NotificationsController
|
diff --git a/lib/eshealth/clusterconfig.rb b/lib/eshealth/clusterconfig.rb
index abc1234..def5678 100644
--- a/lib/eshealth/clusterconfig.rb
+++ b/lib/eshealth/clusterconfig.rb
@@ -24,8 +24,8 @@ rescue => e
$stderr.puts "Unable to retrieve config: #{e}"
end
- response.split(/\s+/).each do |line|
- datanode, master = line.split(" ")
+ response.split("\n").each do |line|
+ datanode, master = line.split(/\s+/)
if /.*d.*/.match(datanode) && master != "-"
self.lastmsg = "Data node is configured as possible master"
return "red"
|
Fix to last commit, split in the wrong place
|
diff --git a/lib/github/nippou/user_events.rb b/lib/github/nippou/user_events.rb
index abc1234..def5678 100644
--- a/lib/github/nippou/user_events.rb
+++ b/lib/github/nippou/user_events.rb
@@ -11,7 +11,7 @@ end
def retrieve
- user_events = @client.user_events(@user)
+ user_events = @client.user_events(@user, per_page: 100)
last_response = @client.last_response
while last_response.rels[:next] && in_range?(user_events.last)
|
Change pagination parameter for performance
|
diff --git a/lib/jiraSOAP/macruby_stuff.rb b/lib/jiraSOAP/macruby_stuff.rb
index abc1234..def5678 100644
--- a/lib/jiraSOAP/macruby_stuff.rb
+++ b/lib/jiraSOAP/macruby_stuff.rb
@@ -7,6 +7,8 @@ def initialize(url_string)
@url = NSURL.URLWithString url_string
end
+
+ alias_method absoluteString to_s
end
module JIRA
|
Add another MacRuby extension to the URL class
|
diff --git a/lib/benchtool/app-config.rb b/lib/benchtool/app-config.rb
index abc1234..def5678 100644
--- a/lib/benchtool/app-config.rb
+++ b/lib/benchtool/app-config.rb
@@ -1,50 +1,46 @@ module BenchTool
# A structureless datastore; loads and persists to a YML file in a configured location
- module AppConfig
+ class AppConfig
CONFIG_DIR = File.expand_path('./config')
CONFIG_FILE = 'configuration.yml'
CONFIG_PATH = File.join(CONFIG_DIR, CONFIG_FILE)
+ APP_CONFIG_DIR = File.expand_path(File.dirname(__FILE__))
- @@options = {}
-
- # Load config
- def self.load
- @@options = fetch
+ def initialize
+ @options ||= fetch
end
- # Safe method to reload new settings
- def self.reload
- options = fetch rescue nil
- @@options = options || {}
+ # Return config as hash
+ def to_hash
+ @options
end
-
- # Get configuration option
- def self.[](key)
- @@options[key.to_s]
- end
-
- # Get configuration option by attribute
- def self.method_missing(method, *args)
- @@options[method.to_s]
- end
-
- # Returns true if configuration key exists
- def self.exist?(key)
- @@options.key?(key)
- end
-
- protected
+
+ private
# Get options from configuration file
- def self.fetch
- if File.exists?(File.join(CONFIG_DIR, CONFIG_FILE))
- @@options = YAML::load(File.open(CONFIG_PATH))
- else
- @@options = {}
- end
- @@options.deep_symbolize
+ def fetch
+ setup unless config_exists?
+ console "Loading config from #{CONFIG_PATH}"
+ @options = YAML::load(File.open(CONFIG_PATH))
+ @options.deep_symbolize
+ end
+
+ def config_exists?
+ File.exists?(CONFIG_PATH)
+ end
+
+ def setup
+ FileUtils.mkdir_p(CONFIG_DIR)
+ FileUtils.cp(File.join(APP_CONFIG_DIR, 'configuration.yml.base'), CONFIG_PATH)
+ console "Default configuration was established in the cwd!"
+ console ""
+ console "NOTICE: The application will exit now. Edit the contents of the config file before proceeeding!"
+ console ""
+ console "Config file path:"
+ console " #{CONFIG_PATH}"
+ exit 0
end
end # module AppConfig
-end # module BenchTool+end # module BenchTool
|
Refactor as class, add setup, and remove cruft
|
diff --git a/lib/quickbooks/service/cdc.rb b/lib/quickbooks/service/cdc.rb
index abc1234..def5678 100644
--- a/lib/quickbooks/service/cdc.rb
+++ b/lib/quickbooks/service/cdc.rb
@@ -11,7 +11,7 @@
def fetch_changes(models, start_time)
response = {}
- get_response = do_http_get(url_for_cdc(models, start_time))
+ get_response = do_http_get(url_for_cdc(models, start_time.iso8601))
change_responses = @last_response_xml.xpath("//xmlns:IntuitResponse/xmlns:CDCResponse")
models.each_index do |index|
|
Format date-time into ISO 8601
|
diff --git a/lib/tasks/publishing_api.rake b/lib/tasks/publishing_api.rake
index abc1234..def5678 100644
--- a/lib/tasks/publishing_api.rake
+++ b/lib/tasks/publishing_api.rake
@@ -0,0 +1,23 @@+namespace :publishing_api do
+ desc "Send all related items to the publishing-api again"
+ task republish_related_links: [:environment] do
+ artefacts = Artefact.where(
+ # Whitehall artefacts can't have related artefacts (the form is hidden).
+ :owning_app.nin => ["whitehall"],
+
+ # Artefacts without content_id are so old that they're not in the
+ # publishing-api and don't need to be.
+ :content_id.nin => [nil]
+ )
+
+ artefacts.each do |artefact|
+ print "."
+ Rails.application.publishing_api_v2.patch_links(
+ artefact.content_id,
+ links: {
+ ordered_related_items: artefact.related_artefacts.map(&:content_id).compact
+ }
+ )
+ end
+ end
+end
|
Add rake task to republish all related links
Since https://github.com/alphagov/panopticon/pull/396 we're sending the
related artefacts in the links hash to the publishing-api. This commit
adds a rake task that republishes all the related links, so that the
publishing-api is up to date.
|
diff --git a/lib/yarrow/html/asset_tags.rb b/lib/yarrow/html/asset_tags.rb
index abc1234..def5678 100644
--- a/lib/yarrow/html/asset_tags.rb
+++ b/lib/yarrow/html/asset_tags.rb
@@ -1,6 +1,6 @@ module Yarrow
module HTML
- module AssetTags
+ module AssetTags
include Yarrow::Configurable
# TODO: make sprockets manifest optional/pluggable
@@ -11,44 +11,49 @@ ##
# Computes the base URL path to assets in the public web directory.
def base_url_path
- raise Yarrow::ConfigurationError if config.assets.nil?
- raise Yarrow::ConfigurationError if config.output_dir.nil?
+ if config.assets.nil? || config.output_dir.nil?
+ raise Yarrow::ConfigurationError
+ end
# TODO: prepend configurable CDN URL for host path
# TODO: dev/production mode switch
- assets_path = config.assets.output_dir
- assets_path.gsub(config.output_dir, '')
+ config.assets.output_dir.gsub(config.output_dir, '')
end
def script_tags
- manifest.js_logical_paths.map { |asset_path| script_tag(asset: asset_path) }.join("\n")
+ manifest.js_logical_paths.map { |path| script_tag(asset: path) }.join("\n")
end
- # TODO: support asset path option?
def script_tag(options)
- if options.has_key? :asset and manifest.exists? options[:asset]
- script_path = manifest.digest_path(options[:asset])
- src_path = "#{base_url_path}/#{script_path}"
+ src_path = if asset_in_manifest?(options)
+ digest_path(options[:asset])
else
- src_path = options[:src]
+ options[:src]
end
"<script src=\"#{src_path}\"></script>"
end
- # TODO: support asset path option?
def link_tag(options)
- if options.has_key? :asset and manifest.exists? options[:asset]
- stylesheet_path = manifest.digest_path(options[:asset])
- href_path = "#{base_url_path}/#{stylesheet_path}"
+ href_path = if asset_in_manifest?(options)
+ digest_path(options[:asset])
else
- href_path = options[:href]
+ options[:href]
end
"<link href=\"#{href_path}\" rel=\"stylesheet\" type=\"text/css\">"
end
+ private
+
+ def asset_in_manifest?(options)
+ options.has_key?(:asset) and manifest.exists?(options[:asset])
+ end
+
+ def digest_path(path)
+ "#{base_url_path}/#{manifest.digest_path(path)}"
+ end
end
end
end
|
Refactor asset tags builder to remove duplicate mess
|
diff --git a/lib/cocoa_pods/resolver.rb b/lib/cocoa_pods/resolver.rb
index abc1234..def5678 100644
--- a/lib/cocoa_pods/resolver.rb
+++ b/lib/cocoa_pods/resolver.rb
@@ -12,7 +12,11 @@
def find_dependency_sets(specification)
specification.read(:dependencies).each do |dependency|
- Source.search(dependency).each do |set|
+ sets = Source.search(dependency)
+ if sets.empty?
+ raise "Unable to find a pod named `#{dependency.name}'"
+ end
+ sets.each do |set|
# TODO ultimately this compatibility check should be used to try and
# resolve the conflicts, but for now we'll keep it simple.
if existing_set = @sets.find { |s| s == set }
|
Raise when a pod can't be found by name.
|
diff --git a/lib/css_splitter/engine.rb b/lib/css_splitter/engine.rb
index abc1234..def5678 100644
--- a/lib/css_splitter/engine.rb
+++ b/lib/css_splitter/engine.rb
@@ -1,7 +1,5 @@ module CssSplitter
class Engine < ::Rails::Engine
- isolate_namespace CssSplitter
-
initializer 'css_splitter.sprockets_engine', after: 'sprockets.environment', group: :all do |app|
app.config.assets.configure do |assets|
assets.register_bundle_processor 'text/css', CssSplitter::SprocketsEngine
|
Remove isolate_namespace to fix unresolved split_stylesheet_link_tag
|
diff --git a/lib/tasks/knapsack_minitest.rake b/lib/tasks/knapsack_minitest.rake
index abc1234..def5678 100644
--- a/lib/tasks/knapsack_minitest.rake
+++ b/lib/tasks/knapsack_minitest.rake
@@ -4,7 +4,7 @@ namespace :knapsack do
Rake::TestTask.new(:minitest_run) do |t|
t.libs << 'test'
- t.test_files = Knapsack::AllocatorBuilder.new(Knapsack::Adapters::MinitestAdapter).allocator.node_tests
+ t.test_files = ENV['KNAPSACK_MINITEST_TEST_FILES'].to_s.split(' ')
end
task :minitest, [:minitest_args] do |_, args|
@@ -18,7 +18,7 @@ puts allocator.leftover_node_tests
puts
- cmd = %Q[TESTOPTS="#{args[:minitest_args]}" bundle exec rake knapsack:minitest_run]
+ cmd = %Q[TESTOPTS="#{args[:minitest_args]}" KNAPSACK_MINITEST_TEST_FILES="#{allocator.stringify_node_tests}" bundle exec rake knapsack:minitest_run]
system(cmd)
exit($?.exitstatus)
|
Fix build - pass test files via ENV to avoid cached report path
|
diff --git a/lib/travis/hub/error_reporter.rb b/lib/travis/hub/error_reporter.rb
index abc1234..def5678 100644
--- a/lib/travis/hub/error_reporter.rb
+++ b/lib/travis/hub/error_reporter.rb
@@ -19,12 +19,15 @@
def pop
begin
- error = queue.pop
- Hubble.report(error)
- Travis.logger.error("Hub error: #{error.message}")
+ handle(queue.pop)
rescue => e
puts "Error handling error: #{e.message}"
end
+ end
+
+ def handle(error)
+ Hubble.report(error)
+ Travis.logger.error("Hub error: #{error.message}")
end
def self.enqueue(error)
|
Move handling the error into separate method.
|
diff --git a/soulless.gemspec b/soulless.gemspec
index abc1234..def5678 100644
--- a/soulless.gemspec
+++ b/soulless.gemspec
@@ -22,7 +22,7 @@ spec.add_dependency 'activemodel', '>= 4.2.0', '< 5.2'
spec.add_dependency 'virtus' , '~> 1.0'
- spec.add_development_dependency 'bundler', '~> 0'
- spec.add_development_dependency 'rake', '~> 0'
+ spec.add_development_dependency 'bundler', '>= 0'
+ spec.add_development_dependency 'rake', '>= 0'
spec.add_development_dependency 'rspec', '~> 3.0'
end
|
Fix issues with dependency definitions
|
diff --git a/delayed-plugins-mutex.gemspec b/delayed-plugins-mutex.gemspec
index abc1234..def5678 100644
--- a/delayed-plugins-mutex.gemspec
+++ b/delayed-plugins-mutex.gemspec
@@ -19,6 +19,7 @@ gem.require_paths = ["lib"]
# Dependencies are not using versions so that there are few version conflicts for users.
+ gem.add_dependency("activerecord", [">= 3.0", "< 5.0"])
gem.add_dependency('delayed_job')
gem.add_development_dependency('rake')
|
Add dependency to active record
|
diff --git a/lib/ipsummer/lengthable.rb b/lib/ipsummer/lengthable.rb
index abc1234..def5678 100644
--- a/lib/ipsummer/lengthable.rb
+++ b/lib/ipsummer/lengthable.rb
@@ -6,18 +6,10 @@ def length_min
if min_no_max?
min
- elsif max_no_min?
- if max < default_min
- low_limit
- else
- default_min
- end
- elsif min_and_max?
- if min <= max
- min
- else
- default_min
- end
+ elsif max_no_min? && max < default_min
+ low_limit
+ elsif min_and_max? && min <= max
+ min
else
default_min
end
@@ -26,18 +18,10 @@ def length_max
if max_no_min?
max
- elsif min_no_max?
- if min > default_max
- high_limit
- else
- default_max
- end
- elsif min_and_max?
- if min <= max
- max
- else
- default_max
- end
+ elsif min_no_max? && min > default_max
+ high_limit
+ elsif min_and_max? && min <= max
+ max
else
default_max
end
|
Refactor Lengthable length_min and length_max
|
diff --git a/test/test_helper.rb b/test/test_helper.rb
index abc1234..def5678 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
-class Test::Unit::TestCase
+class ActiveSupport::TestCase
# Transactional fixtures accelerate your tests by wrapping each test method
# in a transaction that's rolled back on completion. This ensures that the
# test database remains unchanged so your fixtures don't have to be reloaded
|
Fix test case declaration - Rails upgrade
|
diff --git a/test/test_helper.rb b/test/test_helper.rb
index abc1234..def5678 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -1,5 +1,6 @@ gem "minitest"
require "minitest/autorun"
+require "minitest/pride"
require "minitest/mock"
require "minitest/stub_any_instance"
require 'coveralls'
|
Add minitest/pride because PRETTY COLOURS
|
diff --git a/digest-cksum.gemspec b/digest-cksum.gemspec
index abc1234..def5678 100644
--- a/digest-cksum.gemspec
+++ b/digest-cksum.gemspec
@@ -5,6 +5,7 @@ s.summary = "Unix cksum implementation"
s.author = "Mal Clrambault"
s.email = "mael@clerambault.fr"
+ s.homepage = "http://github.com/hanklords/digest-cksum"
s.files = %w(lib/digest/cksum.rb)
s.version = "0.1"
end
|
Add a homepage to the gemspec
|
diff --git a/lib/figs/tasks/install.rake b/lib/figs/tasks/install.rake
index abc1234..def5678 100644
--- a/lib/figs/tasks/install.rake
+++ b/lib/figs/tasks/install.rake
@@ -1,34 +1,34 @@ require 'erb'
require 'pathname'
+require 'figs/figfile'
desc 'Install Fig'
task :install do |task, args|
base_dir = Pathname.new('.')
+ locations = args.extras.empty? ? "application.yml" : args.extras
+ figfile = Figs::Figfile.new(*locations)
+
+ create_figfile base_dir, figfile
+ create_non_existent_yaml(figfile.locations) if figfile.method.eql?("path")
+
+ puts "[Done] Enjoy your figs sir!"
+end
+
+def create_figfile base_dir, figfile
puts "Figsifying #{base_dir}/ ..."
- locations = args.extras || "application.yml"
- method = locations.first.downcase.end_with?(".git") ? "git" : "path"
-
- puts "Figs yaml located at #{locations.join(", ")} using #{method} method."
-
file = base_dir.join('Figfile')
File.open(file, 'w+') do |f|
- f.write("location: ")
- locations.each { |location| f.write("\n - #{location}")}
- f.write("\nmethod: #{method}")
+ f.write(figfile.to_yaml)
end
-
- if method.eql?("path")
- locations.each do |location|
- if !File.exists?(location)
- puts "[Add] #{location} does not exist, creating."
- application_yml = File.expand_path("../../templates/application.yml", __FILE__)
- template = File.read(application_yml)
- file = location
- File.open(file, 'w+') do |f|
- f.write(ERB.new(template).result(binding))
- end
+end
+
+def create_non_existent_yaml locations
+ locations.each do |file|
+ if !File.exists?(file)
+ puts "[Add] #{file} does not exist, creating."
+ application_yml = File.expand_path("../../templates/application.yml", __FILE__)
+ File.open(file, 'w+') do |f|
+ f.write(ERB.new(File.read(application_yml)).result(binding))
end
end
end
-
- puts "[Done] Enjoy your figs sir!"
end
|
Implement figfile object in rake
|
diff --git a/lib/govuk_content_models.rb b/lib/govuk_content_models.rb
index abc1234..def5678 100644
--- a/lib/govuk_content_models.rb
+++ b/lib/govuk_content_models.rb
@@ -1,4 +1,5 @@ require "govuk_content_models/version"
+require "mongoid"
module GovukContentModels
class Engine < Rails::Engine
|
Load Mongoid when being an Engine.
|
diff --git a/lib/harbor/test/response.rb b/lib/harbor/test/response.rb
index abc1234..def5678 100644
--- a/lib/harbor/test/response.rb
+++ b/lib/harbor/test/response.rb
@@ -2,14 +2,30 @@ module Test
class Response < Harbor::Response
- attr_accessor :request
+ attr_accessor :request, :context
##
# We redefine Harbor::Response.initialize(request) with an empty arg
# variant for use with a container.
##
def initialize
+ self.context = []
super(nil)
+ end
+
+ ##
+ # Gives us access to the context, so instance variables can be assessed
+ ##
+ def render(view, context = {})
+ self.context << context
+ super(view, context)
+ end
+
+ ##
+ # Cycle handles multi-render actions
+ ##
+ def render_context(cycle = 0)
+ context[cycle]
end
end
|
Allow Test::Response access to the context.
|
diff --git a/db/migrate/20190801143910_remove_legacy_columns_from_page.rb b/db/migrate/20190801143910_remove_legacy_columns_from_page.rb
index abc1234..def5678 100644
--- a/db/migrate/20190801143910_remove_legacy_columns_from_page.rb
+++ b/db/migrate/20190801143910_remove_legacy_columns_from_page.rb
@@ -0,0 +1,7 @@+# removes intermediary columns left over from moving data
+class RemoveLegacyColumnsFromPage < ActiveRecord::Migration[5.2]
+ def change
+ remove_column :pageflow_pages, :legacy_template, :string
+ remove_column :pageflow_pages, :legacy_configuration, :text
+ end
+end
|
Remove unused legacy columns from pages table
|
diff --git a/lib/knife-solo/berkshelf.rb b/lib/knife-solo/berkshelf.rb
index abc1234..def5678 100644
--- a/lib/knife-solo/berkshelf.rb
+++ b/lib/knife-solo/berkshelf.rb
@@ -40,7 +40,11 @@ end
def initial_config
- 'site :opscode'
+ if Gem::Version.new(::Berkshelf::VERSION) >= Gem::Version.new("3.0.0")
+ 'source "https://api.berkshelf.com"'
+ else
+ 'site :opscode'
+ end
end
end
end
|
Update source location for Berkshelf 3.0
|
diff --git a/lib/interrogate.rb b/lib/interrogate.rb
index abc1234..def5678 100644
--- a/lib/interrogate.rb
+++ b/lib/interrogate.rb
@@ -1,6 +1,6 @@ require "interrogate/version"
-# String?(\"Hello\")
+# String?("Hello")
# Interrogate attempts to bring Scheme-like class predication to Ruby.
# It provides an alternate syntax using Module#===
module Interrogate
|
Fix escaping of quotations in comment
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.