diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/lib/lumberjack/device.rb b/lib/lumberjack/device.rb
index abc1234..def5678 100644
--- a/lib/lumberjack/device.rb
+++ b/lib/lumberjack/device.rb
@@ -11,7 +11,7 @@
# Subclasses must implement this method to write a LogEntry.
def write(entry)
- raise NotImpelementedError
+ raise NotImplementedError
end
# Subclasses may implement this method to close the device.
|
Fix error class name typo
|
diff --git a/lib/biblio_commons/title.rb b/lib/biblio_commons/title.rb
index abc1234..def5678 100644
--- a/lib/biblio_commons/title.rb
+++ b/lib/biblio_commons/title.rb
@@ -29,9 +29,13 @@ titles["title"]
end
- # Returns the first UPC (if present) or ISBN.
+ # Returns the first UPC or ISBN.
def upc_or_isbn
- (upcs.present? ? upcs : isbns).first
+ if upcs
+ upcs.first
+ elsif isbns
+ isbns.first
+ end
end
def thumbnail_url
|
Fix bug where if neither UPC/ISBN present, exception was raised.
|
diff --git a/lib/ramesh/image_util.rb b/lib/ramesh/image_util.rb
index abc1234..def5678 100644
--- a/lib/ramesh/image_util.rb
+++ b/lib/ramesh/image_util.rb
@@ -14,8 +14,8 @@ begin
image_list = [
Image.from_blob(open(BACKGROUND_IMAGE_URL).read).shift,
- Image.from_blob(open(MAP_MASK_URL).read).shift,
- Image.from_blob(open(mesh_url).read).shift
+ Image.from_blob(open(mesh_url).read).shift,
+ Image.from_blob(open(MAP_MASK_URL).read).shift
]
moment_image = composite_images(image_list)
moment_image.write(filename)
@@ -25,9 +25,7 @@
def composite_images(image_list)
image = image_list.shift
-
- (1...image_list.length).each { |i| image = image.composite(image_list[i], 0, 0, OverCompositeOp) }
-
+ image_list.each { |layer| image = image.composite(layer, 0, 0, OverCompositeOp) }
image
end
end
|
Change the order of layers
|
diff --git a/spec/controllers/friendships_controller_spec.rb b/spec/controllers/friendships_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/friendships_controller_spec.rb
+++ b/spec/controllers/friendships_controller_spec.rb
@@ -24,5 +24,27 @@ end
describe "DELETE #destroy" do
+ let(:user) { FactoryGirl.create :user }
+ let(:user_two) { FactoryGirl.create :user }
+ it "deletes user_two as a friend of user" do
+ session[:user_id] = user.id
+ post :create, id: user_two.id
+ delete :destroy, id: user_two.id
+ expect(user.friends.last).to_not eq(user_two)
+ end
+
+ it "deletes user as a friend of user_two" do
+ session[:user_id] = user.id
+ post :create, id: user_two.id
+ delete :destroy, id: user_two.id
+ expect(user_two.friends.last).to_not eq(user)
+ end
+
+ it "redirects to the appropriate user's profile" do
+ session[:user_id] = user.id
+ post :create, id: user_two.id
+ delete :destroy, id: user_two.id
+ expect(response).to redirect_to(user_two)
+ end
end
end
|
Create tests for friendship deletion
|
diff --git a/spec/controllers/retirements_controller_spec.rb b/spec/controllers/retirements_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/retirements_controller_spec.rb
+++ b/spec/controllers/retirements_controller_spec.rb
@@ -1,4 +1,4 @@-RSpec.describe RetirementsController, type: :controller, features: [:rio] do
+RSpec.describe RetirementsController, type: :controller, features: [:pensions_and_retirement] do
describe '#index' do
it 'responds with success' do
get :index, locale: :en
|
Fix wrong feature flag in RetirementsController spec.
|
diff --git a/lib/sales_tax/receipt.rb b/lib/sales_tax/receipt.rb
index abc1234..def5678 100644
--- a/lib/sales_tax/receipt.rb
+++ b/lib/sales_tax/receipt.rb
@@ -1,9 +1,59 @@ module SalesTax
class Receipt
+ def initialize(args = {})
+ @items = args[:items] || []
+ end
+
def add_item(item)
+ items << item
end
def print
+ _print = ""
+ total = BigDecimal('0')
+ sales_taxes_total = BigDecimal('0')
+ items.each do |item|
+ h = item.to_hash
+ total += h[:total_unit_price]
+ sales_taxes_total += h[:unit_sales_tax]
+ _print << print_item(item)
+ end
+ _print << "\n"
+ _print << print_sales_taxes_total(sales_taxes_total)
+ _print << print_total(total)
+ _print
+ end
+
+ private
+
+ attr_accessor :items
+
+ def print_total(bd)
+ total = format_bd_to_price_string(bd)
+ "Total: #{total}\n"
+ end
+
+ def print_sales_taxes_total(bd)
+ total = format_bd_to_price_string(bd)
+ "Sales Taxes: #{total}\n"
+ end
+
+ def print_item(item)
+ print_item_from_hash(item.to_hash)
+ end
+
+ def print_item_from_hash(hash)
+ taxed_price_str = format_bd_to_price_string(hash[:total_unit_price])
+
+ "#{hash[:quantity]}, #{hash[:description]}, #{taxed_price_str}\n"
+ end
+
+ def format_bd_to_price_string(bd)
+ sprintf("%.2f", bd_to_float_str(bd))
+ end
+
+ def bd_to_float_str(bd)
+ bd.to_s('F')
end
end
end
|
Implement Receipt class, green specs
|
diff --git a/spec/features/signing_a_user_in_feature_spec.rb b/spec/features/signing_a_user_in_feature_spec.rb
index abc1234..def5678 100644
--- a/spec/features/signing_a_user_in_feature_spec.rb
+++ b/spec/features/signing_a_user_in_feature_spec.rb
@@ -0,0 +1,13 @@+require 'rails_helper'
+describe "the sign in process", :type => :feature do
+ background do
+ create(:user)
+ end
+
+ scenario 'signing in with valid credentials' do
+ visit '/login'
+ within 'form' do
+ fill_in 'Email'
+ end
+ end
+end
|
Add basic feature tests for user login; all tests pass
|
diff --git a/lib/embiggen/http_client.rb b/lib/embiggen/http_client.rb
index abc1234..def5678 100644
--- a/lib/embiggen/http_client.rb
+++ b/lib/embiggen/http_client.rb
@@ -2,7 +2,7 @@ require 'net/http'
module Embiggen
- class GetWithoutResponse < ::Net::HTTPRequest
+ class GetWithoutBody < ::Net::HTTPRequest
METHOD = 'GET'.freeze
REQUEST_HAS_BODY = false
RESPONSE_HAS_BODY = false
@@ -30,7 +30,7 @@ private
def request(timeout)
- request = GetWithoutResponse.new(uri.request_uri)
+ request = GetWithoutBody.new(uri.request_uri)
http.open_timeout = timeout
http.read_timeout = timeout
|
Use clearer class name in HTTP client
We create our own special HTTP request subclass in order to send a GET
request without reading the body but the class name misleadingly says it
is without response (which isn't true).
Rename the class to GetWithoutBody which hopefully makes this a little
clearer.
|
diff --git a/app/jobs/sendgrid_notification/sendmail_job.rb b/app/jobs/sendgrid_notification/sendmail_job.rb
index abc1234..def5678 100644
--- a/app/jobs/sendgrid_notification/sendmail_job.rb
+++ b/app/jobs/sendgrid_notification/sendmail_job.rb
@@ -9,7 +9,7 @@ def perform(to, notification_mail, params, hash_attachments = [])
mailer = MailerClass.new(params)
- obj_attachments = hash_attachments.map{|hash| SendgridNotification::Attachment.wrap(hash) }
+ obj_attachments = hash_attachments.map{|hash| SendgridNotification::Attachment.wrap(hash.symbolize_keys) }
mailer.sendmail(to, notification_mail, params, obj_attachments)
raise HTTPException, mailer.last_result.body unless mailer.last_result_success?
|
Fix attachment hash keys to symbolize
|
diff --git a/lib/terrestrial/error.rb b/lib/terrestrial/error.rb
index abc1234..def5678 100644
--- a/lib/terrestrial/error.rb
+++ b/lib/terrestrial/error.rb
@@ -1,3 +1,26 @@ module Terrestrial
Error = Module.new
+
+ class LoadError < RuntimeError
+ include Error
+
+ def initialize(relation_name, factory, record, original_error)
+ @relation_name = relation_name
+ @factory = factory
+ @record = record
+ @original_error = original_error
+ end
+
+ attr_reader :relation_name, :factory, :record, :original_error
+ private :relation_name, :factory, :record, :original_error
+
+ def message
+ [
+ "Error loading record from `#{relation_name}` relation `#{record.inspect}`.",
+ "Using: `#{factory.inspect}`.",
+ "Check that the factory is compatible.",
+ "Got Error: #{original_error.class.name} #{original_error.message}",
+ ].join("\n")
+ end
+ end
end
|
Introduce LoadError, mixing in Terrestrial::Error
|
diff --git a/lib/global_phone/context.rb b/lib/global_phone/context.rb
index abc1234..def5678 100644
--- a/lib/global_phone/context.rb
+++ b/lib/global_phone/context.rb
@@ -30,7 +30,7 @@
def validate(string, territory_name = default_territory_name)
number = parse(string, territory_name)
- number && number.valid?
+ number && number.valid? ? true : false
end
end
end
|
Return false if the number passed to GlobalPhone.validate is invalid. Currently the code returns either true or nil
|
diff --git a/api-docs/uceem_api.rb b/api-docs/uceem_api.rb
index abc1234..def5678 100644
--- a/api-docs/uceem_api.rb
+++ b/api-docs/uceem_api.rb
@@ -48,4 +48,9 @@
get '/activities' do
markdown(:activities)
-end+end
+
+get '/all.css' do
+ content_type 'text/css', charset: 'utf-8'
+ scss(:'../public/scss/all')
+end
|
Create route for scss assets.
|
diff --git a/sidekiq/3-signal-handling/worker.rb b/sidekiq/3-signal-handling/worker.rb
index abc1234..def5678 100644
--- a/sidekiq/3-signal-handling/worker.rb
+++ b/sidekiq/3-signal-handling/worker.rb
@@ -13,6 +13,10 @@ sleep 10
puts "Bear with me"
else
+ while true do
+ sleep 1
+ puts "Endless loop"
+ end
sleep 1
puts "Easy peazy"
end
|
Add infinite loop to test Signals
|
diff --git a/lib/avalon/sanitizer.rb b/lib/avalon/sanitizer.rb
index abc1234..def5678 100644
--- a/lib/avalon/sanitizer.rb
+++ b/lib/avalon/sanitizer.rb
@@ -14,7 +14,7 @@
module Avalon
module Sanitizer
- def self.sanitize(name, translations=['\\/ &:.','______'])
+ def self.sanitize(name, translations=['\\/ &:.?','_______'])
name.tr *translations
end
end
|
Convert ?s in collection dropbox name
|
diff --git a/lib/active_node/validations/uniqueness_validator.rb b/lib/active_node/validations/uniqueness_validator.rb
index abc1234..def5678 100644
--- a/lib/active_node/validations/uniqueness_validator.rb
+++ b/lib/active_node/validations/uniqueness_validator.rb
@@ -10,10 +10,11 @@ private
def other_matching_records(record, attribute, value)
+ record_class = record.class
if record.persisted?
- record.class.find_by_cypher("Match (n:#{record.class.label}) where n.#{attribute} = {value} and n.id <> {id} return n", value: value, id: record.id)
+ record_class.find_by_cypher "Match (n:#{record_class.label}) where n.#{attribute} = {value} and id(n) <> {id} return n", value: value, id: record.id
else
- record.class.find_by_cypher("Match (n:#{record.class.label}) where n.#{attribute} = {value} return n", value: value)
+ record_class.find_by_cypher "Match (n:#{record_class.label}) where n.#{attribute} = {value} return n", value: value
end
end
end
|
Update uniqieness lookup by id to use neo4j's id(n)
|
diff --git a/lib/openlogi/base_object.rb b/lib/openlogi/base_object.rb
index abc1234..def5678 100644
--- a/lib/openlogi/base_object.rb
+++ b/lib/openlogi/base_object.rb
@@ -1,6 +1,9 @@+require "openlogi/errors"
+
module Openlogi
class BaseObject < Hashie::Dash
include Hashie::Extensions::Dash::Coercion
+ include Hashie::Extensions::MergeInitializer
include Hashie::Extensions::IndifferentAccess
def initialize(attributes = {}, &block)
|
Include Hashie::Extensions::MergeInitializer in base object
|
diff --git a/adash.gemspec b/adash.gemspec
index abc1234..def5678 100644
--- a/adash.gemspec
+++ b/adash.gemspec
@@ -9,8 +9,8 @@ spec.authors = ["Code Ass"]
spec.email = ["aycabta@gmail.com"]
- spec.summary = %q{Adash}
- spec.description = %q{Adash}
+ spec.summary = %q{Adash is a Dash Replenishment Service CLI client}
+ spec.description = %Q{Adash is a Dash Replenishment Service CLI client.\nYou will login with OAuth (Login with Amazon) and replenish items.}
spec.homepage = "https://github.com/aycabta/adash"
spec.license = "MIT"
|
Fix .spec summary and description
|
diff --git a/lib/rspec/rails/example/controller_example_group.rb b/lib/rspec/rails/example/controller_example_group.rb
index abc1234..def5678 100644
--- a/lib/rspec/rails/example/controller_example_group.rb
+++ b/lib/rspec/rails/example/controller_example_group.rb
@@ -20,6 +20,10 @@ def params_from(method, path)
ActionController::Routing::Routes.reload if ActionController::Routing::Routes.empty?
ActionController::Routing::Routes.recognize_path(path, :method => method)
+ end
+
+ def set_raw_post_data(body)
+ request.env['RAW_POST_DATA']=body
end
# @private
@@ -46,6 +50,10 @@ @controller.send(:initialize_current_url)
end
end
+
+ after(:each) do
+ request.env.delete('RAW_POST_DATA')
+ end
end
end
end
|
Add helper for setting a raw post body
|
diff --git a/lib/scss_lint/linter/id_with_extraneous_selector.rb b/lib/scss_lint/linter/id_with_extraneous_selector.rb
index abc1234..def5678 100644
--- a/lib/scss_lint/linter/id_with_extraneous_selector.rb
+++ b/lib/scss_lint/linter/id_with_extraneous_selector.rb
@@ -7,7 +7,12 @@ id_sel = seq.members.find { |simple| simple.is_a?(Sass::Selector::Id) }
return unless id_sel
- if seq.members.any? { |simple| !simple.is_a?(Sass::Selector::Id) && !simple.is_a?(Sass::Selector::Pseudo) }
+ can_be_simplified = seq.members.any? do |simple|
+ !simple.is_a?(Sass::Selector::Id) &&
+ !simple.is_a?(Sass::Selector::Pseudo)
+ end
+
+ if can_be_simplified
add_lint(seq, "Selector `#{seq}` can be simplified to `#{id_sel}`, " <<
'since IDs should be uniquely identifying')
end
|
Fix Rubocop lints in IdWithExtraneousSelector
Change-Id: Ib06958a78c715c01349fa38db793565fdfa771d9
Reviewed-on: http://gerrit.causes.com/36710
Tested-by: jenkins <d95b56ce41a2e1ac4cecdd398defd7414407cc08@causes.com>
Reviewed-by: Shane da Silva <6f6e68d1df92f30cb4b3ce35260ddf94a402f33d@causes.com>
|
diff --git a/app/controllers/rglossa/corpora_controller.rb b/app/controllers/rglossa/corpora_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/rglossa/corpora_controller.rb
+++ b/app/controllers/rglossa/corpora_controller.rb
@@ -28,11 +28,8 @@ render json: {
corpus: @corpus.as_json(
only: [:id, :name, :logo, :short_name, :search_engine],
- methods: [:metadata_category_ids, :langs, :display_attrs, :extra_line_attrs,
- :parts, :has_sound]
- ),
- metadata_categories: @metadata_categories.as_json(
- only: [:id, :name, :logo, :short_name, :search_engine]
+ methods: [:langs, :display_attrs, :extra_line_attrs,
+ :parts, :has_sound, :metadata_categories]
)
}
end
|
Return metadata embedded when loading a particular corpus
|
diff --git a/test/standard_api/controller/create_test.rb b/test/standard_api/controller/create_test.rb
index abc1234..def5678 100644
--- a/test/standard_api/controller/create_test.rb
+++ b/test/standard_api/controller/create_test.rb
@@ -0,0 +1,27 @@+require 'standard_api/test_helper'
+
+class PropertiesControllerTest < ActionDispatch::IntegrationTest
+
+ # = Include Test
+
+ class Property < ActiveRecord::Base
+ has_many :accounts
+ end
+
+ test "Controller#create with an invalid include" do
+ property = build(:property)
+
+ assert_no_difference 'Property.count' do
+ post "/properties", params: { property: property.attributes, include: [:accounts] }, as: :json
+ end
+
+ assert_response :bad_request
+ end
+
+ test "Controller#update with an invalid include"
+ test "Controller#destroy with an invalid include"
+ test "Controller#create_resource with an invalid include"
+ test "Controller#add_resource with an invalid include"
+ test "Controller#remove_resource with an invalid include"
+
+end
|
Add test for creating/updating with an invalid includes
|
diff --git a/spec/features/show_bounties_spec.rb b/spec/features/show_bounties_spec.rb
index abc1234..def5678 100644
--- a/spec/features/show_bounties_spec.rb
+++ b/spec/features/show_bounties_spec.rb
@@ -0,0 +1,29 @@+require 'spec_helper'
+
+describe 'showing all bounties' do
+ let!(:user) { User.make! }
+ let!(:product) { Product.make! }
+ let!(:chat_room) { ChatRoom.make!(slug: product.slug, product: product) }
+
+ before { login_as(user, scope: :user) }
+
+ it 'shows all bounties for a given product', js: true do
+ Task.make!(title: 'Design a new logo', product: product)
+ Task.make!(title: 'Add some tests', product: product)
+
+ visit product_wips_path(product)
+
+ expect(page).to have_text('Design a new logo')
+ expect(page).to have_text('Add some tests')
+ end
+
+ it 'shows all bounties in a specific state', js: true do
+ Task.make!(title: 'Design a new logo', product: product)
+ Task.make!(title: 'Add some tests', product: product, closed_at: 1.hour.ago)
+
+ visit product_wips_path(product)
+
+ expect(page).to have_text('Design a new logo')
+ expect(page).to_not have_text('Add some tests')
+ end
+end
|
Check to make sure bounties are filtered correctly
|
diff --git a/refinerycms-multisites.gemspec b/refinerycms-multisites.gemspec
index abc1234..def5678 100644
--- a/refinerycms-multisites.gemspec
+++ b/refinerycms-multisites.gemspec
@@ -4,9 +4,9 @@ s.platform = Gem::Platform::RUBY
s.name = 'refinerycms-multisites'
s.version = '1.0'
- s.description = %q{Apartment based authentication extension for Refinery CMS}
+ s.description = %q{Apartment based multisites extension for Refinery CMS}
s.date = '2015-11-14'
- s.summary = %q{An Apartment based authentication extension for Refinery CMS}
+ s.summary = %q{An Apartment based multisites extension for Refinery CMS}
s.homepage = %q{http://www.brice-sanchez.com}
s.authors = ['Brice Sanchez']
s.license = %q{MIT}
|
Fix gemspec desc and sum
|
diff --git a/spec/lita/handlers/hal_9000_spec.rb b/spec/lita/handlers/hal_9000_spec.rb
index abc1234..def5678 100644
--- a/spec/lita/handlers/hal_9000_spec.rb
+++ b/spec/lita/handlers/hal_9000_spec.rb
@@ -2,4 +2,10 @@
describe Lita::Handlers::Hal9000, lita_handler: true do
it { is_expected.to route_event(:unhandled_message) }
+
+ it 'does HAL message if unknown command' do
+ send_command('unknown-command')
+ expect(replies.last).to eq(
+ "I'm sorry, I can't do that @Test User http://bit.ly/11wwIP2")
+ end
end
|
Add test for sending unknown command
|
diff --git a/spec/models/email_processor_spec.rb b/spec/models/email_processor_spec.rb
index abc1234..def5678 100644
--- a/spec/models/email_processor_spec.rb
+++ b/spec/models/email_processor_spec.rb
@@ -12,7 +12,7 @@ it "creates an entry even if the email address is uppercase" do
user = create(:user)
email = double(
- 'email',
+ "email",
from: { email: user.email.upcase },
body: "I am great"
)
|
Use double quotes for @houndci
|
diff --git a/spec/models/lab_description_spec.rb b/spec/models/lab_description_spec.rb
index abc1234..def5678 100644
--- a/spec/models/lab_description_spec.rb
+++ b/spec/models/lab_description_spec.rb
@@ -1,9 +1,29 @@ describe LabDescription do
- it "defaults to true" do
- create(:lab_description).should be_valid
+ describe "validations" do
+ it "defaults to valid" do
+ create(:lab_description).should be_valid
+ end
+
+ it "must have a valid commit hash" do
+ build(:lab_description, commit_hash: "not valid").should_not be_valid
+ end
+
+ it "must have title with length >= 2" do
+ build(:lab_description, title: "a").should_not be_valid
+ end
+
+ it "must have description with length > 5" do
+ build(:lab_description, description: "abcd").should_not be_valid
+ end
+
+ it "must have a 'when' relation" do
+ build(:lab_description, when: nil).should_not be_valid
+ end
end
- it "should have a 'when'" do
- create(:lab_description).when.should_not be_nil
+ describe "realtions" do
+ it "should have a 'when'" do
+ create(:lab_description).when.should_not be_nil
+ end
end
end
|
Create basic specs for LabDescription, all validations passes
|
diff --git a/rack-allocation_stats.gemspec b/rack-allocation_stats.gemspec
index abc1234..def5678 100644
--- a/rack-allocation_stats.gemspec
+++ b/rack-allocation_stats.gemspec
@@ -10,8 +10,7 @@ spec.summary = "Rack middleware for tracing object allocations in Ruby 2.1"
spec.description = "Rack middleware for tracing object allocations in Ruby 2.1"
- #spec.files = `git ls-files`.split("\n")
- spec.files = `find . -path "*.rb"`.split("\n")
+ spec.files = Dir.glob('{lib,spec}/**/*') + %w[LICENSE README.markdown TODO.markdown]
spec.require_paths = ["lib"]
spec.add_dependency "allocation_stats"
|
Include non-Ruby files in gem package
The interactive mode was not working because the gem package did not
contain the non-Ruby files needed to run it. This commit opens up the
file inclusion to anything under lib and spec.
|
diff --git a/lita-github-commits.gemspec b/lita-github-commits.gemspec
index abc1234..def5678 100644
--- a/lita-github-commits.gemspec
+++ b/lita-github-commits.gemspec
@@ -1,6 +1,6 @@ Gem::Specification.new do |spec|
spec.name = "lita-github-commits"
- spec.version = "0.0.1"
+ spec.version = "0.0.2"
spec.authors = ["Mitch Dempsey"]
spec.email = ["mrdempsey@gmail.com"]
spec.description = %q{A Lita handler that will display GitHub commit messages in the channel}
@@ -13,11 +13,13 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
- spec.add_runtime_dependency "lita", "~> 2.3"
+ spec.add_runtime_dependency "lita", ">= 2.3"
spec.add_development_dependency "bundler", "~> 1.3"
spec.add_development_dependency "rake"
- spec.add_development_dependency "rspec", ">= 2.14"
+ spec.add_development_dependency "rspec", ">= 3.0.0.beta2"
spec.add_development_dependency "simplecov"
spec.add_development_dependency "coveralls"
+
+ spec.metadata = { "lita_plugin_type" => "handler" }
end
|
Update gemspec for Lita 3.0 compatibility.
|
diff --git a/lib/bootstrap-sass.rb b/lib/bootstrap-sass.rb
index abc1234..def5678 100644
--- a/lib/bootstrap-sass.rb
+++ b/lib/bootstrap-sass.rb
@@ -7,8 +7,7 @@ require 'sass-rails' # See: https://github.com/thomas-mcdonald/bootstrap-sass/pull/4
require 'bootstrap-sass/engine'
require 'bootstrap-sass/config/sass_extentions'
- end
- if compass?
+ elsif compass?
require 'bootstrap-sass/compass_extensions'
require 'bootstrap-sass/config/sass_extentions'
base = File.join(File.dirname(__FILE__), '..')
|
Revert "support for rails w/compass"
This reverts commit 0cea6384c87fc88ba3503999ed808f3f833c7b43.
I had not considered the side effect of loading all the compass setup,
since this will mean that Rails' asset-url is overridden, or some side
effect will come about as a result.
|
diff --git a/.delivery/build_cookbook/recipes/_install_docker.rb b/.delivery/build_cookbook/recipes/_install_docker.rb
index abc1234..def5678 100644
--- a/.delivery/build_cookbook/recipes/_install_docker.rb
+++ b/.delivery/build_cookbook/recipes/_install_docker.rb
@@ -5,14 +5,14 @@
package "docker-engine"
-execute 'install docker-compose' do
- command <<-EOH
-curl -L https://github.com/docker/compose/releases/download/1.8.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
-chmod +x /usr/local/bin/docker-compose
-EOH
+remote_file '/usr/local/bin/docker-compose' do
+ source 'https://github.com/docker/compose/releases/download/1.8.0/docker-compose-Linux-x86_64'
+ checksum 'ebc6ab9ed9c971af7efec074cff7752593559496d0d5f7afb6bfd0e0310961ff'
+ owner 'root'
+ group 'docker'
+ mode '0755'
end
# Ensure the `dbuild` user is part of the `docker` group so they can
# connect to the Docker daemon
execute "usermod -aG docker #{node['delivery_builder']['build_user']}"
-
|
Use remote_file instead of execute-n-curl
Check that the docker-compose we download is the one we expect with
a checksum.
Also don't need to uname things because we only use 64-bit Linux
builders for this pipeline.
Signed-off-by: Robb Kidd <11cd4f9ba93acb67080ee4dad8d03929f9e64bf2@chef.io>
|
diff --git a/app/views/api/v1/divisions/show.json.jbuilder b/app/views/api/v1/divisions/show.json.jbuilder
index abc1234..def5678 100644
--- a/app/views/api/v1/divisions/show.json.jbuilder
+++ b/app/views/api/v1/divisions/show.json.jbuilder
@@ -7,7 +7,7 @@ json.possible_turnout @division.division_info.possible_turnout
# Extra information that isn't in the summary
-json.motion @division.motion
+json.summary @division.motion
json.markdown @division.markdown?
json.votes do
json.array! @division.votes.order(:vote) do |vote|
|
Use summary rather than motion text in api
|
diff --git a/backend/lib/tasks/rubocop_brakeman_rspec.rake b/backend/lib/tasks/rubocop_brakeman_rspec.rake
index abc1234..def5678 100644
--- a/backend/lib/tasks/rubocop_brakeman_rspec.rake
+++ b/backend/lib/tasks/rubocop_brakeman_rspec.rake
@@ -0,0 +1,55 @@+require 'rubocop/rake_task'
+require 'rspec/core/rake_task'
+
+namespace :test do
+ desc 'Run RuboCop'
+ RuboCop::RakeTask.new(:rubocop) do |task|
+ # Make it easier to disable cops.
+ task.options << "--display-cop-names"
+
+ # Abort on failures (fix your code first)
+ task.fail_on_error = false
+ end
+
+ desc 'Run test'
+ RSpec::Core::RakeTask.new(:rspec) do |rspec|
+ rspec.rspec_opts = "--color --format documentation"
+ end
+
+ desc 'Runs Brakeman'
+ # based on https://brakemanscanner.org/docs/rake/
+ task :brakeman, :output_files do |_task, args|
+ # To abort on failures, set to true.
+ EXIT_ON_FAIL = false
+
+ require 'brakeman'
+
+ files = args[:output_files].split(' ') if args[:output_files]
+
+ # For more options, see source here:
+ # https://github.com/presidentbeef/brakeman/blob/master/lib/brakeman.rb#L30
+ options = {
+ app_path: ".",
+ exit_on_error: EXIT_ON_FAIL,
+ exit_on_warn: EXIT_ON_FAIL,
+ output_files: files,
+ print_report: true,
+ pager: false,
+ summary_only: true
+ }
+
+ tracker = Brakeman.run options
+ failures = tracker.filtered_warnings + tracker.errors
+
+ # Based on code here:
+ # https://github.com/presidentbeef/brakeman/blob/f2376c/lib/brakeman/commandline.rb#L120
+ if EXIT_ON_FAIL && failures.any?
+ puts 'Brakeman violations found. Aborting now...'
+ exit Brakeman::Warnings_Found_Exit_Code unless tracker.filtered_warnings.empty?
+ exit Brakeman::Errors_Found_Exit_Code if tracker.errors.any?
+ end
+ end
+end
+
+Rake::Task[:test].enhance ['test:rubocop', 'test:rspec', 'test:brakeman']
+
|
Write rubocop rspec and test rakefile
|
diff --git a/cookbooks/chef/attributes/default.rb b/cookbooks/chef/attributes/default.rb
index abc1234..def5678 100644
--- a/cookbooks/chef/attributes/default.rb
+++ b/cookbooks/chef/attributes/default.rb
@@ -2,7 +2,7 @@ default[:apt][:sources] = node[:apt][:sources] | [ "opscode" ]
# Set the default client version
-default[:chef][:client][:version] = "11.6.0-1"
+default[:chef][:client][:version] = "11.8.0-1"
# A list of gems needed by chef recipes
default[:chef][:gems] = []
|
Upgrade chef client to 11.8.0
|
diff --git a/lib/resqued/daemon.rb b/lib/resqued/daemon.rb
index abc1234..def5678 100644
--- a/lib/resqued/daemon.rb
+++ b/lib/resqued/daemon.rb
@@ -23,6 +23,7 @@ exit
else
# master
+ rd.close
@master.run(wr)
end
end
|
Clean up a leaky pipe.
|
diff --git a/lib/right_on/rails.rb b/lib/right_on/rails.rb
index abc1234..def5678 100644
--- a/lib/right_on/rails.rb
+++ b/lib/right_on/rails.rb
@@ -1,7 +1,12 @@ require 'right_on/role_model'
+require 'right_on/ability'
+require 'right_on/rule'
+require 'right_on/error'
require 'right_on/right'
require 'right_on/role'
require 'right_on/right_allowed'
require 'right_on/by_group'
require 'right_on/action_controller_extensions'
+require 'cancan/exceptions'
+require 'right_on/controller_additions'
require 'right_on/permission_denied_response'
|
Fix requires to get everything working
|
diff --git a/app/presenters/finders/finder_rummager_presenter.rb b/app/presenters/finders/finder_rummager_presenter.rb
index abc1234..def5678 100644
--- a/app/presenters/finders/finder_rummager_presenter.rb
+++ b/app/presenters/finders/finder_rummager_presenter.rb
@@ -9,12 +9,12 @@
def to_json
{
- title: file.fetch("name"),
description: file.fetch("description", ""),
+ format: "finder",
link: file.fetch("base_path"),
- format: "finder",
public_timestamp: timestamp,
specialist_sectors: file.fetch("topics", []),
+ title: file.fetch("name"),
}
end
end
|
Sort keys in rummager payload
|
diff --git a/lib/MrMurano/version.rb b/lib/MrMurano/version.rb
index abc1234..def5678 100644
--- a/lib/MrMurano/version.rb
+++ b/lib/MrMurano/version.rb
@@ -1,4 +1,13 @@+# Last Modified: 2017.07.01 /coding: utf-8
+# frozen_string_literal: true
+
+# Copyright © 2016-2017 Exosite LLC.
+# License: MIT. See LICENSE.txt.
+# vim:tw=0:ts=2:sw=2:et:ai
+
module MrMurano
- VERSION = '3.0.0.beta.3'.freeze
+ VERSION = '3.0.0.beta.3'
+ EXE_NAME = File.basename($PROGRAM_NAME)
+ SIGN_UP_URL = 'https://exosite.com/signup/'
end
|
Add EXE_NAME and SIGN_UP_URL to MrMurano module.
- Also add copyright and license header.
- Rubocop: Add `# frozen_string_literal: true` header comment.
- Rubocop: Do not `.freeze` immutable object.
|
diff --git a/lib/caching/response.rb b/lib/caching/response.rb
index abc1234..def5678 100644
--- a/lib/caching/response.rb
+++ b/lib/caching/response.rb
@@ -16,10 +16,14 @@ end
def ttl
- cache_control[/max-age=([0-9]+)/, 1] || 0 if cache_control == 'no-cache'
+ max_age.to_i
end
private
+
+ def max_age
+ cache_control[/max-age=([0-9]+)/, 1] || 0
+ end
def cache_control
headers[:cache_control] || ''
|
Refactor and correct ttl for when max-age is defined
|
diff --git a/lib/cassandra/pooled.rb b/lib/cassandra/pooled.rb
index abc1234..def5678 100644
--- a/lib/cassandra/pooled.rb
+++ b/lib/cassandra/pooled.rb
@@ -18,8 +18,7 @@ client.disconnect! if client
end
- # Method not supported (yet?):
- # :login!, :keyspace=,
+ preparation_methods :login!, :disable_node_auto_discovery!
connection_methods :keyspace, :keyspaces, :servers, :schema,
:auth_request, :thrift_client_options, :thrift_client_class,
|
Add preparation methods to Cassandra
|
diff --git a/test/unit/observers/update_router_observer_test.rb b/test/unit/observers/update_router_observer_test.rb
index abc1234..def5678 100644
--- a/test/unit/observers/update_router_observer_test.rb
+++ b/test/unit/observers/update_router_observer_test.rb
@@ -0,0 +1,35 @@+require_relative '../../test_helper'
+
+class UpdateRouterObserverTest < ActiveSupport::TestCase
+ setup do
+ stub_all_router_api_requests
+ stub_all_rummager_requests
+ end
+
+ should 'not register a draft artefact with the router' do
+ RoutableArtefact.expects(:new).never
+
+ artefact = build(:draft_artefact)
+ assert artefact.save
+ end
+
+ should 'submit a live artefact into the router' do
+ mock_routable_artefact = mock("RoutableArtefact")
+ RoutableArtefact.stubs(:new).returns(mock_routable_artefact)
+
+ mock_routable_artefact.expects(:submit)
+
+ artefact = build(:live_artefact)
+ assert artefact.save
+ end
+
+ should 'delete an archived artefact from the router' do
+ mock_routable_artefact = mock("RoutableArtefact")
+ RoutableArtefact.stubs(:new).returns(mock_routable_artefact)
+
+ mock_routable_artefact.expects(:delete)
+
+ artefact = build(:archived_artefact)
+ assert artefact.save
+ end
+end
|
Add test coverage for existing observer behaviour
The existing UpdateRouterObserver didn't have any unit tests. I've
written some retrospectively so that it will be easier to change its
behaviour.
|
diff --git a/wateringServer/spec/routing/plants_routing_spec.rb b/wateringServer/spec/routing/plants_routing_spec.rb
index abc1234..def5678 100644
--- a/wateringServer/spec/routing/plants_routing_spec.rb
+++ b/wateringServer/spec/routing/plants_routing_spec.rb
@@ -1,15 +1,35 @@ require 'rails_helper'
describe PlantsController do
- it 'routes GET /plants/new' do
- expect(get: '/plants/new').to route_to('plants#new')
+ it 'does not route GET /plants' do
+ expect(get: '/plants').not_to route_to('plants#index')
end
it 'routes POST /plants' do
expect(post: '/plants').to route_to('plants#create')
end
+ it 'routes GET /plants/new' do
+ expect(get: '/plants/new').to route_to('plants#new')
+ end
+
+ it 'does not route GET /plants/id/edit' do
+ expect(get: 'plants/1/edit').not_to route_to('plants#edit', id: '1')
+ end
+
it 'routes GET /plants/id' do
- expect(get: "/plants/1").to route_to("plants#show", id: "1")
+ expect(get: '/plants/1').to route_to('plants#show', id: '1')
+ end
+
+ it 'does not route PATCH /plants/id' do
+ expect(patch: '/plants/1').not_to route_to('plants#update', id: '1')
+ end
+
+ it 'does not route PUT /plants/id' do
+ expect(put: '/plants/1').not_to route_to('plants#update', id: '1')
+ end
+
+ it 'does not route DELETE /plants/id' do
+ expect(delete: '/plants/1').not_to route_to('plants#destroy', id: '1')
end
end
|
Add unroutable tests for plants
|
diff --git a/spec/controllers/miq_report_controller/dashboards_spec.rb b/spec/controllers/miq_report_controller/dashboards_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/miq_report_controller/dashboards_spec.rb
+++ b/spec/controllers/miq_report_controller/dashboards_spec.rb
@@ -1,25 +1,23 @@ describe ReportController do
context "::Dashboards" do
+ let(:miq_widget_set) { FactoryGirl.create(:miq_widget_set, :owner => user.current_group, :set_data => {:col1 => [], :col2 => [], :col3 => []}) }
+ let(:user) { FactoryGirl.create(:user, :features => "db_edit") }
+
before do
login_as user
- @db = FactoryGirl.create(:miq_widget_set,
- :owner => user.current_group,
- :set_data => {:col1 => [], :col2 => [], :col3 => []})
end
context "#db_edit" do
- let(:user) { FactoryGirl.create(:user, :features => "db_edit") }
-
it "dashboard owner remains unchanged" do
allow(controller).to receive(:db_fields_validation)
allow(controller).to receive(:replace_right_cell)
- owner = @db.owner
+ owner = miq_widget_set.owner
new_hash = {:name => "New Name", :description => "New Description", :col1 => [1], :col2 => [], :col3 => []}
current = {:name => "New Name", :description => "New Description", :col1 => [], :col2 => [], :col3 => []}
- controller.instance_variable_set(:@edit, :new => new_hash, :db_id => @db.id, :current => current)
- controller.instance_variable_set(:@_params, :id => @db.id, :button => "save")
+ controller.instance_variable_set(:@edit, :new => new_hash, :db_id => miq_widget_set.id, :current => current)
+ controller.instance_variable_set(:@_params, :id => miq_widget_set.id, :button => "save")
controller.db_edit
- expect(@db.owner.id).to eq(owner.id)
+ expect(miq_widget_set.owner.id).to eq(owner.id)
expect(assigns(:flash_array).first[:message]).to include("saved")
expect(controller.send(:flash_errors?)).not_to be_truthy
end
|
Use let and adapt name in dashboard spec
|
diff --git a/spec/controllers/workers/index_filters_controller_spec.rb b/spec/controllers/workers/index_filters_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/workers/index_filters_controller_spec.rb
+++ b/spec/controllers/workers/index_filters_controller_spec.rb
@@ -0,0 +1,59 @@+require 'rails_helper'
+
+module RocketJobMissionControl
+ module Workers
+ RSpec.describe IndexFiltersController do
+ routes { Engine.routes }
+
+ states = %w(starting running paused stopping)
+
+ states.each_with_index do |state, i|
+ describe "GET ##{state}" do
+ describe "with no #{state} workers" do
+ before do
+ get state.to_sym
+ end
+
+ it "succeeds" do
+ expect(response.status).to be(200)
+ end
+
+ it 'renders template' do
+ expect(response).to render_template(state)
+ end
+
+ it "returns no jobs" do
+ expect(assigns(:workers).count).to eq(0)
+ end
+ end
+
+ describe "with #{state} workers" do
+ let(:not_state) { states[i-1] }
+ let!(:state_dirmon) { RocketJob::Worker.create!(state: state) }
+
+ before do
+ RocketJob::Worker.create!(state: not_state)
+ get state.to_sym
+ end
+
+ after do
+ DatabaseCleaner.clean
+ end
+
+ it "succeeds" do
+ expect(response.status).to be(200)
+ end
+
+ it 'renders template' do
+ expect(response).to render_template(state)
+ end
+
+ it "grabs a filtered list of workers" do
+ expect(assigns(:workers)).to match_array([state_dirmon])
+ end
+ end
+ end
+ end
+ end
+ end
+end
|
Add workers index filters controller test.
|
diff --git a/lib/dm-mongo-adapter.rb b/lib/dm-mongo-adapter.rb
index abc1234..def5678 100644
--- a/lib/dm-mongo-adapter.rb
+++ b/lib/dm-mongo-adapter.rb
@@ -3,27 +3,25 @@ require 'dm-core'
require 'dm-aggregates'
-dir = Pathname(__FILE__).dirname.expand_path + 'dm-mongo-adapter'
+require 'dm-mongo-adapter/query'
+require 'dm-mongo-adapter/query/java_script'
-require dir + 'query'
-require dir + 'query' + 'java_script'
+require 'dm-mongo-adapter/property/bson_object_id'
+require 'dm-mongo-adapter/property/foreign_object_id'
+require 'dm-mongo-adapter/property/object_id'
+require 'dm-mongo-adapter/property/array'
+require 'dm-mongo-adapter/property/hash'
-require dir + 'property' + 'bson_object_id'
-require dir + 'property' + 'foreign_object_id'
-require dir + 'property' + 'object_id'
-require dir + 'property' + 'array'
-require dir + 'property' + 'hash'
+require 'dm-mongo-adapter/support/class'
+require 'dm-mongo-adapter/support/date'
+require 'dm-mongo-adapter/support/date_time'
+require 'dm-mongo-adapter/support/object'
-require dir + 'support' + 'class'
-require dir + 'support' + 'date'
-require dir + 'support' + 'date_time'
-require dir + 'support' + 'object'
+require 'dm-mongo-adapter/migrations'
+require 'dm-mongo-adapter/model'
+require 'dm-mongo-adapter/resource'
+require 'dm-mongo-adapter/migrations'
+require 'dm-mongo-adapter/modifier'
-require dir + 'migrations'
-require dir + 'model'
-require dir + 'resource'
-require dir + 'migrations'
-require dir + 'modifier'
-
-require dir + 'aggregates'
-require dir + 'adapter'
+require 'dm-mongo-adapter/aggregates'
+require 'dm-mongo-adapter/adapter'
|
Change requires from absolute to relative paths
|
diff --git a/dmarc_inspector.gemspec b/dmarc_inspector.gemspec
index abc1234..def5678 100644
--- a/dmarc_inspector.gemspec
+++ b/dmarc_inspector.gemspec
@@ -19,5 +19,8 @@ spec.add_dependency 'parslet', '~> 1.6'
spec.add_development_dependency "bundler", "~> 1.7"
+ spec.add_development_dependency 'rspec-core', '~> 3.0'
+ spec.add_development_dependency 'rspec-expectations', '~> 3.0'
+ spec.add_development_dependency 'rspec-mocks', '~> 3.0'
spec.add_development_dependency "rake", "~> 10.0"
end
|
Add rspec-core, rspec-expectations, rspec-mock as dev dependencies
|
diff --git a/lib/interactor/hooks.rb b/lib/interactor/hooks.rb
index abc1234..def5678 100644
--- a/lib/interactor/hooks.rb
+++ b/lib/interactor/hooks.rb
@@ -47,7 +47,7 @@ end
def call_hook(hook)
- hook.is_a?(Symbol) ? method(hook).call : instance_eval(&hook)
+ hook.is_a?(Symbol) ? send(hook) : instance_eval(&hook)
end
end
end
|
Refactor hook execution for symbols
|
diff --git a/app/models/request.rb b/app/models/request.rb
index abc1234..def5678 100644
--- a/app/models/request.rb
+++ b/app/models/request.rb
@@ -16,14 +16,6 @@ true
end
- def other_party
- if current_user == requester
- responder
- elsif current_user == responder
- requester
- end
- end
-
private
def defaultly_unfulfilled
|
Remove other_party getter from model"
|
diff --git a/spec/command_spec.rb b/spec/command_spec.rb
index abc1234..def5678 100644
--- a/spec/command_spec.rb
+++ b/spec/command_spec.rb
@@ -6,6 +6,8 @@ let(:container){LintTrap::Container::Docker.new('lintci/rubocop', fixture_path)}
describe '#run' do
+ let(:container){LintTrap::Container::Docker.new('lintci/rubocop', fixture_path, remove_container: ENV['CI'].nil?)}
+
it 'generates the expected output' do
success = command.run(container) do |io|
expect(io.read).to eq(" 1\tlint\n")
|
Fix remaining failure for circle when trying to remove containers.
|
diff --git a/spec/message_spec.rb b/spec/message_spec.rb
index abc1234..def5678 100644
--- a/spec/message_spec.rb
+++ b/spec/message_spec.rb
@@ -0,0 +1,63 @@+require 'spec_helper'
+
+describe DripDrop::Message do
+ describe "basic message" do
+ def create_basic
+ attrs = {
+ :name => 'test',
+ :head => {:foo => :bar},
+ :body => [:foo, :bar, :baz]
+ }
+ message = DripDrop::Message.new(attrs[:name],:head => attrs[:head],
+ :body => attrs[:body])
+ [message, attrs]
+ end
+ it "should create a basic message without raising an exception" do
+ lambda {
+ message, attrs = create_basic
+ }.should_not raise_exception
+ end
+ describe "with minimal attributes" do
+ it "should create a message with only a name" do
+ lambda {
+ DripDrop::Message.new('nameonly')
+ }.should_not raise_exception
+ end
+ it "should set the head to an empty hash if nil provided" do
+ DripDrop::Message.new('nilhead', :head => nil).head.should == {}
+ end
+ it "should raise an exception if a non-hash, non-nil head is provided" do
+ lambda {
+ DripDrop::Message.new('arrhead', :head => [])
+ }.should raise_exception(ArgumentError)
+ end
+ end
+ describe "encoding" do
+ before(:all) do
+ @message, @attrs = create_basic
+ end
+ it "should encode to valid BERT hash without error" do
+ enc = @message.encoded
+ enc.should be_a(String)
+ BERT.decode(enc).should be_a(Hash)
+ end
+ it "should decode encoded messages without errors" do
+ DripDrop::Message.decode(@message.encoded).should be_a(DripDrop::Message)
+ end
+ it "should encode to valid JSON without error" do
+ enc = @message.json_encoded
+ enc.should be_a(String)
+ JSON.parse(enc).should be_a(Hash)
+ end
+ it "should decode JSON encoded messages without errors" do
+ DripDrop::Message.decode_json(@message.json_encoded).should be_a(DripDrop::Message)
+ end
+ it "should convert messages to Hash representations" do
+ @message.to_hash.should be_a(Hash)
+ end
+ it "should be able to turn hash representations back into Message objs" do
+ DripDrop::Message.from_hash(@message.to_hash).should be_a(DripDrop::Message)
+ end
+ end
+ end
+end
|
Add in message spec for reals
|
diff --git a/app/helpers/tags_helper.rb b/app/helpers/tags_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/tags_helper.rb
+++ b/app/helpers/tags_helper.rb
@@ -8,7 +8,7 @@ end
def tag_classes(tag)
- classes = ["tag-toggle", tag]
+ classes = ["tag-toggle", tag.downcase]
if active_tag?(tag)
classes << "is-active"
|
Tag classnames should always be lowercase
The development seeds have tags that are title case: "Ember", "Rails",
etc. As such, the tags had the classnames `Ember`, `Rails`.
This change forces tags to use the downcase for classnames.
|
diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb
index abc1234..def5678 100644
--- a/app/mailers/user_mailer.rb
+++ b/app/mailers/user_mailer.rb
@@ -5,7 +5,7 @@ @user = user
@url = "http://prepared.ly/users/sign_in"
@referral_url = "http://www.prepared.ly/?ref=<%= @referral_code %>"
- attachments.inline['preparedly-red.png'] = File.read('assets/preparedly-red.png')
+ attachments.inline['preparedly-red.png'] = File.read('preparedly-red.png')
mail(:to => user.email, :subject => "Welcome to Prepared.ly")
end
end
|
Fix welcome email logo url
|
diff --git a/lib/opal/path_reader.rb b/lib/opal/path_reader.rb
index abc1234..def5678 100644
--- a/lib/opal/path_reader.rb
+++ b/lib/opal/path_reader.rb
@@ -1,7 +1,10 @@+require 'opal/regexp_anchors'
require 'opal/hike_path_finder'
module Opal
class PathReader
+ RELATIVE_PATH_REGEXP = %r{#{Opal::REGEXP_START}\.?\.#{File::SEPARATOR}}
+
def initialize(file_finder = HikePathFinder.new)
@file_finder = file_finder
end
@@ -13,7 +16,7 @@ end
def expand(path)
- if Pathname.new(path).absolute? || path =~ %r{\A\.?\.#{File::SEPARATOR}}
+ if Pathname.new(path).absolute? || path =~ RELATIVE_PATH_REGEXP
path
else
file_finder.find(path)
|
Use Opal::REGEXP_START in path reader
At least until we'll be able to compile `\A` and `\z`.
Also moved it to a constant.
Ref: https://github.com/opal/opal/issues/1630
|
diff --git a/server/app/controllers/api/v1/results_controller.rb b/server/app/controllers/api/v1/results_controller.rb
index abc1234..def5678 100644
--- a/server/app/controllers/api/v1/results_controller.rb
+++ b/server/app/controllers/api/v1/results_controller.rb
@@ -1,3 +1,4 @@+# -*- coding: undecided -*-
class Api::V1::ResultsController < ApplicationController
protect_from_forgery except: [:index, :create, :show]
@@ -5,18 +6,43 @@ hs = Result.all
render :json => hs
end
+
+ def bfs(client, open_list=[], check_list=[], from_id, to_id)
+ records = client.query("select to_id from wikipedia_edges where from_id = '#{from_id}' limit 100").to_a.map{|record| record['to_id']}
+ check_list.push from_id
+ open_list.concat records
+ return true if records.include? to_id
+
+ records.each do |next_from_id|
+ unless check_list.include? next_from_id
+ bfs(client, open_list, check_list, next_from_id, to_id)
+ end
+ end
+ return 0
+ end
+
+
def create
param = searchParams
-
+
+ ids = client.query("select id, word from wikipedia_nodes where word = '#{params[:from]}' or word = '#{params[:to]}'").to_a.map{|record| record['id']}
+
+ from_id = ids[0]
+ to_id = ids[1]
+
+ chains = Array.new
########################
# chains = awesomeMethod params[:from], params[:to]
# => [@node, @node, @node]
- chains = [1, 2, 3, 4, 5]
+ # chains = [1, 2, 3, 4, 5]
########################
+
+ chains.push(from_id)
+ chains.push(bfs(client, [], [], from_id, to_id))
+ chains.push(to_id)
result = Result.new
-
if result.save
chains.each do |node_id|
result_item = ResultItem.new result_id: result.id, node_id: node_id
|
ADD bfs in (POST /api/vi/results)
|
diff --git a/api/app/views/spree/api/line_items/show.v1.rabl b/api/app/views/spree/api/line_items/show.v1.rabl
index abc1234..def5678 100644
--- a/api/app/views/spree/api/line_items/show.v1.rabl
+++ b/api/app/views/spree/api/line_items/show.v1.rabl
@@ -1,5 +1,7 @@ object @line_item
attributes *line_item_attributes
+node(:display_single_amount) { |li| li.single_display_amount.to_s }
+node(:display_total_amount) { |li| li.display_amount.to_s }
child :variant do
extends "spree/api/variants/variant"
attributes :product_id
|
[api] Return display_single_amount and display_total_amount in LineItems responses
This is useful if the API client wants to display a well-formatted version of the price
|
diff --git a/streamio-magick.gemspec b/streamio-magick.gemspec
index abc1234..def5678 100644
--- a/streamio-magick.gemspec
+++ b/streamio-magick.gemspec
@@ -19,6 +19,6 @@ s.add_development_dependency("rake", "~> 0.9.2")
s.add_development_dependency("rspec", "~> 2.9")
- s.files = Dir.glob("lib/**/*") + %w(README.rdoc LICENSE)
+ s.files = Dir.glob("lib/**/*") + %w(README.md LICENSE)
s.require_path = 'lib'
end
|
Fix README file in gemspec.
|
diff --git a/lib/color_divider/api.rb b/lib/color_divider/api.rb
index abc1234..def5678 100644
--- a/lib/color_divider/api.rb
+++ b/lib/color_divider/api.rb
@@ -3,6 +3,13 @@
class ColorDivider
class API < Sinatra::Base
+ use Rack::Cors do
+ allow do
+ origins '*'
+ resource '*', :headers => :any, :methods => [:get, :post, :options]
+ end
+ end
+
# Idea from http://www.recursion.org/2011/7/21/modular-sinatra-foreman
configure do
set :app_file, __FILE__
|
Add CORS support to API class
|
diff --git a/test/template_handler_test.rb b/test/template_handler_test.rb
index abc1234..def5678 100644
--- a/test/template_handler_test.rb
+++ b/test/template_handler_test.rb
@@ -26,17 +26,17 @@ get "/site/index.js"
s = last_response.body
- assert_match "var x = 5;", last_response.body
+ assert_match /var x = 5;\s*/, last_response.body
end
test "<reference> to other .ts file works" do
get "/site/ref1_2.js"
- assert_match "var f = function (x, y) {\n return x + y;\n};\nf(1, 2);\n", last_response.body
+ assert_match /var f = function \(x, y\) {\s*return x \+ y;\s*};\s*f\(1, 2\);\s*/, last_response.body
end
test "<reference> to other .d.ts file works" do
get "/site/ref2_2.js"
- assert_match "f(1, 2);\n", last_response.body
+ assert_match /f\(1, 2\);\s*/, last_response.body
end
end
|
Update tests to use a more flexible match to get around multi-system line endings
|
diff --git a/spec/ruby/core/exception/system_stack_error_spec.rb b/spec/ruby/core/exception/system_stack_error_spec.rb
index abc1234..def5678 100644
--- a/spec/ruby/core/exception/system_stack_error_spec.rb
+++ b/spec/ruby/core/exception/system_stack_error_spec.rb
@@ -0,0 +1,16 @@+require File.expand_path('../../../spec_helper', __FILE__)
+
+describe "SystemStackError" do
+ ruby_version_is ""..."1.9" do
+ it "is a subclass of StandardError" do
+ SystemStackError.superclass.should == StandardError
+ end
+ end
+
+ ruby_version_is "1.9" do
+ it "is a subclass of Exception" do
+ SystemStackError.superclass.should == Exception
+ end
+ end
+end
+
|
Add some basic specs for the ancestry of SystemStackError
|
diff --git a/spec/unit/facter/util/fact_rabbitmq_version_spec.rb b/spec/unit/facter/util/fact_rabbitmq_version_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/facter/util/fact_rabbitmq_version_spec.rb
+++ b/spec/unit/facter/util/fact_rabbitmq_version_spec.rb
@@ -19,6 +19,15 @@ expect(Facter.fact(:rabbitmq_version).value).to eq('3.6.0')
end
end
+ context 'with invalid value' do
+ before do
+ allow(Facter::Util::Resolution).to receive(:which).with('rabbitmqadmin') { true }
+ allow(Facter::Core::Execution).to receive(:execute).with('rabbitmqadmin --version 2>&1') { 'rabbitmqadmin %%VSN%%' }
+ end
+ it do
+ expect(Facter.fact(:rabbitmq_version).value).to be_nil
+ end
+ end
context 'rabbitmqadmin is not in path' do
before do
allow(Facter::Util::Resolution).to receive(:which).with('rabbitmqadmin') { false }
|
Add test for invalid version value
|
diff --git a/lib/dotenv/deployment.rb b/lib/dotenv/deployment.rb
index abc1234..def5678 100644
--- a/lib/dotenv/deployment.rb
+++ b/lib/dotenv/deployment.rb
@@ -0,0 +1,9 @@+require "dotenv"
+require "dotenv/deployment/version"
+
+# Load defaults
+Dotenv.load '.env'
+
+# Override any existing variables if an environment-specific file exists
+environment = ENV['RACK_ENV'] || (defined?(Rails) && Rails.env)
+Dotenv.overload ".env.#{environment}" if environment
|
Add support for multiple environments
|
diff --git a/lib/hello_sign/client.rb b/lib/hello_sign/client.rb
index abc1234..def5678 100644
--- a/lib/hello_sign/client.rb
+++ b/lib/hello_sign/client.rb
@@ -36,10 +36,11 @@
def unauth_connection(&auth)
Faraday.new(:url => API_ENDPOINT) do |faraday|
+ auth.call(faraday) if block_given?
+ faraday.request :multipart
faraday.request :url_encoded
faraday.response :logger
faraday.response :multi_json, :symbolize_keys => true
- auth.call(faraday) if block_given?
faraday.adapter Faraday.default_adapter
end
end
|
Add multipart middleware to Faraday stack
|
diff --git a/lib/infrataster/rspec.rb b/lib/infrataster/rspec.rb
index abc1234..def5678 100644
--- a/lib/infrataster/rspec.rb
+++ b/lib/infrataster/rspec.rb
@@ -10,7 +10,7 @@ @infrataster_context = Infrataster::Contexts.from_example(self.class)
end
config.before(:each) do
- @infrataster_context = Infrataster::Contexts.from_example(example)
+ @infrataster_context = Infrataster::Contexts.from_example(RSpec.current_example)
@infrataster_context.before_each(example) if @infrataster_context.respond_to?(:before_each)
end
config.after(:each) do
|
Use `RSpec.current_example` in place of `example`
In order to remove deprecation warning #34
|
diff --git a/lib/pacto/test_helper.rb b/lib/pacto/test_helper.rb
index abc1234..def5678 100644
--- a/lib/pacto/test_helper.rb
+++ b/lib/pacto/test_helper.rb
@@ -1,4 +1,5 @@ begin
+ require 'pacto'
require 'goliath/test_helper'
require 'pacto/server'
rescue LoadError
|
Save an extra require, expect this will fix the issue loading webmock on travis-ci
|
diff --git a/lib/sfn/config/update.rb b/lib/sfn/config/update.rb
index abc1234..def5678 100644
--- a/lib/sfn/config/update.rb
+++ b/lib/sfn/config/update.rb
@@ -10,11 +10,6 @@ :description => 'Print the resulting stack template'
)
attribute(
- :apply_nesting, [TrueClass, FalseClass],
- :default => true,
- :description => 'Apply nested stacks. When disabled, stacks built in serial order.'
- )
- attribute(
:apply_stack, String,
:multiple => true,
:description => 'Apply outputs from stack to input parameters'
|
Remove duplicated configuration attribute (is already inherited)
|
diff --git a/lib/trufflepig/search.rb b/lib/trufflepig/search.rb
index abc1234..def5678 100644
--- a/lib/trufflepig/search.rb
+++ b/lib/trufflepig/search.rb
@@ -25,12 +25,17 @@
def scan(file_path)
content = File.read file_path
- features = FeatureList.load
features.each do |key, feature|
next unless feature["detection_pattern"]
results << key if content.match(/#{feature["detection_pattern"]}/)
end
end
+
+ private
+
+ def features
+ @features ||= FeatureList.load
+ end
end
end
|
Load feature list only once when scanning multiple files
|
diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb
index abc1234..def5678 100644
--- a/spec/spec_helper_acceptance.rb
+++ b/spec/spec_helper_acceptance.rb
@@ -18,6 +18,7 @@ # Install module and dependencies
hosts.each do |host|
copy_module_to(host, source: proj_root, module_name: 'fail2ban')
+ on host, puppet('module install puppet-extlib'), acceptable_exit_codes: [0, 1]
on host, puppet('module install puppetlabs-stdlib'), acceptable_exit_codes: [0, 1]
end
end
|
Add missing dependency for Beaker tests
|
diff --git a/spec/togls/rules/group_spec.rb b/spec/togls/rules/group_spec.rb
index abc1234..def5678 100644
--- a/spec/togls/rules/group_spec.rb
+++ b/spec/togls/rules/group_spec.rb
@@ -22,7 +22,7 @@ describe "#run" do
context "when the target is included in the list" do
it "returns true" do
- group = Togls::Rules::Group.new(["target"], target_type: :foo)
+ group = Togls::Rules::Group.new(:group, ["target"], target_type: :foo)
expect(group.run(double('feature_key'), "target")).to eq(true)
end
end
|
Modify Group rule spec to include type_id
Why you made the change:
I did this because Rule construction now requires the first parameter to be the
abstract type_id of that rule.
|
diff --git a/db/migrate/20160128222817_change_grants_description_type.rb b/db/migrate/20160128222817_change_grants_description_type.rb
index abc1234..def5678 100644
--- a/db/migrate/20160128222817_change_grants_description_type.rb
+++ b/db/migrate/20160128222817_change_grants_description_type.rb
@@ -0,0 +1,9 @@+class ChangeGrantsDescriptionType < ActiveRecord::Migration
+ def up
+ change_column :grants, :details, :text
+ end
+
+ def down
+ change_column :grants, :details, :string
+ end
+end
|
Change grants description type to text
|
diff --git a/Casks/intellij-idea-eap.rb b/Casks/intellij-idea-eap.rb
index abc1234..def5678 100644
--- a/Casks/intellij-idea-eap.rb
+++ b/Casks/intellij-idea-eap.rb
@@ -1,6 +1,6 @@ cask :v1 => 'intellij-idea-eap' do
- version '140.2110.5'
- sha256 '971cea43259cf517c209dd646c6c48220c97f22e35c0773b644b8c7578aea1c3'
+ version '140.2285.5'
+ sha256 'f6ac5ba4ad73eaa7c072c4c4c52b26f7c65f3fbc4f520c2cf9fbe902aedd1751'
url "http://download-cf.jetbrains.com/idea/ideaIU-#{version}.dmg"
homepage 'https://confluence.jetbrains.com/display/IDEADEV/IDEA+14.1+EAP'
|
Upgrade Intellij Idea EAP to v140.2285.5
|
diff --git a/core/app/models/spree/line_item/pricers/abstract.rb b/core/app/models/spree/line_item/pricers/abstract.rb
index abc1234..def5678 100644
--- a/core/app/models/spree/line_item/pricers/abstract.rb
+++ b/core/app/models/spree/line_item/pricers/abstract.rb
@@ -1,6 +1,16 @@ module Spree
class LineItem
+ # Pricers for line items expose `#price`, return a `Spree::Money` object,
+ # and are used to choose or calculate the correct price for a line item.
+ # Ideally, they are idempotent, that is: When run on the same line item, they will return
+ # the same price.
+ #
module Pricers
+ # The `Abstract` pricer is here for other pricers to inherit from. It defines the common
+ # interface for pricers, as well as two practical errors, `VariantMissing` and
+ # `CurrencyMissing`.
+ #
+ # @attr [Spree::LineItem] The line item to calculate or choose a price for
class Abstract
class VariantMissing < StandardError; end
class CurrencyMissing < StandardError; end
@@ -11,12 +21,18 @@ @line_item = line_item
end
+ # Returns the calculated or chosen price
+ #
+ # @return [Spree::Money] a `Spree::Money` object representing line item's price
def price
raise NotImplementedError, "Please implement '#price' in your pricer: #{self.class.name}"
end
private
+ # This helper method converts an amount into a Spree::Money object with the given line
+ # item's currency, and will be needed for most pricers.
+ #
def in_line_item_currency(amount)
Spree::Money.new(amount, currency: line_item.currency)
end
|
Add YARD documentation for Abstract Pricer
|
diff --git a/spec/controllers/vm_controller_spec.rb b/spec/controllers/vm_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/vm_controller_spec.rb
+++ b/spec/controllers/vm_controller_spec.rb
@@ -0,0 +1,23 @@+describe VmController do
+ before do
+ stub_user(:features => :all)
+ EvmSpecHelper.create_guid_miq_server_zone
+ end
+
+ context 'live_migrate' do
+ # FIXME: need to render views for now,
+ # because the branching logic is in app/views/vm/show.html.haml
+ render_views
+
+ let(:vm_openstack) { FactoryGirl.create(:vm_openstack) }
+
+ # Request URL: http://localhost:3000/vm/live_migrate?escape=false
+ # FIXME: the espace=false seems unused
+ it 'renders' do
+ session[:live_migrate_items] = [vm_openstack.id]
+ get :live_migrate
+ expect(response.status).to eq(200)
+ expect(response).to render_template('vm_common/_live_migrate')
+ end
+ end
+end
|
Add spec for live_migrate called outside explorers.
|
diff --git a/spec/factory_bot_rails/railtie_spec.rb b/spec/factory_bot_rails/railtie_spec.rb
index abc1234..def5678 100644
--- a/spec/factory_bot_rails/railtie_spec.rb
+++ b/spec/factory_bot_rails/railtie_spec.rb
@@ -39,14 +39,7 @@ end
def reload_rails!
- if defined? ActiveSupport::Reloader
- Rails.application.reloader.reload!
- else
- # For Rails 4
- ActionDispatch::Reloader.cleanup!
- ActionDispatch::Reloader.prepare!
- end
-
+ Rails.application.reloader.reload!
wait_for_rails_to_reload
end
|
Remove branch for rails 4.2 reloader
We are no longer testing against Rails 4.2, so we no longer need to
branch for the Rails 4.2 style reloader
|
diff --git a/apnd.gemspec b/apnd.gemspec
index abc1234..def5678 100644
--- a/apnd.gemspec
+++ b/apnd.gemspec
@@ -22,6 +22,8 @@ s.add_dependency('json', '= 1.4.6')
s.add_dependency('daemons', '= 1.1.0')
+ s.add_development_dependency('shoulda')
+
s.extra_rdoc_files = ['README.markdown']
s.rdoc_options = ["--charset=UTF-8"]
|
Add shoulda to gemspec development dependencies
|
diff --git a/verified_double.gemspec b/verified_double.gemspec
index abc1234..def5678 100644
--- a/verified_double.gemspec
+++ b/verified_double.gemspec
@@ -8,9 +8,9 @@ gem.version = VerifiedDouble::VERSION
gem.authors = ["George Mendoza"]
gem.email = ["gsmendoza@gmail.com"]
- gem.description = %q{TODO: Write a gem description}
- gem.summary = %q{TODO: Write a gem summary}
- gem.homepage = ""
+ gem.description = %q{Contract tests for rspec}
+ gem.summary = %q{VerifiedDouble would record any mock made in the test suite. It would then verify if the mock is valid by checking if there is a test against it.}
+ gem.homepage = "https://www.relishapp.com/gsmendoza/verified-double"
gem.files = `git ls-files`.split($/)
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
Update gem description, summary, and homepage for release.
|
diff --git a/app/models/page.rb b/app/models/page.rb
index abc1234..def5678 100644
--- a/app/models/page.rb
+++ b/app/models/page.rb
@@ -1,6 +1,4 @@ class Page < DataMapper::Base
- class VersionNotFound < Exception; end
-
property :name, :string
property :slug, :string
property :versions_count, :integer, :default => 0
@@ -22,7 +20,7 @@ end
def select_version!(version_number)
- @selected_version = versions.detect { |version| version.number == version_number } || raise(VersionNotFound)
+ @selected_version = versions.detect { |version| version.number == version_number } || raise(NotFound)
@content = @selected_version.content
end
|
Raise standard 404 not found instead of custom exception when a non-existent version is selected
|
diff --git a/app/models/post.rb b/app/models/post.rb
index abc1234..def5678 100644
--- a/app/models/post.rb
+++ b/app/models/post.rb
@@ -1,6 +1,6 @@ class Post < ActiveRecord::Base
include DateFormat
-
+
before_save :prevent_blank_content
after_save :calculate_word_count
@@ -30,7 +30,7 @@ private
def prevent_blank_content
- return /^\s*$/ =~ content ? false : true
+ return /^\s*$/ =~ content ? nil : true
end
def calculate_word_count
|
Return nil so that callback won't leave false on the stack.
|
diff --git a/test_declarative.gemspec b/test_declarative.gemspec
index abc1234..def5678 100644
--- a/test_declarative.gemspec
+++ b/test_declarative.gemspec
@@ -8,6 +8,7 @@ s.authors = ['Sven Fuchs']
s.email = 'svenfuchs@artweb-design.de'
s.homepage = 'http://github.com/svenfuchs/test_declarative'
+ s.license = 'MIT'
s.summary = 'Simply adds a declarative test method syntax to test/unit'
s.description = 'Simply adds a declarative test method syntax to test/unit.'
s.files = Dir['{lib/**/*,test/**/*,[A-Z]*}']
|
Add license to gemspec file.
|
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
@@ -5,6 +5,7 @@ LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib')
Before do
+ @aruba_timeout_seconds = 3600
# Using "announce" causes massive warnings on 1.9.2
@puts = true
@original_rubylib = ENV['RUBYLIB']
|
Extend aruba timeout in order to have plenty of time to debug.
|
diff --git a/tools/split-mysql-dump.rb b/tools/split-mysql-dump.rb
index abc1234..def5678 100644
--- a/tools/split-mysql-dump.rb
+++ b/tools/split-mysql-dump.rb
@@ -0,0 +1,67 @@+#!/usr/bin/env ruby
+
+require "optparse"
+require "ostruct"
+
+options = OpenStruct.new
+options.base_name = "dump"
+option_parser = OptionParser.new
+option_parser.on("--base-name=NAME",
+ "The base name of output paths",
+ "(#{options.base_name})") do |name|
+ options.base_name = name
+end
+option_parser.parse!
+
+preamble = ""
+postamble = ""
+contents = {}
+current_content = ""
+state = :in_preamble
+ARGF.each_line do |line|
+ case state
+ when :in_preamble
+ case line
+ when /\A\/\*!/
+ state = :in_preamble_set
+ preamble << line
+ else
+ preamble << line
+ end
+ when :in_preamble_set
+ case line
+ when /\A\s*$/
+ preamble << line
+ state = :table
+ else
+ preamble << line
+ end
+ when :in_postamble
+ postamble << line
+ else
+ target_line = line
+ target_line = target_line.scrub unless target_line.valid_encoding?
+ case target_line
+ when /\A-- Table structure for table `(.+?)`$/
+ table_name = $1
+ contents[table_name] = current_content
+ current_content << line
+ when /\AUNLOCK TABLES;$/
+ current_content << line
+ current_content = ""
+ when /\A\/\*!\d+ SET TIME_ZONE=/ # Heuristic. TODO: Improve this.
+ state = :in_postamble
+ postamble << line
+ else
+ current_content << line
+ end
+ end
+end
+
+contents.each do |table, content|
+ File.open("#{options.base_name}-#{table}.sql", "w") do |output|
+ output.puts(preamble)
+ output.puts(content)
+ output.puts(postamble)
+ end
+end
|
Add a tool to split table dump from all tables dump
|
diff --git a/lib/flex_commerce_api/error/internal_server.rb b/lib/flex_commerce_api/error/internal_server.rb
index abc1234..def5678 100644
--- a/lib/flex_commerce_api/error/internal_server.rb
+++ b/lib/flex_commerce_api/error/internal_server.rb
@@ -3,14 +3,15 @@ class InternalServer < Base
def message
body = response_env.fetch(:body, {errors: []})
- error = body[:errors].first
- if error
+ error = body.is_a?(::String) ? body : body[:errors].first
+ return "Internal server error" unless error.present?
+ if error.is_a?(::Enumerable)
title = error.fetch(:title, "")
detail = error.fetch(:detail, "")
backtrace = error.fetch(:meta, {backtrace: []}).fetch(:backtrace)
"Internal server error - #{title} #{detail} #{backtrace}"
else
- "Internal server error"
+ "Internal server error - #{error}"
end
end
|
Fix for when fastly errors are returned
|
diff --git a/lib/rugged/diff/delta.rb b/lib/rugged/diff/delta.rb
index abc1234..def5678 100644
--- a/lib/rugged/diff/delta.rb
+++ b/lib/rugged/diff/delta.rb
@@ -1,25 +1,13 @@ module Rugged
class Diff
class Delta
- def new_blob
- blob(new_file)
- end
-
- def old_blob
- blob(old_file)
- end
-
def repo
diff.tree.repo
end
- private
-
- def blob(file)
- return if file.nil?
- return if file[:oid] == '0000000000000000000000000000000000000000'
-
- repo.lookup(file[:oid])
+ def new_file_full_path
+ repo_path = Pathname.new(repo.path).parent
+ repo_path.join(new_file[:path])
end
end
end
|
Add new_file_full_path method on Rugged::Diff::Delta
|
diff --git a/test/anticuado/ios/carthage_test.rb b/test/anticuado/ios/carthage_test.rb
index abc1234..def5678 100644
--- a/test/anticuado/ios/carthage_test.rb
+++ b/test/anticuado/ios/carthage_test.rb
@@ -9,6 +9,13 @@ *** Fetching Himotoki
The following dependencies are outdated:
Result "2.0.0" -> "2.1.3"
+ OUTDATED
+
+
+ OUTDATED_HAVE_UPDATE_WITH_LATEST =<<-OUTDATED
+*** Fetching Puree-Swift
+The following dependencies are outdated:
+Puree-Swift "3.0.0" -> "3.0.0" (Latest: "3.1.1")
OUTDATED
OUTDATED_NO_UPDATE =<<-OUTDATED
@@ -26,6 +33,14 @@ assert_equal expected_0, result[0]
end
+ def test_with_format_have_update_with_latest
+ result = Anticuado::IOS::Carthage.format OUTDATED_HAVE_UPDATE_WITH_LATEST
+
+ expected_0 = { library_name: "Puree-Swift", current_version: "3.0.0", available_version: "3.0.0", latest_version: "3.1.1" }
+
+ assert_equal expected_0, result[0]
+ end
+
def test_with_format_no_update
result = Anticuado::IOS::Carthage.format OUTDATED_NO_UPDATE
@@ -35,4 +50,4 @@
end
end
-end+end
|
Add test case for recent Carthage
|
diff --git a/client/ruby/solrb/lib/solr/response/standard.rb b/client/ruby/solrb/lib/solr/response/standard.rb
index abc1234..def5678 100644
--- a/client/ruby/solrb/lib/solr/response/standard.rb
+++ b/client/ruby/solrb/lib/solr/response/standard.rb
@@ -36,6 +36,11 @@ def max_score
return @response['maxScore']
end
+
+ def field_facets(field)
+ @data['facet_counts']['facet_fields'][field].sort {|a,b| b[1] <=> a[1]}
+ end
+
# supports enumeration of hits
def each
|
Add helper method to retrieve and sort facets
git-svn-id: 3b1ff1236863b4d63a22e4dae568675c2e247730@499438 13f79535-47bb-0310-9956-ffa450edef68
|
diff --git a/test/operators/revenue_code_test.rb b/test/operators/revenue_code_test.rb
index abc1234..def5678 100644
--- a/test/operators/revenue_code_test.rb
+++ b/test/operators/revenue_code_test.rb
@@ -7,7 +7,7 @@ ).must_equal({})
end
- it "should have the best procedure_domain" do
+ it "should have the correct domain" do
query([:revenue_code, '100']).domains == [:procedure_occurrence]
end
end
|
Fix typo in Revenue Code tests
|
diff --git a/milkfarm-onix.gemspec b/milkfarm-onix.gemspec
index abc1234..def5678 100644
--- a/milkfarm-onix.gemspec
+++ b/milkfarm-onix.gemspec
@@ -15,7 +15,7 @@ s.test_files = Dir.glob("spec/**/*.rb")
s.files = Dir.glob("{lib,support,dtd}/**/**/*") + ["README.markdown", "TODO", "CHANGELOG"]
- s.add_dependency('roxml', '>=3.1.6')
+ s.add_dependency('roxml', '~>3.1.6')
s.add_dependency('i18n')
s.add_dependency('andand')
s.add_dependency('nokogiri', '>=1.4')
|
Change roxml version requirement to ~>3.1.6
|
diff --git a/example/example2.rb b/example/example2.rb
index abc1234..def5678 100644
--- a/example/example2.rb
+++ b/example/example2.rb
@@ -9,6 +9,9 @@ sensor :interface => 'en1',
:name => 'Unified2 Example', :id => 3
+ # Load signatures, generate events will be sent over the web socket
+ # quickly so we slow down the process of
+ # pushing events onto the channel.rs & classifications into memory
load :signatures, 'seeds/sid-msg.map'
load :generators, 'seeds/gen-msg.map'
@@ -17,35 +20,26 @@
end
-path = 'seeds/unified2-current.log'
-#path = '/var/log/snort/merged.log'
+Unified2.watch('seeds/unified2-current.log', :first) do |event|
+
+ puts event.id
-Unified2.watch(path, :first) do |event|
-
- #puts event.source_ip
- #puts event.destination_ip
+ puts event.position
- #puts event.severity
+ puts event.severity
- #puts event.classification.name
+ puts event.classification.name
- #puts event.signature.name
+ puts event.signature.name
- #event.extras.each do |extra|
- #puts extra.name
- #puts extra.value
- #end
+ event.extras.each do |extra|
+ puts extra.name
+ puts extra.value
+ end
event.packets.each do |packet|
-
- #packet.to_pcap
-
- #packet.to_file('output.pcap', 'a')
-
- #puts packet.ip_header
-
- #puts packet.protocol.header
-
+ puts packet.ip_header
+ puts packet.protocol.header
puts packet.hexdump(:header => false, :width => 40)
end
|
Add io position to Event class
|
diff --git a/lib/dimples.rb b/lib/dimples.rb
index abc1234..def5678 100644
--- a/lib/dimples.rb
+++ b/lib/dimples.rb
@@ -7,7 +7,6 @@ require 'yaml'
require 'dimples/frontable'
-require 'dimples/renderable'
require 'dimples/category'
require 'dimples/configuration'
@@ -16,5 +15,6 @@ require 'dimples/pager'
require 'dimples/plugin'
require 'dimples/post'
+require 'dimples/renderer'
require 'dimples/site'
require 'dimples/template'
|
Swap the renderable module for the renderer class
|
diff --git a/fancyengine.gemspec b/fancyengine.gemspec
index abc1234..def5678 100644
--- a/fancyengine.gemspec
+++ b/fancyengine.gemspec
@@ -9,9 +9,9 @@ s.version = Fancyengine::VERSION
s.authors = ["Sean Devine"]
s.email = ["barelyknown@icloud.com"]
- s.homepage = "TODO"
- s.summary = "TODO: Summary of Fancyengine."
- s.description = "TODO: Description of Fancyengine."
+ s.homepage = "http://www.github.com/togglepro/fancyengine"
+ s.summary = "Engine that handles integration with FancyHands API."
+ s.description = s.summary
s.license = "MIT"
s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
|
Add summary and description to gemspec.
|
diff --git a/fc-reminder.gemspec b/fc-reminder.gemspec
index abc1234..def5678 100644
--- a/fc-reminder.gemspec
+++ b/fc-reminder.gemspec
@@ -24,5 +24,5 @@ spec.add_dependency 'daemons', '~> 1.1.9'
spec.add_dependency 'clockwork', '~> 0.7.5'
- spec.add_development_dependency 'bundler', '~> 1.3'
+ spec.add_development_dependency 'bundler', '~> 1.6'
end
|
Set dev dependency of bundler; to ~> 1.6
|
diff --git a/docs/analytics_scripts/submitted_courses.csv.rb b/docs/analytics_scripts/submitted_courses.csv.rb
index abc1234..def5678 100644
--- a/docs/analytics_scripts/submitted_courses.csv.rb
+++ b/docs/analytics_scripts/submitted_courses.csv.rb
@@ -4,7 +4,7 @@
require 'csv'
-CSV.open("/home/sage/unsubmitted-#{Date.today}.csv", 'wb') do |csv|
+CSV.open("/home/sage/submitted-#{Date.today}.csv", 'wb') do |csv|
csv << %w[url title instructor first_time_instructor submitted_at expected_students subject level contribution_type assignment_portion sandbox_opinion]
Course.submitted_but_unapproved.each do |course|
tags = course.tags.pluck(:tag)
|
Fix filename in script for CSV of submitted courses
|
diff --git a/config/application.rb b/config/application.rb
index abc1234..def5678 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -11,9 +11,7 @@ config.generators do |g|
g.factory_girl dir: 'spec/factories'
end
- # Settings in config/environments/* take precedence over those specified here.
- # Application configuration should go into files in config/initializers
- # -- all .rb files in that directory are automatically loaded.
+
config.time_zone = 'Tokyo'
config.active_record.default_timezone = :local
config.i18n.default_locale = :ja
|
Set timezone for displaying (and remove comments)
|
diff --git a/glimpse-mongo.gemspec b/glimpse-mongo.gemspec
index abc1234..def5678 100644
--- a/glimpse-mongo.gemspec
+++ b/glimpse-mongo.gemspec
@@ -18,5 +18,5 @@ gem.require_paths = ['lib']
gem.add_dependency 'glimpse'
- gem.add_dependency 'mongo'
+ gem.add_dependency 'mongo', '>= 1.8'
end
|
Update the mongo dependency to >= 1.8
|
diff --git a/stripe_event.gemspec b/stripe_event.gemspec
index abc1234..def5678 100644
--- a/stripe_event.gemspec
+++ b/stripe_event.gemspec
@@ -14,7 +14,8 @@ s.summary = "Stripe webhook integration for Rails applications."
s.description = "Stripe webhook integration for Rails applications."
- s.files = Dir["{app,config,lib}/**/*"] + ["LICENSE.md", "Rakefile", "README.md"]
+ s.files = `git ls-files`.split("\n")
+ s.test_files = `git ls-files -- Appraisals {spec,gemfiles}/*`.split("\n")
s.add_dependency "rails", ">= 3.1"
s.add_dependency "stripe", "~> 1.6"
|
Update gemspec config for files and test_files
|
diff --git a/sync_repositories.rb b/sync_repositories.rb
index abc1234..def5678 100644
--- a/sync_repositories.rb
+++ b/sync_repositories.rb
@@ -5,7 +5,7 @@ page = 1
catch(:done) do
- while (repositories = Octokit.repositories('railscasts', page: page, per_page: 100, sorted: 'created', direction: 'desc')).length > 0
+ while (repositories = Octokit.repositories('railscasts', page: page, per_page: 100, sort: 'created', direction: 'desc')).length > 0
repositories.each do |repository|
path = "repositories/#{repository.name}"
|
Use right github API parameter for defining the sort field.
|
diff --git a/freckle-api.gemspec b/freckle-api.gemspec
index abc1234..def5678 100644
--- a/freckle-api.gemspec
+++ b/freckle-api.gemspec
@@ -13,11 +13,11 @@ s.files = Dir['LICENSE', 'README.md', 'lib/**/*.rb']
s.test_files = Dir['spec/**/*.rb']
- s.add_development_dependency('rake')
- s.add_development_dependency('rspec')
- s.add_development_dependency('webmock')
- s.add_development_dependency('pry-byebug')
- s.add_development_dependency('sinatra')
- s.add_development_dependency('sinatra-contrib')
- s.add_runtime_dependency('hashie')
+ s.add_development_dependency('rake', '~> 10.1')
+ s.add_development_dependency('rspec', '~> 3.4')
+ s.add_development_dependency('webmock', '~> 1.22')
+ s.add_development_dependency('pry-byebug', '~> 3.3')
+ s.add_development_dependency('sinatra', '~> 1.4')
+ s.add_development_dependency('sinatra-contrib', '~> 1.4')
+ s.add_runtime_dependency('hashie', '~> 3.4')
end
|
Add versions to dependencies, tag 0.1.0
|
diff --git a/lib/instana/frameworks/instrumentation/action_controller.rb b/lib/instana/frameworks/instrumentation/action_controller.rb
index abc1234..def5678 100644
--- a/lib/instana/frameworks/instrumentation/action_controller.rb
+++ b/lib/instana/frameworks/instrumentation/action_controller.rb
@@ -7,15 +7,38 @@ end
end
+ # The Instana wrapper method for ActionController::Base.process_action
+ # for versions 3 and 4.
+ #
def process_action_with_instana(*args)
kv_payload = { :actioncontroller => {} }
kv_payload[:actioncontroller][:controller] = self.class.name
kv_payload[:actioncontroller][:action] = action_name
::Instana.tracer.log_entry(:actioncontroller, kv_payload)
+
process_action_without_instana(*args)
rescue => e
::Instana.tracer.log_error(e)
+ raise
+ ensure
+ ::Instana.tracer.log_exit(:actioncontroller)
+ end
+
+ # This is the Rails 5 version of the method above where we use prepend to
+ # instrument the method instead of using alias_method_chain.
+ #
+ def process_action(*args)
+ kv_payload = { :actioncontroller => {} }
+ kv_payload[:actioncontroller][:controller] = self.class.name
+ kv_payload[:actioncontroller][:action] = action_name
+
+ ::Instana.tracer.log_entry(:actioncontroller, kv_payload)
+
+ super(*args)
+ rescue => e
+ ::Instana.tracer.log_error(e)
+ raise
ensure
::Instana.tracer.log_exit(:actioncontroller)
end
|
Add ActionPack 5 instrumentation support via prepend
|
diff --git a/cssminify.rb b/cssminify.rb
index abc1234..def5678 100644
--- a/cssminify.rb
+++ b/cssminify.rb
@@ -1,19 +1,16 @@ class CSS
-
- def initialize(file_name)
- @file_name = file_name
+ def initialize(file)
+ @file_name = file
+ @file_name_min = file.clone.gsub(/(.css)/, "")
+ clean_file
end
- def open_file
- @css = File.open(@file_name, "r+").each_line do |line|
- minify(line)
+ def clean_file
+ @mincss = File.open("#{@file_name_min}.min.css", "w")
+ File.open(@file_name, "r") do |line|
+ line.each_line { |f| @mincss.puts(f.gsub(/\s+/, ""))}
end
end
-
- def minify(line)
- minified = line.gsub(/\s+/, "")
- end
end
-
# Edit 'style.css' to your CSS file name.
-stylesheet = CSS.new('style.css')+CSS::new('style.css')
|
Fix file issue, thanks johncausey
|
diff --git a/config/initializers/new_framework_defaults.rb b/config/initializers/new_framework_defaults.rb
index abc1234..def5678 100644
--- a/config/initializers/new_framework_defaults.rb
+++ b/config/initializers/new_framework_defaults.rb
@@ -18,6 +18,3 @@
# Require `belongs_to` associations by default. Previous versions had false.
# Rails.application.config.active_record.belongs_to_required_by_default = false
-
-# Do not halt callback chains when a callback returns false. Previous versions had true.
-ActiveSupport.halt_callback_chains_on_return_false = true
|
Change to default halt_callback_chains_on_return_false option
This will make it easier to migrate to Rails 5.2 since this option
has no affect now and it gets fully removed then.
|
diff --git a/lib/active_set/processor_sort/enumerable_adapter.rb b/lib/active_set/processor_sort/enumerable_adapter.rb
index abc1234..def5678 100644
--- a/lib/active_set/processor_sort/enumerable_adapter.rb
+++ b/lib/active_set/processor_sort/enumerable_adapter.rb
@@ -35,12 +35,16 @@ def sortable_attribute_for(item)
value = instruction.value_for(item: item)
- return value.to_s.downcase if case_insensitive?
+ return value.to_s.downcase if case_insensitive?(value)
value
end
- def case_insensitive?
+ def case_insensitive?(value)
+ # Cannot sort pure Booleans or Nils, so we _must_ cast to Strings
+ return true if value.is_a?(TrueClass) || value.is_a?(FalseClass)
+ return true if value.is_a?(NilClass)
+
instruction.operator.to_s.downcase == 'i'
end
|
Handle booleans and nils in the sort enumerable adapter
|
diff --git a/delete_at.rb b/delete_at.rb
index abc1234..def5678 100644
--- a/delete_at.rb
+++ b/delete_at.rb
@@ -18,7 +18,7 @@
index = arguments[1]
- if not index.match(/^\d+$/)
+ if index.is_a?(String) and not index.match(/^\d+$/)
raise(Puppet::ParseError, 'delete_at(): You must provide ' +
'positive numeric index')
end
|
Make sure that we have string-encoded integer value.
Signed-off-by: Krzysztof Wilczynski <9bf091559fc98493329f7d619638c79e91ccf029@linux.com>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.