diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/spec/unit/active_node/node_list_formatter_spec.rb b/spec/unit/active_node/node_list_formatter_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/active_node/node_list_formatter_spec.rb
+++ b/spec/unit/active_node/node_list_formatter_spec.rb
@@ -5,13 +5,13 @@ subject { described_class.new(list, max_elements) }
context 'when the list length is greater than `max_elements`' do
- let(:list) { Array.new(10) { |i| i } }
+ let(:list) { (0...10).to_a }
its(:inspect) { is_expected.to eq '[0, 1, 2, 3, 4, ...]' }
end
context 'when the list length is less or equal than `max_elements`' do
- let(:list) { Array.new(5) { |i| i } }
+ let(:list) { (0...5).to_a }
its(:inspect) { is_expected.to eq '[0, 1, 2, 3, 4]' }
end
|
Fix minor code style issue.
|
diff --git a/chef-api.gemspec b/chef-api.gemspec
index abc1234..def5678 100644
--- a/chef-api.gemspec
+++ b/chef-api.gemspec
@@ -11,7 +11,7 @@ spec.description = 'A tiny Chef API client with minimal dependencies'
spec.summary = 'A Chef API client in Ruby'
spec.homepage = 'https://github.com/sethvargo/chef-api'
- spec.license = 'Apache 2.0'
+ spec.license = 'Apache-2.0'
spec.required_ruby_version = '>= 2.2'
|
Use a SPDX compliant license string
Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
|
diff --git a/lib/job_board/app.rb b/lib/job_board/app.rb
index abc1234..def5678 100644
--- a/lib/job_board/app.rb
+++ b/lib/job_board/app.rb
@@ -21,7 +21,8 @@ JSON.dump(
greeting: 'hello, human 👋!',
pong: JobBoard.redis.ping.to_s,
- now: pg_now
+ now: pg_now,
+ version: JobBoard.version
)
]
end
|
Include version in `GET /` metadata
|
diff --git a/lib/tasks/tmp_migrate_hmrc_manuals_from_live_to_beta.rake b/lib/tasks/tmp_migrate_hmrc_manuals_from_live_to_beta.rake
index abc1234..def5678 100644
--- a/lib/tasks/tmp_migrate_hmrc_manuals_from_live_to_beta.rake
+++ b/lib/tasks/tmp_migrate_hmrc_manuals_from_live_to_beta.rake
@@ -0,0 +1,15 @@+desc "Migrate HMRC manuals from live to beta"
+task tmp_migrate_hmrc_manuals_from_live_to_beta: :environment do
+ hmrc_manuals = Document.presented.where(editions: { publishing_app: "hmrc-manuals-api" })
+
+ hmrc_manuals.each do |document|
+ edition = document.live
+
+ next if edition.blank?
+
+ edition.update!(phase: "beta")
+ if Rails.env.production?
+ Commands::V2::RepresentDownstream.new.call(document.content_id)
+ end
+ end
+end
|
Migrate HMRC manuals from 'live' to 'beta'
HMRC manuals are rendered with a 'beta' banner due to custom logic in
Manuals Frontend, as we're migrating to Government Frontend we need to
set the phase value to persist the beta status.
There are questions around whether these pages should still be in 'beta'
but for now we need to keep the same phase.
Trello:
https://trello.com/c/sCpFwYz6/1213-migrate-hmrc-manuals-from-live-to-beta
|
diff --git a/features/step_definitions/emails.rb b/features/step_definitions/emails.rb
index abc1234..def5678 100644
--- a/features/step_definitions/emails.rb
+++ b/features/step_definitions/emails.rb
@@ -34,4 +34,4 @@ randomString = SecureRandom.hex
@email_address = randomString + '@example.com'
puts "Email address: #{@email_address}"
-end+end
|
Add line terminator at end of file
|
diff --git a/spec/parsley/curb_downloader_spec.rb b/spec/parsley/curb_downloader_spec.rb
index abc1234..def5678 100644
--- a/spec/parsley/curb_downloader_spec.rb
+++ b/spec/parsley/curb_downloader_spec.rb
@@ -5,7 +5,7 @@ headers = double(:headers)
headers.should_receive(:[]=).with('User-Agent', :something)
- yield_options = double(:options)
+ yield_options = double(:options).as_null_object
yield_options.should_receive(:headers).and_return(headers)
curl = double.as_null_object
@@ -17,7 +17,7 @@ end
it 'passes cookies to curl request' do
- setup = double(:setup)
+ setup = double(:setup).as_null_object
setup.should_receive(:cookies=).with('sid=123; abc=321;')
curl = double.as_null_object
@@ -29,7 +29,7 @@ end
it 'passes ssl_verify_peer to curl request' do
- setup = double(:setup)
+ setup = double(:setup).as_null_object
setup.should_receive(:ssl_verify_peer=).with(false)
curl = double.as_null_object
|
Fix tests broken by ipv4 resolve mode
|
diff --git a/lib/rspec/junklet.rb b/lib/rspec/junklet.rb
index abc1234..def5678 100644
--- a/lib/rspec/junklet.rb
+++ b/lib/rspec/junklet.rb
@@ -2,8 +2,9 @@ require_relative "./junklet/junk"
require_relative "./junklet/junklet"
+# Automatically hook into RSpec when you `include "rspec-junklet"`
RSpec.configure do |config|
- config.extend(RSpec::Junklet::Junklet)
- config.extend(RSpec::Junklet::Junk) # when metaprogramming cases, you may need junk in ExampleGroups
- config.include(RSpec::Junklet::Junk)
+ config.extend(RSpec::Junklet::Junklet) # This lets us say junklet() in describes and contexts
+ config.extend(RSpec::Junklet::Junk) # This lets us say junk() in describes and contexts
+ config.include(RSpec::Junklet::Junk) # This lets us say junk() in lets
end
|
Add comments to better document RSpec includes and extends
|
diff --git a/lib/skr/extension.rb b/lib/skr/extension.rb
index abc1234..def5678 100644
--- a/lib/skr/extension.rb
+++ b/lib/skr/extension.rb
@@ -1,5 +1,4 @@ require 'lanes/access/extension'
-
module Skr
class Extension < Lanes::Extensions::Definition
@@ -8,7 +7,10 @@ title "Stockor"
root_path Pathname.new(__FILE__).dirname.join("..","..").expand_path
- components 'record-finder', 'select-field'
+ components 'record-finder', 'select-field', 'calendar'
+ client_js_aliases({
+ 'SC' => 'window.Lanes.Skr.Components'
+ })
def client_bootstrap_data(view)
gl_accounts = Skr::GlAccount.all.as_json
@@ -25,3 +27,5 @@ end
end
+
+require 'skr'
|
Set SC alias to Skr.Components
|
diff --git a/app/controllers/list_controller.rb b/app/controllers/list_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/list_controller.rb
+++ b/app/controllers/list_controller.rb
@@ -1,5 +1,6 @@ class ListController < ApplicationController
def index
+ @lists = List.all
end
def new
|
Make @lists available to index.html.erb
|
diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/main_controller.rb
+++ b/app/controllers/main_controller.rb
@@ -1,5 +1,8 @@ class MainController < ApplicationController
def home
+ if params[:debug]
+ render :json => request.env.inspect and return
+ end
end
def dependencies
|
Add debug flag for debugging https
|
diff --git a/app/importers/behavior_importer.rb b/app/importers/behavior_importer.rb
index abc1234..def5678 100644
--- a/app/importers/behavior_importer.rb
+++ b/app/importers/behavior_importer.rb
@@ -8,15 +8,18 @@
def import_row(row)
student = Student.where(local_id: row[:local_id]).first_or_create!
- event_date = row[:event_date]
- incident_time = row[:incident_time]
- if event_date.present?
- event_date += (" " + incident_time) if incident_time.present?
+ if row[:event_date].present?
+ event_date = row[:event_date].to_datetime
+ if row[:incident_time].present?
+ incident_time = Time.parse(row[:incident_time])
+ event_date += incident_time.hour.hours
+ event_date += incident_time.min.minutes
+ end
discipline_incident = DisciplineIncident.where(
student_id: student.id,
incident_code: row[:incident_code],
- event_date: event_date.to_datetime,
+ event_date: event_date,
has_exact_time: incident_time.present?
).first_or_create!
discipline_incident.assign_attributes(
|
Update behavior importer to handle dates/times that are already parsed by CsvTransformer
|
diff --git a/application.rb b/application.rb
index abc1234..def5678 100644
--- a/application.rb
+++ b/application.rb
@@ -7,4 +7,7 @@ get '/' do
erb :index
end
+ get '/about' do
+ erb :about
+ end
end
|
Add about page in Sinatra actions
|
diff --git a/spec/pragma/operation/base_spec.rb b/spec/pragma/operation/base_spec.rb
index abc1234..def5678 100644
--- a/spec/pragma/operation/base_spec.rb
+++ b/spec/pragma/operation/base_spec.rb
@@ -21,8 +21,4 @@ it 'runs correctly' do
expect(result).to be_success
end
-
- it 'sets up a default response' do
- expect(result['result.response']).to be_instance_of(Pragma::Operation::Response)
- end
end
|
Remove old default response test
|
diff --git a/lib/gimei.rb b/lib/gimei.rb
index abc1234..def5678 100644
--- a/lib/gimei.rb
+++ b/lib/gimei.rb
@@ -13,6 +13,8 @@
def_delegators :@name, :kanji, :hiragana, :katakana, :first, :last, :male?, :female?
alias_method :to_s, :kanji
+
+ attr_reader :name, :address
class << self
extend Forwardable
@@ -39,5 +41,6 @@
def initialize(gender = nil)
@name = Name.new(gender)
+ @address = Address.new
end
end
|
Enable access to Name and Address from Gimei object
|
diff --git a/lib/guide.rb b/lib/guide.rb
index abc1234..def5678 100644
--- a/lib/guide.rb
+++ b/lib/guide.rb
@@ -1,6 +1,10 @@ require 'restaurant'
class Guide
+ class Config
+ @@actions = ['list', 'find', 'add', 'quit']
+ def self.actions; @@actions; end
+ end
def initialize(path = nil)
# locate the restaurant text file at path
@@ -23,14 +27,23 @@ # action loop
result = nil
until result == :quit
- # what do you want to do? (list, find, add, quit)
- print "> "
- user_response = gets.chomp
- # do that action
- result = do_action user_response
+ action = get_action
+ result = do_action action
end
# conclusion
conclusion
+ end
+
+ def get_action
+ action = nil
+ # Keep asking for user input until we get a valid action
+ until Guide::Config.actions.include? action
+ puts "Actions: " + Guide::Config.actions.join(", ") if action
+ print "> "
+ user_response = gets.chomp
+ action = user_response.downcase.strip
+ end
+ return action
end
def do_action(action)
|
Refactor launch! method to separate part of code to get_action method
|
diff --git a/db/migrate/20130615214912_add_name_to_apn_app.rb b/db/migrate/20130615214912_add_name_to_apn_app.rb
index abc1234..def5678 100644
--- a/db/migrate/20130615214912_add_name_to_apn_app.rb
+++ b/db/migrate/20130615214912_add_name_to_apn_app.rb
@@ -0,0 +1,6 @@+class AddNameToApnApp < ActiveRecord::Migration
+ def change
+ add_column :apn_apps, :name, :string, :unique => true
+ add_index :apn_apps, :name, :unique => true
+ end
+end
|
Add column in apn app table to identify an application
|
diff --git a/lib/apiary/command/runner.rb b/lib/apiary/command/runner.rb
index abc1234..def5678 100644
--- a/lib/apiary/command/runner.rb
+++ b/lib/apiary/command/runner.rb
@@ -5,7 +5,7 @@ class Runner
def self.run(cmd, options)
- Apiary::Command.const_get(cmd.capitalize).send(:execute, options)
+ Apiary::Command.const_get(cmd.to_s.capitalize).send(:execute, options)
end
end
|
Fix -v/--version option in Ruby 1.8.7
|
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
@@ -19,11 +19,11 @@ end
property :error, coerce: String
- property :errors, coerce: Openlogi::Errors
+ property :errors, coerce: Openlogi::Errors, default: {}
property :error_description, coerce: String
def valid?
- error.nil? && (errors.nil? || errors.empty?)
+ error.nil? && errors.empty?
end
end
end
|
Set default value for errors so that it is never nil
|
diff --git a/lib/minty.rb b/lib/minty.rb
index abc1234..def5678 100644
--- a/lib/minty.rb
+++ b/lib/minty.rb
@@ -6,15 +6,18 @@
class DataCite
- def initialize(endpoint = 'http://test.datacite.com')
- @endpoint = endpoint
+ def initialize(endpoint = 'http://test.datacite.com', user = nil, pass = nil)
+ @endpoint = RestClient::Resource.new(endpoint, user, pass)
end
def resolve(doi)
- response = RestClient.get "#{@endpoint}/doi/#{doi}"
- response.to_str
+ response = @endpoint["doi/#{doi}"].get
end
+ def mint(doi, url)
+ response = @endpoint['doi'].post "doi=#{doi}\nurl=#{url}",
+ :content_type => 'text/plain;charset=UTF-8'
+ end
end
end
|
Add a method to mint a new DOI.
|
diff --git a/lib/backup/storage/object.rb b/lib/backup/storage/object.rb
index abc1234..def5678 100644
--- a/lib/backup/storage/object.rb
+++ b/lib/backup/storage/object.rb
@@ -24,7 +24,7 @@ # descending. The newest backup storage object comes in Backup::Storage::Object.load[0]
# and the oldest in Backup::Storage::Object.load[-1]
def load
- if File.exist?(storage_file)
+ if File.exist?(storage_file) && !File.zero?(storage_file)
YAML.load_file(storage_file).sort { |a,b| b.time <=> a.time }
else
[]
|
Check if config file is empty before attempting to read it.
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -4,5 +4,6 @@ post '/items', to: 'items#create'
get '/items/:id', to: 'items#show', as: 'item'
get '/items/:id/edit', to: 'items#edit'
+ patch '/items/:id', to: 'items#update'
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
|
Create patch /items/:id to have ability to update item information
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -28,8 +28,6 @@
match "terms" => "text_blocks#terms"
match "about" => "text_blocks#about"
- match "imprint" => "text_blocks#imprint"
-
match "faq" => "faqs#index"
# Jasmine test engine
|
Remove unused imprint route (imprint is on the contact page).
|
diff --git a/lib/cloudflair/connection.rb b/lib/cloudflair/connection.rb
index abc1234..def5678 100644
--- a/lib/cloudflair/connection.rb
+++ b/lib/cloudflair/connection.rb
@@ -12,22 +12,29 @@ new_faraday_from config
end
- def self.headers
- {}.tap do |request_headers|
- cloudflare_auth_config = Cloudflair.config.cloudflare.auth
+ def self.headers # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
+ cloudflare_auth_config = Cloudflair.config.cloudflare.auth
- if !(cloudflare_auth_config.key.nil? || cloudflare_auth_config.email.nil?)
- request_headers['X-Auth-Key'] = cloudflare_auth_config.key
- request_headers['X-Auth-Email'] = cloudflare_auth_config.email
- elsif !cloudflare_auth_config.user_service_key.nil?
- request_headers['Authorization'] = "Bearer #{cloudflare_auth_config.user_service_key}"
- else
- raise CloudflairError, 'Neither email & key nor user_service_key have been defined.'
- end
+ if !cloudflare_auth_config.key.nil? && !cloudflare_auth_config.email.nil?
+ return({
+ 'X-Auth-Key' => cloudflare_auth_config.key,
+ 'X-Auth-Email' => cloudflare_auth_config.email
+ })
end
+
+ unless cloudflare_auth_config.user_service_key.nil?
+ return({
+ 'Authorization' => "Bearer #{cloudflare_auth_config.user_service_key}"
+ })
+ end
+
+ raise(
+ CloudflairError,
+ 'Neither email & key nor user_service_key have been defined.'
+ )
end
- private_class_method def self.new_faraday_from(config)
+ private_class_method def self.new_faraday_from(config) # rubocop:disable Metrics/AbcSize
Faraday.new(url: config.cloudflare.api_base_url, headers: headers) do |faraday|
faraday.request :json
faraday.response config.faraday.logger if config.faraday.logger
|
Address PR comments and use more guard-clause-like structure.
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -26,6 +26,6 @@
resources :audiences
resources :guides, :only => [:show]
-
- match '/:path(/:part)', :to => GuidesFrontEnd::App
+
+ match '/:path(/:part)', :to => GuidesFrontEnd::App, :constraints => {:path => /[^(auth)]/}
end
|
Fix login bug that was introduced when we added the public front end
|
diff --git a/scs.rb b/scs.rb
index abc1234..def5678 100644
--- a/scs.rb
+++ b/scs.rb
@@ -10,6 +10,9 @@ bottle do
root_url 'https://juliabottles.s3.amazonaws.com'
cellar :any
+ sha1 "f91d0d48c370f38bc98cf3e0943ec31aba898ee5" => :yosemite
+ sha1 "7d6dc861d422fae60b152e11ec6182083e4aeec2" => :mavericks
+ sha1 "e75ff42a4e7d15450783cd17fafc22cf9d151491" => :mountain_lion
end
def install
|
Add new 32 and 64-bit SCS dylibs to SCS formula
|
diff --git a/lib/comp_player.rb b/lib/comp_player.rb
index abc1234..def5678 100644
--- a/lib/comp_player.rb
+++ b/lib/comp_player.rb
@@ -1,4 +1,4 @@-require 'pry'
+$: << File.dirname(__FILE__)
class CompPlayer
|
Add file to load path
|
diff --git a/auth/app/models/order_decorator.rb b/auth/app/models/order_decorator.rb
index abc1234..def5678 100644
--- a/auth/app/models/order_decorator.rb
+++ b/auth/app/models/order_decorator.rb
@@ -1,4 +1,4 @@-Order.class_eval do
+Spree::Order.class_eval do
token_resource
# Associates the specified user with the order and destroys any previous association with guest user if
|
Fix Order reference in OrderDecorator
|
diff --git a/lib/friendly_id/migration.rb b/lib/friendly_id/migration.rb
index abc1234..def5678 100644
--- a/lib/friendly_id/migration.rb
+++ b/lib/friendly_id/migration.rb
@@ -14,9 +14,8 @@ t.string :scope
t.datetime :created_at
end
- add_index :friendly_id_slugs, :sluggable_id
+ add_index :friendly_id_slugs, [:sluggable_type, :sluggable_id]
add_index :friendly_id_slugs, [:slug, :sluggable_type], length: { slug: 140, sluggable_type: 50 }
add_index :friendly_id_slugs, [:slug, :sluggable_type, :scope], length: { slug: 70, sluggable_type: 50, scope: 70 }, unique: true
- add_index :friendly_id_slugs, :sluggable_type
end
end
|
Use composite index for queries by sluggable
A sluggable_id index alone isn't much use since the id only makes since in the context of a sluggable_type. This allows for much faster look ups (and better query planning) when searching by a sluggable.
|
diff --git a/lib/instagram_integration.rb b/lib/instagram_integration.rb
index abc1234..def5678 100644
--- a/lib/instagram_integration.rb
+++ b/lib/instagram_integration.rb
@@ -1,10 +1,10 @@ require 'net/http'
require 'uri'
+require 'nokogiri'
class InstagramIntegration
def media
- edges_array = response_object.graphql.user.edge_owner_to_timeline_media.edges
- edges_array.map do |edge|
+ entry_point(response_object).map do |edge|
item = edge.node
OpenStruct.new(
created_at: DateTime.strptime(item.taken_at_timestamp.to_s, '%s'),
@@ -18,11 +18,19 @@
def response_object
response = Net::HTTP.get_response(url)
- JSON.parse(response.body, object_class: OpenStruct) if response.code.to_i == 200
+ if response.code.to_i == 200
+ page = Nokogiri::HTML(response.body)
+ data_string = page.css('body script')[0].text.gsub('window._sharedData = ', '').chop
+ JSON.parse(data_string, object_class: OpenStruct)
+ end
+ end
+
+ def entry_point(data)
+ data.entry_data['ProfilePage'][0].graphql.user.edge_owner_to_timeline_media.edges
end
def url
- URI.parse("https://www.instagram.com/#{ENV['INSTAGRAM_USERNAME']}/?__a=1")
+ URI.parse("https://www.instagram.com/#{ENV['INSTAGRAM_USERNAME']}/")
end
def image_link(code, source)
|
Fix getting JSON data from Instagram again
|
diff --git a/lib/lysergide/application.rb b/lib/lysergide/application.rb
index abc1234..def5678 100644
--- a/lib/lysergide/application.rb
+++ b/lib/lysergide/application.rb
@@ -5,7 +5,7 @@
class Lysergide::Application < Sinatra::Base
set :server, :webrick
- set :views, settings.root + '/../../views'
- set :public_folder, settings.root + '/../../static'
+ set :root, File.dirname(__FILE__) + '/../../'
+ set :public_folder, 'static'
enable :static
end
|
Set sinatra root to correct value
|
diff --git a/lib/microspec/expectation.rb b/lib/microspec/expectation.rb
index abc1234..def5678 100644
--- a/lib/microspec/expectation.rb
+++ b/lib/microspec/expectation.rb
@@ -24,7 +24,7 @@ end
def method_missing(method, *expected, &block)
- unless !!@_boolean == !!@_actual.send(method, *expected)
+ unless @_boolean == !!@_actual.send(method, *expected)
raise Flunked.new "failed #{@_type}", actual: @_actual, method: method, expected: expected
end
|
Remove double bang from a guaranteed boolean
|
diff --git a/lib/onesignal/http_client.rb b/lib/onesignal/http_client.rb
index abc1234..def5678 100644
--- a/lib/onesignal/http_client.rb
+++ b/lib/onesignal/http_client.rb
@@ -9,6 +9,7 @@ @app_id = app_id
@connection = Faraday.new(url: URL) do |connection|
connection.request :json
+ connection.request :retry
connection.response :json, content_type: /\bjson$/
connection.adapter Faraday.default_adapter
connection.response :logger, log, bodies: true
|
Add retry middleware to Faraday connection
Closes #33
By default, it retries 2 times and handles only timeout exceptions
https://github.com/lostisland/faraday/blob/master/lib/faraday/request/retry.rb
|
diff --git a/publify_amazon_sidebar/spec/models/amazon_sidebar_spec.rb b/publify_amazon_sidebar/spec/models/amazon_sidebar_spec.rb
index abc1234..def5678 100644
--- a/publify_amazon_sidebar/spec/models/amazon_sidebar_spec.rb
+++ b/publify_amazon_sidebar/spec/models/amazon_sidebar_spec.rb
@@ -1,8 +1,8 @@ require 'rails_helper'
RSpec.describe AmazonSidebar do
- describe 'without constructor parameters' do
- let(:sidebar) { AmazonSidebar.new }
+ describe 'when using default values for its properties' do
+ let(:sidebar) { AmazonSidebar.new(blog: Blog.new) }
it "title should be 'Cited books'" do
expect(sidebar.title).to eq('Cited books')
@@ -27,11 +27,12 @@ end
end
- describe 'with constructor parameters' do
+ describe 'when overriding the defaults' do
it 'gets attributes set correctly' do
sb = AmazonSidebar.new(title: 'Books',
associate_id: 'justasummary-21',
- maxlinks: 3)
+ maxlinks: 3,
+ blog: Blog.new)
expect(sb).to be_valid
expect(sb.title).to eq('Books')
expect(sb.associate_id).to eq('justasummary-21')
|
Make specs pass with publify_core 9.0.0.pre5
|
diff --git a/lib/omnic/ext/integer_ext.rb b/lib/omnic/ext/integer_ext.rb
index abc1234..def5678 100644
--- a/lib/omnic/ext/integer_ext.rb
+++ b/lib/omnic/ext/integer_ext.rb
@@ -4,6 +4,7 @@
module IntegerExt
def format_currency
- '$' + to_s.reverse.scan(/(\d*\.\d{1,3}|\d{1,3})/).join(',').reverse
+ neg = negative? ? '-' : ''
+ "#{neg}$" + to_s.reverse.scan(/(\d*\.\d{1,3}|\d{1,3})/).join(',').reverse
end
end
|
Support for displaying negative numbers when formatting currency
|
diff --git a/spec/features/projects/project_settings_spec.rb b/spec/features/projects/project_settings_spec.rb
index abc1234..def5678 100644
--- a/spec/features/projects/project_settings_spec.rb
+++ b/spec/features/projects/project_settings_spec.rb
@@ -0,0 +1,41 @@+require 'spec_helper'
+
+describe 'Edit Project Settings', feature: true do
+ let(:user) { create(:user) }
+ let(:project) { create(:empty_project, path: 'gitlab', name: 'sample') }
+
+ before do
+ login_as(user)
+ project.team << [user, :master]
+ end
+
+ describe 'Project settings', js: true do
+ it 'shows errors for invalid project name' do
+ visit edit_namespace_project_path(project.namespace, project)
+
+ fill_in 'project_name_edit', with: 'foo&bar'
+
+ click_button 'Save changes'
+
+ expect(page).to have_field 'project_name_edit', with: 'foo&bar'
+ expect(page).to have_content "Name can contain only letters, digits, '_', '.', dash and space. It must start with letter, digit or '_'."
+ expect(page).to have_button 'Save changes'
+ end
+ end
+
+ describe 'Rename repository' do
+ it 'shows errors for invalid project path/name' do
+ visit edit_namespace_project_path(project.namespace, project)
+
+ fill_in 'Project name', with: 'foo&bar'
+ fill_in 'Path', with: 'foo&bar'
+
+ click_button 'Rename project'
+
+ expect(page).to have_field 'Project name', with: 'sample'
+ expect(page).to have_field 'Path', with: 'gitlab'
+ expect(page).to have_content "Name can contain only letters, digits, '_', '.', dash and space. It must start with letter, digit or '_'."
+ expect(page).to have_content "Path can contain only letters, digits, '_', '-' and '.'. Cannot start with '-', end in '.git' or end in '.atom'"
+ end
+ end
+end
|
Add feature specs for edit project settings
|
diff --git a/spec/integration/commands/account/setup_spec.rb b/spec/integration/commands/account/setup_spec.rb
index abc1234..def5678 100644
--- a/spec/integration/commands/account/setup_spec.rb
+++ b/spec/integration/commands/account/setup_spec.rb
@@ -1,29 +1,51 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
describe "account:setup command" do
-
+
+ def cli
+ @cli ||= HP::Cloud::CLI.new
+ end
+
before(:all) { setup_temp_home_directory }
context "without existing account" do
before(:all) { remove_account_files }
- it "should ask for email address"
-
- it "should ask for account id"
-
- it "should ask for secret key"
-
- it "should provide option to set endpoint"
-
- it "should provide default endpoint"
-
- it "should validate account"
+ it "should ask for account id, account key and endpoint" do
+ $stdout.should_receive(:print).with('Account ID: ')
+ $stdin.should_receive(:gets).and_return('account:user')
+ $stdout.should_receive(:print).with('Account Key: ')
+ $stdin.should_receive(:gets).and_return('pass')
+ $stdout.should_receive(:print).with('Storage API Auth Uri: [https://region-a.geo-1.objects.hpcloudsvc.com/auth/v1.0/] ')
+ $stdin.should_receive(:gets).and_return('https://127.0.0.1/')
+ $stdout.should_receive(:print).with('Error connecting to the service endpoint at: https://127.0.0.1/. ')
+ begin
+ cli.send('account:setup')
+ rescue SystemExit => system_exit # catch any exit calls
+ exit_status = system_exit.status
+ end
+ end
+
+ it "should provide default endpoint and validate endpoint" do
+ $stdout.should_receive(:print).with('Account ID: ')
+ $stdin.should_receive(:gets).and_return('account:user')
+ $stdout.should_receive(:print).with('Account Key: ')
+ $stdin.should_receive(:gets).and_return('pass')
+ $stdout.should_receive(:print).with('Storage API Auth Uri: [https://region-a.geo-1.objects.hpcloudsvc.com/auth/v1.0/] ')
+ $stdin.should_receive(:gets).and_return('https://region-a.geo-1.objects.hpcloudsvc.com/auth/v1.0/')
+ $stdout.should_receive(:print).with('Error connecting to the service endpoint at: https://region-a.geo-1.objects.hpcloudsvc.com/auth/v1.0/. ')
+ begin
+ cli.send('account:setup')
+ rescue SystemExit => system_exit # catch any exit calls
+ exit_status = system_exit.status
+ end
+ end
context "when successful" do
it "should create account credential file"
-
+
end
end
|
Add specs for account credential creation.
|
diff --git a/lib/goblin/book.rb b/lib/goblin/book.rb
index abc1234..def5678 100644
--- a/lib/goblin/book.rb
+++ b/lib/goblin/book.rb
@@ -6,8 +6,7 @@ attr_reader :sheets
def initialize(file, &block)
- @file = file
- @files = Zip::ZipFile.open(@file)
+ @files = Zip::ZipFile.open(file)
@content = Nokogiri::XML(@files.read("content.xml"))
@sheets = @content.xpath("//table:table")
|
Use local variable(file) instead of instance variable(@file)
|
diff --git a/lib/hets/caller.rb b/lib/hets/caller.rb
index abc1234..def5678 100644
--- a/lib/hets/caller.rb
+++ b/lib/hets/caller.rb
@@ -26,25 +26,35 @@ end
def perform(api_uri, method = :get)
- raise NotImplementedError, 'No HTTP-Verb other than GET supported' unless method == :get
- get_caller = performing_instance(api_uri)
- get_caller.call(http_result_options)
+ caller = performing_instance(api_uri, method)
+ caller.call(http_result_options)
end
def http_result_options
TEMPFILE_RESPONSE
end
- def performing_instance(api_uri)
- get_caller = GetCaller.new(api_uri)
- get_caller.has_actual_content_through do |response|
+ def performing_instance(api_uri, method)
+ caller = caller_class(method).new(api_uri)
+ caller.has_actual_content_through do |response|
has_actual_content?(response)
end
- get_caller
+ caller
end
def has_actual_content?(response)
response.is_a?(Net::HTTPSuccess)
end
+
+ def caller_class(method)
+ case method
+ when :get
+ GetCaller
+ when :post
+ PostCaller
+ else
+ raise NotImplementedError, 'No HTTP-Verb other than GET, POST supported'
+ end
+ end
end
end
|
Select PostCaller on `:post` method.
|
diff --git a/spec/rubocop/cop/internal_affairs/useless_message_assertion_spec.rb b/spec/rubocop/cop/internal_affairs/useless_message_assertion_spec.rb
index abc1234..def5678 100644
--- a/spec/rubocop/cop/internal_affairs/useless_message_assertion_spec.rb
+++ b/spec/rubocop/cop/internal_affairs/useless_message_assertion_spec.rb
@@ -9,6 +9,18 @@ inspect_source(cop, 'foo')
expect(cop.messages).to eq([described_class::MSG])
^^^^^^^^^^^^^^^^^^^^ Do not specify cop behavior using `described_class::MSG`.
+ end
+ RUBY
+ end
+
+ it 'registers an offense for specs that expect offense using the MSG' do
+ expect_offense(<<~'RUBY', 'example_spec.rb')
+ it 'uses described_class::MSG to expect offense' do
+ expect_offense(<<-SOURCE.strip_indent('|'))
+ | foo
+ | ^^^ #{described_class::MSG}
+ ^^^^^^^^^^^^^^^^^^^^ Do not specify cop behavior using `described_class::MSG`.
+ SOURCE
end
RUBY
end
|
Add internal spec case for expect_offense with described_class::MSG
Detect specs using the new expect_offense syntax with described_class::MSG.
NOTE: Using strip_indent for the inner heredoc to prevent its annotation
being recognised at the outer level.
|
diff --git a/lib/whatsapp/request/code.rb b/lib/whatsapp/request/code.rb
index abc1234..def5678 100644
--- a/lib/whatsapp/request/code.rb
+++ b/lib/whatsapp/request/code.rb
@@ -6,7 +6,7 @@ class Code < WhatsApp::Request::Base
IDENTITY = 'abcdef0123456789'
- def initialize(country_code, number, method = 'sms', language = 'en', locale = 'EN', mnc = '000', mcc = '000', reason = '')
+ def initialize(country_code, number, method = 'sms', options = {})
super()
self.url = 'https://v.whatsapp.net/v2/code'
@@ -15,12 +15,12 @@ cc: country_code,
in: number,
id: IDENTITY,
- lg: language,
- lc: locale,
- mnc: mnc,
- mcc: mcc,
+ lg: options[:language] || 'en',
+ lc: (options[:locale] || 'EN').to_s.upcase,
+ mnc: (options[:mnc] || '000').to_s.rjust(3, ?0),
+ mcc: (options[:mcc] || '000').to_s.rjust(3, ?0),
method: method,
- reason: reason,
+ reason: options[:reason] || '',
token: token(number.to_s)
}
end
|
Change named parameters to options hash
|
diff --git a/lib/powerschool.rb b/lib/powerschool.rb
index abc1234..def5678 100644
--- a/lib/powerschool.rb
+++ b/lib/powerschool.rb
@@ -23,9 +23,15 @@ end
end
- get :districts, '/district'
- get :schools, '/school'
+ # client is set up per district so it returns only one district
+ # for urls with parameters
+ get :district, '/district'
+ get :schools, '/district/school'
get :teachers, '/staff'
- get :students, '/students'
+ get :students, '/student'
get :sections, '/section'
+ get :school_sections, '/school/:school_id/section'
+ get :school_students, '/school/:school_id/student'
+
+ get :metadata, '/metadata'
end
|
Add a few more routes
|
diff --git a/lib/rack/livejs.rb b/lib/rack/livejs.rb
index abc1234..def5678 100644
--- a/lib/rack/livejs.rb
+++ b/lib/rack/livejs.rb
@@ -31,7 +31,7 @@ end
def inject_livejs(html)
- html.sub(%r{(<head( [^>]*)?>)}i) { $1 + %{<script src="#{bundled_livejs_path}"/>} }
+ html.sub(%r{(<head( [^>]*)?>)}i) { $1 + %{<script src="#{bundled_livejs_path}"></script>} }
end
def bundled_livejs_prefix
|
Make sure script tag is valid syntax
This was breaking layout for me in chrome and safari
|
diff --git a/net-ntp-next.gemspec b/net-ntp-next.gemspec
index abc1234..def5678 100644
--- a/net-ntp-next.gemspec
+++ b/net-ntp-next.gemspec
@@ -17,5 +17,9 @@ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.require_paths = ['lib']
- gem.add_dependency('net-ntp', '>= 2.1.1')
+ gem.add_dependency 'net-ntp', '>= 2.1.1'
+ gem.add_development_dependency 'rspec'
+ gem.add_development_dependency 'simplecov'
+ gem.add_development_dependency 'yard'
+ gem.add_development_dependency 'redcarpet'
end
|
Add development dependencies to gemspec
|
diff --git a/lib/tango/fetch.rb b/lib/tango/fetch.rb
index abc1234..def5678 100644
--- a/lib/tango/fetch.rb
+++ b/lib/tango/fetch.rb
@@ -2,7 +2,7 @@ module Fetch
def fetch(url)
- shell("wget", "--progress=bar:force", "--continue", url)
+ shell("curl", "-O", "-C", "-", "--progress-bar", url)
end
end
|
Use curl rather than wget.
It's on both OS X and Ubuntu boxes by default.
|
diff --git a/lib/tasks/eve.rake b/lib/tasks/eve.rake
index abc1234..def5678 100644
--- a/lib/tasks/eve.rake
+++ b/lib/tasks/eve.rake
@@ -18,4 +18,13 @@ BloodlinesImporter.new.import
end
end
+
+ desc 'Import EveOnline Factions'
+ task factions: :environment do
+ ActiveRecord::Base.transaction do
+ Eve::Faction.destroy_all
+
+ FactionsImporter.new.import
+ end
+ end
end
|
Add rake task for import factions
|
diff --git a/lib/timer/timer.rb b/lib/timer/timer.rb
index abc1234..def5678 100644
--- a/lib/timer/timer.rb
+++ b/lib/timer/timer.rb
@@ -13,11 +13,11 @@ end
def count_down
- @minutes.downto 1 do |i|
+ @minutes.downto 1 do |minute|
sleep 60
- puts i
- if @messages && @messages[i]
- `say #{@messages[i]}`
+ puts minute
+ if @messages && @messages[minute]
+ `say #{@messages[minute]}`
end
end
end
|
Make iteration variable express intent
|
diff --git a/app/helpers/quotes_helper.rb b/app/helpers/quotes_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/quotes_helper.rb
+++ b/app/helpers/quotes_helper.rb
@@ -1,7 +1,11 @@ module QuotesHelper
def cache_key_for_quotes
- count = Quote.count
- max_updated_at = Quote.maximum(:updated_at).utc.to_s
+ count = @quotes.count
+ max_updated_at = @quotes.maximum(:updated_at).utc.to_s
+ if @person
+ "quotes/person-#{@person.id}-#{count}-#{max_updated_at}"
+ else
"quotes/all-#{count}-#{max_updated_at}"
+ end
end
end
|
Fix cache key for person pages
|
diff --git a/engine_cart.gemspec b/engine_cart.gemspec
index abc1234..def5678 100644
--- a/engine_cart.gemspec
+++ b/engine_cart.gemspec
@@ -19,7 +19,6 @@ spec.require_paths = ["lib"]
spec.add_dependency "rails"
- spec.add_dependency "bundler", "~> 1.5"
spec.add_development_dependency "rake"
spec.add_development_dependency "rspec"
end
|
Remove a hard dependency on the bundler gem, since it is baked into ruby 2.6
|
diff --git a/app/services/build_runner.rb b/app/services/build_runner.rb
index abc1234..def5678 100644
--- a/app/services/build_runner.rb
+++ b/app/services/build_runner.rb
@@ -2,7 +2,7 @@ pattr_initialize :payload
def run
- if repo && opened_merge_request? && !runned_merge_request?
+ if repo && opened_merge_request?
repo.builds.create!(
violations: violations,
merge_request_id: payload.merge_request_id,
@@ -16,13 +16,6 @@
def opened_merge_request?
merge_request.opened?
- end
-
- def runned_merge_request?
- repo.builds.find_by(
- merge_request_id: payload.merge_request_id,
- commit_sha: merge_request.head_sha
- ).present?
end
def violations
|
Remove useless check. We have commenting policy!
|
diff --git a/config/initializers/gds-sso.rb b/config/initializers/gds-sso.rb
index abc1234..def5678 100644
--- a/config/initializers/gds-sso.rb
+++ b/config/initializers/gds-sso.rb
@@ -1,6 +1,6 @@ GDS::SSO.config do |config|
config.user_model = 'User'
- config.oauth_id = ENV['SIGNON_OAUTH_ID']
- config.oauth_secret = ENV['SIGNON_OAUTH_SECRET']
+ config.oauth_id = ENV['OAUTH_ID']
+ config.oauth_secret = ENV['OAUTH_SECRET']
config.oauth_root_url = Plek.current.find("signon")
end
|
Fix name of Signon environment variable
This isn't prefixed with `SIGNON`.
|
diff --git a/config/initializers/bower_rails.rb b/config/initializers/bower_rails.rb
index abc1234..def5678 100644
--- a/config/initializers/bower_rails.rb
+++ b/config/initializers/bower_rails.rb
@@ -8,9 +8,6 @@ # Invokes rake bower:resolve before precompilation. Defaults to false
bower_rails.resolve_before_precompile = true
- # Invokes rake bower:clean before precompilation. Defaults to false
- bower_rails.clean_before_precompile = true
-
# Invokes rake bower:install:deployment instead rake bower:install. Defaults to false
bower_rails.use_bower_install_deployment = true
#
|
Remove bower clean command due to bug
|
diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb
index abc1234..def5678 100644
--- a/config/initializers/inflections.rb
+++ b/config/initializers/inflections.rb
@@ -11,6 +11,8 @@ # end
# These inflection rules are supported but not enabled by default:
-# ActiveSupport::Inflector.inflections(:en) do |inflect|
-# inflect.acronym 'RESTful'
-# end
+ActiveSupport::Inflector.inflections(:en) do |inflect|
+ inflect.acronym 'RDF'
+end
+
+
|
Add inflection to ensure Avalon::RDFVocab works with zeitwerk
|
diff --git a/spec/stack_overflow_spec.rb b/spec/stack_overflow_spec.rb
index abc1234..def5678 100644
--- a/spec/stack_overflow_spec.rb
+++ b/spec/stack_overflow_spec.rb
@@ -4,15 +4,42 @@ include Service
describe StackOverflow, '.fetch' do
+ BASE_URL = "http://api.stackexchange.com/2.1"
+ PARAMS = "site=stackoverflow"
+
+ def url_with(resource)
+ "#{BASE_URL}/#{resource}/?#{PARAMS}"
+ end
+
+ let(:resource) { :users }
+ let(:body) { "{}" }
+ let(:endpoint) { url_with(resource) }
+
+ before { stub_request(:get, endpoint).to_return(:body => body) }
+
+ describe "requests" do
+ context "with :users resource" do
+ let(:resource) { :users }
+
+ it "hits /users/ endpoint" do
+ StackOverflow.fetch(:users)
+ a_request(:get, url_with("users")).should have_been_made
+ end
+ end
+
+ context "with :badges resource" do
+ let (:resource) { :badges }
+
+ it "hits /badges/ endpoint" do
+ StackOverflow.fetch(:badges)
+ a_request(:get, url_with("badges")).should have_been_made
+ end
+ end
+ end
+
describe "responses" do
- let(:endpoint) { "http://api.stackexchange.com/2.1/#{resource}/?site=stackoverflow" }
- let(:resource) { :users }
- let(:body) { nil }
-
- before { stub_request(:get, endpoint).to_return(:body => body) }
-
- context "with no 'items' key" do\
- let(:body) { "{}" }
+ context "with no 'items' key" do
+ before { stub_request(:get, endpoint).to_return(:body => "{}") }
specify { expect { |b| StackOverflow.fetch(resource, &b) }.to yield_with_args(nil) }
end
|
Add some tests for StackOverflow request URL patterns
|
diff --git a/spec/client/api/none_spec.rb b/spec/client/api/none_spec.rb
index abc1234..def5678 100644
--- a/spec/client/api/none_spec.rb
+++ b/spec/client/api/none_spec.rb
@@ -0,0 +1,27 @@+require 'client_helper'
+
+describe Cyclid::Client::Api::Basic do
+ context 'passing through requests' do
+ let :config do
+ dbl = instance_double(Cyclid::Client::Config)
+ allow(dbl).to receive(:auth).and_return(Cyclid::Client::AuthMethods::AUTH_NONE)
+ return dbl
+ end
+
+ let :uri do
+ URI('http://example.com/example/test')
+ end
+
+ subject do
+ Cyclid::Client::Api::None.new(config, Logger.new(STDERR))
+ end
+
+ it 'does nothing to a request' do
+ request = Net::HTTP::Get.new(uri)
+
+ api_request = nil
+ expect{ api_request = subject.authenticate_request(request, uri) }.to_not raise_error
+ expect(api_request.key?('authorization')).to be(false)
+ end
+ end
+end
|
Add a simple test for the None authenticator
|
diff --git a/scripts/bm_latency_lb_vs_mget.rb b/scripts/bm_latency_lb_vs_mget.rb
index abc1234..def5678 100644
--- a/scripts/bm_latency_lb_vs_mget.rb
+++ b/scripts/bm_latency_lb_vs_mget.rb
@@ -0,0 +1,61 @@+# Runs a mild benchmark and prints out the average time a call to 'throttle!' takes.
+
+require 'prorate'
+require 'benchmark'
+require 'redis'
+require 'securerandom'
+
+def average_ms(ary)
+ ary.map{|x| x*1000}.inject(0,&:+) / ary.length
+end
+
+r = Redis.new
+
+# 4000000.times do
+# random1 = SecureRandom.hex(10)
+# random2 = SecureRandom.hex(10)
+# r.set(random1,random2)
+# end
+
+logz = Logger.new(STDERR)
+logz.level = Logger::FATAL # block out most stuff
+
+times = []
+15.times do
+ id = SecureRandom.hex(10)
+ times << Benchmark.realtime {
+ r.evalsha('c95c5f1197cef04ec4afd7d64760f9175933e55a', [], [id, 120, 50, 10]) # values beyond 120 chosen more or less at random
+ }
+end
+
+puts average_ms times
+def key_for_ts(ts)
+ "th:%s:%d" % [@id, ts]
+end
+
+times = []
+15.times do
+ id = SecureRandom.hex(10)
+ sec, _ = r.time # Use Redis time instead of the system timestamp, so that all the nodes are consistent
+ ts = sec.to_i # All Redis results are strings
+ k = key_for_ts(ts)
+ times << Benchmark.realtime {
+ r.multi do |txn|
+ # Increment the counter
+ txn.incr(k)
+ txn.expire(k, 120)
+
+ span_start = ts - 120
+ span_end = ts + 1
+ possible_keys = (span_start..span_end).map{|prev_time| key_for_ts(prev_time) }
+
+ # Fetch all the counter values within the time window. Despite the fact that this
+ # will return thousands of elements for large sliding window sizes, the values are
+ # small and an MGET in Redis is pretty cheap, so perf should stay well within limits.
+ txn.mget(*possible_keys)
+ end
+ }
+end
+
+puts average_ms times
+
|
Add script to measure longest redis block times
|
diff --git a/spec/request/base/request_destroy_spec.rb b/spec/request/base/request_destroy_spec.rb
index abc1234..def5678 100644
--- a/spec/request/base/request_destroy_spec.rb
+++ b/spec/request/base/request_destroy_spec.rb
@@ -0,0 +1,14 @@+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe 'RubyRabbitmqJanus::RRJ' do
+ describe '.response', type: :request, level: :base, name: :destroy, destroy: false do
+ let(:type) { 'base::destroy' }
+ let(:message) { @gateway.message_session(type) }
+
+ it 'type create' do
+ expect(message.to_json).to match_json_schema(type)
+ end
+ end
+end
|
Add test for destroy request
|
diff --git a/Casks/qlmarkdown.rb b/Casks/qlmarkdown.rb
index abc1234..def5678 100644
--- a/Casks/qlmarkdown.rb
+++ b/Casks/qlmarkdown.rb
@@ -16,5 +16,5 @@ system '/usr/bin/ditto', '-xk', '--', "#{staged_path}/QLMarkdown.qlgenerator.zip", "#{staged_path}/QLMarkdown.qlgenerator"
end
- qlplugin 'QLMarkdown.qlgenerator'
+ qlplugin 'QLMarkdown.qlgenerator/QLMarkdown.qlgenerator'
end
|
Fix missing subfolder in QLMarkdown Cask
|
diff --git a/app/models/physical_server_provision_task/state_machine.rb b/app/models/physical_server_provision_task/state_machine.rb
index abc1234..def5678 100644
--- a/app/models/physical_server_provision_task/state_machine.rb
+++ b/app/models/physical_server_provision_task/state_machine.rb
@@ -16,7 +16,7 @@ end
def mark_as_completed
- update_and_notify_parent(:state => 'provisioned', :message => msg('provisioning completed'))
+ update_and_notify_parent(:state => 'finished', :message => msg('provisioning completed'))
MiqEvent.raise_evm_event(source, 'generic_task_finish', :message => "Done provisioning PhysicalServer")
signal :finish
end
|
Set task's state to "finished" eventually
We were setting task's state to "provisioned" but that is not a final
state so it doesn't get recognized by the Request which always assumes
that task's final state be "finished".
Signed-off-by: Miha Pleško <e42a14dbca5c0965023849a10306da025a317640@xlab.si>
|
diff --git a/test/hyperclient/entry_point_test.rb b/test/hyperclient/entry_point_test.rb
index abc1234..def5678 100644
--- a/test/hyperclient/entry_point_test.rb
+++ b/test/hyperclient/entry_point_test.rb
@@ -18,9 +18,8 @@ it 'creates a Faraday connection with the default block'
end
- describe 'entry' do
- it 'creates a Link with the entry point url'
- it 'returns the entry point Resource'
+ describe 'initialize' do
+ it 'sets a Link with the entry point url'
end
describe 'method missing' do
|
Fix entry point test definition
|
diff --git a/spec/lib/jwt_utils_spec.rb b/spec/lib/jwt_utils_spec.rb
index abc1234..def5678 100644
--- a/spec/lib/jwt_utils_spec.rb
+++ b/spec/lib/jwt_utils_spec.rb
@@ -20,7 +20,7 @@ describe ".decode" do
it "decodes the payload" do
expect(described_class.decode(jwt: jwt)).to match(payload: { some: "payload" },
- expiration: be_an_instance_of(Integer),
+ expiration: be_a(Integer),
version: "v1")
end
end
|
Use be_a assertion for Integer
|
diff --git a/spec/models/animal_spec.rb b/spec/models/animal_spec.rb
index abc1234..def5678 100644
--- a/spec/models/animal_spec.rb
+++ b/spec/models/animal_spec.rb
@@ -0,0 +1,23 @@+require "rails_helper"
+
+RSpec.describe Animal, :type => :model do
+ before(:all) do
+ dog = Animal.create(breed_id: 1, name: "doge", color: "gold", additional_notes: "additional notes", age: 3)
+ # cat = User.create(name: 'Bill', email: 'bill@dbc.com', password: 'password', admin: true)
+ end
+
+ context "existing pet" do
+ it "a pet has a name" do
+ expect(Animal.first.name).to eq ("doge")
+ end
+ it "a pet has an color" do
+ expect(Animal.first.color).to eq ("gold")
+ end
+ it "a pet has an age" do
+ expect(Animal.first.age).to eq 3
+ end
+ it "a pet has a additional notes" do
+ expect(Animal.first.additional_notes).to eq ("additional notes")
+ end
+ end
+end
|
Add tests for animal model
|
diff --git a/rack_hoptoad.gemspec b/rack_hoptoad.gemspec
index abc1234..def5678 100644
--- a/rack_hoptoad.gemspec
+++ b/rack_hoptoad.gemspec
@@ -0,0 +1,33 @@+# -*- encoding: utf-8 -*-
+
+Gem::Specification.new do |s|
+ s.name = %q{rack_hoptoad}
+ s.version = "0.1.7"
+
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
+ s.authors = ["Corey Donohoe"]
+ s.date = %q{2011-08-11}
+ s.description = %q{A gem that provides hoptoad notifications from rack}
+ s.email = %q{atmos@atmos.org}
+ s.extra_rdoc_files = ["LICENSE", "TODO"]
+ s.files = ["LICENSE", "README.md", "Rakefile", "TODO", "lib/rack", "lib/rack/hoptoad.rb", "lib/rack/hoptoad_version.rb", "lib/rack/hoptoad_version.rb~"]
+ s.homepage = %q{http://github.com/atmos/rack_hoptoad}
+ s.require_paths = ["lib"]
+ s.rubygems_version = %q{1.5.0}
+ s.summary = %q{A gem that provides hoptoad notifications from rack}
+
+ if s.respond_to? :specification_version then
+ s.specification_version = 3
+
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
+ s.add_runtime_dependency(%q<rack>, [">= 0"])
+ s.add_runtime_dependency(%q<toadhopper>, ["~> 2.0.0"])
+ else
+ s.add_dependency(%q<rack>, [">= 0"])
+ s.add_dependency(%q<toadhopper>, ["~> 2.0.0"])
+ end
+ else
+ s.add_dependency(%q<rack>, [">= 0"])
+ s.add_dependency(%q<toadhopper>, ["~> 2.0.0"])
+ end
+end
|
Add the gemspec to hoptoad.
|
diff --git a/spec/archloot/drop_spec.rb b/spec/archloot/drop_spec.rb
index abc1234..def5678 100644
--- a/spec/archloot/drop_spec.rb
+++ b/spec/archloot/drop_spec.rb
@@ -3,8 +3,8 @@ module Archloot
describe Drop do
let(:basic_drop) { FactoryGirl.build :drop }
- it "carries information about the drop" do
- expect(basic_drop.data).not_to be_nil
+ it "carries information about the item" do
+ expect(basic_drop.item).not_to be_nil
end
describe "#successful?" do
|
Update the spec to reflect Drop class changes
|
diff --git a/spec/script/mailin-spec.rb b/spec/script/mailin-spec.rb
index abc1234..def5678 100644
--- a/spec/script/mailin-spec.rb
+++ b/spec/script/mailin-spec.rb
@@ -0,0 +1,21 @@+require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
+require "external_command"
+
+def mailin_test(email_filename)
+ Dir.chdir Rails.root do
+ xc = ExternalCommand.new("script/mailin")
+ xc.run(load_file_fixture(email_filename))
+ xc.err.should == ""
+ return xc
+ end
+end
+
+describe "When importing mail into the application" do
+
+ it "should not produce any output and should return a 0 code on importing a plain email" do
+ r = mailin_test("incoming-request-plain.email")
+ r.status.should == 0
+ r.out.should == ""
+ end
+
+end
|
Add a spec to test that mailin does not produce any output. This is important as under some MTA configurations, any output will result in a bounce message being sent to the original mail sender.
|
diff --git a/spec/localhost/zfirefox_spec.rb b/spec/localhost/zfirefox_spec.rb
index abc1234..def5678 100644
--- a/spec/localhost/zfirefox_spec.rb
+++ b/spec/localhost/zfirefox_spec.rb
@@ -9,7 +9,7 @@ @selenium.quit
end
- res = '1024 x 768'
+ res = '1024 x 7688'
it "should return display resolution of #{res}" do
@selenium.get 'http://www.whatismyscreenresolution.com/'
|
Validate that rspec test of firefox fails
|
diff --git a/spec/support/dummy_view.rb b/spec/support/dummy_view.rb
index abc1234..def5678 100644
--- a/spec/support/dummy_view.rb
+++ b/spec/support/dummy_view.rb
@@ -1,7 +1,40 @@+require 'action_view'
+
class DummyView < ActionView::Base
+ module FakeRequest
+ class Request
+ attr_accessor :path
+ def get?
+ true
+ end
+ end
+ def request
+ @request ||= Request.new
+ end
+ def params
+ @params ||= {}
+ end
+ end
+
+ include FakeRequest
+ include ActionView::Helpers::UrlHelper
include Loaf::ViewExtensions
+
attr_reader :_breadcrumbs
- def url_for(*); end
+ routes = ActionDispatch::Routing::RouteSet.new
+ routes.draw do
+ get "/" => "foo#bar", :as => :home
+ get "/posts" => "foo#posts"
+ get "/post/:id" => "foo#post", :as => :post
+ get "/post/:title" => "foo#title"
+ end
+
+ include routes.url_helpers
+
+ def set_path(path)
+ request.path = path
+ end
+
def current_page?(*); end
end
|
Change to implement bare action view to drive test urls expansion
|
diff --git a/spec/support/setup_dirs.rb b/spec/support/setup_dirs.rb
index abc1234..def5678 100644
--- a/spec/support/setup_dirs.rb
+++ b/spec/support/setup_dirs.rb
@@ -1,5 +1,5 @@ dirs = []
dirs << Rails.root.join('public', 'uploads', 'failed_imports')
-dirs.each{|dir| Fileutils.mkdir_p dir unless Dir.exist? dir}
+dirs.each{|dir| FileUtils.mkdir_p dir unless Dir.exist? dir}
|
Fix stupid typo in specs support file
|
diff --git a/spec/unit/query_builder_spec.rb b/spec/unit/query_builder_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/query_builder_spec.rb
+++ b/spec/unit/query_builder_spec.rb
@@ -11,15 +11,15 @@ end
it "should return empty conditions if the search query is nil" do
- ScopedSearch::QueryBuilder.build_query(@definition, nil).should == { :order => nil }
+ ScopedSearch::QueryBuilder.build_query(@definition, nil).should == { }
end
it "should return empty conditions if the query is blank" do
- ScopedSearch::QueryBuilder.build_query(@definition, "").should == { :order => nil }
+ ScopedSearch::QueryBuilder.build_query(@definition, "").should == { }
end
it "should return empty conditions if the query is whitespace only" do
- ScopedSearch::QueryBuilder.build_query(@definition, "\t ").should == { :order => nil }
+ ScopedSearch::QueryBuilder.build_query(@definition, "\t ").should == { }
end
end
|
Revert "Fix query builder specs by including :order => nil"
This reverts commit 3fafe3986911848ebceb606aba6f498d85eb423b.
|
diff --git a/recipes/default.rb b/recipes/default.rb
index abc1234..def5678 100644
--- a/recipes/default.rb
+++ b/recipes/default.rb
@@ -15,6 +15,6 @@ only_if "ls #{ENV['HOME']}/.composer/vendor/drush/drush/drush"
end
link "/usr/local/bin/drush" do
- to "#{ENV['HOME']}/.composer/vendor/drush/drush/drush"
+ to "#{ENV['HOME']}/.config/composer/vendor/drush/drush/drush"
only_if "ls #{ENV['HOME']}/.config/composer/vendor/drush/drush/drush"
end
|
Handle multiple drush installation paths
|
diff --git a/recipes/firefox.rb b/recipes/firefox.rb
index abc1234..def5678 100644
--- a/recipes/firefox.rb
+++ b/recipes/firefox.rb
@@ -1,6 +1,6 @@ dmg_package "Firefox" do
- source "http://download.mozilla.org/?product=firefox-17.0&os=osx&lang=en-US"
- checksum "abd7e8a4da8faf815d0bd96a6b1a6492e630c73433522c0c3dfd671f46cc2236"
+ source "http://download.mozilla.org/?product=firefox-18.0.2&os=osx&lang=en-US"
+ checksum "3987f23ab8eca77ec63007333f2314743d4fb4c791db2a2820841869ef015c8b"
action :install
owner WS_USER
end
|
Update Firefox URL to latest version.
|
diff --git a/lib/travis.rb b/lib/travis.rb
index abc1234..def5678 100644
--- a/lib/travis.rb
+++ b/lib/travis.rb
@@ -2,7 +2,6 @@ autoload :Buildable, 'travis/buildable'
autoload :Builder, 'travis/builder'
autoload :Config, 'travis/config'
- autoload :WebSocketServer, 'travis/web_socket_server'
class << self
def config
|
Remove that WebSocketServer autoload since we don't use it anymore.
|
diff --git a/lib/virtus.rb b/lib/virtus.rb
index abc1234..def5678 100644
--- a/lib/virtus.rb
+++ b/lib/virtus.rb
@@ -13,7 +13,7 @@ #
# @param [Class] descendant
#
- # @return [Class]
+ # @return [undefined]
#
# @api private
def self.included(descendant)
|
Make sure the hook method is properly commented
|
diff --git a/core/basicobject/not_equal_spec.rb b/core/basicobject/not_equal_spec.rb
index abc1234..def5678 100644
--- a/core/basicobject/not_equal_spec.rb
+++ b/core/basicobject/not_equal_spec.rb
@@ -22,5 +22,13 @@ a = BasicObject.new
(a != a).should be_false
end
+
+ it "dispatches to #==" do
+ a = mock("not_equal")
+ b = BasicObject.new
+ a.should_receive(:==).and_return(true)
+
+ (a != b).should be_false
+ end
end
end
|
Add spec for 1.9 != dispatching to ==.
|
diff --git a/test/spec/auth_timeout_spec.rb b/test/spec/auth_timeout_spec.rb
index abc1234..def5678 100644
--- a/test/spec/auth_timeout_spec.rb
+++ b/test/spec/auth_timeout_spec.rb
@@ -0,0 +1,17 @@+# This test may only be meaningful with kerberos auth
+# Against server 2012, a kerberos connection will require reauth (get a 401)
+# if there are no requests for >= 15 seconds
+$: << File.dirname(__FILE__)
+require 'spec_helper'
+
+describe "Verify kerberos will reauth when necessary" do
+ before(:all) do
+ @winrm = winrm_connection
+ end
+
+ it 'work with a 18 second sleep' do
+ ps_command = 'Start-Sleep -s 18'
+ output = @winrm.run_powershell_script(ps_command)
+ output[:exitcode].should == 0
+ end
+end
|
Add rspec test to make sure kerberos reauth with 18 second sleep works
|
diff --git a/db/data_migration/20140110142811_add_oil_and_gas_detailed_guide_categories.rb b/db/data_migration/20140110142811_add_oil_and_gas_detailed_guide_categories.rb
index abc1234..def5678 100644
--- a/db/data_migration/20140110142811_add_oil_and_gas_detailed_guide_categories.rb
+++ b/db/data_migration/20140110142811_add_oil_and_gas_detailed_guide_categories.rb
@@ -0,0 +1,25 @@+def oil_and_gas_topics
+ [
+ { slug: "carbon-capture-and-storage", title: "Carbon capture and storage" },
+ { slug: "environment-reporting-and-regulation", title: "Environment reporting and regulation" },
+ { slug: "exploration-and-development", title: "Exploration and development" },
+ { slug: "fields-and-wells", title: "Fields and wells" },
+ { slug: "finance-and-taxation", title: "Finance and taxation" },
+ { slug: "infrastructure-and-decommissioning", title: "Infrastructure and decommissioning" },
+ { slug: "licensing", title: "Licensing" },
+ { slug: "onshore-oil-and-gas", title: "Onshore oil and gas" }
+ ]
+end
+
+def slug_for_topic(topic)
+ "industry-sector-oil-and-gas-#{topic[:slug]}"
+end
+
+oil_and_gas_topics.each do |topic|
+ MainstreamCategory.create!(
+ slug: slug_for_topic(topic),
+ title: "Oil and gas: #{topic[:title]}",
+ parent_title: "Industry sector: Oil and gas",
+ parent_tag: "oil-and-gas"
+ )
+end
|
Create new detailed guide categories for oil & gas
This migration creates eight new detailed guide categories for the Oil
and Gas sector, which will be used to push the correct industry_sector
tags into Panopticon.
|
diff --git a/script/test/stream_editor_test.rb b/script/test/stream_editor_test.rb
index abc1234..def5678 100644
--- a/script/test/stream_editor_test.rb
+++ b/script/test/stream_editor_test.rb
@@ -3,7 +3,7 @@ require 'test/unit'
require 'tempfile'
-require File.dirname(__FILE__) + '/../stream_editor'
+require File.dirname(__FILE__) + '/../base/stream_editor'
class StreamEditorTest < Test::Unit::TestCase
|
Correct 'overriding_check.rb' to output message only if not blank
version=0.7.2.5
script/test/stream_editor_test.rb
- 'stream_editor.rb' was moved to directory script/base.
|
diff --git a/lib/feedcellar/groonga_searcher.rb b/lib/feedcellar/groonga_searcher.rb
index abc1234..def5678 100644
--- a/lib/feedcellar/groonga_searcher.rb
+++ b/lib/feedcellar/groonga_searcher.rb
@@ -47,9 +47,8 @@ latest_feeds = []
feeds = database.feeds
- # TODO: I want to use the groonga method for grouping.
- feeds.group_by {|feed| feed.resource.xmlUrl }.each do |url, group|
- latest_feed = group.sort_by {|feed| feed.date }.last
+ feeds.group("resource.xmlUrl", :max_n_sub_records => 1).each do |group|
+ latest_feed = group.sub_records[0]
next unless latest_feed
next unless latest_feed.title
latest_feeds << latest_feed
|
Use rroonga method for latest grouping
rroonga 3.0.4 has been released!!!
|
diff --git a/vendor/stripe-json/lib/json/pure.rb b/vendor/stripe-json/lib/json/pure.rb
index abc1234..def5678 100644
--- a/vendor/stripe-json/lib/json/pure.rb
+++ b/vendor/stripe-json/lib/json/pure.rb
@@ -13,3 +13,16 @@
JSON_LOADED = true unless defined?(::JSON::JSON_LOADED)
end
+
+## Hacks needed to make to_json work
+class Fixnum
+ def to_json(options=nil)
+ to_s
+ end
+end
+
+class Integer
+ def to_json(options=nil)
+ to_s
+ end
+end
|
Add hacks to make to_json work
|
diff --git a/spec/helpers/pages_helper_spec.rb b/spec/helpers/pages_helper_spec.rb
index abc1234..def5678 100644
--- a/spec/helpers/pages_helper_spec.rb
+++ b/spec/helpers/pages_helper_spec.rb
@@ -22,11 +22,15 @@ end
context 'url preview' do
+ before do
+ allow(helper).to receive(:preview_domain).and_return('example.com')
+ end
+
let(:site) { 'en' }
let(:page) { 'slug' }
let(:presenter) { 'articles' }
let(:expected) do
- 'localhost:5000/en/<span data-dough-urlformatter-url-display="true">articles/slug</span>'
+ 'example.com/en/<span data-dough-urlformatter-url-display="true">articles/slug</span>'
end
it 'returns an article URL' do
|
Make sure preview domain is the consistant
|
diff --git a/spec/jortt/client/invoice_spec.rb b/spec/jortt/client/invoice_spec.rb
index abc1234..def5678 100644
--- a/spec/jortt/client/invoice_spec.rb
+++ b/spec/jortt/client/invoice_spec.rb
@@ -19,4 +19,18 @@ end
it { should eq('invoice_number' => '2016-001') }
end
+
+ describe '#credit_invoice' do
+ let(:args) { {invoice_date: Date.today, payment_term: 7} }
+ before do
+ stub_request(:post, 'http://foo/invoices/id/bar/credit')
+ .with(body: JSON.generate(args))
+ .to_return(status: 200, body: '{"credit_invoice_id": "CREDIT_INVOICE_ID"}')
+ end
+
+ it 'creates a draft credit invoice' do
+ res = invoice.credit_invoice(args)
+ expect(res["credit_invoice_id"]).to eq('CREDIT_INVOICE_ID')
+ end
+ end
end
|
Write a dummy spec for credit invoices
|
diff --git a/spec/mini_transformer/cli_spec.rb b/spec/mini_transformer/cli_spec.rb
index abc1234..def5678 100644
--- a/spec/mini_transformer/cli_spec.rb
+++ b/spec/mini_transformer/cli_spec.rb
@@ -0,0 +1,34 @@+require 'spec_helper'
+require 'mini_transformer'
+require 'mini_transformer/cli'
+
+describe "CLI" do
+ it "should check for a version" do
+ mini_transform :version, :exitstatus => true
+ @exitstatus.should eq(0)
+ out.should == "Mini Transform version 0.0.1"
+ end
+
+ it "should be able to check version with -v" do
+ mini_transform "-v"
+ out.should == "Mini Transform version 0.0.1"
+ end
+
+ it "should be able to check version with --version" do
+ mini_transform "--version"
+ out.should == "Mini Transform version 0.0.1"
+ end
+end
+
+describe "MiniTransformer::CLI" do
+
+ before(:all) do
+ @cli = MiniTransformer::CLI.new
+ end
+
+ it "should check version" do
+ @cli.version.should == "Mini Transform version 0.0.1"
+ end
+
+
+end
|
Add basic RSpec for testing the CLI class
Handle the command line calls to the CLI class with RSpec
|
diff --git a/spec/unit/recipes/default_spec.rb b/spec/unit/recipes/default_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/recipes/default_spec.rb
+++ b/spec/unit/recipes/default_spec.rb
@@ -10,9 +10,6 @@ end
shared_examples_for 'default recipe' do
- it 'starts the service' do
- expect(chef_run).to start_service('nginx')
- end
end
context 'unmodified attributes' do
|
Remove spec test to verify nginx start (which we no longer do)
|
diff --git a/db/migrate/20121124105420_add_promise_connections.rb b/db/migrate/20121124105420_add_promise_connections.rb
index abc1234..def5678 100644
--- a/db/migrate/20121124105420_add_promise_connections.rb
+++ b/db/migrate/20121124105420_add_promise_connections.rb
@@ -9,6 +9,10 @@ end
add_index :promise_connections, [:promise_id, :issue_id]
+
+ # in case old join records were left hanging, don't leave connections with invalid issues
+ # see https://github.com/holderdeord/hdo-site/issues/351
+ execute 'DELETE FROM issues_promises ip WHERE (SELECT count(*) FROM issues WHERE id = ip.issue_id) = 0'
# move data
execute <<-SQL
|
Delete invalid join records before migrating to promise_connections.
|
diff --git a/mdv.gemspec b/mdv.gemspec
index abc1234..def5678 100644
--- a/mdv.gemspec
+++ b/mdv.gemspec
@@ -13,7 +13,7 @@
s.executables = ['mdv']
s.files =
- Dir['bin/*', '*.md', 'LICENSE', 'Rakefile', 'Gemfile'] &
+ Dir['bin/*', '*.md', 'LICENSE', 'Rakefile', 'Gemfile', 'lib/**/*.rb'] &
`git ls-files -z`.split("\0")
s.test_files = Dir['test/**/*.rb']
|
Make sure library files are included in the gem
|
diff --git a/examples/sse/server.ru b/examples/sse/server.ru
index abc1234..def5678 100644
--- a/examples/sse/server.ru
+++ b/examples/sse/server.ru
@@ -24,5 +24,5 @@
file_server = Rack::File.new(File.join(File.dirname(__FILE__), 'public'))
-# bundle exec thin -R examples/sse/server.ru start
+# bundle exec thin -V -R examples/sse/server.ru start
run Rack::Cascade.new([file_server, routes])
|
Use -V for thin in example comments
|
diff --git a/IQKeyboardManagerSwift.podspec b/IQKeyboardManagerSwift.podspec
index abc1234..def5678 100644
--- a/IQKeyboardManagerSwift.podspec
+++ b/IQKeyboardManagerSwift.podspec
@@ -1,13 +1,13 @@ Pod::Spec.new do |s|
s.name = "IQKeyboardManagerSwift"
- s.version = "3.3.2"
+ s.version = "3.3.3"
s.summary = "Codeless drop-in universal library allows to prevent issues of keyboard sliding up and cover UITextField/UITextView."
s.homepage = "https://github.com/hackiftekhar/IQKeyboardManager"
s.screenshots = "https://raw.githubusercontent.com/hackiftekhar/IQKeyboardManager/master/Screenshot/IQKeyboardManagerScreenshot.png"
s.license = 'MIT'
- s.author = { "Iftekhar Qurashi" => "hack.iftekhar@gmail.com" }
+ s.author = { "Iftekhar Qurashi" => "hack.iftekhar@gmail.com", "OCTO Technology" => "team.mobilite@octo.com" }
s.platform = :ios, '8.0'
- s.source = { :git => "https://github.com/hackiftekhar/IQKeyboardManager.git", :tag => "v3.3.2" }
+ s.source = { :git => "https://github.com/octo-technology/IQKeyboardManager.git", :tag => "v3.3.2" }
s.source_files = 'Classes', 'IQKeyboardManagerSwift/**/*.{swift}'
s.resources = "IQKeyboardManagerSwift/Resources/IQKeyboardManager.bundle"
s.requires_arc = true
|
Update Podspec for swift to prepare v3.3.3
|
diff --git a/metadata.rb b/metadata.rb
index abc1234..def5678 100644
--- a/metadata.rb
+++ b/metadata.rb
@@ -1,6 +1,6 @@ name 'logrotate'
-maintainer 'Steven Danna'
-maintainer_email 'steve@chef.io'
+maintainer 'Chef Software, Inc.'
+maintainer_email 'cookbooks@chef.io'
license 'Apache-2.0'
description 'Installs logrotate package and provides a resource for managing logrotate configs'
long_description 'Installs the logrotate package, manages /etc/logrotate.conf, and provides a logrotate_app resource.'
|
Switch the maintainer over to Chef Software
Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
|
diff --git a/metadata.rb b/metadata.rb
index abc1234..def5678 100644
--- a/metadata.rb
+++ b/metadata.rb
@@ -6,3 +6,4 @@ long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.1.0'
depends "apt"
+depends "git"
|
Add git cookbook to the dependencies.
|
diff --git a/lib/travis/api/app/responders/badge.rb b/lib/travis/api/app/responders/badge.rb
index abc1234..def5678 100644
--- a/lib/travis/api/app/responders/badge.rb
+++ b/lib/travis/api/app/responders/badge.rb
@@ -10,7 +10,7 @@ end
def content_type
- "image/svg"
+ "image/svg+xml"
end
def filename
|
Return right mime type for SVG.
|
diff --git a/recipes/default.rb b/recipes/default.rb
index abc1234..def5678 100644
--- a/recipes/default.rb
+++ b/recipes/default.rb
@@ -15,7 +15,7 @@
remote_file target do
source url
- mode 0775
+ mode '0775'
not_if { ::File.exist?(target) }
end
|
Fix rubocop offense: Use 0o for octal literals
|
diff --git a/recipes/install.rb b/recipes/install.rb
index abc1234..def5678 100644
--- a/recipes/install.rb
+++ b/recipes/install.rb
@@ -4,6 +4,7 @@ install['old_bins'].each do |old_bin_file|
file "#{install['bin_path']}/#{old_bin_file}" do
action :delete
+ notifies :stop, 'service[remote_syslog2]', :immediately
end
end
|
Stop service as soon as an old version is found (updating has started)
|
diff --git a/spec/games_spec.rb b/spec/games_spec.rb
index abc1234..def5678 100644
--- a/spec/games_spec.rb
+++ b/spec/games_spec.rb
@@ -0,0 +1,67 @@+require 'discordrb/games'
+
+describe Discordrb::Games do
+ describe Discordrb::Games::Game do
+ it 'should initialize without errors' do
+ hash = {
+ id: 123,
+ name: 'Pokémon Super Mystery Dungeon',
+ executables: []
+ }
+
+ Discordrb::Games::Game.new(hash)
+ end
+
+ it 'should contain the given values' do
+ hash = {
+ id: 123,
+ name: 'Pokémon Super Mystery Dungeon',
+ executables: []
+ }
+
+ game = Discordrb::Games::Game.new(hash)
+ game.id.should eq(123)
+ game.name.should eq('Pokémon Super Mystery Dungeon')
+ game.executables.should eq([])
+ end
+ end
+
+ it 'should contain FFXI as the zeroth element' do
+ game = Discordrb::Games.games[0]
+ game.id.should eq(0)
+ game.name.should eq('FINAL FANTASY XI')
+ end
+
+ describe 'find_game' do
+ it 'should return a Game when it is given one' do
+ hash = {
+ id: 123,
+ name: 'Pokémon Super Mystery Dungeon',
+ executables: []
+ }
+
+ game = Discordrb::Games::Game.new(hash)
+ game.should be(Discordrb::Games.find_game(game))
+ end
+
+ it 'should find a game by name' do
+ game = Discordrb::Games.find_game('FINAL FANTASY XI')
+ game.id.should eq(0)
+ game.name.should eq('FINAL FANTASY XI')
+ end
+
+ it 'should find a game by ID' do
+ game = Discordrb::Games.find_game(0)
+ game.id.should eq(0)
+ game.name.should eq('FINAL FANTASY XI')
+
+ game = Discordrb::Games.find_game('0')
+ game.id.should eq(0)
+ game.name.should eq('FINAL FANTASY XI')
+ end
+
+ it 'should return nil if a game is not found' do
+ Discordrb::Games.find_game('this game does not exist').should be(nil)
+ end
+ end
+end
|
Add tests for the games list
|
diff --git a/trunk/Tools/fakeserver.rb b/trunk/Tools/fakeserver.rb
index abc1234..def5678 100644
--- a/trunk/Tools/fakeserver.rb
+++ b/trunk/Tools/fakeserver.rb
@@ -11,9 +11,9 @@ body =
'<Projects>
<Project name="connectfour" activity="Sleeping" lastBuildStatus="Success" lastBuildLabel="build.1"
- lastBuildTime="2007-07-18T18:44:48" webUrl="http://localhost:8080/dashboard/build/detail/connectfour"/>
+ lastBuildTime="2007-07-18T18:44:48" webUrl="http://localhost:4567/dashboard/build/detail/connectfour"/>
</Projects>'
-
+
[200, {"Content-Type" => "application/xml"}, body]
end
@@ -25,3 +25,11 @@ [200, {"Content-Type" => "text/html"}, body]
end
+
+get '/dashboard/build/detail/connectfour' do
+
+ body = '<html><body><h1>Connect Four</h1>This is the project page on the build server.</body></html>'
+
+ [200, {"Content-Type" => "text/html"}, body]
+
+end
|
Correct reporting of responses from server without project status; usually well-formed XHTML.
git-svn-id: 6356d16c5fcd314faaf1b00f846dba9475d041eb@85 fc4f70da-8335-0410-99e3-8b437148c6d8
|
diff --git a/lib/lecture_list.rb b/lib/lecture_list.rb
index abc1234..def5678 100644
--- a/lib/lecture_list.rb
+++ b/lib/lecture_list.rb
@@ -4,22 +4,25 @@
class LectureList
- def self.update
+ def self.update(status)
json = Net::HTTP.get URI.parse("http://theodi.org/lectures.json")
+
lectures = JSON.parse(json)
lecture_list = lectures.map do |url, data|
- tickets = get_tickets(data)
- capacity = data['capacity']
+ if data['status'] == status
+ tickets = get_tickets(data)
+ capacity = data['capacity']
- people = ""
- (capacity - tickets).times { people += "<span class='icon-user'></span>" }
- tickets.times { people += "<span class='icon-user available'></span>" }
+ people = ""
+ (capacity - tickets).times { people += "<span class='icon-user'></span>" }
+ tickets.times { people += "<span class='icon-user available'></span>" }
- {url: url, text: data['name'], date: Date.parse(data['startDate']).to_formatted_s(:short).strip, people: people }
+ {url: url, text: data['name'], date: Date.parse(data['startDate']).to_formatted_s(:short).strip, people: people }
+ end
end
-
+
{ items: lecture_list }
end
|
Tweak lecture list code to return different stuff depending on input
|
diff --git a/rack-canonical-host.gemspec b/rack-canonical-host.gemspec
index abc1234..def5678 100644
--- a/rack-canonical-host.gemspec
+++ b/rack-canonical-host.gemspec
@@ -9,6 +9,7 @@
gem.add_dependency 'addressable', '> 0', '< 3'
gem.add_dependency 'rack', '~> 1.0'
+ gem.add_development_dependency 'rake'
gem.add_development_dependency 'rspec', '~> 3.0'
gem.files = `git ls-files`.split($\)
|
Add development dependency on Rake.
|
diff --git a/lib/specjour/cpu.rb b/lib/specjour/cpu.rb
index abc1234..def5678 100644
--- a/lib/specjour/cpu.rb
+++ b/lib/specjour/cpu.rb
@@ -6,7 +6,7 @@ when /darwin/
`hwprefs cpu_count`.to_i
when /linux/
- `cat /proc/cpuinfo | grep processor | wc -l`.to_i
+ `cat /proc/cpuinfo | grep --count processor`.to_i
end
end
end
|
Use grep's --count option instead of piping to wc
|
diff --git a/lib/tasks/dump.rake b/lib/tasks/dump.rake
index abc1234..def5678 100644
--- a/lib/tasks/dump.rake
+++ b/lib/tasks/dump.rake
@@ -1,6 +1,7 @@-desc "Converts a browscap file to another format"
+
+desc "Converts a browscap file to the Marshal format"
task "browscapper:dump" do
- require File.join(File.dirname(__FILE__), %w{ lib browscapper })
+ require 'browscapper'
if !ENV['IN'] || !ENV['OUT']
puts "Usage: IN=browscap OUT=browscap.dump"
@@ -15,3 +16,45 @@ fp.write(Marshal.dump(Browscapper.entries))
end
end
+
+desc "Converts a browscap file to another format"
+task "browscapper:convert" do
+ require 'browscapper'
+
+ if !ENV['IN'] || !ENV['OUT']
+ puts "Usage: IN=browscap OUT=output.ext"
+ puts
+ puts "Converts a browscap file to another format. The output format"
+ puts "is based on the output extension, which can be one of yml, yaml,"
+ puts "csv, ini or dump. The \"dump\" extension uses the Marshal format."
+ exit
+ end
+
+ Browscapper.load(ENV['IN'])
+
+ case ENV['OUT']
+ when /\.dump$/i
+ File.open(ENV['OUT'], 'wb:BINARY') do |fp|
+ fp.write(Marshal.dump(Browscapper.entries))
+ end
+
+ when /\.ya?ml$/i
+ File.open(ENV['OUT'], 'wb:BINARY') do |fp|
+ fp.write(YAML.dump(Browscaper.entries))
+ end
+
+ when /\.csv$/i
+ Browscapper.load(ENV['IN'])
+ Browscapper::CSVReader::CSV_ENGINE.open(ENV['OUT'], 'wb:BINARY') do |csv|
+ keys = Browscapper.entries['DefaultProperties'].to_hash.keys
+ csv << keys
+ Browscapper.entries.each do |k, v|
+ hash = v.to_hash
+
+ csv << keys.collect { |kk|
+ hash[kk]
+ }
+ end
+ end
+ end
+end
|
Add the `browscapper:convert` Rake task.
|
diff --git a/lib/vehicle_data.rb b/lib/vehicle_data.rb
index abc1234..def5678 100644
--- a/lib/vehicle_data.rb
+++ b/lib/vehicle_data.rb
@@ -8,13 +8,22 @@
module VehicleData
+ class << self
+ attr_accessor :configuration
+ end
+
+ def self.configure
+ self.configuration ||= Configuration.new
+ yield(configuration)
+ end
+
class Base
attr_accessor :app_key, :secret, :data, :response, :request, :options
def initialize(options={})
- @app_key = ENV['app_key']
- @secret = ENV['secret']
+ @app_key = VehicleData.configuration.app_key
+ @secret = VehicleData.configuration.secret
@data = options.merge!({ :app => @app_key, :v => 0.2, :t => Time.now.to_i })
end
@@ -37,6 +46,15 @@ params.collect { |k,v| "#{k}=#{CGI::escape(v.to_s)}" }.join('&')
end
end
+
+ class Configuration
+ attr_accessor :app_key, :secret
+
+ def initialize
+ @app_key
+ @secret
+ end
+ end
end
require 'vehicle_data/makes'
|
Add configuration block for VehicleData app_key & secret.
|
diff --git a/lib/zanders/base.rb b/lib/zanders/base.rb
index abc1234..def5678 100644
--- a/lib/zanders/base.rb
+++ b/lib/zanders/base.rb
@@ -40,5 +40,19 @@ end
end
+ def content_for(xml_doc, field)
+ node = xml_doc.css(field).first
+
+ if node.nil?
+ nil
+ else
+ if node.css("DATA").present?
+ node.css("DATA").text.strip
+ else
+ node.content.strip
+ end
+ end
+ end
+
end
end
|
Handle zanders' weird format edgecases
|
diff --git a/spec/integration/replica_set_connections_spec.rb b/spec/integration/replica_set_connections_spec.rb
index abc1234..def5678 100644
--- a/spec/integration/replica_set_connections_spec.rb
+++ b/spec/integration/replica_set_connections_spec.rb
@@ -2,13 +2,15 @@
describe 'replica set connections' do
with_running_replica_set do
+ let(:repo_name) { :replica_set_connection }
+
it 'should connect the replica set' do
DataMapper.setup(
- :replica_set_connection,
+ repo_name,
:adapter => 'mongo',
:seeds => replica_set
)
- connection = DataMapper.repository(:default).adapter.send(:connection)
+ connection = DataMapper.repository(repo_name).adapter.send(:connection)
connection.should be_kind_of(Mongo::ReplSetConnection)
end
|
Fix for repo name in repl set connection
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.