diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/lib/vidibus/fileinfo/base.rb b/lib/vidibus/fileinfo/base.rb
index abc1234..def5678 100644
--- a/lib/vidibus/fileinfo/base.rb
+++ b/lib/vidibus/fileinfo/base.rb
@@ -10,7 +10,7 @@ end
def format
- @format ||= Fileinfo.format(@path)
+ @format ||= Fileinfo.format(path)
end
def mime_type
@@ -22,15 +22,15 @@ end
def data
- raise PathError unless @path
+ raise PathError unless path
@data ||= parse_metadata
end
protected
def check_file
- raise FileAccessError unless File.exist?(@path)
- raise NoFileError unless File.file?(@path)
+ raise FileAccessError unless File.exist?(path)
+ raise NoFileError unless File.file?(path)
end
def load_processor
@@ -66,7 +66,7 @@
# The video/image file size in bytes.
def size
- File.size(@path)
+ File.size(path)
end
end
end
|
Use accessor instead of instance variable
|
diff --git a/lib/lita/handlers/time.rb b/lib/lita/handlers/time.rb
index abc1234..def5678 100644
--- a/lib/lita/handlers/time.rb
+++ b/lib/lita/handlers/time.rb
@@ -1,7 +1,7 @@ module Lita
module Handlers
class Time < Handler
- URL = "http://api.worldweatheronline.com/free/v1/tz.ashx"
+ URL = "http://api.worldweatheronline.com/free/v2/tz.ashx"
route(/(?:what\s)?time(?:\sis\sit)?(?:\sin)?\s([^\?]+)(?:\?)?/, :fetch, command: true, help: {
t("help.time_key") => t("help.time_value")
|
Use the (working) v2 API.
|
diff --git a/lib/tasks/deployment.rake b/lib/tasks/deployment.rake
index abc1234..def5678 100644
--- a/lib/tasks/deployment.rake
+++ b/lib/tasks/deployment.rake
@@ -9,7 +9,9 @@ namespace :knight do
desc 'Deploy to Heroku'
task :deploy do
- puts 'Deploying to production...'
+ puts 'Pushing to Github...'
+ system 'git push origin master'
+ puts 'Deploying to Heroku production...'
system 'git push heroku master'
end
|
Rake: Deploy task pushed to github, too
|
diff --git a/lib/faker/default/fillmurray.rb b/lib/faker/default/fillmurray.rb
index abc1234..def5678 100644
--- a/lib/faker/default/fillmurray.rb
+++ b/lib/faker/default/fillmurray.rb
@@ -4,8 +4,29 @@ class Fillmurray < Base
class << self
# rubocop:disable Metrics/ParameterLists
+
+ ##
+ # Produces the URL of an image from Fill Murray, a site which hosts
+ # exclusively photographs of actor Bill Murray.
+ #
+ # @param grayscale [Boolean] Whether to return a grayscale image.
+ # @param width [Integer] The iamage width.
+ # @param height [Integer] The image height.
+ # @return [String]
+ #
+ # @example
+ # Faker::Fillmurray.image #=> "https://www.fillmurray.com/300/300"
+ #
+ # @example
+ # Faker::Fillmurray.image(grayscale: true)
+ # #=> "https://fillmurray.com/g/300/300"
+ #
+ # @example
+ # Faker::Fillmurray.image(grayscale: false, width: 200, height: 400)
+ # #=> "https://fillmurray.com/200/400"
+ #
+ # @faker.version 1.7.1
def image(legacy_grayscale = NOT_GIVEN, legacy_width = NOT_GIVEN, legacy_height = NOT_GIVEN, grayscale: false, width: 200, height: 200)
- # rubocop:enable Metrics/ParameterLists
warn_for_deprecated_arguments do |keywords|
keywords << :grayscale if legacy_grayscale != NOT_GIVEN
keywords << :width if legacy_width != NOT_GIVEN
@@ -18,6 +39,7 @@
"https://www.fillmurray.com#{'/g' if grayscale == true}/#{width}/#{height}"
end
+ # rubocop:enable Metrics/ParameterLists
end
end
end
|
Add YARD docs for Faker::Fillmurray.
|
diff --git a/app/models/timeslot.rb b/app/models/timeslot.rb
index abc1234..def5678 100644
--- a/app/models/timeslot.rb
+++ b/app/models/timeslot.rb
@@ -1,6 +1,6 @@ class Timeslot < ActiveRecord::Base
belongs_to :tutor, class_name: 'User'
- has_one :student, class_name: 'User'
+ belongs_to :student, class_name: 'User'
validates :start, :tutor_id, presence: true
end
|
Modify associations in Timeslot model
Correct student_id association to User model (belongs_to)
|
diff --git a/lib/languages/norsk/language.rb b/lib/languages/norsk/language.rb
index abc1234..def5678 100644
--- a/lib/languages/norsk/language.rb
+++ b/lib/languages/norsk/language.rb
@@ -2,7 +2,6 @@
class Norsk < Language
def initialize
- @subjects = ["Jeg", "Du", "Han", "Hun", "Vi", "De", "Den", "Det", "Dere"]
super __FILE__
end
end
|
Remove old reference to subjects.
|
diff --git a/lib/checkpoint/omniauth_clerk.rb b/lib/checkpoint/omniauth_clerk.rb
index abc1234..def5678 100644
--- a/lib/checkpoint/omniauth_clerk.rb
+++ b/lib/checkpoint/omniauth_clerk.rb
@@ -22,6 +22,7 @@ :image_url => auth_data['info']['image'],
:description => auth_data['info']['description'],
:email => auth_data['info']['email'],
+ :phone => auth_data['info']['phone'],
:profile_url => profile_url
}
attributes.merge(additional_attributes)
|
Handle phone number from omniauth params.
|
diff --git a/lib/portable_bridge_notation.rb b/lib/portable_bridge_notation.rb
index abc1234..def5678 100644
--- a/lib/portable_bridge_notation.rb
+++ b/lib/portable_bridge_notation.rb
@@ -1,5 +1,4 @@ # TODO: learn about ruby documentation format and add one here, to eliminate rubocop warning
-# as well as how to turn it off for Internal:: classes
module PortableBridgeNotation
autoload :Importer, File.expand_path('../portable_bridge_notation/importer', __FILE__)
end
|
Delete done portion of a todo.
|
diff --git a/lib/simplecov_custom_profile.rb b/lib/simplecov_custom_profile.rb
index abc1234..def5678 100644
--- a/lib/simplecov_custom_profile.rb
+++ b/lib/simplecov_custom_profile.rb
@@ -3,11 +3,8 @@ SimpleCov.profiles.define 'gem' do
add_filter '/test/'
add_filter '/features/'
- add_filter '/spec/'
add_filter '/autotest/'
add_group 'Binaries', '/bin/'
add_group 'Libraries', '/lib/'
- add_group 'Extensions', '/ext/'
- add_group 'Vendor Libraries', '/vendor/'
end
|
Remove unused groups from simplecov's profile
|
diff --git a/lib/tasks/migrate_homepage.rake b/lib/tasks/migrate_homepage.rake
index abc1234..def5678 100644
--- a/lib/tasks/migrate_homepage.rake
+++ b/lib/tasks/migrate_homepage.rake
@@ -0,0 +1,38 @@+require 'gds_api/publishing_api'
+require 'highline'
+
+desc "Migrate the homepage"
+task migrate_homepage: :environment do
+ cli = HighLine.new
+ cli.say cli.color(
+ "Publishing the homepage will make the old service manual inaccessible. Continue?",
+ :red
+ )
+ exit unless cli.agree "Are you sure you wish to continue?"
+
+ publishing_api_v1 = GdsApi::PublishingApi.new(
+ Plek.new.find('publishing-api'),
+ bearer_token: ENV['PUBLISHING_API_BEARER_TOKEN'] || 'example'
+ )
+
+ # Take ownership of the path reservation
+ publishing_api_v1.put_path('/service-manual',
+ publishing_app: 'service-manual-publisher',
+ override_existing: true
+ )
+
+ homepage = HomepagePresenter.new
+
+ # Save and publish the homepage
+ PUBLISHING_API.put_content(
+ homepage.content_id,
+ homepage.content_payload
+ )
+
+ PUBLISHING_API.publish(
+ homepage.content_id,
+ "major"
+ )
+
+ puts "Done."
+end
|
Add a rake task to migrate the homepage
Because the service manual base path was previously ‘owned’ by a different application, we can’t publish to /service-manual without first explicitly claiming that path reservation using the paths endpoint.
Note that running this rake task will make the old service manual inaccessible, and should only be run on production once the old manual is no longer required.
|
diff --git a/lib/oriented/core/transaction.rb b/lib/oriented/core/transaction.rb
index abc1234..def5678 100644
--- a/lib/oriented/core/transaction.rb
+++ b/lib/oriented/core/transaction.rb
@@ -12,17 +12,15 @@ class Transaction
def self.run connection = Oriented.connection, &block
- begin
- ensure_connection(connection)
- ret = yield
- connection.commit
- ret
- rescue => ex
- connection.rollback
- connection.close
- raise
- ensure
- end
+ ensure_connection(connection)
+ ret = yield
+ connection.commit
+ ret
+ rescue => ex
+ connection.rollback
+ connection.close
+ raise
+ ensure
end
private
|
Remove unnecessary begin/end from Transaction.run
|
diff --git a/lib/vcloud/user/catalog_item.rb b/lib/vcloud/user/catalog_item.rb
index abc1234..def5678 100644
--- a/lib/vcloud/user/catalog_item.rb
+++ b/lib/vcloud/user/catalog_item.rb
@@ -12,7 +12,7 @@ end
def initialize(args)
-
+ @href = args[:href]
end
def self.from_reference(ref, session = VCloud::Session.current_session)
|
Store the href when we create a new CatalogItem
|
diff --git a/lib/travis/worker/cli/vagrant.rb b/lib/travis/worker/cli/vagrant.rb
index abc1234..def5678 100644
--- a/lib/travis/worker/cli/vagrant.rb
+++ b/lib/travis/worker/cli/vagrant.rb
@@ -48,7 +48,7 @@ end
def download
- run "get http://files.vagrantup.com/#{from}.box" unless File.exists?("#{from}.box")
+ run "wget http://files.vagrantup.com/#{from}.box" unless File.exists?("#{from}.box")
end
def add_box(name, options = {})
|
Use wget to download Vagrant base box
|
diff --git a/LLRegex.podspec b/LLRegex.podspec
index abc1234..def5678 100644
--- a/LLRegex.podspec
+++ b/LLRegex.podspec
@@ -1,6 +1,6 @@ Pod::Spec.new do |s|
s.name = 'LLRegex'
- s.version = '1.2.0'
+ s.version = '1.2.1'
s.summary = 'Regular expression library in Swift, wrapping NSRegularExpression.'
s.homepage = 'https://github.com/LittleRockInGitHub/LLRegex'
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
Update pod version to 1.2.1
|
diff --git a/Formula/ruby.rb b/Formula/ruby.rb
index abc1234..def5678 100644
--- a/Formula/ruby.rb
+++ b/Formula/ruby.rb
@@ -6,6 +6,8 @@ @url='ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p243.tar.gz'
@homepage='http://www.ruby-lang.org/en/'
@md5='515bfd965814e718c0943abf3dde5494'
+
+ depends_on 'readline'
def install
system "./configure", "--prefix=#{prefix}",
|
Add readline dependency to Ruby
|
diff --git a/search-engine/spec/foil_queries_spec.rb b/search-engine/spec/foil_queries_spec.rb
index abc1234..def5678 100644
--- a/search-engine/spec/foil_queries_spec.rb
+++ b/search-engine/spec/foil_queries_spec.rb
@@ -0,0 +1,15 @@+describe "Foil queries" do
+ include_context "db"
+ let(:nonfoil) { db.printings.select{|c| c.foiling == "nonfoil" } }
+ let(:foilonly) { db.printings.select{|c| c.foiling == "foilonly" } }
+ let(:both) { db.printings.select{|c| c.foiling == "both" } }
+
+ # These are just boring unit tests
+ it "is:foil" do
+ db.search("is:foil").printings.should match_array(foilonly + both)
+ end
+
+ it "is:nonfoil" do
+ db.search("is:nonfoil").printings.should match_array(nonfoil + both)
+ end
+end
|
Add unti test for foil queries
|
diff --git a/config/schedule.rb b/config/schedule.rb
index abc1234..def5678 100644
--- a/config/schedule.rb
+++ b/config/schedule.rb
@@ -1,6 +1,3 @@-# Customize the rake job to source user profile for environment variables
-job_type :rake, ". $HOME/.profile; cd :path && :environment_variable=:environment bundle exec rake :task --silent :output"
-
set :bundle_command, "/home/deploy/.rbenv/versions/2.3.1/bin/bundle exec"
set :output, { error: '/var/www/shared/cron.front.error.log', standard: '/var/www/shared/cron.front.log' }
every 1.day, :at => '1:30 am' do
|
Revert "customize rake job definition in whenever"
This reverts commit acae3a3b10b52f3734800d2fb239312363d7c6ba.
|
diff --git a/arrow_payments.gemspec b/arrow_payments.gemspec
index abc1234..def5678 100644
--- a/arrow_payments.gemspec
+++ b/arrow_payments.gemspec
@@ -16,7 +16,7 @@ s.add_development_dependency "pry"
s.add_dependency "faraday", "~> 0.9.2"
- s.add_dependency "faraday_middleware", "~> 0.8"
+ s.add_dependency "faraday_middleware", "~> 0.10.0"
s.add_dependency "hashie", "~> 2.0"
s.add_dependency "json", "~> 1.8"
|
Upgrade faraday_middleware and lock down version
|
diff --git a/test/test_integration.rb b/test/test_integration.rb
index abc1234..def5678 100644
--- a/test/test_integration.rb
+++ b/test/test_integration.rb
@@ -0,0 +1,31 @@+require_relative 'test_helper'
+
+if !INTEGRATION
+ puts "Skipping integration tests..."
+else
+ class TestLDAPInstrumentation < Test::Unit::TestCase
+ def setup
+ @service = MockInstrumentationService.new
+ @ldap = Net::LDAP.new \
+ host: 'localhost',
+ port: 389,
+ admin_user: 'uid=admin,dc=rubyldap,dc=com',
+ admin_password: 'passworD1',
+ search_domains: %w(dc=rubyldap,dc=com),
+ uid: 'uid',
+ instrumentation_service: @service
+ end
+
+ def test_bind_success
+ assert @ldap.bind(method: :simple, username: "user1", password: "passworD1")
+ end
+
+ def test_bind_success_anonymous
+ assert @ldap.bind(method: :simple, username: "user1", password: "")
+ end
+
+ def test_bind_fail
+ refute @ldap.bind(method: :simple, username: "user1", password: "not my password")
+ end
+ end
+end
|
Add basic integration tests for bind
|
diff --git a/Casks/acorn3.rb b/Casks/acorn3.rb
index abc1234..def5678 100644
--- a/Casks/acorn3.rb
+++ b/Casks/acorn3.rb
@@ -3,8 +3,9 @@ sha256 'ffc4cd551b9eb2ebadfe8e59c95e84b1f59538d7915eff63dd6c3efdca7858e6'
url "https://secure.flyingmeat.com/download/Acorn-#{version}.zip"
+ name 'Acorn'
homepage 'https://secure.flyingmeat.com/acorn/'
- license :closed
+ license :commercial
app 'Acorn.app'
end
|
Add name stanza to Acorn3
|
diff --git a/activesupport/lib/active_support/messages/metadata.rb b/activesupport/lib/active_support/messages/metadata.rb
index abc1234..def5678 100644
--- a/activesupport/lib/active_support/messages/metadata.rb
+++ b/activesupport/lib/active_support/messages/metadata.rb
@@ -32,7 +32,7 @@ if expires_at
expires_at.utc.iso8601(3)
elsif expires_in
- expires_in.from_now.utc.iso8601(3)
+ Time.now.utc.advance(seconds: expires_in).iso8601(3)
end
end
|
Remove dependency on `from_now` extension.
[ Assain Jaleel & Kasper Timm Hansen ]
|
diff --git a/activesupport/test/deprecation/proxy_wrappers_test.rb b/activesupport/test/deprecation/proxy_wrappers_test.rb
index abc1234..def5678 100644
--- a/activesupport/test/deprecation/proxy_wrappers_test.rb
+++ b/activesupport/test/deprecation/proxy_wrappers_test.rb
@@ -0,0 +1,22 @@+require 'abstract_unit'
+require 'active_support/deprecation'
+
+class ProxyWrappersTest < Test::Unit::TestCase
+ Waffles = false
+ NewWaffles = :hamburgers
+
+ def test_deprecated_object_proxy_doesnt_wrap_falsy_objects
+ proxy = ActiveSupport::Deprecation::DeprecatedObjectProxy.new(nil, "message")
+ assert !proxy
+ end
+
+ def test_deprecated_instance_variable_proxy_doesnt_wrap_falsy_objects
+ proxy = ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy.new(nil, :waffles)
+ assert !proxy
+ end
+
+ def test_deprecated_constant_proxy_doesnt_wrap_falsy_objects
+ proxy = ActiveSupport::Deprecation::DeprecatedConstantProxy.new(Waffles, NewWaffles)
+ assert !proxy
+ end
+end
|
Test to ensure that falsy objects aren't wrapped by deprecation proxies
|
diff --git a/bizcalc.gemspec b/bizcalc.gemspec
index abc1234..def5678 100644
--- a/bizcalc.gemspec
+++ b/bizcalc.gemspec
@@ -21,7 +21,10 @@ spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec", "~> 3.0"
- spec.add_dependency "pry"
- spec.add_dependency "activesupport"
- spec.add_dependency "stock_quote"
+ spec.add_runtime_dependency "pry"
+ spec.add_runtime_dependency "stock_quote", ">= 1.1.8"
+ # I have to include rest-client and mime-types on behalf of the stock_quote gem so
+ # that I don't get "WARN: Unresolved specs during Gem::Specification.reset" warnings
+ spec.add_runtime_dependency "rest-client", ">= 1.7.2"
+ spec.add_runtime_dependency "mime-types", ">= 2.3"
end
|
Fix Gemspec warning error on released gem.
|
diff --git a/app/controllers/api/v2/stomping_grounds_controller.rb b/app/controllers/api/v2/stomping_grounds_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/v2/stomping_grounds_controller.rb
+++ b/app/controllers/api/v2/stomping_grounds_controller.rb
@@ -31,7 +31,13 @@
def update
stomping_ground = @traveler.stomping_grounds.find_by(id: params[:id])
- stomping_ground.update_from_google_place_attributes(params[:stomping_ground])
+ if stomping_ground
+ stomping_ground.update_from_google_place_attributes(params[:stomping_ground])
+ render(success_response(message: "Updated"))
+ else
+ render(fail_response(status: 404, message: "Not found"))
+ end
+
end
end
|
Return 200 on successful update and 404 when ID is not found for stomping ground
|
diff --git a/app/controllers/groups/avatars_controller.rb b/app/controllers/groups/avatars_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/groups/avatars_controller.rb
+++ b/app/controllers/groups/avatars_controller.rb
@@ -1,4 +1,4 @@-class Groups::AvatarsController < ApplicationController
+class Groups::AvatarsController < Groups::ApplicationController
def destroy
@group.remove_avatar!
@group.save
|
Fix removing avatar for group
Signed-off-by: Dmitriy Zaporozhets <be23d75b156792e5acab51b196a2deb155d35d6a@gmail.com>
|
diff --git a/app/interactors/apns/deliver_notification.rb b/app/interactors/apns/deliver_notification.rb
index abc1234..def5678 100644
--- a/app/interactors/apns/deliver_notification.rb
+++ b/app/interactors/apns/deliver_notification.rb
@@ -6,6 +6,7 @@ end
def call
+ Rails.logger.debug "Delivering notification: #{context[:notification]}"
SnsService.deliver_notification(
context[:endpoint_arn], {
platform_key => { aps: aps_options }.merge(context[:notification].metadata).to_json
|
Add debug logging for deliveries
|
diff --git a/test/test_helper.rb b/test/test_helper.rb
index abc1234..def5678 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -0,0 +1,14 @@+ENV["RAILS_ENV"] = "test"
+require File.expand_path('../../config/environment', __FILE__)
+require 'rails/test_help'
+
+class ActiveSupport::TestCase
+ # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
+ #
+ # Note: You'll currently still have to declare fixtures explicitly in integration tests
+ # -- they do not yet inherit this setting
+ fixtures :all
+
+ # Add more helper methods to be used by all tests here...
+
+end
|
Test suite running with failing tests
|
diff --git a/lib/has_navigation/has_navigation/has_navigation.rb b/lib/has_navigation/has_navigation/has_navigation.rb
index abc1234..def5678 100644
--- a/lib/has_navigation/has_navigation/has_navigation.rb
+++ b/lib/has_navigation/has_navigation/has_navigation.rb
@@ -19,7 +19,7 @@ resource_nav_item = self.resource_nav_item.blank? ? ResourceNavItem.new : self.resource_nav_item
resource_nav_item.attributes = options.merge(title: (self.try(:title) || "#{self.class} - #{self.id}"),
url: polymorphic_path(self),
- admin_url: "/admin#{edit_polymorphic_path(self)}",
+ admin_url: edit_polymorphic_path([:admin, self]),
setting_prefix: respond_to?(:settings_prefix) ? settings_prefix : nil)
resource_nav_item
end
|
Fix for shonky front-end link resolution in /admin.
|
diff --git a/test/test_helper.rb b/test/test_helper.rb
index abc1234..def5678 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -4,7 +4,7 @@ require 'simplecov'
require 'coveralls'
-SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
+SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new [
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
]
|
Fix deprecation warning on SimpleCov::Formatter::MultiFormatter use.
|
diff --git a/Casks/reaper.rb b/Casks/reaper.rb
index abc1234..def5678 100644
--- a/Casks/reaper.rb
+++ b/Casks/reaper.rb
@@ -3,7 +3,7 @@ sha256 '0b3946b9b200d93aab89343f4523add7ea49cd3e3a6f4d4ed84d8feaee8a4224'
url "https://www.reaper.fm/files/#{version.major}.x/reaper#{version.no_dots}_x86_64.dmg"
- appcast 'http://www.cockos.com/reaper/latestversion/?p=osx_64'
+ appcast 'https://www.cockos.com/reaper/latestversion/?p=osx_64'
name 'REAPER'
homepage 'https://www.reaper.fm/'
|
Use HTTPS for Reaper appcast
New appcast URL is reachable via HTTPS as well as HTTP. Use HTTPS instead of HTTP.
|
diff --git a/spec/features/viewing_the_home_page.rb b/spec/features/viewing_the_home_page.rb
index abc1234..def5678 100644
--- a/spec/features/viewing_the_home_page.rb
+++ b/spec/features/viewing_the_home_page.rb
@@ -0,0 +1,27 @@+require 'spec_helper'
+
+describe 'Viewing the home page' do
+ subject(:home_visit) { visit root_path }
+
+ context "when there are no guide articles" do
+ it "redirects to the article index" do
+ expect { home_visit }.to change { current_path }.to(articles_path)
+ end
+ end
+
+ context "when there are guide articles" do
+ before { create(:article, :guide) }
+
+ it "displays the guide index" do
+ expect { home_visit }.to change { current_path }.to(root_path)
+ end
+
+ context "and regular articles" do
+ before { create(:article) }
+
+ it "also displays the guide index" do
+ expect { home_visit }.to change { current_path }.to(root_path)
+ end
+ end
+ end
+end
|
Add basic home page feature specs
|
diff --git a/spec/support/factories/file_factory.rb b/spec/support/factories/file_factory.rb
index abc1234..def5678 100644
--- a/spec/support/factories/file_factory.rb
+++ b/spec/support/factories/file_factory.rb
@@ -20,6 +20,7 @@ @@paths_created ||= []
unless File.directory?(path)
@@paths_created << FileUtils.mkdir_p(path).first
+ @@paths_created << path.split('/').first
end
end
end
|
Delete top-level directories created in specs
|
diff --git a/spec/symbolic_math/ast/builder_spec.rb b/spec/symbolic_math/ast/builder_spec.rb
index abc1234..def5678 100644
--- a/spec/symbolic_math/ast/builder_spec.rb
+++ b/spec/symbolic_math/ast/builder_spec.rb
@@ -4,13 +4,14 @@ context "simple operations" do
it "correctly builds the AST" do
operations = {
- "1 + 2" => eq(3),
- "7.5 - 3" => eq(4.5),
- "2 + 3 * 5" => eq(17),
- "8 / 5" => eq(Rational(8,5)),
- "4**2 + 3 * 5" => eq(31),
- "2 ** (1/2)" => eq(Math.sqrt(2)),
- "sin(pi)" => be_within(1e-10).of(0)
+ "1 + 2" => eq(3),
+ "7.5 - 3" => eq(4.5),
+ "2 + 3 * 5" => eq(17),
+ "8 / 5" => eq(Rational(8,5)),
+ "(1+2) * (3+4*(1+1))" => eq(33),
+ "4**2 + 3 * 5" => eq(31),
+ "2 ** (1/2)" => eq(Math.sqrt(2)),
+ "sin(pi)" => be_within(1e-10).of(0)
}
operations.each do |operation, matcher|
|
Add parentheses test for Builder
|
diff --git a/app/models/donation.rb b/app/models/donation.rb
index abc1234..def5678 100644
--- a/app/models/donation.rb
+++ b/app/models/donation.rb
@@ -1,6 +1,6 @@ class Donation < ActiveRecord::Base
belongs_to :round
- attr_accessible :amount, :email, :name, :stripe_token
+ attr_accessible :amount, :email, :name, :stripe_token, :round
def gravatar_url
Rails.application.config.gravatar_url % Digest::MD5.hexdigest(self.email)
|
Add :round to attr_accessible in Donation
|
diff --git a/app/models/my_model.rb b/app/models/my_model.rb
index abc1234..def5678 100644
--- a/app/models/my_model.rb
+++ b/app/models/my_model.rb
@@ -1,10 +1,6 @@ class MyModel < ActiveRecord::Base
- if ENV['ALGOLIASEARCH_APPLICATION_ID']
- include AlgoliaSearch
-
- algoliasearch auto_index: false, auto_remove: false do
- end
+ algoliasearch auto_index: false, auto_remove: false do
end
end
|
Revert "I need to path this helper to not fail if the env variables are missing"
This reverts commit 6b7fe0dcc7be57a0bd9469f518ea82c4201b6baa.
|
diff --git a/spec/mixin_queryable_spec.rb b/spec/mixin_queryable_spec.rb
index abc1234..def5678 100644
--- a/spec/mixin_queryable_spec.rb
+++ b/spec/mixin_queryable_spec.rb
@@ -3,8 +3,8 @@
describe RDF::Queryable do
before :each do
- @file = etc_file("doap.nt")
- @statements = RDF::NTriples::Reader.new(File.open(@file)).to_a
+ @filename = etc_file("doap.nt")
+ @statements = RDF::NTriples::Reader.new(File.open(@filename)).to_a
@queryable = @statements.extend(RDF::Queryable)
@subject = RDF::URI.new("http://rubygems.org/gems/rdf")
end
|
Update queryable spec to use @filename
|
diff --git a/core/spec/requests/admin/configuration/states_spec.rb b/core/spec/requests/admin/configuration/states_spec.rb
index abc1234..def5678 100644
--- a/core/spec/requests/admin/configuration/states_spec.rb
+++ b/core/spec/requests/admin/configuration/states_spec.rb
@@ -1,26 +1,28 @@ require 'spec_helper'
describe "States" do
+ let!(:country) { Factory.create(:country) }
+
before(:each) do
+ Spree::Config[:default_country_id] = country.id
+
visit spree.admin_path
click_link "Configuration"
end
context "admin visiting states listing" do
- before(:each) do
- Factory(:zone)
- end
+ let!(:state) { Factory.create(:state, :country => country) }
it "should correctly display the states" do
click_link "States"
- find('table#listing_states tbody tr:nth-child(1) td:nth-child(1)').text.should == Spree::State.limit(1).order('name asc').to_a.first.name.downcase.capitalize
+ page.should have_content(state.name)
end
end
context "creating and editing states" do
it "should allow an admin to edit existing states", :js => true do
click_link "States"
- select "Canada", :from => "country"
+ select country.name, :from => "country"
click_link "new_state_link"
fill_in "state_name", :with => "Calgary"
fill_in "Abbreviation", :with => "CL"
@@ -31,7 +33,7 @@
it "should show validation errors", :js => true do
click_link "States"
- select "Canada", :from => "country"
+ select country.name, :from => "country"
click_link "new_state_link"
fill_in "state_name", :with => ""
fill_in "Abbreviation", :with => ""
|
Clean up states spec so that a country + state are created for testing purposes
|
diff --git a/YelpAPI.podspec b/YelpAPI.podspec
index abc1234..def5678 100644
--- a/YelpAPI.podspec
+++ b/YelpAPI.podspec
@@ -19,7 +19,7 @@
s.homepage = "https://github.com/Yelp/yelp-ios"
s.license = 'MIT'
- s.author = { "David Chen" => "ywchen@yelp.com" }
+ s.author = 'Yelp'
s.source = { :git => "https://github.com/Yelp/yelp-ios.git", :tag => s.version.to_s }
s.platform = :ios, '7.0'
|
Change Podspec author to Yelp.
|
diff --git a/app/models/shipment.rb b/app/models/shipment.rb
index abc1234..def5678 100644
--- a/app/models/shipment.rb
+++ b/app/models/shipment.rb
@@ -1,16 +1,23 @@ class Shipment < ActiveRecord::Base
belongs_to :pod
belongs_to :user
+
+ after_save :send_shipment_email
def crops
pod.instructions.map{|x| x.ship ? x.crop : nil}.compact
end
def ship!
- self.shipped = true
- save!
- # Tell the user!
- Notifications.shipped(self.user).deliver
+ update_attributes!(shipped: true)
end
+
+ def send_shipment_email
+ if shipped_changed? && shipped_was == false && shipped == true
+ # Tell the user!
+ Notifications.shipped(self.user).deliver
+ end
+ end
+
end
|
Send shipping email whenever shipped flag is set to true
Resolves #117
|
diff --git a/spec/app/analyser/doctor/database_analyser_spec.rb b/spec/app/analyser/doctor/database_analyser_spec.rb
index abc1234..def5678 100644
--- a/spec/app/analyser/doctor/database_analyser_spec.rb
+++ b/spec/app/analyser/doctor/database_analyser_spec.rb
@@ -0,0 +1,57 @@+require "spec_helper"
+
+class Dog
+end
+
+RSpec.describe Doctor::DatabaseAnalyser do
+
+ subject do
+ described_class.new.analyse
+ end
+
+ describe "#analyse" do
+
+ before do
+ expect(Dog).to receive(:model_name).and_return(Dog.name.to_s)
+ Doctor::ConfigManager.active_record_list.concat [Dog]
+ end
+
+ after do
+ Doctor::ConfigManager.active_record_list.clear
+ end
+
+ context "Process with success" do
+
+ before do
+ expect(Dog).to receive(:first).and_return(Dog.new)
+ end
+
+ it "Does return a object with status attribute value 'ok'" do
+ expect(subject.first.status).to eq("ok")
+ end
+
+ it "Does return a object with active_record attribute value 'dog'" do
+ expect(subject.first.active_record).to eq(Dog.name.to_s)
+ end
+
+ it "Does return a object with error_message attribute value nil" do
+ expect(subject.first.error_message).to be_nil
+ end
+ end
+
+ context "Process with failed" do
+
+ before do
+ expect(Dog).to receive(:first).and_raise("i_have_failed")
+ end
+
+ it "Does return a object with status attribute value 'error'" do
+ expect(subject.first.status).to eq("error")
+ end
+
+ it "Does return a object with error_message attribute value 'i_have_failed'" do
+ expect(subject.first.status).to eq("error")
+ end
+ end
+ end
+end
|
Add spec to file database_analyser
|
diff --git a/lib/cucover/cli_commands/cucumber.rb b/lib/cucover/cli_commands/cucumber.rb
index abc1234..def5678 100644
--- a/lib/cucover/cli_commands/cucumber.rb
+++ b/lib/cucover/cli_commands/cucumber.rb
@@ -6,9 +6,17 @@ end
def execute
+ require 'rubygems'
+ require 'cucumber'
+
+ step_mother = ::Cucumber::StepMother.new
+ step_mother.load_programming_language('rb')
require 'cucover/cucumber_hooks'
ARGV.replace cucumber_args
- Kernel.load ::Cucumber::BINARY
+
+ ::Cucumber::Cli::Main.new(ARGV).execute!(step_mother)
+ # Kernel.load ::Cucumber::BINARY
+
ARGV.replace @cli_args
end
|
WIP: Fix Before hooks. Force into ruby mode for now. Dip a little into Cukes internals to get things running
|
diff --git a/lib/tasks/refresh_elasticsearch.rake b/lib/tasks/refresh_elasticsearch.rake
index abc1234..def5678 100644
--- a/lib/tasks/refresh_elasticsearch.rake
+++ b/lib/tasks/refresh_elasticsearch.rake
@@ -0,0 +1,15 @@+namespace :elasticsearch do
+ desc 'Refresh Elastic Search Index'
+ task :refresh => :environment do
+ refresh_elasticsearch
+ end
+end
+
+def refresh_elasticsearch
+ Response.__elasticsearch__.delete_index!
+ puts "Deleted"
+ Response.__elasticsearch__.create_index!
+ puts "Created"
+ Response.__elasticsearch__.import
+ puts "Imported"
+end
|
Add rake task to refresh indexes
|
diff --git a/lib/vmdb/loggers/container_logger.rb b/lib/vmdb/loggers/container_logger.rb
index abc1234..def5678 100644
--- a/lib/vmdb/loggers/container_logger.rb
+++ b/lib/vmdb/loggers/container_logger.rb
@@ -26,17 +26,18 @@ }.freeze
def call(severity, time, progname, msg)
- # From https://github.com/ViaQ/elasticsearch-templates/releases Downloads asciidoc
+ # From https://github.com/ViaQ/elasticsearch-templates/releases -> Downloads -> *.asciidoc
+ # NOTE: These values are in a specific order for easier human readbility via STDOUT
{
:@timestamp => format_datetime(time),
:hostname => hostname,
- :level => translate_error(severity),
- :message => prefix_task_id(msg2str(msg)),
:pid => $PROCESS_ID,
:tid => thread_id,
:service => progname,
+ :level => translate_error(severity),
+ :message => prefix_task_id(msg2str(msg)),
# :tags => "tags string",
- }.to_json << "\n"
+ }.delete_nils.to_json << "\n"
end
private
|
Make the container JSON logs more human readable
- Remove the "service":null bit since it's null 100% of the time right
now. This is done using delete_nils.
- Put the message at the end, since it's the longest variable length.
- Moving level down better shows the top-down scoping.
|
diff --git a/lib/engineyard-cloud-client/version.rb b/lib/engineyard-cloud-client/version.rb
index abc1234..def5678 100644
--- a/lib/engineyard-cloud-client/version.rb
+++ b/lib/engineyard-cloud-client/version.rb
@@ -1,7 +1,7 @@ # This file is maintained by a herd of rabid monkeys with Rakes.
module EY
class CloudClient
- VERSION = '1.0.14'
+ VERSION = '1.0.15.pre'
end
end
# Please be aware that the monkeys like tho throw poo sometimes.
|
Add .pre for next release
|
diff --git a/lib/rubocop/cop/mixin/comments_help.rb b/lib/rubocop/cop/mixin/comments_help.rb
index abc1234..def5678 100644
--- a/lib/rubocop/cop/mixin/comments_help.rb
+++ b/lib/rubocop/cop/mixin/comments_help.rb
@@ -22,16 +22,7 @@ end
def begin_pos_with_comment(node)
- annotation_line = node.first_line - 1
- first_comment = nil
-
- processed_source.comments_before_line(annotation_line)
- .reverse_each do |comment|
- if comment.location.line == annotation_line
- first_comment = comment
- annotation_line -= 1
- end
- end
+ first_comment = processed_source.ast_with_comments[node].first
start_line_position(first_comment || node)
end
|
Improve handling of comments in ClassMethodsDefinition autocorrection
Previously it would take nodes that have inline comment as well,
as long as a blank line to separate the node from the one that would be extracted is missing.
|
diff --git a/lib/stepping_stone/model/doc_string.rb b/lib/stepping_stone/model/doc_string.rb
index abc1234..def5678 100644
--- a/lib/stepping_stone/model/doc_string.rb
+++ b/lib/stepping_stone/model/doc_string.rb
@@ -0,0 +1,80 @@+module SteppingStone
+ module Model
+ # Represents an inline argument in a step. Example:
+ #
+ # Given the message
+ # """
+ # I like
+ # Cucumber sandwich
+ # """
+ #
+ # The text between the pair of <tt>"""</tt> is stored inside a DocString,
+ # which is yielded to the StepDefinition block as the last argument.
+ #
+ # The StepDefinition can then access the String via the #to_s method. In the
+ # example above, that would return: <tt>"I like\nCucumber sandwich"</tt>
+ #
+ # Note how the indentation from the source is stripped away.
+ #
+ class DocString #:nodoc:
+ class Builder
+ attr_reader :string
+
+ def initialize
+ @string = ''
+ end
+
+ def doc_string(string, line_number)
+ @string = string
+ end
+
+ def eof
+ end
+ end
+
+ attr_accessor :file
+
+ def self.default_arg_name
+ "string"
+ end
+
+ def self.parse(text)
+ builder = Builder.new
+ lexer = Gherkin::I18nLexer.new(builder)
+ lexer.scan(text)
+ new(builder.string)
+ end
+
+ def initialize(string)
+ @string = string
+ end
+
+ def to_step_definition_arg
+ @string
+ end
+
+ def accept(visitor)
+ return if Cucumber.wants_to_quit
+ visitor.visit_doc_string(@string)
+ end
+
+ def arguments_replaced(arguments) #:nodoc:
+ string = @string
+ arguments.each do |name, value|
+ value ||= ''
+ string = string.gsub(name, value)
+ end
+ DocString.new(string)
+ end
+
+ def has_text?(text)
+ @string.index(text)
+ end
+
+ # For testing only
+ def to_sexp #:nodoc:
+ [:doc_string, to_step_definition_arg]
+ end
+ end
+ end
+end
|
Copy DocString from Cucumber 1.x
|
diff --git a/lib/tasks/jmd_resave_performances.rake b/lib/tasks/jmd_resave_performances.rake
index abc1234..def5678 100644
--- a/lib/tasks/jmd_resave_performances.rake
+++ b/lib/tasks/jmd_resave_performances.rake
@@ -3,8 +3,14 @@ desc "Resave all performances, leaving their timestamps untouched"
task resave: :environment do
Performance.all.each do |performance|
+ age_group = performance.age_group
if performance.save_without_timestamping
- puts "Resaved performance #{performance.id}"
+ new_age_group = performance.age_group
+ if new_age_group != age_group
+ puts "Resaved performance #{performance.id} and updated age group from #{age_group} to #{new_age_group}"
+ else
+ puts "Resaved performance #{performance.id}"
+ end
else
puts "Failed to resave performance #{performance.id}"
end
|
Add info about age group having changed to resave task
|
diff --git a/test/integration/default/linux_spec.rb b/test/integration/default/linux_spec.rb
index abc1234..def5678 100644
--- a/test/integration/default/linux_spec.rb
+++ b/test/integration/default/linux_spec.rb
@@ -15,9 +15,7 @@ its('content') { should match /allow_unencrypted true/ }
end
-if ( os[:family] == 'centos' && os[:release].to_i > 6 ||
- os[:family] == 'debian' && os[:release].to_i > 7 ||
- os[:family] == 'ubuntu' )
+if os.redhat? && os[:release].to_i > 6 || os.debian? && os[:release].to_i > 7
describe service('chef-push-jobs-client') do
it { should be_enabled }
it { should be_running }
|
Use os helpers for inspec
Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
|
diff --git a/features/support/ui/sections/footer_cookie_message.rb b/features/support/ui/sections/footer_cookie_message.rb
index abc1234..def5678 100644
--- a/features/support/ui/sections/footer_cookie_message.rb
+++ b/features/support/ui/sections/footer_cookie_message.rb
@@ -2,6 +2,6 @@
module UI::Sections
class FooterCookieMessage < UI::Section
- element :close_button, 'button.cookie-message__submit'
+ element :close_button, '.cookie-message__close-button'
end
end
|
Update the selector for the button element in the cookie message section.
|
diff --git a/gds-api-adapters.gemspec b/gds-api-adapters.gemspec
index abc1234..def5678 100644
--- a/gds-api-adapters.gemspec
+++ b/gds-api-adapters.gemspec
@@ -12,6 +12,7 @@ s.email = ["jystewart@gmail.com"]
s.summary = "Adapters to work with GDS APIs"
s.homepage = "http://github.com/alphagov/gds-api-adapters"
+ s.description = "A set of adapters providing easy access to the GDS gov.uk APIs"
s.files = Dir.glob("lib/**/*") + %w(README.md Rakefile)
s.test_files = Dir['test/**/*']
|
Add homepage and description to gemspec
|
diff --git a/gemnasium-parser.gemspec b/gemnasium-parser.gemspec
index abc1234..def5678 100644
--- a/gemnasium-parser.gemspec
+++ b/gemnasium-parser.gemspec
@@ -13,4 +13,6 @@ gem.name = "gemnasium-parser"
gem.require_paths = ["lib"]
gem.version = Gemnasium::Parser::VERSION
+
+ gem.add_development_dependency "rspec", "~> 2.7"
end
|
Add the rspec gem dependency
|
diff --git a/lib/chef_zero/endpoints/environment_nodes_endpoint.rb b/lib/chef_zero/endpoints/environment_nodes_endpoint.rb
index abc1234..def5678 100644
--- a/lib/chef_zero/endpoints/environment_nodes_endpoint.rb
+++ b/lib/chef_zero/endpoints/environment_nodes_endpoint.rb
@@ -13,7 +13,7 @@ list_data(request, ['nodes']).each do |name|
node = JSON.parse(get_data(request, ['nodes', name]), :create_additions => false)
if node['chef_environment'] == request.rest_path[1]
- result[name] = build_uri(request.base_uri, 'nodes', name)
+ result[name] = build_uri(request.base_uri, ['nodes', name])
end
end
json_response(200, result)
|
Fix an issue with an incorrect number of parameters passed to build_uri
|
diff --git a/app/helpers/news_helper.rb b/app/helpers/news_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/news_helper.rb
+++ b/app/helpers/news_helper.rb
@@ -7,19 +7,26 @@ 'content-listing'
end
+
def news_articles(section: nil)
- query_root = if section.present?
- section.news_articles
- else
- NewsArticle
- end
- query_root
+ query_root(section)
.preload([
{:section => {:home_node => :parent}},
- {:sections => {:home_node => :parent}}])
+ {:sections => {:home_node => :parent}}
+ ])
.published
.by_release_date
.by_published_at
.by_name
end
+
+ private
+
+ def query_root(section: nil)
+ if section.present?
+ section.news_articles
+ else
+ NewsArticle
+ end
+ end
end
|
Split query root code into new method
|
diff --git a/benchmark-bigo.gemspec b/benchmark-bigo.gemspec
index abc1234..def5678 100644
--- a/benchmark-bigo.gemspec
+++ b/benchmark-bigo.gemspec
@@ -24,5 +24,5 @@
s.add_development_dependency 'minitest', '~> 5.3'
s.add_development_dependency 'rdoc', '~> 4.0'
- s.add_development_dependency 'rake'
+ s.add_development_dependency 'rake', '~> 12.0'
end
|
Add version dependency to rake
|
diff --git a/test/integration/sqlite/serverspec/sqliste_spec.rb b/test/integration/sqlite/serverspec/sqliste_spec.rb
index abc1234..def5678 100644
--- a/test/integration/sqlite/serverspec/sqliste_spec.rb
+++ b/test/integration/sqlite/serverspec/sqliste_spec.rb
@@ -20,13 +20,27 @@ require_relative 'spec_helper'
require 'json'
+family = os[:family].downcase
+docroot_dir =
+ if %w(centos redhat fedora scientific amazon).include?(family)
+ '/var/www/html'
+ elsif %w(suse opensuse).include?(family)
+ '/srv/www/htdocs'
+ elsif %w(arch).include?(family)
+ '/srv/http'
+ elsif %w(freebsd).include?(family)
+ '/usr/local/www/apache24/data'
+ else
+ '/var/www'
+ end
+
describe 'sqlite' do
- describe file('/var/www/owncloud/data') do
+ describe file("#{docroot_dir}/owncloud/data") do
it { should be_directory }
it { should be_mode 750 }
end
- describe file('/var/www/owncloud/data/owncloud.db') do
+ describe file("#{docroot_dir}/owncloud/data/owncloud.db") do
it { should be_file }
it { should be_mode 644 }
end
|
Fix SQLite integration tests on CentOS
|
diff --git a/lib/generators/katapult/install/templates/lib/katapult/application_model.rb b/lib/generators/katapult/install/templates/lib/katapult/application_model.rb
index abc1234..def5678 100644
--- a/lib/generators/katapult/install/templates/lib/katapult/application_model.rb
+++ b/lib/generators/katapult/install/templates/lib/katapult/application_model.rb
@@ -13,3 +13,6 @@ # wui.action :show
# wui.action :lock, scope: :member, method: :post
# end
+#
+# Add navigation
+# navigation :main
|
Add navigation to application model template (thereby fix Cucumber scenario)
|
diff --git a/db/migrate/20120806141008_add_note_tables.rb b/db/migrate/20120806141008_add_note_tables.rb
index abc1234..def5678 100644
--- a/db/migrate/20120806141008_add_note_tables.rb
+++ b/db/migrate/20120806141008_add_note_tables.rb
@@ -2,13 +2,13 @@ up do
create_table :section_notes do
primary_key :id
- foreign_key :section_id, :sections
+ index :section_id
String :content, text: true
end
create_table :chapter_notes do
primary_key :id
- foreign_key :section_id, :sections
+ index :section_id
Integer :chapter_id, index: true
String :content, text: true
end
|
Use plain indexes, without FK constraints.
FK constraints yield problems if TRUNCATE is used. FK logic should be
handled Rails way (by the application).
|
diff --git a/app/template.rb b/app/template.rb
index abc1234..def5678 100644
--- a/app/template.rb
+++ b/app/template.rb
@@ -1,6 +1,11 @@ apply "app/assets/javascripts/application.js.rb"
copy_file "app/assets/stylesheets/application.css.scss"
remove_file "app/assets/stylesheets/application.css"
+
+insert_into_file "app/controllers/application_controller.rb",
+ :after => /protect_from_forgery.*\n/ do
+ " ensure_security_headers\n"
+end
copy_file "app/controllers/home_controller.rb"
copy_file "app/helpers/javascript_helper.rb"
|
Add ensure_security_headers to app controller
|
diff --git a/alacena.gemspec b/alacena.gemspec
index abc1234..def5678 100644
--- a/alacena.gemspec
+++ b/alacena.gemspec
@@ -20,6 +20,7 @@
spec.add_dependency "eventmachine", "~> 1.0.7"
+ spec.add_development_dependency "minitest", "~> 5.5.1"
spec.add_development_dependency "bundler", "~> 1.7"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "cucumber"
|
Add minitest to the gemspec
|
diff --git a/lib/dm-address.rb b/lib/dm-address.rb
index abc1234..def5678 100644
--- a/lib/dm-address.rb
+++ b/lib/dm-address.rb
@@ -9,7 +9,7 @@
module DataMapper
module Address
- VERSION = '0.3.0'
+ VERSION = '0.4.0'
DEFAULTS = {
:phone_format => PhoneNumber::DEFAULT_FORMAT.dup,
|
Update Address::VERSION constant to 0.4.0
Changes since 0.3.0:
- Updates for DM 0.10 compatibility
- Add Address::Preferred module
- Housecleaning updates (nicer requires, etc)
|
diff --git a/app/controllers/activities_controller.rb b/app/controllers/activities_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/activities_controller.rb
+++ b/app/controllers/activities_controller.rb
@@ -8,6 +8,10 @@ end
protected
+ def insecure
+ true
+ end
+
def sorts
["lower(activities.name) ASC"]
end
|
Allow adding activity without password re-entry
|
diff --git a/lib/ext/hadoop.rb b/lib/ext/hadoop.rb
index abc1234..def5678 100644
--- a/lib/ext/hadoop.rb
+++ b/lib/ext/hadoop.rb
@@ -7,4 +7,11 @@ module Conf
include_package 'org.apache.hadoop.conf'
end
+ module Mapreduce
+ module Lib
+ module Partition
+ include_package 'org.apache.hadoop.mapreduce.lib.partition'
+ end
+ end
+ end
end
|
Add the partition package to the Hadoop module tree
|
diff --git a/app/models/concerns/taggable_document.rb b/app/models/concerns/taggable_document.rb
index abc1234..def5678 100644
--- a/app/models/concerns/taggable_document.rb
+++ b/app/models/concerns/taggable_document.rb
@@ -3,11 +3,20 @@
included do
belongs_to :document_tag
+ validates :document_tag_id, :presence => true
+ end
- # returns boolean indicating whether or not update was successful
- def update_from_filename filename
- self.original_filename = filename
- self.valid?
- end
+ attr_accessor :attributes_from_file_name
+ attr_accessor :folder
+
+ def self.form_params
+ FORM_PARAMS + :document_tag_id
end
+
+ # returns boolean indicating whether or not update was successful
+ def update_from_filename filename
+ self.original_filename = filename
+ self.valid?
+ end
+
end
|
[BMCDOT-825] Add table for structure documents sorted by folder. Current tab functionality is not working, but the table works correctly if you force it to become visible (by adding the "active in" classes to the tab-pane).
|
diff --git a/app/views/json/partials/_enterprise.rabl b/app/views/json/partials/_enterprise.rabl
index abc1234..def5678 100644
--- a/app/views/json/partials/_enterprise.rabl
+++ b/app/views/json/partials/_enterprise.rabl
@@ -1,4 +1,4 @@-attributes :name, :id, :description, :latitude, :longitude, :long_description, :website, :instagram, :linkedin, :twitter, :facebook, :is_primary_producer, :is_distributor
+attributes :name, :id, :description, :latitude, :longitude, :long_description, :website, :instagram, :linkedin, :twitter, :facebook, :is_primary_producer, :is_distributor, :phone
node :email do |enterprise|
enterprise.email.to_s.reverse
|
Make the rabl capture phone number at enterprise level
|
diff --git a/lib/pay/engine.rb b/lib/pay/engine.rb
index abc1234..def5678 100644
--- a/lib/pay/engine.rb
+++ b/lib/pay/engine.rb
@@ -1,5 +1,7 @@ module Pay
class Engine < ::Rails::Engine
+ isolate_namespace Pay
+
initializer 'pay.processors' do
# Include processor backends
require 'pay/stripe' if defined? ::Stripe
|
Revert "Don't need isolating of namespace"
This reverts commit 6e29c77b3c303e3e1285ecfc44a12669ab3c514f.
|
diff --git a/lib/yml_reader.rb b/lib/yml_reader.rb
index abc1234..def5678 100644
--- a/lib/yml_reader.rb
+++ b/lib/yml_reader.rb
@@ -23,7 +23,7 @@ # directory specified by a call to the yml_directory= method.
#
def load(filename)
- @yml = YAML.load_file "#{yml_directory}/#{filename}"
+ @yml = YAML.load(ERB.new(File.read("#{yml_directory}/#{filename}")).result)
end
end
|
Add ERB into yml reader
|
diff --git a/roles/ic.rb b/roles/ic.rb
index abc1234..def5678 100644
--- a/roles/ic.rb
+++ b/roles/ic.rb
@@ -8,7 +8,7 @@ }
},
:networking => {
- :nameservers => ["146.179.159.177"],
+ :nameservers => ["8.8.8.8", "146.179.159.177"],
:roles => {
:internal => {
:inet => {
|
Add google DNS for IC machines
|
diff --git a/Ruby/extconf.rb b/Ruby/extconf.rb
index abc1234..def5678 100644
--- a/Ruby/extconf.rb
+++ b/Ruby/extconf.rb
@@ -12,9 +12,8 @@ exit
end
-qmake_path = File.readlink(qmake_path) if File.symlink?(qmake_path)
-qt_path = qmake_path.sub('/bin/qmake', '')
-
-pkg_config("#{qt_path}/lib/pkgconfig/QtCore.pc")
+qmake_path = File.readlink(qmake_path) while File.symlink?(qmake_path)
+qt_path = qmake_path.sub(/\/bin\/qmake.*$/, '')
+pkg_config("#{qt_path}/lib/pkgconfig/QtNetwork.pc")
create_makefile("QAR")
|
Make it work out of the box on Ubuntu 10.10
|
diff --git a/LVGUtilities.podspec b/LVGUtilities.podspec
index abc1234..def5678 100644
--- a/LVGUtilities.podspec
+++ b/LVGUtilities.podspec
@@ -1,7 +1,7 @@ Pod::Spec.new do |s|
s.name = "LVGUtilities"
- s.version = "0.3.0"
+ s.version = "0.3.1"
s.summary = "Basic Swift utility functions."
s.homepage = 'https://github.com/letvargo/LVGUtilities'
s.description = <<-DESC
@@ -13,7 +13,7 @@ s.author = { "letvargo" => "letvargo@gmail.com" }
s.ios.deployment_target = "8.0"
s.osx.deployment_target = "10.10"
- s.source = { :git => "https://github.com/letvargo/LVGUtilities.git", :tag => "0.3.0" }
+ s.source = { :git => "https://github.com/letvargo/LVGUtilities.git", :tag => "0.3.1" }
s.source_files = "Source/**/*"
s.requires_arc = true
|
Update podspec to version 0.3.1
|
diff --git a/week-6/credit-card/credit_card_spec.rb b/week-6/credit-card/credit_card_spec.rb
index abc1234..def5678 100644
--- a/week-6/credit-card/credit_card_spec.rb
+++ b/week-6/credit-card/credit_card_spec.rb
@@ -0,0 +1,33 @@+require_relative 'my_solution'
+
+describe CreditCard do
+ describe '#initialize' do
+ it 'Expects a single argument for the card' do
+ expect(CreditCard.instance_method(:initialize).arity).to eq 1
+ end
+
+ it 'raises ArgumentError on card > 16' do
+ expect { CreditCard.new(11111111111111112) }.to raise_error(ArgumentError)
+ end
+
+ it 'raises ArgumentError on card < 16' do
+ expect { CreditCard.new(1) }.to raise_error(ArgumentError)
+ end
+ end
+
+ describe '#check_card' do
+ it 'expects no arguments to be passed' do
+ expect(CreditCard.instance_method(:check_card).arity).to be_zero
+ end
+
+ it 'returns true for a valid card' do
+ card = CreditCard.new(4408041234567901)
+ expect(card.check_card).to eq true
+ end
+
+ it 'returns false for a bad card' do
+ card = CreditCard.new(4408041234567906)
+ expect(card.check_card).to eq false
+ end
+ end
+end
|
Add credit card spec file
|
diff --git a/app/models/build.rb b/app/models/build.rb
index abc1234..def5678 100644
--- a/app/models/build.rb
+++ b/app/models/build.rb
@@ -5,8 +5,6 @@ before_create :generate_uuid
validates :repo, presence: true
-
- serialize :violations_archive, Array
def status
if violations.any?
|
Remove serialization of violations_archive on Build
Follow up to https://github.com/thoughtbot/hound/pull/493. We have no need to
serialize this data.
|
diff --git a/app/models/order.rb b/app/models/order.rb
index abc1234..def5678 100644
--- a/app/models/order.rb
+++ b/app/models/order.rb
@@ -1,5 +1,5 @@ class Order < ApplicationRecord
- belongs_to :users
+ belongs_to :user, optional: true
serialize :user_id
serialize :item_id
has_many :items
|
Update belongs_to validation by giving it an optional: true
|
diff --git a/lib/active_job/retriable.rb b/lib/active_job/retriable.rb
index abc1234..def5678 100644
--- a/lib/active_job/retriable.rb
+++ b/lib/active_job/retriable.rb
@@ -23,6 +23,7 @@ end
before_perform do
+ @retry_attempt ||= 0
@retry_attempt += 1
end
end
|
Make sure @retry_attempt is initialized in the before_perform block
|
diff --git a/babbler.gemspec b/babbler.gemspec
index abc1234..def5678 100644
--- a/babbler.gemspec
+++ b/babbler.gemspec
@@ -23,4 +23,5 @@ gem.add_development_dependency "rake"
gem.add_development_dependency "rspec"
gem.add_development_dependency "rspec-mocks"
+ gem.add_development_dependency "pry"
end
|
Add pry for debugging needs
|
diff --git a/lib/banken/policy_finder.rb b/lib/banken/policy_finder.rb
index abc1234..def5678 100644
--- a/lib/banken/policy_finder.rb
+++ b/lib/banken/policy_finder.rb
@@ -32,10 +32,10 @@ policy || raise(NotDefinedError, "unable to find policy `#{find}` for `#{@controller}`")
end
- private
+ private
- def find
- "#{@controller.camelize}#{SUFFIX}"
- end
+ def find
+ "#{@controller.camelize}#{SUFFIX}"
+ end
end
end
|
Add indent for private definition
|
diff --git a/messaging.gemspec b/messaging.gemspec
index abc1234..def5678 100644
--- a/messaging.gemspec
+++ b/messaging.gemspec
@@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'evt-messaging'
- s.version = '2.7.0.0'
+ s.version = '2.7.0.1'
s.summary = 'Common primitives for platform-specific messaging implementations for Eventide'
s.description = ' '
|
Package version is increased from 2.7.0.0 to 2.7.0.1
|
diff --git a/lib/bright/sis_apis/base.rb b/lib/bright/sis_apis/base.rb
index abc1234..def5678 100644
--- a/lib/bright/sis_apis/base.rb
+++ b/lib/bright/sis_apis/base.rb
@@ -35,7 +35,7 @@ else
raise
end
- rescue Errno::ECONNREFUSED, Net::ReadTimeout, Net::OpenTimeout, EOFError => e
+ rescue Errno::ECONNREFUSED, Errno::ECONNRESET, Net::ReadTimeout, Net::OpenTimeout, EOFError => e
retries += 1
if retries <= retry_attempts.to_i
puts "retrying #{retries}: #{e.class.to_s} - #{e.to_s}"
|
Add Errno::ECONNRESET as a rescued exception as well
|
diff --git a/test/integration/jenkins_plugin_install/serverspec/assert_installed_spec.rb b/test/integration/jenkins_plugin_install/serverspec/assert_installed_spec.rb
index abc1234..def5678 100644
--- a/test/integration/jenkins_plugin_install/serverspec/assert_installed_spec.rb
+++ b/test/integration/jenkins_plugin_install/serverspec/assert_installed_spec.rb
@@ -16,7 +16,6 @@
describe jenkins_plugin('github-oauth') do
it { should be_a_jenkins_plugin }
- it { should have_version('0.20') }
end
# Ensure one of github-oauth's deps was installed
|
Remove `github-oauth` specific version check in integration tests
We don’t install a specific version so this check will fail every time
`github-oauth` releases an updated plugin.
|
diff --git a/Swifter.podspec b/Swifter.podspec
index abc1234..def5678 100644
--- a/Swifter.podspec
+++ b/Swifter.podspec
@@ -1,7 +1,7 @@ Pod::Spec.new do |s|
s.name = "Swifter"
- s.version = "2.3.0"
+ s.version = "2.4.0"
s.summary = ":bird: A Twitter framework for iOS & macOS written in Swift"
s.description = <<-DESC
Twitter framework for iOS & macOS written in Swift, with support of three different types of authentication protocol, and most, if not all, of the REST API.
|
Update Podspec for version increase
|
diff --git a/lib/em-imap/ssl_verifier.rb b/lib/em-imap/ssl_verifier.rb
index abc1234..def5678 100644
--- a/lib/em-imap/ssl_verifier.rb
+++ b/lib/em-imap/ssl_verifier.rb
@@ -0,0 +1,61 @@+require 'openssl'
+
+module EventMachine
+ # Provides the ssl_verify_peer method to EM::IMAP::Connection to verify certificates
+ # for use in ssl connections
+ #
+ module IMAP
+ module Connection
+ def ssl_verify_peer(cert_string)
+ cert = nil
+ begin
+ cert = OpenSSL::X509::Certificate.new(cert_string)
+ rescue OpenSSL::X509::CertificateError
+ return false
+ end
+
+ @last_seen_cert = cert
+
+ if certificate_store.verify(@last_seen_cert)
+ begin
+ certificate_store.add_cert(@last_seen_cert)
+ rescue OpenSSL::X509::StoreError => e
+ raise e unless e.message == 'cert already in hash table'
+ end
+ true
+ else
+ raise OpenSSL::SSL::SSLError.new(%(unable to verify the server certificate for "#{host}"))
+ end
+ end
+
+ def ssl_handshake_completed
+ return true unless verify_peer?
+ unless OpenSSL::SSL.verify_certificate_identity(@last_seen_cert, host)
+ raise OpenSSL::SSL::SSLError.new(%(host "#{host}" does not match the server certificate))
+ else
+ true
+ end
+ end
+
+
+ def verify_peer?
+ true
+# parent.connopts.tls[:verify_peer]
+ end
+
+ def certificate_store
+ @certificate_store ||= begin
+ store = OpenSSL::X509::Store.new
+ store.set_default_paths
+# ca_file = parent.connopts.tls[:cert_chain_file]
+ ca_file = nil
+ store.add_file(ca_file) if ca_file
+ store
+ end
+
+
+ end
+ end
+ end
+end
+
|
Fix missing SSL hostname validation [MiM Vuln]
fixes ConradIrwin/em-imap#25
Based on:
https://github.com/lostisland/faraday/commit/63cf47c95b573539f047c729bd9ad67560bc83ff
https://github.com/igrigorik/em-http-request/issues/339
** missing file
|
diff --git a/config.rb b/config.rb
index abc1234..def5678 100644
--- a/config.rb
+++ b/config.rb
@@ -26,6 +26,9 @@ "answer" => "Quick answers",
}
+# disable X-Frame-Options header
+set :protection, :except => :frame_options
+
configure :development do
set :protection, false
use Slimmer::App, prefix: settings.router[:path_prefix], asset_host: settings.slimmer_asset_host
|
Disable X-Frame-Options header from being set with Rack::Protection
|
diff --git a/lib/pod/command/spec/doc.rb b/lib/pod/command/spec/doc.rb
index abc1234..def5678 100644
--- a/lib/pod/command/spec/doc.rb
+++ b/lib/pod/command/spec/doc.rb
@@ -8,7 +8,7 @@ Opens the web documentation of the Pod with the given NAME.
DESC
- self.arguments = 'NAME'
+ self.arguments = [['NAME', :required]]
def initialize(argv)
@name = argv.shift_argument
|
Fix for newer CLAide version
|
diff --git a/lib/rrj/rabbit/propertie.rb b/lib/rrj/rabbit/propertie.rb
index abc1234..def5678 100644
--- a/lib/rrj/rabbit/propertie.rb
+++ b/lib/rrj/rabbit/propertie.rb
@@ -29,7 +29,7 @@
# Define option sending to rabbitmq for janus admin message
def options_admin(type_request)
- base.merge(routing_key: determine_routing_key(type_request))
+ base.merge(routing_key: Tools::Cluster.instance.queue_admin_to(@instance))
rescue
raise Errors::Rabbit::Propertie::Options_admin
end
|
Fix routing_key for admin queue
|
diff --git a/app_test/run.rb b/app_test/run.rb
index abc1234..def5678 100644
--- a/app_test/run.rb
+++ b/app_test/run.rb
@@ -1,6 +1,31 @@ require_relative 'job_test'
+require_relative '../lib/manager.rb'
-20.times do |n|
- JobTestFast.new.perform_async('NON BLOCKING', n)
- JobTestSlow.new.perform_async('BLOCKING', n)
+# 100000.times do |n|
+# JobTestFast.new.perform_async('NONBLOCKING', n)
+# # sleep(0.0015)
+# end
+
+# 10000.times do |n|
+# JobTestSlow.new.perform_async('BLOCKING', n)
+# sleep(0.0015)
+# end
+
+# 100000.times do |n|
+# ThreadKiller.new.perform_async('Kill', n)
+# end
+
+# arg = Array.new(10000, 'string')
+# 10000.times do |n|
+# LargeArg.new.perform_async(arg, n)
+# end
+
+# unsorted_array = (1..10000).to_a.shuffle
+unsorted_array = (1..1000).to_a.shuffle
+1000.times do |n|
+ HeavyCalculation.new.perform_async(n, unsorted_array)
end
+
+# 100000.times do |n|
+# ManyArgs.new.perform_async(n, [1, 2, 3], { key: 'value'}, :symb, 'string', 22, false)
+# end
|
Add enqueueing for the new benchmarking jobs
|
diff --git a/automata/tests/tc_basic.rb b/automata/tests/tc_basic.rb
index abc1234..def5678 100644
--- a/automata/tests/tc_basic.rb
+++ b/automata/tests/tc_basic.rb
@@ -17,4 +17,21 @@
ac_test(words, text)
end
+
+ def test_large
+ words_input = "/usr/share/dict/words"
+ n = 291
+
+ words = []
+ File.open(words_input, "r") do |fp|
+ while n > 0
+ words << fp.gets.chomp
+ n -= 1
+ end
+ end
+
+ text = words.join(" ")
+
+ ac_test(words, text)
+ end
end
|
automata/test: Add end-to-end test of first 1000 words in dictionary.
|
diff --git a/plugins/aws/check-redshift-events.rb b/plugins/aws/check-redshift-events.rb
index abc1234..def5678 100644
--- a/plugins/aws/check-redshift-events.rb
+++ b/plugins/aws/check-redshift-events.rb
@@ -0,0 +1,73 @@+#!/usr/bin/env ruby
+#
+# ===
+#
+# DESCRIPTION:
+# This plugin checks redshift clusters for maintenance events
+#
+# PLATFORMS:
+# all
+#
+# DEPENDENCIES:
+# sensu-plugin >= 1.5 Ruby gem
+# aws-sdk Ruby gem
+#
+# Copyright (c) 2014, Tim Smith, tim@cozy.co
+#
+# Released under the same terms as Sensu (the MIT license); see LICENSE
+# for details.
+
+require 'rubygems' if RUBY_VERSION < '1.9.0'
+require 'sensu-plugin/check/cli'
+require 'aws-sdk'
+
+class CheckInstanceEvents < Sensu::Plugin::Check::CLI
+ option :aws_access_key,
+ :short => '-a AWS_ACCESS_KEY',
+ :long => '--aws-access-key AWS_ACCESS_KEY',
+ :description => "AWS Access Key. Either set ENV['AWS_ACCESS_KEY_ID'] or provide it as an option",
+ :default => ENV['AWS_ACCESS_KEY_ID']
+
+ option :aws_secret_access_key,
+ :short => '-s AWS_SECRET_ACCESS_KEY',
+ :long => '--aws-secret-access-key AWS_SECRET_ACCESS_KEY',
+ :description => "AWS Secret Access Key. Either set ENV['AWS_SECRET_ACCESS_KEY'] or provide it as an option",
+ :default => ENV['AWS_SECRET_ACCESS_KEY']
+
+ option :aws_region,
+ :short => '-r AWS_REGION',
+ :long => '--aws-region REGION',
+ :description => "AWS Region (such as eu-west-1).",
+ :default => 'us-east-1'
+
+ def run
+ redshift = AWS::Redshift::Client.new(
+ :access_key_id => config[:aws_access_key],
+ :secret_access_key => config[:aws_secret_access_key],
+ :region => config[:aws_region])
+
+ begin
+ # fetch all clusters identifiers
+ clusters = redshift.describe_clusters[:clusters].collect { |c| c[:cluster_identifier] }
+ maint_clusters = []
+
+ # fetch the last 2 hours of events for each cluster
+ clusters.each do |cluster_name|
+ events_record = redshift.describe_events({:start_time => (Time.now - 7200).iso8601, :source_type => 'cluster', :source_identifier => cluster_name })
+
+ next if events_record[:events].empty?
+
+ # if the last event is a start maint event then the cluster is still in maint
+ maint_clusters.push(cluster_name) if events_record[:events][-1][:event_id] == 'REDSHIFT-EVENT-2003'
+ end
+ rescue Exception => e
+ unknown "An error occurred processing AWS Redshift API: #{e.message}"
+ end
+
+ if maint_clusters.empty?
+ ok
+ else
+ critical("Clusters in maintenance: #{maint_clusters.split(',')}")
+ end
+ end
+end
|
Add new plugin to check all redshift clusters in an AWS region for maintenance events
|
diff --git a/app/controllers/outpost/application_controller.rb b/app/controllers/outpost/application_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/outpost/application_controller.rb
+++ b/app/controllers/outpost/application_controller.rb
@@ -4,10 +4,8 @@ include Outpost::Controller::Authorization
include Outpost::Controller::Authentication
- unless Rails.application.config.consider_all_requests_local
- rescue_from StandardError, with: ->(e) { render_error(500, e) }
- rescue_from ActionController::RoutingError, ActionView::MissingTemplate, ActionController::UnknownController, ::AbstractController::ActionNotFound, ActiveRecord::RecordNotFound, with: ->(e) { render_error(404, e) }
- end
+ rescue_from StandardError, with: ->(e) { render_error(500, e) }
+ rescue_from ActionController::RoutingError, ActionView::MissingTemplate, ActionController::UnknownController, ::AbstractController::ActionNotFound, ActiveRecord::RecordNotFound, with: ->(e) { render_error(404, e) }
abstract!
protect_from_forgery
@@ -22,7 +20,11 @@ #----------------------
def render_error(status, e=StandardError)
- render template: "/errors/error_#{status}", status: status, locals: { errors: e }
+ if Rails.application.config.consider_all_requests_local
+ raise e
+ else
+ render template: "/errors/error_#{status}", status: status, locals: { errors: e }
+ end
end
end
end
|
Check requests local in render_error
|
diff --git a/app/controllers/users/contributions_controller.rb b/app/controllers/users/contributions_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/users/contributions_controller.rb
+++ b/app/controllers/users/contributions_controller.rb
@@ -1,26 +1,22 @@ class Users::ContributionsController < ApplicationController
after_filter :verify_authorized, except: :index
after_filter :verify_policy_scoped, only: :index
- inherit_resources
- defaults resource_class: Contribution
- belongs_to :user
- actions :index
def index
authorize parent, :update?
- index!
+ @contributions = policy_scope(parent.contributions).
+ order("created_at DESC").
+ includes(:reward, :project)
end
- protected
+ private
+
def policy_scope(scope)
@_policy_scoped = true
ContributionPolicy::UserScope.new(current_user, parent, scope).resolve
end
- def collection
- @contributions ||= policy_scope(end_of_association_chain).
- order("created_at DESC, confirmed_at DESC").
- includes(:user, :reward, project: [:user]).
- page(params[:page]).per(10)
+ def parent
+ @user ||= User.find(params[:user_id])
end
end
|
Remove inherit_resources from user contributions controller
|
diff --git a/app/helpers/metrics_helper/link_checker_helper.rb b/app/helpers/metrics_helper/link_checker_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/metrics_helper/link_checker_helper.rb
+++ b/app/helpers/metrics_helper/link_checker_helper.rb
@@ -1,7 +1,7 @@ module MetricsHelper::LinkCheckerHelper
def response_td(response)
- success = response.is_a?(Fixnum) and response >= 200 and response < 300
+ success = response.is_a?(Fixnum) && response >= 200 && response < 300
cls = success ? 'successful' : 'unsuccessful'
content_tag(:td, response, class: cls)
end
|
Fix success determination for response code
I used the (and) operator which has a lower precedence than the
assignment operator (=), hence I have replaced it with the (&&)
operator.
Signed-off-by: Konrad Reiche <4ff0213f56e2082fcd8c882d04c546881c579ce4@gmail.com>
|
diff --git a/core/spec/support/unit/pavlov_support.rb b/core/spec/support/unit/pavlov_support.rb
index abc1234..def5678 100644
--- a/core/spec/support/unit/pavlov_support.rb
+++ b/core/spec/support/unit/pavlov_support.rb
@@ -35,8 +35,6 @@ end
def as user, &block
- @execute_as_user ||= {}
- @execute_as_user[user] ||= ExecuteAsUser.new(user)
- @execute_as_user[user].execute &block
+ ExecuteAsUser.new(user).execute &block
end
end
|
Remove unnecessary optimisation; keep code in sync with MD variant.
|
diff --git a/test/api/breaks_api_test.rb b/test/api/breaks_api_test.rb
index abc1234..def5678 100644
--- a/test/api/breaks_api_test.rb
+++ b/test/api/breaks_api_test.rb
@@ -9,4 +9,33 @@ Rails.application
end
+#POST TEST
+def test_post_breaks
+ teaching_period = FactoryBot.create(:teaching_period)
+ start = teaching_period.start_date + 4.weeks
+ number_of_break = Break.count
+ data_to_post = {
+ start_date: start,
+ number_of_weeks: rand(1..3),
+ auth_token: auth_token
+ }
+ # Perform the POST
+ post "/api/teaching_periods/#{teaching_period.id}/breaks", data_to_post
+
+ # Check if the POST succeeds
+ assert_equal 201, last_response.status
+
+ # Check if the details posted match as expected
+ response_keys = %w(start_date number_of_weeks)
+ breaks = Break.find(last_response_body['id'])
+ assert_json_matches_model(last_response_body, breaks, response_keys)
+
+ # check if the details in the newly created break match as the pre-set data
+ assert_equal data_to_post[:start_date].to_date, breaks.start_date.to_date
+ assert_equal data_to_post[:number_of_weeks], breaks.number_of_weeks
+
+ # check if one more break is created
+ assert_equal Break.count, number_of_break + 1
+end
+
end
|
TEST: Add POST Test for breaks_api
|
diff --git a/lib/clouds_and_dragons.rb b/lib/clouds_and_dragons.rb
index abc1234..def5678 100644
--- a/lib/clouds_and_dragons.rb
+++ b/lib/clouds_and_dragons.rb
@@ -7,7 +7,7 @@
module CloudsAndDragons
def self.start(args)
- sub_cmds = collect_sub_commands(ARGV)
+ sub_cmds = collect_sub_commands(args)
# main_command = list for example
main_command = sub_cmds.shift
|
Use the passed in args instead of ARGV.
|
diff --git a/test/dummy/app/controllers/posts_controller.rb b/test/dummy/app/controllers/posts_controller.rb
index abc1234..def5678 100644
--- a/test/dummy/app/controllers/posts_controller.rb
+++ b/test/dummy/app/controllers/posts_controller.rb
@@ -1,6 +1,4 @@ class PostsController < ApplicationController
- before_action :set_post, only: [:show, :edit, :update, :destroy]
-
# GET /users/1/posts
def index
end
|
Remove useless before_action in the dummy app
|
diff --git a/lib/stevenson/template.rb b/lib/stevenson/template.rb
index abc1234..def5678 100644
--- a/lib/stevenson/template.rb
+++ b/lib/stevenson/template.rb
@@ -17,7 +17,7 @@ end
def place_config(config_file)
- place_files(config_file, 'config.yml')
+ place_files(config_file, '_config.yml')
end
def place_files(files, directory)
|
Add missing _ for config file name
|
diff --git a/lib/tasks/api_routes.rake b/lib/tasks/api_routes.rake
index abc1234..def5678 100644
--- a/lib/tasks/api_routes.rake
+++ b/lib/tasks/api_routes.rake
@@ -0,0 +1,10 @@+namespace :api do
+ desc "API Routes"
+ task routes: :environment do
+ API::Root.routes.each do |api|
+ method = api.route_method.ljust(10)
+ path = api.route_path.gsub(":version", api.route_version)
+ puts " #{method} #{path}"
+ end
+ end
+end
|
Create rake task to list API routes
|
diff --git a/lib/tasks/rspec_html.rake b/lib/tasks/rspec_html.rake
index abc1234..def5678 100644
--- a/lib/tasks/rspec_html.rake
+++ b/lib/tasks/rspec_html.rake
@@ -0,0 +1,16 @@+require 'rspec/core/rake_task'
+
+RSpec::Core::RakeTask.new(:spec) do |t|
+ t.rspec_opts = '--format html --out reports/rspec_results.html'
+end
+
+namespace :rspec_report do
+ desc 'Run all specs and generate RSpec report in HTML'
+ task :html => :spec
+
+ desc 'Run all specs, generate RSpec report and open it in the browser'
+ task :browser do
+ Rake::Task[:spec].invoke
+ `open reports/rspec_results.html` # This only works if running OS X.
+ end
+end
|
Add new rspec rake task for generating reports in html
|
diff --git a/lib/vagrant-lxc/plugin.rb b/lib/vagrant-lxc/plugin.rb
index abc1234..def5678 100644
--- a/lib/vagrant-lxc/plugin.rb
+++ b/lib/vagrant-lxc/plugin.rb
@@ -12,7 +12,7 @@ provider(:lxc) do
require File.expand_path("../provider", __FILE__)
- I18n.load_path << File.expand_path(File.dirname(__FILE__) + '/../locales/en.yml')
+ I18n.load_path << File.expand_path(File.dirname(__FILE__) + '/../../locales/en.yml')
I18n.reload!
Provider
|
Fix custom I18n load path
|
diff --git a/tcx.gemspec b/tcx.gemspec
index abc1234..def5678 100644
--- a/tcx.gemspec
+++ b/tcx.gemspec
@@ -8,8 +8,8 @@ spec.version = Tcx::VERSION
spec.authors = ["Gareth Townsend"]
spec.email = ["gareth.townsend@me.com"]
- spec.description = %q{TODO: Write a gem description}
- spec.summary = %q{TODO: Write a gem summary}
+ spec.description = %q{A gem for parsing TCX files}
+ spec.summary = %q{A gem for parsing TCX files}
spec.homepage = ""
spec.license = "MIT"
|
Add description and summary to gemspec.
|
diff --git a/spec/factories/gamification_goals.rb b/spec/factories/gamification_goals.rb
index abc1234..def5678 100644
--- a/spec/factories/gamification_goals.rb
+++ b/spec/factories/gamification_goals.rb
@@ -4,5 +4,11 @@ factory :gamification_goal, aliases: [:goal], class: 'Gamification::Goal' do
rewarding nil
points 1
+
+ trait :with_medal do
+ after :create do |goal|
+ create :medal, goal: goal
+ end
+ end
end
end
|
Add with_medal trait to rewards factory
|
diff --git a/app/mailers/admin_mailer.rb b/app/mailers/admin_mailer.rb
index abc1234..def5678 100644
--- a/app/mailers/admin_mailer.rb
+++ b/app/mailers/admin_mailer.rb
@@ -21,7 +21,7 @@ @instance = Rails.configuration.x.local_domain
locale_for_account(@me) do
- mail to: @me.user_email, subject: I18n.t('admin_mailer.new_pending_account.subject', instance: @instance, username: @account.username)
+ mail to: @me.user_email, reply_to: user.email, subject: I18n.t('admin_mailer.new_pending_account.subject', instance: @instance, username: @account.username)
end
end
|
Add Reply-To header for new pending account emails
When I deny someone's application, I usually send them an email explaining why.
This patch facilitates that.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.