diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/test/integration/n_plus_1_test.rb b/test/integration/n_plus_1_test.rb
index abc1234..def5678 100644
--- a/test/integration/n_plus_1_test.rb
+++ b/test/integration/n_plus_1_test.rb
@@ -0,0 +1,41 @@+# frozen_string_literal: true
+
+require("test_helper")
+
+# Discover potential n+1 issues by running some requests with bullet gem
+class NPlusOneTest < IntegrationTestCase
+ include BulletHelper
+
+ def test_api2
+ get("/api2/observations?detail=high&format=xml")
+ get("/api2/locations?detail=high&format=xml")
+ get("/api2/names?detail=high&format=xml")
+ get("/api2/images?detail=high&format=xml")
+ end
+
+ def test_indexes
+ login
+ get("/articles")
+ get("/comment/list_comments")
+ get("/herbaria?flavor=all")
+ get("/location/list_locations")
+ get("/name/list_names")
+ get("/image/list_images")
+ get("/observer/list_observations")
+ get("/observer/list_rss_logs")
+ get("/project/list_projects")
+ get("/publications")
+ get("/sequence/list_sequences")
+ get("/species_list/list_species_lists")
+ end
+
+ def test_download_observations
+ login
+ get("/observer/download_observations")
+ end
+
+ def test_show_site_stats
+ login
+ get("/observer/show_site_stats")
+ end
+end
|
Add integration test to find some potential n+1 queries
|
diff --git a/db/migrate/20110620084032_add_authorised_to_person.rb b/db/migrate/20110620084032_add_authorised_to_person.rb
index abc1234..def5678 100644
--- a/db/migrate/20110620084032_add_authorised_to_person.rb
+++ b/db/migrate/20110620084032_add_authorised_to_person.rb
@@ -0,0 +1,14 @@+class AddAuthorisedToPerson < ActiveRecord::Migration
+ def self.up
+ add_column :people, :authorised_account, :boolean, :default => false
+ #Authorise all current persons registered
+ people = Person.all
+ people.each do |p|
+ p.update_attributes(:authorised_account => true)
+ end
+ end
+
+ def self.down
+ remove_column :people, :authorised_account
+ end
+end
|
Add authorised field to person and update current persons to authorised
|
diff --git a/bibliography.gemspec b/bibliography.gemspec
index abc1234..def5678 100644
--- a/bibliography.gemspec
+++ b/bibliography.gemspec
@@ -9,7 +9,7 @@ spec.authors = ["Mike Robinson"]
spec.email = ["mike@studiolift.com"]
spec.description = %q{A library of useful tools for books and related standards}
- spec.summary = %q{Currently only offers an interface to BIC codes}
+ spec.summary = %q{Currently only offers an interface to BIC subjects}
spec.homepage = "http://github.com/studiolift/bibliography"
spec.license = "MIT"
|
Correct ambiguous notion of "BIC codes" to "BIC subjects"
|
diff --git a/0_code_wars/always_perfect.rb b/0_code_wars/always_perfect.rb
index abc1234..def5678 100644
--- a/0_code_wars/always_perfect.rb
+++ b/0_code_wars/always_perfect.rb
@@ -0,0 +1,9 @@+# http://www.codewars.com/kata/always-perfect/
+# --- iteration 1 ---
+def check_root(str)
+ return "incorrect input" unless /\A-?\d+,-?\d+,-?\d+,-?\d+\z/ === str
+ nums = str.split(",").map(&:to_i)
+ return "not consecutive" unless (nums.first..nums.last).to_a == nums
+ sum = nums.reduce(:*) + 1
+ "#{sum}, #{Math.sqrt(sum).to_i}"
+end
|
Add code wars (7) - always perfect
|
diff --git a/lib/bitbucket/representation/repo.rb b/lib/bitbucket/representation/repo.rb
index abc1234..def5678 100644
--- a/lib/bitbucket/representation/repo.rb
+++ b/lib/bitbucket/representation/repo.rb
@@ -5,10 +5,18 @@
def initialize(raw)
super(raw)
+ end
- if full_name && full_name.split('/').size == 2
- @owner, @slug = full_name.split('/')
- end
+ def owner_and_slug
+ @owner_and_slug ||= full_name.split('/', 2)
+ end
+
+ def owner
+ owner_and_slug.first
+ end
+
+ def slug
+ owner_and_slug.last
end
def clone_url(token = nil)
|
Clean up owner and slug representation
|
diff --git a/lib/cache_comment/fragment_helper.rb b/lib/cache_comment/fragment_helper.rb
index abc1234..def5678 100644
--- a/lib/cache_comment/fragment_helper.rb
+++ b/lib/cache_comment/fragment_helper.rb
@@ -10,7 +10,8 @@ def read_fragment(key, options)
unless params[:cache_comments]
comment = CommentFormatter.new(fragment_cache_key(key), options)
- super(key, options) && super(key, options).gsub(comment.start_regex, '').gsub(comment.end_regex, '')
+ fragment = super(key, options)
+ fragment.gsub(comment.start_regex, '').gsub(comment.end_regex, '') unless fragment.nil?
else
super key, options
end
|
Refactor fragment to call super only once
As suggested by @kirel
|
diff --git a/lib/discordrb/webhooks/embeds.rb b/lib/discordrb/webhooks/embeds.rb
index abc1234..def5678 100644
--- a/lib/discordrb/webhooks/embeds.rb
+++ b/lib/discordrb/webhooks/embeds.rb
@@ -29,5 +29,9 @@ # The URL the title should point to.
# @return [String]
attr_accessor :url
+
+ # The timestamp for this embed. Will be displayed just below the title.
+ # @return [String]
+ attr_accessor :timestamp
end
end
|
:anchor: Add an accessor for the timestamp
|
diff --git a/lib/knife/changelog/git_submodule.rb b/lib/knife/changelog/git_submodule.rb
index abc1234..def5678 100644
--- a/lib/knife/changelog/git_submodule.rb
+++ b/lib/knife/changelog/git_submodule.rb
@@ -6,7 +6,7 @@ class GitSubmodule < Changelog
def run(submodules)
- raise ::ArgumentError "Submodules must be an Array instead of #{submodules.inspect}" unless submodules.is_a?(::Array)
+ raise ::ArgumentError, "Submodules must be an Array instead of #{submodules.inspect}" unless submodules.is_a?(::Array)
submodules.map do |submodule|
Chef::Log.debug "Checking changelog for #{submodule} (submodule)"
format_changelog(submodule, *handle_submodule(submodule))
|
Fix missing coma in argumentError raising for gitsubmodule changelog
|
diff --git a/spec/workers/link_phenotype_snp_spec.rb b/spec/workers/link_phenotype_snp_spec.rb
index abc1234..def5678 100644
--- a/spec/workers/link_phenotype_snp_spec.rb
+++ b/spec/workers/link_phenotype_snp_spec.rb
@@ -1,28 +1,51 @@ RSpec.describe LinkSnpPhenotype do
- subject do
+ setup do
+ # might use 'build' if db transactions are not required
+ @snp = FactoryGirl.create(:snp)
+ @worker = LinkSnpPhenotype.new
+ @document = {
+ "uuid" => UUIDTools::UUID.random_create.to_s,
+ "title" => "Test Driven Development And Why You Should Do It",
+ "authors" => [{ "forename" => "Max", "surname" => "Mustermann" }],
+ "mendeley_url" => "http://example.com",
+ "year" => "2013",
+ "doi" => "456",
+ }
+ end
+
+ describe 'worker' do
+ after :each do
+ LinkSnpPhenotype.clear
+ end
+
+ it 'does nothing if snp does not exist' do
+ expect(@worker).not_to receive(:score_phenotype)
+ @worker.perform(0)
+ end
+
+ it 'enqueues a task if phenotype_updated is less than MAX_AGE' do
+ @snp.phenotype_updated = Time.now
+ @worker.perform(@snp.id)
+
+ expect(LinkSnpPhenotype.jobs).not_to be_empty
+ expect(LinkSnpPhenotype.jobs.first['args']).to include(@snp.id)
+ end
+
+ it 'has no jobs if phenotype_updated is more than MAX_AGE' do
+ @snp.phenotype_updated = 32.days.ago
+ @worker.perform(@snp.id)
+
+ expect(LinkSnpPhenotype.jobs).to be_empty
+ end
end
describe 'scoring' do
- it 'returns a non-negative score for a SNP' do
- end
-
- it 'returns a non-negative count of matched references for a SNP' do
+ it 'returns no more than 10 phenotypes' do
+ out = @worker.score_phenotype(@snp)
+ expect(out.length).to be <= 10
end
it 'uses a consistent scoring scheme' do
end
end
-
- describe 'phenotype matching' do
- it 'returns a non-empty list of phenotype for a SNP' do
- end
-
- it 'returns no more than 10 phenotypes for a SNP' do
- end
- end
-
- describe 'update phenotypes' do
- it 'updates phenotype_snp table if more than MAX_AGE old' do
- end
- end
end
|
Expand tests for LinkSnpPhenotype worker
Signed-off-by: Vivek Rai <4b8b65dd320e6035df8e26fe45ee3876d9e0f96b@gmail.com>
|
diff --git a/lib/tasks/rake_helpers/rake_utils.rb b/lib/tasks/rake_helpers/rake_utils.rb
index abc1234..def5678 100644
--- a/lib/tasks/rake_helpers/rake_utils.rb
+++ b/lib/tasks/rake_helpers/rake_utils.rb
@@ -22,7 +22,7 @@
def decompress_file(filename)
shell_working "decompressing file #{filename}" do
- system "gunzip -3 -f #{filename}"
+ system "gunzip #{filename}"
end
end
|
Use decompression options available on hosted env
Was getting this error trying to restore on
a hosted env (alpine image):
```
gunzip: unrecognized option: -3
BusyBox v1.30.1 (2019-10-26 11:23:07 UTC) multi-call binary.
Usage: gunzip [-cfkt] [FILE]...
Decompress FILEs (or stdin)
-c Write to stdout
-f Force
-k Keep input files
-t Test file integrity
```
|
diff --git a/lib/toy_robot_simulator/simulator.rb b/lib/toy_robot_simulator/simulator.rb
index abc1234..def5678 100644
--- a/lib/toy_robot_simulator/simulator.rb
+++ b/lib/toy_robot_simulator/simulator.rb
@@ -1,4 +1,25 @@ module ToyRobotSimulator
class Simulator
+ attr_accessor :controller
+
+ def initialize
+ welcome_message
+ while line = $stdin.gets do
+ break if line.downcase.include? "quit"
+ puts line
+ end
+ end
+
+ def welcome_message
+ puts %Q(
+ This is the Toy Robot Simulator Code Challenge!\n
+ Enter with #{available_commands}\n
+ or type QUIT to end the simulator! Good game!\n
+ )
+ end
+
+ def available_commands
+ ["PLACE", "MOVE", "LEFT", "RIGHT"].join(', ')
+ end
end
end
|
Create Simulator with a finite loop that receives commands
|
diff --git a/know-your-values/app/controllers/values_controller.rb b/know-your-values/app/controllers/values_controller.rb
index abc1234..def5678 100644
--- a/know-your-values/app/controllers/values_controller.rb
+++ b/know-your-values/app/controllers/values_controller.rb
@@ -2,7 +2,8 @@ include IndexHelper
def show
moreValues = Value.all.shuffle[0..50]
- render partial: '/values/possiblevalues', locals: {moreValues: moreValues}
+ friend = User.find(params[:id])
+ render partial: '/values/possiblevalues', locals: {moreValues: moreValues, friend: friend}
end
|
Send friend data to view.
|
diff --git a/spec/factories/sales_pages.rb b/spec/factories/sales_pages.rb
index abc1234..def5678 100644
--- a/spec/factories/sales_pages.rb
+++ b/spec/factories/sales_pages.rb
@@ -11,5 +11,6 @@ heading { Faker::Lorem.words(rand(3) + 3).join " " }
sub_heading { Faker::Lorem.words(rand(5) + 3).join " " }
video { "http://vimeo.com/22977143" }
+ about_owner { Faker::Lorem.words(rand(22) + 1).join " " }
end
end
|
Update SalesPage Factor for about_owner
Add the about_owner attribute to the SalesPage factory.
|
diff --git a/spec/features/comment_spec.rb b/spec/features/comment_spec.rb
index abc1234..def5678 100644
--- a/spec/features/comment_spec.rb
+++ b/spec/features/comment_spec.rb
@@ -1,23 +1,30 @@ require 'rails_helper'
-describe 'Comments Panel' do
- it "user can see comments on queried translation" do
- pending
+describe 'Comment features' do
+ context "on new comments page" do
+ let(:query) { FactoryGirl.create(:query) }
+ it "can see a form to write a new comment" do
+ visit new_query_comment_path(query)
+ end
end
- context "when logged in" do
- it "user can make comments on a query by clicking comment link" do
- pending
- end
+ # it "user can see comments on queried translation" do
+ # pending
+ # end
- it "user can make comments on comments of a query by clicking nested comment link" do
- pending
- end
- end
+ # context "when logged in" do
+ # it "user can make comments on a query by clicking comment link" do
+ # pending
+ # end
- context "when not logged in" do
- it "user can't make comments on a query after clicking comment link" do
- pending
- end
- end
+ # it "user can make comments on comments of a query by clicking nested comment link" do
+ # pending
+ # end
+ # end
+
+ # context "when not logged in" do
+ # it "user can't make comments on a query after clicking comment link" do
+ # pending
+ # end
+ # end
end
|
Add beginning of test for view of new comment page
|
diff --git a/lib/finite_machine/async_call.rb b/lib/finite_machine/async_call.rb
index abc1234..def5678 100644
--- a/lib/finite_machine/async_call.rb
+++ b/lib/finite_machine/async_call.rb
@@ -0,0 +1,47 @@+# encoding: utf-8
+
+module FiniteMachine
+ # An asynchronouse call representation
+ class AsyncCall
+ include Threadable
+
+ attr_threadsafe :context
+
+ attr_threadsafe :callable
+
+ attr_threadsafe :arguments
+
+ attr_threadsafe :block
+
+ # Build asynchronous call instance
+ #
+ # @param [Object] context
+ # @param [Callable] callable
+ # @param [Array] args
+ # @param [#call] block
+ #
+ # @example
+ # AsyncCall.build(self, Callable.new(:method), :a, :b)
+ #
+ # @return [self]
+ #
+ # @api public
+ def self.build(context, callable, *args, &block)
+ instance = new
+ instance.context = context
+ instance.callable = callable
+ instance.arguments = *args
+ instance.block = block
+ instance
+ end
+
+ # Dispatch the event to the context
+ #
+ # @return [nil]
+ #
+ # @api private
+ def dispatch
+ callable.call(context, *arguments, block)
+ end
+ end # AsyncCall
+end # FiniteMachine
|
Add async call for event dispatch.
|
diff --git a/lib/frecon/models/competition.rb b/lib/frecon/models/competition.rb
index abc1234..def5678 100644
--- a/lib/frecon/models/competition.rb
+++ b/lib/frecon/models/competition.rb
@@ -14,9 +14,6 @@ field :location, type: String
field :name, type: String
- has_many :matches, dependent: :destroy
- has_many :participations, dependent: :destroy
-
validates :location, :name, presence: true
validates :name, uniqueness: true
end
|
Competition: Remove old associations with matches and participations.
|
diff --git a/cookbooks/ondemand_base/metadata.rb b/cookbooks/ondemand_base/metadata.rb
index abc1234..def5678 100644
--- a/cookbooks/ondemand_base/metadata.rb
+++ b/cookbooks/ondemand_base/metadata.rb
@@ -4,21 +4,21 @@ description "Installs/Configures ondemand_base"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
version "1.4.0"
-depends "ubuntu"
+depends "ad-auth"
+depends "chef-client"
+depends "hosts"
+depends "man"
+depends "nagios"
+depends "networking_basic"
depends "ntp"
depends "openssh"
+depends "resolver"
+depends "rundeck"
+depends "selinux"
+depends "snmp"
depends "sudo"
+depends "ubuntu"
depends "vim"
-depends "man"
-depends "networking_basic"
-depends "selinux"
-depends "yum"
-depends "ad-auth"
-depends "nagios"
-depends "chef-client"
-depends "resolver"
-depends "hosts"
-depends "snmp"
-depends "rundeck"
+depends "vmware-tools"
depends "windows"
-depends "vmware-tools"+depends "yum"
|
Sort the world's largest decency list
Former-commit-id: 621e939f456552867f7cd8495a5bfe213e601e3e [formerly 680a1090acf5d9055a7dad3b355f0ece318eed46] [formerly 2634e22baf3c2391edd2a20b8ca2d399ef72c485 [formerly 730a14160af3b916bf94cdfb66d290091832424d [formerly 3221e989820087a090268a9485f48eb959441ea8]]]
Former-commit-id: d53993e0c9638679550ba49c9beeff705786a6a2 [formerly 11d4d9361ca64ae44a4cf9e99a074c81068b623a]
Former-commit-id: d5608cef5e87b10f19e6ce457197dc4c13125736
Former-commit-id: 4f9d544c3b17624071971c86269db472ad93cc2f
|
diff --git a/db/migrate/20160308212903_add_default_group_visibility_to_application_settings.rb b/db/migrate/20160308212903_add_default_group_visibility_to_application_settings.rb
index abc1234..def5678 100644
--- a/db/migrate/20160308212903_add_default_group_visibility_to_application_settings.rb
+++ b/db/migrate/20160308212903_add_default_group_visibility_to_application_settings.rb
@@ -7,7 +7,9 @@ add_column :application_settings, :default_group_visibility, :integer
# Unfortunately, this can't be a `default`, since we don't want the configuration specific
# `allowed_visibility_level` to end up in schema.rb
- execute("UPDATE application_settings SET default_group_visibility = #{allowed_visibility_level}")
+
+ visibility_level = allowed_visibility_level || Gitlab::VisibilityLevel::PRIVATE
+ execute("UPDATE application_settings SET default_group_visibility = #{visibility_level}")
end
def down
|
Fix group visibility level migration in case all visibility levels are restricted
|
diff --git a/engines/order_management/spec/services/order_management/stock/coordinator_spec.rb b/engines/order_management/spec/services/order_management/stock/coordinator_spec.rb
index abc1234..def5678 100644
--- a/engines/order_management/spec/services/order_management/stock/coordinator_spec.rb
+++ b/engines/order_management/spec/services/order_management/stock/coordinator_spec.rb
@@ -5,7 +5,12 @@ module OrderManagement
module Stock
describe Coordinator do
- let!(:order) { create(:order_with_line_items, distributor: create(:distributor_enterprise)) }
+ let!(:order) do
+ build_stubbed(
+ :order_with_line_items,
+ distributor: build_stubbed(:distributor_enterprise)
+ )
+ end
subject { Coordinator.new(order) }
|
Replace `create` with `build_stubbed` in coordinator model specs
|
diff --git a/test/test_read_map.rb b/test/test_read_map.rb
index abc1234..def5678 100644
--- a/test/test_read_map.rb
+++ b/test/test_read_map.rb
@@ -1,3 +1,30 @@ require_relative "test_helper"
+class TestReadMap < Poke::Test
+ def setup
+ @object = Object.new
+ @object.extend(ReadMap)
+ @mf = "media/grid_one/map.txt"
+ @pmf = "media/grid_one/program_map.txt"
+ @lines = @object.get_array_of_lines_from_file(@pmf)
+ @columns = @object.get_array_of_columns_from_file(@pmf)
+ end
+
+ test "creates an array of lines" do
+ assert_equal(Array, @object.get_array_of_lines_from_file(@mf).class)
+ end
+
+ test "creates an array of columns" do
+ assert_equal(Array, @object.get_array_of_columns_from_file(@mf).class)
+ end
+
+ test "can get the width of a lines array" do
+ assert_equal(27, @object.get_width_for_lines(@lines))
+ end
+
+ test "can get the height of a lines array" do
+ assert_equal(12, @object.get_height_for_lines(@lines))
+ end
+
+end
|
Add TestReadMap and several test methods
|
diff --git a/lib/queryable_array/shorthand.rb b/lib/queryable_array/shorthand.rb
index abc1234..def5678 100644
--- a/lib/queryable_array/shorthand.rb
+++ b/lib/queryable_array/shorthand.rb
@@ -1,8 +1,8 @@ class QueryableArray < Array
module Shorthand
- # If +key+ is a +Hash+ or an +Array+ containing one
+ # If +key+ is a +Hash+, +Proc+, or an +Array+ containing a +Hash+ or +Proc+
# then it acts like an alias for +find_by+ or +find_all+ respectively. It
- # behaves exactly like its superclass +Array+ in all other cases.
+ # delegates the call to +super+ in all other cases.
#
# pages = QueryableArray.new Page.all
#
@@ -12,9 +12,11 @@ #
# pages[[uri: '/']] # => [#<Page @uri='/' @name='Home'>]
# pages[[uri: '/', name: 'Typo']] # => []
+ #
+ # pages[uri: proc { |uri| uri.count('/') > 1 }] # => #<Page @uri='/users/bob' @name='Bob'>
def [](key)
# Try to handle numeric indexes, ranges, and anything else that is
- # natively supported by Array first
+ # natively supported by +Array+ first
super
rescue TypeError => error
method, key = key.is_a?(Array) ? [:find_all, key.first] : [:find_by, key]
|
Add more documentation for Shorthand [ci skip]
|
diff --git a/lib/rspec/default_http_header.rb b/lib/rspec/default_http_header.rb
index abc1234..def5678 100644
--- a/lib/rspec/default_http_header.rb
+++ b/lib/rspec/default_http_header.rb
@@ -1,7 +1,19 @@ require "rspec/default_http_header/version"
-module Rspec
+module RSpec
module DefaultHttpHeader
- # Your code goes here...
+ extend ActiveSupport::Concern
+
+ HTTP_METHODS = %w(get post put delete patch)
+
+ included do
+ let(:default_headers) { {} }
+
+ HTTP_METHODS.each do |m|
+ define_method(m) do |path, parameters = nil, headers_or_env = nil|
+ super(path, parameters, default_headers.merge(headers_or_env))
+ end
+ end
+ end
end
end
|
Set default http header via overriding http methods
|
diff --git a/lib/rubycritic/source_locator.rb b/lib/rubycritic/source_locator.rb
index abc1234..def5678 100644
--- a/lib/rubycritic/source_locator.rb
+++ b/lib/rubycritic/source_locator.rb
@@ -21,13 +21,13 @@ private
def expand_paths
- @initial_paths.map do |path|
+ @initial_paths.flat_map do |path|
if File.directory?(path)
Pathname.glob(File.join(path, RUBY_FILES))
elsif File.exist?(path) && File.extname(path) == RUBY_EXTENSION
Pathname.new(path)
end
- end.flatten.compact.map(&:cleanpath)
+ end.compact.map(&:cleanpath)
end
end
end
|
Use flat_map instead of map followed by flatten
Not only is this more idiomatic, [it's also better performance wise!][1]
[1]: http://gistflow.com/posts/578-use-flat_map-instead-of-map-flatten
|
diff --git a/lib/travis/build/script/perl6.rb b/lib/travis/build/script/perl6.rb
index abc1234..def5678 100644
--- a/lib/travis/build/script/perl6.rb
+++ b/lib/travis/build/script/perl6.rb
@@ -9,6 +9,11 @@ perl6: 'latest'
}
+ def export
+ super
+ sh.export 'TRAVIS_PERL6_VERSION', version, echo: false
+ end
+
def configure
super
@@ -19,11 +24,6 @@ sh.echo 'Installing Rakudo (MoarVM)', ansi: :yellow
sh.cmd 'git clone https://github.com/tadzik/rakudobrew.git $HOME/.rakudobrew'
sh.export 'PATH', '$HOME/.rakudobrew/bin:$PATH', echo: false
- end
-
- def export
- super
- sh.export 'TRAVIS_PERL6_VERSION', version, echo: false
end
def setup
|
Move `export` sub to beginning
This makes the global nature of the sub more apparent
|
diff --git a/0_code_wars/parsing_prices.rb b/0_code_wars/parsing_prices.rb
index abc1234..def5678 100644
--- a/0_code_wars/parsing_prices.rb
+++ b/0_code_wars/parsing_prices.rb
@@ -0,0 +1,14 @@+# http://www.codewars.com/kata/56833b76371e86f8b6000015/
+# --- iteration 1 ---
+class String
+ def to_cents
+ /\A\$(?<dols>\d+)\.(?<cents>\d{2})\z/ =~ self ? (dols + cents).to_i : nil
+ end
+end
+
+# --- iteration 2 ---
+class String
+ def to_cents
+ /\A\$(?<dols>\d+)\.(?<cents>\d+)\z/ =~ self ? (dols + cents).to_i : nil
+ end
+end
|
Add code wars (7) - parsing prices
|
diff --git a/spec/features/teams/cud_spec.rb b/spec/features/teams/cud_spec.rb
index abc1234..def5678 100644
--- a/spec/features/teams/cud_spec.rb
+++ b/spec/features/teams/cud_spec.rb
@@ -0,0 +1,48 @@+require 'spec_helper.rb'
+
+feature 'Creating editing and deleting a team', js: true do
+ let(:tournament1){ FactoryGirl::create(:tournament)}
+ let(:tournament2){ FactoryGirl::create(:tournament)}
+ let(:team1) { FactoryGirl::attributes_for(:team, tournament_id: tournament1.id)}
+ let(:team2) { FactoryGirl::attributes_for(:team, tournament_id: tournament2.id)}
+ let(:user) { FactoryGirl::create(:user) }
+
+ before do
+ visit "#/home"
+ visit "#/login"
+ fill_in "email", with: user.email
+ fill_in "password", with: user.password
+
+ click_on "log-in-button"
+ visit "#/home/"
+ end
+
+ scenario "Update a team when user exists and is a tournament admin", :raceable do
+ TournamentAdmin.create(user_id: user.id, tournament_id: tournament1.id, status: :main)
+ tournament2
+ t1 = Team.create(team1)
+
+ #TODO: when tournament IF is done, enter properly
+ visit "#/teams/" + t1.id.to_s
+
+ click_on "edit-team"
+
+ fill_in "name", with: team2[:name]
+ fill_in "required_size", with: team2[:required_size]
+
+ click_on "save-team"
+
+ expect(page).to have_content(team2[:name])
+ expect(page).to have_content(team2[:required_size])
+ end
+
+ scenario "Delete a team when user is a tournament admin" do
+ TournamentAdmin.create(user_id: user.id, tournament_id: tournament1.id, status: :main)
+ team = Team.create(team1)
+ visit "#/teams/" + team.id.to_s
+
+ click_on "delete-team"
+
+ expect(Team.exists?(id: team.id)).to be false
+ end
+end
|
Add Teams UD feature spec
|
diff --git a/spec/models/groups_user_spec.rb b/spec/models/groups_user_spec.rb
index abc1234..def5678 100644
--- a/spec/models/groups_user_spec.rb
+++ b/spec/models/groups_user_spec.rb
@@ -1,5 +1,5 @@ require 'spec_helper'
-describe GroupsUser do
+describe GroupUser do
pending "add some examples to (or delete) #{__FILE__}"
end
|
Fix incorrect model name on GroupUser to get test to run
|
diff --git a/Casks/handbrakecli-nightly.rb b/Casks/handbrakecli-nightly.rb
index abc1234..def5678 100644
--- a/Casks/handbrakecli-nightly.rb
+++ b/Casks/handbrakecli-nightly.rb
@@ -1,10 +1,12 @@ cask :v1 => 'handbrakecli-nightly' do
- version '6782svn'
- sha256 'a661254da12a5fcaaab80b822bed78e8e000800042380bf3ccdfacf017cdb7fa'
+ version '6822svn'
+ sha256 '06b3024888643041779f4ac301266739ef6a6c4a30972a951aec881fb28f50c3'
url "http://download.handbrake.fr/nightly/HandBrake-#{version}-MacOSX.6_CLI_x86_64.dmg"
homepage 'http://handbrake.fr'
license :gpl
+ depends_on :macos => '>= :snow_leopard'
+
binary 'HandBrakeCLI'
end
|
Update HandbrakeCLI Nightly to v6822svn
HandBrakeCLI Nightly v6822svn built 2015-01-28.
|
diff --git a/Casks/webstorm-bundled-jdk.rb b/Casks/webstorm-bundled-jdk.rb
index abc1234..def5678 100644
--- a/Casks/webstorm-bundled-jdk.rb
+++ b/Casks/webstorm-bundled-jdk.rb
@@ -0,0 +1,21 @@+cask :v1 => 'webstorm-bundled-jdk' do
+ version '10.0.1'
+ sha256 '8b05be91e5c688908d6bcaab4d1f5ead86912d5b33b332a7dd5964dc901090b7'
+
+ url "https://download.jetbrains.com/webstorm/WebStorm-#{version}-custom-jdk-bundled.dmg"
+ name 'WebStorm'
+ homepage 'http://www.jetbrains.com/webstorm/'
+ license :commercial
+
+ app 'WebStorm.app'
+ binary 'WebStorm.app/Contents/MacOS/webstorm'
+
+ zap :delete => [
+ '~/.WebStorm10',
+ '~/Library/Preferences/com.jetbrains.webstorm.plist',
+ '~/Library/Preferences/WebStorm10',
+ '~/Library/Application Support/WebStorm10',
+ '~/Library/Caches/WebStorm10',
+ '~/Library/Logs/WebStorm10',
+ ]
+end
|
Add formula for WebStorm with bundled JDK
See #879
|
diff --git a/config/environments/production.rb b/config/environments/production.rb
index abc1234..def5678 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -13,6 +13,5 @@ config.log_level = :info
config.i18n.fallbacks = true
config.active_support.deprecation = :notify
- config.log_formatter = ::Logger::Formatter.new
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
end
|
Remove last vestiges of logstasher config
It's now handled by govuk_app_config and we should have removed it when we
upgraded to 1.0.0, but the documentation was unclear.
|
diff --git a/config/environments/production.rb b/config/environments/production.rb
index abc1234..def5678 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -19,4 +19,8 @@ config.action_mailer.delivery_method = :sendmail # so is queued, rather than giving immediate errors
require 'rack/ssl'
-config.middleware.insert_after ActionController::Failsafe, ::Rack::SSL if ::Configuration::force_ssl
+if ::Configuration::force_ssl
+ config.middleware.insert_after ActionController::Failsafe, ::Rack::SSL
+ # For Rails 3.x this will need to change to
+ #config.middleware.insert_before ActionDispatch::Cookies, ::Rack::SSL
+end
|
Add comment about middleware change for rails 3
|
diff --git a/config/software/datadog-verity.rb b/config/software/datadog-verity.rb
index abc1234..def5678 100644
--- a/config/software/datadog-verity.rb
+++ b/config/software/datadog-verity.rb
@@ -1,8 +1,13 @@ name "datadog-verity"
default_version "last-stable"
+env = {
+ "GOROOT" => "/usr/local/go/",
+ "GOPATH" => "/var/cache/omnibus/src/datadog-verity"
+}
+
build do
- command "go get github.com/DataDog/verity"
- command "cd $GOPATH/src/github.com/DataDog/verity"
- command "go build -o #{install_dir}/bin/verity"
+ command "$GOROOT/bin/go get -d -u github.com/DataDog/verity", :env => env
+ command "cd $GOPATH/src/github.com/DataDog/verity", :env => env
+ command "$GOROOT/bin/go build -o #{install_dir}/bin/verity", :env => env
end
|
Update go env in verity config
|
diff --git a/Casks/mindjet-mindmanager9.rb b/Casks/mindjet-mindmanager9.rb
index abc1234..def5678 100644
--- a/Casks/mindjet-mindmanager9.rb
+++ b/Casks/mindjet-mindmanager9.rb
@@ -2,7 +2,7 @@ version '9.6.510'
sha256 '23e2e2e3f712bc9d58b4a826abc3fb50ffac0134e93c4db9e055fa4874fe12d1'
- url 'http://download.mindjet.com/Mindjet_MindManager_Mac_#{version}.dmg'
+ url "http://download.mindjet.com/Mindjet_MindManager_Mac_#{version}.dmg"
name 'Mindjet MindManager 9'
homepage 'http://www.mindjet.com/mindmanager/'
license :commercial
|
Change single to double quotes in mindjet-mindmanager url
|
diff --git a/Disk.podspec b/Disk.podspec
index abc1234..def5678 100644
--- a/Disk.podspec
+++ b/Disk.podspec
@@ -9,7 +9,7 @@ s.license = { :type => "MIT", :file => "LICENSE" }
s.author = { "Saoud Rizwan" => "hello@saoudmr.com" }
s.social_media_url = "https://twitter.com/sdrzn"
- s.swift_version = "4.0"
+ s.swift_version = "5.0"
s.platform = :ios, "9.0"
s.source = { :git => "https://github.com/saoudrizwan/Disk.git", :tag => "#{s.version}" }
s.source_files = "Sources/**/*.{h,m,swift}"
|
Update podspec to Swift 5
|
diff --git a/extconf.rb b/extconf.rb
index abc1234..def5678 100644
--- a/extconf.rb
+++ b/extconf.rb
@@ -1,3 +1,3 @@ require "mkmf"
have_header("stdint.h")
-create_makefile("bytestream")
+create_makefile("crypt/bytestream")
|
Put bytestream.? in the right place
|
diff --git a/lib/api.rb b/lib/api.rb
index abc1234..def5678 100644
--- a/lib/api.rb
+++ b/lib/api.rb
@@ -39,6 +39,11 @@ Survey.all.to_json
end
+ get '/surveys/:id' do
+ content_type :json
+ Survey.first(_id: params[:id].to_i).to_json
+ end
+
post '/surveys' do
data = JSON.parse(request.body.read)
binding.pry
|
Add route for single survey
|
diff --git a/telemetry-logger.gemspec b/telemetry-logger.gemspec
index abc1234..def5678 100644
--- a/telemetry-logger.gemspec
+++ b/telemetry-logger.gemspec
@@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'telemetry-logger'
- s.version = '0.1.6'
+ s.version = '0.1.7'
s.summary = 'Logging to STDERR with coloring and levels of severity'
s.description = ' '
|
Package version patch number is incremented from 0.1.6 to 0.1.7
|
diff --git a/recipes/server_upgrade.rb b/recipes/server_upgrade.rb
index abc1234..def5678 100644
--- a/recipes/server_upgrade.rb
+++ b/recipes/server_upgrade.rb
@@ -1,4 +1,10 @@ include_recipe "gluster::upgrade_common"
+
+bash "kill glusterfsd and glusterd" do
+ code <<-CMD
+ killall glusterfsd glusterd
+ CMD
+end
include_recipe "gluster::server_install"
|
Kill GFS processes when upgrading
|
diff --git a/test/inheritance_test.rb b/test/inheritance_test.rb
index abc1234..def5678 100644
--- a/test/inheritance_test.rb
+++ b/test/inheritance_test.rb
@@ -32,8 +32,8 @@ end
end
- assert_equal [:born, :conceived] , Animal.workflow_spec.states.keys.sort
- assert_equal [:hiding, :upset], Cat.workflow_spec.states.keys.sort, "Workflow definitions are not inherited"
+ assert_equal [:born, :conceived] , sort_sym_array(Animal.workflow_spec.states.keys)
+ assert_equal [:hiding, :upset], sort_sym_array(Cat.workflow_spec.states.keys), "Workflow definitions are not inherited"
animal = Animal.new
cat = Cat.new
@@ -48,7 +48,13 @@ assert_equal [:halt!, :process_event!, :scratch!], bang_methods(cat)
end
+ def sort_sym_array(a)
+ a.sort! { |a, b| a.to_s <=> b.to_s } # workaround for Ruby 1.8.7
+ end
+
def bang_methods(obj)
- (obj.public_methods-Object.public_methods).select {|m| m =~ /!$/}.sort
+ non_trivial_methods = obj.public_methods-Object.public_methods
+ methods_with_bang = non_trivial_methods.select {|m| m =~ /!$/}
+ sort_sym_array methods_with_bang
end
end
|
Fix test for Ruby 1.8.7
|
diff --git a/tests/helpers/fake_ui.rb b/tests/helpers/fake_ui.rb
index abc1234..def5678 100644
--- a/tests/helpers/fake_ui.rb
+++ b/tests/helpers/fake_ui.rb
@@ -19,8 +19,8 @@ @test.assert_equal expected_score, actual_score
end
- def display_winners(players)
- @output << "#{players.map(&:name).join(' & ')} won with #{players.first.score} points!"
+ def puts(output_string)
+ @output << output_string
end
def ask_for_hold_positions(*)
|
Remove duplication by using method defined in parent and fix test
|
diff --git a/spec/language/alias_spec.rb b/spec/language/alias_spec.rb
index abc1234..def5678 100644
--- a/spec/language/alias_spec.rb
+++ b/spec/language/alias_spec.rb
@@ -1 +1,40 @@ require File.dirname(__FILE__) + '/../spec_helper'
+
+class AliasObject
+ def value; 5; end
+ def false_value; 6; end
+end
+
+describe "The alias keyword" do
+ before(:each) do
+ @obj = AliasObject.new
+ @meta = class << @obj;self;end
+ end
+
+ it "should create a new name for an existing method" do
+ @meta.class_eval do
+ alias __value value
+ end
+ @obj.__value.should == 5
+ end
+
+ it "should overwrite an existing method with the target name" do
+ @meta.class_eval do
+ alias false_value value
+ end
+ @obj.false_value.should == 5
+ end
+
+ it "should be reversible" do
+ @meta.class_eval do
+ alias __value value
+ alias value false_value
+ end
+ @obj.value.should == 6
+
+ @meta.class_eval do
+ alias value __value
+ end
+ @obj.value.should == 5
+ end
+end
|
Add some 'alias' specs that fail on rbx and pass on MRI
|
diff --git a/lib/cannon/route_action.rb b/lib/cannon/route_action.rb
index abc1234..def5678 100644
--- a/lib/cannon/route_action.rb
+++ b/lib/cannon/route_action.rb
@@ -21,6 +21,7 @@ @action.call(request, response)
elsif @action.include? '#'
controller, action = @action.split('#')
+ Cannon.logger.debug "Controller: #{controller}, Action: #{action}"
RouteAction.controller(controller, @app).send(action, request, response)
else
Cannon.logger.debug "Action: #{@action}"
|
Add logger debug line for controller based action requests
|
diff --git a/lib/copian/collector/hp.rb b/lib/copian/collector/hp.rb
index abc1234..def5678 100644
--- a/lib/copian/collector/hp.rb
+++ b/lib/copian/collector/hp.rb
@@ -1,8 +1,18 @@ require File.expand_path(File.dirname(__FILE__) + '/hp/ports')
+require File.expand_path(File.dirname(__FILE__) + '/hp/vlans')
module Copian
module Collector
class Hp < Generic
+ def vlans
+ load_ifnames
+
+ vlans_collector.collect do |vlan_id, vlan_index|
+ vlan_name = @ifnames[vlan_index]
+ vlan_id = vlan_name.gsub(/[^0-9]/, '').to_i
+ yield vlan_id, vlan_index, vlan_name
+ end
+ end
def ports
load_ifnames
@@ -11,6 +21,9 @@ end
end
private
+ def vlans_collector
+ @vlans_collector ||= HpVlansCollector.new(@manager)
+ end
def ports_collector
@ports_collector ||=
HpPortsCollector.new(@manager)
|
Add VLAN support to HP collector.
We work around the lack of VLAN ID information from the VLAN
collector by obtaining the VLAN ID from the ifName.
|
diff --git a/lib/duby/ast/intrinsics.rb b/lib/duby/ast/intrinsics.rb
index abc1234..def5678 100644
--- a/lib/duby/ast/intrinsics.rb
+++ b/lib/duby/ast/intrinsics.rb
@@ -1,47 +1,45 @@ module Duby::AST
- class Print < Node
- attr_accessor :println
-
- def initialize(parent, line_number, println, &block)
- super(parent, line_number, &block)
- @println = println
- end
-
- alias parameters children
- alias parameters= children=
-
- def infer(typer)
- if parameters.size > 0
- resolved = parameters.select {|param| typer.infer(param); param.resolved?}
- resolved! if resolved.size == parameters.size
- else
- resolved!
- end
- typer.no_type
- end
- end
-
defmacro('puts') do |transformer, fcall, parent|
- Print.new(parent, fcall.position, true) do |print|
- if fcall.respond_to?(:args_node) && fcall.args_node
+ Call.new(parent, fcall.position, "println") do |x|
+ args = if fcall.respond_to?(:args_node) && fcall.args_node
fcall.args_node.child_nodes.map do |arg|
- transformer.transform(arg, print)
+ transformer.transform(arg, x)
end
else
[]
end
+ [
+ Call.new(x, fcall.position, "out") do |y|
+ [
+ Constant.new(y, fcall.position, "System"),
+ []
+ ]
+ end,
+ args,
+ nil
+ ]
end
end
defmacro('print') do |transformer, fcall, parent|
- Print.new(parent, fcall.position, false) do |print|
- if fcall.respond_to?(:args_node) && fcall.args_node
+ Call.new(parent, fcall.position, "print") do |x|
+ args = if fcall.respond_to?(:args_node) && fcall.args_node
fcall.args_node.child_nodes.map do |arg|
- transformer.transform(arg, print)
+ transformer.transform(arg, x)
end
else
[]
end
+ [
+ Call.new(x, fcall.position, "out") do |y|
+ [
+ Constant.new(y, fcall.position, "System"),
+ []
+ ]
+ end,
+ args,
+ nil
+ ]
end
end
|
Remove Print node and just transform puts/print into calls against System.out.
|
diff --git a/vagrant_cloud.gemspec b/vagrant_cloud.gemspec
index abc1234..def5678 100644
--- a/vagrant_cloud.gemspec
+++ b/vagrant_cloud.gemspec
@@ -9,7 +9,7 @@ s.homepage = 'https://github.com/cargomedia/vagrant_cloud'
s.license = 'MIT'
- s.add_runtime_dependency 'rest_client'
+ s.add_runtime_dependency 'rest-client', '~>1.7'
- s.add_development_dependency 'rake'
+ s.add_development_dependency 'rake', '~>10.4'
end
|
Update gem dependencies, add version constraints
|
diff --git a/scrolls/mysql.rb b/scrolls/mysql.rb
index abc1234..def5678 100644
--- a/scrolls/mysql.rb
+++ b/scrolls/mysql.rb
@@ -13,17 +13,16 @@ after_bundler do
rake "db:create:all" if config['auto_create']
- if config['populate_rake_task']
- sample_rake = <<-RUBY
-require './config/environment'
+ rakefile("sample.rake") do
+<<-RUBY
namespace :db do
desc "Populate the database with sample data"
- task :sample do
+ task :sample => :environment do
+
end
task :populate => :sample
end
RUBY
- File.open("lib/tasks/sample.rake", 'w') {|f| f.write(sample_rake)}
end
end
@@ -44,8 +43,3 @@ - auto_create:
type: boolean
prompt: "Create MySQL database with default configuration?"
-
- - populate_rake_task:
- type: boolean
- prompt: "Add db:sample rake task?"
-
|
Use the rakefile helper to create sample.rake
|
diff --git a/lib/playlistified_entry.rb b/lib/playlistified_entry.rb
index abc1234..def5678 100644
--- a/lib/playlistified_entry.rb
+++ b/lib/playlistified_entry.rb
@@ -6,8 +6,10 @@ :visual_url,
:locale,
:tracks,
+ :playlists,
+ :albums,
:entry)
- def initialize(id, url, title, description, visual_url, locale, tracks, playlists, entry)
+ def initialize(id, url, title, description, visual_url, locale, tracks, playlists, albums, entry)
@id = id
@url = url
@title = title
@@ -16,6 +18,7 @@ @locale = locale
@tracks = tracks
@playlists = playlists
+ @albums = albums
@entry = entry
end
|
Add albums attribute to PlaylistifiedEntry
|
diff --git a/lib/rack/handler/mizuno.rb b/lib/rack/handler/mizuno.rb
index abc1234..def5678 100644
--- a/lib/rack/handler/mizuno.rb
+++ b/lib/rack/handler/mizuno.rb
@@ -0,0 +1,20 @@+require 'mizuno'
+
+begin
+ require 'rjack-logback'
+ RJack::Logback.config_console( :stderr => true, :thread => true )
+rescue LoadError => e
+ require 'rjack-slf4j/simple'
+end
+
+module Rack
+ module Handler
+ module Mizuno
+
+ def self.run( app, opts = {} )
+ ::Mizuno::HttpServer.run( app, opts )
+ end
+
+ end
+ end
+end
|
Add Rack::Handler::Mizuno for rackup -s support
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -4,8 +4,6 @@ require 'rspec'
require 'tinder'
require 'fakeweb'
-
-require 'faraday/adapter/test'
FakeWeb.allow_net_connect = false
|
Remove direct require of Faraday test adapter
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -2,8 +2,7 @@ require 'chefspec/berkshelf'
RSpec.configure do |config|
- config.color = true
- config.log_level = :error
+ config.color = true # Use color in STDOUT
+ config.formatter = :documentation # Use the specified formatter
+ config.log_level = :error # Avoid deprecation notice SPAM
end
-
-at_exit { ChefSpec::Coverage.report! }
|
Use the doc formatter for specs
Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,9 +1,9 @@+ENV['RACK_ENV'] ||= "test"
+
require 'juici'
require 'mocha'
require 'fileutils'
-
-ENV['RACK_ENV'] ||= "test"
Dir["#{File.expand_path(File.dirname(__FILE__))}/helpers/**/*.rb"].each do |f|
puts "Requiring #{f}"
|
Set RACK_ENV before juici has a chance to
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -2,6 +2,9 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
require 'rspec'
require 'putkitin'
+
+require 'fakefs/safe'
+require 'fakefs/spec_helpers'
# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
|
Include fakefs in spec helper
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -19,7 +19,19 @@ if attributes.empty?
Class.new
else
- Struct.new(*attributes).new(*values)
+ mapped_values = values.map { |v| map_value(v) }
+ Struct.new(*attributes).new(*mapped_values)
+ end
+ end
+
+ def self.map_value(value)
+ case value
+ when Hash
+ HashObject.new(value)
+ when Array
+ value.map { |v| map_value(v) }
+ else
+ value
end
end
end
|
Implement nesting feature for HashObject
|
diff --git a/slides/layout.rb b/slides/layout.rb
index abc1234..def5678 100644
--- a/slides/layout.rb
+++ b/slides/layout.rb
@@ -10,8 +10,8 @@
class Flows < Slide
def content
- head = headline 'Flows'
- @image = fully_shown_image 'images/flow.png', head.height + OFFSET_FOR_EMPTY_LINE
+ headline 'Flows'
+ @image = fully_shown_image 'images/flow.png', 150
add_effect do
@image.remove
code 'code/flow.rb', true
@@ -21,8 +21,8 @@
class Stacks < Slide
def content
- head = headline 'Stacks'
- @image = fully_shown_image 'images/stack.png', head.height + OFFSET_FOR_EMPTY_LINE
+ headline 'Stacks'
+ @image = fully_shown_image 'images/stack.png', 150
add_effect do
@image.remove
code 'code/stack.rb', true
|
Fix another problem with height/width for text blocks not set
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,4 +1,4 @@-require 'rspec-expectations'
+require 'rspec/expectations'
require 'chefspec'
require 'chefspec/berkshelf'
require 'chefspec/server'
|
Resolve deprecation warning in spec
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,3 +1,6 @@+require 'rubygems'
+require 'spork'
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
@@ -7,27 +10,38 @@ # in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
-# Seed the database with the standard values.
-SeedFu.seed
+# Loading more in this block will cause your tests to run faster. However,
+# if you change any configuration or code from libraries loaded here, you'll
+# need to restart spork for it take effect.
+Spork.prefork do
-RSpec.configure do |config|
- # == Mock Framework
- #
- # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
- #
- # config.mock_with :mocha
- # config.mock_with :flexmock
- # config.mock_with :rr
- config.mock_with :rspec
+ # Seed the database with the standard values.
+ SeedFu.seed
- # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
- config.fixture_path = "#{::Rails.root}/spec/fixtures"
+ RSpec.configure do |config|
+ # == Mock Framework
+ #
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
+ #
+ # config.mock_with :mocha
+ # config.mock_with :flexmock
+ # config.mock_with :rr
+ config.mock_with :rspec
- # If you're not using ActiveRecord, or you'd prefer not to run each of your
- # examples within a transaction, remove the following line or assign false
- # instead of true.
- config.use_transactional_fixtures = true
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
- # Allows the use of shorthand `create(:user)` instead of `FactoryGirl.create(:user)`
- config.include FactoryGirl::Syntax::Methods
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
+ # examples within a transaction, remove the following line or assign false
+ # instead of true.
+ config.use_transactional_fixtures = true
+
+ # Allows the use of shorthand `create(:user)` instead of `FactoryGirl.create(:user)`
+ config.include FactoryGirl::Syntax::Methods
+ end
end
+
+# This code will be run each time you run your specs.
+Spork.each_run do
+
+end
|
Set up "spork" for rspec.
Signed-off-by: Daniel Hackney <2591e5f46f28d303f9dc027d475a5c60d8dea17a@haxney.org>
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -11,7 +11,7 @@ Coveralls::SimpleCov::Formatter
]
SimpleCov.start do
- add_filter '/spec/support/custom_matcher'
+ add_filter '/spec/'
end
require 'sepa_king'
|
Coverage: Check the main code only, not the test code
|
diff --git a/spectabular.gemspec b/spectabular.gemspec
index abc1234..def5678 100644
--- a/spectabular.gemspec
+++ b/spectabular.gemspec
@@ -18,7 +18,7 @@ s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.md"]
s.test_files = Dir["test/**/*"]
- s.add_dependency "rails", '~> 3.0'
+ s.add_dependency "rails", '> 3.0'
s.add_development_dependency "sqlite3"
end
|
Add Compatibility with Rails 4
|
diff --git a/lib/yard/server/adapter.rb b/lib/yard/server/adapter.rb
index abc1234..def5678 100644
--- a/lib/yard/server/adapter.rb
+++ b/lib/yard/server/adapter.rb
@@ -31,7 +31,7 @@ self.options = opts
self.server_options = server_opts
self.document_root = server_options[:DocumentRoot]
- self.router = Router.new(self)
+ self.router = (options[:router] || Router).new(self)
options[:adapter] = self
log.debug "Serving libraries using #{self.class}: #{libraries.keys.join(', ')}"
log.debug "Caching on" if options[:caching]
|
Allow alternate Router class to be specified with Adapter
|
diff --git a/app_template.rb b/app_template.rb
index abc1234..def5678 100644
--- a/app_template.rb
+++ b/app_template.rb
@@ -1,4 +1,4 @@-gem "rglossa", git: "git://github.com/textlab/rglossa.git"
+gem "rglossa", github: "textlab/rglossa"
run "bundle install"
|
Use github reference in application template
|
diff --git a/unsorted/excel_columns.rb b/unsorted/excel_columns.rb
index abc1234..def5678 100644
--- a/unsorted/excel_columns.rb
+++ b/unsorted/excel_columns.rb
@@ -0,0 +1,47 @@+# encoding: UTF-8
+require 'minitest/autorun'
+
+# Given a positive integer, return its corresponding column title as appear in an Excel sheet.
+
+# For example:
+
+# 1 -> A
+# 2 -> B
+# 3 -> C
+# ...
+# 26 -> Z
+# 27 -> AA
+# 28 -> AB
+
+ASCII_OFFSET_CONST = 64
+ALPHABET_BASE = 26
+
+def excel_column(col_number)
+ return -1 unless
+ col_number && col_number.respond_to?(:to_int) && col_number > 1
+
+ output_col = []
+
+ while col_number > 0 do
+ output_col.unshift(((col_number % ALPHABET_BASE) + ASCII_OFFSET_CONST).chr)
+ col_number = (col_number / ALPHABET_BASE).floor
+ end
+
+ output_col.join
+end
+
+describe "answer validation" do
+ it "returns correct column encodings" do
+ invalid_input = "I'm Invalid"
+ assert_equal -1,
+ excel_column(invalid_input), "should handle invalid input"
+
+ invalid_input = -42
+ assert_equal -1,
+ excel_column(invalid_input), "should handle invalid input"
+
+ expected_answer = "BB"
+ assert_equal expected_answer,
+ excel_column(54), "Should give correct answer for BB"
+ end
+end
|
Add Excel column problem from Leetcode
|
diff --git a/spec/tww_spec.rb b/spec/tww_spec.rb
index abc1234..def5678 100644
--- a/spec/tww_spec.rb
+++ b/spec/tww_spec.rb
@@ -4,12 +4,22 @@ let(:config) { TWW.config }
let(:client) { TWW.client }
- it { expect(config).to_not be_nil }
- it { expect(config.from).to eq('ACME Inc.') }
- it { expect(config.username).to eq('acme') }
- it { expect(config.password).to eq('valid') }
+ describe 'config' do
+ subject { config }
- it { expect(client).to_not be_nil }
- it { expect(client.config).to eq(config) }
- it { expect(client).to eq(TWW.client) }
+ it { should_not be_nil }
+ it { should eq(TWW.config) }
+ it { should eq(client.config) }
+
+ it { expect(config.username).to eq('acme') }
+ it { expect(config.password).to eq('valid') }
+ it { expect(config.from).to eq('ACME Inc.') }
+ end
+
+ describe 'client' do
+ subject { client }
+
+ it { should_not be_nil }
+ it { should eq(TWW.client) }
+ end
end
|
Improve tests for rest impl
|
diff --git a/my_hash.rb b/my_hash.rb
index abc1234..def5678 100644
--- a/my_hash.rb
+++ b/my_hash.rb
@@ -3,7 +3,7 @@ class MyHash
attr_reader :array
def initialize
- @array = ArrayList.new(5)
+ @array = ArrayList.new(100)
end
def set(key, value)
|
Increase the initial size of MyHash
This is necessary because the initial size is not large enough to prevent scenarios where someone is attempting to access the value of a certain key that doesn't actually exist yet. Without this fix, MyHash would raise an exception.
|
diff --git a/app/controllers/teachers/progress_reports/standards/classroom_topics_controller.rb b/app/controllers/teachers/progress_reports/standards/classroom_topics_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/teachers/progress_reports/standards/classroom_topics_controller.rb
+++ b/app/controllers/teachers/progress_reports/standards/classroom_topics_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])
+
topics = ::ProgressReports::Standards::Topic.new(current_user).results(params)
topics_json = topics.map do |topic|
serializer = ::ProgressReports::Standards::TopicSerializer.new(topic)
@@ -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/NSURL+QueryDictionary.podspec b/NSURL+QueryDictionary.podspec
index abc1234..def5678 100644
--- a/NSURL+QueryDictionary.podspec
+++ b/NSURL+QueryDictionary.podspec
@@ -1,6 +1,6 @@ Pod::Spec.new do |s|
s.name = "NSURL+QueryDictionary"
- s.version = "1.1.0"
+ s.version = "1.2.0"
s.summary = "Make working with NSURL queries more pleasant."
s.description = "NSURL, NSString and NSDictionary categories for working with URL queries"
s.homepage = "https://github.com/itsthejb/NSURL-QueryDictionary"
@@ -10,7 +10,7 @@ s.ios.deployment_target = '6.1'
s.osx.deployment_target = '10.8'
s.watchos.deployment_target = '2.0'
+ s.tvos.deployment_target = '9.0'
s.source_files = s.name + '/*.{h,m}'
s.frameworks = 'Foundation'
- s.requires_arc = true
end
|
Add tvOS to the Podspec
|
diff --git a/app/helpers/posts_helper.rb b/app/helpers/posts_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/posts_helper.rb
+++ b/app/helpers/posts_helper.rb
@@ -3,7 +3,7 @@ module PostsHelper
def render_links(text)
raw(text.split(%r{((?:https?:)?\/{2}[^\)\s]*)}).map.with_index do |s, i|
- i.even? ? sanitize(s) : link_to(s, s)
+ i.even? ? html_escape(s) : link_to(s, s)
end.join)
end
end
|
Use html_escape instead of sanitize to avoid stripping HTML completely
|
diff --git a/app/jobs/fhir_upload_job.rb b/app/jobs/fhir_upload_job.rb
index abc1234..def5678 100644
--- a/app/jobs/fhir_upload_job.rb
+++ b/app/jobs/fhir_upload_job.rb
@@ -21,7 +21,7 @@ fhir_server_url = "http://" + ENV["IE_PORT_3001_TCP_ADDR"] + ":" + ENV["IE_PORT_3001_TCP_PORT"]
end
- `#{upload_executable} -f #{fhir_server_url} -s #{json_file.path}`
+ `#{upload_executable} -f #{fhir_server_url} -s #{json_file.path} -c`
json_file.unlink
end
end
|
Use conditional uploading to FHIR endpoint to avoid record duplication
|
diff --git a/lib/bond/readlines/jruby.rb b/lib/bond/readlines/jruby.rb
index abc1234..def5678 100644
--- a/lib/bond/readlines/jruby.rb
+++ b/lib/bond/readlines/jruby.rb
@@ -4,7 +4,7 @@ require 'readline'
require 'jruby'
class << Readline
- ReadlineExt = org.jruby.ext.Readline
+ ReadlineExt ||= org.jruby.ext.Readline
def line_buffer
ReadlineExt.s_get_line_buffer(JRuby.runtime.current_context, JRuby.reference(self))
end
|
Enable plural Readline invocations sans warnings.
|
diff --git a/lib/byebug/commands/kill.rb b/lib/byebug/commands/kill.rb
index abc1234..def5678 100644
--- a/lib/byebug/commands/kill.rb
+++ b/lib/byebug/commands/kill.rb
@@ -13,7 +13,6 @@ end
def execute
- puts @match[1]
if @match[1]
signame = @match[1]
unless Signal.list.member?(signame)
|
Remove annoying debug print that has been around for a while.
|
diff --git a/lib/conceptql/query_modifiers/gdm/provider_query_modifier.rb b/lib/conceptql/query_modifiers/gdm/provider_query_modifier.rb
index abc1234..def5678 100644
--- a/lib/conceptql/query_modifiers/gdm/provider_query_modifier.rb
+++ b/lib/conceptql/query_modifiers/gdm/provider_query_modifier.rb
@@ -25,7 +25,7 @@ query
.select_all
.select_append(Sequel[:practitioner_id].as(:provider_id))
- .select_append(Sequel[nil].as(:specialty_concept_id))
+ .select_append(Sequel.cast(nil, :Bigint).as(:specialty_concept_id))
end.from_self
end
|
Fix issue with Union and CTEs
|
diff --git a/lib/flying_sphinx/binary.rb b/lib/flying_sphinx/binary.rb
index abc1234..def5678 100644
--- a/lib/flying_sphinx/binary.rb
+++ b/lib/flying_sphinx/binary.rb
@@ -1,9 +1,6 @@ module FlyingSphinx::Binary
def self.load
require 'flying_sphinx/binary/translator'
- require 'flying_sphinx/binary/delayed_delta'
- require 'flying_sphinx/binary/flag_as_deleted_job'
- require 'flying_sphinx/binary/index_job'
FlyingSphinx.translator = Translator.new FlyingSphinx::Configuration.new
end
|
Remove old delayed job files from Binary interface.
|
diff --git a/lib/frontend_server/rack.rb b/lib/frontend_server/rack.rb
index abc1234..def5678 100644
--- a/lib/frontend_server/rack.rb
+++ b/lib/frontend_server/rack.rb
@@ -8,8 +8,6 @@ self.class.configurations.each do |configuration|
configuration.call builder, config
end
-
- # builder.use ::Rack::Deflater
builder.use ReverseProxy do
reverse_proxy /^\/api(\/.*)$/, "#{server.config.server}$1"
|
Remove reference to Rack::Deflate. Seems to blow up aganist production
|
diff --git a/lib/health_inspector/cli.rb b/lib/health_inspector/cli.rb
index abc1234..def5678 100644
--- a/lib/health_inspector/cli.rb
+++ b/lib/health_inspector/cli.rb
@@ -17,7 +17,7 @@ [ cookbooks, databags, environments, roles ]
EOS
- def inspect(component=nil)
+ def inspect(component="")
checklists = component_to_checklists(component)
Inspector.inspect( checklists ,options[:repopath], options[:configpath])
end
@@ -36,7 +36,7 @@ ["Environments"]
when "roles"
["Roles"]
- when nil, "all"
+ when "", "all"
all
else
shell.say "I did not understand which component you wanted me to inspect. Running all checks."
|
Fix bug when passing no component
|
diff --git a/rgversion.gemspec b/rgversion.gemspec
index abc1234..def5678 100644
--- a/rgversion.gemspec
+++ b/rgversion.gemspec
@@ -24,7 +24,7 @@ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
- spec.add_development_dependency "bundler", "~> 1.15"
+ spec.add_development_dependency "bundler", "~> 1.16"
spec.add_development_dependency "rake", "~> 12.0"
spec.add_development_dependency "rspec", "~> 3.6"
|
Update bundler version for development.
|
diff --git a/lib/rack/instrumentation.rb b/lib/rack/instrumentation.rb
index abc1234..def5678 100644
--- a/lib/rack/instrumentation.rb
+++ b/lib/rack/instrumentation.rb
@@ -20,7 +20,7 @@
response
rescue Exception => raised
- instrument 'exception', 1, source: 'rack', type: 'count'
+ instrument 'rack.exception', 1, type: 'count'
raise
end
end
|
Use rack.exception as metric name.
|
diff --git a/lib/ropian/meter/raritan.rb b/lib/ropian/meter/raritan.rb
index abc1234..def5678 100644
--- a/lib/ropian/meter/raritan.rb
+++ b/lib/ropian/meter/raritan.rb
@@ -1,6 +1,9 @@ module Ropian
module Meter
class Raritan
+ UnitCurrent = SNMP::ObjectId.new("1.3.6.1.4.1.13742.4.1.4.2.1.3.1")
+ OutletCurrent = SNMP::ObjectId.new("1.3.6.1.4.1.13742.4.1.2.2.1.4")
+
def inspect
"#<#{self.class} #{@manager.host}@#{@manager.community}>"
end
@@ -8,15 +11,24 @@ @manager = SNMP::Manager.new(:Host => ip_addr,
:Community => community, :Version => version)
end
+ def collect # :yields: total_amps, hash_of_outlet_amps
+ results = Hash.new
+
+ @manager.walk(OutletCurrent) do |r|
+ r.each do |varbind|
+ results[varbind.name.index(OutletCurrent)] = varbind.value.to_f / 1000
+ end
+ end
+
+ yield total_amps, results
+ end
# Amps in total on whole bar
def total_amps
- oid = SNMP::ObjectId.new("1.3.6.1.4.1.13742.4.1.4.2.1.3.1")
- amps_for_oid(oid)
+ amps_for_oid(UnitCurrent)
end
# Amps per outlet
def outlet_amps(outlet_index)
- oid = SNMP::ObjectId.new("1.3.6.1.4.1.13742.4.1.2.2.1.4") + outlet_index
- amps_for_oid(oid)
+ amps_for_oid(OutletCurrent + outlet_index)
end
protected
def amps_for_oid(oid)
|
Add collection method for gathering all outlet details at once
|
diff --git a/lib/shex/extensions/test.rb b/lib/shex/extensions/test.rb
index abc1234..def5678 100644
--- a/lib/shex/extensions/test.rb
+++ b/lib/shex/extensions/test.rb
@@ -6,21 +6,23 @@ # @see http://shex.io/extensions/Test/
require 'shex'
-class ShEx::Test < ShEx::Extension("http://shex.io/extensions/Test/")
- # (see ShEx::Extension#visit)
- def visit(code: nil, matched: nil, depth: 0, **options)
- str = if md = /^ *(fail|print) *\( *(?:(\"(?:[^\\"]|\\")*\")|([spo])) *\) *$/.match(code.to_s)
- md[2] || case md[3]
- when 's' then matched.subject
- when 'p' then matched.predicate
- when 'o' then matched.object
- else matched.to_sxp
- end.to_s
- else
- matched ? matched.to_sxp : 'no statement'
+module ShEx
+ Test = Class.new(ShEx::Extension("http://shex.io/extensions/Test/")) do
+ # (see ShEx::Extension#visit)
+ def visit(code: nil, matched: nil, depth: 0, **options)
+ str = if md = /^ *(fail|print) *\( *(?:(\"(?:[^\\"]|\\")*\")|([spo])) *\) *$/.match(code.to_s)
+ md[2] || case md[3]
+ when 's' then matched.subject
+ when 'p' then matched.predicate
+ when 'o' then matched.object
+ else matched.to_sxp
+ end.to_s
+ else
+ matched ? matched.to_sxp : 'no statement'
+ end
+
+ $stdout.puts str
+ return !md || md[1] == 'print'
end
-
- $stdout.puts str
- return !md || md[1] == 'print'
end
-end+end
|
Update Test class definition to fix yardoc issue.
|
diff --git a/ruby/lib/bson/registry.rb b/ruby/lib/bson/registry.rb
index abc1234..def5678 100644
--- a/ruby/lib/bson/registry.rb
+++ b/ruby/lib/bson/registry.rb
@@ -43,8 +43,15 @@ # @since 2.0.0
def register(byte, type)
MAPPINGS.store(byte, type)
- type.define_method(:bson_type) { byte }
+ define_type_reader(type)
+ end
+
+ private
+
+ def define_type_reader(type)
+ type.module_eval <<-MOD
+ def bson_type; BSON_TYPE; end
+ MOD
end
end
end
-
|
Use module_eval to define the type reader.
This is so we follow normal method binding.
|
diff --git a/lib/tasks/mingle_tasks.rake b/lib/tasks/mingle_tasks.rake
index abc1234..def5678 100644
--- a/lib/tasks/mingle_tasks.rake
+++ b/lib/tasks/mingle_tasks.rake
@@ -2,12 +2,18 @@
desc "Fetch everything"
task fetch: ['twitter:fetch', 'facebook:fetch', 'instagram:fetch']
+ task clear: ['twitter:clear', 'facebook:clear', 'instagram:clear']
namespace :twitter do
desc "Fetch tweets from Twitter"
task fetch: :environment do
Mingle::Twitter.fetch
+ end
+
+ desc "Clear tweets from Twitter"
+ task clear: :environment do
+ Mingle::Twitter::Tweet.destroy_all
end
end
@@ -19,6 +25,11 @@ Mingle::Facebook.fetch
end
+ desc "Clear posts from Facebook"
+ task clear: :environment do
+ Mingle::Facebook::Post.destroy_all
+ end
+
end
namespace :instagram do
@@ -28,6 +39,11 @@ Mingle::Instagram.fetch
end
+ desc "Clear photos from Instagram"
+ task clear: :environment do
+ Mingle::Instagram::Photo.destroy_all
+ end
+
end
end
|
Implement rake tasks for clearing photos, tweets and posts
|
diff --git a/lib/uniq_martin/brew_cli.rb b/lib/uniq_martin/brew_cli.rb
index abc1234..def5678 100644
--- a/lib/uniq_martin/brew_cli.rb
+++ b/lib/uniq_martin/brew_cli.rb
@@ -5,7 +5,7 @@
# Only accept invocation via `brew`.
unless defined?(HOMEBREW_LIBRARY_PATH)
- brew_command = File.basename($PROGRAM_NAME, ".rb").tr("-", " ")
+ brew_command = File.basename($PROGRAM_NAME, ".rb").split("-", 2).join(" ")
abort("Error: Please run via `#{brew_command}`.")
end
|
lib: Fix error message for direct invocation
For commands that contain dashes our error message suggested to run via
`brew random command`, but that should have been `brew random-command`.
|
diff --git a/ember-handlebars-template.gemspec b/ember-handlebars-template.gemspec
index abc1234..def5678 100644
--- a/ember-handlebars-template.gemspec
+++ b/ember-handlebars-template.gemspec
@@ -18,7 +18,7 @@ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ['lib']
- spec.add_dependency 'sprockets', '~> 2.8'
+ spec.add_dependency 'sprockets', '~> 2.1'
spec.add_dependency 'barber', '>= 0.7.0'
spec.add_development_dependency 'bundler', '~> 1.7'
|
Allow older version of sprockets for Rails 3
|
diff --git a/providers/node.rb b/providers/node.rb
index abc1234..def5678 100644
--- a/providers/node.rb
+++ b/providers/node.rb
@@ -1,10 +1,6 @@-begin
- require 'zookeeper'
-rescue LoadError
- Chef::Log.warn("Missing gem 'zookeeper'")
-end
def get_zk()
+ require 'zookeeper'
# todo: memoize
return Zookeeper.new(@new_resource.connect_str)
end
|
Revert "put require in try/catch"
This reverts commit 5ce207567b81245d50ac903bea75f9630ca9f733.
since this gets loaded a compile time, we cannot install the gem from a
recipe.
|
diff --git a/spec/features/user_sign_up_spec.rb b/spec/features/user_sign_up_spec.rb
index abc1234..def5678 100644
--- a/spec/features/user_sign_up_spec.rb
+++ b/spec/features/user_sign_up_spec.rb
@@ -2,7 +2,11 @@
describe "the signin process", :type => :feature do
scenario 'with valid email and password' do
- sign_up_with 'valid@example.com', 'password'
+ params = { username: 'some_user', firstname: 'Some', lastname: 'User',
+ birthdate: '09-11-1988', email: 'some_email@mail.com', phone: '6665773'
+ password: '12345', password_confirmation: '12345' }
+
+ sign_up_with(params)
expect(page).to have_content('Sign out')
end
@@ -18,5 +22,18 @@
expect(page).to have_content('Sign in')
end
-
+
+ def sign_up_with(params)
+ visit sign_up_path
+ fill_in 'Username', with: params[:username]
+ fill_in 'Firstname', with: params[:firstname]
+ fill_in 'Lastname', with: params[:lastname]
+ fill_in 'Birth Date', with: params[:birthdate]
+ fill_in 'Email', with: params[:email]
+ fill_in 'Phone', with: params[:phone]
+ fill_in 'Password', with: params[:password]
+ fill_in 'Password Confirmation', with: params[:password_confirmation]
+
+ click_button 'Sign up'
+ end
end
|
Add Integration Spec for user sign up feature.
|
diff --git a/spec/features/slug_spec.rb b/spec/features/slug_spec.rb
index abc1234..def5678 100644
--- a/spec/features/slug_spec.rb
+++ b/spec/features/slug_spec.rb
@@ -12,14 +12,14 @@ expect(page.status_code).to be(200)
end
- describe 'changing the firstname slug' do
+ describe 'changing the firstname' do
before do
- user.firstname = "Ama"
+ user.firstname = "Adam"
user.save!
end
it 'changes the slug' do
- visit "/profiles/ama-lovelace"
+ visit "/profiles/adam-lovelace"
expect(page.status_code).to be(200)
end
end
|
Change the name from ada to adam in the slug test
|
diff --git a/spec/fixtures/factories.rb b/spec/fixtures/factories.rb
index abc1234..def5678 100644
--- a/spec/fixtures/factories.rb
+++ b/spec/fixtures/factories.rb
@@ -0,0 +1,20 @@+FactoryGirl.define do
+ factory :user do
+ sequence(:uid) { |n| "uid-#{n}"}
+ sequence(:name) { |n| "Joe Bloggs #{n}" }
+ sequence(:email) { |n| "joe#{n}@bloggs.com" }
+ if defined?(GDS::SSO::Config)
+ # Grant permission to signin to the app using the gem
+ permissions { ["signin"] }
+ end
+ end
+
+ factory :editor, parent: :user do
+ permissions %w(signin editor)
+ end
+
+ factory :cma_editor, parent: :user do
+ organisation_slug "competition-and-markets-authority"
+ end
+
+end
|
Add factory for CMA user
|
diff --git a/spec/support/generators.rb b/spec/support/generators.rb
index abc1234..def5678 100644
--- a/spec/support/generators.rb
+++ b/spec/support/generators.rb
@@ -24,6 +24,7 @@ FileUtils.cp_r dummy_app_template_path,
dummy_app_path,
remove_destination: true
+ raise 'Could not create dummy app' unless File.exists? dummy_app_path
end
def remove_dummy_app
|
Raise proper error if creating the dummy app fails
|
diff --git a/lib/behavior_tree/branch_nodes.rb b/lib/behavior_tree/branch_nodes.rb
index abc1234..def5678 100644
--- a/lib/behavior_tree/branch_nodes.rb
+++ b/lib/behavior_tree/branch_nodes.rb
@@ -32,6 +32,11 @@ end
end
+ # A Sequence is a branch node that evaluates its children in order until one
+ # of them returns false. If all children evaluate to true, then the sequence
+ # as a whole evaluates to true. If any child evaluates to false, then
+ # evaluation of children is halted and the sequence as a whole evaluates to
+ # false.
class Sequence < BranchNode
def handle_child_result(child_result)
unless child_result
@@ -44,6 +49,11 @@ end
end
+ # A Selector is a branch node that evaluates its children in order until one
+ # of them returns true. If all children evaluate to false, then the selector
+ # as a whole evaluates to false. If any child evaluates to true, then
+ # evaluation of children is halted and the selector as a whole evaluates to
+ # true.
class Selector < BranchNode
def handle_child_result(child_result)
if child_result
|
Add some RDoc to branch node classes.
|
diff --git a/Casks/appfresh.rb b/Casks/appfresh.rb
index abc1234..def5678 100644
--- a/Casks/appfresh.rb
+++ b/Casks/appfresh.rb
@@ -9,6 +9,8 @@ license :commercial
tags :vendor => 'metaquark'
+ uninstall :launchctl => 'de.metaquark.appfresh'
+
zap :delete => [
'~/Library/Application Support/AppFresh',
'~/Library/Application Support/Growl/Tickets/AppFresh.growlTicket',
|
Add uninstall :launchctl for AppFresh.app
|
diff --git a/spec/active_record/turntable/active_record_ext/migration_spec.rb b/spec/active_record/turntable/active_record_ext/migration_spec.rb
index abc1234..def5678 100644
--- a/spec/active_record/turntable/active_record_ext/migration_spec.rb
+++ b/spec/active_record/turntable/active_record_ext/migration_spec.rb
@@ -15,7 +15,7 @@
context "With clusters definitions" do
let(:migration_class) {
- klass = Class.new(ActiveRecord::Migration) {
+ klass = Class.new(ActiveRecord::Migration[5.0]) {
clusters :user_cluster
}
}
@@ -27,7 +27,7 @@
context "With shards definitions" do
let(:migration_class) {
- klass = Class.new(ActiveRecord::Migration) {
+ klass = Class.new(ActiveRecord::Migration[5.0]) {
shards :user_shard_01
}
}
|
Add migration versioning numbers when creating `Migration` instances
|
diff --git a/lib/ditty/policies/user_policy.rb b/lib/ditty/policies/user_policy.rb
index abc1234..def5678 100644
--- a/lib/ditty/policies/user_policy.rb
+++ b/lib/ditty/policies/user_policy.rb
@@ -26,7 +26,7 @@ end
def delete?
- create? && user.super_admin? == false
+ create? && record&.super_admin? == false
end
def permitted_attributes
|
fix: Allow user deletion, but can't delete super users
|
diff --git a/lib/i18n/tasks/locale_pathname.rb b/lib/i18n/tasks/locale_pathname.rb
index abc1234..def5678 100644
--- a/lib/i18n/tasks/locale_pathname.rb
+++ b/lib/i18n/tasks/locale_pathname.rb
@@ -10,7 +10,7 @@ private
def path_locale_re(locale)
- (@path_locale_res ||= {})[locale] ||= %r{(?<=^|[/.])#{locale}(?=[/.])}
+ (@path_locale_res ||= {})[locale] ||= %r{(?<=^|[/.-])#{locale}(?=[/.])}
end
end
end
|
Allow dash in locale filenames when merging data
|
diff --git a/lib/vagrant-digitalocean/actions/shut_down.rb b/lib/vagrant-digitalocean/actions/shut_down.rb
index abc1234..def5678 100644
--- a/lib/vagrant-digitalocean/actions/shut_down.rb
+++ b/lib/vagrant-digitalocean/actions/shut_down.rb
@@ -15,11 +15,13 @@
def call(env)
# submit shutdown droplet request
- result = @client.request("/droplets/#{@machine.id}/shutdown")
+ result = @client.post("/v2/droplets/#{@machine.id}/actions", {
+ :type => 'shutdown'
+ })
# wait for request to complete
env[:ui].info I18n.t('vagrant_digital_ocean.info.shutting_down')
- @client.wait_for_event(env, result['event_id'])
+ @client.wait_for_event(env, result['action']['id'])
# refresh droplet state with provider
Provider.droplet(@machine, :refresh => true)
|
Update shutdown request to API v2
Resolves #215
|
diff --git a/lib/tasks/resynch_activities.rake b/lib/tasks/resynch_activities.rake
index abc1234..def5678 100644
--- a/lib/tasks/resynch_activities.rake
+++ b/lib/tasks/resynch_activities.rake
@@ -0,0 +1,14 @@+namespace :activities do
+ desc "update names of activity states"
+ task resync: :environment do
+ project = Project.find(ENV.fetch("PROJECT_ID"))
+ data_compound = project.project_anchor.data_compound_for(DateTime.now)
+
+ project.activities.flat_map(&:activity_states).each do |activity_state|
+ next unless activity_state.external_reference
+ de = data_compound.data_element(activity_state.external_reference)
+ next unless de
+ activity_state.update!(name: de.name)
+ end
+ end
+end
|
Allow resync of activity states based on data element name
|
diff --git a/sinatra-assetpack.gemspec b/sinatra-assetpack.gemspec
index abc1234..def5678 100644
--- a/sinatra-assetpack.gemspec
+++ b/sinatra-assetpack.gemspec
@@ -23,4 +23,5 @@ s.add_development_dependency "mocha"
s.add_development_dependency "stylus"
s.add_development_dependency "uglifier"
+ s.add_development_dependency "rake"
end
|
Add missing depedency for development unit test
|
diff --git a/lib/vidibus/user/warden/helper.rb b/lib/vidibus/user/warden/helper.rb
index abc1234..def5678 100644
--- a/lib/vidibus/user/warden/helper.rb
+++ b/lib/vidibus/user/warden/helper.rb
@@ -43,7 +43,7 @@
# Returns protocol depending on SERVER_PORT.
def protocol
- env['SERVER_PORT'] == 443 ? 'https://' : 'http://'
+ env['SERVER_PORT'].to_i == 443 ? 'https://' : 'http://'
end
def logger
|
Fix check of SERVER_PORT env variable
|
diff --git a/spec/models/booking_template_spec.rb b/spec/models/booking_template_spec.rb
index abc1234..def5678 100644
--- a/spec/models/booking_template_spec.rb
+++ b/spec/models/booking_template_spec.rb
@@ -8,10 +8,11 @@ end
it 'should call build_booking on the matching template' do
- expect {Booking_template}.to receive(:
- FactoryGirl.create(:booking_template)
- expect {BookingTemplate.build_booking(-booking_template.code)}
+ template = stub_model(BookingTemplate)
+ allow(BookingTemplate).to receive(:find_by_code).with('code').and_return(template)
+ expect(template).to receive(:build_booking).with({:test => 55})
+ BookingTemplate.build_booking 'code', {:test => 55}
+
end
end
end
|
Fix unfinished spec for BookingTemplate.build_booking.
|
diff --git a/spec/unit/plugins/aix/memory_spec.rb b/spec/unit/plugins/aix/memory_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/plugins/aix/memory_spec.rb
+++ b/spec/unit/plugins/aix/memory_spec.rb
@@ -0,0 +1,35 @@+#
+# License:: Apache License, Version 2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
+
+describe Ohai::System, "AIX memory plugin" do
+ before(:each) do
+ @plugin = get_plugin("aix/memory")
+ allow(@plugin).to receive(:collect_os).and_return(:aix)
+ allow(@plugin).to receive(:shell_out).with("svmon -G -O unit=MB,summary=longreal | grep '[0-9]'").and_return(mock_shell_out(0, " 513280.00 340034.17 173245.83 62535.17 230400.05 276950.14 70176.00\n", nil))
+ end
+
+ it "should get total memory" do
+ @plugin.run
+ expect(@plugin['memory']['total']).to eql("513280.00")
+ end
+
+ it "should get free memory" do
+ @plugin.run
+ expect(@plugin['memory']['free']).to eql("173245.83")
+ end
+end
|
Add unit test for aix memory plugin
|
diff --git a/OneTimePassword.podspec b/OneTimePassword.podspec
index abc1234..def5678 100644
--- a/OneTimePassword.podspec
+++ b/OneTimePassword.podspec
@@ -10,4 +10,14 @@ s.source_files = "OneTimePassword/**/*.{swift}"
s.requires_arc = true
s.dependency "Base32", "~> 1.0.2"
+ s.pod_target_xcconfig = {
+ "SWIFT_INCLUDE_PATHS[sdk=appletvos*]" => "$(SRCROOT)/OneTimePassword/CommonCrypto/appletvos",
+ "SWIFT_INCLUDE_PATHS[sdk=appletvsimulator*]" => "$(SRCROOT)/OneTimePassword/CommonCrypto/appletvsimulator",
+ "SWIFT_INCLUDE_PATHS[sdk=iphoneos*]" => "$(SRCROOT)/OneTimePassword/CommonCrypto/iphoneos",
+ "SWIFT_INCLUDE_PATHS[sdk=iphonesimulator*]" => "$(SRCROOT)/OneTimePassword/CommonCrypto/iphonesimulator",
+ "SWIFT_INCLUDE_PATHS[sdk=macosx*]" => "$(SRCROOT)/OneTimePassword/CommonCrypto/macosx",
+ "SWIFT_INCLUDE_PATHS[sdk=watchos*]" => "$(SRCROOT)/OneTimePassword/CommonCrypto/watchos",
+ "SWIFT_INCLUDE_PATHS[sdk=watchsimulator*]" => "$(SRCROOT)/OneTimePassword/CommonCrypto/watchsimulator",
+ }
+ s.preserve_paths = "CommonCrypto/*/**.modulemap"
end
|
Use CommonCrypto modulemaps with the pod
This blog post provided helpful instructions: https://ind.ie/labs/blog/using-system-headers-in-swift/
|
diff --git a/JSONModel.podspec b/JSONModel.podspec
index abc1234..def5678 100644
--- a/JSONModel.podspec
+++ b/JSONModel.podspec
@@ -1,6 +1,6 @@ Pod::Spec.new do |s|
s.name = "JSONModel"
- s.version = "1.2.3"
+ s.version = "1.2.4"
s.summary = "Magical Data Modelling Framework for JSON. Create rapidly powerful, atomic and smart data model classes."
s.homepage = "http://www.jsonmodel.com"
@@ -17,7 +17,7 @@ s.source_files = 'JSONModel/**/*.{m,h}'
s.public_header_files = 'JSONModel/**/*.h'
- s.dependency 'CocoaLumberjack', '~> 2.2'
+ s.dependency 'CocoaLumberjack/Default', '~> 3.0'
s.requires_arc = true
|
Update to 1.2.4, change Cocoalumberjack dependency to 3.0
|
diff --git a/rack-logs.gemspec b/rack-logs.gemspec
index abc1234..def5678 100644
--- a/rack-logs.gemspec
+++ b/rack-logs.gemspec
@@ -20,8 +20,17 @@
spec.add_runtime_dependency "rack", "~> 1.5.2"
+ if RUBY_VERSION.to_f < 1.9 || RUBY_VERSION == '1.9.2'
+ spec.add_development_dependency "rake", "~> 10.0.0"
+ elsif RUBY_VERSION.to_f < 2
+ spec.add_development_dependency "rake", "~> 11.0.0"
+ elsif RUBY_VERSION.to_f < 2.3
+ spec.add_development_dependency "rake", "~> 12.3.2"
+ else
+ spec.add_development_dependency "rake", "~> 13.0.0"
+ end
+
spec.add_development_dependency "bundler"
- spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rack-test"
spec.add_development_dependency "rspec", "~> 3.9.0"
end
|
Update rake to avoid CVE-2020-8130
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.