diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/hets/hets_options.rb b/lib/hets/hets_options.rb index abc1234..def5678 100644 --- a/lib/hets/hets_options.rb +++ b/lib/hets/hets_options.rb @@ -14,6 +14,10 @@ def add(**opts) @options.merge!(opts.dup) prepare + end + + def merge!(hets_options) + add(hets_options.options) end protected
Add method merge! on HetsOptions.
diff --git a/spec/controllers/api/enterprise_fees_controller_spec.rb b/spec/controllers/api/enterprise_fees_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/api/enterprise_fees_controller_spec.rb +++ b/spec/controllers/api/enterprise_fees_controller_spec.rb @@ -0,0 +1,34 @@+require 'spec_helper' + +module Api + describe EnterpriseFeesController, type: :controller do + include AuthenticationWorkflow + + let!(:unreferenced_fee) { create(:enterprise_fee) } + let!(:referenced_fee) { create(:enterprise_fee) } + let(:product) { create(:product) } + let(:distributor) { create(:distributor_enterprise) } + let!(:product_distribution) { create(:product_distribution, product: product, distributor: distributor, enterprise_fee: referenced_fee) } + let(:current_user) { create(:admin_user) } + + before do + allow(controller).to receive(:spree_current_user) { current_user } + end + + describe "destroy" do + it "removes the fee" do + expect { spree_delete :destroy, id: unreferenced_fee.id, format: :json } + .to change { EnterpriseFee.count }.by -1 + end + + context "when the fee is referenced by a product distribution" do + it "does not remove the fee" do + spree_delete :destroy, id: referenced_fee.id, format: :json + expect(response.status).to eq 403 + expect(response.body).to match(/That enterprise fee cannot be deleted/) + expect(referenced_fee.reload).to eq(referenced_fee) + end + end + end + end +end
Add specs for new Api::EnterpriseFeesController
diff --git a/spec/backend/exec/stdxxx_handler_spec.rb b/spec/backend/exec/stdxxx_handler_spec.rb index abc1234..def5678 100644 --- a/spec/backend/exec/stdxxx_handler_spec.rb +++ b/spec/backend/exec/stdxxx_handler_spec.rb @@ -0,0 +1,25 @@+require 'spec_helper' + +backend = Specinfra::Backend::Exec.new + +context 'Output of stdout_handler' do + subject(:stdout) do + out = '' + backend.stdout_handler = Proc.new {|o| out += o } + backend.run_command('echo foo') + out + end + + it { expect(stdout).to eq "foo\n" } +end + +context 'Output of stderr_handler' do + subject(:stderr) do + err = '' + backend.stderr_handler = Proc.new {|e| err += e } + backend.run_command('echo foo 1>&2') + err + end + + it { expect(stderr).to eq "foo\n" } +end
Add specs of stdout_handler and stderr_handler for exec backend
diff --git a/spec/controllers/join_controller_spec.rb b/spec/controllers/join_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/join_controller_spec.rb +++ b/spec/controllers/join_controller_spec.rb @@ -10,7 +10,7 @@ login_user it "sign_up_at should be very very recent" do subject.current_user.sign_in_count.should == 0 - subject.current_user.signup_at.should > (Time.now - 1) + subject.current_user.signup_at.should >= (Time.now - 1) end end end
Fix a sporadic test failure
diff --git a/spec/integration/mince_interface_spec.rb b/spec/integration/mince_interface_spec.rb index abc1234..def5678 100644 --- a/spec/integration/mince_interface_spec.rb +++ b/spec/integration/mince_interface_spec.rb @@ -6,5 +6,9 @@ Mince::Config.interface = Mince::HashyDb::Interface end + after do + Mince::HashyDb::Interface.clear + end + it_behaves_like 'a mince interface' end
Clear data store when integration tests finish so that we can run ints and units together
diff --git a/lib/tasks/superbolt.rake b/lib/tasks/superbolt.rake index abc1234..def5678 100644 --- a/lib/tasks/superbolt.rake +++ b/lib/tasks/superbolt.rake @@ -1,9 +1,19 @@ # assumes an environment task that sets up your app environment desc "worker that reads the queue and sends messages through the router as configured" task :superbolt => :environment do + require "statsd" + statsd = Statsd.new("localhost", 8125) begin Superbolt::App.new(Superbolt.app_name, {}).run do |message, logger| - Superbolt::Router.new(message, logger).perform + begin + Superbolt::Router.new(message, logger).perform + statsd.increment("app.#{Superbolt.app_name}.messages.#{message["event"]}.success") + rescue Exceptions::AbortJob + statsd.increment("app.#{Superbolt.app_name}.messages.#{message["event"]}.abort") + rescue => e + statsd.increment("app.#{Superbolt.app_name}.messages.#{message["event"]}.error") + raise e + end end # Rescue SignalException so that we don't spam error handlers like Airbrake # with SIGTERM errors every time a task is killed (machine restarts, etc.)
EGG-757: Add statsd message logging around worker perform
diff --git a/lib/uber/api/requests.rb b/lib/uber/api/requests.rb index abc1234..def5678 100644 --- a/lib/uber/api/requests.rb +++ b/lib/uber/api/requests.rb @@ -1,11 +1,17 @@ require 'uber/arguments' require 'uber/api_request' require 'uber/models/request' +require 'uber/models/estimate' require 'uber/models/map' module Uber module API module Requests + def trip_estimate(*args) + arguments = Uber::Arguments.new(args) + perform_with_object(:post, "v1/requests/estimate", arguments.options, Estimate) + end + def trip_request(*args) arguments = Uber::Arguments.new(args) perform_with_object(:post, "v1/requests", arguments.options, Request) @@ -22,6 +28,10 @@ def trip_update(request_id, status) perform_with_object(:put, "v1/sandbox/requests/#{request_id}", {status: status}, Request) end + + def trip_cancel(request_id) + perform_with_object(:delete, "v1/requests/#{request_id}", {}, Request) + end end end end
Add request estimate and cancelation methods
diff --git a/rails/benchmarks/bm_actioncontroller_api.rb b/rails/benchmarks/bm_actioncontroller_api.rb index abc1234..def5678 100644 --- a/rails/benchmarks/bm_actioncontroller_api.rb +++ b/rails/benchmarks/bm_actioncontroller_api.rb @@ -0,0 +1,16 @@+require 'bundler/setup' +require 'action_controller' +require_relative 'support/benchmark_rails' + +class ApiController < ActionController::API + def show + render json: "JSON", status: :ok + end +end +app = ApiController.action(:show) +request = Rack::MockRequest.new(app) +Benchmark.rails("actioncontroller/api", time: 5) do + response = request.get("/") + fail "Bad response #{response.status}" if response.status != 200 + fail "Bad response #{response.body}" if response.body != "JSON" +end
Add ActionController::API benchmark with Kir
diff --git a/test/integration/default/serverspec/default_spec.rb b/test/integration/default/serverspec/default_spec.rb index abc1234..def5678 100644 --- a/test/integration/default/serverspec/default_spec.rb +++ b/test/integration/default/serverspec/default_spec.rb @@ -17,11 +17,11 @@ require 'serverspec' set :backend, :exec -# describe service('poise_test') do -# it { is_expected.to be_enabled } -# it { is_expected.to be_running } -# end +describe service('poise_test') do + it { is_expected.to be_enabled } + it { is_expected.to be_running } +end -# describe process('ruby /usr/bin/poise_test') do -# it { is_expected.to be_running } -# end +describe process('ruby /usr/bin/poise_test') do + it { is_expected.to be_running } +end
Fix up core tests for systemd.
diff --git a/tools/filter_of_messages.rb b/tools/filter_of_messages.rb index abc1234..def5678 100644 --- a/tools/filter_of_messages.rb +++ b/tools/filter_of_messages.rb @@ -0,0 +1,14 @@+#!/usr/bin/env ruby + +input_file = ARGV.shift +input = File.open(input_file) + +while line = input.gets + if line =~ /^c.*OF Message START/ + line = input.gets + while line !~ /OF Message END/ + puts line if line =~ /^c/ and line !~ /xid:/ + line = input.gets + end + end +end
Add a tool to filter out openflow messages from stdout logs
diff --git a/spec/requests/account_suspended_spec.rb b/spec/requests/account_suspended_spec.rb index abc1234..def5678 100644 --- a/spec/requests/account_suspended_spec.rb +++ b/spec/requests/account_suspended_spec.rb @@ -0,0 +1,91 @@+require "spec_helper" + +RSpec.describe "When account is enabled", type: :request do + before do + allow(Rails.configuration).to receive(:feature_flag_govuk_accounts).and_return(true) + end + + context "and accounts is returning a 503 error code" do + before { stub_request(:get, Services.accounts_api).to_return(status: 503) } + + describe "/login" do + it "redirects a user to the accounts 503 error page" do + get transition_checker_new_session_path + + expect(response).to redirect_to(Services.accounts_api) + end + end + + describe "/login/callback" do + it "redirects a user to the accounts 503 error page" do + get transition_checker_new_session_callback_path + + expect(response).to redirect_to(Services.accounts_api) + end + end + + describe "/logout" do + it "redirects a user to the accounts 503 error page" do + get transition_checker_end_session_path + + expect(response.body).to eq("Redirecting to #{Services.accounts_api}/sign-out?continue=1") + end + + context "With a continue parameter" do + it "redirects a user to the accounts 503 error page" do + get transition_checker_end_session_path, params: { continue: 1 } + + expect(response.body).to eq("Redirecting to #{Services.accounts_api}/sign-out?done=1") + end + end + + context "With a done parameter" do + it "redirects a user to /transition" do + get transition_checker_end_session_path, params: { done: 1 } + + expect(response.body).to eq("Redirecting to /transition") + end + end + end + + describe "/save-your-results" do + it "redirects a user to the accounts 503 error page" do + get transition_checker_save_results_path + + expect(response).to redirect_to(Services.accounts_api) + end + end + + describe "/save-your-results/confirm" do + it "redirects a user to the accounts 503 error page" do + get transition_checker_save_results_confirm_path + + expect(response).to redirect_to(Services.accounts_api) + end + end + + describe "/save-your-results/email-signup" do + it "redirects a user to the accounts 503 error page" do + get transition_checker_save_results_email_signup_path + + expect(response).to redirect_to(Services.accounts_api) + end + end + + describe "/saved-results" do + it "redirects a user to the accounts 503 error page" do + get transition_checker_saved_results_path + + expect(response).to redirect_to(Services.accounts_api) + end + end + + describe "/edit-saved-results" do + it "redirects a user to the accounts 503 error page" do + get transition_checker_edit_saved_results_path + + expect(response).to redirect_to(Services.accounts_api) + end + end + end +end
Add requests specs for account suspension We have implimented an "emergency brake" feature on accounts that will allow us to suspend the account. This will temporarily remove public access to accounts to allow us to either perform some maintance or respond to an incident. In these cases the account will return a 503 HTTP status code. The checker should then revert all views back to email only subscriptions, allowing it to gracefully handle the lack of accounts and prevent new user journies into the account world. Routes that are exclusive to checker accounts integration (so for a small number of users mid-journey when we suspend) we want to halt their journey and redirect them to the account 503 page which will have a message explaining what is currently happening with accounts. The paths targeted here are all those used by the `check_account_enabled` callback, defining expected behaviour.
diff --git a/fwtbt.rb b/fwtbt.rb index abc1234..def5678 100644 --- a/fwtbt.rb +++ b/fwtbt.rb @@ -0,0 +1,8 @@+require_relative 'narrative-distance' + +#chunk = Chunk.new("sample.txt") + +# This should go in a seeds file. +%w(Moscow Guaranty-Trust-Company Missoula Paris Foyot’s Butte Billings Red-Lodge Cooke-City Fort-Kearny Sun-Valley same-town-as-Franco St.-Jean-de-Luz Irun San-Sebastian Lugo Negreira Vitoria Pamplona Noya Cathedral-at-Léon Tafalla Burgos Soria Zaragoza Café-Colon Valladolid Barcelona Siguenza Santa-Maria-del-Real Arevalo Buitrago Segovia La-Granja Alpine-Club Villacastín Trijueque Brihuega Torija Cerce Navacerrada Manzanares-el-Real San-Rafael Alto-del-Léon Guadar Colmenar Avila Guadalajara Peguerinos Escorial Puente-de-los-Franceses Velazquez-63 Florida Plaza-del-Callao Gran-Via Calle-de-Salud Gaylord Opera Fornos Mantequerías-Leonesas Parque-of-the-Buen-Retiro Ppalace Villa-Rosa Prado Jardín-Botánico Circus-of-Price Madrid Puente-de-Toledo Usera Béjar Carabanchel Barco-de-Avila Arganda Villaconejos Aranjuez Plasencia Otero Talavera Alcazar Toledo Valencia Pozoblanco Alicante Fuente-Ovejuna Tarsus Puerto-de-Santa-Maria Cádiz Vicksburg Corpus-Christi Gredos Spain Estremadura Russia Estremadura Russia Navarr(e|a) America Castile Montana Galicia Sierra Andalucía Black-Sea Córdoba France Lenin-Institute Little-Big-Horn Soviet-Union United-States Africa Agincourt Aragon Asturias Avenue-du-Maine Azerbaijan Basque-country Bear-Tooth-plateau Butte-Chaumont Cantabrico Caucasus Chartres-Cathedral China Cuba Dardanelles Europe Idaho Ile-de-la-Cité Maine Mmanzanares Mediterranean Mexico Morocco Mount-Everest Ohio Parc-Montsouris Poland Pyrenees Tambre damned-Jordan Scotland Siberia Sierra-de-Paramera Stade-Buffalo Straits-of-Marmora Texas two-Castiles Thermopylæ University-of-Montana Venezuela Republican-Embassy).each do |word| + Token.create(string: word) +end
Add For Whom the Bell Tolls tokens.
diff --git a/Casks/balsamiq-mockups.rb b/Casks/balsamiq-mockups.rb index abc1234..def5678 100644 --- a/Casks/balsamiq-mockups.rb +++ b/Casks/balsamiq-mockups.rb @@ -1,6 +1,6 @@ cask :v1 => 'balsamiq-mockups' do - version '3.1.6' - sha256 '5f6fec35f0ab2fdaea766b5139cc9ea604782eeda6ac417b606e6d309c7b89b7' + version '3.1.7' + sha256 'e46f9d6c7abfc95b34ec6ff944efbdef9c256f5ac49fb54767c3f287fe38919a' # amazonaws is the official download host per the vendor homepage url "https://s3.amazonaws.com/build_production/mockups-desktop/Balsamiq_Mockups_#{version}.dmg"
Update Balsamic Mockups 3.app to v3.1.7
diff --git a/spec/dummy_app/config/routes.rb b/spec/dummy_app/config/routes.rb index abc1234..def5678 100644 --- a/spec/dummy_app/config/routes.rb +++ b/spec/dummy_app/config/routes.rb @@ -1,4 +1,4 @@ Dummy::Application.routes.draw do devise_for :users - root :to => "rails_admin#index" + root :to => "rails_admin::Main#index" end
Fix dummy app default route to point to RailsAdmin::MainController
diff --git a/spec/kenny_g/game_setup_spec.rb b/spec/kenny_g/game_setup_spec.rb index abc1234..def5678 100644 --- a/spec/kenny_g/game_setup_spec.rb +++ b/spec/kenny_g/game_setup_spec.rb @@ -0,0 +1,14 @@+require 'spec_helper' +require 'kenny_g/game_setup' + +describe GameSetup do + let(:options) { { winning_score: 100, players: ['beatrix'] } } + let(:game_setup) { described_class.new(options) } + + describe '#add_player' do + it 'increments the player count' do + expect{ game_setup.add_player(name: 'lilly') } + .to change{ game_setup.players.size }.by 1 + end + end +end
Add unit test for GameSetup service object
diff --git a/spec/support/matchers/markup.rb b/spec/support/matchers/markup.rb index abc1234..def5678 100644 --- a/spec/support/matchers/markup.rb +++ b/spec/support/matchers/markup.rb @@ -1,6 +1,6 @@ RSpec::Matchers.define :contain_nil_element do |element| match do |markup| - markup =~ /<#{element} xsi:nil="true"><\/#{element}>/ + markup =~ /<#{element} xsi:nil="true"\/>/ end failure_message_for_should do |markup|
Update Custom RSpec Matcher for Refactored Order Class
diff --git a/spec/system/follow_view_spec.rb b/spec/system/follow_view_spec.rb index abc1234..def5678 100644 --- a/spec/system/follow_view_spec.rb +++ b/spec/system/follow_view_spec.rb @@ -0,0 +1,28 @@+# frozen_string_literal: true + +require 'rails_helper' + +RSpec.describe 'visit the follow page' do + let(:user) { users(:third_user) } + let(:admin) { users(:admin_user) } + let(:event_group) { event_groups(:hardrock_2015) } + + scenario 'A visitor views the follow page' do + visit follow_event_group_path(event_group) + expect(page).to have_content(event_group.name) + end + + scenario 'A user views the follow page' do + login_as user, scope: :user + + visit follow_event_group_path(event_group) + expect(page).to have_content(event_group.name) + end + + scenario 'An admin views the follow page' do + login_as admin, scope: :user + + visit follow_event_group_path(event_group) + expect(page).to have_content(event_group.name) + end +end
Add basic system spec for event_groups/follow view.
diff --git a/test/relation_test.rb b/test/relation_test.rb index abc1234..def5678 100644 --- a/test/relation_test.rb +++ b/test/relation_test.rb @@ -5,10 +5,8 @@ let(:relation) { if ActiveRecord.gem_version >= Gem::Version.new("5.2") ActiveRecord::Relation.new(klass, table: stub, predicate_builder: stub) - elsif ActiveRecord::VERSION::MAJOR > 4 + else ActiveRecord::Relation.new(klass, stub, stub) - else - ActiveRecord::Relation.new(klass, stub) end } let(:klass) { stub(name: 'Klass') }
Remove outdated ActiveRecord VERSION branch The lowest supported version of ActiveRecord is v5.0.0.
diff --git a/test/test_fizzbuzz.rb b/test/test_fizzbuzz.rb index abc1234..def5678 100644 --- a/test/test_fizzbuzz.rb +++ b/test/test_fizzbuzz.rb @@ -31,8 +31,9 @@ assert_equal "4", FizzBuzz.say(4) end - should "say Buzz for 5" do + should "say Buzz for multiples of 5" do assert_equal "Buzz", FizzBuzz.say(5) + assert_equal "Buzz", FizzBuzz.say(10) end end
Test for 10. 7 to 9 are not bringing anything new to change the code
diff --git a/sprout-osx-apps/recipes/onyx.rb b/sprout-osx-apps/recipes/onyx.rb index abc1234..def5678 100644 --- a/sprout-osx-apps/recipes/onyx.rb +++ b/sprout-osx-apps/recipes/onyx.rb @@ -1,14 +1,7 @@-osx_majorver = node['platform_version'].split('.')[0,2].join() - -source_url = "http://joel.barriere.pagesperso-orange.fr/dl/#{osx_majorver}/OnyX.dmg" - -sha256_hash = '94377590c4e08516c5b056d413571dbc747425b472483b25f2fc91c58e97eebd' -onyx_ver = '2.6.9' - dmg_package "Onyx" do - volumes_dir "Onyx #{onyx_ver}" - source source_url - checksum sha256_hash + volumes_dir "Onyx 2.7.1" + source "http://joel.barriere.pagesperso-orange.fr/dl/108/OnyX.dmg" + checksum '94377590c4e08516c5b056d413571dbc747425b472483b25f2fc91c58e97eebd' action :install owner node['current_user'] end
Simplify Onyx recipe and update to 2.7.1
diff --git a/kitchen-pester.gemspec b/kitchen-pester.gemspec index abc1234..def5678 100644 --- a/kitchen-pester.gemspec +++ b/kitchen-pester.gemspec @@ -19,7 +19,7 @@ spec.add_development_dependency "bundler" spec.add_development_dependency "rake" - spec.add_development_dependency "minitest", "~> 5.3", "< 5.14" + spec.add_development_dependency "minitest", "~> 5.3", "< 5.15" spec.add_development_dependency "mocha", "~> 1.1" spec.add_dependency "test-kitchen", ">= 1.10", "< 3"
Update minitest requirement from ~> 5.3, < 5.14 to ~> 5.3, < 5.15 Updates the requirements on [minitest](https://github.com/seattlerb/minitest) to permit the latest version. - [Release notes](https://github.com/seattlerb/minitest/releases) - [Changelog](https://github.com/seattlerb/minitest/blob/master/History.rdoc) - [Commits](https://github.com/seattlerb/minitest/compare/v5.3.0...v5.14.0) Signed-off-by: dependabot-preview[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>
diff --git a/api/lib/spree/api/controller_setup.rb b/api/lib/spree/api/controller_setup.rb index abc1234..def5678 100644 --- a/api/lib/spree/api/controller_setup.rb +++ b/api/lib/spree/api/controller_setup.rb @@ -21,6 +21,9 @@ include CanCan::ControllerAdditions include Spree::Core::ControllerHelpers::Auth + prepend_view_path Rails.root + "app/views" + append_view_path File.expand_path("../../../app/views", File.dirname(__FILE__)) + self.responder = Spree::Api::Responders::AppResponder respond_to :json end
Revert "Remove append_view_path from api ControllerSetup" This reverts commit 92aaf03a787fc37810c07a1f8605fc4f1bb73c29.
diff --git a/lib/strut.rb b/lib/strut.rb index abc1234..def5678 100644 --- a/lib/strut.rb +++ b/lib/strut.rb @@ -41,7 +41,7 @@ rescue => e puts e ensure - Process.kill("HUP", pid) + Process.kill("KILL", pid) end end end
Use KILL signal instead of HUP for Windows compatibility.
diff --git a/kepler_processor.gemspec b/kepler_processor.gemspec index abc1234..def5678 100644 --- a/kepler_processor.gemspec +++ b/kepler_processor.gemspec @@ -22,5 +22,6 @@ s.required_ruby_version = '>= 1.9.2' s.add_dependency "gnuplot" + s.add_dependency "prawn" s.add_development_dependency "rspec" end
Add prawn as a dependency
diff --git a/Casks/razer-synapse.rb b/Casks/razer-synapse.rb index abc1234..def5678 100644 --- a/Casks/razer-synapse.rb +++ b/Casks/razer-synapse.rb @@ -1,6 +1,6 @@ cask :v1 => 'razer-synapse' do - version '1.44' - sha256 '63c739c78d4f537ec64b32126fc358fba4840194296e45bd7c22638af6529984' + version '1.45' + sha256 '4b4368bf5f90cb94667a60a120d49b9073329ba6d9efcd4f5108cf709bfe8115' # amazonaws.com is the official download host per the vendor homepage url "https://razerdrivers.s3.amazonaws.com/drivers/Synapse2/mac/Razer_Synapse_Mac_Driver_v#{version}.dmg"
Update Razer Synapse.app to v1.45
diff --git a/Casks/join-together.rb b/Casks/join-together.rb index abc1234..def5678 100644 --- a/Casks/join-together.rb +++ b/Casks/join-together.rb @@ -1,11 +1,11 @@ cask :v1 => 'join-together' do - version '7.4.1' - sha256 '86f7e31e437f7fbdbfa58db2f6e566d1f37f7eed74535ebcaa3e96eba23a4f18' + version '7.5.0' + sha256 'a6661c05b73fff78e1fcfc4e474e95f732ccc996a5bbae56f390e51a414e6867' url "http://dougscripts.com/itunes/scrx/jointogether#{version.delete('.')}.zip" name 'Join Together' appcast 'http://dougscripts.com/itunes/itinfo/jointogether_appcast.xml', - :sha256 => 'd83ab7e864a6f2df3500ce6b28ed44868bdb869af5a691372f305585c90ee03b' + :sha256 => '4265e5826859579304b51216b5b675e853b25fda0b1293565a79ff8352a7e363' homepage 'http://dougscripts.com/itunes/itinfo/jointogether.php' license :commercial
Update Join Together to 7.5.0
diff --git a/test/integration/coronavirus_local_restrictions_test.rb b/test/integration/coronavirus_local_restrictions_test.rb index abc1234..def5678 100644 --- a/test/integration/coronavirus_local_restrictions_test.rb +++ b/test/integration/coronavirus_local_restrictions_test.rb @@ -3,14 +3,15 @@ class CoronavirusLocalRestrictionsTest < ActionDispatch::IntegrationTest it "visits postcode lookup page" do given_i_am_on_the_local_restrictions_page - then_i_can_see_the_postcode_lookup + then_i_can_see_the_postcode_lookup_form end def given_i_am_on_the_local_restrictions_page visit find_coronavirus_local_restrictions_path end - def then_i_can_see_the_postcode_lookup + def then_i_can_see_the_postcode_lookup_form assert page.has_text?(I18n.t("coronavirus_local_restrictions.lookup.title")) + assert page.has_text?(I18n.t("coronavirus_local_restrictions.lookup.input_label")) end end
Check form label displays in feature test - We will add to this test in the follow up PR Co-authored-by: Alex Newton <a4a07234de0a205690872ef5d9931abdf491c9ba@digital.cabinet-office.gov.uk> Co-authored-by: Jonathan Hallam <jonathan.hallam@digital.cabinet-office.gov.uk
diff --git a/spec/requests/geckoboard/statistics_spec.rb b/spec/requests/geckoboard/statistics_spec.rb index abc1234..def5678 100644 --- a/spec/requests/geckoboard/statistics_spec.rb +++ b/spec/requests/geckoboard/statistics_spec.rb @@ -0,0 +1,27 @@+# frozen_string_literal: true + +RSpec.shared_examples 'a disabler of view only actions' do + it { expect(assigns(:disable_analytics)).to be_truthy } + it { expect(assigns(:disable_phase_banner)).to be_truthy } + it { expect(assigns(:disable_flashes)).to be_truthy } +end + +RSpec.describe 'Geckoboard statistics', type: :request do + describe 'GET #index' do + before { get statistics_path } + + let(:expected_reports) { { 'Claim creation by source' => 'claim_creation_source', + 'Claim Submissions' => 'claim_submissions', + 'Requests for further info' => 'requests_for_further_info', + 'Multi session submissions' => 'multi_session_submissions', + 'Time reject to auth' => 'time_reject_to_auth', + 'Completion rate' => 'completion_rate', + 'Time to completion' => 'time_to_completion', + 'Redeterminations average' => 'redeterminations_average', + 'Money claimed per month' => 'money_claimed_per_month' } } + + it { expect(response).to render_template(:index) } + it { expect(assigns(:available_reports)).to match(expected_reports) } + it_behaves_like 'a disabler of view only actions' + end +end
Add missing geckoboard request spec
diff --git a/app/controllers/snippet_controller.rb b/app/controllers/snippet_controller.rb index abc1234..def5678 100644 --- a/app/controllers/snippet_controller.rb +++ b/app/controllers/snippet_controller.rb @@ -23,5 +23,17 @@ set_snippet end + private + def set_user + + end + + def set_snippet + @snippet = Snippet.find(params[:id]) + end + + def snippet_params + params.require(:snippet).permit(:user_id, :content) + end end
Create private method to set a snippet and snippet params. Set skeleton for current user
diff --git a/app/controllers/articles_controller.rb b/app/controllers/articles_controller.rb index abc1234..def5678 100644 --- a/app/controllers/articles_controller.rb +++ b/app/controllers/articles_controller.rb @@ -52,7 +52,6 @@ end def force_authentication - return if authenticated? - redirect_to login_url + redirect_to login_url unless authenticated? end end
Use one liner for authentication check
diff --git a/app/controllers/contacts_controller.rb b/app/controllers/contacts_controller.rb index abc1234..def5678 100644 --- a/app/controllers/contacts_controller.rb +++ b/app/controllers/contacts_controller.rb @@ -4,11 +4,8 @@ def new @message = Message.new @subject = default_subject - user = User.find_by_id(params[:user_id]) - if user.nil? - redirect_to root_path and return - end - @user = user + @user = User.find params[:user_id] + redirect_to root_path if user.nil? end def create
[Refactor] Improve new method in Contacts Controller
diff --git a/app/controllers/expenses_controller.rb b/app/controllers/expenses_controller.rb index abc1234..def5678 100644 --- a/app/controllers/expenses_controller.rb +++ b/app/controllers/expenses_controller.rb @@ -15,11 +15,11 @@ end def create - Expense.expense_sheet(params[:expense][:amount]).each do |e| - expense = @user.expenses.create(:amount => e.amount, :expense_type_id => e.expense_type_id) - flash[:error] = "Oops! Someting went wrong." if !expense.save + expense = @user.expenses.build(expenses_params) + if !expense.save + flash[:error] = "Your expense must be greater than $0." end - redirect_to user_path(session[:user_id]) + redirect_to new_expense_path end def edit
Revert to old expense create method
diff --git a/app/models/google_user.rb b/app/models/google_user.rb index abc1234..def5678 100644 --- a/app/models/google_user.rb +++ b/app/models/google_user.rb @@ -9,7 +9,7 @@ current_user, google_user.user, User.joins(:twitch).find_by(twitch_users: {email: auth.info.email}), - User.new(name: auth.info.email.split('@')[0]) + User.new(name: auth.info.email.split('@')[0].remove('.')) ].compact.first unless google_user.user.save
Fix Google accounts with periods breaking signin
diff --git a/app/helpers/congress_message_helper.rb b/app/helpers/congress_message_helper.rb index abc1234..def5678 100644 --- a/app/helpers/congress_message_helper.rb +++ b/app/helpers/congress_message_helper.rb @@ -9,19 +9,18 @@ end end - def congress_forms_email_values(campaign, location = {}) + def congress_forms_email_values(campaign, location) + location ||= {} { "$NAME_FIRST": current_first_name, "$NAME_LAST": current_last_name, - "$ADDRESS_STREET": current_street_address, - "$ADDRESS_CITY": current_city, "$EMAIL": current_email, "$PHONE": current_user.try(:phone), "$SUBJECT": campaign.subject, + "$ADDRESS_STREET": location[:street] || current_street_address, + "$ADDRESS_CITY": location[:city] || current_city, "$ADDRESS_ZIP4": location[:zip4], "$ADDRESS_ZIP5": location[:zip5], - "$ADDRESS_STREET": location[:street], - "$ADDRESS_CITY": location[:city], "$STATE": location[:state] } end
Remove duplicate values from congress_forms_email_values
diff --git a/app/models/builders/section_builder.rb b/app/models/builders/section_builder.rb index abc1234..def5678 100644 --- a/app/models/builders/section_builder.rb +++ b/app/models/builders/section_builder.rb @@ -3,11 +3,11 @@ class SectionBuilder def call(manual, attrs) section_factory = SectionFactory.new(manual) - document = section_factory.call(SecureRandom.uuid, []) + section = section_factory.call(SecureRandom.uuid, []) - document.update(attrs.reverse_merge(defaults)) + section.update(attrs.reverse_merge(defaults)) - document + section end private
Rename document -> section in SectionBuilder
diff --git a/app/models/webmail/stored_mail_part.rb b/app/models/webmail/stored_mail_part.rb index abc1234..def5678 100644 --- a/app/models/webmail/stored_mail_part.rb +++ b/app/models/webmail/stored_mail_part.rb @@ -16,7 +16,7 @@ end def image? - part.main_type.upcase == 'IMAGE' + part.main_type.casecmp('IMAGE') end def link_target
[rubocop] C: Use casecmp instead of upcase ==.
diff --git a/app/presenters/tweet/html_presenter.rb b/app/presenters/tweet/html_presenter.rb index abc1234..def5678 100644 --- a/app/presenters/tweet/html_presenter.rb +++ b/app/presenters/tweet/html_presenter.rb @@ -13,7 +13,12 @@ buffer = ActiveSupport::SafeBuffer.new buffer << tweet.tweet_text + # make links anchors + buffer.gsub! /(https?[^\s]+)/o, + %q(<a href="\\1" target="_blank">\\1</a>) + # link hashtags buffer.gsub! /#(\w+)/, '<a href="http://twitter.com/search?q=%23\\1">#\\1</a>' + # link users buffer.gsub! /@(\w+)/, '<a href="http://twitter.com/\\1">@\\1</a>' buffer
Make links in tweets anchor tags
diff --git a/lib/ordinalize_full.rb b/lib/ordinalize_full.rb index abc1234..def5678 100644 --- a/lib/ordinalize_full.rb +++ b/lib/ordinalize_full.rb @@ -4,18 +4,37 @@ I18n.load_path << Dir[File.join(__dir__, "ordinalize_full/locales/*.yml")] def ordinalize(in_full: false) - if in_full - self.ordinalize_in_full - else - require "active_support/inflector" - ActiveSupport::Inflector.ordinalize(self) - end + in_full ? ordinalize_in_full : ordinalize_in_short end def ordinalize_in_full I18n.t("ordinalize_full.n_#{self}") end - alias_method :ordinalize_full, :ordinalize_in_full +private + + def ordinalize_in_short + abs_number = self.to_i.abs + + suffix = case I18n.locale + when :en + if (11..13).include?(abs_number % 100) + "th" + else + case abs_number % 10 + when 1; "st" + when 2; "nd" + when 3; "rd" + else "th" + end + end + when :fr + self == 1 ? "er" : "ème" + else + raise NotImplementedError, "Unknown locale #{I18n.locale}" + end + + [self, suffix].join + end end
Drop optional dependency on ActiveSupport
diff --git a/lib/slatan/buttocks.rb b/lib/slatan/buttocks.rb index abc1234..def5678 100644 --- a/lib/slatan/buttocks.rb +++ b/lib/slatan/buttocks.rb @@ -5,45 +5,70 @@ ## Wrapper class of Logger class Buttocks @@use_log = Spirit.use_log + + @@color = { + reset: 0, + fatal: 31, #red + error: 31, #red + warn: 33, #yellow + info: 32, #green + debug: 37 #white + } + class << self def init() if @@use_log - path = Spirit.logfile_path + path = Spirit.log_file_path @@log = Logger.new(path) - @@log.level = (case Spirit.log_level - when 'debug' - Logger::DEBUG - when 'info' - Logger::INFO - when 'warn' - Logger::WARN - when 'error' - Logger::ERROR - when 'fatal' - Logger::FATAL - end) + @@log.level = const_level(Spirit.log_level) end end def debug(msg) @@log.debug(msg) if @@use_log + stdoutput('debug', msg) end def info(msg) @@log.info(msg) if @@use_log + stdoutput('info', msg) end def warn(msg) @@log.warn(msg) if @@use_log + stdoutput('warn', msg) end def error(msg) @@log.error(msg) if @@use_log + stdoutput('error', msg) end def fatal(msg) @@log.fatal(msg) if @@use_log + stdoutput('fatal', msg) + end + + private + def const_level(level) + case level + when 'debug' + Logger::DEBUG + when 'info' + Logger::INFO + when 'warn' + Logger::WARN + when 'error' + Logger::ERROR + else + Logger::FATAL + end + end + + def stdoutput(level, msg) + puts "\e[#{@@color[level.to_sym]}m[#{level}] #{DateTime.now.strftime('%Y-%m-%d %H:%M:%S')}: #{msg}" + print "\e[#{@@color[:reset]}m" end end end
Add console output of content of logger
diff --git a/lib/teaas/overlayer.rb b/lib/teaas/overlayer.rb index abc1234..def5678 100644 --- a/lib/teaas/overlayer.rb +++ b/lib/teaas/overlayer.rb @@ -4,7 +4,7 @@ if options[:whitelisted_animation] overlay_animated_on_animated(original_img, overlay_img, options) else - overlay_animated_on_static(original_img, overlay_img) + overlay_animated_on_static(original_img, overlay_img, options={}) end end
Fix bug in static overlaying
diff --git a/lib/vagrant-vbguest.rb b/lib/vagrant-vbguest.rb index abc1234..def5678 100644 --- a/lib/vagrant-vbguest.rb +++ b/lib/vagrant-vbguest.rb @@ -11,7 +11,7 @@ Vagrant.config_keys.register(:vbguest) { VagrantVbguest::Config } [:start, :up, :reload].each do |level| - Vagrant::Action[level].use VagrantVbguest::Middleware, :run_level => level + Vagrant.actions[level].use VagrantVbguest::Middleware, :run_level => level end # Add our custom translations to the load path
Use new interface for modifying actions.
diff --git a/examples/methods/list.rb b/examples/methods/list.rb index abc1234..def5678 100644 --- a/examples/methods/list.rb +++ b/examples/methods/list.rb @@ -2,3 +2,7 @@ # Filter by amount and currency methods = Mollie::Method.all(amount: { value: '100.00', currency: 'EUR' }) + +# Retrieve all payment methods that Mollie offers and can be activated by +# the Organization. +methods = Mollie::Method.all_available
Add example to retrieve all available payment methods
diff --git a/lib/b2b_center_api/web_service/response.rb b/lib/b2b_center_api/web_service/response.rb index abc1234..def5678 100644 --- a/lib/b2b_center_api/web_service/response.rb +++ b/lib/b2b_center_api/web_service/response.rb @@ -9,7 +9,7 @@ @body = response.body @ret = @body.values[0][:return] @status = @ret.delete(:status) - if @status[:error_code] == 0 + if @status[:error_code] == '0' @result = @ret else fail B2bCenterApi::EtpError,
Fix bug error_code = '0'
diff --git a/lib/kuniri/language/ruby/end_block_ruby.rb b/lib/kuniri/language/ruby/end_block_ruby.rb index abc1234..def5678 100644 --- a/lib/kuniri/language/ruby/end_block_ruby.rb +++ b/lib/kuniri/language/ruby/end_block_ruby.rb @@ -9,13 +9,15 @@ public def has_end_of_block?(pLine) - #TODO + return detect_end(pLine) end protected def detect_end(pLine) - #TODO + #TODO: EXTREMELY SIMPLE HANDLING, IT HAVE TO BE IMPROVED! + return true if pLine =~ /^\s+end|^end/ + return false end # Class
Fix previous state bug (part 3: simple end detection)
diff --git a/lib/rubocop/cop/mixin/surrounding_space.rb b/lib/rubocop/cop/mixin/surrounding_space.rb index abc1234..def5678 100644 --- a/lib/rubocop/cop/mixin/surrounding_space.rb +++ b/lib/rubocop/cop/mixin/surrounding_space.rb @@ -22,7 +22,7 @@ def index_of_last_token(node) e = node.loc.expression.end - (0...e.column).to_a.reverse.find do |c| + (0...e.column).to_a.reverse_each do |c| ix = token_table[e.line][c] return ix if ix end
Use reverse_each instead of reverse.find Saves an Array allocation, and since the block already has a `return` statement, `#each` works just as well as `#find`.
diff --git a/Library/Formula/jython.rb b/Library/Formula/jython.rb index abc1234..def5678 100644 --- a/Library/Formula/jython.rb +++ b/Library/Formula/jython.rb @@ -1,7 +1,8 @@ require 'formula' class Jython <Formula - url 'http://downloads.sourceforge.net/project/jython/jython/2.5.1/jython_installer-2.5.1.jar' + JAR = 'jython_installer-2.5.1.jar' + url "http://downloads.sourceforge.net/project/jython/jython/2.5.1/#{JAR}" homepage 'http://www.jython.org' md5 '2ee978eff4306b23753b3fe9d7af5b37' @@ -10,6 +11,6 @@ end def install - system "java", "-jar", "jython_installer-2.5.1.jar", "-s", "-d", prefix + system "java", "-jar", JAR, "-s", "-d", prefix end end
Remove duplication of Jar name in Jython.
diff --git a/chef-zero.gemspec b/chef-zero.gemspec index abc1234..def5678 100644 --- a/chef-zero.gemspec +++ b/chef-zero.gemspec @@ -15,6 +15,7 @@ s.add_dependency 'mixlib-log', '~> 1.3' s.add_dependency 'hashie', '~> 2.0' s.add_dependency 'moneta', '< 0.7.0' # For chef, see CHEF-3721 + s.add_dependency 'json' s.add_development_dependency 'rake'
Add json to list of dependencies
diff --git a/lib/frontkick/error.rb b/lib/frontkick/error.rb index abc1234..def5678 100644 --- a/lib/frontkick/error.rb +++ b/lib/frontkick/error.rb @@ -1,4 +1,5 @@ require 'json' +require 'timeout' module Frontkick # ref. http://docs.ruby-lang.org/ja/1.9.3/class/Timeout=3a=3aError.html
Fix uninitialized constant Timeout (NameError)
diff --git a/lib/nexmo/signature.rb b/lib/nexmo/signature.rb index abc1234..def5678 100644 --- a/lib/nexmo/signature.rb +++ b/lib/nexmo/signature.rb @@ -8,10 +8,20 @@ signature = params.delete('sig') - ::JWT.secure_compare(signature, digest(params, secret)) + secure_compare(signature, digest(params, secret)) end private + + if defined?(::JWT::SecurityUtils) # ruby-jwt v2 + def self.secure_compare(left, right) + ::JWT::SecurityUtils.secure_compare(left, right) + end + else + def self.secure_compare(left, right) + ::JWT.secure_compare(left, right) + end + end def self.digest(params, secret) md5 = Digest::MD5.new
Fix Nexmo::Signature for compatibility with ruby-jwt v2 Currently raising NoMethodError: undefined method `secure_compare' because the secure_compare method has been moved into a JWT::SecurityUtils module.
diff --git a/lib/scorm_cloud/CLI.rb b/lib/scorm_cloud/CLI.rb index abc1234..def5678 100644 --- a/lib/scorm_cloud/CLI.rb +++ b/lib/scorm_cloud/CLI.rb @@ -2,7 +2,7 @@ class CLI def self.start command = ARGV.shift - secret = ENV['SCORM-CLOUD-APPID'] + appid = ENV['SCORM-CLOUD-APPID'] secret = ENV['SCORM-CLOUD-SECRET'] opts = {} while ARGV.length > 0
Fix variable name for defaulting appid from environment
diff --git a/lib/tasks/cleardb.rake b/lib/tasks/cleardb.rake index abc1234..def5678 100644 --- a/lib/tasks/cleardb.rake +++ b/lib/tasks/cleardb.rake @@ -0,0 +1,11 @@+namespace :db do + desc 'setup DATABASE_URL from CLEARDB_DATABASE_URL in .env' + task cleardb_env: :environment do + unless ENV['CLEARDB_DATABASE_URL'].nil? + cleardb_url = ENV['CLEARDB_DATABASE_URL'].gsub(/^mysql:\/\//, 'mysql2://') + dot_env = File.open(Rails.root.join(".env"), 'w') + dot_env.puts "DATABASE_URL=\"#{cleardb_url}\"" + dot_env.close + end + end +end
Add a rake task to setup DATABASE_URL for ClearDB There currently is no other way to inherit environment variables from parent apps on heroku
diff --git a/lib/twat/subcommand.rb b/lib/twat/subcommand.rb index abc1234..def5678 100644 --- a/lib/twat/subcommand.rb +++ b/lib/twat/subcommand.rb @@ -5,11 +5,17 @@ module Twat class Subcommand - # A proxy class to represend all of the possible actions that a - # command may take def self.run(argv) + # First, without commands dump user into follow mode if argv.empty? argv.insert(0, "follow_stream") + + # Failing that, in the case of invalid commands, assume they want to + # tweet something. + # TODO, fuzzy match against the contents of COMMANDS and have a sook if + # they're close to an actual command + # FIXME Potentially the absense of a space would suggest that it's just a + # fucked effort at typing elsif !Subcommands::COMMANDS.include?(argv[0]) argv.insert(0, "update") end
Document some of the insanity
diff --git a/lib/yomou/bookshelf.rb b/lib/yomou/bookshelf.rb index abc1234..def5678 100644 --- a/lib/yomou/bookshelf.rb +++ b/lib/yomou/bookshelf.rb @@ -12,6 +12,18 @@ def ncode_exist?(ncode) novels = Groonga["NarouNovels"] novels.has_key?(ncode.upcase) + end + + def ncodes_from_realpath + Dir.chdir(File.expand_path(@conf.directory)) do + `find . -maxdepth 3 -name 'n[0-9]*'`.split.each do |entry| + if entry =~ /\/(n.+)$/ + ncode = $1 + p ncode + ncodes << ncode + end + end + end end def register_ncode(ncode)
Add method to fetch ncodes from realpath
diff --git a/license_finder.gemspec b/license_finder.gemspec index abc1234..def5678 100644 --- a/license_finder.gemspec +++ b/license_finder.gemspec @@ -17,11 +17,12 @@ s.license = "MIT" s.add_dependency "bundler" - %w(rake cucumber rails pry xpath capybara).each do |gem| + s.add_development_dependency "rails", ">=3" + s.add_development_dependency "rspec", ">= 2.12.0" + + %w(rake cucumber pry nokogiri xpath capybara).each do |gem| s.add_development_dependency gem end - - s.add_development_dependency "rspec", ">= 2.12.0" s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
Revert "Try to clean up dependencies" This reverts commit 869f468c148dd4cb4d198eba8b56c2caa566fd4c. Conflicts: license_finder.gemspec
diff --git a/lib/droplet_kit/models/droplet.rb b/lib/droplet_kit/models/droplet.rb index abc1234..def5678 100644 --- a/lib/droplet_kit/models/droplet.rb +++ b/lib/droplet_kit/models/droplet.rb @@ -15,19 +15,26 @@ attribute :private_networking def public_ip - network = networks.v4.find do |network| - network.type == 'public' - end - + network = network_for(:v4, 'public') network && network.ip_address end def private_ip - network = networks.v4.find do |network| - network.type == 'private' + network = network_for(:v4, 'private') + network && network.ip_address + end + + private + + def network_for(type, publicity) + networks = case type + when :v4 then self.networks.v4 + when :v6 then self.networks.v6 + end + + networks.find do |network| + network.type == publicity end - - network && network.ip_address end end end
Refactor convenience methods to use a network_for method.
diff --git a/src/bosh-dev/lib/bosh/dev/gnatsd_manager.rb b/src/bosh-dev/lib/bosh/dev/gnatsd_manager.rb index abc1234..def5678 100644 --- a/src/bosh-dev/lib/bosh/dev/gnatsd_manager.rb +++ b/src/bosh-dev/lib/bosh/dev/gnatsd_manager.rb @@ -3,10 +3,10 @@ module Bosh::Dev class GnatsdManager - VERSION = '0.9.6-bosh.6' - DARWIN_SHA256 = '13b9ffac19e0a733f8e7e07fcd34d8738a9942d29ce5776c396adc701e29967a' - LINUX_SHA256 = '68afe5eaad377b336f9c58511be6de10d181f04ffddd8c3522c43d856a7e760b' - BUCKET_NAME = 'bosh-nats-tls' + VERSION = '0.9.6-bosh.12' + DARWIN_SHA256 = '4880812fc854e8c7691f2fa26d74cdab278e223267fa2c70204613a906ffaa1a' + LINUX_SHA256 = 'e42777ce2da188a0f7bfb07a782c40275b8144de718b40253481e03169b05066' + BUCKET_NAME = 'bosh-gnatsd' REPO_ROOT = File.expand_path('../../../../', File.dirname(__FILE__)) INSTALL_DIR = File.join('tmp', 'gnatsd')
Update gnatsd version used in tests Signed-off-by: Nader Ziada <61306b0d4f20cfca7d1222440ff271187de40866@pivotal.io>
diff --git a/spec/rspec_emoji_spec.rb b/spec/rspec_emoji_spec.rb index abc1234..def5678 100644 --- a/spec/rspec_emoji_spec.rb +++ b/spec/rspec_emoji_spec.rb @@ -0,0 +1,19 @@+describe 'my amazing tests' do + # generate many hearts! + 50.times do |i| + it "must #{i}" do + 100.should == 100 + end + end + + # generate some poops! + 2.times do |i| + it "compares #{i} to #{i + 1}" do + i.should == i + 1 + end + end + + it 'skips things!!' do + pending "don't care!" + end +end
Add a spec file to allow seeing the magical emoji!
diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb index abc1234..def5678 100644 --- a/spec/support/capybara.rb +++ b/spec/support/capybara.rb @@ -1,3 +1,8 @@ require 'capybara/poltergeist' +Capybara.register_driver :poltergeist do |app| + Capybara::Poltergeist::Driver.new(app, { phantomjs_options: ['--ssl-protocol=TLSv1'] }) +end + Capybara.javascript_driver = :poltergeist +
Fix issue with phantom JS loading assets phantomjs defaults to using SSLv3, which has now been disabled everywhere. The protocol used can be changed with an option: --ssl-protocol= Sets the SSL protocol (supported protocols: 'SSLv3' (default), 'SSLv2', 'TLSv1', 'any') This PR makes poltergeist set this option when invoking phantomjs.
diff --git a/db/migrate/20140418184518_remove_user_email_requirement.rb b/db/migrate/20140418184518_remove_user_email_requirement.rb index abc1234..def5678 100644 --- a/db/migrate/20140418184518_remove_user_email_requirement.rb +++ b/db/migrate/20140418184518_remove_user_email_requirement.rb @@ -0,0 +1,9 @@+class RemoveUserEmailRequirement < ActiveRecord::Migration + def self.up + change_column :user, :email, :string, :null => true + end + + def self.down + change_column :user, :email, :string, :default => "", :null => false + end +end
Create migration to allow null emails Omniauth authentication providers do not always return a user's email in the info hash sent back through the callback. Providers like Twitter keep that information private/hidden. User records need to be able to be saved without an email if they're using an omniauth provider.
diff --git a/Casks/gog-galaxy.rb b/Casks/gog-galaxy.rb index abc1234..def5678 100644 --- a/Casks/gog-galaxy.rb +++ b/Casks/gog-galaxy.rb @@ -1,8 +1,8 @@ cask :v1 => 'gog-galaxy' do - version '1.0.2.939' - sha256 '2c46d7aafe862bc0b2aa6b4bc95490683f8ec80f96feffb7c6f7918e2203e4e7' + version '1.0.5.11' + sha256 '1adba93ef842bff2ecf40de423abb610e215d4e40536a622e16e8d008881057b' - url "http://cdn.gog.com/open/galaxy/client/installers/galaxy_client_#{version}.pkg" + url "http://cdn.gog.com/open/galaxy/client/galaxy_client_#{version}.pkg" name 'GOG Galaxy Client' homepage 'https://www.gog.com/galaxy' license :gratis
Upgrade GOG.com Galaxy Client to v1.0.5.11
diff --git a/ext/stompede/extconf.rb b/ext/stompede/extconf.rb index abc1234..def5678 100644 --- a/ext/stompede/extconf.rb +++ b/ext/stompede/extconf.rb @@ -2,7 +2,7 @@ require "mkmf" -$CFLAGS << " -ggdb -O0 -Wextra -DDEBUG_H" # only for development +$CFLAGS << " -O3" should_build = true should_build &&= have_header "ruby.h"
Allow C-optimizations for even more C parser speed
diff --git a/hashie.gemspec b/hashie.gemspec index abc1234..def5678 100644 --- a/hashie.gemspec +++ b/hashie.gemspec @@ -17,6 +17,15 @@ gem.files += Dir['spec/**/*.rb'] gem.test_files = Dir['spec/**/*.rb'] + if gem.respond_to?(:metadata) + gem.metadata = { + 'bug_tracker_uri' => 'https://github.com/hashie/hashie/issues', + 'changelog_uri' => 'https://github.com/hashie/hashie/blob/master/CHANGELOG.md', + 'documentation_uri' => 'https://www.rubydoc.info/gems/hashie', + 'source_code_uri' => 'https://github.com/hashie/hashie' + } + end + gem.add_development_dependency 'rake', '< 11' gem.add_development_dependency 'rspec', '~> 3.0' gem.add_development_dependency 'rspec-pending_for', '~> 0.1'
Adjust URL in gemspec and add metadata URLs RubyGems.org has recently added the capability to have extra metadata URLs shown on the gem page. These are handy for people who are new to a gem or need to report an issue.
diff --git a/Artsy+Authentication.podspec b/Artsy+Authentication.podspec index abc1234..def5678 100644 --- a/Artsy+Authentication.podspec +++ b/Artsy+Authentication.podspec @@ -11,9 +11,11 @@ s.source = { :git => "https://github.com/artsy/Artsy_Authentication.git"} s.social_media_url = 'https://twitter.com/artsy' - s.platform = :tvos, '9.0' - s.platform = :ios, '7.0' - s.requires_arc = true + + s.ios.deployment_target = '7.0' + s.osx.deployment_target = '10.9' + s.watchos.deployment_target = '2.0' + s.tvos.deployment_target = '7.0' s.source_files = 'Pod/Classes' s.private_header_files = 'Pod/Classes/*Private.h'
Copy AFNetworking in the Podspec
diff --git a/pivo.gemspec b/pivo.gemspec index abc1234..def5678 100644 --- a/pivo.gemspec +++ b/pivo.gemspec @@ -21,6 +21,6 @@ spec.add_development_dependency "bundler", "~> 1.7" spec.add_development_dependency "rake", "~> 10.0" - spec.add_dependency "tracker_api" + spec.add_dependency "tracker_api", '>=0.2.9' spec.add_dependency "thor" end
Update tracker_api for bug fix
diff --git a/Library/Formula/jed.rb b/Library/Formula/jed.rb index abc1234..def5678 100644 --- a/Library/Formula/jed.rb +++ b/Library/Formula/jed.rb @@ -0,0 +1,17 @@+require 'formula' + +class Jed <Formula + url 'ftp://space.mit.edu/pub/davis/jed/v0.99/jed-0.99-19.tar.bz2' + homepage 'http://www.jedsoft.org/jed/' + md5 'c9b2f58a3defc6f61faa1ce7d6d629ea' + + depends_on 's-lang' + + def install + system "./configure", "--disable-debug", "--disable-dependency-tracking", "--prefix=#{prefix}" + system "make" + + ENV.deparallelize + system "make install" + end +end
Add a formula for the Jed editor. Signed-off-by: Adam Vandenberg <34c2b6407fd5a10249a15d699d40f9ed1782e98c@gmail.com>
diff --git a/app/controllers/cfp/proposals_controller.rb b/app/controllers/cfp/proposals_controller.rb index abc1234..def5678 100644 --- a/app/controllers/cfp/proposals_controller.rb +++ b/app/controllers/cfp/proposals_controller.rb @@ -26,7 +26,7 @@ end def update - if @proposal.update_attributes(proposal_params[:proposal]) + if @proposal.can_be_edited_by?(current_user) && @proposal.update_attributes(proposal_params[:proposal]) redirect_to :proposals, :notice => t('proposals.edited.success') else render :action => "edit" @@ -34,7 +34,7 @@ end def destroy - @proposal.destroy + @proposal.destroy if @proposal.can_be_edited_by?(current_user) redirect_to :proposals, :notice => t('proposals.deleted.success') end
Make sure that only the people that are supposed to edit and destroy proposals do so
diff --git a/app/controllers/load_profiles_controller.rb b/app/controllers/load_profiles_controller.rb index abc1234..def5678 100644 --- a/app/controllers/load_profiles_controller.rb +++ b/app/controllers/load_profiles_controller.rb @@ -14,6 +14,7 @@ # GET /load_profiles def show + respond_with(@load_profile) end # GET /load_profiles/new
Fix rendering load profile as JSON
diff --git a/app/controllers/presentations_controller.rb b/app/controllers/presentations_controller.rb index abc1234..def5678 100644 --- a/app/controllers/presentations_controller.rb +++ b/app/controllers/presentations_controller.rb @@ -2,7 +2,7 @@ skip_before_filter :auth_required, :only => [:show] before_filter :load_presentation layout 'presentation' - + def show unless can?(:edit, @presentation) || @project.presentation.published? redirect_to project_path(@project), notice: "Only event moderators and project owners can view the presentation until it has been published" @@ -12,7 +12,7 @@ def update authorize! :edit, @presentation @presentation.update_attributes(presentation_params) - + respond_to do |format| format.html {redirect_to project_presentation_path(@project)} format.json {render :show} @@ -34,7 +34,7 @@ private :load_presentation def presentation_params - params.require(:presentation).permit(:why, :what, :right, :wrong, :next_steps) + params.require(:presentation).permit(:title, :why, :what, :right, :wrong, :next_steps) end private :presentation_params end
Allow project presentation title updates Signed-off-by: Max Fierke <0706025b2bbcec1ed8d64822f4eccd96314938d0@maxfierke.com>
diff --git a/app/controllers/relationships_controller.rb b/app/controllers/relationships_controller.rb index abc1234..def5678 100644 --- a/app/controllers/relationships_controller.rb +++ b/app/controllers/relationships_controller.rb @@ -2,11 +2,13 @@ before_filter :authenticate_user! #TODO: Use ajax? - #TODO: Add conditional to make sure a contact cannot be requestd twice + #TODO: Add conditional to make sure a contact cannot be requested twice def create Relationship.pending!(current_user.partner.id, params[:student_id]) flash[:notice] = "You successfully requested contact with #{Student.find(params[:student_id]).name}." redirect_to students_path end + #TODO: Add destroy relationship + end
Add TODO in normal relationships controller
diff --git a/webpack-rails.gemspec b/webpack-rails.gemspec index abc1234..def5678 100644 --- a/webpack-rails.gemspec +++ b/webpack-rails.gemspec @@ -18,4 +18,5 @@ s.test_files = Dir["test/**/*"] s.add_dependency "rails", ">= 3.2.0" + s.required_ruby_version = '>= 2.0.0' end
Add minimum ruby version to spec
diff --git a/spec/helpers/posts_helper_spec.rb b/spec/helpers/posts_helper_spec.rb index abc1234..def5678 100644 --- a/spec/helpers/posts_helper_spec.rb +++ b/spec/helpers/posts_helper_spec.rb @@ -17,6 +17,13 @@ post_page_title(post) end end + + context "with a reshare" do + it "returns 'Reshare by...'" do + reshare = FactoryGirl.create(:reshare, author: alice.person) + expect(post_page_title(reshare)).to eq I18n.t("posts.show.reshare_by", author: reshare.author_name) + end + end end
Add spec for post_page_title for reshares
diff --git a/app/controllers/drive/application_controller.rb b/app/controllers/drive/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/drive/application_controller.rb +++ b/app/controllers/drive/application_controller.rb @@ -5,7 +5,9 @@ private def ensure_admin - render_json_error(current_user) unless current_user && current_user.admin? + render json: MultiJson.dump(create_errors_json("Invalid Access")), status: 401 + + # render_json_error(current_user) unless current_user && current_user.admin? # raise Discourse::InvalidAccess.new unless current_user.admin? end
Return correct error status for invalid access
diff --git a/Formula/mysql-connector-c.rb b/Formula/mysql-connector-c.rb index abc1234..def5678 100644 --- a/Formula/mysql-connector-c.rb +++ b/Formula/mysql-connector-c.rb @@ -3,7 +3,7 @@ class MysqlConnectorC <Formula @homepage='http://dev.mysql.com/downloads/connector/c/6.0.html' @url='http://mysql.llarian.net/Downloads/Connector-C/mysql-connector-c-6.0.2.tar.gz' - @md5='67e478df66e8f66536e54388cfa29854' + @md5='f922b778abdd25f7c1c95a8329144d56' depends_on 'cmake'
Fix md5 on MySQL Connector (C)
diff --git a/app/controllers/admin/orders_controller.rb b/app/controllers/admin/orders_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/orders_controller.rb +++ b/app/controllers/admin/orders_controller.rb @@ -7,7 +7,7 @@ def create @order_form = NewOrderForm.new(customer: customer, form_params: params[:admin_new_order_form]) - @create_order = CreateOrderService.new(user: current_user, + @create_order = ::Admin::CreateOrderService.new(user: current_user, form: @order_form).perform @edit_customer_view = Customers::EditView.new(customer) end
Fix broken tasks based on ambiguous name module Admin CreateOrderService end In test ::CreateOrderService is used sometimes instead of ::Admin::CreateOrderService (e.g. run all tests)
diff --git a/app/controllers/api/v1/dicts_controller.rb b/app/controllers/api/v1/dicts_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/v1/dicts_controller.rb +++ b/app/controllers/api/v1/dicts_controller.rb @@ -3,7 +3,7 @@ class DictsController < ApplicationController def show require "rugby-dict" - input = params[:entry] + input = params[:entry] || "" dict = RugbyDict::Dict.from_yaml names = RugbyDict::Dict.segment(input)
Add default value for dict[entry]
diff --git a/test/functional/campaign_controller_test.rb b/test/functional/campaign_controller_test.rb index abc1234..def5678 100644 --- a/test/functional/campaign_controller_test.rb +++ b/test/functional/campaign_controller_test.rb @@ -27,11 +27,13 @@ should "load the sort my tax campaign" do get :sort_my_tax - - should "load the dval new licence rules campaign" do - get :new_licence_rules assert_response :success end + should "load the dvla new licence rules campaign" do + get :new_licence_rules + assert_response :success + end + end
Test to ensure DVLA campaign page exists
diff --git a/rectangle.rb b/rectangle.rb index abc1234..def5678 100644 --- a/rectangle.rb +++ b/rectangle.rb @@ -0,0 +1,24 @@+class Rectangle + def initialize(length = 0,breath = 0) + @length = length + @breath = breath + end + + def area() + return @length*@breath + end + + def setDim(length,breath) + @length = length + @breath = breath + end + +end + +recta = Rectangle.new(20,30) +rectb = Rectangle.new +rectb.setDim(10,40) + +puts "Area is #{recta.area()}" + +puts "Area is #{rectb.area()}"
Create Rectangle class and two objects of it
diff --git a/features/pages/article.rb b/features/pages/article.rb index abc1234..def5678 100644 --- a/features/pages/article.rb +++ b/features/pages/article.rb @@ -1,6 +1,6 @@ module Pages class Article < SitePrism::Page set_url '/articles{/id}' - set_url_matcher /\/articles\/\w+/ + set_url_matcher %r{/articles/\w+} end end
Use %r for regexp matching more than 1 '/' char
diff --git a/MendeleySDK.podspec b/MendeleySDK.podspec index abc1234..def5678 100644 --- a/MendeleySDK.podspec +++ b/MendeleySDK.podspec @@ -1,11 +1,11 @@ Pod::Spec.new do |s| s.name = "MendeleySDK" - s.version = "1.1" + s.version = "1.2" s.summary = "Objective-C client for the Mendeley Open API." s.homepage = "https://github.com/shazino/MendeleySDK" s.license = 'MIT' s.author = { 'shazino' => 'contact@shazino.com' } - s.source = { :git => "https://github.com/shazino/MendeleySDK.git", :tag => '1.1' } + s.source = { :git => "https://github.com/shazino/MendeleySDK.git", :tag => '1.2' } s.source_files = 'MendeleySDK' s.requires_arc = true
Update podspec for upcoming version 1.2
diff --git a/MendeleySDK.podspec b/MendeleySDK.podspec index abc1234..def5678 100644 --- a/MendeleySDK.podspec +++ b/MendeleySDK.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = 'MendeleySDK' s.version = '2.0' - s.summary = 'Objective-C client for the Mendeley Open API.' + s.summary = 'Objective-C client for the Mendeley API.' s.homepage = 'https://github.com/shazino/MendeleySDK' s.license = 'MIT' s.author = { 'shazino' => 'contact@shazino.com' }
Update pod description (drop deprecated “Open” API)
diff --git a/SwiftLoader.podspec b/SwiftLoader.podspec index abc1234..def5678 100644 --- a/SwiftLoader.podspec +++ b/SwiftLoader.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "SwiftLoader" - s.version = "0.2.3 + s.version = "0.2.3" s.summary = "A simple and beautiful activity indicator" s.description = <<-DESC SwiftLoader is a simple and beautiful activity indicator written in Swift.
Add closing quote to version number in podspec
diff --git a/UIFontComplete.podspec b/UIFontComplete.podspec index abc1234..def5678 100644 --- a/UIFontComplete.podspec +++ b/UIFontComplete.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'UIFontComplete' - s.version = '0.1.0' + s.version = '0.1.1' s.summary = 'Make working with UIFont faster and less error-prone' s.description = <<-DESC
Raise version in podspec to 0.1.1
diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index abc1234..def5678 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -5,7 +5,7 @@ # GET / # GET /feed.atom def index - @postings = Posting.readable( current_user ? current_user.roles_mask : 1).latest(CONSTANTS['num_postings_on_welcome_page']) + @postings = Posting.readable( current_user ? current_user.roles_mask : 1).latest(CONSTANTS['num_postings_on_welcome_page']).order('updated_at asc') respond_to do |format| format.atom { @commentables = Commentable.all_commentables
Fix order on rss feed
diff --git a/core/spec/integration-real/interactors/global_features_spec.rb b/core/spec/integration-real/interactors/global_features_spec.rb index abc1234..def5678 100644 --- a/core/spec/integration-real/interactors/global_features_spec.rb +++ b/core/spec/integration-real/interactors/global_features_spec.rb @@ -3,7 +3,13 @@ describe 'global_features' do include PavlovSupport - let(:current_user) { create :user } + let(:current_user) do + OpenStruct.new( + agrees_tos: true, + admin?: true, + features: [], + ) + end it 'initial state is empty' do as(current_user) do |pavlov|
Update spec to support authorization.
diff --git a/db/migrate/20150507204849_remove_broken_profile_suggestions.rb b/db/migrate/20150507204849_remove_broken_profile_suggestions.rb index abc1234..def5678 100644 --- a/db/migrate/20150507204849_remove_broken_profile_suggestions.rb +++ b/db/migrate/20150507204849_remove_broken_profile_suggestions.rb @@ -0,0 +1,9 @@+class RemoveBrokenProfileSuggestions < ActiveRecord::Migration + def up + execute("DELETE FROM profile_suggestions WHERE suggestion_id NOT IN (SELECT id from profiles)") + end + + def down + say "this migration can't be reverted" + end +end
Add migration to remove broken profile suggestions
diff --git a/app/jobs/asset_location_update_job.rb b/app/jobs/asset_location_update_job.rb index abc1234..def5678 100644 --- a/app/jobs/asset_location_update_job.rb +++ b/app/jobs/asset_location_update_job.rb @@ -0,0 +1,18 @@+#------------------------------------------------------------------------------ +# +# AssetLocationUpdateJob +# +# Updates an assets location +# +#------------------------------------------------------------------------------ +class AssetLocationUpdateJob < AbstractAssetUpdateJob + + def execute_job(asset) + asset.update_location + end + + def prepare + Rails.logger.debug "Executing AssetLocationUpdateJob at #{Time.now.to_s} for Asset #{object_key}" + end + +end
Move asset location update job to core where it belongs
diff --git a/test/compatibility_test.rb b/test/compatibility_test.rb index abc1234..def5678 100644 --- a/test/compatibility_test.rb +++ b/test/compatibility_test.rb @@ -0,0 +1,47 @@+require File.expand_path('../test_helper', __FILE__) + +# Test ensures that values stored by previous versions of the gem will +# roundtrip and decrypt correctly in this and future versions. This is important +# for data stored in databases and allows consumers of the gem to upgrade with +# confidence in the future. +# +class CompatibilityTest < Test::Unit::TestCase + ALGORITHM = 'aes-256-cbc' + + def self.base64_encode(value) + [value].pack('m').strip + end + + def self.base64_decode(value) + value.unpack('m').first + end + + if OpenSSL::Cipher.ciphers.include?(ALGORITHM) + def test_encrypt_with_iv + key = Digest::SHA256.hexdigest('my-fixed-key') + iv = Digest::SHA256.hexdigest('my-fixed-iv') + result = Encryptor.encrypt(:algorithm => ALGORITHM, :value => 'my-fixed-input', :key => key, :iv => iv) + assert_equal 'nGuyGniksFXnMYj/eCxXKQ==', self.class.base64_encode(result) + end + + def test_encrypt_without_iv + key = Digest::SHA256.hexdigest('my-fixed-key') + result = Encryptor.encrypt(:algorithm => ALGORITHM, :value => 'my-fixed-input', :key => key) + assert_equal 'XbwHRMFWqR5M80kgwRcEEg==', self.class.base64_encode(result) + end + + def test_decrypt_with_iv + key = Digest::SHA256.hexdigest('my-fixed-key') + iv = Digest::SHA256.hexdigest('my-fixed-iv') + result = Encryptor.decrypt(:algorithm => ALGORITHM, :value => self.class.base64_decode('nGuyGniksFXnMYj/eCxXKQ=='), :key => key, :iv => iv) + assert_equal 'my-fixed-input', result + end + + def test_decrypt_without_iv + key = Digest::SHA256.hexdigest('my-fixed-key') + result = Encryptor.decrypt(:algorithm => ALGORITHM, :value => self.class.base64_decode('XbwHRMFWqR5M80kgwRcEEg=='), :key => key) + assert_equal 'my-fixed-input', result + end + end +end +
Create CompatibilityTest to ensure that new versions of gem will decrypt data stored by old versions of gem Test ensures that values stored by previous versions of the gem will roundtrip and decrypt correctly in this and future versions. This is important for data stored in databases and allows consumers of the gem to upgrade with confidence in the future.
diff --git a/lib/heroku_backup_orchestrator/email_error_reporter.rb b/lib/heroku_backup_orchestrator/email_error_reporter.rb index abc1234..def5678 100644 --- a/lib/heroku_backup_orchestrator/email_error_reporter.rb +++ b/lib/heroku_backup_orchestrator/email_error_reporter.rb @@ -11,7 +11,7 @@ } Pony.options = { :from => CONFIG['error_email'], :to => CONFIG['error_email'], - :via => 'smtp', :via_options => smtp_options, + :via => :smtp, :via_options => smtp_options, :subject => 'BACKUP ERROR' } end
Use symbol instead of String for smtp config value
diff --git a/app/controllers/repository_issues_controller.rb b/app/controllers/repository_issues_controller.rb index abc1234..def5678 100644 --- a/app/controllers/repository_issues_controller.rb +++ b/app/controllers/repository_issues_controller.rb @@ -9,15 +9,12 @@ page = params[:page].to_i page = 1 if page < 1 - @count = Issue.count - @pages = Paginator.new @count, per_page, page - - @issues = Issue.limit(per_page).offset(@pages.offset) - @issues = Change.joins(:changeset => :issues) + query = Change.joins(:changeset => :issues) .where(:path => '/' + @path, 'issues.closed_on' => nil) .order('committed_on DESC') - .limit(per_page).offset(@pages.offset) - .map(&:changeset).map(&:issues).flatten.uniq + @count = query.count + @pages = Paginator.new @count, per_page, page + @issues = query.limit(per_page).offset(@pages.offset).map(&:changeset).map(&:issues).flatten.uniq end end
Remove test code & fix pagination
diff --git a/vendor/plugins/noosfero_caching/init.rb b/vendor/plugins/noosfero_caching/init.rb index abc1234..def5678 100644 --- a/vendor/plugins/noosfero_caching/init.rb +++ b/vendor/plugins/noosfero_caching/init.rb @@ -2,6 +2,8 @@ def self.included(c) c.send(:after_filter, :noosfero_set_cache) + c.send(:before_filter, :noosfero_session_check_before) + c.send(:after_filter, :noosfero_session_check_after) end def noosfero_set_cache @@ -25,6 +27,38 @@ end end + def noosfero_session_check_before + return if params[:controller] == 'account' + headers["X-Noosfero-Auth"] = (session[:user] != nil).to_s + end + + def noosfero_session_check_after + if headers['X-Noosfero-Auth'] == 'true' + # special case: logout + if !session[:user] + session.delete + end + else + # special case: login + if session[:user] + headers['X-Noosfero-Auth'] = 'true' + end + end + end + +end + +class ActionController::CgiResponse + + def out_with_noosfero_session_check(output = $stdout) + if headers['X-Noosfero-Auth'] == 'false' + @cgi.send(:instance_variable_set, '@output_cookies', nil) + end + headers.delete('X-Noosfero-Auth') + out_without_noosfero_session_check(output) + end + alias_method_chain :out, :noosfero_session_check + end if Rails.env != 'development'
Revert "Remove Rails 2.1 handling code from noosfero HTTP caching code" This reverts commit 0fcf86d44896774ec82af0ea41ac6c61a95a3485.
diff --git a/app/models/spree/store_credit_type.rb b/app/models/spree/store_credit_type.rb index abc1234..def5678 100644 --- a/app/models/spree/store_credit_type.rb +++ b/app/models/spree/store_credit_type.rb @@ -1,6 +1,6 @@ module Spree class StoreCreditType < ActiveRecord::Base DEFAULT_TYPE_NAME = 'Promotional' - has_one :store_credit, class_name: 'Spree::StoreCredit' + has_many :store_credits, class_name: 'Spree::StoreCredit', foreign_key: 'type_id' end end
Make store credits a has many association on types
diff --git a/app/models/spree/variant_decorator.rb b/app/models/spree/variant_decorator.rb index abc1234..def5678 100644 --- a/app/models/spree/variant_decorator.rb +++ b/app/models/spree/variant_decorator.rb @@ -12,7 +12,12 @@ if Spree::Config[:track_inventory_levels] && !self.on_demand available = SpreeFishbowl.client_from_config.available_inventory(self) - available.nil? ? orig_on_hand : available + if available.nil? + orig_on_hand + else + update(:count_on_hand => available) + available + end else (1.0 / 0) # Infinity end
Update variants with count on-hand, to keep direct queries happy
diff --git a/lib/scss_helpers.rb b/lib/scss_helpers.rb index abc1234..def5678 100644 --- a/lib/scss_helpers.rb +++ b/lib/scss_helpers.rb @@ -1,7 +1,19 @@ require "scss_helpers/version" module ScssHelpers - # Your code goes here... + + def self.assets_path + Pathname.new(File.expand_path("../assets", __FILE__)) + end + + module Sprockets + + def self.add_paths(environment) + environment.append_path(ScssHelpers.assets_path.join("stylesheets")) + end + + end + end require 'scss_helpers/engine' if defined?(Rails)
Add path methods for extending a sprockets environment manually
diff --git a/gears/carto_gears_api/lib/carto_gears_api/events/base_event.rb b/gears/carto_gears_api/lib/carto_gears_api/events/base_event.rb index abc1234..def5678 100644 --- a/gears/carto_gears_api/lib/carto_gears_api/events/base_event.rb +++ b/gears/carto_gears_api/lib/carto_gears_api/events/base_event.rb @@ -1,5 +1,6 @@ module CartoGearsApi module Events + # @abstract All events must subclass this class BaseEvent end end
Mark base event as abstract (doc)
diff --git a/test/imminence_api_test.rb b/test/imminence_api_test.rb index abc1234..def5678 100644 --- a/test/imminence_api_test.rb +++ b/test/imminence_api_test.rb @@ -0,0 +1,68 @@+require "test_helper" +require "gds_api/imminence" + +class ImminenceApiTest < MiniTest::Unit::TestCase + + ROOT = "https://imminence.test.alphagov.co.uk" + + def api_client + GdsApi::Imminence.new('test') + end + + def dummy_place + { + "access_notes" => nil, + "address1" => "Cauldwell Street", + "address2" => "Bedford", + "fax" => nil, + "general_notes" => nil, + "geocode_error" => nil, + "location" => [52.1327584352089, -0.4702813074674147], + "name" => "Town Hall", + "phone" => nil, + "postcode" => "MK42 9AP", + "source_address" => "Town Hall, Cauldwell Street, Bedford", + "text_phone" => nil, + "town" => nil, + "url" => "http://www.bedford.gov.uk/advice_and_benefits/registration_service.aspx" + } + end + + def test_no_second_address_line + c = api_client + url = "#{ROOT}/places/wibble.json?limit=5&lat=52&lng=0" + place_info = dummy_place.merge "address2" => nil + c.expects(:get_json).with(url).returns([place_info]) + places = c.places("wibble", 52, 0) + + assert_equal 1, places.size + assert_equal "Cauldwell Street", places[0]["address"] + end + + def test_search_for_places + c = api_client + url = "#{ROOT}/places/wibble.json?limit=5&lat=52&lng=0" + c.expects(:get_json).with(url).returns([dummy_place]) + places = c.places("wibble", 52, 0) + + assert_equal 1, places.size + place = places[0] + assert_equal 52.1327584352089, place["latitude"] + assert_equal -0.4702813074674147, place["longitude"] + assert_equal "Cauldwell Street, Bedford", place["address"] + end + + def test_empty_location + # Test behaviour when the location field is an empty array + c = api_client + url = "#{ROOT}/places/wibble.json?limit=5&lat=52&lng=0" + place_info = dummy_place.merge("location" => []) + c.expects(:get_json).with(url).returns([place_info]) + places = c.places("wibble", 52, 0) + + assert_equal 1, places.size + place = places[0] + assert_nil place["latitude"] + assert_nil place["longitude"] + end +end
Test existing Imminence API functionality.
diff --git a/test/piwik_plugins_test.rb b/test/piwik_plugins_test.rb index abc1234..def5678 100644 --- a/test/piwik_plugins_test.rb +++ b/test/piwik_plugins_test.rb @@ -1,27 +1,25 @@ require File.expand_path('../helper', __FILE__) class PiwikPluginsTest < Service::TestCase - def setup - @stubs = Faraday::Adapter::Test::Stubs.new - end + include Service::HttpTestMethods def test_push - svc = service :push, {}, 'a' => 1 + svc = service({}, 'a' => 1) @stubs.post "/postreceive-hook" do |env| + body = JSON.parse(env[:body]) assert_equal 'plugins.piwik.org', env[:url].host - data = Faraday::Utils.parse_nested_query(env[:body]) - assert_equal 1, JSON.parse(data['payload'])['a'] + assert_equal 1, body['payload']['a'] [200, {}, ''] end - svc.receive + svc.receive_push @stubs.verify_stubbed_calls end - def service(*args) - super Service::PiwikPlugins, *args + def service_class + Service::PiwikPlugins end end
Fix failing test for PiwikPlugins hook
diff --git a/lib/vagrant/util.rb b/lib/vagrant/util.rb index abc1234..def5678 100644 --- a/lib/vagrant/util.rb +++ b/lib/vagrant/util.rb @@ -15,7 +15,7 @@ ===================================================================== Vagrant experienced an error! -#{Translator.error_string(key, data).chomp} +#{Translator.t(key, data).chomp} ===================================================================== error end
Call properly `t` method in error_and_exit
diff --git a/twist.rb b/twist.rb index abc1234..def5678 100644 --- a/twist.rb +++ b/twist.rb @@ -0,0 +1,33 @@+require 'rubygems' +require 'bundler' +require 'em-twitter' +require 'json' +require 'hipchat' + +Bundler.require + +track_keywords = ENV['TWITTER_TRACK_KEYWORDS'] + +options = { + path: '/1/statuses/filter.json', + params: { track: track_keywords }, + oauth: { + consumer_key: ENV['TWITTER_CONSUMER_KEY'], + consumer_secret: ENV['TWITTER_CONSUMER_SECRET'], + token: ENV['TWITTER_OAUTH_TOKEN'], + token_secret: ENV['TWITTER_OAUTH_SECRET'] + } +} + +EM.run do + twitter_client = EM::Twitter::Client.connect(options) + hipchat_client = HipChat::Client.new(ENV['HIPCHAT_API_TOKEN']) + + twitter_client.each do |result| + result = JSON.parse(result) + unless track_keywords.include?(result['user']['screen_name']) + status_url = "https://twitter.com/#{result['user']['screen_name']}/status/#{result['id']}" + hipchat_client[ENV['HIPCHAT_ROOM_NAME']].send(ENV['HIPCHAT_SENDER_NAME'], status_url, message_format: 'text') + end + end +end
Add twitter streaming api and hipchat message api script
diff --git a/spec/extensions/customer_extension_spec.rb b/spec/extensions/customer_extension_spec.rb index abc1234..def5678 100644 --- a/spec/extensions/customer_extension_spec.rb +++ b/spec/extensions/customer_extension_spec.rb @@ -6,6 +6,7 @@ describe "#days_since_activity" do it "returns a count of the days since the customer's last transaction" do DateTime.stub(:now => DateTime.parse("March 29, 2012")) + Date.stub(:today => Date.parse("March 29, 2012")) days_since = SalesEngine::Customer.find_by_id(1).days_since_activity days_since.should == 4
Add stub for Date in addition to DateTime (some of us used Date instead of DateTime for measuring days_since_last_activity)
diff --git a/config/initializers/disable_xml_and_json.rb b/config/initializers/disable_xml_and_json.rb index abc1234..def5678 100644 --- a/config/initializers/disable_xml_and_json.rb +++ b/config/initializers/disable_xml_and_json.rb @@ -0,0 +1,3 @@+# Per https://groups.google.com/forum/?fromgroups=#!topic/rubyonrails-security/ZOdH5GH5jCU +ActionDispatch::ParamsParser::DEFAULT_PARSERS.delete(Mime::XML) +ActionDispatch::ParamsParser::DEFAULT_PARSERS.delete(Mime::JSON)
Disable xml and json parsers per security advisory