diff stringlengths 65 26.7k | message stringlengths 7 9.92k |
|---|---|
diff --git a/app/graphql/resolvers/developer_resolver.rb b/app/graphql/resolvers/developer_resolver.rb
index abc1234..def5678 100644
--- a/app/graphql/resolvers/developer_resolver.rb
+++ b/app/graphql/resolvers/developer_resolver.rb
@@ -17,6 +17,15 @@ def call
developer = Developer.find_by_login(params[:id])
return developer unless developer.nil?
+
+ FetchDeveloperLanguagesWorker.perform_async(
+ params[:id], current_user.try(:access_token)
+ ) unless Rails.cache.exist?(['developer', params[:id], 'languages'])
+
+ FetchDeveloperOrgsWorker.perform_async(
+ params[:id], current_user.try(:access_token)
+ ) unless Rails.cache.exist?(['developer', params[:id], 'organizations'])
+
api = Github::Api.new(current_user.try(:access_token))
api.fetch_developer(params[:id])
end
| Add workers for fetching orgs
|
diff --git a/lib/changelog_driver.rb b/lib/changelog_driver.rb
index abc1234..def5678 100644
--- a/lib/changelog_driver.rb
+++ b/lib/changelog_driver.rb
@@ -3,50 +3,7 @@ class ChangelogDriver
attr_accessor :ancestor, :current, :other
- # def initialize(ancestor, current, other)
- # # ancestor = File.readlines ancestor
- # # @file_header = parse_header ancestor
- # #
- # # @ancestor = parse_changelog ancestor.drop(@file_header.count)
- # # # @current = File.readlines current
- # # # @other = File.readlines other
- # end
-
- def parse_header(file)
- header = []
-
- file.each do |line|
- if line =~ /^[^#]/ || line[0,3].count('#') == 1
- header << line
- else
- return header
- end
- end
+ def initialize(ancestor, current, other)
+ parser = ChangelogParser.new
end
-
- def parse_changelog(lines)
- descriptions = []
- sub_container = {}
- container = {}
-
- lines.reverse.each do |line|
- if line =~ /^[^#]/
- descriptions.unshift line
- else
- if hashes = line[0,3].count('#') == 3
- sub_container[line] = descriptions
-
- descriptions = []
- else
- container[line] = sub_container
-
- sub_container = {}
- descriptions = []
- end
- end
- end
-
- container
- end
-
end
| Remove parsing logic from the driver.
|
diff --git a/lib/dimensions-rails.rb b/lib/dimensions-rails.rb
index abc1234..def5678 100644
--- a/lib/dimensions-rails.rb
+++ b/lib/dimensions-rails.rb
@@ -14,7 +14,7 @@ # https://developers.google.com/speed/docs/best-practices/rendering#SpecifyImageDimensions
#
def image_tag source, options = {}
- unless options[:size]
+ unless options[:size] or options[:width] or options[:height]
fs_path = asset_paths.asset_for(source, nil)
if fs_path.present?
options[:width], options[:height] = ::Dimensions.dimensions(fs_path.to_path)
| Check if width or height have been set too |
diff --git a/lib/ebay/api_helpers.rb b/lib/ebay/api_helpers.rb
index abc1234..def5678 100644
--- a/lib/ebay/api_helpers.rb
+++ b/lib/ebay/api_helpers.rb
@@ -34,12 +34,34 @@ end
def extract_values(api_response)
- response = Hashie::Mash.new(api_response.body.values.first).freeze
+ response_hash = api_response.body.values.first
+ normalize_values!(response_hash)
+ response = Hashie::Mash.new(response_hash).freeze
if response.ack != 'Success'
raise ApiError, response.errors
end
response
end
+ def normalize_values!(hash)
+ hash.each do |key, value|
+ case value
+ when /^\d+$/
+ hash[key] = value.to_i
+ when /^\d*\.\d+$/
+ hash[key] = value.to_f
+ when Hash
+ if key =~ /_array$/
+ array = value.values.first
+ array = [array] unless array.is_a?(Array)
+ array.each {|item| normalize_values!(item) if item.is_a?(Hash)}
+ hash[key] = array
+ else
+ normalize_values!(value)
+ end
+ end
+ end
+ end
+
end
end
| Normalize response hash by converting values to int, float, and array
|
diff --git a/lib/fingerjam/jammit.rb b/lib/fingerjam/jammit.rb
index abc1234..def5678 100644
--- a/lib/fingerjam/jammit.rb
+++ b/lib/fingerjam/jammit.rb
@@ -3,7 +3,11 @@
# Used by rake fingerjam:package
def rewrite_asset_path(relative_path, absolute_path)
- Fingerjam::Base.save_cached_url_from_path(relative_path, absolute_path)
+ if File.exist?(absolute_path)
+ Fingerjam::Base.save_cached_url_from_path(relative_path, absolute_path)
+ else
+ relative_path
+ end
end
end
| Check for file existence before trying to md5sum |
diff --git a/lib/fivemat/cucumber.rb b/lib/fivemat/cucumber.rb
index abc1234..def5678 100644
--- a/lib/fivemat/cucumber.rb
+++ b/lib/fivemat/cucumber.rb
@@ -3,7 +3,7 @@ module Fivemat
class Cucumber < ::Cucumber::Formatter::Progress
def before_feature(feature)
- @io.print "#{feature.file} "
+ @io.print "#{feature.short_name} "
@io.flush
@exceptions = []
end
| Use a feature's name instead of file in output
|
diff --git a/lib/frakup/backupset.rb b/lib/frakup/backupset.rb
index abc1234..def5678 100644
--- a/lib/frakup/backupset.rb
+++ b/lib/frakup/backupset.rb
@@ -23,7 +23,7 @@
$log.info " Created Backupset ##{backupset.id}"
- Pathname.glob(File.join(source, "*")).each do |f|
+ Pathname.glob(File.join(source, "**", "*")).each do |f|
Backupelement.store(backupset, f)
end
| Fix bug where iteration over files wasn't recursive.
|
diff --git a/lib/pronto/slim_lint.rb b/lib/pronto/slim_lint.rb
index abc1234..def5678 100644
--- a/lib/pronto/slim_lint.rb
+++ b/lib/pronto/slim_lint.rb
@@ -15,8 +15,8 @@ end
def inspect(patch)
- runner = SlimLint::Runner.new
- lints = runner.run(files: [patch.new_file_full_path]).lints
+ runner = ::SlimLint::Runner.new
+ lints = runner.run(files: [patch.new_file_full_path.to_s]).lints
lints.map do |lint|
patch.added_lines.select { |line| line.new_lineno == lint.line }
.map { |line| new_message(lint, line) }
| Fix how Slim-lint is called
|
diff --git a/lib/tasks/oa_setup.rake b/lib/tasks/oa_setup.rake
index abc1234..def5678 100644
--- a/lib/tasks/oa_setup.rake
+++ b/lib/tasks/oa_setup.rake
@@ -0,0 +1,99 @@+task :oa_setup => :environment do
+
+ account_id = Account.find(1).id
+
+ puts "Would you like to delete past data? y/n"
+ response = STDIN.gets.chomp
+ if response == "y"
+ User.destroy_all
+ Assessment.destroy_all
+ AssessmentSetting.destroy_all
+ puts "Past data deleted"
+ end
+
+ # Prompts user for the email address to be used for signing in to OA
+ puts "Please enter your email"
+ email = STDIN.gets
+
+ # Prompts user for the password to be used for signing in to OA
+ puts "Please enter your password (at least 8 characters)"
+ password = STDIN.noecho(&:gets).chomp
+
+ # Creates a user object
+ # email: [User Entry] password: password
+ user = User.create(
+ email: email,
+ password: password,
+ remember_created_at: Time.now,
+ confirmation_sent_at: Time.now,
+ role: 2,
+ confirmed_at: Time.now,
+ current_sign_in_at: Time.now,
+ account_id: account_id
+ )
+ user.add_to_role("administrator")
+ puts "User created"
+
+ # Creates the Formative, Summative, and Show What You Know quizzes
+ formative_assessment = Assessment.create(
+ title: "Formative Quiz Example",
+ description: "Use this to test formative quizzes.",
+ user_id: user.id,
+ account_id: account_id,
+ kind: "formative"
+ )
+ puts "Created Formative Assessment"
+
+ summative_assessment = Assessment.create(
+ title: "Summative Quiz Example",
+ description: "Use this to test formative quizzes.",
+ user_id: user.id,
+ account_id: account_id,
+ kind: "summative"
+ )
+ puts "Created Summative Assessment"
+
+ swyk_assessment = Assessment.create(
+ title: "Show What You Know Quiz Example",
+ description: "Use this to test show what you know quizzes.",
+ user_id: user.id,
+ account_id: account_id,
+ kind: "show_what_you_know"
+ )
+ puts "Created Show What You Know Assessment"
+
+ Assessment.all.each do |assessment|
+ File.open("spec/fixtures/swyk_quiz.xml") do |file|
+ assessment.xml_file = file
+ assessment.save!
+ end
+
+ AssessmentSetting.create(
+ assessment_id: assessment.id,
+ account_id: account_id,
+ style: "lumen_learning",
+ enable_start: true,
+ mode: "formative",
+ confidence_levels: true
+ )
+ end
+
+ # Defines summative-assessment-specific parameters
+ summative_as = AssessmentSetting.find_by assessment_id: summative_assessment.id
+ summative_as.update(
+ per_sec: 2,
+ allowed_attempts: 2
+ )
+ puts "Created Assessment Settings"
+
+ # Sets the account domain to 'localhost', and the key/secret to 'fake'
+ account = Account.find(1)
+ account.update(
+ domain: "localhost",
+ lti_key: "fake",
+ lti_secret: "fake"
+ )
+
+ puts "All done!"
+
+end
| Add rake task for setting up OA
Setup to get OA running with assessment loaded is
pretty tedious. Adding this rake tasks makes the
process smoother so developers can spend less time
on setup.
Test Plan:
-Run:
rake oa_setup
-If rake task is successful you should see a notice that says:
Creating User
Creating Assessment
Creating Assessment Settings
All done!
-Check if the records are created in rails console
|
diff --git a/abstract_class.gemspec b/abstract_class.gemspec
index abc1234..def5678 100644
--- a/abstract_class.gemspec
+++ b/abstract_class.gemspec
@@ -1,4 +1,4 @@-require File.expand_path("../lib/abstract_class/version", __FILE__)
+require File.expand_path('../lib/abstract_class/version', __FILE__)
Gem::Specification.new do |s|
s.name = 'abstract_class'
| Use single quotes in the gemspec
|
diff --git a/git-up.gemspec b/git-up.gemspec
index abc1234..def5678 100644
--- a/git-up.gemspec
+++ b/git-up.gemspec
@@ -8,7 +8,7 @@ s.name = "git-up"
s.version = GitUp::VERSION
s.platform = Gem::Platform::RUBY
- s.authors = ["Aanand Prasad", "Elliot Crosby-McCullough"]
+ s.authors = ["Aanand Prasad", "Elliot Crosby-McCullough", "Adrian Irving-Beer", "Joshua Wehner"]
s.email = ["aanand.prasad@gmail.com", "elliot.cm@gmail.com"]
s.homepage = "http://github.com/aanand/git-up"
s.summary = "git command to fetch and rebase all branches"
| Add Josh and Adrian to gemspec authors
|
diff --git a/spec/consumer_spec.rb b/spec/consumer_spec.rb
index abc1234..def5678 100644
--- a/spec/consumer_spec.rb
+++ b/spec/consumer_spec.rb
@@ -0,0 +1,82 @@+describe Kafka::Consumer do
+ let(:cluster) { double(:cluster) }
+ let(:log) { StringIO.new }
+ let(:logger) { Logger.new(log) }
+ let(:instrumenter) { Kafka::Instrumenter.new(client_id: "test", group_id: "test") }
+ let(:group) { double(:group) }
+ let(:offset_manager) { double(:offset_manager) }
+ let(:heartbeat) { double(:heartbeat) }
+ let(:fetch_operation) { double(:fetch_operation) }
+ let(:session_timeout) { 30 }
+ let(:assigned_partitions) { { "greetings" => [0] } }
+
+ let(:consumer) {
+ Kafka::Consumer.new(
+ cluster: cluster,
+ logger: logger,
+ instrumenter: instrumenter,
+ group: group,
+ offset_manager: offset_manager,
+ session_timeout: session_timeout,
+ heartbeat: heartbeat,
+ )
+ }
+
+ before do
+ allow(Kafka::FetchOperation).to receive(:new) { fetch_operation }
+
+ allow(cluster).to receive(:add_target_topics)
+ allow(cluster).to receive(:refresh_metadata_if_necessary!)
+
+ allow(offset_manager).to receive(:commit_offsets)
+ allow(offset_manager).to receive(:set_default_offset)
+ allow(offset_manager).to receive(:next_offset_for) { 42 }
+
+ allow(group).to receive(:subscribe)
+ allow(group).to receive(:leave)
+ allow(group).to receive(:member?) { true }
+ allow(group).to receive(:assigned_partitions) { assigned_partitions }
+
+ allow(heartbeat).to receive(:send_if_necessary)
+
+ allow(fetch_operation).to receive(:fetch_from_partition)
+ allow(fetch_operation).to receive(:execute) { fetched_batches }
+
+ consumer.subscribe("greetings")
+ end
+
+ describe "#each_message" do
+ let(:messages) {
+ [
+ Kafka::FetchedMessage.new(
+ value: "hello",
+ key: nil,
+ topic: "greetings",
+ partition: 0,
+ offset: 13,
+ )
+ ]
+ }
+
+ let(:fetched_batches) {
+ [
+ Kafka::FetchedBatch.new(
+ topic: "greetings",
+ partition: 0,
+ highwater_mark_offset: 42,
+ messages: messages,
+ )
+ ]
+ }
+
+ it "logs exceptions raised in the block" do
+ expect {
+ consumer.each_message do |message|
+ raise "hello"
+ end
+ }.to raise_exception(RuntimeError, "hello")
+
+ expect(log.string).to include "Exception raised when processing greetings/0 at offset 13 -- RuntimeError: hello"
+ end
+ end
+end
| Add a unit test of Consumer
|
diff --git a/sportngin-brew-gem.rb b/sportngin-brew-gem.rb
index abc1234..def5678 100644
--- a/sportngin-brew-gem.rb
+++ b/sportngin-brew-gem.rb
@@ -1,6 +1,6 @@ require 'formula'
-class SportBrewGem < Formula
+class SportnginBrewGem < Formula
homepage 'https://github.com/sportngin/brew-gem'
url 'https://github.com/sportngin/brew-gem/archive/master.tar.gz'
| Fix constant name for real
|
diff --git a/lib/splunk_logging.rb b/lib/splunk_logging.rb
index abc1234..def5678 100644
--- a/lib/splunk_logging.rb
+++ b/lib/splunk_logging.rb
@@ -7,6 +7,7 @@ def add_with_splunk(arg1, log_hash = nil, arg3 = nil, &block)
string = format_hash(log_hash).dup
string << " pid=#{Process.pid} "
+ string << " time=#{Time.now.to_i} "
add_without_splunk(arg1, string, arg3, &block)
end
def format_hash(hash)
| Add a timestamp to splunk-style logs
|
diff --git a/migration_tools.gemspec b/migration_tools.gemspec
index abc1234..def5678 100644
--- a/migration_tools.gemspec
+++ b/migration_tools.gemspec
@@ -6,7 +6,6 @@ s.authors = ["Morten Primdahl"]
s.files = `git ls-files lib`.split("\n")
s.license = "Apache-2.0"
- s.metadata['allowed_push_host'] = "https://zdrepo.jfrog.io/zdrepo/api/gems/gems-local/"
s.add_runtime_dependency "activerecord", '>= 3.2.6', '< 6.0'
| Revert "Added allowed push host"
This reverts commit fbd7e9ab0de5fb4958407078e554bff5a35c4364.
|
diff --git a/lib/tasks/rptman.rake b/lib/tasks/rptman.rake
index abc1234..def5678 100644
--- a/lib/tasks/rptman.rake
+++ b/lib/tasks/rptman.rake
@@ -1,4 +1,4 @@-require File.expand_path("#{File.dirname(__FILE__)}/../rptman.rb")
+require 'rptman'
namespace :rptman do
namespace :vs_projects do
| Update require so that it assumes that file is on the path
|
diff --git a/config/initializers/geocoder.rb b/config/initializers/geocoder.rb
index abc1234..def5678 100644
--- a/config/initializers/geocoder.rb
+++ b/config/initializers/geocoder.rb
@@ -2,11 +2,11 @@ # geocoding service (see below for supported options):
# :lookup => :google,
# # IP address geocoding service (see below for supported options):
- # :ip_lookup => :google,
- # :use_https => true,
+ :ip_lookup => :google,
+ :use_https => true,
#
# # to use an API key:
- # :api_key => ENV["GOOGLE_API_KEY"],
+ :api_key => ENV["GOOGLE_API_KEY"],
# geocoding service request timeout, in seconds (default 3):
:timeout => 10 # CHECK against avg time for API to return results.
| Change configs to add google
|
diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb
index abc1234..def5678 100644
--- a/config/initializers/omniauth.rb
+++ b/config/initializers/omniauth.rb
@@ -1,8 +1,10 @@ # frozen_string_literal: true
+
+OmniAuth.config.full_host = 'https://evemonk.com'
Rails.application.config.middleware.use OmniAuth::Builder do
provider :eve_online_sso,
Setting.eve_online_sso_client_id,
Setting.eve_online_sso_secret_key,
- scope: "esi-wallet.read_character_wallet.v1 esi-characters.read_loyalty.v1 esi-skills.read_skillqueue.v1 esi-skills.read_skills.v1 esi-assets.read_assets.v1"
+ scope: "esi-wallet.read_character_wallet.v1 esi-characters.read_loyalty.v1 esi-skills.read_skillqueue.v1 esi-skills.read_skills.v1 esi-assets.read_assets.v1 esi-location.read_location.v1 esi-location.read_online.v1 esi-location.read_ship_type.v1"
end
| Add full host name for OmniAuth. Add more scopes.
|
diff --git a/Library/Homebrew/test/test_bottle_hooks.rb b/Library/Homebrew/test/test_bottle_hooks.rb
index abc1234..def5678 100644
--- a/Library/Homebrew/test/test_bottle_hooks.rb
+++ b/Library/Homebrew/test/test_bottle_hooks.rb
@@ -0,0 +1,40 @@+require 'testing_env'
+require 'formula_installer'
+require 'hooks/bottles'
+
+class BottleHookTests < Test::Unit::TestCase
+ class FormulaDouble
+ def bottle; end
+ def local_bottle_path; end
+ def some_random_method; true; end
+ end
+
+ def setup
+ @fi = FormulaInstaller.new FormulaDouble.new
+ end
+
+ def test_has_bottle
+ Homebrew::Hooks::Bottles.setup_formula_has_bottle do |f|
+ f.some_random_method
+ end
+ assert_equal true, @fi.pour_bottle?
+ end
+
+ def test_has_no_bottle
+ Homebrew::Hooks::Bottles.setup_formula_has_bottle do |f|
+ !f.some_random_method
+ end
+ assert_equal false, @fi.pour_bottle?
+ end
+
+ def test_pour_formula_bottle
+ Homebrew::Hooks::Bottles.setup_formula_has_bottle do |f|
+ true
+ end
+
+ Homebrew::Hooks::Bottles.setup_pour_formula_bottle do |f|
+ f.some_random_method
+ end
+ @fi.pour
+ end
+end
| Add tests for new bottling hooks.
Closes Homebrew/homebrew#27890.
Signed-off-by: Mike McQuaid <a17fed27eaa842282862ff7c1b9c8395a26ac320@mikemcquaid.com>
|
diff --git a/spec/controllers/tags_controller_spec.rb b/spec/controllers/tags_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/tags_controller_spec.rb
+++ b/spec/controllers/tags_controller_spec.rb
@@ -19,6 +19,11 @@ end
describe "#show" do
+ before(:each) do
+ @tag = create(:tag)
+ @tag.questions << create(:question)
+ end
+
it "renders show template" do
get :show, {id: 2}
expect(response).to render_template("show")
| Move create into show tests
|
diff --git a/app/controllers/admin/platforms_controller.rb b/app/controllers/admin/platforms_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/admin/platforms_controller.rb
+++ b/app/controllers/admin/platforms_controller.rb
@@ -19,5 +19,10 @@
# See https://administrate-prototype.herokuapp.com/customizing_controller_actions
# for more information
+
+ # Disable destroy
+ def valid_action?(name, resource = resource_class)
+ %w[destroy].exclude?(name.to_s) && super
+ end
end
end
| Disable platform destroy in admin panel
|
diff --git a/doc/_plugins/custom.rb b/doc/_plugins/custom.rb
index abc1234..def5678 100644
--- a/doc/_plugins/custom.rb
+++ b/doc/_plugins/custom.rb
@@ -20,7 +20,7 @@ end
def runhaskell_(cmd)
- `runhaskell -i../src -fobject-code -outputdircache/ghc #{cmd}`
+ `runhaskell -i../src -fobject-code -outputdir.cache/ghc #{cmd}`
end
end
end
| doc: Store ghc intermediate files in /doc/.cache instead of /doc/cache/
|
diff --git a/config/initializers/mumukit_auth.rb b/config/initializers/mumukit_auth.rb
index abc1234..def5678 100644
--- a/config/initializers/mumukit_auth.rb
+++ b/config/initializers/mumukit_auth.rb
@@ -1,6 +1,6 @@ class Mumukit::Auth::Permissions
def accessible_organizations
- scope_for(:student)&.grants&.map { |grant| grant.instance_variable_get(:@first) }.to_set
+ scope_for(:student)&.grants&.map { |grant| grant.to_mumukit_slug.organization }.to_set
end
end
| Make accessible organizations more expressive
|
diff --git a/core/builtin_constants/builtin_constants.rb b/core/builtin_constants/builtin_constants.rb
index abc1234..def5678 100644
--- a/core/builtin_constants/builtin_constants.rb
+++ b/core/builtin_constants/builtin_constants.rb
@@ -0,0 +1,13 @@+require File.dirname(__FILE__) + '/../../spec_helper'
+
+describe "RUBY_VERSION" do
+ it "is a String" do
+ RUBY_VERSION.should be_kind_of(String)
+ end
+end
+
+describe "RUBY_PATCHLEVEL" do
+ it "is a Fixnum" do
+ RUBY_PATCHLEVEL.should be_kind_of(Fixnum)
+ end
+end | Add specs for RUBY_VERSION and RUBY_PATCHLEVEL.
|
diff --git a/lib/capistrano-deploy/newrelic.rb b/lib/capistrano-deploy/newrelic.rb
index abc1234..def5678 100644
--- a/lib/capistrano-deploy/newrelic.rb
+++ b/lib/capistrano-deploy/newrelic.rb
@@ -4,20 +4,17 @@ def self.load_into(configuration)
configuration.load do
- set(:api_key) { ENV['NEW_RELIC_API_KEY'] }
- set(:new_relic_app_name) { ENV['NEW_RELIC_APP_NAME'] }
- set(:new_relic_user) { (%x(users)).chomp }
+ set(:new_relic_user) { (%x(git config user.name)).chomp }
set(:current_revision) { capture("cd #{deploy_to} && git rev-parse HEAD").chomp }
set(:link) { "https://api.newrelic.com/deployments.xml" }
namespace :newrelic do
task :notice_deployment do
- run "curl -H '#{api_key}' -d 'deployment[app_name]=#{new_relic_app_name}' -d 'deployment[revision]=#{current_revision}' -d 'deployment[user]=#{new_relic_user}' #{link}"
+ run "curl -H '#{new_relic_api_key}' -d 'deployment[app_name]=#{new_relic_app_name}' -d 'deployment[revision]=#{current_revision}' -d 'deployment[user]=#{new_relic_user}' #{link}"
end
end
- after 'unicorn:reexec', 'newrelic:notice_deployment'
end
end
end
| Move new relic vairables outside the recipe
* Move the app name and api key to be on the
capfile.
* Change the user to get the git user instead
of the command line user.
|
diff --git a/lib/capistrano/tasks/symfony.rake b/lib/capistrano/tasks/symfony.rake
index abc1234..def5678 100644
--- a/lib/capistrano/tasks/symfony.rake
+++ b/lib/capistrano/tasks/symfony.rake
@@ -3,7 +3,7 @@ args.with_defaults(:command => :list)
on roles fetch(:symfony_roles) do
within release_path do
- execute :symfony, args[:command], *args.extras
+ execute :php, release_path.join('app/console'), args[:command], *args.extras
end
end
end
@@ -20,4 +20,4 @@ set :symfony_roles, :web
set :symfony_assets_flags, '--symlink --quiet'
end
-end+end
| Fix how console was called
|
diff --git a/lib/groovehq/client/connection.rb b/lib/groovehq/client/connection.rb
index abc1234..def5678 100644
--- a/lib/groovehq/client/connection.rb
+++ b/lib/groovehq/client/connection.rb
@@ -20,18 +20,39 @@ request :delete, path, options
end
+ private
+
def request(method, path, options)
response = self.class.send(method, path, { query: options })
data = response.parsed_response
parse_data(data)
end
- def parse_data(data)
- return unless data
- data = data.values.first
+ def parse_data(original_data)
+ return unless original_data
+
+ # This hack is added primaraly to deal with API response inconsistencies:
+ # https://www.groovehq.com/docs/ticket-counts#listing-ticket-counts (one key per folder)
+ # https://www.groovehq.com/docs/tickets#listing-tickets (has two keys: 'tickets' and 'meta')
+ # https://www.groovehq.com/docs/tickets#finding-one-ticket (one key: 'ticket')
+ # :(
+ data = original_data.keys.count <= 2 ? original_data.values.first : original_data
+
case data
when Hash then Resource.new(self, data)
- when Array then data.map { |hash| parse_data({resource: hash}) }
+ when Array then Resource.new(self,
+ {
+ collection: data.map { |hash| parse_data({resource: hash}) },
+ meta: original_data["meta"],
+ links: {
+ next: {
+ href: original_data["meta"]["pagination"]["next_page"]
+ },
+ prev: {
+ href: original_data["meta"]["pagination"]["prev_page"]
+ }
+ }
+ })
when nil then nil
else data
end
| Add pagination and tickets_count support
|
diff --git a/lib/llt/diff/common/reviewable.rb b/lib/llt/diff/common/reviewable.rb
index abc1234..def5678 100644
--- a/lib/llt/diff/common/reviewable.rb
+++ b/lib/llt/diff/common/reviewable.rb
@@ -13,7 +13,7 @@ # can't use the class methods that set the same, as we have
# subclasses using this value as well
def xml_tag
- :comparison
+ :reviewable
end
def diff
| Fix xml tag of Common::Reviewable
|
diff --git a/lib/power_scraper/table_parser.rb b/lib/power_scraper/table_parser.rb
index abc1234..def5678 100644
--- a/lib/power_scraper/table_parser.rb
+++ b/lib/power_scraper/table_parser.rb
@@ -8,14 +8,9 @@
def parse_html(html)
doc = Nokogiri::HTML html
- headers = doc.xpath('//table/tr/th').map do |header|
- header.text.strip
- end
+ headers = find_headers(doc)
- rows = doc.xpath('//table/tr').to_a
- rows.delete_at(0)
-
- document_objects = rows.map do |row|
+ find_data_rows(doc).map do |row|
td_children = row.children.select do |child|
child.class == Nokogiri::XML::Element
end
@@ -25,5 +20,17 @@ Hash[headers.zip children_text]
end
end
+
+ def find_headers(doc)
+ doc.xpath('//table/tr/th').map do |header|
+ header.text.strip
+ end
+ end
+
+ def find_data_rows(doc)
+ rows = doc.xpath('//table/tr').to_a
+ rows.delete_at(0)
+ rows
+ end
end
end
| Add parser for html. Gets a big array of hashes for each row. No tests.
|
diff --git a/lib/ruboty/gitlab/actions/base.rb b/lib/ruboty/gitlab/actions/base.rb
index abc1234..def5678 100644
--- a/lib/ruboty/gitlab/actions/base.rb
+++ b/lib/ruboty/gitlab/actions/base.rb
@@ -41,7 +41,7 @@ end
def search_project
- client.search_projects(given_project).first
+ client.projects({ search: given_project }).first
end
def project
| Fix bug; can't search with project path
|
diff --git a/lib/app_store_info/app.rb b/lib/app_store_info/app.rb
index abc1234..def5678 100644
--- a/lib/app_store_info/app.rb
+++ b/lib/app_store_info/app.rb
@@ -12,7 +12,7 @@ genre_ids: 'genreIds', price: 'price', currency: 'currency',
supported_devices: 'supportedDevices', company: 'artistName',
description: 'description', minimum_os_version: 'minimumOsVersion',
- features: 'features'
+ features: 'features', languages: 'languageCodesISO2A'
def initialize(json)
read_json_accessors(json)
| Add languages as an attribute of App
|
diff --git a/lib/concurrent/executor/per_thread_executor.rb b/lib/concurrent/executor/per_thread_executor.rb
index abc1234..def5678 100644
--- a/lib/concurrent/executor/per_thread_executor.rb
+++ b/lib/concurrent/executor/per_thread_executor.rb
@@ -1,9 +1,6 @@-require_relative 'executor'
-
module Concurrent
class PerThreadExecutor
- include Executor
def self.post(*args)
raise ArgumentError.new('no block given') unless block_given?
@@ -17,5 +14,10 @@ def post(*args, &task)
return PerThreadExecutor.post(*args, &task)
end
+
+ def <<(task)
+ PerThreadExecutor.post(&task)
+ return self
+ end
end
end
| Reset PerThreadExecutor to original state.
|
diff --git a/lib/emoji_test_love/rspec/rspec_integration.rb b/lib/emoji_test_love/rspec/rspec_integration.rb
index abc1234..def5678 100644
--- a/lib/emoji_test_love/rspec/rspec_integration.rb
+++ b/lib/emoji_test_love/rspec/rspec_integration.rb
@@ -7,17 +7,20 @@ @char_provider = provider.new
end
end
+ def char_provider
+ self.class.char_provider
+ end
def example_passed(example)
super(example)
- self.class.char_provider.passed_char
+ self.char_provider.passed_char
end
def example_failed(example)
super(example)
- self.class.char_provider.failed_char
+ self.char_provider.failed_char
end
def example_pending(example)
super(example)
- self.class.char_provider.pending_char
+ self.char_provider.pending_char
end
end
def self.RSpecFormatter(name)
| Isolate knowledge of how to get the char_provider
|
diff --git a/lib/commentator/engine.rb b/lib/commentator/engine.rb
index abc1234..def5678 100644
--- a/lib/commentator/engine.rb
+++ b/lib/commentator/engine.rb
@@ -1,5 +1,14 @@ module Commentator
class Engine < ::Rails::Engine
isolate_namespace Commentator
+ initializer 'commentator' do |app|
+ ActiveSupport.on_load(:action_view) do
+ require "commentator/comments_helper"
+ class ActionView::Base
+ include Commentator::CommentsHelper
+ end
+ end
+ end
+
end
end
| Fix problem with reloading CommentsHelper
|
diff --git a/lib/front_matter_ninja.rb b/lib/front_matter_ninja.rb
index abc1234..def5678 100644
--- a/lib/front_matter_ninja.rb
+++ b/lib/front_matter_ninja.rb
@@ -1,6 +1,6 @@ require 'front_matter_ninja/version'
-require 'safe_yaml'
+require 'safe_yaml/load'
module FrontMatterNinja
def self.parse(string)
| Load SafeYAML without patching YAML itself
|
diff --git a/lib/instana/collectors.rb b/lib/instana/collectors.rb
index abc1234..def5678 100644
--- a/lib/instana/collectors.rb
+++ b/lib/instana/collectors.rb
@@ -13,14 +13,24 @@ end
if ENV.key?('INSTANA_GEM_DEV')
- ::Instana::Collector.interval = 5
+ ::Instana::Collector.interval = 3
else
::Instana::Collector.interval = 1
end
::Thread.new do
timers = ::Timers::Group.new
+
timers.every(::Instana::Collector.interval) {
+
+ # Check if we forked (unicorn, puma) and
+ # if so, re-announce the process sensor
+ if ::Instana.pid_change?
+ ::Instana.logger.debug "Detected a fork (old: #{::Instana.pid} new: #{::Process.pid}). Re-announcing sensor."
+ ::Instana.pid = Process.pid
+ Instana.agent.announce_sensor
+ end
+
::Instana.collectors.each do |c|
c.collect
end
| Add fork detection code; re-announce sensor if so
|
diff --git a/metrics-stream-divergence.gemspec b/metrics-stream-divergence.gemspec
index abc1234..def5678 100644
--- a/metrics-stream-divergence.gemspec
+++ b/metrics-stream-divergence.gemspec
@@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'metrics-stream-divergence'
- s.version = '0.2.0.0'
+ s.version = '0.2.1.0'
s.summary = 'Measurement of divergence in time of the heads of streams'
s.description = ' '
| Package version is increased from 0.2.0.0 to 0.2.1.0
|
diff --git a/app/controllers/api/v1/events_controller.rb b/app/controllers/api/v1/events_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/v1/events_controller.rb
+++ b/app/controllers/api/v1/events_controller.rb
@@ -24,7 +24,7 @@ private
def event_params
- params.require(:event).permit(:title, :event_type, :start_time, :end_time, :start_date, :end_date, :description, :address, :skills_needed, :minimum_age, :url)
+ params.require(:event).permit(:title, :organization, :start, :end, :description, :address, :skills, :age, :url)
end
end
| Update event params in events controller
|
diff --git a/lib/ppcurses/form/form.rb b/lib/ppcurses/form/form.rb
index abc1234..def5678 100644
--- a/lib/ppcurses/form/form.rb
+++ b/lib/ppcurses/form/form.rb
@@ -50,27 +50,25 @@ while 1
c = @win.getch
- if c == ESCAPE
- # exit for now
- break
+ if c == KEY_UP or c == KEY_DOWN
+
+ selected_index = @elements.index(@selected_element)
+
+ if c == KEY_DOWN
+ (selected_index == n_choices-1) ? next_selection = 0 : next_selection = selected_index + 1
+ else
+ (selected_index == 0) ? next_selection = n_choices - 1 : next_selection = selected_index - 1
+ end
+
+ set_selected_element(@elements[next_selection])
+ else
+ should_exit = @selected_element.handle_keypress(c)
+ if should_exit
+ break
+ end
end
- if c == KEY_UP or c == KEY_DOWN
-
- selected_index = @elements.index(@selected_element)
-
- if c == KEY_DOWN
- (selected_index == n_choices-1) ? next_selection = 0 : next_selection = selected_index + 1
- else
- (selected_index == 0) ? next_selection = n_choices - 1 : next_selection = selected_index - 1
- end
-
- set_selected_element(@elements[next_selection])
- else
- @selected_element.handle_keypress(c)
- end
-
- show
+ show
end
| Use button submit instead of escape key
|
diff --git a/lib/rlyeh/deep_ones/me.rb b/lib/rlyeh/deep_ones/me.rb
index abc1234..def5678 100644
--- a/lib/rlyeh/deep_ones/me.rb
+++ b/lib/rlyeh/deep_ones/me.rb
@@ -11,18 +11,26 @@
def initialize(app)
@app = app
+ @registered = false
end
def call(env)
super env
- env.me = self
- env.message.prefix = to_prefix
- env.sender = Rlyeh::Target.new(env, @nick)
- @app.call env if @app
+
+ if registered?
+ env.me = self
+ env.message.prefix = to_prefix
+ env.sender = Rlyeh::Target.new(env, @nick)
+ @app.call env if @app
+ end
end
def to_prefix
Ircp::Prefix.new(:nick => @nick, :user => @user, :host => @host)
+ end
+
+ def registered?
+ !!@registered
end
on :pass do |env|
@@ -37,6 +45,7 @@ @user = env.message.params[0]
@real = env.message.params[3]
@host = env.connection.host
+ @registered = true
end
end
end
| Check user has been registered
|
diff --git a/lib/simple_gate/router.rb b/lib/simple_gate/router.rb
index abc1234..def5678 100644
--- a/lib/simple_gate/router.rb
+++ b/lib/simple_gate/router.rb
@@ -22,9 +22,7 @@ # find the shortest route.
# The graph must be acyclical or it will loop forever.
def find(start, target)
- if start == target
- return [target]
- end
+ return [target] if start == target
if paths.has_key?(start)
# Map all possible paths to the target
routes = paths[start].map do |next_node|
| Use inline if to shorten code
|
diff --git a/lib/tasks/ci_monitor.rake b/lib/tasks/ci_monitor.rake
index abc1234..def5678 100644
--- a/lib/tasks/ci_monitor.rake
+++ b/lib/tasks/ci_monitor.rake
@@ -13,11 +13,14 @@ task :force_update => :environment do
print "Doing forced update of all projects..."
Project.enabled.each do |project|
+ next if project.webhooks_enabled
+
begin
StatusFetcher.retrieve_status_for(project)
StatusFetcher.retrieve_velocity_for(project)
+ project.save!
rescue => e
- puts "Failed to update project '#{project}', reason: #{e.message}"
+ puts "Failed to update project '#{project}', #{e.class}: #{e.message}"
end
end
puts " done."
| Save project after force update and don't update webhook projects
|
diff --git a/lib/tasks/single_run.rake b/lib/tasks/single_run.rake
index abc1234..def5678 100644
--- a/lib/tasks/single_run.rake
+++ b/lib/tasks/single_run.rake
@@ -0,0 +1,8 @@+namespace :single_run do
+ desc '2015-04-06: Migrate data entered into Teams#description to ApplicationDraft#project_plan'
+ task copy_team_description_to_application_draft: :environment do
+ ApplicationDraft.includes(:team).each do |draft|
+ draft.update_attribute(:project_plan, draft.team.description)
+ end
+ end
+end
| Add conversion script for new project plan attribute
|
diff --git a/lib/yardstick/yard_ext.rb b/lib/yardstick/yard_ext.rb
index abc1234..def5678 100644
--- a/lib/yardstick/yard_ext.rb
+++ b/lib/yardstick/yard_ext.rb
@@ -3,12 +3,11 @@ module YARD #:nodoc: all
# Test if JRuby head is being used
- JRUBY = RUBY_ENGINE == 'jruby'
- JRUBY_HEAD = JRUBY && JRUBY_VERSION >= '1.7.4.dev'
- JRUBY_19MODE = JRUBY && RUBY_VERSION >= '1.9'
+ JRUBY_19MODE = RUBY_VERSION >= '1.9' && RUBY_ENGINE == 'jruby'
+ JRUBY_HEAD = JRUBY_19MODE && JRUBY_VERSION >= '1.7.4.dev'
# Fix jruby-head to use the ruby 1.8 parser until their ripper port is working
- Parser::SourceParser.parser_type = :ruby18 if JRUBY_HEAD && JRUBY_19MODE
+ Parser::SourceParser.parser_type = :ruby18 if JRUBY_HEAD
# Extend docstring with yardstick methods
class Docstring
| Fix problems with RUBY_ENGINE under ruby 1.8
|
diff --git a/poker-dice/hand_spec.rb b/poker-dice/hand_spec.rb
index abc1234..def5678 100644
--- a/poker-dice/hand_spec.rb
+++ b/poker-dice/hand_spec.rb
@@ -2,9 +2,15 @@ require_relative 'loaded_die'
describe Hand do
- it "has five dice, each of which has a known face value" do
+ def hand_with(face_values)
dice = %w[ Q Q Q Q Q ].map { |value| LoadedDie.new(value) }
hand = Hand.new( dice )
+ end
+
+ it "has five dice, each of which has a known face value" do
+ # dice = %w[ Q Q Q Q Q ].map { |value| LoadedDie.new(value) }
+ # hand = Hand.new( dice )
+ hand = hand_with(nil)
expect( hand.face_values ).to eq( %w[ Q Q Q Q Q ] )
end
| Create a helper method, use it once
|
diff --git a/app/controllers/forem/topics_controller.rb b/app/controllers/forem/topics_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/forem/topics_controller.rb
+++ b/app/controllers/forem/topics_controller.rb
@@ -15,6 +15,7 @@
def create
@topic = @forum.topics.build(params[:topic])
+ @topic.posts -= [@topic.posts.first] # Why are there two posts created? Me no understand.
@topic.user = current_user
if @topic.save
flash[:notice] = t("forem.topic.created")
| Remove first 'accidental' post, put there by a Rails bug (not fixed in edge)
|
diff --git a/sermepa_web_tpv.gemspec b/sermepa_web_tpv.gemspec
index abc1234..def5678 100644
--- a/sermepa_web_tpv.gemspec
+++ b/sermepa_web_tpv.gemspec
@@ -17,7 +17,7 @@ s.files = Dir["{lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.md"]
s.test_files = Dir["test/**/*"]
- s.add_dependency "rails", "~> 3.0.17"
+ s.add_dependency "rails"
s.add_development_dependency "sqlite3"
s.add_development_dependency "rspec-rails"
| Remove rails version from gemspec
|
diff --git a/redis/redis_migrator.rb b/redis/redis_migrator.rb
index abc1234..def5678 100644
--- a/redis/redis_migrator.rb
+++ b/redis/redis_migrator.rb
@@ -0,0 +1,47 @@+# Original Author: Matt Casper (@mcasper/mattc@procore.com)
+
+require 'redis'
+
+# These can be new Redis servers, these can be different namespaces on the same
+# Redis server, whatever. Replace these with the appropriate Redis connections.
+# All keys from `old_redis` will be moved with the appropriate values to
+# `new_redis`.
+old_redis = Redis.new
+new_redis = Redis.new
+
+old_redis.keys.each do |key|
+ begin
+ case old_redis.type(key)
+ when "string"
+ new_redis.set(key, old_redis.get(key))
+ when "list"
+ # This should preserve the list's ordering as well (if it was sorted),
+ # because we walk the list by index and then push to the end of the list.
+ (0..old_redis.llen(key)).each do |i|
+ value = old_redis.lindex(key, i)
+ new_redis.lpush(key, value)
+ end
+ when "set"
+ members = old_redis.smembers(key)
+ members.each do |member|
+ new_redis.sadd(key, member)
+ end
+ when "zset"
+ # This ranges over all the keys in the zset, making sure to get back
+ # the scores as well. They scores/values are returned in reverse order
+ # than what you set them in, which is why we have to map reverse
+ # over all the sets we get back.
+ zsets = old_redis.zrange(key, 0, -1, with_scores: true)
+ new_redis.zadd(key, zsets.map(&:reverse))
+ when "hash"
+ hash = old_redis.hgetall(key)
+ hash.each do |hkey, hvalue|
+ new_redis.hset(key, hkey, hvalue)
+ end
+ end
+ rescue Redis::CommandError => e
+ puts "Sadness! Failed on key #{key} with type #{old_redis.type(key)} with error #{e}."
+ end
+end
+
+puts "Successfully migrated keys from #{old_redis.inspect} to #{new_redis.inspect}"
| Add redis migrator, for moving all keys from one redis to another
|
diff --git a/lib/gorilla/middleware/signature_auth.rb b/lib/gorilla/middleware/signature_auth.rb
index abc1234..def5678 100644
--- a/lib/gorilla/middleware/signature_auth.rb
+++ b/lib/gorilla/middleware/signature_auth.rb
@@ -33,7 +33,6 @@ def build_token(env)
JWT.encode({
exp: Time.now.utc.to_i + @opts[:token_duration].to_i,
- iss: @opts[:key],
method: env[:method].to_s.upcase,
path: env[:url].path.split('?').first
}, @opts[:secret], SIGNATURE_ALGO)
| Remove iss claim from signature
|
diff --git a/lib/pronto/formatter/github_formatter.rb b/lib/pronto/formatter/github_formatter.rb
index abc1234..def5678 100644
--- a/lib/pronto/formatter/github_formatter.rb
+++ b/lib/pronto/formatter/github_formatter.rb
@@ -28,7 +28,7 @@ : client.commit_comments(repo, sha)
existing_comment = comments.find do |comment|
- comment.position = position &&
+ comment.position == position &&
comment.path == path &&
comment.body == body
end
| Fix comment comparison in GithubFormatter
|
diff --git a/lib/tasks/code_quality_html_reports.rake b/lib/tasks/code_quality_html_reports.rake
index abc1234..def5678 100644
--- a/lib/tasks/code_quality_html_reports.rake
+++ b/lib/tasks/code_quality_html_reports.rake
@@ -12,6 +12,11 @@ sh 'rubycritic app lib -p public/reports/ruby_critic --no-browser --format html'
end
+ task :simplecov_html do
+ Rake::Task["spec"].invoke if Rake::Task.task_defined?('spec')
+ Rake::Task["test"].invoke if Rake::Task.task_defined?('test')
+ end
+
task :html do
puts 'Generating html reports...'
%w(rubocop_html rubycritic_html).each { |task| Rake::Task["pc_reports:#{task}"].invoke }
| Add simplecov html report rake task
|
diff --git a/spec/support/shared/statusable.rb b/spec/support/shared/statusable.rb
index abc1234..def5678 100644
--- a/spec/support/shared/statusable.rb
+++ b/spec/support/shared/statusable.rb
@@ -11,14 +11,14 @@
if RailsStuff.rails4?
def relation_values(relation)
- where_sql = relation.where_values.map(&:to_sql).join
- values_sql = relation.bind_values.map(&:second).join
+ where_sql = relation.where_values.map(&:to_sql)
+ values_sql = relation.bind_values.to_h.transform_values(&:to_s)
[where_sql, values_sql]
end
else
def relation_values(relation)
where_sql = relation.where_clause.ast.to_sql
- values_sql = relation.where_clause.binds.map(&:value).join
+ values_sql = relation.where_clause.to_h.transform_values(&:to_s)
[where_sql, values_sql]
end
end
| Update tests to support rails master
See https://github.com/rails/rails/commit/213796fb4936dce1da2f0c097a054e1af5c25c2c
|
diff --git a/lib/hpcloud.rb b/lib/hpcloud.rb
index abc1234..def5678 100644
--- a/lib/hpcloud.rb
+++ b/lib/hpcloud.rb
@@ -7,6 +7,13 @@
module HPCloud
class CLI < Thor
+
+ ## Constants
+ ACCESS_ID = 'cecf0acbcf6add394cc526b93a0017e151a76fbb'
+ SECRET_KEY = 'd8a8bf2d86ef9d2a9b258120858e3973608f41e6'
+ ACCOUNT_ID = '1ba31f9b7a1adbb28cb1495e0fb2ac65ef82b34a'
+ HOST = '16.49.184.31'
+ PORT = '9233'
desc "buckets", "list available buckets"
def buckets
@@ -21,6 +28,16 @@ desc "buckets:rm <name>", "remove a bucket"
define_method "buckets:rm" do
puts "remove bucket"
+ end
+
+ private
+
+ def connection
+ @connection ||= Fog::HP::Storage.new( :hp_access_id => ACCESS_ID,
+ :hp_secret_key => SECRET_KEY,
+ :hp_account_id => ACCOUNT_ID,
+ :host => HOST,
+ :port => PORT )
end
end
| Set up basic connection with fog.
|
diff --git a/.rubocop/cop/zammad/exists_db_strategy.rb b/.rubocop/cop/zammad/exists_db_strategy.rb
index abc1234..def5678 100644
--- a/.rubocop/cop/zammad/exists_db_strategy.rb
+++ b/.rubocop/cop/zammad/exists_db_strategy.rb
@@ -17,7 +17,7 @@ PATTERN
def_node_matcher :has_reset?, <<-PATTERN
- $(send _ {:describe :context :it :shared_examples} (_ ...) (hash ... (pair (sym :db_strategy) (sym {:reset :reset_all}))))
+ $(send _ {:describe :context :it :shared_examples} (_ ...) (hash <(pair (sym :db_strategy) (sym {:reset :reset_all})) ...> ))
PATTERN
MSG = 'Add a `db_strategy: :reset` to your context/decribe when you are creating object manager attributes!'.freeze
| Maintenance: Fix ExistsDbStrategy to not depend of the position of the db_strategy hash element.
|
diff --git a/spec/factories/case_workers.rb b/spec/factories/case_workers.rb
index abc1234..def5678 100644
--- a/spec/factories/case_workers.rb
+++ b/spec/factories/case_workers.rb
@@ -13,9 +13,15 @@
FactoryBot.define do
factory :case_worker do
- after(:build) do |case_worker|
- case_worker.user ||= build(:user, first_name: Faker::Name.first_name, last_name: Faker::Name.last_name, password: 'password', password_confirmation: 'password')
- case_worker.user.email = "#{case_worker.first_name}.#{case_worker.last_name}@laa.gov.uk"
+ transient do
+ build_user { true }
+ end
+
+ after(:build) do |case_worker, evaluator|
+ if evaluator.build_user
+ case_worker.user ||= build(:user, first_name: Faker::Name.first_name, last_name: Faker::Name.last_name, password: 'password', password_confirmation: 'password')
+ case_worker.user.email = "#{case_worker.first_name}.#{case_worker.last_name}@laa.gov.uk"
+ end
end
location
| Add build_user option to case worker factory
Some tests may find it useful to define their own user
attributes for clarity.
|
diff --git a/spec/lib/i18n/core_ext_spec.rb b/spec/lib/i18n/core_ext_spec.rb
index abc1234..def5678 100644
--- a/spec/lib/i18n/core_ext_spec.rb
+++ b/spec/lib/i18n/core_ext_spec.rb
@@ -0,0 +1,37 @@+require 'i18n'
+
+RSpec.describe I18n::Backend::Base do
+ # Since #load_erb is a protected method, this spec tests the
+ # interface that calls it: #load_translations
+ describe '#load_translations' do
+ let(:translations) do
+ I18n.backend.instance_variable_get(:@translations)
+ end
+
+ before do
+ I18n.backend = I18n::Backend::Simple.new
+ end
+
+ context 'when loading data from a yml.erb file' do
+ let(:filename) { 'en.yml.erb' }
+ let(:yaml) do
+ <<-YAML
+ en:
+ foo: 1 + 1 = <%= 1 + 1 %>
+ YAML
+ end
+ let(:erb_interpolated_hash) do
+ { en: { foo: '1 + 1 = 2' } }
+ end
+
+ before do
+ allow(File).to receive(:read).with(filename).and_return(yaml)
+ I18n.backend.load_translations(filename)
+ end
+
+ it 'loads data from a yml.erb file and interpolates the ERB' do
+ expect(translations).to eq(erb_interpolated_hash)
+ end
+ end
+ end
+end
| Add spec for i18n monkey patch
|
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb
index abc1234..def5678 100644
--- a/spec/models/repository_spec.rb
+++ b/spec/models/repository_spec.rb
@@ -19,6 +19,17 @@ end
end
+ describe '#feed_link' do
+ it 'returns the short feed link for the main repositiory' do
+ expect(repo.feed_link).to eq('/feed.atom')
+ end
+
+ it 'returns the full feed link for other repositiories' do
+ repo.name = 'Homebrew/homebrew-games'
+ expect(repo.feed_link).to eq('/repos/Homebrew/homebrew-games/feed.atom')
+ end
+ end
+
describe '#main?' do
it "returns true for #{Repository::MAIN}" do
expect(repo.main?).to be_truthy
@@ -29,6 +40,12 @@ end
end
+ describe '#to_param' do
+ it 'returns the name of the repository' do
+ expect(repo.to_param).to eq(Repository::MAIN)
+ end
+ end
+
describe '#url' do
it 'returns the Git URL of the GitHub repository' do
expect(repo.url).to eq("git://github.com/#{Repository::MAIN}.git")
| Add some missing specs for Repository
|
diff --git a/app/presenters/renalware/renal/clinical_summary_presenter.rb b/app/presenters/renalware/renal/clinical_summary_presenter.rb
index abc1234..def5678 100644
--- a/app/presenters/renalware/renal/clinical_summary_presenter.rb
+++ b/app/presenters/renalware/renal/clinical_summary_presenter.rb
@@ -29,6 +29,7 @@ def current_events
@current_events ||= Events::Event.includes([:created_by, :event_type])
.for_patient(@patient)
+ .order(created_at: :desc)
end
def letters
@@ -45,7 +46,6 @@ .with_author
.with_patient
.limit(6)
- .reverse
end
def present_letters(letters)
| Order items in clinical summary
|
diff --git a/lib/authorize/test_helper.rb b/lib/authorize/test_helper.rb
index abc1234..def5678 100644
--- a/lib/authorize/test_helper.rb
+++ b/lib/authorize/test_helper.rb
@@ -17,5 +17,15 @@ role = tor.is_a?(Authorize::Role) ? tor : tor.role
assert_block("Role #{role} is authorized") {role.may_not?(*args)}
end
+
+ def assert_has_role(tor, subrole)
+ role = tor.is_a?(Authorize::Role) ? tor : tor.role
+ assert_block("Role #{role} does not include #{subrole}") {role.roles.include?(subrole))}
+ end
+
+ def assert_does_not_have_role(tor, subrole)
+ role = tor.is_a?(Authorize::Role) ? tor : tor.role
+ assert_block("Role #{role} includes #{subrole}") {!role.roles.include?(subrole))}
+ end
end
end | Expand test helpers with role inclusion assertions |
diff --git a/lib/bipbip/plugin/network.rb b/lib/bipbip/plugin/network.rb
index abc1234..def5678 100644
--- a/lib/bipbip/plugin/network.rb
+++ b/lib/bipbip/plugin/network.rb
@@ -9,8 +9,11 @@ end
def monitor
- connections = `netstat -tn | wc -l`
- {:connections_total => connections.to_i}
+ tcp_summary = `ss -s | grep '^TCP:'`
+ tcp_counters = /^TCP:\s+(\d+) \(estab (\d+), closed (\d+), orphaned (\d+), synrecv (\d+), timewait (\d+)\/(\d+)\), ports (\d+)$/.match(tcp_summary)
+ raise "Cannot match ss-output `#{tcp_summary}`" unless tcp_counters
+
+ {:connections_total => tcp_counters[1].to_i}
end
end
end
| Use "ss" to get socket counts
|
diff --git a/lib/skr/models/time_entry.rb b/lib/skr/models/time_entry.rb
index abc1234..def5678 100644
--- a/lib/skr/models/time_entry.rb
+++ b/lib/skr/models/time_entry.rb
@@ -12,6 +12,10 @@
has_one :inv_line, inverse_of: :time_entry, listen: { create: :mark_as_invoiced }
+
+ export_sort :hours do | q, dir |
+ q.order("end_at-start_at #{dir}")
+ end
def hours
(end_at - start_at) / 1.hour
| Set a custom sort for hours
|
diff --git a/lib/ublisherp/publishable.rb b/lib/ublisherp/publishable.rb
index abc1234..def5678 100644
--- a/lib/ublisherp/publishable.rb
+++ b/lib/ublisherp/publishable.rb
@@ -2,6 +2,12 @@
module Ublisherp::Publishable
extend ActiveSupport::Concern
+
+ included do
+ if self.respond_to?(:include_root_in_json=)
+ self.include_root_in_json = true
+ end
+ end
module ClassMethods
def publish_associations(*assocs)
| Make sure we include root type in JSON
|
diff --git a/lib/upstream/tracker/init.rb b/lib/upstream/tracker/init.rb
index abc1234..def5678 100644
--- a/lib/upstream/tracker/init.rb
+++ b/lib/upstream/tracker/init.rb
@@ -18,6 +18,35 @@ end
end
+ desc "library [LIBRARY]", "Initialize library"
+ option :list, :required => false
+ def library(arg = "")
+ if options.has_key?("list")
+ #p options
+ exit
+ end
+ exit unless arg
+ arg.split(/,/).each do |library|
+ components = load_component
+ if components.keys.include?(library)
+ fetch_versions_html(components[library])
+ end
+ end
+ end
+
+ private
+
+ def fetch_versions_html(component)
+ p component
+ url = UPSTREAM_TRACKER_URL + component[:html]
+ html = fetch_html(url)
+ path = File.join(get_config_dir, component[:html])
+ FileUtils.mkdir_p(File.dirname(path))
+ File.open(path, "w+") do |file|
+ file.puts(html[:data])
+ end
+ end
+
end
end
end
| Implement to fetch versions of specific component
|
diff --git a/lib/vagrant_cloud/account.rb b/lib/vagrant_cloud/account.rb
index abc1234..def5678 100644
--- a/lib/vagrant_cloud/account.rb
+++ b/lib/vagrant_cloud/account.rb
@@ -14,10 +14,11 @@ Box.new(self, name, data)
end
- def create_box(name, description = nil)
+ def create_box(name, description = nil, is_private = false)
params = {:name => name}
params[:description] = description if description
params[:short_description] = description if description
+ params[:is_private] = is_private
data = request('post', '/boxes', {:box => params})
get_box(name, data)
end
| Make boxes public by default.
|
diff --git a/test/integration/default/default_spec.rb b/test/integration/default/default_spec.rb
index abc1234..def5678 100644
--- a/test/integration/default/default_spec.rb
+++ b/test/integration/default/default_spec.rb
@@ -1,11 +1,3 @@-describe command('ps ax | grep activem[q]') do
- its('exit_status') { should eq 0 }
+describe command('/Applications/Tunnelblick.app/Contents/Resources/openvpnstart') do
+ it { should exist }
end
-
-describe command('/opt/apache-activemq-5.14.4/bin/activemq producer') do
- its('stdout') { should match(/Produced: 1000 messages/) }
-end
-
-describe command('/opt/apache-activemq-5.14.4/bin/activemq consumer') do
- its('stdout') { should match(/Consumed: 1000 messages/) }
-end
| Add a valid inspec test
Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
|
diff --git a/examples/rails_style_routing.ru b/examples/rails_style_routing.ru
index abc1234..def5678 100644
--- a/examples/rails_style_routing.ru
+++ b/examples/rails_style_routing.ru
@@ -3,43 +3,39 @@ class App < Scorched::Controller
end
-module Scorched
- module RestActions
- def self.included(klass)
- klass.get('/') { invoke_action :index }
- klass.get('/new') { invoke_action :new }
- klass.post('/') { invoke_action :create }
- klass.get('/:id') { |id| invoke_action :show, id }
- klass.get('/:id/edit') { |id| invoke_action :edit, id }
- klass.route('/:id', method: ['PATCH', 'PUT']) { |id| invoke_action :update, id }
- klass.delete('/:id') { |id| invoke_action :delete, id }
- end
- def invoke_action(action, *captures)
- respond_to?(action) ? send(action, *captures) : pass
- end
+class Base < App
+ def self.inherited(klass)
+ klass.get('/') { invoke_action :index }
+ klass.get('/new') { invoke_action :new }
+ klass.post('/') { invoke_action :create }
+ klass.get('/:id') { invoke_action :show }
+ klass.get('/:id/edit') { invoke_action :edit }
+ klass.route('/:id', method: ['PATCH', 'PUT']) { invoke_action :update }
+ klass.delete('/:id') { invoke_action :delete }
+ end
+
+ def invoke_action(action)
+ respond_to?(action) ? send(action) : pass
end
end
-class Root < App
- include Scorched::RestActions
+class Root < Base
def index
'Hello'
end
-
+
def create
'Creating it now'
end
end
-class Customer < App
- include Scorched::RestActions
+class Customer < Base
def index
'Hello customer'
end
end
-class Order < App
- include Scorched::RestActions
+class Order < Base
def index
'Me order'
end
@@ -49,4 +45,4 @@ App.controller '/order', Order
App.controller '/', Root
-run App
+run App | Revert "rework as resfult module"
This reverts commit 3d7f1f6982f9b87dae777c42541797fedb8c05a6.
|
diff --git a/lib/gds_api/test_helpers/content_api.rb b/lib/gds_api/test_helpers/content_api.rb
index abc1234..def5678 100644
--- a/lib/gds_api/test_helpers/content_api.rb
+++ b/lib/gds_api/test_helpers/content_api.rb
@@ -14,9 +14,9 @@ "title" => slug.gsub("-", " ").capitalize,
"details" => {
"type" => "section",
- "description" => "#{slug} description",
- "parent" => nil
- }
+ "description" => "#{slug} description"
+ },
+ "parent" => nil
}
end
)
| Tag parent attributes are now top-level
|
diff --git a/lib/signup/partner_enquiry_processor.rb b/lib/signup/partner_enquiry_processor.rb
index abc1234..def5678 100644
--- a/lib/signup/partner_enquiry_processor.rb
+++ b/lib/signup/partner_enquiry_processor.rb
@@ -4,12 +4,13 @@ # Public: Process new enquiries
#
# enquiry_details - a hash containing details of the enquiry.
- # 'name' => the name of the enquirer
- # 'affiliation' => the person's organisation
- # 'job_title' => role
- # 'email' => email address
- # 'telephone' => phone number
- # 'note' => free text, 'what would you like to talk about'
+ # 'name' => the name of the enquirer
+ # 'affiliation' => the person's organisation
+ # 'job_title' => role
+ # 'email' => email address
+ # 'telephone' => phone number
+ # 'offer_category' => the membership level they have expressed an interest in
+ # 'note' => free text, 'what would you like to talk about'
#
# Examples
#
| Add offer_category for the membership level they're interested in.
|
diff --git a/lib/cash_poster/transaction.rb b/lib/cash_poster/transaction.rb
index abc1234..def5678 100644
--- a/lib/cash_poster/transaction.rb
+++ b/lib/cash_poster/transaction.rb
@@ -13,7 +13,7 @@ http = Net::HTTP.new(uri.host, uri.port)
end
http.use_ssl = true
- http.ssl_version = 'SSLv3'
+ http.ssl_version = 'TLSv1_2'
http_req = Net::HTTP::Post.new(uri.path)
http_req.body = request.params.to_query
http_res = http.request(http_req)
| Modify SSL version from SSLv3 to TLSv1.2
|
diff --git a/lib/convection/model/diff.rb b/lib/convection/model/diff.rb
index abc1234..def5678 100644
--- a/lib/convection/model/diff.rb
+++ b/lib/convection/model/diff.rb
@@ -45,6 +45,13 @@
[action, message, color]
end
+
+ def ==(other)
+ @key == other.key &&
+ @ours == other.ours &&
+ @theirs == other.theirs &&
+ @action == other.action
+ end
end
end
end
| Define an == method for Diff objects.
|
diff --git a/lib/juici/build_environment.rb b/lib/juici/build_environment.rb
index abc1234..def5678 100644
--- a/lib/juici/build_environment.rb
+++ b/lib/juici/build_environment.rb
@@ -1,5 +1,5 @@ module Juici
- BUILD_SENSITIVE_VARIABLES = %w[RUBYOPT BUNDLE_GEMFILE RACK_ENV MONGOLAB_URI GEM_PATH WORKING_DIR GEM_HOME]
+ BUILD_SENSITIVE_VARIABLES = %w[RUBYOPT BUNDLE_GEMFILE RACK_ENV MONGOLAB_URI GEM_PATH WORKING_DIR]
class BuildEnvironment
attr_reader :env
| Use JuiCI's GEM_HOME in the child, people can manually unset if they
want
|
diff --git a/lib/netzke/basepack/version.rb b/lib/netzke/basepack/version.rb
index abc1234..def5678 100644
--- a/lib/netzke/basepack/version.rb
+++ b/lib/netzke/basepack/version.rb
@@ -4,8 +4,9 @@ MAJOR = 0
MINOR = 9
PATCH = 0
+ PRE = 'rc1'
- STRING = [MAJOR, MINOR, PATCH].compact.join('.')
+ STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
end
end
end
| Add pre-release part to VERSION
|
diff --git a/lib/recliner/view_functions.rb b/lib/recliner/view_functions.rb
index abc1234..def5678 100644
--- a/lib/recliner/view_functions.rb
+++ b/lib/recliner/view_functions.rb
@@ -12,8 +12,10 @@ end
def to_s
- @body
+ "\"#{@body}\""
end
+
+ alias to_json to_s
def self.create(definition)
returning Class.new(self) do |klass|
| Fix JSON serialization of view functions
|
diff --git a/week-4/concatenate-arrays/my_solution.rb b/week-4/concatenate-arrays/my_solution.rb
index abc1234..def5678 100644
--- a/week-4/concatenate-arrays/my_solution.rb
+++ b/week-4/concatenate-arrays/my_solution.rb
@@ -5,23 +5,22 @@
# Your Solution Below
+# def array_concat(array_1, array_2)
+# array_2.each {|x| array_1<<x}
+# array_1.flatten
+# end
-def array_concat(array_1, array_2)
-
-array_2.each {|x| array_1<<x}
-array_1.flatten
-
-end
+# def array_concat(array_1, array_2)
+# a = array_1+array_2
+# a.flatten
+# end
-def array_concat(array_1, array_2)
-
- a = array_1+array_2
- a.flatten
- #array_1.concat array_2
-
- end
+# def array_concat(array_1, array_2)
+# array_1.concat array_2
+# end
+
| Add solution for challenge 4.6
|
diff --git a/cf_spec/integration/pushing_an_app_spec.rb b/cf_spec/integration/pushing_an_app_spec.rb
index abc1234..def5678 100644
--- a/cf_spec/integration/pushing_an_app_spec.rb
+++ b/cf_spec/integration/pushing_an_app_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe 'app state' do
- subject(:app) { Machete.deploy_app(app_name, {buildpack: 'binary_buildpack'}) }
+ subject(:app) { Machete.deploy_app(app_name, {buildpack: 'null-test-buildpack'}) }
let(:browser) { Machete::Browser.new(app) }
let(:app_name) { 'app_that_does_not_access_the_internet' }
@@ -15,7 +15,7 @@ end
describe 'logging' do
- subject(:app) { Machete.deploy_app(app_name, {buildpack: 'binary_buildpack'}) }
+ subject(:app) { Machete.deploy_app(app_name, {buildpack: 'null-test-buildpack'}) }
let(:browser) { Machete::Browser.new(app) }
context 'an app that does not access the internet' do
| Use null-test-buildpack for firewall integration specs
[#111610094]
Signed-off-by: Brandon Shroyer <d370be3f39cb88690ed16d1a7b77debc20949e86@pivotal.io>
|
diff --git a/config/initializers/normalise_blank_values.rb b/config/initializers/normalise_blank_values.rb
index abc1234..def5678 100644
--- a/config/initializers/normalise_blank_values.rb
+++ b/config/initializers/normalise_blank_values.rb
@@ -0,0 +1,21 @@+module NormaliseBlankValues extend ActiveSupport::Concern
+
+ def self.included(base)
+ base.extend ClassMethods
+ end
+
+ def normalise_blank_values
+ attributes.each do |column, value|
+ self[column].present? || self[column] = nil
+ end
+ end
+
+ module ClassMethods
+ def normalise_blank_values
+ before_save :normalise_blank_values
+ end
+ end
+
+end
+
+ActiveRecord::Base.send(:include, NormaliseBlankValues)
| Add module to be used when we want to normalise empty values before save
|
diff --git a/app/helpers/container_helper/textual_summary.rb b/app/helpers/container_helper/textual_summary.rb
index abc1234..def5678 100644
--- a/app/helpers/container_helper/textual_summary.rb
+++ b/app/helpers/container_helper/textual_summary.rb
@@ -4,7 +4,7 @@ #
def textual_group_properties
- %i(name state restart_count backing_ref)
+ %i(name state restart_count backing_ref command)
end
def textual_group_relationships
@@ -35,4 +35,8 @@ def textual_backing_ref
{:label => "Backing Ref (Container ID)", :value => @record.backing_ref}
end
+
+ def textual_command
+ {:label => "Command", :value => @record.container_definition.command} if @record.container_definition.command
+ end
end
| Revert "Revert "persist and show container command""
This reverts commit d65dd1d8c8f4a98145d6a951d26c624006afef91.
(transferred from ManageIQ/manageiq@8941f2543733d2a94f026e313eff67c213667450)
|
diff --git a/core/lib/spree/testing_support/common_rake.rb b/core/lib/spree/testing_support/common_rake.rb
index abc1234..def5678 100644
--- a/core/lib/spree/testing_support/common_rake.rb
+++ b/core/lib/spree/testing_support/common_rake.rb
@@ -17,8 +17,8 @@
puts "Setting up dummy database..."
- sh "bundle exec bin/rails db:environment:set RAILS_ENV=test"
- sh "bundle exec rake db:drop db:create db:migrate VERBOSE=false RAILS_ENV=test"
+ sh "bin/rails db:environment:set RAILS_ENV=test"
+ sh "bin/rails db:drop db:create db:migrate VERBOSE=false RAILS_ENV=test"
begin
require "generators/#{ENV['LIB_NAME']}/install/install_generator"
| Drop bundle exec from bin/rails in test_app
Without this we are getting bundler errors
bundle exec bin/rails db:environment:set RAILS_ENV=test
bundler: failed to load command: bin/rails (bin/rails)
Gem::LoadError: You have already activated arel 7.1.4, but your Gemfile requires arel 7.1.2. Prepending `bundle exec` to your command may solve this.
/home/jhawthorn/.gem/ruby/2.3.1/gems/bundler-1.13.1/lib/bundler/runtime.rb:40:in `block in setup'
/home/jhawthorn/.gem/ruby/2.3.1/gems/bundler-1.13.1/lib/bundler/runtime.rb:25:in `map'
/home/jhawthorn/.gem/ruby/2.3.1/gems/bundler-1.13.1/lib/bundler/runtime.rb:25:in `setup'
/home/jhawthorn/.gem/ruby/2.3.1/gems/bundler-1.13.1/lib/bundler.rb:99:in `setup'
/home/jhawthorn/src/solidus/core/spec/dummy/config/boot.rb:6:in `<top (required)>'
bin/rails:3:in `require_relative'
bin/rails:3:in `<top (required)>'
rake aborted!
Command failed with status (1): [bundle exec bin/rails db:environment:set R...]
|
diff --git a/lib/salesforce_bulk/batch.rb b/lib/salesforce_bulk/batch.rb
index abc1234..def5678 100644
--- a/lib/salesforce_bulk/batch.rb
+++ b/lib/salesforce_bulk/batch.rb
@@ -18,7 +18,7 @@ end
def in_progress?
- ?state 'InProgress'
+ state? 'InProgress'
end
def queued?
| Fix typo on state method call. All tests now passing.
|
diff --git a/lib/scanny/checks/helpers.rb b/lib/scanny/checks/helpers.rb
index abc1234..def5678 100644
--- a/lib/scanny/checks/helpers.rb
+++ b/lib/scanny/checks/helpers.rb
@@ -10,7 +10,7 @@ <<-EOT
SendWithArguments
<
- name = :system | :exec,
+ name = :system | :exec | :spawn,
arguments = ActualArguments<
array = [
any*,
| Add spawn method to pattern
Method build_pattern_exec_command should build pattern that can
recognize execute system command with spawn method.
|
diff --git a/spec/acceptance/class_plugin_ovs_stats_spec.rb b/spec/acceptance/class_plugin_ovs_stats_spec.rb
index abc1234..def5678 100644
--- a/spec/acceptance/class_plugin_ovs_stats_spec.rb
+++ b/spec/acceptance/class_plugin_ovs_stats_spec.rb
@@ -0,0 +1,44 @@+require 'spec_helper_acceptance'
+
+describe 'collectd::plugin::ovs_stats class', unless: default[:platform] =~ %r{ubuntu} do
+ context 'basic parameters' do
+ # Using puppet_apply as a helper
+ it 'works idempotently with no errors' do
+ pp = <<-EOS
+ class{'collectd':
+ utils => true,
+ }
+ class{ 'collectd::plugin::ovs_stats':
+ port => 6639,
+ }
+ # Add one write plugin to keep logs quiet
+ class{'collectd::plugin::csv':}
+ # Create a socket to query
+ class{'collectd::plugin::unixsock':
+ socketfile => '/var/run/collectd-sock',
+ socketgroup => 'root',
+ }
+
+ EOS
+ # Run 3 times since the collectd_version
+ # fact is impossible until collectd is
+ # installed.
+ apply_manifest(pp, catch_failures: false)
+ apply_manifest(pp, catch_failures: true)
+ apply_manifest(pp, catch_changes: true)
+ # Wait to get some data
+ shell('sleep 10')
+ end
+
+ describe service('collectd') do
+ it { is_expected.to be_running }
+ end
+
+ # it is expected to unload the ovs_stats plugin, since there
+ # is no ovs running inside the docker container.
+ # At the same time, collectd should continue to run.
+ describe command('collectdctl -s /var/run/collectd-sock listval') do
+ its(:exit_status) { is_expected.to eq 0 }
+ end
+ end
+end
| Add acceptance test for ovs_stats
|
diff --git a/cookbooks/bach_repository/recipes/ubuntu.rb b/cookbooks/bach_repository/recipes/ubuntu.rb
index abc1234..def5678 100644
--- a/cookbooks/bach_repository/recipes/ubuntu.rb
+++ b/cookbooks/bach_repository/recipes/ubuntu.rb
@@ -9,6 +9,6 @@ source 'http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/' +
'installer-amd64/current/images/xenial-netboot/mini.iso'
mode 0444
- checksum '28b11928cd8bd63ee522f2e9b0a2f3bfd0dd1d826471e8f7726d65d583b32154'
+ checksum 'eefab8ae8f25584c901e6e094482baa2974e9f321fe7ea7822659edeac279609'
end
| Update Ubuntu mini-iso checksum for the September 12th update
|
diff --git a/lib/sevenhelpers/view_helpers.rb b/lib/sevenhelpers/view_helpers.rb
index abc1234..def5678 100644
--- a/lib/sevenhelpers/view_helpers.rb
+++ b/lib/sevenhelpers/view_helpers.rb
@@ -16,7 +16,7 @@
if options[:environments].include? Rails.env
output = <<-EOD
- <-- Google Analytics -->
+ <!-- Google Analytics -->
<script type="text/javascript">
var _gaq = _gaq || [];
@@ -30,7 +30,7 @@ })();
</script>
- <-- end Google Analytics -->
+ <!-- end Google Analytics -->
EOD
elsif options[:show_placeholder]
output = "<!-- actual Google Analytics code will render here in #{ options[:environments].map(&:capitalize).to_sentence } -->"
| Fix comment headers for Google Analytics embed
|
diff --git a/lib/hipbot/message.rb b/lib/hipbot/message.rb
index abc1234..def5678 100644
--- a/lib/hipbot/message.rb
+++ b/lib/hipbot/message.rb
@@ -5,7 +5,7 @@
attr_accessor :body
- MENTION_REGEXP = /@(\p{Word}++)/.freeze
+ MENTION_REGEXP = /@(\p{Word}++):?/.freeze
def initialize *args
super
| Allow a colon after mentions
|
diff --git a/init.rb b/init.rb
index abc1234..def5678 100644
--- a/init.rb
+++ b/init.rb
@@ -14,8 +14,8 @@ version = @project.versions.where( name: name ).first!
groupped = rest.group_by { |attr| ((tmp = attr[0...3]) == "max" || tmp == "min") ? tmp : "eq" }
query = Hash[*(groupped["eq"] || []).flat_map {|q| k,v = q.split("="); [k,v]}]
- smaller = (groupped['max'] || []).collect { |attr| attr[4..-1].gsub("=", " < ") }.join(" AND ")
- greater = (groupped['min'] || []).collect { |attr| attr[4..-1].gsub("=", " > ") }.join(" AND ")
+ smaller = (groupped['max'] || []).collect { |attr| attr[4..-1].gsub("=", " <= ") }.join(" AND ")
+ greater = (groupped['min'] || []).collect { |attr| attr[4..-1].gsub("=", " >= ") }.join(" AND ")
content_tag(:ul) do
version.fixed_issues.where(query).where(smaller).where(greater).collect do |issue|
| Fix comparing min and max
|
diff --git a/git_trend.gemspec b/git_trend.gemspec
index abc1234..def5678 100644
--- a/git_trend.gemspec
+++ b/git_trend.gemspec
@@ -20,7 +20,7 @@
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
spec.bindir = "exe"
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
+ spec.executables << 'git-trend'
spec.require_paths = ["lib"]
spec.add_development_dependency "bundler", "~> 1.8"
| Change executable to work in command line
|
diff --git a/lib/ubuntu_unused_kernels.rb b/lib/ubuntu_unused_kernels.rb
index abc1234..def5678 100644
--- a/lib/ubuntu_unused_kernels.rb
+++ b/lib/ubuntu_unused_kernels.rb
@@ -33,6 +33,10 @@ end
def get_installed(suffix)
+ if suffix.nil? or suffix.empty?
+ raise "Suffix argument must not be empty or nil"
+ end
+
args = PACKAGE_PREFIXES.collect { |prefix|
"#{prefix}-*-#{suffix}"
}
@@ -40,7 +44,11 @@ 'dpkg-query', '--show',
'--showformat', '${Package}\n',
*args
- ).first.split("\n")
+ )
+ raise "Unable to get list of packages" unless dpkg.last.success?
+
+ packages = dpkg.first.split("\n")
+ raise "No kernel packages found for prefix" if packages.empty?
return packages
end
| Implement error handling for get_installed.
|
diff --git a/grape_devise_token_auth.gemspec b/grape_devise_token_auth.gemspec
index abc1234..def5678 100644
--- a/grape_devise_token_auth.gemspec
+++ b/grape_devise_token_auth.gemspec
@@ -19,6 +19,6 @@ spec.add_development_dependency "bundler", "~> 1.8"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_dependency 'grape', '> 0.9.0'
- spec.add_dependency 'devise', '~> 3.3'
- spec.add_dependency 'devise_token_auth', '~> 0.1.32.beta9'
+ spec.add_dependency 'devise', '>= 3.3'
+ spec.add_dependency 'devise_token_auth', '>= 0.1.32'
end
| Modify devise and DTA version dependencies
Fixes #12
|
diff --git a/spec/protocol/message_set_spec.rb b/spec/protocol/message_set_spec.rb
index abc1234..def5678 100644
--- a/spec/protocol/message_set_spec.rb
+++ b/spec/protocol/message_set_spec.rb
@@ -0,0 +1,22 @@+describe Kafka::Protocol::Message do
+ include Kafka::Protocol
+
+ it "decodes message sets" do
+ message1 = Kafka::Protocol::Message.new(value: "hello")
+ message2 = Kafka::Protocol::Message.new(value: "good-day")
+
+ message_set = Kafka::Protocol::MessageSet.new(messages: [message1, message2])
+
+ data = StringIO.new
+ encoder = Kafka::Protocol::Encoder.new(data)
+
+ message_set.encode(encoder)
+
+ data.rewind
+
+ decoder = Kafka::Protocol::Decoder.new(data)
+ new_message_set = Kafka::Protocol::MessageSet.decode(decoder)
+
+ expect(new_message_set).to eq message_set
+ end
+end
| Add a spec for MessageSet
|
diff --git a/core/spec/screenshots/conversations_spec.rb b/core/spec/screenshots/conversations_spec.rb
index abc1234..def5678 100644
--- a/core/spec/screenshots/conversations_spec.rb
+++ b/core/spec/screenshots/conversations_spec.rb
@@ -19,4 +19,22 @@
assume_unchanged_screenshot "conversations_overview"
end
+
+ it "the layout of the conversations detail page is correct" do
+ factlink = backend_create_fact
+ message_content = 'content'
+
+ send_message(message_content, factlink, @recipients)
+
+ recipient_ids = Message.last.conversation.recipients.map(&:id)
+
+ @recipients.each do |recipient|
+ expect(recipient_ids).to include recipient.id
+
+ switch_to_user @user
+ open_message_with_content message_content
+ end
+
+ assume_unchanged_screenshot "conversations_detail"
+ end
end
| Add test for conversation detail
|
diff --git a/lib/jolokia/client.rb b/lib/jolokia/client.rb
index abc1234..def5678 100644
--- a/lib/jolokia/client.rb
+++ b/lib/jolokia/client.rb
@@ -14,7 +14,7 @@ options = { 'type' => 'read', 'mbean' => mbean, 'attribute' => attribute }
options['path'] = path if path
- request(:post, options)
+ request(:post, options)['value']
end
def set_attribute(mbean, attribute, value, path = nil)
| Return the value of the attribute
|
diff --git a/nanoc-core/spec/meta_spec.rb b/nanoc-core/spec/meta_spec.rb
index abc1234..def5678 100644
--- a/nanoc-core/spec/meta_spec.rb
+++ b/nanoc-core/spec/meta_spec.rb
@@ -0,0 +1,32 @@+# frozen_string_literal: true
+
+describe 'meta', chdir: false do
+ example do
+ regular_files = Dir['lib/nanoc/core/**/*.rb']
+ regular_file_base_names = regular_files.map { |fn| fn.gsub(/^lib\/nanoc\/core\/|\.rb$/, '') }
+
+ spec_files = Dir['spec/nanoc/core/**/*_spec.rb']
+ spec_file_base_names = spec_files.map { |fn| fn.gsub(/^spec\/nanoc\/core\/|_spec\.rb$/, '') }
+
+ # TODO: don’t ignore anything
+ ignored = %w[
+ action_provider
+ action_sequence_store
+ checksum_collection
+ contracts_support
+ dependency
+ error
+ errors
+ item_collection
+ item_rep_repo
+ layout_collection
+ outdatedness_reasons
+ outdatedness_rule
+ processing_actions
+ snapshot_def
+ version
+ ]
+
+ expect(regular_file_base_names - ignored).to match_array(spec_file_base_names)
+ end
+end
| Verify that all Core files have matching specs
|
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -6,14 +6,20 @@ helper_method :exhibition_is_set
def set_exhibition
- if params.has_key(:exhibition_id)
+ if params.has_key?(:exhibition_id)
@exhibition = Exhibition.find(params[:exhibition_id])
+ session[:exhibition] = @exhibition
else
- @exhibition = 0
+ if session.has_key?(:exhibition)
+ @exhibition = session[:exhibition]
+ else
+ @exhibition = nil #There isn't an exhibition
+ end
end
- end
+ end
def exhibition_is_set
+
return !((defined?(@exhibition)).nil?) #returns true if set otherwise false
end
| Add a fallback to session storage for exhibition
|
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -12,6 +12,9 @@ def error_503(e = nil); error(503, e); end
def error(status_code, exception = nil)
+ if exception and defined? Airbrake
+ env["airbrake.error_id"] = notify_airbrake(exception)
+ end
render :status => status_code, :text => "#{status_code} error"
end
| Call notify_airbrake from controller error method
|
diff --git a/app/controllers/base_assets_controller.rb b/app/controllers/base_assets_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/base_assets_controller.rb
+++ b/app/controllers/base_assets_controller.rb
@@ -19,7 +19,10 @@ protected
def normalize_redirect_url(params)
- params.reject { |k, v| (k.to_sym == :redirect_url) && v.blank? }
+ if params.has_key?(:redirect_url) && params[:redirect_url].blank?
+ params[:redirect_url] = nil
+ end
+ params
end
def normalize_access_limited(params)
| Allow unsetting the redirect URL
|
diff --git a/hero_mapper/app/models/heroe.rb b/hero_mapper/app/models/heroe.rb
index abc1234..def5678 100644
--- a/hero_mapper/app/models/heroe.rb
+++ b/hero_mapper/app/models/heroe.rb
@@ -1,30 +1,30 @@ class Heroe < ApplicationRecord
- validates :name, uniqueness: true
+ validates :marvel_id, uniqueness: true
def self.save_hero_data
- # offset = 0
response_count = nil
- # until response_count == 0
- # character_data = marvel_api_call
- # if character_data['data']['results'].empty?
-
- # end
+ until response_count == 0
+ character_data = marvel_api_call['data']
+ if !character_data['results'].empty?
+ character_data['results'].each do |hero|
+ character = Heroe.new( :name => hero['name'], :comics => hero['comics']['available'] )
+ character.save
+ end
+ response_count = character_data['count']
+ else
+ break
+ end
- # end
+ end
end
private
def self.marvel_api_call
- url = "https://gateway.marvel.com:443/v1/public/characters?limit=100&offset=#{offset}&ts=#{timestamp}&apikey=#{ENV['MARVEL_PUBLIC']}&hash=#{marvel_hash}"
- debugger
+ url = "https://gateway.marvel.com:443/v1/public/characters?orderBy=modified&limit=100&offset=#{Heroe.count}&ts=#{timestamp}&apikey=#{ENV['MARVEL_PUBLIC']}&hash=#{marvel_hash}"
uri = URI(url)
response = Net::HTTP.get(uri)
response = JSON.parse(response)
- end
-
- def self.offset
- Heroe.count
end
def self.marvel_hash
| Update to validate on unique marvel_id. Create loop to populate database
|
diff --git a/spec/data_store_spec.rb b/spec/data_store_spec.rb
index abc1234..def5678 100644
--- a/spec/data_store_spec.rb
+++ b/spec/data_store_spec.rb
@@ -12,4 +12,10 @@ pending
end
end
+
+ describe 'reset(id)' do
+ it 'replaces the transformed data with original data' do
+ pending
+ end
+ end
end
| Add additional pending spec to DataStore
|
diff --git a/spec/full_usage_spec.rb b/spec/full_usage_spec.rb
index abc1234..def5678 100644
--- a/spec/full_usage_spec.rb
+++ b/spec/full_usage_spec.rb
@@ -4,7 +4,7 @@ match do |path|
reader, writer = IO.pipe
error_r, error_w = IO.pipe
- options = {4 => writer.fileno, in: File::NULL, out: File::NULL, err: error_w}
+ options = {4 => writer.fileno, in: File::NULL, out: writer, err: error_w}
pid = spawn('ruby', "spec/full_usage/#{path}", '4', options)
writer.close
| Use STDOUT for full_usage tests
|
diff --git a/spec/support/mongoid.rb b/spec/support/mongoid.rb
index abc1234..def5678 100644
--- a/spec/support/mongoid.rb
+++ b/spec/support/mongoid.rb
@@ -5,7 +5,8 @@ Mongoid.load_configuration({
:sessions => {
:default => {
- :uri => ENV["GARNER_MONGO_URL"] || "mongodb://localhost/garner_test"
+ :uri => ENV["GARNER_MONGO_URL"] || "mongodb://localhost/garner_test",
+ :safe => true
}
},
:options => {
| Add { safe: true } back into Mongoid test mode options
|
diff --git a/spectator-emacs.gemspec b/spectator-emacs.gemspec
index abc1234..def5678 100644
--- a/spectator-emacs.gemspec
+++ b/spectator-emacs.gemspec
@@ -20,4 +20,11 @@ gem.add_development_dependency 'rdoc', '~> 3.0'
gem.add_development_dependency 'rspec', '~> 2.4'
gem.add_development_dependency 'rubygems-tasks', '~> 0.2'
+ gem.add_development_dependency 'yard'
+ gem.add_development_dependency 'redcarpet'
+ gem.add_dependency 'rspec'
+ gem.add_dependency 'spectator', '~> 1.2'
+ gem.add_dependency 'open4'
+ gem.add_dependency 'rb-inotify', '~> 0.8.8'
+ gem.add_dependency 'docopt'
end
| Update gem dependencies in gemspec file.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.