diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/spec/requests/user/locations_spec.rb b/spec/requests/user/locations_spec.rb index abc1234..def5678 100644 --- a/spec/requests/user/locations_spec.rb +++ b/spec/requests/user/locations_spec.rb @@ -24,5 +24,26 @@ page.should have_content("Location Created") page.should have_content("Route to School") end + + context "edit" do + let!(:location) { FactoryGirl.create(:user_location, user: current_user, category: location_category) } + + it "should let you edit an existing location" do + visit user_locations_path + click_on "Edit" # hmm, edit the right one? + + page.should have_content("Edit Location") + find("#user_location_loc_json").set(location_attributes[:loc_json]) + click_on "Save" + + page.should have_content("Location Updated") + end + + it "should let you delete a location" do + visit user_locations_path + click_on "Delete" + page.should have_content("Location deleted") + end + end end end
Check for location editing and deleting too
diff --git a/app/controllers/lists_controller.rb b/app/controllers/lists_controller.rb index abc1234..def5678 100644 --- a/app/controllers/lists_controller.rb +++ b/app/controllers/lists_controller.rb @@ -9,7 +9,8 @@ end def show - respond_with({list: @list, dramas: @list.dramas}) + @dramas = @list.dramas.map { |drama| drama.add_image_url } + respond_with({list: @list, dramas: @dramas}) end def new
Add image url to dramas in lists
diff --git a/app/controllers/notes_controller.rb b/app/controllers/notes_controller.rb index abc1234..def5678 100644 --- a/app/controllers/notes_controller.rb +++ b/app/controllers/notes_controller.rb @@ -7,7 +7,7 @@ @activity_log = ActivityLogPresenter.new(ActivityLog.parse(@note)) render :create, status: :created else - render nothing: true, status: :bad_request + head :bad_request end end
Use head bad request when don't have the note description
diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index abc1234..def5678 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -1,4 +1,6 @@ class PostsController < ApplicationController + before_action :authenticate_user!, except: [:index, :show] + def index @posts = Post.all.order('created_at DESC')
Hide from non authenticated user all pages, except 'index' and 'show' posts pages
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,9 +1,13 @@ class UsersController < ApplicationController def show @user = User.find_by(id: params[:id]) - @user_expenses = @user.expenses - @all_expenses = Expense.all - @new_expense = Expense.new() + if @user.blank? || current_user.id != @user.id + redirect_to current_user + else + @user_expenses = @user.expenses + @all_expenses = Expense.all + @new_expense = Expense.new + end end def current_user_home
Fix bug: if user does not exist
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2,7 +2,7 @@ before_action :get_user, only: [:show, :update, :destroy] def show - + @questions = Question.where(user: @user) end def new @@ -16,13 +16,15 @@ session[:current_user] = @user.id redirect_to user_path(@user) else - flash[:notice] = "Bad email/password combination" + flash[:notice] = @user.errors.full_messages.to_sentence redirect_to signup_path end end def destroy + @user.destroy + redirect_to root end private @@ -32,6 +34,6 @@ end def user_params - params.require(:user).permit(:email, :password, :password_confirmation) + params.require(:user).permit(:name, :email, :password, :password_confirmation) end end
Add User Controller To Show User
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -13,7 +13,7 @@ end def index - @users = User.all + @users = User.all.sort_by(&:name) end def new
Sort users list by name
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,7 +1,17 @@ class UsersController < ApplicationController - + before_action :authenticate_user!, :set_user + def home - + if user_signed_in? + @user + else + redirect_to new_user_session_path + end end + private + + def set_user + @user = current_user + end end
Add if-else for whether user is signed in to home method, set_user method sets user
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -14,7 +14,7 @@ end def index - render json: User.all + render json: User.all.includes(:affiliations) end def update_avatar
Include affiliations when loading users.
diff --git a/google_suggest.gemspec b/google_suggest.gemspec index abc1234..def5678 100644 --- a/google_suggest.gemspec +++ b/google_suggest.gemspec @@ -2,7 +2,6 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'google_suggest/version' -require 'rake' Gem::Specification.new do |spec| spec.name = 'google_suggest' @@ -13,11 +12,11 @@ spec.email = 'satoryu.1981@gmail.com' spec.homepage = 'http://github.com/satoryu/google_suggest/' spec.license = "MIT" - spec.files = FileList[%w[ - [A-Z]* - lib/**/*.rb - spec/**/* - ]] + spec.files = Dir[ + 'lib/**/*.rb', + '[A-Z]*', + 'spec/**/*' + ] spec.add_runtime_dependency "nokogiri", '~> 1.6.0'
Use Dir instead of FileList in order to resolve the dependency on rake
diff --git a/app/controllers/budgets_controller.rb b/app/controllers/budgets_controller.rb index abc1234..def5678 100644 --- a/app/controllers/budgets_controller.rb +++ b/app/controllers/budgets_controller.rb @@ -1,5 +1,6 @@ class BudgetsController < ApplicationController include FeatureFlags + include BudgetsHelper feature_flag :budgets load_and_authorize_resource @@ -9,6 +10,7 @@ respond_to :html, :js def show + raise ActionController::RoutingError, 'Not Found' unless budget_published?(@budget) end def index
Return 404 status for non-published Budget access Why: Non-admin users shouldn't be able to access, or know of the existence of a non-published Budget. How: Raising an ActionController::RoutingError (404 error) to simulate the same behaviour as accesing a non-existing Budget. We could have used CanCanCan abilities for this but then an user could be aware of existing but not published Budgets by trying different urls
diff --git a/app/models/message_parser.rb b/app/models/message_parser.rb index abc1234..def5678 100644 --- a/app/models/message_parser.rb +++ b/app/models/message_parser.rb @@ -7,10 +7,15 @@ def recipient_name beginning = trigger_word.size remaining = text[beginning..text.size-1] - remaining.strip.split.first || "" + name = remaining.strip.split.first || "" + clean_name(name) end private attr_accessor :text, :trigger_word + + def clean_name(name) + name.gsub(/^(@+)/, "") + end end
Remove leading `@` characters from recipient name.
diff --git a/app/models/travis_project.rb b/app/models/travis_project.rb index abc1234..def5678 100644 --- a/app/models/travis_project.rb +++ b/app/models/travis_project.rb @@ -33,7 +33,7 @@ if webhooks_enabled? parsed_url else - "http://travis-ci.org/#{travis_github_account}/#{travis_repository}" + "https://travis-ci.org/#{travis_github_account}/#{travis_repository}" end end
Fix Travis CI url format
diff --git a/ci_environment/kerl/attributes/source.rb b/ci_environment/kerl/attributes/source.rb index abc1234..def5678 100644 --- a/ci_environment/kerl/attributes/source.rb +++ b/ci_environment/kerl/attributes/source.rb @@ -1,2 +1,2 @@-default[:kerl][:releases] = %w(R14B02 R14B03 R14B04 R15B R15B01 R15B02 R15B03 R16B R16B01 R16B02 R16B03 R16B03-1 17.0) +default[:kerl][:releases] = %w(R14B02 R14B03 R14B04 R15B R15B01 R15B02 R15B03 R16B R16B01 R16B02 R16B03 R16B03-1 17.0 17.1) default[:kerl][:path] = "/usr/local/bin/kerl"
Support Erlang 17.1 via kerl
diff --git a/lib/capybara/ui.rb b/lib/capybara/ui.rb index abc1234..def5678 100644 --- a/lib/capybara/ui.rb +++ b/lib/capybara/ui.rb @@ -44,6 +44,7 @@ def reload page.reload_ui + page.ui end end end
Return the new UI when reloaded from a UI instance
diff --git a/test/test_link.rb b/test/test_link.rb index abc1234..def5678 100644 --- a/test/test_link.rb +++ b/test/test_link.rb @@ -7,7 +7,7 @@ describe 'Link' do before do path = File.join( - test_configuration['source_path'], + test_configuration[:source_path], 'links', 'inspired', 'the.other.setup.yml'
Use a symbol instead of a string for the source_path key.
diff --git a/libraries/sensu.rb b/libraries/sensu.rb index abc1234..def5678 100644 --- a/libraries/sensu.rb +++ b/libraries/sensu.rb @@ -1,21 +1,16 @@ module Sensu def self.generate_config(node, databag) - address = node.has_key?(:ec2) ? node.ec2.public_ipv4 : node.ipaddress + address = node.has_key?(:cloud) ? node.cloud.public_ipv4 : node.ipaddress node_config = Mash.new( node.sensu.to_hash.reject{ |key, value| - %w(user version).include?(key) + %w(id chef_type data_bag).include?(key) } ) client_config = Mash.new( 'client' => { :name => node.name, :address => address, - :subscriptions => [ - node.roles, - node.recipes, - node.tags, - node.chef_environment - ].flatten.uniq + :subscriptions => node.roles } ) databag_config = Mash.new( @@ -32,15 +27,4 @@ ) ) end - - def self.find_bin(service) - bin_path = "/usr/bin/sensu-#{service}" - ENV['PATH'].split(':').each do |path| - test_path = File.join(path, "sensu-#{service}") - if File.exists?(test_path) - bin_path = test_path - end - end - bin_path - end end
Apply updates to sync with latest version.
diff --git a/acceptance/henson_install_spec.rb b/acceptance/henson_install_spec.rb index abc1234..def5678 100644 --- a/acceptance/henson_install_spec.rb +++ b/acceptance/henson_install_spec.rb @@ -32,7 +32,6 @@ end it "should have boxen module" do - pending "github_tarball support" expect(Pathname.new("#{project}/shared/boxen")).to be_directory end end
Remove pending from the github_tarball acceptance test
diff --git a/active_merchant.gemspec b/active_merchant.gemspec index abc1234..def5678 100644 --- a/active_merchant.gemspec +++ b/active_merchant.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |s| s.name = "active_merchant" - s.version = "1.4.2.1" - s.date = "2009-01-08" + s.version = "1.4.2.2" + s.date = "2009-01-12" s.summary = "Active Merchant is a simple payment abstraction library used in and sponsored by Shopify." s.homepage = "http://www.activemerchant.org/" s.description = "Active Merchant is a simple payment abstraction library used in and sponsored by Shopify. It is written by Tobias Luetke, Cody Fauser, and contributors. The aim of the project is to feel natural to Ruby users and to abstract as many parts as possible away from the user to offer a consistent interface across all supported gateways." @@ -10,6 +10,6 @@ "Cody Fauser" ] s.has_rdoc = true - s.files = Dir['[a-zA-Z]*'] + Dir['generators/**/*'] + Dir['lib/**/*'] + Dir['script/*'] + Dir['test/**/*'] + s.files = Dir['[a-zA-Z]*'] + Dir['generators/**/*'] + Dir['lib/**/*'] + Dir['rails/*'] + Dir['script/*'] + Dir['test/**/*'] s.test_files = Dir['test/unit/**/*.rb'] end
Add a rails/init.rb just in case.
diff --git a/lib/khipu_rails.rb b/lib/khipu_rails.rb index abc1234..def5678 100644 --- a/lib/khipu_rails.rb +++ b/lib/khipu_rails.rb @@ -1,11 +1,13 @@ module KhipuRails - extend self def configure - @config = Config.default - yield @config + yield config end - attr_accessor :config + def config + @config ||= Config.default + end + + attr_writer :config end
Refactor of the configuration to have default configuration without call to cofigure
diff --git a/lib/libxml-ruby.rb b/lib/libxml-ruby.rb index abc1234..def5678 100644 --- a/lib/libxml-ruby.rb +++ b/lib/libxml-ruby.rb @@ -4,7 +4,7 @@ begin RUBY_VERSION =~ /(\d+.\d+)/ require "#{$1}/libxml_ruby" -rescue LoadError +rescue LoadError => e require "libxml_ruby" end
Store exception to local object for easier debugging.
diff --git a/lib/nifty_alert.rb b/lib/nifty_alert.rb index abc1234..def5678 100644 --- a/lib/nifty_alert.rb +++ b/lib/nifty_alert.rb @@ -18,7 +18,7 @@ ) end rescue => error - if ENV["debug"] + if self.class.debug puts error end @@ -32,4 +32,12 @@ def self.recipients @recipients end + + def self.debug=(debug) + @debug = debug + end + + def self.debug + @debug + end end
Use class instance variable for debugging
diff --git a/lib/nyny/router.rb b/lib/nyny/router.rb index abc1234..def5678 100644 --- a/lib/nyny/router.rb +++ b/lib/nyny/router.rb @@ -23,9 +23,9 @@ def process route, env request = Request.new(env) request.params.merge! route.url_params(env) - request.params.default_proc = proc { |h, k| + request.params.default_proc = lambda do |h, k| h.fetch(k.to_s, nil) || h.fetch(k.to_sym, nil) - } + end eval_response scope_class.new(request), route.handler end
Use do/end for multiline blocks
diff --git a/lib/rails-trash.rb b/lib/rails-trash.rb index abc1234..def5678 100644 --- a/lib/rails-trash.rb +++ b/lib/rails-trash.rb @@ -34,7 +34,7 @@ self.update_attribute(:deleted_at, deleted_at) self.class.reflect_on_all_associations(:has_many).each do |reflection| if reflection.options[:dependent].eql?(:destroy) - self.send(reflection.name).each { |obj| obj.destroy_with_trash } + self.send(reflection.name).each { |obj| obj.destroy } end end end
Call standard destroy and let the plugin call the right method
diff --git a/lib/prawn_rails.rb b/lib/prawn_rails.rb index abc1234..def5678 100644 --- a/lib/prawn_rails.rb +++ b/lib/prawn_rails.rb @@ -8,7 +8,7 @@ module PrawnHelper def prawn_document(opts={}) - pdf = (opts.delete(:renderer) || Prawn::Document).new + pdf = (opts.delete(:renderer) || Prawn::Document).new(opts) yield pdf if block_given? pdf @@ -30,4 +30,4 @@ Mime::Type.register_alias "application/pdf", :pdf ActionView::Template.register_template_handler(:prawn, Prawn::Rails::TemplateHandler) -ActionView::Base.send(:include, Prawn::Rails::PrawnHelper)+ActionView::Base.send(:include, Prawn::Rails::PrawnHelper)
Fix args not being passed to constructor
diff --git a/lib/sloc/runner.rb b/lib/sloc/runner.rb index abc1234..def5678 100644 --- a/lib/sloc/runner.rb +++ b/lib/sloc/runner.rb @@ -2,7 +2,7 @@ module Sloc class Runner - def initialize(options) + def initialize(options = {}) @options = options end
Define default argument for Runner
diff --git a/lib/xcode/shell.rb b/lib/xcode/shell.rb index abc1234..def5678 100644 --- a/lib/xcode/shell.rb +++ b/lib/xcode/shell.rb @@ -1,4 +1,5 @@ require 'xcode/shell/command.rb' +require 'pty' module Xcode module Shell @@ -9,16 +10,17 @@ out = [] cmd = cmd.to_s - puts "EXECUTE: #{cmd}" if show_command - IO.popen (cmd) do |f| - f.each do |line| + PTY.spawn(cmd) do |r, w, pid| + r.sync + r.each_line do |line| puts line if show_output yield(line) if block_given? out << line end end + raise ExecutionError.new("Error (#{$?.exitstatus}) executing '#{cmd}'\n\n #{out.join(" ")}") if $?.exitstatus>0 out end end -end+end
Switch Xcode::Shell to using PTY rather than open3 to enable processing of log data delivered to stderr (required to process KIF output)
diff --git a/libs/user_utils.rb b/libs/user_utils.rb index abc1234..def5678 100644 --- a/libs/user_utils.rb +++ b/libs/user_utils.rb @@ -32,4 +32,10 @@ :username => user[:username] } end + + def is_admin(username) + entry = db[:group_users].where(username: username, group_name: 'admin').first + self.close + entry != nil + end end
Add utility to check if user is admin or not
diff --git a/spec/controllers/admin/projects_controller_spec.rb b/spec/controllers/admin/projects_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/admin/projects_controller_spec.rb +++ b/spec/controllers/admin/projects_controller_spec.rb @@ -0,0 +1,112 @@+require 'spec_helper' + +describe Admin::ProjectsController do + subject{ response } + let(:admin) { create(:user, admin: true) } + let(:current_user){ admin } + + before do + controller.stub(:current_user).and_return(current_user) + request.env['HTTP_REFERER'] = admin_projects_path + end + + describe 'PUT approve' do + let(:project) { create(:project, state: 'in_analysis') } + subject { project.online? } + + before do + put :approve, id: project, locale: :pt + end + + it do + project.reload + should be_true + end + end + + describe 'PUT reject' do + let(:project) { create(:project, state: 'in_analysis') } + subject { project.rejected? } + + before do + put :reject, id: project, locale: :pt + project.reload + end + + it { should be_true } + end + + describe 'PUT push_to_draft' do + let(:project) { create(:project, state: 'online') } + subject { project.draft? } + + before do + controller.stub(:current_user).and_return(admin) + put :push_to_draft, id: project, locale: :pt + end + + it do + project.reload + should be_true + end + end + + describe "GET index" do + context "when I'm not logged in" do + let(:current_user){ nil } + before do + get :index, locale: :pt + end + it{ should redirect_to new_user_registration_path } + end + + context "when I'm logged as admin" do + before do + get :index, locale: :pt + end + its(:status){ should == 200 } + end + end + + describe '.collection' do + let(:project) { create(:project, name: 'Project for search') } + context "when there is a match" do + before do + get :index, locale: :pt, pg_search: 'Project for search' + end + it{ assigns(:projects).should eq([project]) } + end + + context "when there is no match" do + before do + get :index, locale: :pt, pg_search: 'Foo Bar' + end + it{ assigns(:projects).should eq([]) } + end + end + + describe "DELETE destroy" do + let(:project) { create(:project, state: 'draft') } + + context "when I'm not logged in" do + let(:current_user){ nil } + before do + delete :destroy, id: project, locale: :pt + end + it{ should redirect_to new_user_registration_path } + end + + context "when I'm logged as admin" do + before do + delete :destroy, id: project, locale: :pt + end + + its(:status){ should redirect_to admin_projects_path } + + it 'should change state to deleted' do + expect(project.reload.deleted?).to be_true + end + end + end +end +
Create specs for admin/projects controller
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 @@ -4,7 +4,7 @@ Redcarpet::Markdown.new(renderer, { auto_link: true, tables: true }).render(text).html_safe end def shorten(text, max_length, cut_characters, ending_sign) - (text.length < (max_length-cut_characters) ? text : text[0,max_length].gsub(/[\s,.\-!?]+\S+$/, "")) + " " + ending_sign + (text.length < (max_length-cut_characters) ? text : text[0,max_length].gsub(/[\s,.\-!?]+\S+\z/, "")) + " " + ending_sign end def finnishTime(time)
Fix shortening to work on multiline strings
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 @@ -27,9 +27,9 @@ Resume.exists?(published: true) end - def tenant_instance_hostname(tenant) + def tenant_instance_hostname(tenant, domains_allowed = true) if multi_tenancy? - return tenant.domain if tenant.domain + return tenant.domain if tenant.domain && domains_allowed "#{tenant.subdomain}.#{request.domain}" else canonical_host
Add optional domains_allowed param to tenant_instance_hostname helper Signed-off-by: Max Fierke <0706025b2bbcec1ed8d64822f4eccd96314938d0@maxfierke.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 @@ -4,6 +4,8 @@ end def main_navigation(menu) + menu.item "Canterbury", "/by_province/Canterbury" + menu.item "York", "/by_province/York" menu.item "Create a Page", new_page_path menu.item "Manage Labels", labels_path end
Add a link to the province lists
diff --git a/Casks/fpc.rb b/Casks/fpc.rb index abc1234..def5678 100644 --- a/Casks/fpc.rb +++ b/Casks/fpc.rb @@ -4,4 +4,5 @@ version '2.6.2' sha256 '09b0964c6fb11eaa04e0fa065e479674384aab81e69e377bb1e030ec1d3398a6' install 'fpc-2.6.2rc1.intel-macosx.pkg' + uninstall :pkgutil => 'org.freepascal.freePascalCompiler262.fpcinst386.pkg' end
Add uninstall stanza to FPC
diff --git a/app/helpers/active_application/layout_helper.rb b/app/helpers/active_application/layout_helper.rb index abc1234..def5678 100644 --- a/app/helpers/active_application/layout_helper.rb +++ b/app/helpers/active_application/layout_helper.rb @@ -12,7 +12,7 @@ flash_class = key.to_s end close_button = - '<button type="button" class="close" data-dismiss="alert">&times;</a>' + '<button type="button" class="close" data-dismiss="alert">&times;</button>' html << content_tag(:div, close_button.html_safe + ' ' + msg.html_safe, class: ["alert", flash_class, "fade", "in"]
Fix button element in flash alerts
diff --git a/activesupport/lib/active_support/core_ext/date_and_time/compatibility.rb b/activesupport/lib/active_support/core_ext/date_and_time/compatibility.rb index abc1234..def5678 100644 --- a/activesupport/lib/active_support/core_ext/date_and_time/compatibility.rb +++ b/activesupport/lib/active_support/core_ext/date_and_time/compatibility.rb @@ -1,3 +1,5 @@+require 'active_support/core_ext/module/attribute_accessors' + module DateAndTime module Compatibility # If true, +to_time+ preserves the timezone offset of receiver.
Add require of mattr_accessor since Compatibility relies on it. Follow up to https://github.com/rails/rails/commit/c9c5788a527b70d7f983e2b4b47e3afd863d9f48
diff --git a/spec/higher_level_api/integration/publisher_confirms_spec.rb b/spec/higher_level_api/integration/publisher_confirms_spec.rb index abc1234..def5678 100644 --- a/spec/higher_level_api/integration/publisher_confirms_spec.rb +++ b/spec/higher_level_api/integration/publisher_confirms_spec.rb @@ -29,7 +29,8 @@ ch.next_publish_seq_no.should == 5001 ch.wait_for_confirms - + sleep 0.25 + q.message_count.should == 5000 q.purge
Insert a brief sleep to allow all messages to be confirmed before message_count is called
diff --git a/spec/models/spree/marketing/list/abandoned_cart_list_spec.rb b/spec/models/spree/marketing/list/abandoned_cart_list_spec.rb index abc1234..def5678 100644 --- a/spec/models/spree/marketing/list/abandoned_cart_list_spec.rb +++ b/spec/models/spree/marketing/list/abandoned_cart_list_spec.rb @@ -1,4 +1,4 @@-require "spec_helper" +require 'spec_helper' describe Spree::Marketing::AbandonedCartList, type: :model do @@ -7,15 +7,19 @@ let!(:registered_user_complete_order) { create(:completed_order_with_totals, user_id: second_user.id) } let!(:registered_user_incomplete_order) { create(:order, user_id: first_user.id) } - describe "methods" do - describe "#user_ids" do - context "with incomplete order" do + describe 'constants' do + it { expect(Spree::Marketing::AbandonedCartList::NAME_TEXT).to eq('Abandoned Cart') } + end + + describe 'methods' do + describe '#user_ids' do + context 'with incomplete order' do it { expect(Spree::Marketing::AbandonedCartList.new.user_ids).to include first_user.id } it { expect(Spree::Marketing::AbandonedCartList.new.user_ids).to_not include second_user.id } end - context "user is not registered" do - let!(:guest_user_incomplete_order) { create(:order, user_id: nil, email: "spree@example.com") } + context 'user is not registered' do + let!(:guest_user_incomplete_order) { create(:order, user_id: nil, email: 'spree@example.com') } it { expect(Spree::Marketing::AbandonedCartList.new.send :emails).to_not include guest_user_incomplete_order.email } it { expect(Spree::Marketing::AbandonedCartList.new.send :emails).to include registered_user_incomplete_order.email }
Fix Abandoned Cart List Spec
diff --git a/app/workers/pubsubhubbub/distribution_worker.rb b/app/workers/pubsubhubbub/distribution_worker.rb index abc1234..def5678 100644 --- a/app/workers/pubsubhubbub/distribution_worker.rb +++ b/app/workers/pubsubhubbub/distribution_worker.rb @@ -7,9 +7,12 @@ def perform(stream_entry_id) stream_entry = StreamEntry.find(stream_entry_id) - account = stream_entry.account - renderer = AccountsController.renderer.new(method: 'get', http_host: Rails.configuration.x.local_domain, https: Rails.configuration.x.use_https) - payload = renderer.render(:show, assigns: { account: account, entries: [stream_entry] }, formats: [:atom]) + + return if stream_entry.hidden? + + account = stream_entry.account + renderer = AccountsController.renderer.new(method: 'get', http_host: Rails.configuration.x.local_domain, https: Rails.configuration.x.use_https) + payload = renderer.render(:show, assigns: { account: account, entries: [stream_entry] }, formats: [:atom]) Subscription.where(account: account).active.select('id').find_each do |subscription| Pubsubhubbub::DeliveryWorker.perform_async(subscription.id, payload)
Fix accidental distribution of hidden stream entries to PuSH subscribers
diff --git a/yaks/spec/unit/yaks/configurable_spec.rb b/yaks/spec/unit/yaks/configurable_spec.rb index abc1234..def5678 100644 --- a/yaks/spec/unit/yaks/configurable_spec.rb +++ b/yaks/spec/unit/yaks/configurable_spec.rb @@ -0,0 +1,84 @@+class Kitten + include Yaks::Attributes.new(:furriness) + + def self.create(opts, &block) + level = opts[:fur_level] + level = block.call(level) if block + new(furriness: level) + end +end + +class Hanky + include Yaks::Attributes.new(:stickyness, :size, :color) + + def self.create(sticky, opts = {}) + new(stickyness: sticky, size: opts[:size], color: opts[:color]) + end +end + +RSpec.describe Yaks::Configurable do + let(:suffix) { SecureRandom.hex(16) } + subject do + eval %Q< +class TestConfigurable#{suffix} + class Config + include Yaks::Attributes.new(color: 'blue', taste: 'sour', contents: []) + end + extend Yaks::Configurable + + def_add :kitten, create: Kitten, append_to: :contents, defaults: {fur_level: 7} + def_add :cat, create: Kitten, append_to: :contents + def_add :hanky, create: Hanky, append_to: :contents, defaults: {size: 12, color: :red} +end +> + Kernel.const_get("TestConfigurable#{suffix}") + end + + describe '.extended' do + it 'should initialize an empty config object' do + expect(subject.config).to eql subject::Config.new + end + end + + describe '#def_add' do + it 'should add' do + subject.kitten(fur_level: 9) + expect(subject.config.contents).to eql [Kitten.new(furriness: 9)] + end + + it 'should use defaults if configured' do + subject.kitten + expect(subject.config.contents).to eql [Kitten.new(furriness: 7)] + end + + it 'should work without defaults configured' do + subject.cat(fur_level: 3) + expect(subject.config.contents).to eql [Kitten.new(furriness: 3)] + end + + it 'should pass on a block' do + subject.cat(fur_level: 3) {|l| l+3} + expect(subject.config.contents).to eql [Kitten.new(furriness: 6)] + end + + it 'should work with a create with positional arguments - defaults' do + subject.hanky(3) + expect(subject.config.contents).to eql [Hanky.new(stickyness: 3, size: 12, color: :red)] + end + + it 'should work with a create with positional arguments' do + subject.hanky(5, size: 15) + expect(subject.config.contents).to eql [Hanky.new(stickyness: 5, size: 15, color: :red)] + end + end + + + describe '#def_set' do + it 'should set' do + end + end + describe '#def_forward' do + it 'should forward' do + end + end +end
Add specs for Configurable.extend and Configurable.def_add
diff --git a/aws-name-to-id.rb b/aws-name-to-id.rb index abc1234..def5678 100644 --- a/aws-name-to-id.rb +++ b/aws-name-to-id.rb @@ -0,0 +1,38 @@+# Used to find group and subnet ids from their names + +begin + require 'aws-sdk' +rescue LoadError + raise 'Missing "aws-sdk" gem. Install it or use ChefDK.' +end + +group_name = ENV['AWS_SECURITY_GROUP'] || 'criteo-sre-core-testing-oss-vpc-security-group' +subnet_name = ENV['AWS_SUBNET'] || 'criteo-sre-core-testing-oss-vpc-subnet-1' +@region = ENV['AWS_REGION'] || 'us-west-2' +ec2 = Aws::EC2::Client.new(region: @region) + +group = ec2.describe_security_groups( + filters: [ + { + name: 'group-name', + values: [group_name] + } + ] +)[0][0] +raise "The group named '#{group_name}' does not exist!!!" unless group +@group_id = group.group_id + +subnet = ec2.describe_subnets( + filters: [ + { + name: 'tag:Name', + values: [subnet_name] + } + ] +)[0][0] +raise "The group named '#{subnet_name}' does not exist!!!" unless subnet +@subnet_id = subnet.subnet_id + +@availability_zone = ec2.describe_subnets( + subnet_ids: [@subnet_id] +)[0][0].availability_zone
Add lib for converting aws names to ids
diff --git a/app/admin/person.rb b/app/admin/person.rb index abc1234..def5678 100644 --- a/app/admin/person.rb +++ b/app/admin/person.rb @@ -19,7 +19,22 @@ form :as => :pg_person do |f| f.semantic_errors - f.inputs + f.inputs do + f.input :fullname + f.input :firstname + f.input :lastname + f.input :email + f.input :education + f.input :profession_category + f.input :profession + f.input :image + f.input :twitter + f.input :facebook + f.input :gender + f.input :birthdate, as: :datepicker + f.input :birthplace + f.input :phone + end f.actions end
Switch to datepicker for birthdate
diff --git a/common/model.rb b/common/model.rb index abc1234..def5678 100644 --- a/common/model.rb +++ b/common/model.rb @@ -36,11 +36,11 @@ attr_accessor :users, :channels, :servers, :messages, :roles def initialize - @users = {} - @channels = {} - @servers = {} - @messages = {} - @roles = {} + @users = [] + @channels = [] + @servers = [] + @messages = [] + @roles = [] end end end
Make the lists arrays instead of hashes, for consistency
diff --git a/lib/culqi/encryptor.rb b/lib/culqi/encryptor.rb index abc1234..def5678 100644 --- a/lib/culqi/encryptor.rb +++ b/lib/culqi/encryptor.rb @@ -8,28 +8,27 @@ end def encrypt(plaintext) - cipher = build_cipher(:encrypt) - decoded = cipher.iv + cipher.update(plaintext) + cipher.final + cipher = build_cipher(:encrypt) + cipher.iv = iv = cipher.random_iv + decoded = iv + cipher.update(plaintext) + cipher.final Base64.urlsafe_encode64(decoded) end def decrypt(encrypted) - decoded = Base64.urlsafe_decode64(encrypted) - iv = decoded.slice!(0, 16) - decipher = build_cipher(:decrypt, iv) - plaintext = decipher.update(decoded) + decipher.final + decoded = Base64.urlsafe_decode64(encrypted) + decipher = build_cipher(:decrypt) + decipher.iv = decoded.slice!(0, 16) - plaintext + decipher.update(decoded) + decipher.final end private - def build_cipher(type, iv = nil) + def build_cipher(type) cipher = OpenSSL::Cipher::AES.new(256, :CBC) cipher.send(type) cipher.key = @key - cipher.iv = iv || cipher.random_iv cipher end end
Move iv out of cipher builder
diff --git a/db/migrate/20090827081458_migration_merge_request_proposals_to_summery.rb b/db/migrate/20090827081458_migration_merge_request_proposals_to_summery.rb index abc1234..def5678 100644 --- a/db/migrate/20090827081458_migration_merge_request_proposals_to_summery.rb +++ b/db/migrate/20090827081458_migration_merge_request_proposals_to_summery.rb @@ -0,0 +1,22 @@+# encoding: utf-8 + +class MigrationMergeRequestProposalsToSummery < ActiveRecord::Migration + def self.up + transaction do + MergeRequest.all.each do |mr| + if mr.proposal.blank? + mr.summary = "..." + mr.save! + next + end + mr.summary = mr.proposal.encode("utf-8", + :undef => :replace, :invalid => :replace, :replace => "?")[0..75] + mr.summary << '...' if mr.proposal.length > 75 + mr.save! + end + end + end + + def self.down + end +end
Add migration to migrate existing merge request proposals into summaries
diff --git a/db/migrate/20161104135655_add_epix_user_fields_to_annual_report_upload.rb b/db/migrate/20161104135655_add_epix_user_fields_to_annual_report_upload.rb index abc1234..def5678 100644 --- a/db/migrate/20161104135655_add_epix_user_fields_to_annual_report_upload.rb +++ b/db/migrate/20161104135655_add_epix_user_fields_to_annual_report_upload.rb @@ -0,0 +1,9 @@+class AddEpixUserFieldsToAnnualReportUpload < ActiveRecord::Migration + def change + add_column :trade_annual_report_uploads, :epix_created_by_id, :integer + add_column :trade_annual_report_uploads, :epix_created_at, :integer + add_column :trade_annual_report_uploads, :epix_updated_by_id, :integer + add_column :trade_annual_report_uploads, :epix_updated_at, :integer + remove_column :trade_annual_report_uploads, :is_from_epix + end +end
Add epix user fields for annual_report_uploads
diff --git a/plugins/providers/virtualbox/action/destroy_unused_network_interfaces.rb b/plugins/providers/virtualbox/action/destroy_unused_network_interfaces.rb index abc1234..def5678 100644 --- a/plugins/providers/virtualbox/action/destroy_unused_network_interfaces.rb +++ b/plugins/providers/virtualbox/action/destroy_unused_network_interfaces.rb @@ -13,8 +13,8 @@ if env[:machine].provider_config.destroy_unused_network_interfaces @logger.info("Destroying unused network interfaces...") env[:machine].provider.driver.delete_unused_host_only_networks - @app.call(env) end + @app.call(env) end end end
Call the rest of the middleware stack all the time.
diff --git a/stevedore.gemspec b/stevedore.gemspec index abc1234..def5678 100644 --- a/stevedore.gemspec +++ b/stevedore.gemspec @@ -8,8 +8,10 @@ s.licenses = ['MIT'] s.authors = ['M Innovations'] s.email = ['contact@minnovations.sg'] - s.summary = 'Stevedore' - s.description = 'Stevedore' + s.homepage = 'https://github.com/minnovations/stevedore' + s.summary = 'Containerized app development workflow helper' + s.description = 'Stevedore is a handy helper to make developing and deploying apps with Docker +containers a little easier.' s.required_ruby_version = '>= 2.0.0'
Include Gemspec homepage, summary and description
diff --git a/lib/invenio/git_hub.rb b/lib/invenio/git_hub.rb index abc1234..def5678 100644 --- a/lib/invenio/git_hub.rb +++ b/lib/invenio/git_hub.rb @@ -1,4 +1,10 @@ module Invenio module GitHub + + REPO = "dailydiscovery/dailydiscovery" + + LOGIN = "expiscor" + + ACCESS_TOKEN = ENV["EXPISCOR_ACCESS_TOKEN"] end end
Add repo, organization member and member access token as constants
diff --git a/test/filters/test_rdiscount.rb b/test/filters/test_rdiscount.rb index abc1234..def5678 100644 --- a/test/filters/test_rdiscount.rb +++ b/test/filters/test_rdiscount.rb @@ -10,16 +10,17 @@ end end - def test_with_extensions - if_have 'rdiscount' do - # Create filter - filter = ::Nanoc::Filters::RDiscount.new - - # Run filter - input = "The quotation 'marks' sure make this look sarcastic!" - output_expected = /The quotation &lsquo;marks&rsquo; sure make this look sarcastic!/ - output_actual = filter.setup_and_run(input, extensions: [:smart]) - assert_match(output_expected, output_actual) - end - end + # FIXME: Re-enable this test (flaky; quotation marks are not transformed consistently) + # def test_with_extensions + # if_have 'rdiscount' do + # # Create filter + # filter = ::Nanoc::Filters::RDiscount.new + # + # # Run filter + # input = "The quotation 'marks' sure make this look sarcastic!" + # output_expected = /The quotation &lsquo;marks&rsquo; sure make this look sarcastic!/ + # output_actual = filter.setup_and_run(input, extensions: [:smart]) + # assert_match(output_expected, output_actual) + # end + # end end
Disable RDiscount extension test (flaky)
diff --git a/lib/provider/github.rb b/lib/provider/github.rb index abc1234..def5678 100644 --- a/lib/provider/github.rb +++ b/lib/provider/github.rb @@ -12,28 +12,23 @@ TaskMapper.new(:github, auth) end + def provider + TaskMapper::Provider::Github + end + + def new_github_client(auth) + Octokit::Client.new auth + end + # declare needed overloaded methods here def authorize(auth = {}) - @authentication ||= TaskMapper::Authenticator.new(auth) - auth = @authentication - $D = auth - login = auth.login || auth.username - if auth.login.blank? and auth.username.blank? - raise TaskMapper::Exception.new('Please provide at least a username') - elsif auth.password - TaskMapper::Provider::Github.login = login - TaskMapper::Provider::Github.user_token = auth.token - TaskMapper::Provider::Github.api = Octokit::Client.new(:login => login, :password => auth.password) - elsif auth.oauth_token - TaskMapper::Provider::Github.login = login - TaskMapper::Provider::Github.user_token = auth.oauth_token - TaskMapper::Provider::Github.api = Octokit::Client.new(:login => login, :oauth_token => auth.oauth_token) - else - TaskMapper::Provider::Github.login = login - TaskMapper::Provider::Github.user_token = nil - TaskMapper::Provider::Github.api = Octokit::Client.new(:login => login) - end + auth[:login] = auth[:login] || auth[:username] + raise TaskMapper::Exception.new('Please provide at least a username') if auth[:login].blank? + provider.login = auth[:login] + provider.user_token = auth[:password] || auth[:oauth_token] + provider.api = new_github_client auth end + def valid? TaskMapper::Provider::Github.api.authenticated? || TaskMapper::Provider::Github.api.oauthed?
Refactor Use auth hash directly. Extract method to remove repeated code.
diff --git a/buildserver/cookbooks/fdroidbuild-general/recipes/default.rb b/buildserver/cookbooks/fdroidbuild-general/recipes/default.rb index abc1234..def5678 100644 --- a/buildserver/cookbooks/fdroidbuild-general/recipes/default.rb +++ b/buildserver/cookbooks/fdroidbuild-general/recipes/default.rb @@ -1,5 +1,5 @@ -%w{ant ant-contrib autoconf bison libtool libssl1.0.0 libssl-dev maven javacc python git-core mercurial subversion bzr git-svn make perlmagick pkg-config zip ruby rubygems librmagick-ruby}.each do |pkg| +%w{ant ant-contrib autoconf autopoint bison libtool libssl1.0.0 libssl-dev maven javacc python git-core mercurial subversion bzr git-svn make perlmagick pkg-config zip ruby rubygems librmagick-ruby}.each do |pkg| package pkg do action :install end
Add autopoint to build server
diff --git a/lib/tasks/rubocop.rake b/lib/tasks/rubocop.rake index abc1234..def5678 100644 --- a/lib/tasks/rubocop.rake +++ b/lib/tasks/rubocop.rake @@ -1,3 +1,9 @@-require 'rubocop/rake_task' - -RuboCop::RakeTask.new +begin + require 'rubocop/rake_task' + RuboCop::RakeTask.new +rescue LoadError + desc 'Disabled as RuboCop gem is unavailable' + task :rubocop do + raise 'Disabled as RuboCop gem is unavailable' + end +end
Disable Rubocop task when Rubocop gem is unavailable to fix issue in production Signed-off-by: Theo Cushion <9391e8fee6b4bb857269a4f82fb270f1b8927974@pivotal.io>
diff --git a/lib/terrible_apples.rb b/lib/terrible_apples.rb index abc1234..def5678 100644 --- a/lib/terrible_apples.rb +++ b/lib/terrible_apples.rb @@ -10,4 +10,24 @@ end end end + + def ick + if true + unless false + if true && true + unless not false && false + if true + unless false + if true && true + unless not false && false + puts "what!" + end + end + end + end + end + end + end + end + end end
Make things a lot worse
diff --git a/compatibility-kit/ruby/features/parameter-types/parameter-types_steps.rb b/compatibility-kit/ruby/features/parameter-types/parameter-types_steps.rb index abc1234..def5678 100644 --- a/compatibility-kit/ruby/features/parameter-types/parameter-types_steps.rb +++ b/compatibility-kit/ruby/features/parameter-types/parameter-types_steps.rb @@ -18,3 +18,7 @@ expect(flight.to).to eq('CDG') expect(delay).to eq(45) end + +Given('{airport} is closed because of a strike') do |airport| + raise StandardError, 'Should not be called because airport type not defined' +end
Implement step raising an UndefinedParameterType error
diff --git a/spec/cmd_domain_spec.rb b/spec/cmd_domain_spec.rb index abc1234..def5678 100644 --- a/spec/cmd_domain_spec.rb +++ b/spec/cmd_domain_spec.rb @@ -14,7 +14,7 @@ expect(status.exitstatus).to eq(0) end after(:example) do - out, err, status = Open3.capture3(capcmd('murano', 'solution', 'delete', @project_name)) + out, err, status = Open3.capture3(capcmd('murano', 'solution', 'delete', @product_name)) expect(out).to eq('') expect(err).to eq('') expect(status.exitstatus).to eq(0) @@ -22,7 +22,12 @@ it "show domain" do out, err, status = Open3.capture3(capcmd('murano', 'domain')) - expect(out.chomp).to start_with("#{@project_name.downcase}.apps.exosite").and end_with(".io") + # 2017-05-31: Previously, the project could be named whatever and + # the URI would start with the same. + # expect(out.chomp).to start_with("#{@product_name.downcase}.apps.exosite").and end_with(".io") + # Now, it's: <ID>.m2.exosite.io, where ID is of the form, "j41fj45hhk82so0os" + expect(out.split('.', 2)[0]).to match(/^[a-zA-Z0-9]{17}$/) + expect(out.chomp).to end_with("m2.exosite.io") expect(err).to eq('') expect(status.exitstatus).to eq(0) end
Update 'murano domain' check per last week's changes.
diff --git a/spec/es-reindex_spec.rb b/spec/es-reindex_spec.rb index abc1234..def5678 100644 --- a/spec/es-reindex_spec.rb +++ b/spec/es-reindex_spec.rb @@ -19,7 +19,7 @@ after { reindexer.copy! } before do - %i{ + %w{ confirm clear_destination create_destination copy_docs check_docs }.each { |meth| reindexer.stub(meth).and_return true } end
Use strings instead of symbols since Ruby 193 doesn't like %i
diff --git a/app/exporters/formatters/abstract_document_publication_alert_formatter.rb b/app/exporters/formatters/abstract_document_publication_alert_formatter.rb index abc1234..def5678 100644 --- a/app/exporters/formatters/abstract_document_publication_alert_formatter.rb +++ b/app/exporters/formatters/abstract_document_publication_alert_formatter.rb @@ -23,7 +23,8 @@ def body view_renderer.render( - template: "email_alerts/publication.html", + template: "email_alerts/publication", + formats: ["html"], locals: { human_document_type: name, document_noun: document_noun,
Update call to render to new syntax This deprecation warning was turning up about 100 times during the cucumber tests. `DEPRECATION WARNING: Passing the format in the template name is deprecated. Please pass render with :formats => [:html] instead. (called from body at /var/govuk/specialist-publisher/app/exporters/formatters/abstract_docume nt_publication_alert_formatter.rb:25)` So I did what it said.
diff --git a/modsulator.gemspec b/modsulator.gemspec index abc1234..def5678 100644 --- a/modsulator.gemspec +++ b/modsulator.gemspec @@ -13,6 +13,11 @@ s.executables << 'modsulator' s.add_dependency 'roo', '>= 1.1' - s.add_dependency 'rspec', '>= 3.0' + s.add_dependency 'equivalent-xml' + s.add_dependency 'nokogiri' s.add_dependency 'activesupport', '>= 3.0' # For ActiveSupport::HashWithIndifferentAccess + + s.add_development_dependency 'rake' + s.add_development_dependency 'rspec', '>= 3.0' + s.add_development_dependency 'yard' end
Update gemspec to match actual dependencies
diff --git a/config/initializers/repositories.rb b/config/initializers/repositories.rb index abc1234..def5678 100644 --- a/config/initializers/repositories.rb +++ b/config/initializers/repositories.rb @@ -43,13 +43,6 @@ branch "gh-pages" open? true end - - repository :rotations do - title "Rotations" - description "Our server rotation files" - repo "Rotations" - open? true - end end end end
Remove rotations repository from revisions
diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb index abc1234..def5678 100644 --- a/config/initializers/secret_token.rb +++ b/config/initializers/secret_token.rb @@ -9,4 +9,4 @@ # Make sure your secret_key_base is kept private # if you're sharing your code publicly. -SchemeFinderFrontend::Application.config.secret_key_base = 'f8a14991a276e1e8e70925031c5d13826838b8b7f7d4df47b36ca7f7c66d22a6be0e88cdf66f68e0c44931c7401bf301f1162066fb3d618f26eebb0ad854976c' +SchemeFinderFrontend::Application.config.secret_key_base = ENV['COOKIE_SECRET_KEY'] || 'development'
Use cookie secret key from ENV
diff --git a/spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb b/spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb index abc1234..def5678 100644 --- a/spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb +++ b/spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb @@ -0,0 +1,27 @@+require 'spec_helper' + +feature 'Projects > Members > Master adds member with expiration date', feature: true, js: true do + include Select2Helper + + let!(:master) { create(:user) } + let!(:project) { create(:project) } + let!(:new_member) { create(:user) } + + background do + project.team << [master, :master] + login_as(master) + visit namespace_project_project_members_path(project.namespace, project) + end + + scenario 'expiration date is displayed in the members list' do + page.within ".users-project-form" do + select2(new_member.id, from: "#user_ids", multiple: true) + fill_in "Access expiration date", with: "2016-08-02" + click_on "Add users to project" + end + + page.within ".project_member:first-child" do + expect(page).to have_content("Access expires Aug 2, 2016") + end + end +end
Add test for a member with the expiration date.
diff --git a/Framezilla.podspec b/Framezilla.podspec index abc1234..def5678 100644 --- a/Framezilla.podspec +++ b/Framezilla.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |spec| spec.name = "Framezilla" - spec.version = "2.5.0" + spec.version = "2.7.0" spec.summary = "Comfortable syntax for working with frames." spec.homepage = "https://github.com/Otbivnoe/Framezilla"
Change the podspec version -> 2.7.0
diff --git a/test.rb b/test.rb index abc1234..def5678 100644 --- a/test.rb +++ b/test.rb @@ -7,20 +7,21 @@ attach_function :gtk_init, [:pointer, :pointer], :void attach_function :gtk_main, [], :void - enum :GtkWindowType, [:GTK_WINDOW_TOPLEVEL, :GTK_WINDOW_POPUP] - attach_function :gtk_window_new, [:GtkWindowType], :pointer - attach_function :gtk_widget_show, [:pointer], :pointer - def self.init gtk_init nil, nil end class Window + extend FFI::Library + enum :GtkWindowType, [:GTK_WINDOW_TOPLEVEL, :GTK_WINDOW_POPUP] + attach_function :gtk_window_new, [:GtkWindowType], :pointer + attach_function :gtk_widget_show, [:pointer], :pointer + def initialize type - @gobj = Gtk.gtk_window_new(type) + @gobj = gtk_window_new(type) end def show - Gtk.gtk_widget_show(@gobj) + gtk_widget_show(@gobj) end end end
Move window functions into Window
diff --git a/mixlib-cli.gemspec b/mixlib-cli.gemspec index abc1234..def5678 100644 --- a/mixlib-cli.gemspec +++ b/mixlib-cli.gemspec @@ -20,6 +20,7 @@ s.add_development_dependency 'rdoc' s.require_path = 'lib' - s.files = %w(LICENSE README.rdoc Gemfile Rakefile NOTICE) + Dir.glob("{lib,spec}/**/*") + s.files = %w(LICENSE README.rdoc Gemfile Rakefile NOTICE) + Dir.glob("*.gemspec") + + Dir.glob("{lib,spec}/**/*", File::FNM_DOTMATCH).reject {|f| File.directory?(f) } end
Add gemspec files to allow bundler to run from the gem
diff --git a/features/step_definitions/debug_steps.rb b/features/step_definitions/debug_steps.rb index abc1234..def5678 100644 --- a/features/step_definitions/debug_steps.rb +++ b/features/step_definitions/debug_steps.rb @@ -15,3 +15,7 @@ page.save_screenshot(path) puts("screenshot saved to #{path}") end + +When(/^I wait (.*?) seconds$/) do |seconds| + sleep(seconds.to_i) +end
Add a wait debug step to cucumber I sometimes find this useful to rule out timing issues
diff --git a/Formula/gdb.rb b/Formula/gdb.rb index abc1234..def5678 100644 --- a/Formula/gdb.rb +++ b/Formula/gdb.rb @@ -3,6 +3,7 @@ class Gdb < Formula homepage 'http://www.gnu.org/software/gdb/' url 'http://ftpmirror.gnu.org/gdb/gdb-7.3.1.tar.bz2' + mirror 'http://ftp.gnu.org/gnu/gdb/gdb-7.3.1.tar.bz2' md5 'b89a5fac359c618dda97b88645ceab47' depends_on 'readline'
Add mirrors to GNU formulae Signed-off-by: Jack Nagel <43386ce32af96f5c56f2a88e458cb94cebee3751@gmail.com>
diff --git a/benchmarks/actor.rb b/benchmarks/actor.rb index abc1234..def5678 100644 --- a/benchmarks/actor.rb +++ b/benchmarks/actor.rb @@ -2,12 +2,25 @@ require 'rubygems' require 'bundler/setup' -require 'celluloid/io' +require 'celluloid' require 'benchmark/ips' class ExampleActor include Celluloid::IO + + def initialize + @condition = Condition.new + end + def example_method; end + + def finished + @condition.signal + end + + def wait_until_finished + @condition.wait + end end example_actor = ExampleActor.new @@ -24,11 +37,18 @@ Benchmark.ips do |ips| ips.report("spawn") { ExampleActor.new.terminate } + ips.report("calls") { example_actor.example_method } - - # FIXME: deadlock?! o_O - ips.report("async calls") { example_actor.example_method! } unless RUBY_ENGINE == 'ruby' - + + ips.report("async calls") do |n| + waiter = example_actor.future.wait_until_finished + + for i in 1..n; example_actor.async.example_method; end + example_actor.async.finished + + waiter.value + end + ips.report("messages") do |n| latch_in << n for i in 0..n; mailbox << :message; end
Fix usage of legacy async syntax in benchmarks
diff --git a/tasks/native.rake b/tasks/native.rake index abc1234..def5678 100644 --- a/tasks/native.rake +++ b/tasks/native.rake @@ -12,7 +12,7 @@ end ext.cross_compile = true - ext.cross_platform = 'i386-mswin32' + ext.cross_platform = ['i386-mswin32', 'i386-mingw32'] ext.cross_config_options << "--with-sqlite3-dir=#{sqlite3_lib}" end
Build both mswin32 and mingw32 gems Taking advantage of rake-compiler 0.5.0, now is possible. Please note that some tweaks still are required to rake-compiler to be bullet-proof on this area.
diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index abc1234..def5678 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,4 +1,4 @@ # Be sure to restart your server when you modify this file. # Configure sensitive parameters which will be filtered from the log file. -Rails.application.config.filter_parameters += [:password, :password_confirmation] +Rails.application.config.filter_parameters += [:password, :password_confirmation, :session, :warden, :secret, :salt, :cookie, :csrf, :api_key, :pw, :secret]
Add categories to be filtered
diff --git a/Library/Homebrew/tap_constants.rb b/Library/Homebrew/tap_constants.rb index abc1234..def5678 100644 --- a/Library/Homebrew/tap_constants.rb +++ b/Library/Homebrew/tap_constants.rb @@ -5,6 +5,6 @@ # match taps' directory paths, e.g. HOMEBREW_LIBRARY/Taps/someuser/sometap HOMEBREW_TAP_DIR_REGEX = %r{#{Regexp.escape(HOMEBREW_LIBRARY)}/Taps/(?<user>[\w-]+)/(?<repo>[\w-]+)} # match taps' formula paths, e.g. HOMEBREW_LIBRARY/Taps/someuser/sometap/someformula -HOMEBREW_TAP_PATH_REGEX = Regexp.new(HOMEBREW_TAP_DIR_REGEX.source + %r{/(.*)}.source) +HOMEBREW_TAP_PATH_REGEX = Regexp.new(HOMEBREW_TAP_DIR_REGEX.source + %r{(?:/.*)?$}.source) # match official taps' casks, e.g. homebrew/cask/somecask or homebrew/cask-versions/somecask HOMEBREW_CASK_TAP_CASK_REGEX = %r{^(?:([Cc]askroom)/(cask|versions)|(homebrew)/(cask|cask-[\w-]+))/([\w+-.]+)$}
Make `HOMEBREW_TAP_PATH_REGEX` also match exact path.
diff --git a/unchanged_validator.gemspec b/unchanged_validator.gemspec index abc1234..def5678 100644 --- a/unchanged_validator.gemspec +++ b/unchanged_validator.gemspec @@ -21,6 +21,7 @@ spec.add_runtime_dependency "activemodel", ">= 3.1" spec.add_development_dependency "activesupport", ">= 3.1" + spec.add_development_dependency "appraisal", "~> 1.0" spec.add_development_dependency "bundler", "~> 1.6" spec.add_development_dependency "rake", "~> 10.0" spec.add_development_dependency "rspec", "~> 3.1"
Add development dependency on appraisal (~> 1.0)
diff --git a/vmdb/lib/tasks/test.rake b/vmdb/lib/tasks/test.rake index abc1234..def5678 100644 --- a/vmdb/lib/tasks/test.rake +++ b/vmdb/lib/tasks/test.rake @@ -11,6 +11,7 @@ end task :setup_db => :initialize do + puts "** Preparing database" Rake::Task['evm:db:reset'].invoke end end
Add logging for Cruise Control Builds before preparing the database [skip ci]
diff --git a/db/migrate/20121201194057_add_pull_request_counter_cache_column_to_users.rb b/db/migrate/20121201194057_add_pull_request_counter_cache_column_to_users.rb index abc1234..def5678 100644 --- a/db/migrate/20121201194057_add_pull_request_counter_cache_column_to_users.rb +++ b/db/migrate/20121201194057_add_pull_request_counter_cache_column_to_users.rb @@ -0,0 +1,10 @@+class AddPullRequestCounterCacheColumnToUsers < ActiveRecord::Migration + def change + add_column :users, :pull_requests_count, :integer, default: 0 + + User.reset_column_information + User.all.each do |p| + User.update_counters p.id, :pull_requests_count => p.pull_requests.count + end + end +end
Add counter cache column for pull requests.
diff --git a/app/controllers/teachers/progress_reports/standards/topic_students_controller.rb b/app/controllers/teachers/progress_reports/standards/topic_students_controller.rb index abc1234..def5678 100644 --- a/app/controllers/teachers/progress_reports/standards/topic_students_controller.rb +++ b/app/controllers/teachers/progress_reports/standards/topic_students_controller.rb @@ -17,7 +17,7 @@ serializer.classroom_id = params[:classroom_id] serializer.as_json(root: false) end - selected_classroom = params[:classroom_id] == 0 ? 'All Classrooms' : Classroom.find_by(id: params[:classroom_id]) + selected_classroom = params[:classroom_id] == 0 ? 'All Classrooms' : current_user.classrooms_i_teach.find(params[:classroom_id]) render json: { selected_classroom: selected_classroom, classrooms: current_user.classrooms_i_teach,
Fix security hole in Teachers::ProgressReports::Standards::TopicStudentsController
diff --git a/lib/wolfram.rb b/lib/wolfram.rb index abc1234..def5678 100644 --- a/lib/wolfram.rb +++ b/lib/wolfram.rb @@ -10,8 +10,17 @@ url = "http://api.wolframalpha.com/v2/query?appid=XR5V85-RTLWAEKWEQ&input=#{URI::encode(query).gsub('=','%3D').gsub('+','%2B').gsub(',','%2C')}&format=image" raw_response = Hash.from_xml(open(url).read) raw_response["queryresult"]["pod"].each do |pod| - hash[pod["title"].downcase.tr(' ', '_')] = pod["subpod"]["img"]["src"] + if pod["subpod"].count > 2 + images = [] + pod["subpod"].each do |subpod| + images.push(subpod["img"]["src"]) + end + hash[pod["title"].downcase.tr(' ', '_')] = images + images = [] + else + hash[pod["title"].downcase.tr(' ', '_')] = pod["subpod"]["img"]["src"] + end end response = OpenStruct.new(hash) end -end +end
Fix error when respond has more than 1 subpod
diff --git a/AnimatedTextInput.podspec b/AnimatedTextInput.podspec index abc1234..def5678 100644 --- a/AnimatedTextInput.podspec +++ b/AnimatedTextInput.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'AnimatedTextInput' - s.version = '0.3.2' + s.version = '0.3.3' s.summary = 'UITextField and UITextView replacement with animated hint and error message support. Highly customizable. Used in Jobandtalent iOS app' s.description = <<-DESC
Update pod version to 0.3.3
diff --git a/lib/metrics/trello/idle_hours_average.rb b/lib/metrics/trello/idle_hours_average.rb index abc1234..def5678 100644 --- a/lib/metrics/trello/idle_hours_average.rb +++ b/lib/metrics/trello/idle_hours_average.rb @@ -0,0 +1,26 @@+ProviderRepo.find!(:trello).register_metric :idle_hours_average do |metric| + metric.description = "Average time each card has been idle measured in hours" + metric.title = "Card Average Age" + + metric.block = proc do |adapter, options| + now_utc = Time.current.utc + list_ids = Array(options[:list_ids]) + cards = adapter.cards(list_ids) + + sum = cards.map { |card| now_utc - card.last_activity_date }.sum + value = sum.zero? ? sum : sum / (1.hour * cards.count) + + Datapoint.new value: value.to_i + end + + metric.configuration = proc do |client, params| + list_ids = Array(params["list_ids"]) + [ + [:list_ids, select_tag("goal[params][list_ids]", + options_for_select(client.list_options, + selected: list_ids), + multiple: true, + class: "form-control")] + ] + end +end
Add average card age metric to trello
diff --git a/_plugins/post-commit-history-hook.rb b/_plugins/post-commit-history-hook.rb index abc1234..def5678 100644 --- a/_plugins/post-commit-history-hook.rb +++ b/_plugins/post-commit-history-hook.rb @@ -3,20 +3,22 @@ require 'uri' Jekyll::Hooks.register :posts, :pre_render do |post| - language = post.site.config['lang'] + language = post.site.config['lang'] - repository_name = case language - when /^en/ then "articles" - when /^es/ then "articles-es" - when /^fr/ then "articles-fr" - when /^ko/ then "articles-ko" - when /^zh-Hans/ then "articles-zh-Hans" - when /^ru/ then "articles-ru" - else - raise "Unknown language: #{language}" - end + repository_name = case language + when /^en/ then 'articles' + when /^es/ then 'articles-es' + when /^fr/ then 'articles-fr' + when /^ko/ then 'articles-ko' + when /^zh-Hans/ then 'articles-zh-Hans' + when /^ru/ then 'articles-ru' + when nil + raise 'Unspecified language in site configuration' + else + raise "Unknown language: #{language}" + end - filename = File.basename(post.path) + filename = File.basename(post.path) - post.data['commit_history_url'] = "https://github.com/nshipster/#{repository_name}/commits/master/#{filename}" + post.data['commit_history_url'] = "https://github.com/nshipster/#{repository_name}/commits/master/#{filename}" end
Add warning when configuration doesn't specify language
diff --git a/docs/_plugins/hightlight_as_toml.rb b/docs/_plugins/hightlight_as_toml.rb index abc1234..def5678 100644 --- a/docs/_plugins/hightlight_as_toml.rb +++ b/docs/_plugins/hightlight_as_toml.rb @@ -0,0 +1,41 @@+require "jekyll/tags/highlight" +require "open3" + +module Jekyll + class HighlightAsTomlBlock < Jekyll::Tags::HighlightBlock + + def initialize(tag_name, markup, tokens) + @highlighttoml = Liquid::Template.parse("{% highlight0 toml %}{{toml}}{% endhighlight0 %}") + @highlightjson = Liquid::Template.parse("{% highlight0 json %}{{json}}{% endhighlight0 %}") + super(tag_name, markup, tokens) + @lang = 'toml' if @lang == 'json' + end + + def render(context) + if @lang == 'toml' + json = render_all(@nodelist, context) + jsonpatched = if json =~ /^\b*{/ then json else "{#{json}}" end + stdin, stdout, stderr = Open3.popen3('cd glstyleconv && cargo run -q') + stdin.puts(jsonpatched) + stdin.close + toml = (stdout.read || "") + + @highlighttoml.registers.merge!(context.registers) + out = @highlighttoml.render('toml' => toml) + + # Debugging output + @highlightjson.registers.merge!(context.registers) + json << (stderr.read || "") + out += @highlightjson.render('json' => json) + + out + else + super + end + end + end +end + +# Overwrite highlight tag +Liquid::Template.register_tag('highlight', Jekyll::HighlightAsTomlBlock) +Liquid::Template.register_tag('highlight0', Jekyll::Tags::HighlightBlock)
Convert JSON in doc to TOML
diff --git a/spec/active_interaction/integration/hash_interaction_spec.rb b/spec/active_interaction/integration/hash_interaction_spec.rb index abc1234..def5678 100644 --- a/spec/active_interaction/integration/hash_interaction_spec.rb +++ b/spec/active_interaction/integration/hash_interaction_spec.rb @@ -18,7 +18,7 @@ it_behaves_like 'an interaction', :hash, -> { {} } context 'with options[:a]' do - let(:a) { { 'x' => {} } } + let(:a) { { x: {} } } before { options.merge!(a: a) }
Change key to a symbol This used to be a string because of with_indifferent_access, but that's not necessary any more.
diff --git a/app/controllers/api/v1_controller.rb b/app/controllers/api/v1_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/v1_controller.rb +++ b/app/controllers/api/v1_controller.rb @@ -6,17 +6,14 @@ end def woeid_show - ads = if params[:type] == 'give' - Ad.give - else - Ad.want - end + @type = type_scope @woeid = params[:id] @page = params[:page] - @ads = ads.available - .by_woeid_code(@woeid) - .recent_first - .paginate(page: params[:page]) + @ads = Ad.public_send(@type) + .available + .by_woeid_code(@woeid) + .recent_first + .paginate(page: params[:page]) end def woeid_list
Make API behave like the other Ad scopes Return `give` ads by default.
diff --git a/app/controllers/my_cas_controller.rb b/app/controllers/my_cas_controller.rb index abc1234..def5678 100644 --- a/app/controllers/my_cas_controller.rb +++ b/app/controllers/my_cas_controller.rb @@ -1,4 +1,13 @@ class MyCasController < Devise::CasSessionsController skip_before_action :assert_projet_courant skip_before_action :authentifie + before_action :delete_flash_error, only: :new + +private + # Le login SSO redirige sur Clavis, le message d'erreur "You need to sign in + # or sign up before continuing." n'est donc pas affiché et apparaissait après + # une authentification réussie. + def delete_flash_error + flash.delete(:error) + end end
Fix message d'erreur après authentification SSO (Clavis) réussie
diff --git a/app/controllers/static_controller.rb b/app/controllers/static_controller.rb index abc1234..def5678 100644 --- a/app/controllers/static_controller.rb +++ b/app/controllers/static_controller.rb @@ -13,7 +13,7 @@ end def humans - @contributors = Rails.env.production? ? load_contributors : [] + @contributors = load_contributors render "static/humans.txt.erb", content_type: "text/plain" end
Remove production check, not needed
diff --git a/app/controllers/status_controller.rb b/app/controllers/status_controller.rb index abc1234..def5678 100644 --- a/app/controllers/status_controller.rb +++ b/app/controllers/status_controller.rb @@ -11,19 +11,15 @@ @smoke_detector.location = params[:location] @smoke_detector.is_standby = params[:standby] || false - # If an instance is manually switched to standby, we - # don't want it to immediately kick back - new_standby_switch = @smoke_detector.is_standby_changed? and @smoke_detector.is_standby - @smoke_detector.save! respond_to do |format| format.json do - if @smoke_detector.should_failover and not new_standby_switch + if @smoke_detector.should_failover @smoke_detector.update(:is_standby => false, :force_failover => false) render :status => 200, :json => { 'failover': true } else - head 200, content_type: "text/html" + render :status => 200, :json => { 'failover': false } end end end
Revert "Save a few bytes on every ping" This reverts commit a5b4e50be4189b52a6eaff1a124ad03ae7bd82d6. Revert "Don't immediately kick back on new standby instances" This reverts commit 3a2a636eb97c7b5199be7f3885b6552d94fb56b6.
diff --git a/app/controllers/topics_controller.rb b/app/controllers/topics_controller.rb index abc1234..def5678 100644 --- a/app/controllers/topics_controller.rb +++ b/app/controllers/topics_controller.rb @@ -16,7 +16,7 @@ @topic = Topic.new(topic_params) if @topic.save - redirect_to topic_path(@topic), notice: 'Topic was successfully created.' + redirect_to (topic_path(@topic) + '/' + @topic.edit_key), notice: 'Topic was successfully created.' else render :new end
Change new topic form to redirect to edit page
diff --git a/app/models/chargeback/rates_cache.rb b/app/models/chargeback/rates_cache.rb index abc1234..def5678 100644 --- a/app/models/chargeback/rates_cache.rb +++ b/app/models/chargeback/rates_cache.rb @@ -6,6 +6,11 @@ ChargebackRate.get_assigned_for_target(perf.resource, :tag_list => perf.tag_list_with_prefix, :parents => perf.parents_determining_rate) + + if perf.resource_type == Container.name && @rates[perf.hash_features_affecting_rate].empty? + @rates[perf.hash_features_affecting_rate] = [ChargebackRate.find_by(:description => "Default", :rate_type => "Compute")] + end + @rates[perf.hash_features_affecting_rate] end end end
Apply a specific default rate to CB for container images
diff --git a/SDDKit.podspec b/SDDKit.podspec index abc1234..def5678 100644 --- a/SDDKit.podspec +++ b/SDDKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "SDDKit" - s.version = "1.4.0" + s.version = "1.4.1" s.license = "MIT" s.summary = "Easiest way for implementing hierarchical state machine(HSM) based programs in Objective-C." s.homepage = "https://github.com/charleslyh/SDDKit"
Update podspec with version 1.4.1
diff --git a/classy_hash.gemspec b/classy_hash.gemspec index abc1234..def5678 100644 --- a/classy_hash.gemspec +++ b/classy_hash.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'classy_hash' - s.version = '0.0.1' + s.version = '0.1.0' s.license = 'MIT' s.files = ['lib/classy_hash.rb'] s.summary = 'Classy Hash: Keep your Hashes classy; a Hash schema validator'
Set version number to 0.1.0 for initial public release.
diff --git a/test/node_spec.rb b/test/node_spec.rb index abc1234..def5678 100644 --- a/test/node_spec.rb +++ b/test/node_spec.rb @@ -9,12 +9,17 @@ require '../node' group Node do - content = 'here is some text' - node = Node.new(content) + empty_node = Node.new + content = 'here is some text' + node = Node.new(content) group '#to_s' do assert 'returns the content' do node.to_s == content end + + assert 'returns an empty string if initialized with nothing' do + empty_node.to_s == '' + end end end
Test creating an empty node
diff --git a/behaviour/effect/activated_target.rb b/behaviour/effect/activated_target.rb index abc1234..def5678 100644 --- a/behaviour/effect/activated_target.rb +++ b/behaviour/effect/activated_target.rb @@ -5,7 +5,7 @@ def initialize(parent, costs = nil, name = nil, targets = [:self, Entity::Character]) @parent = parent - @targets = Set.new targets + @targets = targets @costs = Hash.new{|hash, key| 0} unless costs === nil costs.each do |cost, delta|
Change set to Array so we can use join method
diff --git a/recipes/default.rb b/recipes/default.rb index abc1234..def5678 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -18,7 +18,7 @@ # chef_gem('chef-sugar') do - version '1.2.0.beta.1' + version '1.2.2' action :nothing end.run_action(:install)
Update recipe to install 1.2.2
diff --git a/lib/active_record/postgres/constraints/command_recorder.rb b/lib/active_record/postgres/constraints/command_recorder.rb index abc1234..def5678 100644 --- a/lib/active_record/postgres/constraints/command_recorder.rb +++ b/lib/active_record/postgres/constraints/command_recorder.rb @@ -4,26 +4,28 @@ module Postgres module Constraints module CommandRecorder - def add_check_constraint(*args, &block) - record(:add_check_constraint, args, &block) + type = :check + + define_method("add_#{type}_constraint") do |*args, &block| + record(:"add_#{type}_constraint", args, &block) end - def invert_add_check_constraint(args, &block) - [:remove_check_constraint, args, block] + define_method("invert_add_#{type}_constraint") do |args, &block| + [:"remove_#{type}_constraint", args, block] end - def remove_check_constraint(*args, &block) + define_method("remove_#{type}_constraint") do |*args, &block| if args.length < 3 raise ActiveRecord::IrreversibleMigration, 'To make this migration reversible, pass the constraint to '\ - 'remove_check_constraint, i.e. `remove_check_constraint, '\ + "remove_#{type}_constraint, i.e. `remove_#{type}_constraint, "\ "#{args[0].inspect}, #{args[1].inspect}, 'price > 999'`" end - record(:remove_check_constraint, args, &block) + record(:"remove_#{type}_constraint", args, &block) end - def invert_remove_check_constraint(args, &block) - [:add_check_constraint, args, block] + define_method("invert_remove_#{type}_constraint") do |args, &block| + [:"add_#{type}_constraint", args, block] end end end
Define CommandRecorder methods dynamically in preparation for adding another type of constraint
diff --git a/app/models/notice.rb b/app/models/notice.rb index abc1234..def5678 100644 --- a/app/models/notice.rb +++ b/app/models/notice.rb @@ -19,10 +19,12 @@ # Associations #------------------------------------------------------------------------------ - # Every activity has 0 or more orgasnization types that are required to - # complete them + # Every notice has an optional organizatiopn type that that can see the notice belongs_to :organization_type + # Every notice must have a defined type + belongs_to :notice_type + #------------------------------------------------------------------------------ # Validations #------------------------------------------------------------------------------
Fix issue with Notice class
diff --git a/actionview/test/template/text_test.rb b/actionview/test/template/text_test.rb index abc1234..def5678 100644 --- a/actionview/test/template/text_test.rb +++ b/actionview/test/template/text_test.rb @@ -4,4 +4,20 @@ test "formats always return :text" do assert_equal [:text], ActionView::Template::Text.new("").formats end + + test "identifier should return 'text template'" do + assert_equal "text template", ActionView::Template::Text.new("").identifier + end + + test "inspect should return 'text template'" do + assert_equal "text template", ActionView::Template::Text.new("").inspect + end + + test "to_str should return a given string" do + assert_equal "a cat", ActionView::Template::Text.new("a cat").to_str + end + + test "render should return a given string" do + assert_equal "a dog", ActionView::Template::Text.new("a dog").render + end end
Add missing tests for ActionView::Template::Text
diff --git a/spec/pidgin2adium/tag_balancer_spec.rb b/spec/pidgin2adium/tag_balancer_spec.rb index abc1234..def5678 100644 --- a/spec/pidgin2adium/tag_balancer_spec.rb +++ b/spec/pidgin2adium/tag_balancer_spec.rb @@ -1,15 +1,15 @@ describe Pidgin2Adium::TagBalancer do - describe "text without tags" do - it "should be left untouched" do - text = "Foo bar baz, this is my excellent test text!" + describe 'text without tags' do + it 'is left untouched' do + text = 'foo!' Pidgin2Adium::TagBalancer.new(text).balance.should == text end end - describe "text with tags" do - it "should be balanced correctly" do + describe 'text with tags' do + it 'is balanced correctly' do unbalanced = '<p><b>this is unbalanced!' - balanced = "<p><b>this is unbalanced!</b></p>" + balanced = '<p><b>this is unbalanced!</b></p>' Pidgin2Adium::TagBalancer.new(unbalanced).balance.should == balanced end end
Remove shoulds from test descriptions
diff --git a/spec/unit/rom/support/registry_spec.rb b/spec/unit/rom/support/registry_spec.rb index abc1234..def5678 100644 --- a/spec/unit/rom/support/registry_spec.rb +++ b/spec/unit/rom/support/registry_spec.rb @@ -1,5 +1,24 @@ require 'spec_helper' require 'rom/support/registry' + +shared_examples_for 'registry fetch' do + it 'returns registered element identified by name' do + expect(registry.public_send(fetch_method, :mars)).to be(mars) + end + + it 'raises error when element is not found' do + expect { registry.public_send(fetch_method, :twix) }.to raise_error( + ROM::Registry::ElementNotFoundError, + ":twix doesn't exist in Candy registry" + ) + end + + it 'returns the value from an optional block when key is not found' do + value = registry.public_send(fetch_method, :candy) { :twix } + + expect(value).to eq(:twix) + end +end describe ROM::Registry do subject(:registry) { registry_class.new(mars: mars) } @@ -15,31 +34,20 @@ end describe '#fetch' do - it 'has an alias to []' do - expect(registry.method(:fetch)).to eq(registry.method(:[])) - end + let(:fetch_method) { :fetch } - it 'returns registered elemented identified by name' do - expect(registry.fetch(:mars)).to be(mars) - end - - it 'raises error when element is not found' do - expect { registry.fetch(:twix) }.to raise_error( - ROM::Registry::ElementNotFoundError, - ":twix doesn't exist in Candy registry" - ) - end - - it 'returns the value from an optional block when key is not found' do - value = registry.fetch(:candy) { :twix } - - expect(value).to eq(:twix) - end + it_behaves_like 'registry fetch' end - describe '.element_name' do - it 'returns registered elemented identified by element_name' do - expect(registry[:mars]).to be(mars) + describe '#[]' do + let(:fetch_method) { :[] } + + it_behaves_like 'registry fetch' + end + + describe '#method_missing' do + it 'returns registered element identified by name' do + expect(registry.mars).to be(mars) end it 'raises no-method error when element is not there' do
Implement shared examples for fetch on registry spec That allows us to test #fetch and #[] by behavior.
diff --git a/lib/miq_automation_engine/service_models/miq_ae_service_service_template.rb b/lib/miq_automation_engine/service_models/miq_ae_service_service_template.rb index abc1234..def5678 100644 --- a/lib/miq_automation_engine/service_models/miq_ae_service_service_template.rb +++ b/lib/miq_automation_engine/service_models/miq_ae_service_service_template.rb @@ -27,5 +27,11 @@ @object.save end end + + def provision_request(user, options) + ar_method do + wrap_results(@object.provision_request(user.instance_variable_get("@object"), options)) + end + end end end
Use user object instead of userid (transferred from ManageIQ/manageiq@bc8f06be80d4efcaa5b29a1e54c279a9132b84da)
diff --git a/recipes/default.rb b/recipes/default.rb index abc1234..def5678 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -28,7 +28,7 @@ end drbd_packages = value_for_platform_family( - %w(rhel fedora amazon scientific oracle) => %w(kmod-drbd84 drbd84-utils), + %w(rhel fedora) => %w(kmod-drbd84 drbd84-utils), %w(default debian) => %w(drbd8-utils) )
Correct list of platform families RHEL includes oracle, scientific, and amazon Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/recipes/default.rb b/recipes/default.rb index abc1234..def5678 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -15,7 +15,7 @@ # chef_ingredient 'analytics' do - channel node['chef-analytics']['channel'] + channel node['chef-analytics']['channel'].to_sym version node['chef-analytics']['version'] package_source node['chef-analytics']['package_source'] action :upgrade
Update channel to force string to symbol conversion
diff --git a/bot/job_status_generation.rb b/bot/job_status_generation.rb index abc1234..def5678 100644 --- a/bot/job_status_generation.rb +++ b/bot/job_status_generation.rb @@ -3,6 +3,10 @@ rep = [] rep << "Job #{ident} (#{url}):" + + if started_by + rep << "Started by #{started_by}." + end if aborted? rep << "Job aborted."
Make !status show who started a job.