diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/spec/controllers/organisations_controller_spec.rb b/spec/controllers/organisations_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/organisations_controller_spec.rb +++ b/spec/controllers/organisations_controller_spec.rb @@ -2,4 +2,15 @@ describe OrganisationsController do + it "should query an organisation by title" do + FactoryGirl.create(:organisation, name: "my-terrrible-organisation", title: "My Terrible Organisation") + FactoryGirl.create(:organisation, name: "my-fantastic-organisation", title: "My Fantastic Organisation") + + get "index", q: "fantastic", format: "json" + + results = JSON.parse(response.body) + + expect(results.count).to eq(1) + expect(results.first["text"]).to eq("My Fantastic Organisation") + end end
Add test for standard organisation search
diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb index abc1234..def5678 100644 --- a/config/initializers/cookies_serializer.rb +++ b/config/initializers/cookies_serializer.rb @@ -2,4 +2,4 @@ # Specify a serializer for the signed and encrypted cookie jars. # Valid options are :json, :marshal, and :hybrid. -Rails.application.config.action_dispatch.cookies_serializer = :marshal +Rails.application.config.action_dispatch.cookies_serializer = :json
Change cookie serialisation method to :json The :marshal option is potentially unsafe, and has been added to brakeman as a security warning. Deploying this will invalidate everyone's cookies, but specialist-publisher should just re-auth them against signon.
diff --git a/core/config/initializers/resque_mailer.rb b/core/config/initializers/resque_mailer.rb index abc1234..def5678 100644 --- a/core/config/initializers/resque_mailer.rb +++ b/core/config/initializers/resque_mailer.rb @@ -1,5 +1,5 @@ # config/initializers/resque_mailer.rb -Resque::Mailer.excluded_environments = []#[:test, :develop] +Resque::Mailer.excluded_environments = [:test, :develop] module Devise module Mailers @@ -13,4 +13,4 @@ end end end -end+end
EXclude test and develop environments for RescueMailer Signed-off-by: tomdev <96835dd8bfa718bd6447ccc87af89ae1675daeca@codigy.nl>
diff --git a/exercises/crypto-square/.meta/solutions/crypto_square.rb b/exercises/crypto-square/.meta/solutions/crypto_square.rb index abc1234..def5678 100644 --- a/exercises/crypto-square/.meta/solutions/crypto_square.rb +++ b/exercises/crypto-square/.meta/solutions/crypto_square.rb @@ -3,6 +3,12 @@ def initialize(plaintext) @plaintext = plaintext end + + def ciphertext + transposed.join(' ') + end + + private def normalize_plaintext @normalized ||= @plaintext.downcase.gsub(/\W/, '') @@ -23,12 +29,6 @@ Math.sqrt(normalize_plaintext.length).ceil end - def ciphertext - transposed.join(' ') - end - - private - def transposed chunk_size = size chunks = plaintext_segments.map do |s| @@ -36,6 +36,7 @@ end chunks.transpose.map{ |s| s.join('') } end + end module BookKeeping
Make methods not called by tests private
diff --git a/NHNetworkTime.podspec b/NHNetworkTime.podspec index abc1234..def5678 100644 --- a/NHNetworkTime.podspec +++ b/NHNetworkTime.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'NHNetworkTime' - s.version = '1.5' + s.version = '1.6' s.summary = 'Network time protocol NTP for iOS.' s.homepage = 'https://github.com/huynguyencong/NHNetworkTime' s.license = { :type => 'Apache', :file => 'LICENSE' }
Update podspec version to 1.6
diff --git a/db/migrate/20150401092322_create_songs.rb b/db/migrate/20150401092322_create_songs.rb index abc1234..def5678 100644 --- a/db/migrate/20150401092322_create_songs.rb +++ b/db/migrate/20150401092322_create_songs.rb @@ -1,4 +1,11 @@ class CreateSongs < ActiveRecord::Migration def change + create_table :songs do |t| + t.references :user + t.string :title, null: false, limit: 256 + t.text :content, null: false + + t.timestamps null: false + end end end
Write migration code for songs table
diff --git a/spec/bitbucket_rest_api/core_ext/hash_spec.rb b/spec/bitbucket_rest_api/core_ext/hash_spec.rb index abc1234..def5678 100644 --- a/spec/bitbucket_rest_api/core_ext/hash_spec.rb +++ b/spec/bitbucket_rest_api/core_ext/hash_spec.rb @@ -0,0 +1,65 @@+# encoding: utf-8 + +require 'spec_helper' + +describe Hash do + + before do + BitBucket.new + @hash = { :a => 1, :b => 2, :c => 'e'} + @serialized = "a=1&b=2&c=e" + @nested_hash = { 'a' => { 'b' => {'c' => 1 } } } + @symbols = { :a => { :b => { :c => 1 } } } + end + + context '#except!' do + xit 'should respond to except!' do + @nested_hash.should respond_to :except! + copy = @nested_hash.dup + copy.except!('b', 'a') + copy.should be_empty + end + end + + context '#except' do + it 'should respond to except' do + @nested_hash.should respond_to :except + end + + it 'should remove key from the hash' do + @nested_hash.except('a').should be_empty + end + end + + context '#symbolize_keys' do + it 'should respond to symbolize_keys' do + @nested_hash.should respond_to :symbolize_keys + end + end + + context '#symbolize_keys!' do + it 'should respond to symbolize_keys!' do + @nested_hash.should respond_to :symbolize_keys! + end + + it 'should convert nested keys to symbols' do + @nested_hash.symbolize_keys!.should == @symbols + end + end + + context '#serialize' do + it 'should respond to serialize' do + @nested_hash.should respond_to :serialize + end + + it 'should serialize hash' do + @hash.serialize.should == @serialized + end + end + + context '#deep_key?' do + it 'should find key inside nested hash' do + @nested_hash.has_deep_key?('c').should be_truthy + end + end +end # Hash
Add tests for hash extension Reference: https://github.com/peter-murach/github/blob/master/spec/github/core_ext/hash_spec.rb
diff --git a/spec/services/next_activity_suggester_spec.rb b/spec/services/next_activity_suggester_spec.rb index abc1234..def5678 100644 --- a/spec/services/next_activity_suggester_spec.rb +++ b/spec/services/next_activity_suggester_spec.rb @@ -0,0 +1,33 @@+require 'rails_helper' + +describe NextActivitySuggester do + let(:school) { school = create :school, enrolled: true } + let(:activity_category) { create :activity_category } + let!(:activity_types) { create_list(:activity_type, 5, activity_category: activity_category, data_driven: true) } + + context "with no activity types set for the school" do + subject { NextActivitySuggester.new(school, true) } + it "suggests any 5 if no suggestions" do + expect(subject.suggest).to match_array(activity_types) + end + end + + context "with initial suggestions" do + let!(:activity_types_with_suggestions) { create_list(:activity_type, 5, :as_initial_suggestions)} + subject { NextActivitySuggester.new(school, true) } + + it "suggests the first five initial suggestions" do + expect(subject.suggest).to match_array(activity_types_with_suggestions) + end + end + + context "with suggestions based on last activity type" do + subject { NextActivitySuggester.new(school) } + let!(:activity_type_with_further_suggestions) { create :activity_type, :with_further_suggestions, number_of_suggestions: 5 } + let!(:last_activity) { create :activity, school: school, activity_type: activity_type_with_further_suggestions } + + it "suggests the five follow ons from original" do + expect(subject.suggest).to match_array(last_activity.activity_type.activity_type_suggestions.map(&:suggested_type)) + end + end +end
Add new test for service
diff --git a/lib/gitlab/ci/build/prerequisite/kubernetes_namespace.rb b/lib/gitlab/ci/build/prerequisite/kubernetes_namespace.rb index abc1234..def5678 100644 --- a/lib/gitlab/ci/build/prerequisite/kubernetes_namespace.rb +++ b/lib/gitlab/ci/build/prerequisite/kubernetes_namespace.rb @@ -20,7 +20,9 @@ private def deployment_cluster - build.deployment&.deployment_platform_cluster + strong_memoize(:deployment_cluster) do + build.deployment&.cluster || build.deployment&.deployment_platform_cluster + end end def kubernetes_namespace
Use deployment's cluster for kubernetes prereq A deployment will have a cluster associated on creation if there is one. Otherwise fallback to deployment_platform for legacy deployments.
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.12' + VERSION = '1.0.13.pre' end end # Please be aware that the monkeys like tho throw poo sometimes.
Add .pre for next release
diff --git a/lib/tasks/eu_exit_business_finder.rake b/lib/tasks/eu_exit_business_finder.rake index abc1234..def5678 100644 --- a/lib/tasks/eu_exit_business_finder.rake +++ b/lib/tasks/eu_exit_business_finder.rake @@ -0,0 +1,21 @@+namespace :eu_exit_business_finder do + desc <<-DESC + Adds a link to the EU Exit Business Readiness Finder to all content items which are tagged to this finder + DESC + task add_related_link_to_tagged_content: [:environment] do + facet_group_content_id = "52435175-82ed-4a04-adef-74c0199d0f46" + finder_content_id = "42ce66de-04f3-4192-bf31-8394538e0734" + + content_ids = Services.publishing_api.get_linked_items( + facet_group_content_id, link_type: "facet_groups", fields: %w[content_id] + ).pluck('content_id') + + content_ids.each do |content_id| + ordered_links = Services.publishing_api.get_links(content_id) + .to_hash + .fetch("links") + .fetch("ordered_related_items", []) + Services.publishing_api.patch_links(content_id, links: { ordered_related_items: ordered_links.unshift(finder_content_id) }) + end + end +end
Add rake task to add related link for business finder content This adds a related link (back to the finder itself) to all content items that are tagged to the EU Exit Business Readness Finder.
diff --git a/lib/user_agent/browsers/libavformat.rb b/lib/user_agent/browsers/libavformat.rb index abc1234..def5678 100644 --- a/lib/user_agent/browsers/libavformat.rb +++ b/lib/user_agent/browsers/libavformat.rb @@ -0,0 +1,36 @@+class UserAgent + module Browsers + # The user agent utilized by ffmpeg or other projects utilizing libavformat + class Libavformat < Base + def self.extend?(agent) + agent.detect do |useragent| + useragent.product == "Lavf" || (useragent.product == "NSPlayer" && agent.version == "4.1.0.3856") + end + end + + # @return ["libavformat"] To make it easy to pick it out, all of the UAs that Lavf uses have this browser. + def browser + "libavformat" + end + + # @return [nil, Version] If the product is NSPlayer, we don't have a version + def version + if detect_product("NSPlayer") + nil + else + super + end + end + + # @return [nil] Lavf doesn't return us anything here + def os + nil + end + + # @return [nil] Lavf doesn't return us anything here + def platform + nil + end + end + end +end
Add a class for Libavformat.
diff --git a/lib/vagrant-cookbook-fetcher/config.rb b/lib/vagrant-cookbook-fetcher/config.rb index abc1234..def5678 100644 --- a/lib/vagrant-cookbook-fetcher/config.rb +++ b/lib/vagrant-cookbook-fetcher/config.rb @@ -16,10 +16,9 @@ def validate(machine) errors = [] - unless @disable then - if @url == UNSET_VALUE - errors << "vagrant-cookbook-fetcher plugin requires a config parameter, 'url', which is missing." - end + if @url == UNSET_VALUE + # Disable vagrant cookbook fetcher if we don't specify a URL + @disable = true end { 'Cookbook Fetcher' => errors }
Disable plugin if a URL isn't specified Rather than throw an error, this change disables vagrant-cookbook-fetcher. Without this, any Vagrantfile that doesn't use vagrant-cookbook-fetcher will throw an error, preventing you from using vagrant without configuring this plugin.
diff --git a/modules/govuk_logging/spec/classes/govuk_logging_spec.rb b/modules/govuk_logging/spec/classes/govuk_logging_spec.rb index abc1234..def5678 100644 --- a/modules/govuk_logging/spec/classes/govuk_logging_spec.rb +++ b/modules/govuk_logging/spec/classes/govuk_logging_spec.rb @@ -0,0 +1,9 @@+require_relative '../../../../spec_helper' + +describe 'govuk_logging', :type => :class do + + it { is_expected.to compile } + it { is_expected.to compile.with_all_deps } + it { is_expected.to contain_class('govuk_logging') } + +end
Add class spec test for govuk_logging
diff --git a/watir-rspec.gemspec b/watir-rspec.gemspec index abc1234..def5678 100644 --- a/watir-rspec.gemspec +++ b/watir-rspec.gemspec @@ -16,6 +16,7 @@ gem.version = Watir::RSpec::VERSION gem.add_dependency "rspec", "~>2.0" + gem.add_dependency "watir", "~>5.0" gem.add_development_dependency "yard" gem.add_development_dependency "rake"
Add watir as a dependency.
diff --git a/app/services/wrestler_services/placement_points.rb b/app/services/wrestler_services/placement_points.rb index abc1234..def5678 100644 --- a/app/services/wrestler_services/placement_points.rb +++ b/app/services/wrestler_services/placement_points.rb @@ -21,9 +21,9 @@ def thirdPlace if @number_of_placers == 4 + return 7 + else return 9 - else - return 7 end end
Fix points for fourth place
diff --git a/app/models/palm_information.rb b/app/models/palm_information.rb index abc1234..def5678 100644 --- a/app/models/palm_information.rb +++ b/app/models/palm_information.rb @@ -7,7 +7,12 @@ validates :knowledge_slope, numericality: { only_integer: true }, allow_nil: true validates :fate_slope, numericality: { only_integer: true }, allow_nil: true - enum status: [:unread, :read, :reread] + enum status: [:unread, :read, :reread] + enum feeling_length: [:feeling_length_short, :feeling_length_normal, :feeling_length_long] + enum feeling_slope: [:feeling_slope_middle, :feeling_slope_center, :feeling_slope_index] + enum knowledge_length: [:knowledge_length_short, :knowledge_length_normal, :knowledge_length_long] + enum knowledge_slope: [:knowledge_slope_straight, :knowledge_slope_center, :knowledge_slope_down] + enum fate_slope: [:fate_slope_left, :fate_slope_center, :fate_right] private
Add enum, feeling_length, feeling_slopek, knowledge_length, knowledge_slope, fate_slope
diff --git a/rails/spec/helpers/divisions_helper_spec.rb b/rails/spec/helpers/divisions_helper_spec.rb index abc1234..def5678 100644 --- a/rails/spec/helpers/divisions_helper_spec.rb +++ b/rails/spec/helpers/divisions_helper_spec.rb @@ -1,11 +1,10 @@ require 'spec_helper' describe DivisionsHelper do - # TODO Enable this test - # describe '#formatted_motion_text' do - # subject { formatted_motion_text division } + describe '#formatted_motion_text' do + subject { formatted_motion_text division } - # let(:division) { mock_model(Division, motion: "A bill [No. 2] and votes") } - # it { should eq("\n<p>A bill [No. 2] and votes</p>") } - # end + let(:division) { mock_model(Division, motion: "A bill [No. 2] and votes") } + it { should eq("<p>A bill [No. 2] and votes</p>\n") } + end end
Enable test now this is working since we switched to Marker
diff --git a/broadcast.rb b/broadcast.rb index abc1234..def5678 100644 --- a/broadcast.rb +++ b/broadcast.rb @@ -7,26 +7,43 @@ require "erb" class Broadcast < Sinatra::Base - DROID = Android.new set :views, File.join(APP_DIR, "views") set :public, File.join(APP_DIR, "public") get '/' do - @temp = DROID.batteryGetTemperature - get_location_coordinates + set_location_coordinates + set_temp + set_status erb :"index.html" end - get "/snapshot" do + get "/snapshot.jpg" do content_type 'image/png' - img_path = File.join APP_DIR, "snapshots", "latest.png" + img_path = File.join APP_DIR, "snapshots", "latest.jpg" DROID.cameraCapturePicture img_path - File.read(img_path).to_blob + File.read(img_path) end - def get_location_coordinates + def set_temp + @temp = DROID.batteryGetTemperature["result"].to_f / 10 + end + + def set_status + map = { + "1" => "unknown", + "2" => "charging", + "3" => "discharging", + "4" => "not charging", + "5" => "full" + } + + result = DROID.batteryGetStatus["result"].to_s + @status = map[result] + end + + def set_location_coordinates result = DROID.getLastKnownLocation["result"] location_data = result["gps"] || result["passive"] @latitude, @longitude = location_data["latitude"], location_data["longitude"]
Improve ability to retreive battery temp, battery status, snapshot.
diff --git a/server/spec/controllers/api/v1/traits_controller_spec.rb b/server/spec/controllers/api/v1/traits_controller_spec.rb index abc1234..def5678 100644 --- a/server/spec/controllers/api/v1/traits_controller_spec.rb +++ b/server/spec/controllers/api/v1/traits_controller_spec.rb @@ -14,11 +14,9 @@ resp = JSON.parse(response.body) # traits = JSON.parse([trait]) p resp - expect(resp).to eq([{ - "id"=>trait.id, - "name"=>trait.name, - "trait_type"=>trait.trait_type - }]) + expect(resp).to eq( + trait.name => [{"name"=>trait.name}] + ) end end
Fix Traits Controller spec tests to pass
diff --git a/lib/contentful_model/chainable_queries.rb b/lib/contentful_model/chainable_queries.rb index abc1234..def5678 100644 --- a/lib/contentful_model/chainable_queries.rb +++ b/lib/contentful_model/chainable_queries.rb @@ -31,7 +31,12 @@ def find_by(*args) @query ||= ContentfulModel::Query.new(self) args.each do |query| - @query << {"fields.#{query.keys.first}" => query.values.first} + #query is a hash + if query.values.first.is_a?(Array) #we need to do an 'in' query + @query << {"fields.#{query.keys.first}[in]" => query.values.first.join(",")} + else + @query << {"fields.#{query.keys.first}" => query.values.first} + end end self end
Allow 'in' queries is passing an array of values
diff --git a/lib/generators/joofaq/joofaq_generator.rb b/lib/generators/joofaq/joofaq_generator.rb index abc1234..def5678 100644 --- a/lib/generators/joofaq/joofaq_generator.rb +++ b/lib/generators/joofaq/joofaq_generator.rb @@ -8,9 +8,16 @@ copy_file "joofaq/_qapair.html.erb", "app/views/faq/_qapair.html.erb" copy_file "joofaq/_subtitle.html.erb", "app/views/faq/_subtitle.html.erb" create_route + add_gem_dependencies end + +private def create_route route "match '/faq' => 'Faq#index'" end + + def add_gem_dependencies + gem 'rdiscount', version: '1.6.8' + end end
Add ridscount to Gemfile from joofaq generator
diff --git a/lib/weeter/plugins/notification_plugin.rb b/lib/weeter/plugins/notification_plugin.rb index abc1234..def5678 100644 --- a/lib/weeter/plugins/notification_plugin.rb +++ b/lib/weeter/plugins/notification_plugin.rb @@ -7,13 +7,16 @@ module Weeter module Plugins class NotificationPlugin - delegate :publish_tweet, :to => :configured_plugin - delegate :delete_tweet, :to => :configured_plugin - + delegate :publish_tweet, + :delete_tweet, + :notify_rate_limiting_initiated, + :notify_missed_tweets, + :to => :configured_plugin + def initialize(client_app_config) @config = client_app_config end - + protected def configured_plugin @configured_plugin ||= begin @@ -23,4 +26,4 @@ end end end -end+end
Add missing delegations - Luke Melia/Stefan Penner
diff --git a/AssistantKit.podspec b/AssistantKit.podspec index abc1234..def5678 100644 --- a/AssistantKit.podspec +++ b/AssistantKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'AssistantKit' - s.version = '0.5' + s.version = '0.5.1' s.summary = 'Easy way to detect and work with  device environments written in Swift' s.description = <<-DESC
Set podspec version to 0.5.1
diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -19,7 +19,7 @@ end def regexp_preview - plugin_config = prepare_plugin_config + plugin_config = prepare_plugin_config || {} preview = RegexpPreview.processor(params[:parse_type]).new(params[:file], params[:parse_type], plugin_config) render json: preview.matches
Set empty hash if params[:plugin_config] is null Signed-off-by: Kenji Okimoto <7a4b90a0a1e6fc688adec907898b6822ce215e6c@clear-code.com>
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index abc1234..def5678 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -3,7 +3,7 @@ begin Date.parse(datetime_string).strftime("%d-%m-%Y") rescue ArgumentError - '' + datetime_string end end end
Return value as it is if not a date
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index abc1234..def5678 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,2 +1,12 @@ module ApplicationHelper + def new_item_link + if @todo_list && !@todo_list.new_record? + text = "Todo Item" + path = new_todo_list_todo_item_path(@todo_list) + else + text = "Todo List" + path = new_todo_list_path + end + link_to "Add #{text}", path, class: "icon-new float-right hide-text" + end end
Add new item link helper
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index abc1234..def5678 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -11,9 +11,9 @@ def user_image_link(user, opts={}, &block) link_to user_entries_path(user) do if opts[:border] - concat gravatar_image_tag user.email, class: "image-circle", style: "border: 3px solid #{user.full_name.pastel_color}" + concat gravatar_image_tag user.email, class: "image-circle", title: "#{user.full_name}", style: "border: 3px solid #{user.full_name.pastel_color}" else - concat gravatar_image_tag user.email, class: "image-circle" + concat gravatar_image_tag user.email, class: "image-circle", title: "#{user.full_name}" end concat yield if block_given? end
Add title to user profile image
diff --git a/JSONRequest.podspec b/JSONRequest.podspec index abc1234..def5678 100644 --- a/JSONRequest.podspec +++ b/JSONRequest.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "JSONRequest" - s.version = "0.2,0" + s.version = "0.2.0" s.summary = "JSONRequest is a tiny Swift library for Synchronous and Asynchronous HTTP JSON requests." s.homepage = "http://github.com/hathway/JSONRequest" s.license = { :type => "MIT", :file => "LICENSE" }
Fix version number on podspec file
diff --git a/queue_classic_plus.gemspec b/queue_classic_plus.gemspec index abc1234..def5678 100644 --- a/queue_classic_plus.gemspec +++ b/queue_classic_plus.gemspec @@ -19,6 +19,10 @@ spec.require_paths = ["lib"] spec.add_dependency "queue_classic", ">= 3.1.0" - spec.add_development_dependency "bundler", "~> 1.6" + if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.3.0') + spec.add_development_dependency "bundler", "~> 1.6" + else + spec.add_development_dependency "bundler", "~> 2.0" + end spec.add_development_dependency "rake" end
Use bundler 2.0 for Ruby 2.3+
diff --git a/jekyll-tidy.gemspec b/jekyll-tidy.gemspec index abc1234..def5678 100644 --- a/jekyll-tidy.gemspec +++ b/jekyll-tidy.gemspec @@ -7,9 +7,9 @@ spec.name = "jekyll-tidy" spec.version = Jekyll::Tidy::VERSION spec.authors = ["Wyatt Kirby"] - spec.email = ["kirby.wa@gmail.com"] + spec.email = ["wyatt@apsis.io"] spec.summary = %q{Sanitize and Tidy HTML Output for Jekyll} - spec.homepage = "" + spec.homepage = "http://www.apsis.io" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0")
Update gemspec with apsis info
diff --git a/Casks/snapz-pro-x.rb b/Casks/snapz-pro-x.rb index abc1234..def5678 100644 --- a/Casks/snapz-pro-x.rb +++ b/Casks/snapz-pro-x.rb @@ -1,10 +1,10 @@ cask :v1 => 'snapz-pro-x' do - version '2.5.4' - sha256 'b3b7dfd27222dfc45414cf820d83d14f12f6504af0b8e9009fd4b0a771b8894c' + version '2.6.0' + sha256 'f603dae7a8fe64633f01ca2a53a1eed0907d17e3733f125fedb6d2e96b491b64' url "http://downloads3.ambrosiasw.com/snapzprox/essentials/SnapzProX#{version.to_i}.dmg" appcast 'https://www.ambrosiasw.com/updates/profile.php/snapz_pro_x/release', - :sha256 => '9bb22b961c94283f380351f4748cc5cea9e443b9c082da51231995cbf3313987' + :sha256 => '8fbbd653283a84ce8541f1f58670cc2fe9da88ed32b75a153bbabd69709d7314' name 'Snapz Pro X' homepage 'http://www.ambrosiasw.com/utilities/snapzprox/' license :commercial
Update Snapz Pro X to 2.6.0
diff --git a/lib/rubygems-compile/common_methods.rb b/lib/rubygems-compile/common_methods.rb index abc1234..def5678 100644 --- a/lib/rubygems-compile/common_methods.rb +++ b/lib/rubygems-compile/common_methods.rb @@ -4,7 +4,7 @@ def execution_list gems_list.map do |gem| - candidates = Gem.source_index.find_name(gem) + candidates = Gem.source_index.find_name(gem, options[:version]) if candidates.empty? alert_error "#{gem} is not installed. Skipping." @@ -28,7 +28,7 @@ def dependencies_for *specs specs.map { |spec| spec.runtime_dependencies.map { |dep| - deps = Gem.source_index.find_name(dep.name) + deps = Gem.source_index.find_name(dep.name,dep.requirement) deps + dependencies_for(*deps) } }
Support the --version option for the Compile and Uncompile commands
diff --git a/lib/sitescoutrest/concerns/creative.rb b/lib/sitescoutrest/concerns/creative.rb index abc1234..def5678 100644 --- a/lib/sitescoutrest/concerns/creative.rb +++ b/lib/sitescoutrest/concerns/creative.rb @@ -10,6 +10,24 @@ return result end + def create_creative(creative_data, options = {}) + oauth_token = self.oauth_token || options[:oauth_token] + advertiser_id = self.advertiser_id || options[:advertiser_id] + path = "/advertisers/#{advertiser_id}/creatives" + content_type = 'application/json' + result = data_post(path, content_type, creative_data, oauth_token) + return result + end + + def add_creative_to_campaign(campaign_id, creative_data, options = {}) + oauth_token = self.oauth_token || options[:oauth_token] + advertiser_id = self.advertiser_id || options[:advertiser_id] + path = "/advertisers/#{advertiser_id}/campaigns/#{campaign_id}/creatives" + content_type = 'application/json' + result = data_post(path, content_type, creative_data, oauth_token) + return result + end + end end end
Add Creative Asset to Campaign
diff --git a/lib/versionator/detector/phpmyadmin.rb b/lib/versionator/detector/phpmyadmin.rb index abc1234..def5678 100644 --- a/lib/versionator/detector/phpmyadmin.rb +++ b/lib/versionator/detector/phpmyadmin.rb @@ -7,7 +7,7 @@ set :project_url, "http://www.phpmyadmin.net" set :detect_dirs, %w{js libraries themes} - set :detect_files, %w{export.php index.php main.php navigation.php README sql.php themes.php} + set :detect_files, %w{export.php index.php navigation.php README sql.php themes.php} set :installed_version_file, "README" set :installed_version_regexp, /^\s*Version (.+)$/ @@ -15,16 +15,6 @@ set :newest_version_url, 'http://www.phpmyadmin.net/home_page/index.php' set :newest_version_selector, '#body .rightbuttons .downloadbutton .dlname a' set :newest_version_regexp, /^Download (.+)$/ - - def project_url_for_version(version) - if version < Versionomy.parse('3.3.9') - "http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/#{version}/phpMyAdmin-#{version}-notes.html/view" - elsif Versionomy.parse('3.3.9') <= version && version < Versionomy.parse('3.4.7.1') - "http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/#{version}/phpMyAdmin-#{version}.html/view" - else - "http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/#{version}/phpMyAdmin-#{version}-notes.html/view" - end - end end end end
Prepare the phpMyAdmin detector for the upcoming 4.0.0 release
diff --git a/spec/bls_api/client_spec.rb b/spec/bls_api/client_spec.rb index abc1234..def5678 100644 --- a/spec/bls_api/client_spec.rb +++ b/spec/bls_api/client_spec.rb @@ -2,7 +2,7 @@ describe BLS_API::Client do describe "accepts an API key" do - let(:api_key) { "definitely-not-real" } + let(:api_key) { "dummy_api_key" } it "via environment variable" do ClimateControl.modify(:BLS_API_KEY => api_key) do
Make dummy API keys consistent across tests
diff --git a/spec/check_registry_spec.rb b/spec/check_registry_spec.rb index abc1234..def5678 100644 --- a/spec/check_registry_spec.rb +++ b/spec/check_registry_spec.rb @@ -0,0 +1,23 @@+ +RSpec.describe Rack::ECG::CheckRegistry do + class MyCheckClass; end + subject(:check_registry) { described_class } + + before do + check_registry.register(:my_check, MyCheckClass) + end + + describe ".lookup" do + context "with a registered class" do + it "returns the registered class" do + expect(check_registry.lookup(:my_check)).to eq(MyCheckClass) + end + end + + context "when the class is not registered" do + it "raises an error" do + expect { check_registry.lookup(:my_other_check) }.to raise_error(Rack::ECG::CheckRegistry::CheckNotRegistered) + end + end + end +end
Add a spec to cover CheckRegistry changes
diff --git a/spec/classes/mod/jk_spec.rb b/spec/classes/mod/jk_spec.rb index abc1234..def5678 100644 --- a/spec/classes/mod/jk_spec.rb +++ b/spec/classes/mod/jk_spec.rb @@ -2,6 +2,18 @@ describe 'apache::mod::jk', :type => :class do it_behaves_like 'a mod class, without including apache' + + shared_examples 'minimal resources' do + it { is_expected.to compile } + it { is_expected.to create_class('apache::mod::jk') } + it { is_expected.to contain_class('apache') } + it { is_expected.to contain_apache__mod('jk') } + it { is_expected.to contain_file('jk.conf').that_notifies('Class[apache::service]').with( + :ensure => 'file', + :content => /<IfModule jk_module>/, + :content => /<\/IfModule>/, + )} + end context "with only required facts and no parameters" do @@ -13,15 +25,7 @@ } end - it { is_expected.to compile } - it { is_expected.to create_class('apache::mod::jk') } - it { is_expected.to contain_class('apache') } - it { is_expected.to contain_apache__mod('jk') } - it { is_expected.to contain_file('jk.conf').that_notifies('Class[apache::service]').with( - :ensure => 'file', - :content => /<IfModule jk_module>/, - :content => /<\/IfModule>/, - )} + it_behaves_like 'minimal resources' end
Include shared context in apache::mod::jk spec test
diff --git a/spec/factories/burndowns.rb b/spec/factories/burndowns.rb index abc1234..def5678 100644 --- a/spec/factories/burndowns.rb +++ b/spec/factories/burndowns.rb @@ -12,7 +12,14 @@ end after(:create) do |burndown, evaluator| - FactoryGirl.create_list(:iteration_with_metrics, evaluator.iteration_count, burndown: burndown) + evaluator.iteration_count.times do |i| + FactoryGirl.create(:iteration_with_metrics, + burndown: burndown, + number: i + 1, + start_at: (i*2).weeks.ago, + finish_at: (i*2).weeks.ago + 2.weeks + ) + end end end end
Rewrite factory for burndown with metrics
diff --git a/spec/models/article_spec.rb b/spec/models/article_spec.rb index abc1234..def5678 100644 --- a/spec/models/article_spec.rb +++ b/spec/models/article_spec.rb @@ -1,5 +1,12 @@ require 'spec_helper' describe Article do - it { should have_many :comments } + describe "validations" do + it { should validate_presence_of :title } + it { should validate_presence_of :text } + end + + describe "associations" do + it { should have_many :comments } + end end
Update article model spec to include validations
diff --git a/spec/tomcat_manager_spec.rb b/spec/tomcat_manager_spec.rb index abc1234..def5678 100644 --- a/spec/tomcat_manager_spec.rb +++ b/spec/tomcat_manager_spec.rb @@ -0,0 +1,15 @@+require 'spec_helper' + +describe Tomcat::Manager do + subject { Tomcat::Manager } + + it "can create a new instance" do + subject.should respond_to(:new) + end + + describe "new" do + it "returns a new Server instance" do + Tomcat::Manager.new(:host => "http://www.google.com/").should be_instance_of(Tomcat::Manager::Instance) + end + end +end
Add Spec for Tomcat::Manager Module Add an initial spec to test the Tomcat::Manager module.
diff --git a/spec/typhoeus/hydra_spec.rb b/spec/typhoeus/hydra_spec.rb index abc1234..def5678 100644 --- a/spec/typhoeus/hydra_spec.rb +++ b/spec/typhoeus/hydra_spec.rb @@ -19,8 +19,4 @@ expect(Typhoeus::Hydra.hydra).to be_a(Typhoeus::Hydra) end end - - describe "#fire_and_forget" do - it - end end
Remove old pending spec which served as a todo.
diff --git a/spec/unit/transport_spec.rb b/spec/unit/transport_spec.rb index abc1234..def5678 100644 --- a/spec/unit/transport_spec.rb +++ b/spec/unit/transport_spec.rb @@ -3,12 +3,12 @@ # mystically fails on Rubinius on CI. MK. if RUBY_ENGINE != "rbx" describe Bunny::Transport, ".reachable?" do - it "returns true for google.com, 80" do - Bunny::Transport.reacheable?("google.com", 80, 1).should be_true + it "returns true for rabbitmq.com, 80" do + Bunny::Transport.reacheable?("rabbitmq.com", 80, 1).should be_true end - it "returns true for google.com, 8088" do - Bunny::Transport.reacheable?("google.com", 8088, 1).should be_false + it "returns true for rabbitmq.com, 18088" do + Bunny::Transport.reacheable?("rabbitmq.com", 18088, 1).should be_false end it "returns false for google1237982792837.com, 8277" do
Use a host that does not try to block incoming traffic in this test
diff --git a/spec/models/organisation_spec.rb b/spec/models/organisation_spec.rb index abc1234..def5678 100644 --- a/spec/models/organisation_spec.rb +++ b/spec/models/organisation_spec.rb @@ -9,6 +9,9 @@ describe 'validations' do it { should validate_presence_of(:whitehall_slug) } - it { should validate_uniqueness_of(:whitehall_slug) } + it 'ensures whitehall_slugs are unique' do + create :organisation + should validate_uniqueness_of(:whitehall_slug) + end end end
Deal with shoulda failure on NOT NULL column See https://github.com/thoughtbot/shoulda-matchers/issues/194
diff --git a/spec/read_time_estimator_spec.rb b/spec/read_time_estimator_spec.rb index abc1234..def5678 100644 --- a/spec/read_time_estimator_spec.rb +++ b/spec/read_time_estimator_spec.rb @@ -3,9 +3,10 @@ describe "ReadTimeEstimator" do describe "read_time" do - it "should break the string into an array of words" do - expect("Big old test string".read_time).to eql ["Big", "old", "test", "string"] - end + it "returns the reading time in phrase form" do + text = "word " * 250 + expect(text.read_time).to eql "1.0 minutes to read" + end end describe "time_per_word" do
Add spec for read_time method. PA-2182
diff --git a/spec/requests/microposts_spec.rb b/spec/requests/microposts_spec.rb index abc1234..def5678 100644 --- a/spec/requests/microposts_spec.rb +++ b/spec/requests/microposts_spec.rb @@ -4,7 +4,7 @@ describe "GET /microposts" do pending "works! (now write some real specs)" do get microposts_path - expect(response.status).to be(200) + expect(response.status).to eq(200) end end end
Use `eq` instead of `be`
diff --git a/lib/activerecord-spatial/active_record/connection_adapters/postgresql/adapter_extensions.rb b/lib/activerecord-spatial/active_record/connection_adapters/postgresql/adapter_extensions.rb index abc1234..def5678 100644 --- a/lib/activerecord-spatial/active_record/connection_adapters/postgresql/adapter_extensions.rb +++ b/lib/activerecord-spatial/active_record/connection_adapters/postgresql/adapter_extensions.rb @@ -5,12 +5,17 @@ module ConnectionAdapters class PostgreSQLColumn def simplified_type_with_spatial_type(field_type) - if field_type =~ /^geometry(\(|$)/ - :geometry - elsif field_type =~ /^geography(\(|$)/ - :geography - else - simplified_type_without_spatial_type(field_type) + case field_type + # This is a special internal type used by PostgreSQL. In this case, + # it is being used by the `geography_columns` view in PostGIS. + when 'name' + :string + when /^geometry(\(|$)/ + :geometry + when /^geography(\(|$)/ + :geography + else + simplified_type_without_spatial_type(field_type) end end alias_method_chain :simplified_type, :spatial_type
Handle the `name` type found in the geography_columns view.
diff --git a/spec/commit_activity/git_repository_spec.rb b/spec/commit_activity/git_repository_spec.rb index abc1234..def5678 100644 --- a/spec/commit_activity/git_repository_spec.rb +++ b/spec/commit_activity/git_repository_spec.rb @@ -2,7 +2,8 @@ require 'commit_activity/git_repository' describe CommitActivity::GitRepository do - subject { CommitActivity::GitRepository.new } + let(:url) { 'url' } + subject { CommitActivity::GitRepository.new(url) } it { should be_instance_of CommitActivity::GitRepository } end
Modify spec because GitRepository requires url when it initialize.
diff --git a/spec/controllers/courses_controller_spec.rb b/spec/controllers/courses_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/courses_controller_spec.rb +++ b/spec/controllers/courses_controller_spec.rb @@ -40,7 +40,7 @@ end describe "GET 'edit'" do - let(:course) { FactoryGirl.create :course } + let(:course) { FactoryGirl.create :course, :club_id => user.clubs.first.id } before :each do get 'edit', :club_id => course.club.id, :id => course.id
Update Courses Spec for Course Ownership Update the Courses controller spec to ensure that the Course being created actually belongs to the User's Club (thus allowing the user the correct privileges for editing it).
diff --git a/spec/frozen/core/string/equal_value_spec.rb b/spec/frozen/core/string/equal_value_spec.rb index abc1234..def5678 100644 --- a/spec/frozen/core/string/equal_value_spec.rb +++ b/spec/frozen/core/string/equal_value_spec.rb @@ -24,4 +24,8 @@ ('hello' == obj).should == true end + + it "is not fooled by NUL characters" do + "abc\0def".should_not == "abc\0xyz" + end end
Test for equality with embedded NUL chars Signed-off-by: Brian Ford <31227094f3baea959abbdb82d34f0bc93c1f3b36@engineyard.com>
diff --git a/spec/integrations/schedule_messages_spec.rb b/spec/integrations/schedule_messages_spec.rb index abc1234..def5678 100644 --- a/spec/integrations/schedule_messages_spec.rb +++ b/spec/integrations/schedule_messages_spec.rb @@ -19,6 +19,7 @@ it 'responds with success message' do expect(JSON.parse(schedule_messages.body)).to eq( + 'schedule_id' => appboy_schedule_id, 'message' => 'success' ) end
Fix scheduled_messages_spec for proper response body
diff --git a/spec/performance/proxy_order_syncer_spec.rb b/spec/performance/proxy_order_syncer_spec.rb index abc1234..def5678 100644 --- a/spec/performance/proxy_order_syncer_spec.rb +++ b/spec/performance/proxy_order_syncer_spec.rb @@ -0,0 +1,41 @@+require 'open_food_network/proxy_order_syncer' + +module OpenFoodNetwork + describe ProxyOrderSyncer, performance: true do + let(:start) { Time.zone.now.beginning_of_day } + let!(:schedule) { create(:schedule, order_cycles: order_cycles) } + + let!(:order_cycles) do + 10.times.map do |i| + create(:simple_order_cycle, orders_open_at: start + i.days, orders_close_at: start + (i+1).days ) + end + end + + let!(:standing_orders) do + 150.times.map do |i| + create(:standing_order, schedule: schedule, begins_at: start, ends_at: start + 10.days) + end + StandingOrder.where(schedule_id: schedule) + end + + context "measuring performance for initialisation" do + it "reports the average run time for 150 x 10 OCs" do + expect(ProxyOrder.count).to be 0 + times = [] + 10.times do + syncer = ProxyOrderSyncer.new(standing_orders.reload) + sleep 1 + t1 = Time.now + syncer.sync! + t2 = Time.now + times << t2-t1 + puts (t2-t1).round(2) + expect(ProxyOrder.count).to be 1500 + ProxyOrder.destroy_all + sleep 1 + end + puts "AVG: #{(times.sum/times.count).round(2)}" + end + end + end +end
Add performance spec for proxy order syncer
diff --git a/test/ffi-gobject_introspection/gobject_type_init_test.rb b/test/ffi-gobject_introspection/gobject_type_init_test.rb index abc1234..def5678 100644 --- a/test/ffi-gobject_introspection/gobject_type_init_test.rb +++ b/test/ffi-gobject_introspection/gobject_type_init_test.rb @@ -0,0 +1,25 @@+# frozen_string_literal: true +require 'introspection_test_helper' + +describe GObjectIntrospection::GObjectTypeInit do + describe 'Lib' do + it 'represents the gobject-2.0 library' do + GObjectIntrospection::GObjectTypeInit::Lib.ffi_libraries.first.name. + must_match /gobject-2\.0/ + end + + it 'provides the g_type_init function' do + GObjectIntrospection::GObjectTypeInit::Lib.must_respond_to :g_type_init + end + end + + describe '.type_init' do + it 'calls the g_type_init function from the gobject-2.0 library' do + allow(GObjectIntrospection::GObjectTypeInit::Lib).to receive(:g_type_init) + + GObjectIntrospection::GObjectTypeInit.type_init + + expect(GObjectIntrospection::GObjectTypeInit::Lib).to have_received(:g_type_init) + end + end +end
Add unit test for GObjectTypeInit
diff --git a/lib/devise/hooks/two_step_verification.rb b/lib/devise/hooks/two_step_verification.rb index abc1234..def5678 100644 --- a/lib/devise/hooks/two_step_verification.rb +++ b/lib/devise/hooks/two_step_verification.rb @@ -2,9 +2,9 @@ if user.need_two_step_verification? cookie = auth.env["action_dispatch.cookies"].signed["remember_2sv_session"] valid = cookie && - cookie[:user_id] == user.id && - cookie[:valid_until] > Time.zone.now && - cookie[:secret_hash] == Digest::SHA256.hexdigest(user.otp_secret_key) + cookie["user_id"] == user.id && + cookie["valid_until"] > Time.zone.now && + cookie["secret_hash"] == Digest::SHA256.hexdigest(user.otp_secret_key) unless valid auth.session(:user)['need_two_step_verification'] = user.need_two_step_verification? end
Use strings to access cookies instead of symbols Due to the cookie serialisation changes in Rails 5 cookies now need to be accessed with string keys rather than symbols
diff --git a/lib/podio/models/stream_activity_group.rb b/lib/podio/models/stream_activity_group.rb index abc1234..def5678 100644 --- a/lib/podio/models/stream_activity_group.rb +++ b/lib/podio/models/stream_activity_group.rb @@ -4,7 +4,8 @@ property :kind, :string property :type, :string property :created_on, :datetime - property :data, :hash + property :data, :hash # kind = single + property :activities, :array # kind = creator || type has_one :data_ref, :class => 'Reference' has_one :created_by, :class => 'ByLine'
Add activities for creator groups
diff --git a/lib/rpm_contrib/instrumentation/resque.rb b/lib/rpm_contrib/instrumentation/resque.rb index abc1234..def5678 100644 --- a/lib/rpm_contrib/instrumentation/resque.rb +++ b/lib/rpm_contrib/instrumentation/resque.rb @@ -7,6 +7,8 @@ perform_action_with_newrelic_trace(:name => 'perform', :class_name => class_name, :category => 'OtherTransaction/ResqueJob') do yield(*args) end + + NewRelic::Agent.shutdown end end end
Add a shutdown method to Resque instrumentation to ensure data is saved Signed-off-by: Justin George <26962c8b46ccf1e15704afec3ad512e5c5878696@gmail.com>
diff --git a/lib/suspenders/generators/ci_generator.rb b/lib/suspenders/generators/ci_generator.rb index abc1234..def5678 100644 --- a/lib/suspenders/generators/ci_generator.rb +++ b/lib/suspenders/generators/ci_generator.rb @@ -11,7 +11,7 @@ end def copy_database_yml_for_gitlab - copy_file 'database.gitlab.yml', 'database.gitlab.yml' + copy_file 'database.gitlab.yml', 'config/database.gitlab.yml' end end end
Fix destination path for database.yml for gitlab
diff --git a/test/string_test.rb b/test/string_test.rb index abc1234..def5678 100644 --- a/test/string_test.rb +++ b/test/string_test.rb @@ -4,6 +4,7 @@ def test_set_param_positive url = 'https://www.example.com/$[name]/intro' assert_equal('https://www.example.com/acme/intro', url.set_param(:name, 'acme')) + assert_equal('https://www.example.com/$[name]/intro', url) end def test_set_param_negative
Add one more assertion to StringTest
diff --git a/test/test_server.rb b/test/test_server.rb index abc1234..def5678 100644 --- a/test/test_server.rb +++ b/test/test_server.rb @@ -0,0 +1,32 @@+require 'helper' +require 'memcached_mock' + +describe Dalli::Server do + describe 'hostname parsing' do + it 'handles no port or weight' do + s = Dalli::Server.new('localhost') + assert_equal 'localhost', s.hostname + assert_equal 11211, s.port + assert_equal 1, s.weight + end + + it 'handles a port, but no weight' do + s = Dalli::Server.new('localhost:11212') + assert_equal 'localhost', s.hostname + assert_equal 11212, s.port + assert_equal 1, s.weight + end + + it 'handles a port and a weight' do + s = Dalli::Server.new('localhost:11212:2') + assert_equal 'localhost', s.hostname + assert_equal 11212, s.port + assert_equal 2, s.weight + end + + it 'handles ipv4 addresses' do + s = Dalli::Server.new('127.0.0.1') + assert_equal '127.0.0.1', s.hostname + end + end +end
Add test for existing server hostname parsing
diff --git a/decidim-core/spec/spec_helper.rb b/decidim-core/spec/spec_helper.rb index abc1234..def5678 100644 --- a/decidim-core/spec/spec_helper.rb +++ b/decidim-core/spec/spec_helper.rb @@ -1,7 +1,7 @@ ENV['RAILS_ENV'] ||= 'test' begin - require File.expand_path("../dummy/config/environment", __FILE__) + require File.expand_path("../core_dummy/config/environment", __FILE__) rescue LoadError puts "Could not load dummy application. Please ensure you have run `bundle exec rake test_app`" exit
Fix dummy test app path
diff --git a/lib/scss_lint/linter/id_with_extraneous_selector.rb b/lib/scss_lint/linter/id_with_extraneous_selector.rb index abc1234..def5678 100644 --- a/lib/scss_lint/linter/id_with_extraneous_selector.rb +++ b/lib/scss_lint/linter/id_with_extraneous_selector.rb @@ -7,7 +7,12 @@ id_sel = seq.members.find { |simple| simple.is_a?(Sass::Selector::Id) } return unless id_sel - if seq.members.any? { |simple| !simple.is_a?(Sass::Selector::Id) && !simple.is_a?(Sass::Selector::Pseudo) } + can_be_simplified = seq.members.any? do |simple| + !simple.is_a?(Sass::Selector::Id) && + !simple.is_a?(Sass::Selector::Pseudo) + end + + if can_be_simplified add_lint(seq, "Selector `#{seq}` can be simplified to `#{id_sel}`, " << 'since IDs should be uniquely identifying') end
Fix Rubocop lints in IdWithExtraneousSelector Change-Id: Ib06958a78c715c01349fa38db793565fdfa771d9 Reviewed-on: http://gerrit.causes.com/36710 Tested-by: jenkins <d95b56ce41a2e1ac4cecdd398defd7414407cc08@causes.com> Reviewed-by: Shane da Silva <6f6e68d1df92f30cb4b3ce35260ddf94a402f33d@causes.com>
diff --git a/app/models/spree/user_decorator.rb b/app/models/spree/user_decorator.rb index abc1234..def5678 100644 --- a/app/models/spree/user_decorator.rb +++ b/app/models/spree/user_decorator.rb @@ -1,5 +1,11 @@ module Spree User.class_eval do + after_create :set_default_role + has_many :devices, class_name: "Devices" + + def set_default_role + self.spree_roles << Spree::Role.find_or_create_by(name: "user") + end end end
Set default role for new user to "user".
diff --git a/app/models/gallery.rb b/app/models/gallery.rb index abc1234..def5678 100644 --- a/app/models/gallery.rb +++ b/app/models/gallery.rb @@ -1,5 +1,5 @@ class Gallery < ActiveRecord::Base - has_many :pictures + has_many :pictures, dependent: :destroy after_initialize do if new_record?
Delete pictures, when galleries are deleted.
diff --git a/app/models/on_call.rb b/app/models/on_call.rb index abc1234..def5678 100644 --- a/app/models/on_call.rb +++ b/app/models/on_call.rb @@ -8,7 +8,7 @@ on_call_schedules.each do |schedule, on_call_days| on_call_days.each do |day, email| - self.find_or_create_by(date: day.to_date, email: email, schedule: schedule) + self.find_or_create_by(date: day.to_date, schedule: schedule).update_attributes(email: email) end end end
Fix overriding of an on call shift
diff --git a/config/initializers/active_job.rb b/config/initializers/active_job.rb index abc1234..def5678 100644 --- a/config/initializers/active_job.rb +++ b/config/initializers/active_job.rb @@ -0,0 +1,59 @@+require 'active_job/logging' + +# TODO: remove this when the following issue is resolved: +# https://github.com/rails/rails/issues/21036 + +# Unsubscribe all Active Job notifications +ActiveSupport::Notifications.unsubscribe 'perform_start.active_job' +ActiveSupport::Notifications.unsubscribe 'perform.active_job' +ActiveSupport::Notifications.unsubscribe 'enqueue_at.active_job' +ActiveSupport::Notifications.unsubscribe 'enqueue.active_job' + +module ActiveJob + module Logging + class LogSubscriber + # Remove all public methods so that we can use the class + # as the base class for our two new subscriber classes. + remove_method :enqueue + remove_method :enqueue_at + remove_method :perform_start + remove_method :perform + end + + class EnqueueSubscriber < LogSubscriber + def enqueue(event) + info do + job = event.payload[:job] + "Enqueued #{job.class.name} (Job ID: #{job.job_id}) to #{queue_name(event)}" + args_info(job) + end + end + + def enqueue_at(event) + info do + job = event.payload[:job] + "Enqueued #{job.class.name} (Job ID: #{job.job_id}) to #{queue_name(event)} at #{scheduled_at(event)}" + args_info(job) + end + end + end + + class ExecutionSubscriber < LogSubscriber + def perform_start(event) + info do + job = event.payload[:job] + "Performing #{job.class.name} from #{queue_name(event)}" + args_info(job) + end + end + + def perform(event) + info do + job = event.payload[:job] + "Performed #{job.class.name} from #{queue_name(event)} in #{event.duration.round(2)}ms" + end + end + end + end +end + +# Suubscribe to Active Job notifications +ActiveJob::Logging::EnqueueSubscriber.attach_to :active_job +ActiveJob::Logging::ExecutionSubscriber.attach_to :active_job
Fix memory leak when queuing jobs inside a job Active Job uses a single log subscriber class[1] for both perform and enqueue events. The consequence of this is that any queue events that happen inside a perform event are treated as child events[2] and so get added to the event object for the perform event. This causes us a problem when queuing the individual emails inside a background job as it means that even though we are using `find_each` to batch the record loading we eventually end up with 100,000+ records loaded into memory as part of the event object. As a temporary fix we can split the log subscriber into two classes - one for perform events and one for enqueue events that prevents the enqueue events being treated as child events. It is however possible that this behaviour is intentional and desired so we should start considering other approaches for sending bulk email responses. I've create rails/rails#21036 to track this issue. [1]: https://github.com/rails/rails/blob/v4.2.3/activejob/lib/active_job/logging.rb#L53-L103 [2]: https://github.com/rails/rails/blob/v4.2.3/activesupport/lib/active_support/subscriber.rb#L88
diff --git a/config/initializers/okcomputer.rb b/config/initializers/okcomputer.rb index abc1234..def5678 100644 --- a/config/initializers/okcomputer.rb +++ b/config/initializers/okcomputer.rb @@ -29,7 +29,7 @@ def check message = "" targets.each_pair do |k, v| - check = OkComputer::SolrCheck.new(v['url']) + check = OkComputer::HttpCheck.new(v['url'] + '/admin/ping') check.check if check.success? message += "Target #{k} is up. "
Use an ordinary HttpCheck until the upstream SolrCheck is updated to support solr 7
diff --git a/lib/ctrlo/external/external_board.rb b/lib/ctrlo/external/external_board.rb index abc1234..def5678 100644 --- a/lib/ctrlo/external/external_board.rb +++ b/lib/ctrlo/external/external_board.rb @@ -2,20 +2,18 @@ class ExternalBoard include Helpers - def initialize(external_id = nil) + def initialize(external_id = nil, options = {}) @external_id = external_id - end - - def self.fetch_all - new.fetch_all - end - - def self.fetch_by_external_id(external_id) - new(external_id).fetch_by_external_id + @options = options end def self.fetch(external_id, options = {}) Ctrlo::Board.persist new(external_id, options).fetch_by_external_id + end + + def fetch_by_external_id + [Trello::Board.find(external_id)] + rescue Trello::Error end def self.refresh_all @@ -27,11 +25,6 @@ rescue Trello::Error end - def fetch_by_external_id - [Trello::Board.find(external_id)] - rescue Trello::Error - end - private attr_reader :external_id end
Change order of methods, add options attribute.
diff --git a/app/concerns/resources_controller/acts_as_list_concern.rb b/app/concerns/resources_controller/acts_as_list_concern.rb index abc1234..def5678 100644 --- a/app/concerns/resources_controller/acts_as_list_concern.rb +++ b/app/concerns/resources_controller/acts_as_list_concern.rb @@ -26,7 +26,13 @@ end end - redirect_to collection_path, notice: I18n.t("acts_as_list.flash.actions.reposition.inserted_#{position}", target_resource: target_resource_label, inserted_resource: inserted_resource_label) + redirect_to after_reposition_location, notice: I18n.t("acts_as_list.flash.actions.reposition.inserted_#{position}", target_resource: target_resource_label, inserted_resource: inserted_resource_label) + end + + private + + def after_reposition_location + collection_path end end end
Add after_reposition_location method to ResourcesController::ActsAsListConcern.
diff --git a/lib/ettu/railtie.rb b/lib/ettu/railtie.rb index abc1234..def5678 100644 --- a/lib/ettu/railtie.rb +++ b/lib/ettu/railtie.rb @@ -1,24 +1,37 @@ class Ettu class Railtie < Rails::Railtie config.ettu = ActiveSupport::OrderedOptions.new - initializer 'load' do |app| unless app.config.ettu.disabled require 'ettu' - ActiveSupport.on_load :action_controller do - ActionController::Base.send :include, FreshWhen - end + if app.config.ettu.development_hack - if app.config.ettu.development_hack class BlackHole < Hash def []=(k, v); end end + module EtagBuster + extend ActiveSupport::Concern + included do + def fresh_when(*args); end + end + end + module ::ActionView class Digestor @@cache = BlackHole.new end end + ActiveSupport.on_load :action_controller do + ActionController::Base.send :include, EtagBuster + end + + else + + ActiveSupport.on_load :action_controller do + ActionController::Base.send :include, FreshWhen + end + end end
Stop etags fresh_when development_hack is true
diff --git a/lib/instana/base.rb b/lib/instana/base.rb index abc1234..def5678 100644 --- a/lib/instana/base.rb +++ b/lib/instana/base.rb @@ -37,8 +37,28 @@ @pid = ::Process.pid end + # Indicates if the process ID has changed since we last check. + # + # @return Boolean + # def pid_change? @pid != ::Process.pid end + + # Indicates whether we are running in a development environment. + # + # @return Boolean + # + def debug? + ENV.key?('INSTANA_GEM_DEV') + end + + # Indicates whether we are running in the test environment. + # + # @return Boolean + # + def test? + ENV.key?('INSTANA_GEM_TEST') + end end end
Add methods to check which environment we are running in
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,15 @@+require 'sidekiq/api' require 'sidekiq/web' + +Sidekiq::Web.get '/rag' do + stats = Sidekiq::Stats.new + + content_type :json + + { item: [{ value: stats.failed, text: 'Failed' }, + { value: stats.enqueued, text: 'Enqueued' }, + { value: stats.processed, text: 'Processed' }] }.to_json +end if ENV['SIDEKIQ_USERNAME'] && ENV['SIDEKIQ_PASSWORD'] Sidekiq::Web.use Rack::Auth::Basic do |username, password|
Add Red Amber Green stats to Sidekiq endpoint
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -17,6 +17,7 @@ scope 'pages' do get 'pages', path: '/' get 'pages_guide', path: '/guide' + get 'pages_error', path: '/error' end scope 'css' do
Configure route for error page.
diff --git a/lib/scan/manager.rb b/lib/scan/manager.rb index abc1234..def5678 100644 --- a/lib/scan/manager.rb +++ b/lib/scan/manager.rb @@ -3,7 +3,7 @@ def work(options) Scan.config = options - FastlaneCore::PrintTable.print_values(config: options, hide_keys: [], title: "Summary") + FastlaneCore::PrintTable.print_values(config: options, hide_keys: [:destination], title: "Summary") return Runner.new.run end
Hide :destination option from table summary
diff --git a/lib/tasks/data.rake b/lib/tasks/data.rake index abc1234..def5678 100644 --- a/lib/tasks/data.rake +++ b/lib/tasks/data.rake @@ -13,6 +13,11 @@ en.labels.create(name: "offensive", parent: informal, for_seq: false) en.labels.create(name: "archaic") en.labels.create(name: "idiom", for_seq: false) + en.labels.create(name: "formal") + technical = en.labels.create(name: "technical") + en.labels.create(name: "medical", parent: technical) + en.labels.create(name: "legal", parent: technical) + en.labels.create(name: "scientific", parent: technical) dialects = { "American" => [ "US", "Canada", "AAVE"],
Add five more labels (see comment) Formal, technical, then three children of technical: medical, legal, scientific
diff --git a/activesupport/lib/active_support/json/backends/yajl.rb b/activesupport/lib/active_support/json/backends/yajl.rb index abc1234..def5678 100644 --- a/activesupport/lib/active_support/json/backends/yajl.rb +++ b/activesupport/lib/active_support/json/backends/yajl.rb @@ -1,4 +1,4 @@-require 'yajl-ruby' unless defined?(Yajl) +require 'yajl' unless defined?(Yajl) module ActiveSupport module JSON
Fix Yajl backend discovery in ActiveSupport::JSON [#4897 state:committed] Signed-off-by: Jeremy Kemper <b3f594e10a9edcf5413cf1190121d45078c62290@bitsweat.net>
diff --git a/lib/motion-settings/configuration.rb b/lib/motion-settings/configuration.rb index abc1234..def5678 100644 --- a/lib/motion-settings/configuration.rb +++ b/lib/motion-settings/configuration.rb @@ -23,8 +23,8 @@ def toggle(title, options = {}) preference(title, "PSToggleSwitchSpecifier", options, { - "TrueValue" => "YES", - "FalseValue" => "YES" + "TrueValue" => true, + "FalseValue" => false }) end
Use actual true/false for toggle switch
diff --git a/config/environments/production.rb b/config/environments/production.rb index abc1234..def5678 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -2,6 +2,7 @@ config.action_controller.perform_caching = true config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" config.active_support.deprecation = :notify + config.assets.digest = true config.cache_classes = true config.consider_all_requests_local = false config.i18n.fallbacks = true
Use config digest to fingerprint assets
diff --git a/lib/proxy_fetcher/providers/xroxy.rb b/lib/proxy_fetcher/providers/xroxy.rb index abc1234..def5678 100644 --- a/lib/proxy_fetcher/providers/xroxy.rb +++ b/lib/proxy_fetcher/providers/xroxy.rb @@ -6,7 +6,7 @@ class XRoxy < Base # Provider URL to fetch proxy list def provider_url - "https://madison.xroxy.com/proxylist.html" + "https://www.xroxy.com/proxylist.htm" end def xpath
Fix link for XRoxy provider
diff --git a/lib/pseudocephalopod/memory_cache.rb b/lib/pseudocephalopod/memory_cache.rb index abc1234..def5678 100644 --- a/lib/pseudocephalopod/memory_cache.rb +++ b/lib/pseudocephalopod/memory_cache.rb @@ -1,4 +1,8 @@ module Pseudocephalopod + # Implements a simple cache store that uses the + # current processes memory. This makes is primarily + # used for testing purposes in the situations where + # caching is used. class MemoryCache def self.write(key, value, options = {})
Add a comment to the memory cache documentation.
diff --git a/core/encoding/fixtures/classes.rb b/core/encoding/fixtures/classes.rb index abc1234..def5678 100644 --- a/core/encoding/fixtures/classes.rb +++ b/core/encoding/fixtures/classes.rb @@ -20,4 +20,26 @@ end end end + + class InvalidByteSequenceError + def self.exception + ec = Encoding::Converter.new("utf-8", "iso-8859-1") + begin + ec.convert("\xf1abcd") + rescue Encoding::InvalidByteSequenceError => e + e + end + end + end + + class InvalidByteSequenceErrorIndirect + def self.exception + ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1") + begin + ec.convert("abc\xA1\xFFdef") + rescue Encoding::InvalidByteSequenceError => e + e + end + end + end end
Encoding: Expand fixtures file for InvalidByteSequenceError
diff --git a/lib/versionator/detector/owncloud.rb b/lib/versionator/detector/owncloud.rb index abc1234..def5678 100644 --- a/lib/versionator/detector/owncloud.rb +++ b/lib/versionator/detector/owncloud.rb @@ -16,11 +16,6 @@ set :newest_version_url, 'https://owncloud.org/install/' set :newest_version_selector, '.install .main p' set :newest_version_regexp, /^Latest stable version: ([\d\.]+)/ - - # Overridden to make sure that we do only detect the 5+ series - def contents_detected? - installed_version.major >= 7 if super - end end end end
Update ownCloud detector to also cover 6.*
diff --git a/ESTabBarController-swift.podspec b/ESTabBarController-swift.podspec index abc1234..def5678 100644 --- a/ESTabBarController-swift.podspec +++ b/ESTabBarController-swift.podspec @@ -10,5 +10,6 @@ s.platform = :ios, '8.0' s.source = {:git => 'https://github.com/eggswift/ESTabBarController.git', :tag => s.version} s.source_files = ['Sources/**/*.{swift}'] +s.resources = ['Sources/**/*.{lproj}'] s.requires_arc = true end
Include Localizable.strings file in podspec Without this, accessibility labels aren't being set with properly formatted localized strings
diff --git a/mlb_gameday.gemspec b/mlb_gameday.gemspec index abc1234..def5678 100644 --- a/mlb_gameday.gemspec +++ b/mlb_gameday.gemspec @@ -8,7 +8,7 @@ spec.version = MLBGameday::VERSION spec.authors = ["Steven Hoffman"] spec.email = ["git@fustrate.com"] - spec.description = %q{MLB Gameday gem} + spec.description = %q{Access data about games and players from the official MLB Gameday API} spec.summary = %q{Fetches gameday data from the MLB Gameday API} spec.homepage = "http://github.com/fustrate/mlb_gameday" spec.license = "MIT"
Add a real gem description Signed-off-by: Steven Hoffman <46f1a0bd5592a2f9244ca321b129902a06b53e03@fustrate.com>
diff --git a/RNZipArchive.podspec b/RNZipArchive.podspec index abc1234..def5678 100644 --- a/RNZipArchive.podspec +++ b/RNZipArchive.podspec @@ -16,15 +16,11 @@ s.library = 'z' s.dependency 'React' + s.dependency 'SSZipArchive', '2.2.2' s.subspec 'Core' do |ss| ss.source_files = 'ios/*.{h,m}' ss.public_header_files = ['ios/RNZipArchive.h'] end - s.subspec 'SSZipArchive' do |ss| - ss.source_files = 'ios/SSZipArchive/*.{h,m}', 'ios/SSZipArchive/aes/*.{h,c}', 'ios/SSZipArchive/minizip/*.{h,c}' - ss.private_header_files = 'ios/SSZipArchive/*.h', 'ios/SSZipArchive/aes/*.h', 'ios/SSZipArchive/minizip/*.h' - end - end
Update podspec to pull in SSZipArchive directly This also eliminate the need to manually add libiconv and Security.framework.
diff --git a/app/workers/import_workers/finaliser_worker.rb b/app/workers/import_workers/finaliser_worker.rb index abc1234..def5678 100644 --- a/app/workers/import_workers/finaliser_worker.rb +++ b/app/workers/import_workers/finaliser_worker.rb @@ -34,7 +34,8 @@ Search::Index.delete Search::Index.create - + Search::Index.index + Autocompletion.drop Autocompletion.populate
Add Search::Index.index in explcitly to import as a result of the search refactor that has index creation and index indexing as two separate steps now
diff --git a/attributes/default.rb b/attributes/default.rb index abc1234..def5678 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -17,7 +17,7 @@ # limitations under the License. # -default['codecpetion']['dir'] = '/assets' -default['codecpetion']['user'] = "www-data" -default['codecpetion']['group'] = "www-data" -default['codecpetion']['source'] = "http://codeception.com/codecept.phar" +default[:codecpetion][:dir] = "/assets" +default[:codecpetion][:user] = "www-data" +default[:codecpetion][:group] = "www-data" +default[:codecpetion][:source] = "http://codeception.com/codecept.phar"
Access node attributes in a consistent manner
diff --git a/railties/test/json_params_parsing_test.rb b/railties/test/json_params_parsing_test.rb index abc1234..def5678 100644 --- a/railties/test/json_params_parsing_test.rb +++ b/railties/test/json_params_parsing_test.rb @@ -3,7 +3,7 @@ require "active_record" class JsonParamsParsingTest < ActionDispatch::IntegrationTest - test "prevent null query" do + def test_prevent_null_query # Make sure we have data to find klass = Class.new(ActiveRecord::Base) do def self.name; 'Foo'; end @@ -32,6 +32,8 @@ [[[nil]], [[[nil]]]].each do |data| assert_nil app.call(make_env({ 't' => data })) end + ensure + klass.connection.drop_table("foos") end private
Drop a temporary table before end of a test case
diff --git a/db/migrate/20110410211735_seed_asset_booking_templates.rb b/db/migrate/20110410211735_seed_asset_booking_templates.rb index abc1234..def5678 100644 --- a/db/migrate/20110410211735_seed_asset_booking_templates.rb +++ b/db/migrate/20110410211735_seed_asset_booking_templates.rb @@ -1,5 +1,8 @@ class SeedAssetBookingTemplates < ActiveRecord::Migration def self.up + # Workaround as we changed BookingTemplate before + BookingTemplate.reset_column_information + BookingTemplate.create!([ {:code => "asset:activate", :title => "Aktivierung", :debit_account => Account.find_by_code("4000"), :credit_account => Account.find_by_code("1230"), :amount => 1, :amount_relates_to => 'reference_amount'},
Add column information reload to fix migration path.
diff --git a/config/environments/development.rb b/config/environments/development.rb index abc1234..def5678 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,15 +1,16 @@ RacingOnRails::Application.configure do - config.action_controller.perform_caching = false - config.action_mailer.raise_delivery_errors = false - config.active_record.migration_error = :page_load - config.active_support.deprecation = :log - config.assets.css_compressor = false - config.assets.debug = true - config.assets.js_compressor = false - config.assets.raise_runtime_errors = true - config.cache_classes = false - config.consider_all_requests_local = true - config.eager_load = false - config.middleware.use Rack::LiveReload - config.action_view.raise_on_missing_translations = true + config.action_controller.action_on_unpermitted_parameters = :raise + config.action_controller.perform_caching = false + config.action_mailer.raise_delivery_errors = false + config.active_record.migration_error = :page_load + config.active_support.deprecation = :log + config.assets.css_compressor = false + config.assets.debug = true + config.assets.js_compressor = false + config.assets.raise_runtime_errors = true + config.cache_classes = false + config.consider_all_requests_local = true + config.eager_load = false + config.middleware.use Rack::LiveReload + config.action_view.raise_on_missing_translations = true end
Raise exception in dev if there are unpermitted attributes
diff --git a/Library/Formula/gambit-scheme.rb b/Library/Formula/gambit-scheme.rb index abc1234..def5678 100644 --- a/Library/Formula/gambit-scheme.rb +++ b/Library/Formula/gambit-scheme.rb @@ -1,9 +1,9 @@ require 'formula' class GambitScheme <Formula - url 'http://www.iro.umontreal.ca/~gambit/download/gambit/v4.5/source/gambc-v4_5_2.tgz' + url 'http://www.iro.umontreal.ca/~gambit/download/gambit/v4.5/source/gambc-v4_5_3.tgz' homepage 'http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php/Main_Page' - md5 '71bd4b5858f807c4a8ce6ce68737db16' + md5 '716ed47b7a73d90c9426a240e9536f67' def options [
Update Gambit Scheme to v4.5.3
diff --git a/fix_stats.rb b/fix_stats.rb index abc1234..def5678 100644 --- a/fix_stats.rb +++ b/fix_stats.rb @@ -0,0 +1,34 @@+require 'rubygems' +require 'time' +require 'sqlite3' + +db = SQLite3::Database.new('data.sqlite3') + +links_hash = {} +links = [] +users = {} + +# Clear the stats +db.execute("update stats set dupes=0, total=0") + +# Pull the links and sort +db.execute("select dt,user_id,url from links").each do |row| + links << {:link => row[2], :timestamp => Time.parse(row[0]).to_i, :user => row[1]} +end +links.sort!{|a,b| a[:timestamp] <=> b[:timestamp]} + + +links.each do |link| + users[link[:user]] ||= {:total => 0, :dupes => 0} + users[link[:user]][:total] = users[link[:user]][:total] + 1 + if !links_hash[link[:link]].nil? + users[link[:user]][:dupes] = users[link[:user]][:dupes] + 1 + else + links_hash[link[:link]] = true + end +end + +# Go through the users, update the stats +users.each do |user_id,user| + db.execute("update stats set dupes=#{user[:dupes]}, total=#{user[:total]} where user_id='#{user_id}'") +end
Fix the TOTAL stats... but not dupes :\
diff --git a/lib/tasks/import/covid19_test_and_trace_scheme_links.rake b/lib/tasks/import/covid19_test_and_trace_scheme_links.rake index abc1234..def5678 100644 --- a/lib/tasks/import/covid19_test_and_trace_scheme_links.rake +++ b/lib/tasks/import/covid19_test_and_trace_scheme_links.rake @@ -0,0 +1,35 @@+require "csv" + +namespace :import do + desc "Imports COVID-19 Test and Trace scheme links from CSV file" + task :test_and_trace_links, %i[lgsl_code lgil_code filename] => :environment do |_, args| + service_interaction = ServiceInteraction.find_or_create_by!( + service: Service.find_by!(lgsl_code: args.lgsl_code), + interaction: Interaction.find_by!(lgil_code: args.lgil_code), + ) + + csv = CSV.read(args.filename, { headers: true }) + + puts "Importing [#{csv.count}] links" + imported = 0 + + csv.each do |row| + slug = row["slug"]&.strip + url = row["url"]&.strip + + local_authority = LocalAuthority.find_by(slug: slug) + + local_link = Link.find_or_initialize_by( + local_authority: local_authority, + service_interaction: service_interaction, + ) + + local_link.url = url + local_link.save! + + imported += 1 + end + + puts "[#{imported}] links imported" + end +end
Add local links for Test and Trace scheme What We need to add the local authority links for the test and trace scheme self isolation payments. The rake task takes 3 params: LGSL code, LGIL code and a filename. The file to which the filename points to must be a CSV file with 2 columns. It must have a header row of "slug" and "url". It is expected that this file be available locally, in the /tmp directory for example. Why The test and trace scheme is newly created.
diff --git a/spec/workers/share_worker_spec.rb b/spec/workers/share_worker_spec.rb index abc1234..def5678 100644 --- a/spec/workers/share_worker_spec.rb +++ b/spec/workers/share_worker_spec.rb @@ -5,21 +5,29 @@ describe ShareWorker do let(:user) { FactoryBot.create(:user) } let(:answer) { FactoryBot.create(:answer, user: user) } + let!(:service) { Services::Twitter.create!(type: 'Services::Twitter', + user: user) } describe "#perform" do - subject { ShareWorker.new.perform(user.id, answer.id, 'twitter') } - - before do - Service.create!(type: 'Services::Twitter', - user: user) - end + subject { + Sidekiq::Testing.fake! do + ShareWorker.perform_async(user.id, answer.id, 'twitter') + end + } context 'when answer doesn\'t exist' do it 'prevents the job from retrying and logs a message' do answer.destroy! Sidekiq.logger.should_receive(:info) - subject - expect(ShareWorker.jobs.size).to eq(0) + expect { subject }.to change(ShareWorker.jobs, :size).by(1) + expect { ShareWorker.drain }.to change(ShareWorker.jobs, :size).by(-1) + end + end + + context 'when answer exists' do + it 'retries on unhandled exceptions' do + expect { subject }.to change(ShareWorker.jobs, :size).by(1) + expect { ShareWorker.drain }.to raise_error(Twitter::Error::Forbidden) end end end
Test `ShareWorker`'s handling of unhandled exceptions
diff --git a/TGLStackedViewController.podspec b/TGLStackedViewController.podspec index abc1234..def5678 100644 --- a/TGLStackedViewController.podspec +++ b/TGLStackedViewController.podspec @@ -0,0 +1,13 @@+Pod::Spec.new do |s| + s.name = 'TGLStackedViewController' + s.version = '0.0.1' + s.license = 'MIT' + s.summary = 'A stacked view layout with gesture-based reordering using a UICollectionView -- inspired by Passbook and Reminders apps.' + s.homepage = 'https://github.com/gleue/TGLStackedViewController' + s.authors = { 'Tim Gleue' => 'tim@gleue-interactive.com' } + s.source = { :git => 'https://github.com/gleue/TGLStackedViewController.git', :tag => '0.0.1' } + s.source_files = 'TGLStackedViewController' + + s.requires_arc = true + s.platform = :ios, '7.0' +end
Add the podspec file for cocoapods
diff --git a/tinymce-rails-langs.gemspec b/tinymce-rails-langs.gemspec index abc1234..def5678 100644 --- a/tinymce-rails-langs.gemspec +++ b/tinymce-rails-langs.gemspec @@ -6,6 +6,7 @@ s.files = Dir["README.md", "LICENSE", "lib/**/*", "vendor/**/*"] s.authors = ["Sam Pohlenz"] s.email = "sam@sampohlenz.com" + s.homepage = "https://github.com/spohlenz/tinymce-rails-langs" s.add_dependency "tinymce-rails", "~> 4.0" end
Add home page to gemspec
diff --git a/html-conditional-comment.gemspec b/html-conditional-comment.gemspec index abc1234..def5678 100644 --- a/html-conditional-comment.gemspec +++ b/html-conditional-comment.gemspec @@ -20,8 +20,8 @@ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.add_development_dependency "bundler", "~> 1.13" - spec.add_development_dependency "rake", "~> 10.0" - spec.add_development_dependency "minitest", "~> 5.0" + spec.add_development_dependency "bundler" + spec.add_development_dependency "rake" + spec.add_development_dependency "minitest" spec.add_development_dependency "byebug" end
Upgrade dependencies by removing version restrictions
diff --git a/spec/factories/harvests.rb b/spec/factories/harvests.rb index abc1234..def5678 100644 --- a/spec/factories/harvests.rb +++ b/spec/factories/harvests.rb @@ -3,7 +3,7 @@ FactoryBot.define do factory :harvest do crop { planting.present? ? planting.crop : FactoryBot.create(:crop) } - plant_part { create :plant_part, name: Faker::Book.unique.title } + plant_part { FactoryBot.create :plant_part } planting nil owner { planting.present? ? planting.owner : FactoryBot.create(:member) } harvested_at { Time.zone.local(2015, 9, 17) }
Use factory bot to make a harvest.plant_part
diff --git a/spec/factories/podcasts.rb b/spec/factories/podcasts.rb index abc1234..def5678 100644 --- a/spec/factories/podcasts.rb +++ b/spec/factories/podcasts.rb @@ -1,12 +1,12 @@ FactoryBot.define do factory :podcast, class: Podcast do - track_id { 123 } title { 'title' } description { 'description' } content_size { 0 } duration { 0 } permalink { 'title' } - permalink_url { 'http://aaa.bbb/title' } + permalink_url { 'https://aaa.bbb/title' } + enclosure_url { 'https://ccc.ddd/title.mp3' } published_date { Time.zone.today } end end
Stop using 'track_id' in sample data for test
diff --git a/db/migrate/067_remove_blog_ids.rb b/db/migrate/067_remove_blog_ids.rb index abc1234..def5678 100644 --- a/db/migrate/067_remove_blog_ids.rb +++ b/db/migrate/067_remove_blog_ids.rb @@ -4,6 +4,7 @@ end class Feedback < ActiveRecord::Base + set_table_name "feedback" end class Sidebar < ActiveRecord::Base
Fix up feedback table name in migration 067.
diff --git a/spec/models/rating_spec.rb b/spec/models/rating_spec.rb index abc1234..def5678 100644 --- a/spec/models/rating_spec.rb +++ b/spec/models/rating_spec.rb @@ -0,0 +1,30 @@+require 'rails_helper' + +RSpec.describe Rating, type: :model do + let(:rating) { Rating.new(stars: 4, user_id: User.first.id, film_id: Film.last.id) } + + describe 'validations' do + it 'is valid with valid attributes' do + expect(rating).to be_valid + end + + it 'is not valid without stars' do + rating.stars = nil + expect(rating).to_not be_valid + end + + it 'is not valid without a user' do + rating.user = nil + expect(rating).to_not be_valid + end + + it 'is not valid without a film' do + rating.film = nil + expect(rating).to_not be_valid + end + end + + describe 'associations' do + + end +end
Add validation tests to Rating model spec