diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
---|---|
diff --git a/week-6/nested_data_solution.rb b/week-6/nested_data_solution.rb
index abc1234..def5678 100644
--- a/week-6/nested_data_solution.rb
+++ b/week-6/nested_data_solution.rb
@@ -0,0 +1,83 @@+# RELEASE 2: NESTED STRUCTURE GOLF
+# Hole 1
+# Target element: "FORE"
+
+array = [[1,2], ["inner", ["eagle", "par", ["FORE", "hook"]]]]
+
+# attempts:
+# ============================================================
+p array[1][1][2][0]
+
+
+# ============================================================
+
+# Hole 2
+# Target element: "congrats!"
+
+hash = {outer: {inner: {"almost" => {3 => "congrats!"}}}}
+
+# attempts:
+# ============================================================
+p hash[:outer][:inner]["almost"][3]
+
+
+# ============================================================
+
+
+# Hole 3
+# Target element: "finished"
+
+nested_data = {array: ["array", {hash: "finished"}]}
+
+# attempts:
+# ============================================================
+p nested_data[:array][1][:hash]
+
+
+# ============================================================
+
+# RELEASE 3: ITERATE OVER NESTED STRUCTURES
+
+number_array = [5, [10, 15], [20,25,30], 35]
+
+number_array.map! {|element|
+ if element.kind_of?(Array)
+ element.map! {|inner| inner += 5}
+ else
+ element += 5
+ end
+}
+
+# p number_array
+
+# Bonus:
+
+startup_names = ["bit", ["find", "fast", ["optimize", "scope"]]]
+
+startup_names.map! {|element|
+ if element.kind_of?(Array)
+ element.map! {|inner|
+ if inner.kind_of?(Array)
+ inner.map! {|meta| meta += "ly"}
+ else
+ inner += "ly"
+ end
+ }
+ else
+ element += "ly"
+ end
+}
+
+p startup_names
+
+# What are some general rules you can apply to nested arrays?
+# => You can access data by chaining indexes.
+# => e.g. test = [0, 1, 2, [4, 5, [6, 7], 8], 9, 10, [11]]
+# => to get 7, you would call test[3][2][1]
+# => [3][2][1] is the chain of indexes.
+#
+# What are some ways you can iterate over nested arrays?
+# => You can use the enumberable methods like each and map to check if an element is an array or hash. If it is, then you can add a nested loop to iterate through the nested array/hash. You can also probably use recursion to do this so that you can make your code DRY.
+#
+# Did you find any good new methods to implement or did you re-use one you were already familiar with? What was it and why did you decide that was a good option?
+# => For release 3 and the bonus, we used map! to make a destructive loop. We used it differently. Instead of using one line like in the previous weeks, we added if/else statements and a nested map! loop.
|
Add completed nested data challenge with reflection.
|
diff --git a/lib/neat.rb b/lib/neat.rb
index abc1234..def5678 100644
--- a/lib/neat.rb
+++ b/lib/neat.rb
@@ -1,7 +1,4 @@+require "sass"
require "neat/generator"
-neat_path = File.expand_path("../../core", __FILE__)
-ENV["SASS_PATH"] = [
- ENV["SASS_PATH"],
- neat_path,
-].compact.join(File::PATH_SEPARATOR)
+Sass.load_paths << File.expand_path("../../core", __FILE__)
|
Use Sass.load_paths instead of SASS_PATH env
The SASS_PATH environment variable is not intended to be set by another
library but rather by consumers of Sass. Since the environment variable
is only read in once at the first time `load_paths` is called.
This was causing an error where, if a user had another gem such as
`bootstrap-sass` and it was being loaded before `neat` was, the
modifications to `SASS_PATH` we were making were never read in, so the
neat files would never be found.
See https://github.com/sass/sass/blob/1b628f03b9361fa6047097c9fd0d01b21247b8f3/lib/sass.rb#L20-L43
|
diff --git a/gemdiff.gemspec b/gemdiff.gemspec
index abc1234..def5678 100644
--- a/gemdiff.gemspec
+++ b/gemdiff.gemspec
@@ -23,7 +23,6 @@ spec.add_dependency "octokit", "~> 4.0"
spec.add_dependency "thor", "~> 0.19"
- spec.add_development_dependency "bundler", ">= 1.7"
spec.add_development_dependency "minitest", "~> 5.4"
spec.add_development_dependency "mocha", "~> 1.1"
spec.add_development_dependency "rake", "~> 12.0"
|
Remove bundler dependency from gemspec
|
diff --git a/log.gemspec b/log.gemspec
index abc1234..def5678 100644
--- a/log.gemspec
+++ b/log.gemspec
@@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'log'
- s.version = '0.4.2.0'
+ s.version = '0.4.2.1'
s.summary = 'Logging to STD IO with levels, tagging, and coloring'
s.description = ' '
|
Package version is increased from 0.4.2.0 to 0.4.2.1
|
diff --git a/app/controllers/solidus_subscriptions/api/v1/line_items_controller.rb b/app/controllers/solidus_subscriptions/api/v1/line_items_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/solidus_subscriptions/api/v1/line_items_controller.rb
+++ b/app/controllers/solidus_subscriptions/api/v1/line_items_controller.rb
@@ -16,6 +16,8 @@ return render json: {}, status: 400 if @line_item.order.complete?
@line_item.destroy!
+ @line_item.order.update!
+
render json: @line_item.to_json
end
|
Update order on subscription line item removal
This could affect promotions if they are targeting line items with
associated subscription line items
|
diff --git a/core/lib/spree/core/testing_support/factories/tax_category_factory.rb b/core/lib/spree/core/testing_support/factories/tax_category_factory.rb
index abc1234..def5678 100644
--- a/core/lib/spree/core/testing_support/factories/tax_category_factory.rb
+++ b/core/lib/spree/core/testing_support/factories/tax_category_factory.rb
@@ -6,8 +6,11 @@
factory :tax_category_with_rates, :parent => :tax_category do
after_create do |tax_category|
- tax_category.tax_rates.create!(:amount => 0.05, :calculator => Spree::Calculator::DefaultTax.new,
- :zone => Spree::Zone.global)
+ tax_category.tax_rates.create!({
+ :amount => 0.05,
+ :calculator => Spree::Calculator::DefaultTax.new,
+ :zone => Spree::Zone.find_by_name('GlobalZone') || FactoryGirl.create(:global_zone)
+ })
end
end
end
|
Fix TaxRate.zone mass-assignment in TaxCategory factory
Fixes #1817
|
diff --git a/lib/generators/wepay_rails/install/templates/wepay_checkout_record.rb b/lib/generators/wepay_rails/install/templates/wepay_checkout_record.rb
index abc1234..def5678 100644
--- a/lib/generators/wepay_rails/install/templates/wepay_checkout_record.rb
+++ b/lib/generators/wepay_rails/install/templates/wepay_checkout_record.rb
@@ -1,8 +1,4 @@ class WepayCheckoutRecord < ActiveRecord::Base
- belongs_to :checkout
- belongs_to :preapproval
- belongs_to :ipn
- belongs_to :authorize
attr_accessible :amount,
:short_description,
:access_token,
|
Remove relationships in WepayCheckoutRecord model, as it's up to the user to customize.
|
diff --git a/spec/diffusul/version_spec.rb b/spec/diffusul/version_spec.rb
index abc1234..def5678 100644
--- a/spec/diffusul/version_spec.rb
+++ b/spec/diffusul/version_spec.rb
@@ -0,0 +1,18 @@+require 'diffusul/version'
+
+ver2next = {
+ '1' => '2',
+ 'v1' => 'v2',
+ 'v0.3.1' => 'v0.3.2',
+ 'p208-1' => 'p208-2',
+ 'foo' => 'foo-1',
+}
+
+describe 'Automatically determine next version' do
+ ver2next.each_pair do |pre,nxt|
+ it "#{pre} => #{nxt}" do
+ ver = Diffusul::Version.new(value: pre)
+ expect(ver.next_version).to eq nxt
+ end
+ end
+end
|
Write test for auto versioning
|
diff --git a/spec/lita/ext/handler_spec.rb b/spec/lita/ext/handler_spec.rb
index abc1234..def5678 100644
--- a/spec/lita/ext/handler_spec.rb
+++ b/spec/lita/ext/handler_spec.rb
@@ -0,0 +1,74 @@+require 'spec_helper'
+
+describe Lita::Handler, lita: true do
+ let(:robot) { instance_double("Lita::Robot", name: "Lita") }
+ let(:user) { instance_double("Lita::User", name: "Test User") }
+
+ let(:handler_class) do
+ Class.new(described_class) do
+ config :foo
+ config :bar, required: false
+ config :baz, default: "default value"
+
+ def self.name
+ "FooHandler"
+ end
+ end
+ end
+
+ subject { handler_class.new(robot) }
+
+ it "auto-registers Lita::Handler sub-classes" do
+ class TestHandler < Lita::Handler
+ end
+ Lita.send(:register_app_handlers)
+ expect(Lita.handlers).to include(TestHandler)
+ end
+
+ describe '.config_options' do
+ it "contains specified configuration options" do
+ expect(handler_class.config_options.length).to eq(3)
+ end
+ end
+
+ describe '.config' do
+ before do
+ allow(Lita).to receive(:handlers).and_return([subject])
+ Lita::Config.load_user_config
+ end
+
+ it "defaults to required" do
+ foo_option = handler_class.config_options.select { |opt| opt.name == :foo }.first
+ expect(foo_option.required?).to eq(true)
+ end
+
+ it "required option can be used to make a config setting optional" do
+ bar_option = handler_class.config_options.select { |opt| opt.name == :bar }.first
+ expect(bar_option.required?).to eq(false)
+ end
+
+ # TODO: figure out how to initialize the handler's config object properly
+ # it "can accept a default value for the config setting" do
+ # baz_option = handler_class.config_options.select { |opt| opt.name == :baz }.first
+ # expect(baz_option.default).to eq("default value")
+ # expect(subject.config[:baz]).to eq("default value")
+ # end
+ end
+
+ describe '#log' do
+ it "returns the Lita logger" do
+ expect(subject.log).to eq(Lita.logger)
+ end
+ end
+
+ describe '#config' do
+ it "returns the handler's config object" do
+ expect(subject.config).to eq(Lita.config.handlers.foo_handler)
+ end
+
+ # TODO: figure out how to initialize the handler's config object properly
+ # it "contains options specified with Lita::Handler.config" do
+ # exepect(subject.config.baz).to eq("default value")
+ # end
+ end
+end
|
Add tests for the Lita::Handler extensions.
|
diff --git a/lib/debox_server/recipes.rb b/lib/debox_server/recipes.rb
index abc1234..def5678 100644
--- a/lib/debox_server/recipes.rb
+++ b/lib/debox_server/recipes.rb
@@ -47,7 +47,7 @@ end
def recipe_template_content
- name = File.join Config.debox_root, 'assets', RECIPE_TEMPLATE
+ name = File.join Config.debox_root, 'templates', RECIPE_TEMPLATE
File.open(name).read
end
|
Use the new dir for templates
|
diff --git a/spree_unified_payment.gemspec b/spree_unified_payment.gemspec
index abc1234..def5678 100644
--- a/spree_unified_payment.gemspec
+++ b/spree_unified_payment.gemspec
@@ -2,7 +2,7 @@ s.platform = Gem::Platform::RUBY
s.name = "spree_unified_payment"
s.version = "1.0.0"
- s.author = ["Manish Kangia", "Sushant Mittal"
+ s.author = ["Manish Kangia", "Sushant Mittal"]
s.email = '[email protected]'
s.homepage = 'http://vinsol.com'
s.license = 'MIT'
|
Add missing ] in gemspec file.
|
diff --git a/lib/frecon/models/record.rb b/lib/frecon/models/record.rb
index abc1234..def5678 100644
--- a/lib/frecon/models/record.rb
+++ b/lib/frecon/models/record.rb
@@ -9,8 +9,8 @@ field :position, type: Position
belongs_to :match
- belongs_to :participation
+ belongs_to :team
- validates :position, :match_id, :participation_id, presence: true
+ validates :position, :match_id, :team_id, presence: true
end
end
|
Revert "Record: Use participation, not team"
This reverts commit dc5d1b6f723fb129c25e7fbb201fce0052d9b85a.
No need for participations.
|
diff --git a/test/browser/features/support/env.rb b/test/browser/features/support/env.rb
index abc1234..def5678 100644
--- a/test/browser/features/support/env.rb
+++ b/test/browser/features/support/env.rb
@@ -21,15 +21,18 @@ end
Process.detach(pid)
-bs_local_start
-$driver = driver_start
-
def get_test_url path
"http://#{ENV['HOST']}:#{FIXTURES_SERVER_PORT}#{path}?ENDPOINT=#{URI::encode("http://#{ENV['API_HOST']}:#{MOCK_API_PORT}")}&API_KEY=#{URI::encode($api_key)}"
end
def get_error_message id
ERRORS[ENV['BROWSER']][id]
+end
+
+AfterConfiguration do
+ # Necessary as Appium removes any existing $driver instance on load
+ bs_local_start
+ $driver = driver_start
end
at_exit do
|
Tests: Move initialization into AfterConfiguration to avoid appium overwrite
|
diff --git a/calfresh_application_writer.rb b/calfresh_application_writer.rb
index abc1234..def5678 100644
--- a/calfresh_application_writer.rb
+++ b/calfresh_application_writer.rb
@@ -1,15 +1,24 @@ require 'pdf_forms'
-class CalfreshApplicationWriter
- def initialize
- @pdftk = PdfForms.new('/usr/bin/pdftk')
- end
+module Calfresh
+ FORM_FIELDS = { name: 'Text1 PG 1', \
+ home_address: 'Text4 PG 1', \
+ home_city: 'Text5 PG 1', \
+ home_state: 'Text6 PG 1', \
+ home_zip_code: 'Text7 PG 1' \
+ }
- def fill_out_form(args)
- validated_field_values = args.select { |key| ['name','address'].include?(key.to_s) }
- # Need to replace keys with keys from form
- @pdftk.fill_form './calfresh_application.pdf', \
- "/tmp/calfresh_application_filled_in_at_#{Time.now.strftime('%Y%m%d%H%M%S%L')}.pdf", \
- validated_field_values
+ class ApplicationWriter
+ def initialize
+ @pdftk = PdfForms.new('/usr/bin/pdftk')
+ end
+
+ def fill_out_form(args)
+ validated_field_values = args.select { |key| ['name','address'].include?(key.to_s) }
+ # Need to replace keys with keys from form, accessible via Calfresh::FORM_FIELDS
+ @pdftk.fill_form './calfresh_application.pdf', \
+ "/tmp/calfresh_application_filled_in_at_#{Time.now.strftime('%Y%m%d%H%M%S%L')}.pdf", \
+ validated_field_values
+ end
end
end
|
Make Calfresh module and add FORM_FIELDS mapping constant
|
diff --git a/test/integration/ubuntu12_04_test.rb b/test/integration/ubuntu12_04_test.rb
index abc1234..def5678 100644
--- a/test/integration/ubuntu12_04_test.rb
+++ b/test/integration/ubuntu12_04_test.rb
@@ -0,0 +1,14 @@+require 'integration_helper'
+
+class Ubuntu12_04Test < IntegrationTest
+ def user
+ "ubuntu"
+ end
+
+ def image_id
+ "ami-098f5760"
+ end
+
+ include EmptyCook
+ include Apache2Cook
+end
|
Add ubuntu 12.04 integration test.
|
diff --git a/lib/qb_integration/stock.rb b/lib/qb_integration/stock.rb
index abc1234..def5678 100644
--- a/lib/qb_integration/stock.rb
+++ b/lib/qb_integration/stock.rb
@@ -15,7 +15,7 @@ end
def inventories
- items.each do |inventory|
+ items.map do |inventory|
{
id: "qbs-#{inventory.name}",
product_id: inventory.name,
@@ -25,7 +25,7 @@ end
def last_modified_date
- items.last.meta_data.last_updated_time
+ items.last.meta_data.last_updated_time.utc.iso8601
end
end
end
|
Return a valid timestamp for inventory polling
|
diff --git a/lib/refinery_initializer.rb b/lib/refinery_initializer.rb
index abc1234..def5678 100644
--- a/lib/refinery_initializer.rb
+++ b/lib/refinery_initializer.rb
@@ -1,4 +1,7 @@-REFINERY_ROOT = File.join File.dirname(__FILE__), '..'
+# Get library path without '..' directories.
+dir_parts = (File.join File.dirname(__FILE__), '..').split(File::SEPARATOR)
+dir_parts = dir_parts[0..(dir_parts.length-3)] until dir_parts[dir_parts.length-1] != ".."
+REFINERY_ROOT = File.join dir_parts
unless REFINERY_ROOT == RAILS_ROOT # e.g. only if we're in a gem.
$LOAD_PATH.unshift "#{REFINERY_ROOT}/vendor/plugins"
|
Remove any dir/.. in REFINERY_ROOT which are ugly and useless.
|
diff --git a/lib/sidekiq/grouping/web.rb b/lib/sidekiq/grouping/web.rb
index abc1234..def5678 100644
--- a/lib/sidekiq/grouping/web.rb
+++ b/lib/sidekiq/grouping/web.rb
@@ -11,11 +11,11 @@ erb File.read(File.join(VIEWS, 'index.erb')), locals: {view_path: VIEWS}
end
- app.post "/grouping/*/delete" do |name|
- worker_class, queue = Sidekiq::Grouping::Batch.extract_worker_klass_and_queue(name)
+ app.post "/grouping/:name/delete" do
+ worker_class, queue = Sidekiq::Grouping::Batch.extract_worker_klass_and_queue(params['name'])
batch = Sidekiq::Grouping::Batch.new(worker_class, queue)
batch.delete
- redirect "#{root_path}/grouping"
+ redirect "#{root_path}grouping"
end
end
@@ -25,4 +25,3 @@
Sidekiq::Web.register(Sidekiq::Grouping::Web)
Sidekiq::Web.tabs["Grouping"] = "grouping"
-
|
Fix grouping delete from Sidekiq Web
|
diff --git a/lib/jmespath/nodes/subexpression.rb b/lib/jmespath/nodes/subexpression.rb
index abc1234..def5678 100644
--- a/lib/jmespath/nodes/subexpression.rb
+++ b/lib/jmespath/nodes/subexpression.rb
@@ -46,7 +46,7 @@ end
def optimize
- children = @children.dup
+ children = @children.map(&:optimize)
index = 0
while index < children.size - 1
if children[index].is_a?(Field) && children[index + 1].is_a?(Field)
|
Optimize an extra time in Chain
Right now the children of a Chain are guaranteed to be optimized, but if it were used from somewhere else that would not hold.
|
diff --git a/lib/asteroids/states/play_state.rb b/lib/asteroids/states/play_state.rb
index abc1234..def5678 100644
--- a/lib/asteroids/states/play_state.rb
+++ b/lib/asteroids/states/play_state.rb
@@ -6,6 +6,7 @@ Utils.get_image_path('background.png'), false)
@object_pool = ObjectPool.new
@ship = Ship.new(@object_pool)
+ create_asteroids(4)
end
def draw
@@ -23,5 +24,12 @@ end
end
+ def create_asteroids(amount)
+ amount.times do |n|
+ Asteroid.new(@object_pool, rand(800), rand(600),
+ rand() * 0.6 - 0.3, rand() * 0.6 - 0.3, 0)
+ end
+ end
+
end
end
|
Implement the asteroid spawning method.
|
diff --git a/db/migrate/20170225002251_create_waypoints.rb b/db/migrate/20170225002251_create_waypoints.rb
index abc1234..def5678 100644
--- a/db/migrate/20170225002251_create_waypoints.rb
+++ b/db/migrate/20170225002251_create_waypoints.rb
@@ -2,7 +2,7 @@ def change
create_table :waypoints do |t|
# t.string :name, { null: false }
- t.st_point :coordinates, geographic: true
+ t.st_point :location, geographic: true
t.timestamps
end
end
|
Rename Waypoint migration column to location
|
diff --git a/spec/unit/veritas/adapter/arango/visitor/for/unary/local_name_spec.rb b/spec/unit/veritas/adapter/arango/visitor/for/unary/local_name_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/veritas/adapter/arango/visitor/for/unary/local_name_spec.rb
+++ b/spec/unit/veritas/adapter/arango/visitor/for/unary/local_name_spec.rb
@@ -0,0 +1,21 @@+require 'spec_helper'
+
+describe Veritas::Adapter::Arango::Visitor::For::Unary, '#local_name' do
+ subject { object.local_name }
+ let(:object) { class_under_test.new(relation, context) }
+ let(:relation) { mock('Relation') }
+ let(:context) { mock('Context') }
+
+ let(:local_name) { mock('Local Name') }
+
+ let(:class_under_test) do
+ local_name = self.local_name
+ Class.new(described_class) do
+ const_set('LOCAL_NAME', local_name)
+ end
+ end
+
+ it_should_behave_like 'an idempotent method'
+
+ it { should be(local_name) }
+end
|
Kill mutation in unary FOR visitor
|
diff --git a/lib/middleman-s3_sync/extension.rb b/lib/middleman-s3_sync/extension.rb
index abc1234..def5678 100644
--- a/lib/middleman-s3_sync/extension.rb
+++ b/lib/middleman-s3_sync/extension.rb
@@ -21,7 +21,7 @@ # Define the after_build step after during configuration so
# that it's pushed to the end of the callback chain
app.after_build do |builder|
- ::Middleman::S3Sync.sync(@option) if options.after_build
+ ::Middleman::S3Sync.sync(@options) if options.after_build
end
options.build_dir ||= build_dir
|
Fix a typo in the @options variable.
Fixes #64.
|
diff --git a/features/support/local_env.rb b/features/support/local_env.rb
index abc1234..def5678 100644
--- a/features/support/local_env.rb
+++ b/features/support/local_env.rb
@@ -0,0 +1,54 @@+require 'coveralls'
+require 'selenium-webdriver'
+Coveralls.wear_merged!('rails')
+
+require 'pry'
+
+# Require support classes in spec/support and its subdirectories.
+Dir[Rails.root.join("spec/support/**/*.rb")].each do |helper|
+ require helper
+end
+
+# Require and include helper modules
+# in feature/support/helpers and its subdirectories.
+Dir[Rails.root.join("features/support/helpers/**/*.rb")].each do |helper|
+ require helper
+ # Only include _helper.rb methods
+ if /_helper.rb/ === helper
+ helper_name = "RoomsFeatures::#{helper.camelize.demodulize.split('.').first}"
+ Cucumber::Rails::World.send(:include, helper_name.constantize)
+ end
+end
+
+require 'capybara/poltergeist'
+
+if ENV['IN_BROWSER']
+ # On demand: non-headless tests via Selenium/WebDriver
+ # To run the scenarios in browser (default: Firefox), use the following command line:
+ # IN_BROWSER=true bundle exec cucumber
+ # or (to have a pause of 1 second between each step):
+ # IN_BROWSER=true PAUSE=1 bundle exec cucumber
+ Capybara.register_driver :selenium do |app|
+ http_client = Selenium::WebDriver::Remote::Http::Default.new
+ http_client.timeout = 120
+ Capybara::Selenium::Driver.new(app, :browser => :firefox, :http_client => http_client)
+ end
+ Capybara.default_driver = :selenium
+ AfterStep do
+ sleep (ENV['PAUSE'] || 0).to_i
+ end
+else
+ # DEFAULT: headless tests with poltergeist/PhantomJS
+ Capybara.register_driver :poltergeist do |app|
+ Capybara::Poltergeist::Driver.new(
+ app,
+ phantomjs_options: ['--load-images=no', '--ignore-ssl-errors=yes', '--ssl-protocol=TLSv1'],
+ window_size: [1280, 1024],
+ timeout: 120#,
+ # debug: true
+ )
+ end
+ Capybara.default_driver = :poltergeist
+ Capybara.javascript_driver = :poltergeist
+ # Capybara.default_wait_time = 20
+end
|
Set up settings for cucumber
|
diff --git a/spec/features/user_creates_species_variation_observation_spec.rb b/spec/features/user_creates_species_variation_observation_spec.rb
index abc1234..def5678 100644
--- a/spec/features/user_creates_species_variation_observation_spec.rb
+++ b/spec/features/user_creates_species_variation_observation_spec.rb
@@ -16,12 +16,12 @@ fill_in('Average height', with: '10.0')
fill_in('Average width', with: '10.0')
fill_in('Qualitative observations', with: 'Fake description')
- click_on('Create Species variation observation')
+ click_on('Create Obs.')
expect(page).to have_content('Species variation observation was successfully created')
end
scenario 'with invalid sample attributes' do
- click_on('Create Species variation observation')
+ click_on('Create Obs.')
expect(page).to have_content('The form contains 5 errors')
end
|
Update test to match UI
|
diff --git a/spec/download_helper.rb b/spec/download_helper.rb
index abc1234..def5678 100644
--- a/spec/download_helper.rb
+++ b/spec/download_helper.rb
@@ -5,9 +5,11 @@ end
def wait_for_download
- sleep 1
Timeout.timeout(Capybara.default_max_wait_time) do
- sleep 1 until downloaded?
+ loop do
+ sleep 1
+ break if downloaded?
+ end
end
end
|
Use do...while instead of while in wait_for_download
This gives browser the time to have started a new download. Also,
FileUtils.rm can take time to have effect. Even though this time
is in millisecond level, it can sometime happen that downloaded?
returns true simply because the old file hasn't been deleted yet.
Signed-off-by: Anurag Priyam <[email protected]>
|
diff --git a/spec/helpers/servers.rb b/spec/helpers/servers.rb
index abc1234..def5678 100644
--- a/spec/helpers/servers.rb
+++ b/spec/helpers/servers.rb
@@ -3,7 +3,6 @@ ### This helper is required because servers.get(id) does not work
def get_server(connection = nil, id)
connection ||= compute_connection
- connection.servers.filters = {'instance-id' => ["#{id}"]}
- connection.servers.first
+ connection.servers.select {|s| s.id == id}.first
end
end
|
Fix the helper method to get server based on id.
|
diff --git a/lib/envm/env_var.rb b/lib/envm/env_var.rb
index abc1234..def5678 100644
--- a/lib/envm/env_var.rb
+++ b/lib/envm/env_var.rb
@@ -2,24 +2,23 @@
module Envm
class EnvVar
- attr_accessor :name, :description, :default_value, :required
+ attr_accessor :name, :description, :default_value, :required_environments
def initialize(name:, description: nil, default_value: nil, required: [])
self.name = name
self.description = description
self.default_value = default_value
- self.required = []
if required.respond_to?(:include?)
- self.required = required
+ self.required_environments = required
else
- self.required = []
- self.required << DEFAULT_ENV if required
+ self.required_environments = []
+ self.required_environments << DEFAULT_ENV if required
end
end
def value
- if required?(Config.environment)
+ if required_environments.include?(Config.environment)
system_value or fail(NotSetError, "'#{name}' environment variable was required but set on system.")
else
default_value || system_value
@@ -29,11 +28,5 @@ def system_value
ENV[name]
end
-
- private
-
- def required?(env)
- required.include?(env)
- end
end
end
|
Rename ivar on env var for clarity
|
diff --git a/metadata.rb b/metadata.rb
index abc1234..def5678 100644
--- a/metadata.rb
+++ b/metadata.rb
@@ -14,4 +14,6 @@
recommends 'java', '~> 1.17'
-supports 'centos'
+%w(centos debian).each do |os|
+ supports os
+end
|
Add debian to supported OSes
|
diff --git a/metadata.rb b/metadata.rb
index abc1234..def5678 100644
--- a/metadata.rb
+++ b/metadata.rb
@@ -2,7 +2,7 @@ maintainer 'Chef Software, Inc.'
maintainer_email '[email protected]'
license 'Apache 2.0'
-description 'Provides experimental interface to partial search API in Chef Software Hosted Chef'
+description 'Provides experimental interface to partial search API in Chef Software Hosted Chef for Chef-Client pre-11.10.0'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '1.0.8'
source_url 'https://github.com/chef-cookbooks/partial_search' if respond_to?(:source_url)
|
Clarify where this is needed in the description
|
diff --git a/spec/service_methods/miq_ae_service_classification_spec.rb b/spec/service_methods/miq_ae_service_classification_spec.rb
index abc1234..def5678 100644
--- a/spec/service_methods/miq_ae_service_classification_spec.rb
+++ b/spec/service_methods/miq_ae_service_classification_spec.rb
@@ -2,22 +2,22 @@
describe MiqAeMethodService::MiqAeServiceClassification do
before do
- @cat1 = FactoryGirl.create(:classification_department_with_tags)
- @cat2 = FactoryGirl.create(:classification_cost_center_with_tags)
- @cat_array = Classification.categories.collect(&:name)
- @tags_array = @cat2.entries.collect(&:name)
+ FactoryGirl.create(:classification_department_with_tags)
+ @cc_cat = FactoryGirl.create(:classification_cost_center_with_tags)
end
let(:user) { FactoryGirl.create(:user_with_group) }
let(:categories) { MiqAeMethodService::MiqAeServiceClassification.categories }
it "get a list of categories" do
- expect(categories.collect(&:name)).to match_array(@cat_array)
+ cat_array = Classification.categories.collect(&:name)
+ expect(categories.collect(&:name)).to match_array(cat_array)
end
it "check the tags" do
+ tags_array = @cc_cat.entries.collect(&:name)
cc = categories.detect { |c| c.name == 'cc' }
tags = cc.entries
- expect(tags.collect(&:name)).to match_array(@tags_array)
+ expect(tags.collect(&:name)).to match_array(tags_array)
end
end
|
Automate methods can access categories and entries
https://bugzilla.redhat.com/show_bug.cgi?id=1254953
PR feedback
(transferred from ManageIQ/manageiq@06d79ecb7c45c39ae1009925199461b7f6c95b94)
|
diff --git a/que.gemspec b/que.gemspec
index abc1234..def5678 100644
--- a/que.gemspec
+++ b/que.gemspec
@@ -19,4 +19,6 @@ spec.require_paths = ['lib']
spec.add_development_dependency 'bundler', '~> 1.3'
+
+ spec.add_runtime_dependency 'activesupport'
end
|
Declare the gem's dependency on ActiveSupport
We now [use][1] ActiveSupport in `Que::Job`. This dependency isn't
declared in the gemspec, so it can cause projects using Que to
blow up (e.g. [que-failure][2].
This declares the dependency on `activesupport`. I haven't
specified a specific version because the method calls I've
identified which require `active_support/core_ext` are using
sugary `Hash` methods that have been around for a while.
[1]: https://github.com/gocardless/que/blob/master/lib/que/job.rb#L1-L2
[2]: https://circleci.com/gh/gocardless/que-failure/17?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link
|
diff --git a/app/presenters/home_page_presenter.rb b/app/presenters/home_page_presenter.rb
index abc1234..def5678 100644
--- a/app/presenters/home_page_presenter.rb
+++ b/app/presenters/home_page_presenter.rb
@@ -1,3 +1,4 @@+#= Presenter for main page / cohort view
class HomePagePresenter
attr_reader :current_user, :cohort_param
@@ -12,7 +13,7 @@ end
def user_courses
- return [] unless current_user && current_user.admin?
+ return [] unless current_user
current_user.courses.current_and_future.listed
end
@@ -28,6 +29,7 @@ end
end
+#= Pseudo-Cohort that displays all unsubmitted, non-deleted courses
class NullCohort
def title
'Unsubmitted Courses'
|
Fix logic for loading a user's active courses on the home page
|
diff --git a/spec/controllers/ontology_search_controller_spec.rb b/spec/controllers/ontology_search_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/ontology_search_controller_spec.rb
+++ b/spec/controllers/ontology_search_controller_spec.rb
@@ -0,0 +1,25 @@+require 'spec_helper'
+
+describe OntologySearchController do
+
+ describe "GET search" do
+ it "searches for ontologies with the given keywords" do
+ @request.env["HTTP_ACCEPT"] = "application/json"
+ @request.env["CONTENT_TYPE"] = "application/json"
+ get :search, { keywords: [] }
+
+
+ expect(response.status).to eq(200)
+ end
+ end
+
+ describe "GET filter_map" do
+ it "renders a map of filters in json" do
+ @request.env["HTTP_ACCEPT"] = "application/json"
+ @request.env["CONTENT_TYPE"] = "application/json"
+ get :filters_map
+ expect(response.status).to eq(200)
+ end
+ end
+
+end
|
Add ontology search controller spec
|
diff --git a/spec/mailers/timeslot_mailer_spec.rb b/spec/mailers/timeslot_mailer_spec.rb
index abc1234..def5678 100644
--- a/spec/mailers/timeslot_mailer_spec.rb
+++ b/spec/mailers/timeslot_mailer_spec.rb
@@ -25,4 +25,28 @@
end
+ describe "tutor_cancel" do
+ let!(:timeslot) { FactoryGirl.create(:booked_timeslot)}
+ let!(:mail) { TimeslotMailer.tutor_cancel(timeslot, timeslot.student) }
+
+ it "renders the headers" do
+ expect(mail.subject).to eq("Mentor Me Cancellation Notification")
+ expect(mail.to).to eq(["[email protected]"])
+ expect(mail.from).to eq(["[email protected]"])
+ end
+
+ end
+
+ describe "student_cancel" do
+ let!(:timeslot) { FactoryGirl.create(:booked_timeslot)}
+ let!(:mail) { TimeslotMailer.tutor_cancel(timeslot, timeslot.student) }
+
+ it "renders the headers" do
+ expect(mail.subject).to eq("Mentor Me Cancellation Notification")
+ expect(mail.to).to eq(["[email protected]"])
+ expect(mail.from).to eq(["[email protected]"])
+ end
+
+ end
+
end
|
Add spec for timeslot mailer cancellation methods
Add specs to verify the proper issuance of email notifications to
student and tutor that a session has been canceled.
|
diff --git a/data-aggregation-index.gemspec b/data-aggregation-index.gemspec
index abc1234..def5678 100644
--- a/data-aggregation-index.gemspec
+++ b/data-aggregation-index.gemspec
@@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'data_aggregation-index'
- s.version = '0.0.0.1'
+ s.version = '0.1.0.0'
s.summary = 'Event store data aggregation index library'
s.description = ' '
|
Package version is increased from 0.0.0.1 to 0.1.0.0
|
diff --git a/absinthe.gemspec b/absinthe.gemspec
index abc1234..def5678 100644
--- a/absinthe.gemspec
+++ b/absinthe.gemspec
@@ -1,12 +1,13 @@ Gem::Specification.new do |s|
- s.name = 'absinthe'
- s.version = '0.0.1'
- s.platform = Gem::Platform::RUBY
- s.license = 'bsd'
- s.summary = "Absinthe is an opinioned IoC container for Ruby."
- s.description = "Not yet suitable for production use!"
- s.authors = ["Lance Cooper"]
- s.email = '[email protected]'
- s.files = ["lib/absinthe.rb"]
- s.homepage = 'https://github.com/deathwish/absinthe'
+ s.name = 'absinthe'
+ s.version = '0.0.2'
+ s.platform = Gem::Platform::RUBY
+ s.license = 'bsd'
+ s.summary = "Absinthe is an opinioned IoC container for Ruby."
+ s.description = "Not yet suitable for production use!"
+ s.authors = ["Lance Cooper"]
+ s.email = '[email protected]'
+ s.files = Dir.glob("lib/**/*.rb")
+ s.require_path = 'lib'
+ s.homepage = 'https://github.com/deathwish/absinthe'
end
|
Correct file listing in gemspec.
|
diff --git a/lib/stripe_event.rb b/lib/stripe_event.rb
index abc1234..def5678 100644
--- a/lib/stripe_event.rb
+++ b/lib/stripe_event.rb
@@ -50,7 +50,8 @@ end
end
- class UnauthorizedError < StandardError; end
+ class StripeEvent::Error < StandardError; end
+ class StripeEvent::UnauthorizedError < StripeEvent::Error; end
self.backend = ActiveSupport::Notifications
self.event_retriever = lambda { |params| Stripe::Event.retrieve(params[:id]) }
|
Add base error class for all specific error classes to inherit from
|
diff --git a/hermann.gemspec b/hermann.gemspec
index abc1234..def5678 100644
--- a/hermann.gemspec
+++ b/hermann.gemspec
@@ -16,6 +16,7 @@ s.require_paths = ["lib", "ext"]
s.rubygems_version = %q{2.2.2}
s.summary = %q{The Kafka consumer is based on the librdkafka C library.}
+ s.licenses = ['MIT']
s.platform = Gem::Platform::CURRENT
|
Add MIT license to Gemspec.
|
diff --git a/tepco_usage_api.gemspec b/tepco_usage_api.gemspec
index abc1234..def5678 100644
--- a/tepco_usage_api.gemspec
+++ b/tepco_usage_api.gemspec
@@ -18,5 +18,7 @@ lib/**/*.rb
spec/**/*
]]
+ spec.add_dependency('nokogiri', '>= 1.4.0')
+ spec.add_development_dependency('rspec')
end
|
Define depencencies of this gem.
|
diff --git a/NSDateComponents-HNExtensions.podspec b/NSDateComponents-HNExtensions.podspec
index abc1234..def5678 100644
--- a/NSDateComponents-HNExtensions.podspec
+++ b/NSDateComponents-HNExtensions.podspec
@@ -12,4 +12,6 @@
s.source_files = 'NSDateComponents+HNExtensions.{h,m}'
s.resources = 'Localizations/**'
+
+ s.requires_arc = true
end
|
Make sure requires_arc is set to true
|
diff --git a/jobs/summary.rb b/jobs/summary.rb
index abc1234..def5678 100644
--- a/jobs/summary.rb
+++ b/jobs/summary.rb
@@ -5,6 +5,6 @@
send_event('total-donated', { current: summary["total_donated"] })
send_event('procedures', { current: summary["procedures"] })
- send_event('checkouts', { current: summary["checkouts"] })
+ send_event('checkouts', { current: summary["check_outs"] })
send_event('top-procedures', { items: summary["top_procedures"] })
end
|
Fix check out data feed
|
diff --git a/app/controllers/commits_controller.rb b/app/controllers/commits_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/commits_controller.rb
+++ b/app/controllers/commits_controller.rb
@@ -21,7 +21,8 @@ .select_append(:projects__name)
page = params[:page] ? params[:page].to_i : 1
- @commits = @commits.paginate(page, 10)
+ results_per_page = 25
+ @commits = @commits.paginate(page, results_per_page)
end
def show
|
Increase total results per page
|
diff --git a/app/helpers/admin/injection_helper.rb b/app/helpers/admin/injection_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/admin/injection_helper.rb
+++ b/app/helpers/admin/injection_helper.rb
@@ -6,6 +6,10 @@
def admin_inject_payment_methods
admin_inject_json_ams_array "admin.payment_methods", "paymentMethods", @payment_methods, Api::Admin::IdNameSerializer
+ end
+
+ def admin_inject_shipping_methods
+ admin_inject_json_ams_array "admin.shipping_methods", "shippingMethods", @shipping_methods, Api::Admin::IdNameSerializer
end
def admin_inject_json_ams(ngModule, name, data, serializer, opts = {})
|
Add shipping method injection helper using id name serializer
|
diff --git a/app/models/ontology_version/states.rb b/app/models/ontology_version/states.rb
index abc1234..def5678 100644
--- a/app/models/ontology_version/states.rb
+++ b/app/models/ontology_version/states.rb
@@ -38,13 +38,8 @@ protected
def after_update_state
- ontology.state = state
-
- # unset logic_id to pass the logic_id_check in case of failures
- ontology.logic_id = nil if state=='failed'
-
+ ontology.state = state.to_s
ontology.save!
-
if ontology.distributed?
ontology.children.update_all state: ontology.state
end
|
Revert "unset ontology_id on setting state to failed"
This reverts commit 57eba7322d74ad38e54791f9a5aea29562bf2684.
|
diff --git a/templates/project/manifest.rb b/templates/project/manifest.rb
index abc1234..def5678 100644
--- a/templates/project/manifest.rb
+++ b/templates/project/manifest.rb
@@ -13,6 +13,6 @@ end
# Javascripts
-%w(alert button carousel collapse dropdown modal popover scrollspy tab tooltip transition typeahead).each do |file|
+%w(affix alert button carousel collapse dropdown modal popover scrollspy tab tooltip transition typeahead).each do |file|
javascript "#{basedir}/javascripts/bootstrap-#{file}.js", :to => "bootstrap-#{file}.js"
-end+end
|
Add `affix` to the list of Javascripts
|
diff --git a/features/step_definitions/base.rb b/features/step_definitions/base.rb
index abc1234..def5678 100644
--- a/features/step_definitions/base.rb
+++ b/features/step_definitions/base.rb
@@ -17,6 +17,6 @@ Given /^(?:a )?local docker image (.*)$/ do |img_name|
steps %Q{
Given I successfully run `docker pull #{test_env_base}`
- And I successfully run `docker tag -f #{test_env_base} #{img_name}`
+ And I successfully run `docker tag #{test_env_base} #{img_name}`
}
end
|
tests: Fix compatibility with Docker > 1.9.1
switch -f of docker tag was dropped in newer versions.
Signed-off-by: Dmitry Fleytman <[email protected]>
|
diff --git a/jquery-colorbox-rails.gemspec b/jquery-colorbox-rails.gemspec
index abc1234..def5678 100644
--- a/jquery-colorbox-rails.gemspec
+++ b/jquery-colorbox-rails.gemspec
@@ -15,5 +15,5 @@ s.files = Dir["{vendor,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "Gemfile", "README.md"]
s.require_paths = ["lib"]
- s.add_dependency 'railties', '>= 3.1'
-end+ s.add_runtime_dependency 'railties', '~> 3.1', '~> 4.0'
+end
|
Fix rails dependency in gemspec
|
diff --git a/features/support/env.rb b/features/support/env.rb
index abc1234..def5678 100644
--- a/features/support/env.rb
+++ b/features/support/env.rb
@@ -15,6 +15,7 @@ # If you'd prefer to use XPath, just uncomment this line and adjust any
# selectors in your step definitions to use the XPath syntax.
# Capybara.default_selector = :xpath
+Capybara.default_wait_time = 5 # in seconds
# By default, any exception happening in your Rails application will bubble up
# to Cucumber so that your scenario will fail. This is a different from how
|
Increase Capybara default wait time
|
diff --git a/Formula/sshfs.rb b/Formula/sshfs.rb
index abc1234..def5678 100644
--- a/Formula/sshfs.rb
+++ b/Formula/sshfs.rb
@@ -12,7 +12,9 @@
def install
ENV['ACLOCAL'] = "/usr/bin/aclocal -I/usr/share/aclocal -I#{HOMEBREW_PREFIX}/share/aclocal"
- system "autoreconf", "--force", "--install"
+ ENV['AUTOCONF'] = "/usr/bin/autoconf"
+ ENV['AUTOMAKE'] = "/usr/bin/automake"
+ system "/usr/bin/autoreconf", "--force", "--install"
system "./configure", "--disable-debug", "--disable-dependency-tracking",
"--prefix=#{prefix}"
|
SSHFS: Use paths to OS X supplied autotools
|
diff --git a/jently.rb b/jently.rb
index abc1234..def5678 100644
--- a/jently.rb
+++ b/jently.rb
@@ -1,17 +1,23 @@-require './lib/git.rb'
-require './lib/core.rb'
-require './lib/github.rb'
-require './lib/jenkins.rb'
-require './lib/helpers/logger.rb'
-require './lib/helpers/repository.rb'
-require './lib/helpers/config_file.rb'
-require './lib/helpers/pull_requests_data.rb'
+#!/usr/bin/env ruby
+
+require 'pathname'
+lib = Pathname.new(__FILE__).parent.join('lib').to_s
+$: << lib
+
+require 'git'
+require 'core'
+require 'github'
+require 'jenkins'
+require 'helpers/logger'
+require 'helpers/repository'
+require 'helpers/config_file'
+require 'helpers/pull_requests_data'
while true
begin
config = ConfigFile.read
Core.poll_pull_requests_and_queue_next_job
- sleep config[:github_polling_interval_seconds]
+ sleep(config[:github_polling_interval_seconds])
rescue => e
Logger.log('Error in main loop', e)
end
|
Modify the load path to include lib/ to simplify requires
|
diff --git a/lib/specinfra/command/debian/base/service.rb b/lib/specinfra/command/debian/base/service.rb
index abc1234..def5678 100644
--- a/lib/specinfra/command/debian/base/service.rb
+++ b/lib/specinfra/command/debian/base/service.rb
@@ -2,7 +2,7 @@ class << self
def check_is_enabled(service, level=3)
# Until everything uses Upstart, this needs an OR.
- "ls /etc/rc#{level}.d/ | grep -- '^S..#{escape(service)}$' || grep 'start on' /etc/init/#{escape(service)}.conf"
+ "ls /etc/rc#{level}.d/ | grep -- '^S..#{escape(service)}$' || grep '^\s*start on' /etc/init/#{escape(service)}.conf"
end
def enable(service)
|
Modify regex to skip commented 'start on' statements
Chef comments the 'start on' line when disabling upstart services
|
diff --git a/bench/publish.rb b/bench/publish.rb
index abc1234..def5678 100644
--- a/bench/publish.rb
+++ b/bench/publish.rb
@@ -0,0 +1,90 @@+# /usr/bin/env ruby
+
+require ::File.expand_path('../../config/environment', __FILE__)
+require 'benchmark'
+require 'securerandom'
+
+require 'faker'
+require 'stackprof'
+
+abort "Refusing to run outside of development" unless Rails.env.development?
+
+def publish(content_items)
+ puts Benchmark.measure {
+ content_items.each do |item|
+ Commands::V2::Publish.call(content_id: item[:content_id], update_type: 'major')
+ print "."
+ end
+ puts ""
+ }
+end
+
+$queries = 0
+ActiveSupport::Notifications.subscribe "sql.active_record" do |name, started, finished, unique_id, data|
+ $queries += 1
+end
+
+content_items = 100.times.map do
+ title = Faker::Company.catch_phrase
+ {
+ content_id: SecureRandom.uuid,
+ format: "placeholder",
+ schema_name: "placeholder",
+ document_type: "placeholder",
+ title: title,
+ base_path: "/performance-testing/#{title.parameterize}",
+ description: Faker::Lorem.paragraph,
+ public_updated_at: Time.now.iso8601,
+ locale: "en",
+ routes: [
+ {path: "/performance-testing/#{title.parameterize}", type: "exact"}
+ ],
+ redirects: [],
+ publishing_app: "performance-testing",
+ rendering_app: "performance-testing",
+ details: {
+ body: "<p>#{Faker::Lorem.paragraphs(10)}</p>"
+ },
+ phase: 'live',
+ need_ids: []
+ }
+end
+
+begin
+ puts "Creating drafts..."
+ content_items.each do |item|
+ Commands::V2::PutContent.call(item)
+ end
+
+ $queries = 0
+
+ puts "Publishing..."
+
+ StackProf.run(mode: :wall, out: "tmp/publish_wall.dump") { publish(content_items) }
+
+ puts "#{$queries} SQL queries"
+
+ puts "Creating new drafts..."
+ content_items.each do |item|
+ Commands::V2::PutContent.call(item.merge(title: Faker::Company.catch_phrase))
+ end
+
+ $queries = 0
+
+ puts "Superseding..."
+
+ StackProf.run(mode: :wall, out: "tmp/supersede_wall.dump") { publish(content_items) }
+
+ puts "#{$queries} SQL queries"
+
+ensure
+ scope = ContentItem.where(publishing_app: 'performance-testing')
+ LinkSet.includes(:links).where(content_id: scope.pluck(:content_id)).destroy_all
+ Location.where(content_item: scope).delete_all
+ State.where(content_item: scope).delete_all
+ Translation.where(content_item: scope).delete_all
+ UserFacingVersion.where(content_item: scope).delete_all
+ LockVersion.where(target: scope).delete_all
+ PathReservation.where(publishing_app: 'performance-testing').delete_all
+ scope.delete_all
+end
|
Add benchmark for Publish command
Creates 100 different draft content items, publishes them, then
supersedes them with new drafts.
|
diff --git a/contao.gemspec b/contao.gemspec
index abc1234..def5678 100644
--- a/contao.gemspec
+++ b/contao.gemspec
@@ -16,8 +16,10 @@ gem.version = Contao::VERSION
# Runtime dependencies
- gem.add_dependency "compass"
+ gem.add_dependency 'compass'
+ gem.add_dependency 'oily_png'
+ gem.add_dependency 'uglifier'
# Development dependencies
- gem.add_development_dependency "rspec"
+ gem.add_development_dependency 'rspec'
end
|
Add more dependencies that will be used in the first part of this project
|
diff --git a/files/private-chef-ctl-commands/chef12_upgrade_download.rb b/files/private-chef-ctl-commands/chef12_upgrade_download.rb
index abc1234..def5678 100644
--- a/files/private-chef-ctl-commands/chef12_upgrade_download.rb
+++ b/files/private-chef-ctl-commands/chef12_upgrade_download.rb
@@ -0,0 +1,61 @@+#
+# Copyright:: Copyright (c) 2014 Chef Software, Inc.
+#
+# All Rights Reserved
+#
+
+require "/opt/opscode/embedded/service/omnibus-ctl/osc_upgrade"
+require 'optparse'
+require 'ostruct'
+
+add_command "chef12-upgrade-download", "Download data from a Chef 11 server.", 2 do
+
+ def parse(args)
+ @options = OpenStruct.new
+
+ # Define defaults
+ @options.chef_server_url = "https://localhost"
+
+ opt_parser = OptionParser.new do |opts|
+ opts.banner = "Usage: private-chef-ctl chef12-upgrade-download [options]"
+
+ opts.on("-d", "--data-dir [directory]", "Directory to store Chef 11 data. Defaults to a created tmp dir.") do |dir|
+ @options.osc_data_dir = dir
+ end
+
+ opts.on("-c", "--chef-server-url [url]", String, "The url of the Chef 11 server. Defaults to #{@options.chef_server_url}") do |u|
+ @options.chef_server_url = u
+ end
+
+ opts.on("-h", "--help", "Show this message") do
+ puts opts
+ exit
+ end
+ end
+
+ opt_parser.parse!(args)
+ log "Proceeding with options #{@options.inspect}"
+ end
+
+ def data_dir
+ if @options.osc_data_dir
+ @options.osc_data_dir
+ else
+ osc_data_dir = Dir.mktmpdir('osc-chef-server-data')
+ log "Creating #{osc_data_dir} as the location to save the Chef 11 server data"
+ osc_data_dir
+ end
+ end
+
+ ### Start script ###
+
+ parse(ARGV)
+
+ osc_data_dir = data_dir
+ key_file = "#{osc_data_dir}/key_dump.json"
+
+ osc_upgrade = OscUpgrade.new(@options, self)
+ osc_upgrade.download_osc_data(osc_data_dir, key_file)
+
+ log "Chef 11 server data downloaded to #{osc_data_dir}"
+end
|
Add a ctl command for just the chef12 upgrade download step.
This will download the data from a Chef 11 OSC server and save it
to disk so it can be manipulated if needed.
|
diff --git a/lib/common_event_formatter.rb b/lib/common_event_formatter.rb
index abc1234..def5678 100644
--- a/lib/common_event_formatter.rb
+++ b/lib/common_event_formatter.rb
@@ -2,14 +2,14 @@ require "json"
class CommonEventFormatter < Logger::Formatter
- VERSION = "0.1.3"
+ VERSION = "0.1.4"
def call(severity, time, progname, msg)
create_event({:level => severity, :time => time, :host => hostname, :app => pwd, :pname => (progname || $0), :msg => msg2str(msg)})
end
def create_event(hash)
- hash.merge(process_hash).to_json + "\n"
+ hash.merge(process_hash).to_json + "\r\n"
end
private
|
Make the message boundary be \r\n, 0.1.4
Seems to follow with popular json streaming(ie, twitter) uses
|
diff --git a/geos-extensions.gemspec b/geos-extensions.gemspec
index abc1234..def5678 100644
--- a/geos-extensions.gemspec
+++ b/geos-extensions.gemspec
@@ -20,7 +20,7 @@ s.homepage = "http://github.com/zoocasa/geos-extensions"
s.require_paths = ["lib"]
- s.add_dependency("ffi-geos", ["~> 0.0.4"])
+ s.add_dependency("ffi-geos", ["~> 0.1"])
s.add_dependency("rdoc")
s.add_dependency("rake", ["~> 0.9"])
s.add_dependency("minitest")
|
Bump the ffi-geos version requirement to "~> 0.1".
|
diff --git a/lib/power.rb b/lib/power.rb
index abc1234..def5678 100644
--- a/lib/power.rb
+++ b/lib/power.rb
@@ -5,7 +5,7 @@
class Power
- @attempts = 1..7
+ MaxAttempts = 7
def self.find(n)
find_all(n).first
@@ -13,7 +13,7 @@
def self.find_all(n)
power_sets = [[1]]
- @attempts.each do
+ (1..MaxAttempts).each do
solutions = power_sets.select { |set| set.include?(n) }
return solutions unless solutions.empty?
power_sets = generate_all_next_power_sets(power_sets)
|
Replace range @attempts with integer MaxAttempts
|
diff --git a/app/models/manageiq/providers/inventory/persister/builder/physical_infra_manager.rb b/app/models/manageiq/providers/inventory/persister/builder/physical_infra_manager.rb
index abc1234..def5678 100644
--- a/app/models/manageiq/providers/inventory/persister/builder/physical_infra_manager.rb
+++ b/app/models/manageiq/providers/inventory/persister/builder/physical_infra_manager.rb
@@ -36,6 +36,14 @@ add_common_default_values
end
+ def physical_chassis_details
+ add_properties(
+ :model_class => ::AssetDetail,
+ :manager_ref => %i(resource),
+ :parent_inventory_collections => %i(physical_chassis)
+ )
+ end
+
def physical_storages
add_common_default_values
end
|
Add physical chassis details builder
|
diff --git a/lib/generators/flexi/auth/templates/sessions_controller.rb b/lib/generators/flexi/auth/templates/sessions_controller.rb
index abc1234..def5678 100644
--- a/lib/generators/flexi/auth/templates/sessions_controller.rb
+++ b/lib/generators/flexi/auth/templates/sessions_controller.rb
@@ -20,7 +20,7 @@ end
def destroy
- current_<%= session_singular_name %>.destroy
+ current_<%= session_singular_name %>.destroy if <%= session_singular_name %>
redirect_to login_url
end
end
|
Fix undefined method 'destroy' for user session
|
diff --git a/business.gemspec b/business.gemspec
index abc1234..def5678 100644
--- a/business.gemspec
+++ b/business.gemspec
@@ -23,5 +23,5 @@ spec.add_development_dependency "gc_ruboconfig", "~> 2.19.0"
spec.add_development_dependency "rspec", "~> 3.1"
spec.add_development_dependency "rspec_junit_formatter", "~> 0.4.1"
- spec.add_development_dependency "rubocop", "~> 0.90.0"
+ spec.add_development_dependency "rubocop", "~> 0.91.0"
end
|
Update rubocop requirement from ~> 0.90.0 to ~> 0.91.0
Updates the requirements on [rubocop](https://github.com/rubocop-hq/rubocop) to permit the latest version.
- [Release notes](https://github.com/rubocop-hq/rubocop/releases)
- [Changelog](https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop-hq/rubocop/compare/v0.90.0...v0.91.0)
Signed-off-by: dependabot-preview[bot] <[email protected]>
|
diff --git a/lib/sweep.rb b/lib/sweep.rb
index abc1234..def5678 100644
--- a/lib/sweep.rb
+++ b/lib/sweep.rb
@@ -3,16 +3,6 @@ APP_NAME = 'sweep'
VERSION = '0.0.0'
COPYRIGHT = "(C) Andrew Benson and contributors 2013"
- Config = {
- :HostInterval => 10,
- :PortInterval => 5,
- :AliveScanners => 10,
- :TCPScanners => 10,
- :UDPScanners => 5,
- :AliveModule => 'AliveICMP',
- :TCPModule => 'TCPSyn',
- :UDPModule => 'UDPCheck'
- }
end
require 'rubygems'
|
Remove old Config variable. Superceded by Config class.
|
diff --git a/chefspec.gemspec b/chefspec.gemspec
index abc1234..def5678 100644
--- a/chefspec.gemspec
+++ b/chefspec.gemspec
@@ -25,6 +25,6 @@
s.add_dependency 'chef', '>= 14'
s.add_dependency 'chef-cli'
- s.add_dependency 'fauxhai', '>= 6.11'
+ s.add_dependency 'fauxhai-ng', '>= 6.11'
s.add_dependency 'rspec', '~> 3.0'
end
|
Switch from fauxhai to fauxhai-ng
We've lost access to the fauxhai gem even though the source is
controlled by the chefspec org. The gem has been renamed to fauxhai-ng
so we can continue to release updates for use in chefspec.
Signed-off-by: Tim Smith <[email protected]>
|
diff --git a/lib/action_mailer_config/rails.rb b/lib/action_mailer_config/rails.rb
index abc1234..def5678 100644
--- a/lib/action_mailer_config/rails.rb
+++ b/lib/action_mailer_config/rails.rb
@@ -2,7 +2,19 @@ require "yaml"
path = "#{Rails.root}/config/mail.yml"
-raise "Could not found ActionMailer config file: #{path}" unless File.exists? path
-config_for_all = YAML.load_file(path)
-raise "Could not found ActionMailer config for #{Raile.env.inspect}" unless config_for_all.has_key? Rails.env
-ActionMailerConfig.load config_for_all(Rails.env)
+
+config = if File.exists? path
+ config_for_all = YAML.load_file(path)
+
+ if config_for_all.has_key? Rails.env
+ config_for_all[Rails.env]
+ else
+ warn "Could not found ActionMailer config for #{Rails.env.inspect}, use delivery_method: test"
+ {}
+ end
+else
+ warn "Could not found ActionMailer config file: #{path}, use delivery_method: test"
+ {}
+end
+
+ActionMailerConfig.load config
|
Fix typo / Ignore config missing
|
diff --git a/lib/active_fulfillment/service.rb b/lib/active_fulfillment/service.rb
index abc1234..def5678 100644
--- a/lib/active_fulfillment/service.rb
+++ b/lib/active_fulfillment/service.rb
@@ -4,7 +4,7 @@ include ActiveUtils::RequiresParameters
include ActiveUtils::PostsData
- cattr_accessor :logger
+ class_attribute :logger
def initialize(options = {})
check_test_mode(options)
|
Use class_attribute instead of cattr_accessor
|
diff --git a/test/bmff/box/test_free_space.rb b/test/bmff/box/test_free_space.rb
index abc1234..def5678 100644
--- a/test/bmff/box/test_free_space.rb
+++ b/test/bmff/box/test_free_space.rb
@@ -0,0 +1,42 @@+# coding: utf-8
+# vim: set expandtab tabstop=2 shiftwidth=2 softtabstop=2 autoindent:
+
+require_relative '../../minitest_helper'
+require 'bmff/box'
+require 'stringio'
+
+class TestBMFFBoxFreeSpace < MiniTest::Unit::TestCase
+ def test_parse_free
+ io = StringIO.new("", "r+:ascii-8bit")
+ io.extend(BMFF::BinaryAccessor)
+ io.write_uint32(0)
+ io.write_ascii("free")
+ io.write_byte("abcdefg") # data
+ size = io.pos
+ io.pos = 0
+ io.write_uint32(size)
+ io.pos = 0
+
+ box = BMFF::Box.get_box(io, nil)
+ assert_instance_of(BMFF::Box::FreeSpace, box)
+ assert_equal(size, box.actual_size)
+ assert_equal("free", box.type)
+ end
+
+ def test_parse_skip
+ io = StringIO.new("", "r+:ascii-8bit")
+ io.extend(BMFF::BinaryAccessor)
+ io.write_uint32(0)
+ io.write_ascii("skip")
+ io.write_byte("abcdefg") # data
+ size = io.pos
+ io.pos = 0
+ io.write_uint32(size)
+ io.pos = 0
+
+ box = BMFF::Box.get_box(io, nil)
+ assert_instance_of(BMFF::Box::FreeSpace, box)
+ assert_equal(size, box.actual_size)
+ assert_equal("skip", box.type)
+ end
+end
|
Add a test file for BMFF::Box::FreeSpace.
|
diff --git a/test/formatter_heuristic_test.rb b/test/formatter_heuristic_test.rb
index abc1234..def5678 100644
--- a/test/formatter_heuristic_test.rb
+++ b/test/formatter_heuristic_test.rb
@@ -0,0 +1,71 @@+require 'test/unit'
+require 'rcov-cobertura'
+require 'tmpdir'
+
+class FormatterHeuristicTest < Test::Unit::TestCase
+
+ def get_output(file, lines, coverage, counts)
+ Dir.mktmpdir('rcov_cobertura_formatter_test') do |dir|
+ fmt = Rcov::Cobertura::Formatter.new(:destdir => dir)
+ fmt.add_file(file, lines, coverage, counts)
+ fmt.execute
+ IO.read File.join(dir, 'cobertura.xml')
+ end
+ end
+
+ def assert_line_rate(file, expected_rate, xml)
+ assert xml =~ /\bfilename="#{Regexp.escape(file)}" line-rate="([0-9.]+)"/,
+ "expected line rate of #{expected_rate} for #{file}, but no line rate found"
+
+ assert_equal expected_rate, $1, "line rate for #{file} differs from expected"
+ end
+
+ def get_lines(xml)
+ xml.split("\n").select{|l| l =~ /<line /}.map do |l|
+ assert l =~ %r{<line number="(\d+)" hits="(\d+)"/>}
+ [$1.to_i, $2.to_i]
+ end
+ end
+
+ def test_comments_are_ignored
+ output = get_output('comments_ignored.rb', (<<-'endcode').split("\n"),
+# line 1 should not be counted.
+puts "but this line should count"; return
+"this line is dead, making the LOC coverage 50%"
+endcode
+ [false,true,false], [0, 1, 0])
+
+ assert_line_rate 'comments_ignored.rb', '0.5', output
+ assert_equal [[2,1], [3,0]], get_lines(output)
+ end
+
+ def test_empty_lines_are_ignored
+ output = get_output('empty_lines_ignored.rb', (<<-'endcode').split("\n"),
+
+puts "above, empty line should be ignored"; return
+"this line is dead, making the LOC coverage 50%"
+endcode
+ [false,true,false], [0, 1, 0])
+
+ assert_line_rate 'empty_lines_ignored.rb', '0.5', output
+ assert_equal [[2,1], [3,0]], get_lines(output)
+ end
+
+ def test_end_inherits_previous_line
+ output = get_output('end.rb', (<<-'endcode').split("\n"),
+begin
+ "although rcov reports the 'end' line is not covered, we flip it to covered"
+end # because the prior line was covered
+
+begin
+ "and if the prior line was not covered, neither is end"
+end
+endcode
+ [true,true,true,false,true,false,false],
+ [ 1, 1, 1, 0, 1, 0, 0])
+
+ assert_line_rate 'end.rb', '0.666666666666667', output
+ assert_equal [[1,1], [2,1], [3,1], [5,1], [6,0], [7,0]], get_lines(output)
+ end
+
+end
|
Add another test for special cases.
|
diff --git a/mail.gemspec b/mail.gemspec
index abc1234..def5678 100644
--- a/mail.gemspec
+++ b/mail.gemspec
@@ -11,7 +11,7 @@
s.platform = Gem::Platform::RUBY
s.has_rdoc = true
- s.extra_rdoc_files = ["README.rdoc", "CHANGELOG.rdoc", "TODO.rdoc"]
+ s.extra_rdoc_files = ["README.mkd", "CHANGELOG.rdoc", "TODO.rdoc"]
s.add_dependency('mime-types', "~> 1.16")
s.add_dependency('treetop', '~> 1.4.8')
|
Add another missing reference to the gemspec
|
diff --git a/closed_issues.rb b/closed_issues.rb
index abc1234..def5678 100644
--- a/closed_issues.rb
+++ b/closed_issues.rb
@@ -1,9 +1,13 @@-MILESTONE = 47
-# subtract 6 from actual Sprint milestone number for the ManageIQ/manageiq repo
ACCESS_TOKEN = "your github access token"
+MILESTONE = "Sprint 58 Ending Apr 10, 2017"
+ORGANIZATION = "ManageIQ"
+PROJECT = "manageiq"
require_relative 'sprint_statistics'
-prs = SprintStatistics.new(ACCESS_TOKEN).pull_requests("ManageIQ/manageiq", :milestone => MILESTONE, :state => "closed")
+fq_repo = File.join(ORGANIZATION, PROJECT)
+ss = SprintStatistics.new(ACCESS_TOKEN)
+milestone = ss.client.milestones(fq_repo, :title => MILESTONE).first
+prs = ss.pull_requests(fq_repo, :milestone => milestone[:number], :state => "closed")
File.open('closed_issues_master_repo.csv', 'w') do |f|
f.puts "Milestone Statistics for: #{prs.first.milestone.title}"
|
Use title for Milestone lookup
|
diff --git a/Casks/dropletsmanager.rb b/Casks/dropletsmanager.rb
index abc1234..def5678 100644
--- a/Casks/dropletsmanager.rb
+++ b/Casks/dropletsmanager.rb
@@ -0,0 +1,7 @@+class Dropletsmanager < Cask
+ url 'https://dl.dropboxusercontent.com/u/115750/files/DropletsManager0.1.zip'
+ homepage 'https://github.com/deivuh/DODropletManager-OSX'
+ version '0.1'
+ sha256 '632e608d9dfa926166a8471c60609f104f3ad0b07048fbfb2bb323c9adae8e85'
+ link 'DropletsManager.app'
+end
|
Add DigitalOcean Droplets Manager 0.1
|
diff --git a/lib/pry/default_commands/input.rb b/lib/pry/default_commands/input.rb
index abc1234..def5678 100644
--- a/lib/pry/default_commands/input.rb
+++ b/lib/pry/default_commands/input.rb
@@ -9,28 +9,29 @@ end
command "hist", "Show and replay Readline history. Type `hist --help` for more info." do |*args|
- hist_array = Readline::HISTORY.to_a
+ history = Readline::HISTORY.to_a
if args.empty?
- text = add_line_numbers(hist_array.join("\n"), 0)
- stagger_output(text)
+ text = add_line_numbers history.join("\n"), 0
+ stagger_output text
next
end
- opts = Slop.parse(args) do |opt|
- opt.banner "Usage: hist [--replay START..END]\nView and replay history\ne.g hist --replay 2..8"
- opt.on :r, :replay, 'The line (or range of lines) to replay.', true, :as => Range
+ Slop.parse(args) do |opt|
+ opt.banner "Usage: hist [--replay START..END]\n" \
+ "View and replay history\n" \
+ "e.g hist --replay 2..8"
+
+ opt.on :r, :replay, 'The line (or range of lines) to replay.', true, :as => Range do |range|
+ actions = history[range].join("\n") + "\n"
+ Pry.active_instance.input = StringIO.new(actions)
+ end
+
opt.on :h, :help, 'Show this message.', :tail => true do
output.puts opt.help
end
end
-
- next if opts.h?
-
- actions = Array(hist_array[opts[:replay]]).join("\n") + "\n"
- Pry.active_instance.input = StringIO.new(actions)
end
-
end
|
Clean up the "hist" command.
|
diff --git a/app/controllers/teachers/progress_reports/standards/classroom_students_controller.rb b/app/controllers/teachers/progress_reports/standards/classroom_students_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/teachers/progress_reports/standards/classroom_students_controller.rb
+++ b/app/controllers/teachers/progress_reports/standards/classroom_students_controller.rb
@@ -5,6 +5,8 @@ respond_to do |format|
format.html
format.json do
+ return render json: {}, status: 401 unless current_user.classrooms_i_teach.map(&:id).include?(params[:classroom_id])
+
students = ::ProgressReports::Standards::Student.new(current_user).results(params)
students_json = students.map do |student|
serializer = ::ProgressReports::Standards::StudentSerializer.new(student)
@@ -13,7 +15,6 @@ serializer.as_json(root: false)
end
- # TODO security fix: we do not verify that the classroom here can be seen by the current_user.
cas = Classroom.where(id: params[:classroom_id]).includes(:classroom_activities).map(&:classroom_activities).flatten
render json: {
|
Return 401 unless this teacher has access to this classroom
|
diff --git a/config/deploy.rb b/config/deploy.rb
index abc1234..def5678 100644
--- a/config/deploy.rb
+++ b/config/deploy.rb
@@ -1,5 +1,5 @@ # config valid only for current version of Capistrano
-lock "3.10.1"
+lock "3.10.2"
set :application, "gallery"
@@ -21,4 +21,4 @@ set :sidekiq_pid, File.join(shared_path, 'tmp', 'pids', 'sidekiq.pid')
set :sidekiq_log, File.join(shared_path, 'log', 'sidekiq.log')
#set :sidekiq_processes, nil
-set :sidekiq_concurrency, 4+set :sidekiq_concurrency, 4
|
Increase Capistrano version in config file
|
diff --git a/library/net/http/http/get_spec.rb b/library/net/http/http/get_spec.rb
index abc1234..def5678 100644
--- a/library/net/http/http/get_spec.rb
+++ b/library/net/http/http/get_spec.rb
@@ -2,7 +2,7 @@ require 'net/http'
require_relative 'fixtures/http_server'
-describe "Net::HTTP.get when passed URI" do
+describe "Net::HTTP.get" do
before :each do
NetHTTPSpecs.start_server
@port = NetHTTPSpecs.port
|
Fix spec description for Net::HTTP.get
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -13,9 +13,9 @@ resource :user
# Authentication
- get 'login' => 'sessions#new'
- post 'login' => 'sessions#create'
- post 'logout' => 'sessions#destroy'
+ get 'login', to: 'sessions#new'
+ post 'login', to: 'sessions#create'
+ post 'logout', to: 'sessions#destroy'
namespace :twilio do
resources :text_messages
|
Use new route definition style
|
diff --git a/lib/arel/engines/sql/engine.rb b/lib/arel/engines/sql/engine.rb
index abc1234..def5678 100644
--- a/lib/arel/engines/sql/engine.rb
+++ b/lib/arel/engines/sql/engine.rb
@@ -26,12 +26,13 @@
module CRUD
def create(relation)
- attribute = [*relation.record].map do |attr, value|
- if attr.respond_to?(:name) && !relation.primary_key.blank? && attr.name == relation.primary_key
- value
- end
- end.compact.first
- primary_key_value = attribute ? attribute.value : nil
+ primary_key_value = if relation.primary_key.blank?
+ nil
+ elsif relation.record.is_a?(Hash)
+ attribute = relation.record.detect { |attr, _| attr.name.to_s == relation.primary_key.to_s }
+ attribute && attribute.last.value
+ end
+
connection.insert(relation.to_sql(false), nil, relation.primary_key, primary_key_value)
end
|
Refactor thethe wayy to obtain primary key value.
|
diff --git a/lib/comptroller/claim_error.rb b/lib/comptroller/claim_error.rb
index abc1234..def5678 100644
--- a/lib/comptroller/claim_error.rb
+++ b/lib/comptroller/claim_error.rb
@@ -3,6 +3,7 @@ include Her::Model
use_api BILLING_API
collection_path '/duxware_errors'
+ include_root_in_json true
def eql?(other)
id.eql? other.id
|
Include root in json for claim errors
|
diff --git a/business.gemspec b/business.gemspec
index abc1234..def5678 100644
--- a/business.gemspec
+++ b/business.gemspec
@@ -20,7 +20,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
- spec.add_development_dependency "gc_ruboconfig", "~> 2.18.0"
+ spec.add_development_dependency "gc_ruboconfig", "~> 2.19.0"
spec.add_development_dependency "rspec", "~> 3.1"
spec.add_development_dependency "rspec_junit_formatter", "~> 0.4.1"
spec.add_development_dependency "rubocop", "~> 0.90.0"
|
Update gc_ruboconfig requirement from ~> 2.18.0 to ~> 2.19.0
Updates the requirements on [gc_ruboconfig](https://github.com/gocardless/ruboconfig) to permit the latest version.
- [Release notes](https://github.com/gocardless/ruboconfig/releases)
- [Changelog](https://github.com/gocardless/gc_ruboconfig/blob/master/CHANGELOG.md)
- [Commits](https://github.com/gocardless/ruboconfig/commits)
Signed-off-by: dependabot-preview[bot] <[email protected]>
|
diff --git a/lib/generators/spina_projects/templates/create_spina_projects_table.rb b/lib/generators/spina_projects/templates/create_spina_projects_table.rb
index abc1234..def5678 100644
--- a/lib/generators/spina_projects/templates/create_spina_projects_table.rb
+++ b/lib/generators/spina_projects/templates/create_spina_projects_table.rb
@@ -7,7 +7,7 @@ t.string :lat
t.string :long
t.string :duration
- t.string :project_category_id
+ t.integer :project_category_id
t.text :testimonial
t.string :testimonial_name
t.timestamps
|
Change association type to integer
|
diff --git a/spec/models/event_registration_spec.rb b/spec/models/event_registration_spec.rb
index abc1234..def5678 100644
--- a/spec/models/event_registration_spec.rb
+++ b/spec/models/event_registration_spec.rb
@@ -5,15 +5,19 @@ let(:event) { create(:event) }
let(:reg) { create(:event_registration, event: event, user: user) }
- describe 'validations' do
- it { should validate_presence_of(:user_id) }
- it { should validate_presence_of(:event_id) }
- it { should validate_uniqueness_of(:event_id).scoped_to(:user_id) }
+ describe 'Associations' do
+ it { reg.should belong_to(:user) }
+ it { reg.should belong_to(:event) }
end
- describe 'Associations' do
- it { should belong_to(:user) }
- it { should belong_to(:event) }
+ describe 'validations' do
+ it { reg.should validate_presence_of(:user_id) }
+ it { reg.should validate_presence_of(:event_id) }
+ it 'validate uniqueness scoped to user_id' do
+ # More explicitly written because of issue
+ # https://github.com/thoughtbot/shoulda-matchers/issues/880
+ reg
+ reg.should validate_uniqueness_of(:event_id).scoped_to(:user_id)
+ end
end
end
-
|
Rewrite EventRegistration model spec because of bug in shoulda_matchers
|
diff --git a/spec/models/idp_sso_descriptor_spec.rb b/spec/models/idp_sso_descriptor_spec.rb
index abc1234..def5678 100644
--- a/spec/models/idp_sso_descriptor_spec.rb
+++ b/spec/models/idp_sso_descriptor_spec.rb
@@ -4,6 +4,11 @@ context 'extends sso_descriptor' do
it { is_expected.to validate_presence :want_authn_requests_signed }
it { is_expected.to have_one_to_many :single_sign_on_services }
+
+ let(:subject) { FactoryGirl.create :idp_sso_descriptor }
+ it 'has at least 1 single sign on service' do
+ expect(subject).to validate_presence :single_sign_on_services
+ end
context 'optional attributes' do
it { is_expected.to have_one_to_many :name_id_mapping_services }
|
Increase coverage of IDPSSODescriptor to 100%
|
diff --git a/ALCameraViewController.podspec b/ALCameraViewController.podspec
index abc1234..def5678 100644
--- a/ALCameraViewController.podspec
+++ b/ALCameraViewController.podspec
@@ -10,4 +10,5 @@ spec.resources = ["ALCameraViewController/ViewController/ConfirmViewController.xib", "ALCameraViewController/CameraViewAssets.xcassets", "ALCameraViewController/CameraView.strings"]
spec.homepage = "https://github.com/AlexLittlejohn/ALCameraViewController"
spec.author = { "Alex Littlejohn" => "[email protected]" }
+ spec.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.0' }
end
|
Add swift 4 config to podspec
|
diff --git a/the_bullet-generator.gemspec b/the_bullet-generator.gemspec
index abc1234..def5678 100644
--- a/the_bullet-generator.gemspec
+++ b/the_bullet-generator.gemspec
@@ -21,6 +21,8 @@ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ['lib']
+ spec.add_runtime_dependency 'railties', '~> 5.0.0'
+
spec.add_development_dependency 'bundler', '~> 1.14'
spec.add_development_dependency 'rake', '~> 10.0'
end
|
Add railties as runtime dependency
|
diff --git a/methane.gemspec b/methane.gemspec
index abc1234..def5678 100644
--- a/methane.gemspec
+++ b/methane.gemspec
@@ -17,6 +17,9 @@
gem.add_dependency('slop')
gem.add_dependency('qtbindings')
+ gem.add_dependency('tinder')
+ gem.add_dependency('faye')
+ gem.add_dependency('thin')
gem.add_development_dependency('rake')
end
|
Add tinder and faye with thin.
|
diff --git a/dir_manager.rb b/dir_manager.rb
index abc1234..def5678 100644
--- a/dir_manager.rb
+++ b/dir_manager.rb
@@ -0,0 +1,49 @@+class Middleman::Extensions::DirManager < Middleman::Extension
+ register :dir_manager
+ option :remap_resources, [
+ {
+ new_dir: "/spec/fixtures/blog",
+ old_dir: "blog"
+ }
+ ]
+
+ def manipulate_resource_list resources
+ options[:remap_resources].each do |opts|
+
+ old_dir = normalize(opts[:old_dir])
+ new_dir = normalize(opts[:new_dir])
+
+ resources.reject! do |page|
+ Dir.glob(old_dir + '/*', File::FNM_DOTMATCH).include? page.source_file
+ end
+
+ all_new_files = Dir.glob(new_dir + '/**/*', File::FNM_DOTMATCH)
+ all_new_files.reject! { |f| File.directory? f }
+
+ new_resources = all_new_files.map do |sourcepath|
+ relative_path = Pathname(sourcepath).relative_path_from Pathname(new_dir)
+ resource_name = app.sitemap.extensionless_path relative_path
+
+ unless app.source_dir == old_dir
+ resource_name = File.join opts[:old_dir], resource_name
+ end
+
+ Middleman::Sitemap::Resource.new app.sitemap, resource_name, sourcepath
+ end
+
+ resources.concat new_resources
+ end
+
+ resources
+ end
+
+ private
+
+ def normalize directory
+ if Pathname(directory).relative?
+ File.expand_path File.join app.source_dir, directory
+ else
+ File.expand_path File.join app.root, directory
+ end
+ end
+end
|
Add start of extension to remap a source directory to a test directory
|
diff --git a/tasks/rspec.rake b/tasks/rspec.rake
index abc1234..def5678 100644
--- a/tasks/rspec.rake
+++ b/tasks/rspec.rake
@@ -11,8 +11,8 @@ desc "Spec ROXML under the #{parser} parser"
Spec::Rake::SpecTask.new(parser) do |spec|
spec.libs << 'lib' << 'spec' << 'examples'
- spec.spec_opts = ['--options', "spec/spec.opts", "spec/support/#{parser}.rb"]
- spec.spec_files = FileList['spec/**/*_spec.rb']
+ spec.spec_opts = ['--options=spec/spec.opts']
+ spec.spec_files = ["spec/support/#{parser}.rb"] + FileList['spec/**/*_spec.rb']
end
end
end
|
Fix up specs so they actually run on a parser-specific basis
|
diff --git a/lib/metacrunch/mab2/builder.rb b/lib/metacrunch/mab2/builder.rb
index abc1234..def5678 100644
--- a/lib/metacrunch/mab2/builder.rb
+++ b/lib/metacrunch/mab2/builder.rb
@@ -8,7 +8,8 @@
def self.build(&block)
builder = new
- builder.instance_eval(&block)
+ document = builder.instance_eval(&block) if block_given?
+ document || Document.new
end
def initialize
|
Make sure to return a MAB document.
|
diff --git a/db/data_migration/20171102132014_remove_and_redirect_cts_group.rb b/db/data_migration/20171102132014_remove_and_redirect_cts_group.rb
index abc1234..def5678 100644
--- a/db/data_migration/20171102132014_remove_and_redirect_cts_group.rb
+++ b/db/data_migration/20171102132014_remove_and_redirect_cts_group.rb
@@ -0,0 +1,12 @@+slug = "common-technology-services-cts"
+redirect_path = "/government/publications/technology-code-of-practice/technology-code-of-practice"
+
+group = PolicyGroup.find_by(slug: slug)
+exit unless group
+
+content_id = group.content_id
+
+group.delete
+PublishingApiRedirectWorker.new.perform(content_id, redirect_path, "en")
+
+puts "#{slug} -> #{redirect_path}"
|
Delete CTS group and redirect to new location
|
diff --git a/db/migrate/20110805014415_remove_improperly_embedded_yaml_data.rb b/db/migrate/20110805014415_remove_improperly_embedded_yaml_data.rb
index abc1234..def5678 100644
--- a/db/migrate/20110805014415_remove_improperly_embedded_yaml_data.rb
+++ b/db/migrate/20110805014415_remove_improperly_embedded_yaml_data.rb
@@ -0,0 +1,12 @@+class RemoveImproperlyEmbeddedYamlData < ActiveRecord::Migration
+ def self.up
+ Dependency.where("requirements like '%YAML::Syck::DefaultKey%'").each do |d|
+ d.requirements = d.clean_requirements
+ d.save(:validate => false)
+ end
+ end
+
+ def self.down
+ # Do nothing.
+ end
+end
|
Add migration to clean up malformed requirements fields from yaml/syck issues.
|
diff --git a/lib/lita/commands/ack_mine.rb b/lib/lita/commands/ack_mine.rb
index abc1234..def5678 100644
--- a/lib/lita/commands/ack_mine.rb
+++ b/lib/lita/commands/ack_mine.rb
@@ -18,7 +18,7 @@
def query_params
{
- 'statuses' => %w[triggered acknowledged],
+ statuses: %w[triggered acknowledged],
'user_ids[]' => current_user[:id]
}
end
|
Use symbols for hash keys
Co-Authored-By: biggless <[email protected]>
|
diff --git a/lib/quotes/gateways/backend.rb b/lib/quotes/gateways/backend.rb
index abc1234..def5678 100644
--- a/lib/quotes/gateways/backend.rb
+++ b/lib/quotes/gateways/backend.rb
@@ -14,9 +14,9 @@
def retrieve_database
if ENV['test']
- database = Sequel.connect('sqlite://quotes-test.db')
+ Sequel.connect('sqlite://quotes-test.db')
else
- database = Sequel.connect('sqlite://quotes-development.db')
+ Sequel.sqlite('/home/dd/programming/quotes/quotes_backend/quotes-development.db')
end
end
end
|
Use absolute path for development db
|
diff --git a/ncsa-parser.gemspec b/ncsa-parser.gemspec
index abc1234..def5678 100644
--- a/ncsa-parser.gemspec
+++ b/ncsa-parser.gemspec
@@ -11,6 +11,7 @@ s.description = "A simple NCSA-style log file parser."
s.summary = s.description
s.email = "[email protected]"
+ s.license = "MIT"
s.extra_rdoc_files = [
"README.rdoc"
]
|
Add license details to gemspec.
|
diff --git a/lib/ravelin/pre_transaction.rb b/lib/ravelin/pre_transaction.rb
index abc1234..def5678 100644
--- a/lib/ravelin/pre_transaction.rb
+++ b/lib/ravelin/pre_transaction.rb
@@ -6,6 +6,8 @@ :debit,
:credit,
:gateway,
+ :type,
+ :time,
:custom
attr_required :transaction_id, :currency, :debit, :credit, :gateway
|
Add missing fields to Pretransaction Object
type and time are valid pretransition attributes
as can be seen on Ravelin API docs
https://developer.ravelin.com/#post-/v2/pretransaction
|
diff --git a/lib/pakyow/commands/server.rb b/lib/pakyow/commands/server.rb
index abc1234..def5678 100644
--- a/lib/pakyow/commands/server.rb
+++ b/lib/pakyow/commands/server.rb
@@ -3,7 +3,7 @@ class Server
attr_reader :environment, :port
- def initialize(environment: :development, port:)
+ def initialize(environment: :development, port: 3000)
@environment = environment
@port = port
end
|
Fix sneaky ruby 2.0 incompatibility
* Ruby 2.0 doesn't support required kwargs. This wasn't caught
previously because the file was not being loaded. This reinforces the
need for #130.
|
diff --git a/app/services/accountancy/condition_builder/journal_condition_builder.rb b/app/services/accountancy/condition_builder/journal_condition_builder.rb
index abc1234..def5678 100644
--- a/app/services/accountancy/condition_builder/journal_condition_builder.rb
+++ b/app/services/accountancy/condition_builder/journal_condition_builder.rb
@@ -2,7 +2,7 @@ module ConditionBuilder
class JournalConditionBuilder < Base
# Build an SQL condition based on options which should contains natures
- def nature_condition(natures, table_name)
+ def nature_condition(natures, table_name:)
if !natures.is_a?(Hash) || natures.empty?
connection.quoted_true
else
|
Fix missing colon un journal condition builder
|
diff --git a/lib/sync_issues/comparison.rb b/lib/sync_issues/comparison.rb
index abc1234..def5678 100644
--- a/lib/sync_issues/comparison.rb
+++ b/lib/sync_issues/comparison.rb
@@ -11,7 +11,7 @@ @content = github_issue.body
@sync_assignee = sync_assignee
@title = github_issue.title
- compare(issue, github_issue)
+ compare(issue)
end
def changed?
@@ -20,7 +20,7 @@
private
- def compare(issue, github_issue)
+ def compare(issue)
if @sync_assignee && issue.assignee != @assignee
@changed << 'assignee'
@assignee = issue.assignee
@@ -29,10 +29,9 @@ @changed << 'title'
@title = issue.new_title
end
- unless content_matches?(issue.content, @content)
- @changed << 'body'
- @content = issue.content
- end
+ return if content_matches?(issue.content, @content)
+ @changed << 'body'
+ @content = issue.content
end
def content_matches?(first, second)
|
Resolve rubocop warnings in comparision.rb.
|
diff --git a/lib/tasks/gitlab/uploads.rake b/lib/tasks/gitlab/uploads.rake
index abc1234..def5678 100644
--- a/lib/tasks/gitlab/uploads.rake
+++ b/lib/tasks/gitlab/uploads.rake
@@ -0,0 +1,44 @@+namespace :gitlab do
+ namespace :uploads do
+ desc 'GitLab | Uploads | Check integrity of uploaded files'
+ task check: :environment do
+ puts 'Starting checking integrity of uploaded files'
+
+ uploads_batches do |batch|
+ batch.each do |upload|
+ puts "- Checking file (#{upload.id}): #{upload.absolute_path}".color(:green)
+
+ if upload.exist?
+ check_checksum(upload)
+ else
+ puts " * File does not exist on the file system".color(:red)
+ end
+ end
+ end
+
+ puts 'Done!'
+ end
+
+ def batch_size
+ ENV.fetch('BATCH', 200).to_i
+ end
+
+ def calculate_checksum(absolute_path)
+ Digest::SHA256.file(absolute_path).hexdigest
+ end
+
+ def check_checksum(upload)
+ checksum = calculate_checksum(upload.absolute_path)
+
+ if checksum != upload.checksum
+ puts " * File checksum (#{checksum}) does not match the one in the database (#{upload.checksum})".color(:red)
+ end
+ end
+
+ def uploads_batches(&block)
+ Upload.all.in_batches(of: batch_size, start: ENV['ID_FROM'], finish: ENV['ID_TO']) do |relation| # rubocop: disable Cop/InBatches
+ yield relation
+ end
+ end
+ end
+end
|
Add rake task to check integrity of uploaded files
|
diff --git a/lib/tasks/keyword_search.rake b/lib/tasks/keyword_search.rake
index abc1234..def5678 100644
--- a/lib/tasks/keyword_search.rake
+++ b/lib/tasks/keyword_search.rake
@@ -10,7 +10,7 @@ KeywordSearchIndex.delete_all
Rails.application.config.transam_keyword_searchable_classes.each do |klass|
Rails.logger.info "Creating keyword index for #{klass}"
- klass.all.each do |obj|
+ klass.all.find_each do |obj|
obj.write_to_index
end
end
|
Use batches when processing keyword index
|
diff --git a/app/reports/integrity_check.rb b/app/reports/integrity_check.rb
index abc1234..def5678 100644
--- a/app/reports/integrity_check.rb
+++ b/app/reports/integrity_check.rb
@@ -26,6 +26,7 @@ StudentAssessment.find_each(&:save!)
Educator.find_each(&:save!)
Student.find_each(&:save!)
+ StudentSchoolYear.find_each(&:save!)
end
end
|
Add StudentSchoolYears to data integrity check
+ #264
|
diff --git a/app/services/list_bookmarks.rb b/app/services/list_bookmarks.rb
index abc1234..def5678 100644
--- a/app/services/list_bookmarks.rb
+++ b/app/services/list_bookmarks.rb
@@ -1,4 +1,12 @@+##
+# This class allows users to list all of their bookmarks. It consists of a
+# single method that retrieves an array of {Bookmark} objects.
+#
class ListBookmarks
+ ##
+ # The main method of the service. Retrieves a list of bookmarks.
+ #
+ # @return Array
def self.list
Bookmark.all.to_a
end
|
Add docs for ListBookmarks service.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.