diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/app/models/project.rb b/app/models/project.rb index abc1234..def5678 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -31,4 +31,8 @@ percent_complete.round(0) end + def full_errors_string + self.errors.full_messages.join(". ") + end + end
Add full errors string message
diff --git a/agharta.gemspec b/agharta.gemspec index abc1234..def5678 100644 --- a/agharta.gemspec +++ b/agharta.gemspec @@ -13,6 +13,7 @@ gem.homepage = "" gem.add_runtime_dependency 'thor', '~> 0.16' + gem.add_runtime_dependency 'userstream', '~> 1.2' gem.files = `git ls-files`.split($/) gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
Add userstream gem to dependency.
diff --git a/app/forms/options_form.rb b/app/forms/options_form.rb index abc1234..def5678 100644 --- a/app/forms/options_form.rb +++ b/app/forms/options_form.rb @@ -3,12 +3,5 @@ class OptionsForm < Reform::Form feature Coercion property :toc, type: Types::Form::Int, - validates: { - numericality: { - only_integer: true, - greater_than_or_equal_to: 0, - less_than_or_equal_to: 2, - allow_nil: true - } - } + validates: { inclusion: [nil, 0, 1, 2] } end
Use inclusion rather than numericality validators
diff --git a/spec/blueprints.rb b/spec/blueprints.rb index abc1234..def5678 100644 --- a/spec/blueprints.rb +++ b/spec/blueprints.rb @@ -8,7 +8,7 @@ Member.blueprint do email "foo@example.com" - name Sham.name + name {Sham.name} created_at Time.now - 1.day pw = Sham.password password pw @@ -23,17 +23,17 @@ end Decision.blueprint do |d| - d.proposal Proposal.make + d.proposal {Proposal.make} end AddMemberProposal.blueprint do |bp| bp.title "a proposal title" bp.open "1" - bp.proposer Member.make + bp.proposer {Member.make} end Clause.blueprint do |bp| bp.name 'objectives' bp.text_value 'consuming doughnuts' - bp.started_at(Time.now - 1.day) + bp.started_at {Time.now - 1.day} end
Fix some machinist errors by deferring shamming.
diff --git a/app/jobs/resolrize_job.rb b/app/jobs/resolrize_job.rb index abc1234..def5678 100644 --- a/app/jobs/resolrize_job.rb +++ b/app/jobs/resolrize_job.rb @@ -1,6 +1,4 @@ class ResolrizeJob < ActiveJob::Base - queue_as :resolrize - def perform ActiveFedora::Base.reindex_everything end
Put the ResolrizeJob on the default queue
diff --git a/app/models/lit/base.rb b/app/models/lit/base.rb index abc1234..def5678 100644 --- a/app/models/lit/base.rb +++ b/app/models/lit/base.rb @@ -41,6 +41,9 @@ self.class.create! attributes.merge(retried_created: true) end elsif !retried_updated + # Why elsif and not just if? Because if a record object was first saved + # with INSERT and then with UPDATE (still being the same Ruby object), + # it makes no sense to retry both create and upadte. Let's only retry create. self.retried_updated = true if rolledback_after_update? update_columns(attributes)
Add comment about retry mechanism
diff --git a/app/models/location.rb b/app/models/location.rb index abc1234..def5678 100644 --- a/app/models/location.rb +++ b/app/models/location.rb @@ -24,12 +24,12 @@ private :set_is_active def full_address - base_address << ", #{city_and_country}" + base_address << ", #{city_and_country}" unless base_address.nil? end private :full_address def city_and_country - city << ", Colombia" + city << ", Colombia" unless city.nil? end private :city_and_country end
Add validation to avoid errors when there are nil values for Location.
diff --git a/app/models/pano/filter.rb b/app/models/pano/filter.rb index abc1234..def5678 100644 --- a/app/models/pano/filter.rb +++ b/app/models/pano/filter.rb @@ -0,0 +1,23 @@+module Pano + class Filter + + attr_accessor :dimension, :selected, :url + + def initialize(dimension, selected, url) + self.dimension = dimension + self.selected = selected + self.url = url + end + + def to_label + return "#{dimension}: #{selected}" if dimension == 'Sort By' + return "#{dimension}: #{selected.truncate(60)}" if selected.is_a?(String) + if selected.size > 2 + "#{dimension}: #{selected.size} Selected" + else + "#{dimension}: #{selected.to_sentence(words_connector: ' or ', two_words_connector: ' or ', last_word_connector: ' or ').truncate(60)}" + end + end + + end +end
Add Filter - used by searches
diff --git a/bosh-stemcell/spec/support/stemcell_shared_examples.rb b/bosh-stemcell/spec/support/stemcell_shared_examples.rb index abc1234..def5678 100644 --- a/bosh-stemcell/spec/support/stemcell_shared_examples.rb +++ b/bosh-stemcell/spec/support/stemcell_shared_examples.rb @@ -21,4 +21,14 @@ its (:stdout) { should eq('') } end end + + context 'disable remote host login (stig: V-38491)' do + describe command('find /home -name .rhosts') do + its (:stdout) { should eq('') } + end + + describe file('/etc/hosts.equiv') do + it { should_not be_file } + end + end end
Verify that /etc/hosts.equiv and ~/.rhosts don't exist Stig: V-38491 [Finishes #98327690](https://www.pivotaltracker.com/story/show/98327690) Signed-off-by: Maria Shaldibina <dc03896a0185453e5852a5e0f0fab6cbd2e026ff@pivotal.io>
diff --git a/rails-i18nterface.gemspec b/rails-i18nterface.gemspec index abc1234..def5678 100644 --- a/rails-i18nterface.gemspec +++ b/rails-i18nterface.gemspec @@ -10,8 +10,8 @@ s.authors = ["Larry Sprock", "Artin Boghosain"] s.email = ["lardawge@gmail.com"] s.homepage = "https://github.com/lardawge/rails-i18nterface" - s.summary = "TODO: Summary of RailsI18nterface." - s.description = "TODO: Description of RailsI18nterface." + s.summary = "A rails 3.1 engine based interface for translating and writing translation files" + s.description = "Add me please" s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"] s.test_files = Dir["test/**/*"]
Add summary to gem file
diff --git a/week-6/bingo_solution.rb b/week-6/bingo_solution.rb index abc1234..def5678 100644 --- a/week-6/bingo_solution.rb +++ b/week-6/bingo_solution.rb @@ -0,0 +1,99 @@+# A Nested Array to Model a Bingo Board SOLO CHALLENGE + +# I spent [2] hours on this challenge. + + +# Release 0: Pseudocode + +=begin +Outline: + +Create a method to generate a letter ( b, i, n, g, o) and a number (1-100) + Randomly select a letter from b, i, n, g, or o for the current call column + Randomly select a number from 1-100 and input it as the current call number + +Check the called column for the number called. + Check the position corresponding to the current letter for each row to see if the number is there + IF the number is found THEN replace it with an X + ELSE do nothing + + +Display a column to the console + fill in the outline here + +Display the board to the console (prettily) + fill in the outline here +=end + + +# Initial Solution + +class BingoBoard + + def initialize(board) + @bingo_board = board + end + + def call + #Use sample and return index + @call_letter = ["B","I","N","G","O"].sample + + if @call_letter == "B" + @call_column = 0 + elsif @call_letter == "I" + @call_column = 1 + elsif @call_letter == "N" + @call_column = 2 + elsif @call_letter == "G" + @call_column = 3 + elsif @call_letter == "O" + @call_column = 4 + end + + @call_number = rand(1..100) + p "#{@call_letter}:#{@call_number}" + end + + def check + @bingo_board.map! do |row| + if row[@call_column] == @call_number + row.map! do |position| + if position == @call_number + "X" + else + position + end + end + else + row + end + + end + end + + def print + @bingo_board.each do |row| + p row + end + end +end + +# Refactored Solution + + + +#DRIVER CODE (I.E. METHOD CALLS) GO BELOW THIS LINE +board = [[47, 44, 71, 8, 88], + [22, 69, 75, 65, 73], + [83, 85, 97, 89, 57], + [25, 31, 96, 68, 51], + [75, 70, 54, 80, 83]] + +new_game = BingoBoard.new(board) + +new_game.call +new_game.check +new_game.print + +#Reflection +
Add progress on 6.6 Bingo Solo Challenge Assignment
diff --git a/backend/app/controllers/spree/admin/stock_locations_controller.rb b/backend/app/controllers/spree/admin/stock_locations_controller.rb index abc1234..def5678 100644 --- a/backend/app/controllers/spree/admin/stock_locations_controller.rb +++ b/backend/app/controllers/spree/admin/stock_locations_controller.rb @@ -2,16 +2,15 @@ module Admin class StockLocationsController < ResourceController - def new + new_action.before :set_country + + private + + def set_country if Spree::Config[:default_country_id].present? @stock_location.country = Spree::Country.find(Spree::Config[:default_country_id]) else @stock_location.country = Spree::Country.find_by_iso('US') - end - invoke_callbacks(:new_action, :before) - respond_with(@object) do |format| - format.html { render :layout => !request.xhr? } - format.js { render :layout => false } end end
Use new_action.before callback to cleanup controller.
diff --git a/rusen.gemspec b/rusen.gemspec index abc1234..def5678 100644 --- a/rusen.gemspec +++ b/rusen.gemspec @@ -1,7 +1,9 @@+# -*- encoding: utf-8 -*- +require File.expand_path('../lib/rusen/version', __FILE__) + Gem::Specification.new do |s| s.name = 'rusen' - s.version = '0.0.2' - s.date = '2012-01-25' + s.version = Rusen::VERSION s.platform = Gem::Platform::RUBY s.authors = ['Adrian Gomez'] s.summary = 'RUby Simple Exception Notification' @@ -9,10 +11,18 @@ simple exception notification for ruby.' s.email = 'adri4n.gomez@gmail.com' s.homepage = 'https://github.com/Moove-it/rusen' + s.rdoc_options = ["--charset=UTF-8"] + s.require_paths = ["lib"] + s.licenses = ["MIT"] - s.files = Dir.glob('{lib}/**/*') + %w(LICENSE README.md CHANGELOG.md) - - s.files = Dir.glob('{lib}/**/*') + s.files = Dir.glob("{bin,lib}/**/*") + %w(LICENSE README.md CHANGELOG.md Rakefile) + s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) } + s.test_files = s.files.grep(%r{^(test|spec|features)/}) + s.extra_rdoc_files = [ + "CHANGELOG.md", + "LICENSE", + "README.md" + ] s.add_dependency('pony') s.add_dependency('log4r')
Load the new VERSION; Add LICENSE; Fix 'files';
diff --git a/bin/tracker_custom_points.rb b/bin/tracker_custom_points.rb index abc1234..def5678 100644 --- a/bin/tracker_custom_points.rb +++ b/bin/tracker_custom_points.rb @@ -2,8 +2,19 @@ require 'pivotal-tracker' require 'yaml' -config = YAML.load(open(File.join(File.dirname(__FILE__), 'config.yml'))) -mappings = YAML.load(open(File.join(File.dirname(__FILE__), 'mappings.yml'))) +if File.exists?(File.join(ENV['HOME'], '.tracker_custom_points_config.yml')) + config = YAML.load(open(File.join(ENV['HOME'], '.tracker_custom_points_config.yml'))) +else + puts "You do not have your tracker_custom_points_config.yml file setup" + puts "\tcp #{File.join(File.dirname(__FILE__), '../config/config.yml.example')} ~/.tracker_custom_points_config.yml" + exit +end + +if File.exists?(File.join(ENV['HOME'], '.tracker_custom_points_mappings.yml')) + mappings = YAML.load(open(File.join(ENV['HOME'], '.tracker_custom_points_mappings.yml'))) +else + mappings = YAML.load(open(File.join(File.dirname(__FILE__), '../config/mappings.yml'))) +end PivotalTracker::Client.token = config['token']
Allow custom config and mappings
diff --git a/app/models/forecast.rb b/app/models/forecast.rb index abc1234..def5678 100644 --- a/app/models/forecast.rb +++ b/app/models/forecast.rb @@ -8,7 +8,7 @@ class << self def current - where('timestamp > ?', Time.now.utc) + where(timestamp: Time.now.utc..(Time.now.utc + 1.month)) end def ordered
Refactor current scope to play nice with joins
diff --git a/lib/ci_in_a_can/build.rb b/lib/ci_in_a_can/build.rb index abc1234..def5678 100644 --- a/lib/ci_in_a_can/build.rb +++ b/lib/ci_in_a_can/build.rb @@ -3,8 +3,8 @@ class Build params_constructor - attr_accessor :git_ssh, :local_location, :repo, :sha - attr_accessor :id + attr_accessor :id, :git_ssh, :sha, + :local_location, :repo def self.parse content GithubBuildParser.new.parse content
Use one list of attr_accessors.
diff --git a/spec/lib/blogit/parsers/markdown_parser_spec.rb b/spec/lib/blogit/parsers/markdown_parser_spec.rb index abc1234..def5678 100644 --- a/spec/lib/blogit/parsers/markdown_parser_spec.rb +++ b/spec/lib/blogit/parsers/markdown_parser_spec.rb @@ -11,13 +11,17 @@ describe "code highlighting" do - let(:parser) { - Blogit::Parsers::MarkdownParser.new("## Header\n\n``` ruby\nputs 'hello world'\n```") + let(:parser) { + Blogit::Parsers::MarkdownParser.new("## Header\n\n``` ruby\nputs 'hello world'\n```") } + + it "requires pymentize to run" do + system("pygmentize > /dev/null").should equal(true), "It seems that pygmentize is not installed on your system" + end it "should highlight code if highlight_code_syntax is true" do Blogit::configuration.highlight_code_syntax = true - parser.parsed.should =~ + parser.parsed.should =~ Regexp.new("<h2>Header</h2>\n<div class=\"highlight\"><pre><span class=\"nb\">puts</span> <span class=\"s1\">&#39;hello world&#39;</span>\n</pre>\n</div>\n") end
Add a test to make sure that pygmentize is there
diff --git a/lib/mars_photos/rover.rb b/lib/mars_photos/rover.rb index abc1234..def5678 100644 --- a/lib/mars_photos/rover.rb +++ b/lib/mars_photos/rover.rb @@ -6,16 +6,9 @@ end def get(parameter = {}) - response = HTTParty.get(build_url(parameter)) + url = MarsPhotos::Calculations.build_url(name, parameter) + response = HTTParty.get(url) response['photos'] - end - - private - def build_url(parameter) - url_rovers = "https://api.nasa.gov/mars-photos/api/v1/rovers/" - key = parameter.keys.first.to_s - value = parameter[parameter.keys.first] - "#{url_rovers}#{self.name}/photos?#{key}=#{value}&api_key=DEMO_KEY" end end end
Refactor Rover class after adding module calculations
diff --git a/lib/noam_lemma/player.rb b/lib/noam_lemma/player.rb index abc1234..def5678 100644 --- a/lib/noam_lemma/player.rb +++ b/lib/noam_lemma/player.rb @@ -1,9 +1,15 @@ require 'thread' module Noam + class NoamPlayerException < Exception; end class Player def initialize(con_host,con_port) - @socket = TCPSocket.new(con_host, con_port) + begin + @socket = TCPSocket.new(con_host, con_port) + rescue Errno::ECONNREFUSED + raise NoamPlayerException.new("Unable to connect to the Noam server at #{con_host}:#{con_port}. Is it running?") + end + @queue = Queue.new @thread = Thread.new do |t| begin
Throw a named exception when the socket fails to connect.
diff --git a/lib/sw_indexer_engine.rb b/lib/sw_indexer_engine.rb index abc1234..def5678 100644 --- a/lib/sw_indexer_engine.rb +++ b/lib/sw_indexer_engine.rb @@ -1,4 +1,37 @@ class SwIndexerEngine < BaseIndexer::MainIndexerEngine + # It is the main indexing function + # + # @param druid [String] is the druid for an object e.g., ab123cd4567 + # @param targets [Array] is an array with the targets list to index towards, + # if it is nil, the method will read the target list from release_tags + # + # @raise it will raise erros if there is any problems happen in any level + def index druid, targets=nil + # Read input mods and purl + purl_model = read_purl(druid) + if purl_model.catkey == nil + mods_model = read_mods(druid) + collection_data = get_collection_data(purl_model.collection_druids) + + # Map the input to solr_doc + solr_doc = BaseIndexer.mapper_class_name.constantize.new(druid, mods_model, purl_model, collection_data).convert_to_solr_doc + + # Get target list + targets_hash={} + if targets.nil? or targets.length == 0 + targets_hash = purl_model.release_tags_hash + else + targets_hash = get_targets_hash_from_param(targets) + end + + targets_hash = update_targets_before_write(targets_hash, purl_model) + + # Get SOLR configuration and write + solr_targets_configs = BaseIndexer.solr_configuration_class_name.constantize.instance.get_configuration_hash + BaseIndexer.solr_writer_class_name.constantize.new.process( druid, solr_doc, targets_hash, solr_targets_configs) + end + end + # It allows the consumer to modify the targets list before doing the final writing # to the solr core. Default behavior returns the targets_hash as it is # @param targets_hash [Hash] a hash of targets with true value @@ -7,6 +40,8 @@ def update_targets_before_write(targets_hash, purl_model) if purl_model.catkey != nil targets_hash["sw_dev"] = false + targets_hash["sw_stage"] = false + targets_hash["sw_prod"] = false end return targets_hash end
Check for catkey prior to building solr doc
diff --git a/lib/tasks/snapshots.rake b/lib/tasks/snapshots.rake index abc1234..def5678 100644 --- a/lib/tasks/snapshots.rake +++ b/lib/tasks/snapshots.rake @@ -1,23 +1,28 @@ namespace :actions do task :create_snapshots => :environment do success_count = failure_count = skip_count = 0 - Artefact.all.each do |artefact| - if artefact.actions.empty? - artefact.record_action "snapshot" - if artefact.save - STDERR.puts "Recorded snapshot for '#{artefact.name}'" if verbose - success_count += 1 + # Disable re-registration: this isn't making any changes that should be + # reflected in Rummager or the router, and disabling them makes things + # faster and less likely to break + Artefact.observers.disable :update_search_observer, :update_router_observer do + Artefact.all.each do |artefact| + if artefact.actions.empty? + artefact.record_action "snapshot" + if artefact.save + STDERR.puts "Recorded snapshot for '#{artefact.name}'" if verbose + success_count += 1 + else + STDERR.puts "Failed to save '#{artefact.name}'" if verbose + failure_count += 1 + end else - STDERR.puts "Failed to save '#{artefact.name}'" if verbose - failure_count += 1 + STDERR.puts "Skipping snapshot for '#{artefact.name}'" if verbose + skip_count += 1 end - else - STDERR.puts "Skipping snapshot for '#{artefact.name}'" if verbose - skip_count += 1 end + STDERR.puts "#{success_count} succeeded" + STDERR.puts "#{failure_count} failed" + STDERR.puts "#{skip_count} skipped" end - STDERR.puts "#{success_count} succeeded" - STDERR.puts "#{failure_count} failed" - STDERR.puts "#{skip_count} skipped" end end
Disable single registration for snapshotting task. This makes the process much faster and less fragile.
diff --git a/spec/controllers/api/devices/devices_controller_dump_spec.rb b/spec/controllers/api/devices/devices_controller_dump_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/api/devices/devices_controller_dump_spec.rb +++ b/spec/controllers/api/devices/devices_controller_dump_spec.rb @@ -0,0 +1,30 @@+require 'spec_helper' + +describe Api::DevicesController do + + include Devise::Test::ControllerHelpers + let(:user) { FactoryBot.create(:user) } + EXPECTED = [:device, + :images, + :regimens, + :peripherals, + :sequences, + :farm_events, + :tools, + :points, + :users, + :webcam_feeds] + + describe '#dump' do + it 'creates a backup of your account' do + # NOTE: As of 11 December 17, the dump endpoint is only for dev purposes. + # Not going to spend a bunch of time writing unit tests for this + # endpoint- just basic syntax checking. + sign_in user + get :dump, params: {}, session: { format: :json } + expect(response.status).to eq(200) + actual = json.keys + EXPECTED.map { |key| expect(actual).to include(key) } + end + end +end
Fix tests for device controller
diff --git a/benchmark-perf.gemspec b/benchmark-perf.gemspec index abc1234..def5678 100644 --- a/benchmark-perf.gemspec +++ b/benchmark-perf.gemspec @@ -1,4 +1,3 @@-# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'benchmark/perf/version' @@ -18,6 +17,7 @@ spec.test_files = spec.files.grep(%r{^spec/}) spec.require_paths = ["lib"] - spec.add_development_dependency 'bundler', '>= 1.5.0', '< 2.0' - spec.add_development_dependency 'rake' + spec.add_development_dependency 'bundler', '~> 1.16' + spec.add_development_dependency 'rspec', '~> 3.0' + spec.add_development_dependency 'rake', '~> 10.0' end
Add rspec as dev dependency
diff --git a/test/unit/test_helper.rb b/test/unit/test_helper.rb index abc1234..def5678 100644 --- a/test/unit/test_helper.rb +++ b/test/unit/test_helper.rb @@ -37,3 +37,18 @@ end end + +# Minitest uses Tempfiles for figuring out more complicated diffs +# This causes FakeFS to explode, so make sure this is run without FakeFS +# enabled. +module MiniTest + module Assertions + alias :actual_diff :diff + + def diff exp, act + FakeFS.without do + actual_diff exp, act + end + end + end +end
Work around Minitest and FakeFS collision issues See https://github.com/defunkt/fakefs/issues/143
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -16,5 +16,8 @@ # Configure cookie session store. config.session_store :cookie_store, key: '_mas_session' + # Configure additional assets to precompile + config.assets.precompile += %w(styleguide.css basic.css enhanced_fixed.css enhanced_responsive.css) + end end
Configure additional assets to precompile Fixes #4
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -26,8 +26,6 @@ config.middleware.use Rack::Attack - config.assets << Rails.root.join('app', 'services') - initializer :regenerate_require_cache, before: :load_environment_config do Bootscale.regenerate end
Remove adding services to assets as this is not needed
diff --git a/lib/rubocop/cop/generator/configuration_injector.rb b/lib/rubocop/cop/generator/configuration_injector.rb index abc1234..def5678 100644 --- a/lib/rubocop/cop/generator/configuration_injector.rb +++ b/lib/rubocop/cop/generator/configuration_injector.rb @@ -47,7 +47,7 @@ configuration_entries.find.with_index do |line, index| next if comment?(line) - break index if badge.to_s < line + return index if badge.to_s < line end configuration_entries.size - 1 end
Update based on PR review
diff --git a/lib/grunt/responses/messages.rb b/lib/grunt/responses/messages.rb index abc1234..def5678 100644 --- a/lib/grunt/responses/messages.rb +++ b/lib/grunt/responses/messages.rb @@ -2,15 +2,15 @@ module Responses module Messages include Concerns::Matching - + def on_privmsg - Grunt.history << response - if response.text =~ command_regex handle_command $~[1], $~[2] elsif response.text =~ assignment_regex handle_assignment $~[1], $~[2] end + + Grunt.history << response end end end
Append message to history after handling command
diff --git a/db/data_migration/20130305132612_add_nio_categories.rb b/db/data_migration/20130305132612_add_nio_categories.rb index abc1234..def5678 100644 --- a/db/data_migration/20130305132612_add_nio_categories.rb +++ b/db/data_migration/20130305132612_add_nio_categories.rb @@ -15,8 +15,12 @@ categories.each do |category_data| category_data[:slug] = category_data[:title].parameterize - category = MainstreamCategory.create(category_data) - if category - puts "Mainstream category '#{category.title}' created" + unless category = MainstreamCategory.where(slug: category_data[:slug]).first + category = MainstreamCategory.create(category_data) + if category + puts "Mainstream category '#{category.title}' created" + end + else + puts "Mainstream category '#{category.title}' already exists" end end
Make NIO categories migration idempotent
diff --git a/Library/Formula/berkeley-db4.rb b/Library/Formula/berkeley-db4.rb index abc1234..def5678 100644 --- a/Library/Formula/berkeley-db4.rb +++ b/Library/Formula/berkeley-db4.rb @@ -0,0 +1,29 @@+require 'formula' + +class BerkeleyDb4 < Formula + homepage 'http://www.oracle.com/technology/products/berkeley-db/index.html' + url 'http://download.oracle.com/berkeley-db/db-4.8.30.tar.gz' + sha1 'ab36c170dda5b2ceaad3915ced96e41c6b7e493c' + + keg_only "BDB 4.8.30 is provided for software that doesn't compile against newer versions." + + def install + # BerkeleyDB dislikes parallel builds + ENV.deparallelize + + args = ["--disable-debug", + "--prefix=#{prefix}", + "--mandir=#{man}", + "--enable-cxx"] + + # BerkeleyDB requires you to build everything from the build_unix subdirectory + cd 'build_unix' do + system "../dist/configure", *args + system "make install" + + # use the standard docs location + doc.parent.mkpath + mv prefix+'docs', doc + end + end +end
Add BDB 4.8.30 to core Some software still requires this version and will not build against BDB 5.x. Closes #15725.
diff --git a/activeresource.gemspec b/activeresource.gemspec index abc1234..def5678 100644 --- a/activeresource.gemspec +++ b/activeresource.gemspec @@ -13,7 +13,7 @@ s.email = 'david@loudthinking.com' s.homepage = 'http://www.rubyonrails.org' - s.files = Dir['CHANGELOG', 'MIT-LICENSE', 'README.rdoc', 'examples/**/*', 'lib/**/*'] + s.files = Dir['CHANGELOG.md', 'MIT-LICENSE', 'README.rdoc', 'examples/**/*', 'lib/**/*'] s.require_path = 'lib' s.extra_rdoc_files = %w( README.rdoc )
Synchronize the gemspecs since CHANGELOG has been renamed to CHANGELOG.md
diff --git a/bin/prebuild.rb b/bin/prebuild.rb index abc1234..def5678 100644 --- a/bin/prebuild.rb +++ b/bin/prebuild.rb @@ -21,7 +21,7 @@ end platformFiles << filename if formats.include? ext - json['resources']['media'] << { + json[:resources][:media] << { type: ext[1..-1], file: "images/#{filename}", name: "IMAGE_#{filename[0..-(ext.length + 1)].gsub(/\W/i, '_').upcase}"
Put symbol instead of string
diff --git a/lib/heroku/http_instrumentor.rb b/lib/heroku/http_instrumentor.rb index abc1234..def5678 100644 --- a/lib/heroku/http_instrumentor.rb +++ b/lib/heroku/http_instrumentor.rb @@ -17,6 +17,7 @@ $stderr.puts filter(params[:query]) when "excon.response" $stderr.puts "#{params[:status]} #{params[:reason_phrase]}" + $stderr.puts "request-id: #{headers['Request-id']}" if headers['Request-Id'] if headers['Content-Encoding'] == 'gzip' $stderr.puts filter(ungzip(params[:body])) else
Print Request-Id when HEROKU_DEBUG is on.
diff --git a/config/initializers/application.rb b/config/initializers/application.rb index abc1234..def5678 100644 --- a/config/initializers/application.rb +++ b/config/initializers/application.rb @@ -1,3 +1,6 @@+require 'active_record' +require "#{Rails.root}/lib/extensions/active_record" + require 'periscope' require "#{Rails.root}/lib/extensions/periscope"
Add initializer, missing from last commit
diff --git a/lib/dolphy/template_engines.rb b/lib/dolphy/template_engines.rb index abc1234..def5678 100644 --- a/lib/dolphy/template_engines.rb +++ b/lib/dolphy/template_engines.rb @@ -17,7 +17,7 @@ engine.render(Object.new, locals) end - def erb(template_name, locals) + def erb(template_name, locals=nil) template = File.open("views/#{template_name.to_s}.erb").read engine = ERB.new(template) engine.result(OpenStruct.new(locals).instance_eval { binding })
Set locals to nil on default.
diff --git a/lib/gitlab/patch/draw_route.rb b/lib/gitlab/patch/draw_route.rb index abc1234..def5678 100644 --- a/lib/gitlab/patch/draw_route.rb +++ b/lib/gitlab/patch/draw_route.rb @@ -8,8 +8,9 @@ RoutesNotFound = Class.new(StandardError) def draw(routes_name) - draw_ce(routes_name) | draw_ee(routes_name) || - raise(RoutesNotFound.new("Cannot find #{routes_name}")) + drawn_any = draw_ce(routes_name) | draw_ee(routes_name) + + drawn_any || raise(RoutesNotFound.new("Cannot find #{routes_name}")) end def draw_ce(routes_name)
Make it clear that we intent to use | over ||
diff --git a/lib/tasks/marriage_abroad.rake b/lib/tasks/marriage_abroad.rake index abc1234..def5678 100644 --- a/lib/tasks/marriage_abroad.rake +++ b/lib/tasks/marriage_abroad.rake @@ -0,0 +1,6 @@+namespace :marriage_abroad do + desc "Flatten a set of outcomes for a given country" + task :flatten_outcomes, [:country] => [:environment] do |_, args| + MarriageAbroadOutcomeFlattener.new(args[:country]).flatten + end +end
Add a rake task to wrap flattening utility
diff --git a/Casks/bathyscaphe.rb b/Casks/bathyscaphe.rb index abc1234..def5678 100644 --- a/Casks/bathyscaphe.rb +++ b/Casks/bathyscaphe.rb @@ -1,10 +1,10 @@ cask :v1 => 'bathyscaphe' do - version '2.5.0' - sha256 '16c9c7c2ade802f735e3e10f8330f548bd8ea2192e65f5c187618603af1a7422' + version '251-v816' + sha256 '3a225c571ffcc9e939008442efc00dc10399d6ef3f67e39e7b13a659c63b1519' - url "http://dl.sourceforge.jp/bathyscaphe/62963/BathyScaphe-#{version.gsub('.','')}-v787.dmg" + url "https://bitbucket.org/bathyscaphe/public/downloads/BathyScaphe-#{version}.dmg" name 'BathyScaphe' - homepage 'http://bathyscaphe.sourceforge.jp/' + homepage 'http://bathyscaphe.bitbucket.org/' license :oss app 'BathyScaphe.app'
Upgrade batchyscaphe to v2.5.1 and homepage
diff --git a/build/recipe.rb b/build/recipe.rb index abc1234..def5678 100644 --- a/build/recipe.rb +++ b/build/recipe.rb @@ -2,12 +2,12 @@ name 'sifter' version '0.7' - revision '4' + revision '5' description 'sifter' homepage 'https://github.com/darron/sifter' source "https://github.com/darron/sifter/releases/download/v#{version}/sifter-#{version}-linux-amd64.zip" - sha256 '367c98a025b7ff344b4e6cff14652acbcaab37ff06f795ac85b9ddef4a0cce96' + sha256 'f56329cae73810fa81173f87ca4e002b7244b00308bbf534afac7d37ac0467ae' maintainer 'Darron <darron@froese.org>' vendor 'octohost'
Rebuild package with properly built release.
diff --git a/spec/controllers/tree_display_controller_spec.rb b/spec/controllers/tree_display_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/tree_display_controller_spec.rb +++ b/spec/controllers/tree_display_controller_spec.rb @@ -0,0 +1,48 @@+require 'rails_helper' + +describe TreeDisplayController do + + describe "#list" do + it "should not redirect to student_task controller if current user is an instructor" do + allow(session[:user]).to receive("student?").and_return(false) + post "list" + response.should_not redirect_to(list_student_task_index_path) + end + it "should redirect to student_task controller if current user is a student" do + allow(session[:user]).to receive("student?").and_return(true) + post "list" + response.should redirect_to(list_student_task_index_path) + end + end + + describe "#ta_for_current_mappings?" do + it "should return true if current user is a TA for current course" do + allow(session[:user]).to receive("ta?").and_return(true) + end + end + + describe "#populate_rows" do + let(:dbl) { double } + before { expect(dbl).to receive(:populate_rows).with(Hash, String)} + it "passes when the arguments match" do + dbl.populate_rows({},"") + end + end + + describe "#populate_1_row" do + let(:dbl) { double } + before { expect(dbl).to receive(:populate_1_row).with(Node) } + it "passes when the arguments match" do + dbl.populate_1_row(Node.new) + end + end + + describe "#drill" do + it "redirect to list action" do + get "drill" , root: 1 + session[:root].should == "1" + expect(response).to redirect_to(list_tree_display_index_path) + end + + end +end
Add part of test done by E1570.
diff --git a/lib/generators/rets_data/templates/create_addresses.rb b/lib/generators/rets_data/templates/create_addresses.rb index abc1234..def5678 100644 --- a/lib/generators/rets_data/templates/create_addresses.rb +++ b/lib/generators/rets_data/templates/create_addresses.rb @@ -8,7 +8,7 @@ t.string :city t.string :state_or_province t.string :postal_code - t.string :country, :null => false, :default => "US" + t.string :country, :default => "US" t.timestamps end
Allow country to be null.
diff --git a/spec/file_storage_spec.rb b/spec/file_storage_spec.rb index abc1234..def5678 100644 --- a/spec/file_storage_spec.rb +++ b/spec/file_storage_spec.rb @@ -24,7 +24,7 @@ before do @default_internal = Encoding.default_internal - @tempfilename = Tempfile.create("text") { |f| f.path } + @tempfilename = Tempfile.new("text").path end after do
Use .new that is compatible with 2.0
diff --git a/spec/models/owner_spec.rb b/spec/models/owner_spec.rb index abc1234..def5678 100644 --- a/spec/models/owner_spec.rb +++ b/spec/models/owner_spec.rb @@ -0,0 +1,20 @@+require 'spec_helper' + +describe Owner do + describe "#buildpacks" do + context "new owner" do + let(:owner) { Owner.new } + it { expect(owner.buildpacks).to be_falsy } + + context "buildpacks explicitly enabled" do + before(:each) { owner.buildpacks = "1"} + it { expect(owner.buildpacks).to be_truthy } + end + + context "buildpacks explicitly disabled" do + before(:each) { owner.buildpacks = "0"} + it { expect(owner.buildpacks).to be_falsy } + end + end + end +end
Test current support for buildpack setting
diff --git a/spec/models/right_spec.rb b/spec/models/right_spec.rb index abc1234..def5678 100644 --- a/spec/models/right_spec.rb +++ b/spec/models/right_spec.rb @@ -35,6 +35,7 @@ describe "with multiple entries" do before { @right.save } + after(:all) { @right.destroy } describe "with duplicate resource-operation combination" do before { @right2 = @right.dup }
Remove right after test block is run
diff --git a/lib/slatan.rb b/lib/slatan.rb index abc1234..def5678 100644 --- a/lib/slatan.rb +++ b/lib/slatan.rb @@ -1,17 +1,21 @@ require "slatan/version" require "slatan/spirit" require "slatan/heart" -require "slatan/mouth" require "slatan/ear" +require "slatan/buttocks" require "utils/string_ex" module Slatan using StringEx Spirit.infuse + Buttocks.init @heart = Heart.new - @mouth = Mouth.new @heart - @ear = Ear.new @mouth + @ear = Ear.new - @heart.beat @ear + begin + @heart.beat @ear + rescue => e + Buttocks.fatal "#{e.backtrace.first}: #{e.message} (#{e.class})" + end end
Add logger of exception to Slatan
diff --git a/aphrodite/test/controllers/projects_controller_test.rb b/aphrodite/test/controllers/projects_controller_test.rb index abc1234..def5678 100644 --- a/aphrodite/test/controllers/projects_controller_test.rb +++ b/aphrodite/test/controllers/projects_controller_test.rb @@ -1,77 +1,4 @@ require 'test_helper' describe ProjectsController do - context "Display information about a single project" do - before do - @user = FactoryGirl.create :user - @document_1 = FactoryGirl.create :document, :public - @document_2 = FactoryGirl.create :document, :public - @project = FactoryGirl.create :project, :user_ids => [@user.id] - - sign_in @user - end - - it "Should list project's name" do - get :show, :id => @project.id - assert_response :success - assert_template :show - assert_not_nil assigns(:project) - end - - it "Add a document to a project" do - assert_difference '@project.documents.length' do - post :add_document, id: @project.id, document_id: @document_2.id - @project.reload - end - end - - it "Remove a document from a project" do - @project.documents << @document_1 - assert_difference '@project.documents.length', -1 do - delete :remove_document, id: @project.id, document_id: @document_1.id - @project.reload - end - end - end - - context "Add documents" do - before do - @user_1 = FactoryGirl.create :user - @user_2 = FactoryGirl.create :user - @project_1 = FactoryGirl.create :project, :user_ids => [@user_1.id] - @project_2 = FactoryGirl.create :project, :user_ids => [@user_1.id] - - @private_doc_user_1 = FactoryGirl.create :document, :private, user: @user_1 - @private_doc_user_2 = FactoryGirl.create :document, :private, user: @user_2 - @private_doc_added_to_other_project = FactoryGirl.create :document, :private - @project_2.documents << @private_doc_added_to_other_project - - @public_doc = FactoryGirl.create :document, :public - @public_doc_already_added = FactoryGirl.create :document, :public - @project_1.documents << @public_doc_already_added - - sign_in @user_1 - - get :add_documents, id: @project_1.id - @own_documents = assigns :own_documents - @public_documents = assigns :public_documents - @private_documents = assigns :private_documents - end - - it "display public and user_1 private docuements" do - assert @private_documents.include?(@private_doc_user_1), "private documents is not including private document" - assert @public_documents.include?(@public_doc), "public documents does not include public document" - assert @own_documents.include?(@public_doc_already_added) - end - - it "not display private document for another user" do - assert !@private_documents.include?(@private_doc_user_2) - assert !@own_documents.include?(@private_doc_added_to_other_project) - end - - it "not display already added documents" do - assert !@public_documents.include?(@public_doc_already_added) - assert !@private_documents.include?(@public_doc_already_added) - end - end end
[aphrodite] Remove project related unused tests
diff --git a/app/models/spree/home_page_feature.rb b/app/models/spree/home_page_feature.rb index abc1234..def5678 100644 --- a/app/models/spree/home_page_feature.rb +++ b/app/models/spree/home_page_feature.rb @@ -15,6 +15,8 @@ :path => ':rails_root/public/spree/home_page_features/:id/:style/:basename.:extension' validates_attachment_presence :image, unless: :body + + validates_attachment_content_type :image, :content_type => ['image/jpg', 'image/jpeg', 'image/png', 'image/gif'] scope :published, -> { where publish: true }
Add required Paperclip 4 validations
diff --git a/acceptance/setup/post_suite/10_collect_artifacts.rb b/acceptance/setup/post_suite/10_collect_artifacts.rb index abc1234..def5678 100644 --- a/acceptance/setup/post_suite/10_collect_artifacts.rb +++ b/acceptance/setup/post_suite/10_collect_artifacts.rb @@ -10,7 +10,8 @@ # that goes *out* to the hosts, no method that # scp's *from* the hosts. - scp_cmd = "scp root@#{database['ip']}:/var/log/puppetdb/puppetdb.log ./artifacts 2>&1" + ssh_host = database['ip'] || database.name + scp_cmd = "scp root@#{ssh_host}:/var/log/puppetdb/puppetdb.log ./artifacts 2>&1" PuppetAcceptance::Log.notify("Executing scp command:\n\n#{scp_cmd}\n\n") result = `#{scp_cmd}` status = $?
Acceptance: Fix ssh hostname for in-house runs
diff --git a/db/migrate/20160804150737_add_timestamps_to_members_again.rb b/db/migrate/20160804150737_add_timestamps_to_members_again.rb index abc1234..def5678 100644 --- a/db/migrate/20160804150737_add_timestamps_to_members_again.rb +++ b/db/migrate/20160804150737_add_timestamps_to_members_again.rb @@ -7,6 +7,7 @@ # Why this happened is lost in the mists of time, so repeat the SQL query # without speculation, just in case more than one person was affected. class AddTimestampsToMembersAgain < ActiveRecord::Migration + DOWNTIME = false def up execute "UPDATE members SET created_at = NOW() WHERE created_at IS NULL"
Add missing DOWNTIME constant to the AddTimestampsToMembersAgain migration
diff --git a/app/consumers/trace_consumer.rb b/app/consumers/trace_consumer.rb index abc1234..def5678 100644 --- a/app/consumers/trace_consumer.rb +++ b/app/consumers/trace_consumer.rb @@ -12,8 +12,6 @@ end def process(message) - return if message.body.fetch(:platform, 'default') == 'default' - try = 0 begin ::Mnemosyne::Builder.create!(message.body)
Remove hotfix not storing default platform
diff --git a/app/helpers/checklist_helper.rb b/app/helpers/checklist_helper.rb index abc1234..def5678 100644 --- a/app/helpers/checklist_helper.rb +++ b/app/helpers/checklist_helper.rb @@ -32,6 +32,6 @@ def format_question_option(option, criteria_keys) checked = criteria_keys.include?(option["value"]) - { label: option["label"], text: option["label"], value: option["value"], checked: checked } + { label: option["label"], text: option["label"], value: option["value"], checked: checked, hint_text: option["hint_text"] } end end
Allow radio buttons to display hint text
diff --git a/lib/generators/calagator/install_generator.rb b/lib/generators/calagator/install_generator.rb index abc1234..def5678 100644 --- a/lib/generators/calagator/install_generator.rb +++ b/lib/generators/calagator/install_generator.rb @@ -1,6 +1,8 @@ module Calagator class InstallGenerator < Rails::Generators::Base source_root File.expand_path('../templates', __FILE__) + + class_option :dummy, type: :boolean, default: false def install add_route @@ -8,10 +10,12 @@ add_initializer add_javascripts add_stylesheets - rake 'calagator:install:migrations' - rake 'db:migrate' - rake 'db:test:prepare' run 'rm -f public/index.html' + unless options[:dummy] + rake 'calagator:install:migrations' + rake 'db:migrate' + rake 'db:test:prepare' + end end private @@ -25,7 +29,7 @@ end def add_initializer - copy_file File.expand_path(File.join(__FILE__, '../templates/config/calagator.rb')), 'config/initializers/calagator.rb' + initializer 'calagator.rb', File.read(File.expand_path('../templates/config/calagator.rb', __FILE__)) end def add_javascripts
Add a --dummy option to calagator:install generator The dummy app in spec/dummy shouldn't copy migrations from db/migrate, since this will cause migration name exceptions when using the rake tasks provided by the engine-level Rakefile.
diff --git a/lib/woocommerce_api/resources/v2/line_item.rb b/lib/woocommerce_api/resources/v2/line_item.rb index abc1234..def5678 100644 --- a/lib/woocommerce_api/resources/v2/line_item.rb +++ b/lib/woocommerce_api/resources/v2/line_item.rb @@ -17,6 +17,7 @@ attribute :price , Decimal , writer: :private attribute :tax_class , String , writer: :private attribute :meta_data , Array[MetaDatum], writer: :private + attribute :taxes , Array[Hash] , writer: :private # Write Only attribute :variations, Array[Hash]
[ENHANCEMENT] Add taxes to line item model
diff --git a/app/models/georgia/meta_page.rb b/app/models/georgia/meta_page.rb index abc1234..def5678 100644 --- a/app/models/georgia/meta_page.rb +++ b/app/models/georgia/meta_page.rb @@ -9,8 +9,8 @@ class << self - def find(id) - @publisher = Georgia::Publisher.new(id) + def find(uuid) + @publisher = Georgia::Publisher.new(uuid) @page = @publisher.meta_page end
Rename id to uuid to avoid confusion
diff --git a/app/policies/ci/build_policy.rb b/app/policies/ci/build_policy.rb index abc1234..def5678 100644 --- a/app/policies/ci/build_policy.rb +++ b/app/policies/ci/build_policy.rb @@ -23,7 +23,7 @@ !::Gitlab::UserAccess .new(user, project: build.project) - .can_push_to_branch?(build.ref) + .can_merge_to_branch?(build.ref) end end end
Check only a merge ability for protected actions
diff --git a/app/policies/exercise_policy.rb b/app/policies/exercise_policy.rb index abc1234..def5678 100644 --- a/app/policies/exercise_policy.rb +++ b/app/policies/exercise_policy.rb @@ -38,7 +38,13 @@ if @user.admin? @scope.all elsif @user.teacher? - @scope.where('user_id = ? OR public = TRUE', @user.id) + @scope.where( + 'user_id IN (SELECT user_id FROM study_group_memberships WHERE study_group_id IN (?)) + OR (user_id = ? AND user_type = ?) + OR public = TRUE', + @user.study_groups.pluck(:id), + @user.id, @user.class.name + ) else @scope.none end
Include hidden exercises for other teachers of the same study group
diff --git a/lib/mr_keychain/keychain_exception.rb b/lib/mr_keychain/keychain_exception.rb index abc1234..def5678 100644 --- a/lib/mr_keychain/keychain_exception.rb +++ b/lib/mr_keychain/keychain_exception.rb @@ -9,7 +9,7 @@ # @param [Fixnum] error_code result code from calling a Sec function def initialize message_prefix, error_code cf_message = SecCopyErrorMessageString( error_code, nil ) - super "#{message_prefix}. #{cf_message}" + super "#{message_prefix}. [Error code: #{error_code}] #{cf_message}" end end
Include the error code in exception messages
diff --git a/lib/raven/integrations/delayed_job.rb b/lib/raven/integrations/delayed_job.rb index abc1234..def5678 100644 --- a/lib/raven/integrations/delayed_job.rb +++ b/lib/raven/integrations/delayed_job.rb @@ -14,23 +14,23 @@ rescue Exception => exception # Log error to Sentry ::Raven.capture_exception(exception, - logger => 'delayed_job', - tags => { - delayed_job_queue: job.queue + logger => 'delayed_job', + tags => { + delayed_job_queue => job.queue }, extra => { delayed_job => { - id => job.id, - priority => job.priority, - attempts => job.attempts, - handler => job.handler, - last_error => job.last_error, - run_at => job.run_at, - locked_at => job.locked_at, - #failed_at => job.failed_at, - locked_by => job.locked_by, - queue => job.queue, - created_at => job.created_at + id => job.id, + priority => job.priority, + attempts => job.attempts, + handler => job.handler, + last_error => job.last_error, + run_at => job.run_at, + locked_at => job.locked_at, + #failed_at => job.failed_at, + locked_by => job.locked_by, + queue => job.queue, + created_at => job.created_at } })
Support for Ruby 1.8.7 failing due new Hash syntax
diff --git a/lib/strumbar/instrumentation/redis.rb b/lib/strumbar/instrumentation/redis.rb index abc1234..def5678 100644 --- a/lib/strumbar/instrumentation/redis.rb +++ b/lib/strumbar/instrumentation/redis.rb @@ -4,18 +4,31 @@ def self.load Strumbar.subscribe 'query.redis' do |client, event| client.increment 'query.redis' + client.increment 'failure.redis' if event.payload[:failure] + + command = event.payload[:command].size > 1 ? 'multi' : event.payload[:command].first + client.timing "#{command}.redis", event.duration end - unless ::Redis::Client.instance_methods.include? :process_with_instrumentation + unless ::Redis::Client.instance_methods.include? :call_with_instrumentation ::Redis::Client.class_eval do - def process_with_instrumentation commands - Strumbar.strum 'query.redis', commands: commands do - process_without_instrumentation commands + def call_with_instrumentation command, &block + Strumbar.strum 'query.redis', command: command do |payload| + call_without_instrumentation command, &block + begin + reply = call_without_instrumentation command, &block + payload[:failure] = false + rescue CommandError + payload[:failure] = true + raise + end + + reply end end - alias_method :process_without_instrumentation, :process - alias_method :process, :process_with_instrumentation + alias_method :call_without_instrumentation, :call + alias_method :call, :call_with_instrumentation end end end
Switch from process to call for failure state
diff --git a/codeclimate_ci.gemspec b/codeclimate_ci.gemspec index abc1234..def5678 100644 --- a/codeclimate_ci.gemspec +++ b/codeclimate_ci.gemspec @@ -8,6 +8,7 @@ spec.summary = %q{Simple gem for checking your code with CodeClimate} spec.description = %q{ Gem that allows You to check your code quality with CodeClimate and integrate it with your CI scripts } spec.license = 'MIT' + spec.homepage = 'https://github.com/fs/codeclimate_ci' spec.files = `git ls-files -z`.split("\x0") spec.executables = ['codeclimate_ci']
Add homepage link to gemspec
diff --git a/test/class_test.rb b/test/class_test.rb index abc1234..def5678 100644 --- a/test/class_test.rb +++ b/test/class_test.rb @@ -0,0 +1,11 @@+require "test_helper" + +class ClassTest < Test::Unit::TestCase + + @@html = %{<a href="http://google.com" class="testing">Testing</a>} + + test "pass through classes" do + assert_equal @@html, Govspeak::HtmlSanitizer.new(@@html).sanitize + end + +end
Test that classes pass through
diff --git a/trousseau.rb b/trousseau.rb index abc1234..def5678 100644 --- a/trousseau.rb +++ b/trousseau.rb @@ -2,7 +2,7 @@ class Trousseau < Formula homepage 'https://github.com/oleiade/trousseau' - url 'https://github.com/oleiade/trousseau/releases/download/0.3.0/trousseau_0.3.0_darwin_amd64.zip' + url 'https://github.com/oleiade/trousseau/releases/download/0.3.1/trousseau_0.3.1_darwin_amd64.zip' sha1 '' def install
Update homebrew recipe to fetch 0.3.1 release
diff --git a/db/migrate/20161206051008_src_sets_search_document_indices.rb b/db/migrate/20161206051008_src_sets_search_document_indices.rb index abc1234..def5678 100644 --- a/db/migrate/20161206051008_src_sets_search_document_indices.rb +++ b/db/migrate/20161206051008_src_sets_search_document_indices.rb @@ -1,7 +1,7 @@ class SrcSetsSearchDocumentIndices < ActiveRecord::Migration[5.0] def change if ActiveRecord::Base.connection.adapter_name == 'PostgreSQL' - execute 'drop index src_sets_to_tsvector_idx' + execute 'drop index if exists src_sets_to_tsvector_idx' execute "create index on src_sets using gin(to_tsvector('english', search_document));" end end
Add if exists to src_sets_to_tsvector_idx creation
diff --git a/app/controllers/discussion_boards_controller.rb b/app/controllers/discussion_boards_controller.rb index abc1234..def5678 100644 --- a/app/controllers/discussion_boards_controller.rb +++ b/app/controllers/discussion_boards_controller.rb @@ -1,6 +1,12 @@ class DiscussionBoardsController < ApplicationController - before_filter :authenticate_user! - before_filter :get_discussion_board, :only => [ :edit, :update ] + before_filter :authenticate_user!, :except => [ :show ] + before_filter :get_discussion_board, :only => [ :show, :edit, :update ] + + def show + redirect_to club_sales_page_path(@discussion_board.club) unless user_signed_in? and can?(:read, @discussion_board) + + @club = @discussion_board.club + end def edit authorize! :edit, @discussion_board
Add show Action to DiscussionBoard Controller Update the DiscussionBoard controller to include the show action.
diff --git a/app/models/setup/notification_flow_execution.rb b/app/models/setup/notification_flow_execution.rb index abc1234..def5678 100644 --- a/app/models/setup/notification_flow_execution.rb +++ b/app/models/setup/notification_flow_execution.rb @@ -1,14 +1,18 @@ module Setup class NotificationFlowExecution < Setup::Task - agent_field :notification + agent_field :notification, :notification_id build_in_data_type belongs_to :notification, class_name: Setup::NotificationFlow.name, inverse_of: nil - before_save do - self.notification = Setup::NotificationFlow.where(id: message[:notification_id]).first + def auto_description + if (notification = agent_from_msg) && notification.data_type + "Executing notification #{notification.custom_title} with #{notification.data_type.custom_title} ID: #{message[:record_id]}" + else + super + end end def run(message)
Add | Custom notification flow execution description
diff --git a/db/migrate/20120117225649_add_booking_template_id_to_line_items.rb b/db/migrate/20120117225649_add_booking_template_id_to_line_items.rb index abc1234..def5678 100644 --- a/db/migrate/20120117225649_add_booking_template_id_to_line_items.rb +++ b/db/migrate/20120117225649_add_booking_template_id_to_line_items.rb @@ -0,0 +1,6 @@+class AddBookingTemplateIdToLineItems < ActiveRecord::Migration + def change + add_column :line_items, :booking_template_id, :integer + add_index :line_items, :booking_template_id + end +end
Add booking template id to line items.
diff --git a/lib/lims-laboratory-app/laboratory/tube_rack/tube_rack_resource.rb b/lib/lims-laboratory-app/laboratory/tube_rack/tube_rack_resource.rb index abc1234..def5678 100644 --- a/lib/lims-laboratory-app/laboratory/tube_rack/tube_rack_resource.rb +++ b/lib/lims-laboratory-app/laboratory/tube_rack/tube_rack_resource.rb @@ -10,9 +10,12 @@ include Lims::Api::Resources::Container - def content_to_stream(s, mime_type) - dimensions_to_stream(s) - s.add_key "tubes" + def elements_name + :tubes + end + + def children_to_stream(s, mime_type) + s.add_key :tubes tubes_to_stream(s, mime_type) end
Refactor TubeRackResource to define children_to_stream
diff --git a/mongo-activerecord-ruby.gemspec b/mongo-activerecord-ruby.gemspec index abc1234..def5678 100644 --- a/mongo-activerecord-ruby.gemspec +++ b/mongo-activerecord-ruby.gemspec @@ -9,10 +9,21 @@ s.require_paths = ['lib'] - s.files = Dir['examples/*.rb'] + Dir['lib/mongo_record/*.rb'] - ['lib/mongo_record.rb', 'README.rdoc', 'Rakefile', - 'mongo-activerecord-ruby.gemspec'] - s.test_files = Dir['tests/*.rb'] + s.files = ['examples/tracks.rb', 'lib/mongo_record.rb', + 'lib/mongo_record/base.rb', + 'lib/mongo_record/convert.rb', + 'lib/mongo_record/log_device.rb', + 'lib/mongo_record/sql.rb', + 'lib/mongo_record/subobject.rb', + 'README.rdoc', 'Rakefile', 'mongo-activerecord-ruby.gemspec'] + s.test_files = ['tests/address.rb', + 'tests/course.rb', + 'tests/student.rb', + 'tests/test_log_device.rb', + 'tests/test_mongo.rb', + 'tests/test_sql.rb', + 'tests/track2.rb', + 'tests/track3.rb'] s.has_rdoc = true s.rdoc_options = ['--main', 'README.rdoc', '--inline-source']
Stop using Dir[] in an attempt to get rid of a Github gemspec build error.
diff --git a/stylesheet_flipper.gemspec b/stylesheet_flipper.gemspec index abc1234..def5678 100644 --- a/stylesheet_flipper.gemspec +++ b/stylesheet_flipper.gemspec @@ -6,7 +6,7 @@ gem.email = ["jeppe@liisberg.net"] gem.description = %q{Makes your LTR stylesheet work for RTL locales and vice versa} gem.summary = %q{Makes your LTR stylesheet work for RTL locales and vice versa} - gem.homepage = "https://github.com/monibuds/stylesheet_flipper" + gem.homepage = "https://github.com/liisberg-consulting/stylesheet_flipper" gem.add_development_dependency "rspec" gem.add_runtime_dependency "rails", ">=3.1"
Add correct homepage link in gemspec
diff --git a/spec/models/metrics/richness_of_information_spec.rb b/spec/models/metrics/richness_of_information_spec.rb index abc1234..def5678 100644 --- a/spec/models/metrics/richness_of_information_spec.rb +++ b/spec/models/metrics/richness_of_information_spec.rb @@ -0,0 +1,35 @@+require 'spec_helper' + +describe Metrics::RichnessOfInformation do + + it "computes the frequency of a word in a given text" do + + data = { :notes => 'These files provide detailed road safety data '\ + 'about the circumstances of personal injury road '\ + 'accidents in GB from 2005', + + :resources => [{:description => 'Road Safety - Accidents 2005'}, + {:description => 'Road Safety - Accidents 2006'}, + {:description => 'Road Safety - Accidents 2007'}, + {:description => 'Road Safety - Accidents 2008'}]} + + expectation = {'these' => 1, 'files' => 1, 'provide' => 1, 'detailed' => 1, + 'road' => 6, 'safety' => 5, 'data' => 1, 'about' => 1, + 'the' => 1, 'circumstances' => 1, 'of' => 1, + 'personal' => 1, 'injury' => 1, 'accidents' => 5, 'in' => 1, + 'gb' => 1, 'from' => 1, '2005' => 2, '2006' => 1, + '2007' => 1, '2008' => 1} + + result = Metrics::RichnessOfInformation.term_frequency(data) + term_frequency, doc_length = result + expect(doc_length).to be(5.0) + expect(term_frequency).to eq(expectation) + end + + it "computes the frequency of a word in all given texts" do + end + + it "computes the Term Frequency-Inverse Document Frequency" do + end + +end
Add specifications for the richness of information Since the implementation of the richness of information detail view raised my suspicion about its proper implementation I have started to add tests. Signed-off-by: Konrad Reiche <4ff0213f56e2082fcd8c882d04c546881c579ce4@gmail.com>
diff --git a/active_utils.gemspec b/active_utils.gemspec index abc1234..def5678 100644 --- a/active_utils.gemspec +++ b/active_utils.gemspec @@ -10,6 +10,7 @@ s.email = ["developers@jadedpixel.com"] s.homepage = "http://github.com/shopify/active_utils" s.summary = %q{Common utils used by active_merchant, active_fulfillment, and active_shipping} + s.license = 'MIT' s.rubyforge_project = "active_utils"
Add license to gemspec, is MIT
diff --git a/app/models/line_search.rb b/app/models/line_search.rb index abc1234..def5678 100644 --- a/app/models/line_search.rb +++ b/app/models/line_search.rb @@ -3,7 +3,7 @@ if !@term.empty? query = Line.search(@term) if @character - query = query.includes(:character).where(characters: { name: @character }) + query = query.joins(:character).where(characters: { name: @character }) end elsif @character query = Line.includes(:character).where(characters: { name: @character })
Use joins instead of includes when searching on term and character name
diff --git a/app/models/pano/filter.rb b/app/models/pano/filter.rb index abc1234..def5678 100644 --- a/app/models/pano/filter.rb +++ b/app/models/pano/filter.rb @@ -0,0 +1,23 @@+module Pano + class Filter + + attr_accessor :dimension, :selected, :url + + def initialize(dimension, selected, url) + self.dimension = dimension + self.selected = selected + self.url = url + end + + def to_label + return "#{dimension}: #{selected}" if dimension == 'Sort By' + return "#{dimension}: #{selected.truncate(60)}" if selected.is_a?(String) + if selected.size > 2 + "#{dimension}: #{selected.size} Selected" + else + "#{dimension}: #{selected.to_sentence(words_connector: ' or ', two_words_connector: ' or ', last_word_connector: ' or ').truncate(60)}" + end + end + + end +end
Add Filter - used by searches
diff --git a/lib/rack/insight/panels/redis_panel/redis_extension.rb b/lib/rack/insight/panels/redis_panel/redis_extension.rb index abc1234..def5678 100644 --- a/lib/rack/insight/panels/redis_panel/redis_extension.rb +++ b/lib/rack/insight/panels/redis_panel/redis_extension.rb @@ -16,8 +16,7 @@ end end - alias_method_chain :call, :insight - + Redis::Client.alias_method_chain :call, :insight end end end
Fix Redis extension for Redis 3.x.
diff --git a/adequate_exposure.gemspec b/adequate_exposure.gemspec index abc1234..def5678 100644 --- a/adequate_exposure.gemspec +++ b/adequate_exposure.gemspec @@ -14,6 +14,6 @@ spec.required_ruby_version = "~> 2.0" - spec.add_dependency "railties", ">= 4.0" - spec.add_dependency "activesupport", ">= 4.0" + spec.add_dependency "railties", ">= 4.0", "< 6" + spec.add_dependency "activesupport", ">= 4.0", "< 6" end
Add upper deps version constraints
diff --git a/spec/helpers/application_helper/buttons/vm_retire_now_spec.rb b/spec/helpers/application_helper/buttons/vm_retire_now_spec.rb index abc1234..def5678 100644 --- a/spec/helpers/application_helper/buttons/vm_retire_now_spec.rb +++ b/spec/helpers/application_helper/buttons/vm_retire_now_spec.rb @@ -0,0 +1,52 @@+describe ApplicationHelper::Button::VmRetireNow do + describe '#visible?' do + context "when record is retireable" do + before do + @record = FactoryGirl.create(:vm_vmware) + allow(@record).to receive(:supports_retire?).and_return(true) + end + + it_behaves_like "will not be skipped for this record" + end + + context "when record is not retiretable" do + before do + @record = FactoryGirl.create(:vm_vmware) + allow(@record).to receive(:supports_retire?).and_return(false) + end + + it_behaves_like "will be skipped for this record" + end + end + + describe '#disabled?' do + context "when record has an error message" do + before do + @record = FactoryGirl.create(:vm_vmware) + allow(@record).to receive(:retired).and_return(true) + end + + it "disables the button" do + view_context = setup_view_context_with_sandbox({}) + button = described_class.new(view_context, {}, {'record' => @record}, {}) + expect(button.disabled?).to be_truthy + end + end + end + + describe "#calculate_properties" do + context "when record is retired" do + before do + @record = FactoryGirl.create(:vm_vmware) + allow(@record).to receive(:retired).and_return(true) + end + + it "sets the error message for disabled button" do + view_context = setup_view_context_with_sandbox({}) + button = described_class.new(view_context, {}, {'record' => @record}, {}) + button.calculate_properties + expect(button[:title]).to eq("VM is already retired") + end + end + end +end
Use previous spec for the new button vm_retire_now
diff --git a/spec/requests/customer_nudge_appointment_landing_page_spec.rb b/spec/requests/customer_nudge_appointment_landing_page_spec.rb index abc1234..def5678 100644 --- a/spec/requests/customer_nudge_appointment_landing_page_spec.rb +++ b/spec/requests/customer_nudge_appointment_landing_page_spec.rb @@ -1,18 +1,41 @@ require 'spec_helper' RSpec.describe 'Landing page for customer nudge bookings', type: :request do - specify 'Visiting the landing page sets the nudge cookie' do + context 'When a customer lands in the regular journey' do + specify 'Visiting the landing page sets the nudge cookie' do + when_the_customer_visits_the_landing_page + then_the_nudge_cookie_is_set + and_they_are_redirected_to_the_phone_booking_journey + end + + specify 'Unsetting the nudge cookie upon confirmation' do + when_the_nudge_cookie_is_set + and_the_customer_completes_a_booking + then_the_nudge_cookie_is_cleared + end + end + + def when_the_customer_visits_the_landing_page get '/en/nudge/new' + end + def then_the_nudge_cookie_is_set expect(response.cookies['nudged']).to eq('true') + end + + def and_they_are_redirected_to_the_phone_booking_journey expect(response).to redirect_to('/en/telephone-appointments/new') end - specify 'Unsetting the nudge cookie upon confirmation' do + def when_the_nudge_cookie_is_set cookies['nudged'] = 'true' + end + def and_the_customer_completes_a_booking get '/en/telephone-appointments/confirmation?booking_reference=123456&booking_date=2022-05-05' + end + def then_the_nudge_cookie_is_cleared expect(cookies['nudged']).to be_blank end end
Rework this spec into the GWT style I'm adding other scenarios with shared contexts.
diff --git a/lib/amakanize/filters/brackets_normalization_filter.rb b/lib/amakanize/filters/brackets_normalization_filter.rb index abc1234..def5678 100644 --- a/lib/amakanize/filters/brackets_normalization_filter.rb +++ b/lib/amakanize/filters/brackets_normalization_filter.rb @@ -5,6 +5,7 @@ ‹ › ‾ ‾ - - + ― ― 〜 〜 « » ( )
Support a new bracket type
diff --git a/app/models/domain.rb b/app/models/domain.rb index abc1234..def5678 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -1,10 +1,18 @@+# For the benefit of NewDomainWorker +require "nokogiri" + class Domain < ActiveRecord::Base # Lookup and cache meta information for a domain def self.lookup_meta(domain_name) # TODO If the last time the meta info was grabbed was a long time ago, refresh it domain = find_by(name: domain_name) if domain.nil? - doc = RestClient.get("http://#{domain_name}") + begin + doc = RestClient.get("http://#{domain_name}") + rescue RestClient::InternalServerError + doc = "" + end + tag = Nokogiri::HTML(doc).at("html head meta[name='Description']") meta = tag["content"] if tag domain = create!(name: domain_name, meta: meta)
Handle internal server error and require nokogiri for background job
diff --git a/actionpack/lib/action_controller/metal/url_for.rb b/actionpack/lib/action_controller/metal/url_for.rb index abc1234..def5678 100644 --- a/actionpack/lib/action_controller/metal/url_for.rb +++ b/actionpack/lib/action_controller/metal/url_for.rb @@ -6,6 +6,7 @@ def url_options options = {} + @_routes ||= nil if _routes.equal?(env["action_dispatch.routes"]) options[:script_name] = request.script_name.dup end
Initialize @_routes if not defined yet, avoiding more warnings.
diff --git a/week-6/gps.rb b/week-6/gps.rb index abc1234..def5678 100644 --- a/week-6/gps.rb +++ b/week-6/gps.rb @@ -0,0 +1,41 @@+# Your Names +# 1) Jason Milfred + +# We spent [#] hours on this challenge. + +# Bakery Serving Size portion calculator. + +def serving_size_calc(item_to_make, num_of_ingredients) + library = {"cookie" => 1, "cake" => 5, "pie" => 7} + error_counter = 3 + + library.each do |food| + if library[food] != library[item_to_make] + error_counter += -1 + end + end + + if error_counter > 0 + raise ArgumentError.new("#{item_to_make} is not a valid input") + end + + serving_size = library.values_at(item_to_make)[0] + remaining_ingredients = num_of_ingredients % serving_size + + case remaining_ingredients + when 0 + return "Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}" + else + return "Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}, you have #{remaining_ingredients} leftover ingredients. Suggested baking items: TODO: MAKE THIS FEATURE" + end +end + +p serving_size_calc("pie", 7) +p serving_size_calc("pie", 8) +p serving_size_calc("cake", 5) +p serving_size_calc("cake", 7) +p serving_size_calc("cookie", 1) +p serving_size_calc("cookie", 10) +p serving_size_calc("THIS IS AN ERROR", 5) + +# Reflection
Add initial file for GPS 2.3
diff --git a/uppercrust.gemspec b/uppercrust.gemspec index abc1234..def5678 100644 --- a/uppercrust.gemspec +++ b/uppercrust.gemspec @@ -21,7 +21,7 @@ spec.add_dependency "thor" spec.add_dependency "mustache" - spec.add_development_dependency "bundler", "~> 1.6" + spec.add_development_dependency "bundler", "~> 2.0" spec.add_development_dependency "rake" spec.add_development_dependency "rspec", "~> 2.6" spec.add_development_dependency "cucumber"
Update bundler requirement from ~> 1.6 to ~> 2.0 Updates the requirements on [bundler](https://github.com/bundler/bundler) to permit the latest version. - [Release notes](https://github.com/bundler/bundler/releases) - [Changelog](https://github.com/bundler/bundler/blob/master/CHANGELOG.md) - [Commits](https://github.com/bundler/bundler/compare/v1.6.0...v2.0.1)
diff --git a/core/db/migrate/20150609093816_increase_scale_on_pre_tax_amounts.rb b/core/db/migrate/20150609093816_increase_scale_on_pre_tax_amounts.rb index abc1234..def5678 100644 --- a/core/db/migrate/20150609093816_increase_scale_on_pre_tax_amounts.rb +++ b/core/db/migrate/20150609093816_increase_scale_on_pre_tax_amounts.rb @@ -1,5 +1,15 @@ class IncreaseScaleOnPreTaxAmounts < ActiveRecord::Migration def change + # set pre_tax_amount on shipments to discounted_amount - included_tax_total + # so that the null: false option on the shipment pre_tax_amount doesn't generate + # errors. + # + execute(<<-SQL) + UPDATE spree_shipments + SET pre_tax_amount = (cost + promo_total) - included_tax_total + WHERE pre_tax_amount IS NULL; + SQL + change_column :spree_line_items, :pre_tax_amount, :decimal, precision: 12, scale: 4, default: 0.0, null: false change_column :spree_shipments, :pre_tax_amount, :decimal, precision: 12, scale: 4, default: 0.0, null: false end
Set pre_tax_amount for shipments so that migration works On existing installations, the migrations `IncreaseScaleOnPreTaxAmounts` will fail because of existing shipments not having a `pre_tax_amount` set. Fixes #6525 Fixes #6527
diff --git a/app/controllers/technical_feedbacks_controller.rb b/app/controllers/technical_feedbacks_controller.rb index abc1234..def5678 100644 --- a/app/controllers/technical_feedbacks_controller.rb +++ b/app/controllers/technical_feedbacks_controller.rb @@ -26,7 +26,7 @@ def feedback_params if params[:feedback] feedback = params.require(:feedback).permit(:issue_type, :attempting, :occurred) - feedback[:url] = request.url + feedback[:url] = session.fetch(:return_to, request.url) feedback[:user_agent] = request.user_agent feedback[:time] = Time.current
Add return_to url to the technical feedback
diff --git a/app/controllers/voting_app/requests_controller.rb b/app/controllers/voting_app/requests_controller.rb index abc1234..def5678 100644 --- a/app/controllers/voting_app/requests_controller.rb +++ b/app/controllers/voting_app/requests_controller.rb @@ -24,10 +24,10 @@ end private - + def filter_requests(time, category) @requests = Request.where(state: ['promoted','accepted', 'rejected', 'done']) - @requests = @requests.send(category) + @requests = @requests.send(category) unless category == 'all' @requests = @requests.send("in_last_" + time) unless time == 'all' @requests end
Add 'all' filter to categories
diff --git a/tasks/helper_testing.rake b/tasks/helper_testing.rake index abc1234..def5678 100644 --- a/tasks/helper_testing.rake +++ b/tasks/helper_testing.rake @@ -0,0 +1,21 @@+desc 'Run all unit, functional, helper and integration tests' +task :test do + errors = %w(test:units test:functionals test:helpers test:integration).collect do |task| + begin + Rake::Task[task].invoke + nil + rescue => e + task + end + end.compact + abort "Errors running #{errors.to_sentence}!" if errors.any? +end + +namespace :test do + Rake::TestTask.new(:helpers => "db:test:prepare") do |t| + t.libs << "test" + t.pattern = 'test/helpers/**/*_test.rb' + t.verbose = true + end + Rake::Task['test:units'].comment = "Run the helper tests in test/helpers" +end
Add rake tasks for helper tests, and modify Rails "rake test" to include helper tests.
diff --git a/recipes/mod_pagespeed.rb b/recipes/mod_pagespeed.rb index abc1234..def5678 100644 --- a/recipes/mod_pagespeed.rb +++ b/recipes/mod_pagespeed.rb @@ -31,11 +31,6 @@ apache_module 'pagespeed' do conf true - if node['apache']['version'] == '2.2' - filename 'mod_pagespeed.so' - elsif node['apache']['version'] == '2.4' - filename 'mod_pagespeed_ap24.so' - end end else Chef::Log.warn "apache::mod_pagespeed does not support #{node['platform_family']} yet, and is not being installed"
Revert "add support for 2.2/2.4 module loading" This reverts commit b86ff4f597508d5a38c358afcb26c756c009f50f.
diff --git a/templates/model_sqlite.rb b/templates/model_sqlite.rb index abc1234..def5678 100644 --- a/templates/model_sqlite.rb +++ b/templates/model_sqlite.rb @@ -0,0 +1,74 @@+begin + require "bundler/inline" +rescue LoadError => e + $stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler" + raise e +end + +gemfile(true) do + source "https://rubygems.org" + + gem "rake" + gem "hanami-model", github: "hanami/model" + gem "sqlite3" + gem "rspec" + gem "rspec-core" +end + +require 'hanami/model' +require 'hanami/model/sql' + +Hanami::Model.configure do + adapter :sql, "sqlite:///#{Dir.pwd}/hanami_model_template.db" +end + +Hanami::Model.migration do + change do + create_table :authors do + primary_key :id + + column :name, String + end + + create_table :books do + primary_key :id + + foreign_key :author_id, :authors, null: false + + column :title, String + end + end +end.run + +class Book < Hanami::Entity +end + +class BookRepository < Hanami::Repository +end + +class Author < Hanami::Entity +end + +class AuthorRepository < Hanami::Repository + associations do + has_many :books + end + + def add_book(author, data) + assoc(:books, author).add(data) + end +end + +Hanami::Model.load! + +require 'rspec' +require 'rspec/autorun' + +RSpec.describe 'Model' do + let(:author_repository) { AuthorRepository.new } + let(:book_repository) { BookRepository.new } + + subject { author_repository.create(name: "Leo Tolstoy") } + + it { expect { subject }.to change { author_repository.all.count }.by(1) } +end
Create simple one file template for hanami model with sqlite adapter
diff --git a/test/app/controllers/admin/resources/format_test.rb b/test/app/controllers/admin/resources/format_test.rb index abc1234..def5678 100644 --- a/test/app/controllers/admin/resources/format_test.rb +++ b/test/app/controllers/admin/resources/format_test.rb @@ -11,7 +11,7 @@ class Admin::EntriesControllerTest < ActionController::TestCase setup do - @request.session[:typus_user_id] = FactoryGirl.create(:typus_user).id + admin_sign_in end test "export csv" do
Use admin_sign_in helper on FormatTest.
diff --git a/marso.gemspec b/marso.gemspec index abc1234..def5678 100644 --- a/marso.gemspec +++ b/marso.gemspec @@ -8,10 +8,9 @@ spec.version = Marso::VERSION spec.authors = ["Nicolas Dao"] spec.email = ["nicolas@quivers.com"] - spec.homepage = ["https://github.com/nicolasdao/marso"] + spec.homepage = "https://github.com/nicolasdao/marso" spec.summary = %q{Marso is a lightweight BDD project} spec.description = %q{Marso is the beginning of a small lightweight BDD project. Currently, this is just a very simple code sample that only displays a custom message in green or in red depending on the value of a predicate.} - spec.homepage = "" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0") @@ -20,7 +19,7 @@ spec.require_paths = ["lib"] spec.add_development_dependency "bundler", "~> 1.6" - spec.add_development_dependency "rake" - spec.add_runtime_dependency "colorize" - spec.add_runtime_dependency "watir-webdriver", "~>0.6.9" + spec.add_development_dependency "rake", "~> 10.3" + spec.add_runtime_dependency "colorize", "~> 0.7" + spec.add_runtime_dependency "watir-webdriver", "~>0.6" end
Fix the gemspec so there are no more warnings during the gem build
diff --git a/spec/patron_spec_helper.rb b/spec/patron_spec_helper.rb index abc1234..def5678 100644 --- a/spec/patron_spec_helper.rb +++ b/spec/patron_spec_helper.rb @@ -10,6 +10,7 @@ sess.connect_timeout = 10 sess.timeout = 10 + sess.max_redirects = 0 response = sess.request(method, "#{uri.path}#{uri.query ? '?' : ''}#{uri.query}", options[:headers] || {}, { :data => options[:body]
Disable redirect handling when running Patron specs Patron's default settings allow it to automatically follow up to 5 redirects. Since example.com has started issuing a 302 Found response, patron's behavior deviates from other backends.
diff --git a/db/migrate/20121001085315_change_attachment_dir_name.rb b/db/migrate/20121001085315_change_attachment_dir_name.rb index abc1234..def5678 100644 --- a/db/migrate/20121001085315_change_attachment_dir_name.rb +++ b/db/migrate/20121001085315_change_attachment_dir_name.rb @@ -1,9 +1,9 @@ class ChangeAttachmentDirName < ActiveRecord::Migration def up - ActiveRecord::Base.connection.execute("UPDATE paperclipdb SET dir_name='/paperclipdb'+dir_name") + Paperclipdb::Attachment.all.each{|a| a.update_attribute(:dir_name, "/paperclipdb#{a.dir_name}") unless a.dir_name.start_with?("/paperclipdb")} end def down - ActiveRecord::Base.connection.execute("UPDATE paperclipdb SET dir_name=REPLACE(dir_name, '/paperclipdb', '')") + Paperclipdb::Attachment.all.each{|a| a.update_attribute(:dir_name, a.dir_name.gsub("/paperclipdb/", "/")) if a.dir_name.start_with?("/paperclipdb")} end end
Add correct migration to update routes in db
diff --git a/app/controllers/observer_controller/info_controller.rb b/app/controllers/observer_controller/info_controller.rb index abc1234..def5678 100644 --- a/app/controllers/observer_controller/info_controller.rb +++ b/app/controllers/observer_controller/info_controller.rb @@ -1,17 +1,18 @@ # TODO: move this into a new InfoController +# Display canned informations about site class ObserverController # Intro to site. - def intro # :nologin: + def intro store_location end # Recent features. - def news # :nologin: + def news store_location end # Help page. - def how_to_use # :nologin: + def how_to_use store_location @min_pos_vote = Vote.confidence(Vote.min_pos_vote) @min_neg_vote = Vote.confidence(Vote.min_neg_vote) @@ -19,26 +20,21 @@ end # A few ways in which users can help. - def how_to_help # :nologin: + def how_to_help store_location end - def wrapup_2011 # :nologin: + def wrapup_2011 store_location end - # Disable cop as a temporary measure to make Codeclimate pass - # because :nologin: might have to be on same line as def - # rubocop:disable Style/CommentedKeyword - # linked from search bar - def search_bar_help # :nologin: + def search_bar_help store_location end - # rubocop:enable Style/CommentedKeyword # Simple form letting us test our implementation of Textile. - def textile_sandbox # :nologin: + def textile_sandbox if request.method != "POST" @code = nil else @@ -49,9 +45,9 @@ end # I keep forgetting the stupid "_sandbox" thing. - alias_method :textile, :textile_sandbox # :nologin: + alias_method :textile, :textile_sandbox # Allow translator to enter a special note linked to from the lower left. - def translators_note # :nologin: + def translators_note end end
Delete :nologin: magic comment stuff in InfoController It offends RuboCop and we can get rid of it. See https://www.pivotaltracker.com/story/show/165520354
diff --git a/Cachyr.podspec b/Cachyr.podspec index abc1234..def5678 100644 --- a/Cachyr.podspec +++ b/Cachyr.podspec @@ -14,7 +14,7 @@ DESC s.homepage = "https://github.com/YR/Cachyr" s.license = { :type => "MIT", :file => "LICENSE" } - s.author = { "Yr" => "yr-test@nrk.no" } + s.author = { "Yr" => "mobil-tilbakemelding@nrk.no" } s.social_media_url = "" s.ios.deployment_target = "8.0" s.osx.deployment_target = "10.10"
Use mobil-tilbakemelding@nrk.no for author email
diff --git a/Aardvark.podspec b/Aardvark.podspec index abc1234..def5678 100644 --- a/Aardvark.podspec +++ b/Aardvark.podspec @@ -2,7 +2,7 @@ s.name = 'Aardvark' s.version = '1.0.0' s.license = 'Apache' - s.summary = 'Aardvark is a threadsafe library that makes it dead simple to create actionable bug reports within your app without impacting performance.' + s.summary = 'Aardvark is a library that makes it dead simple to create actionable bug reports.' s.homepage = 'https://stash.corp.squareup.com/projects/IOS/repos/aardvark/browse' s.authors = { 'Dan Federman' => 'federman@squareup.com' } s.source = { :git => 'https://stash.corp.squareup.com/scm/ios/aardvark.git', :tag => s.version }
Update podspec to be in line with README summary
diff --git a/config/initializers/slack_notifier.rb b/config/initializers/slack_notifier.rb index abc1234..def5678 100644 --- a/config/initializers/slack_notifier.rb +++ b/config/initializers/slack_notifier.rb @@ -1,5 +1,4 @@ Rails.application.config.slack_notifier = Slack::Notifier.new ENV["SLACK_WEBHOOK_URL"] do - defaults channel: ENV.fetch("SLACK_DEFAULT_CHANNEL", "#general"), - username: ENV.fetch("SLACK_NAME", "tokite"), + defaults username: ENV.fetch("SLACK_NAME", "tokite"), icon_emoji: ":sunglasses:" end
Remove unused default channel config
diff --git a/spec/jasmine_selenium_runner/configure_jasmine_spec.rb b/spec/jasmine_selenium_runner/configure_jasmine_spec.rb index abc1234..def5678 100644 --- a/spec/jasmine_selenium_runner/configure_jasmine_spec.rb +++ b/spec/jasmine_selenium_runner/configure_jasmine_spec.rb @@ -4,49 +4,25 @@ require 'jasmine_selenium_runner/configure_jasmine' describe "Configuring jasmine" do - - class FakeConfig - attr_accessor :port, :runner - end - - def configure - Dir.stub(:pwd).and_return(working_dir) - Jasmine.stub(:configure).and_yield(fake_config) - JasmineSeleniumRunner::ConfigureJasmine.install_selenium_runner - end - - def stub_config_file(config_obj) - config_path = File.join(working_dir, 'spec', 'javascripts', 'support', 'jasmine_selenium_runner.yml') - File.stub(:exist?).with(config_path).and_return(true) - File.stub(:read).with(config_path).and_return(YAML.dump(config_obj)) - end - - let(:working_dir) { 'hi' } - let(:fake_config) { FakeConfig.new } + let(:configurer) { JasmineSeleniumRunner::ConfigureJasmine.new(nil, nil, config) } context "when a custom selenium server is specified" do - before do - stub_config_file 'selenium_server' => 'http://example.com/selenium/stuff' - configure - end + let(:config) { { 'selenium_server' => 'http://example.com/selenium/stuff' }} it "make a webdriver pointing to the custom server" do Selenium::WebDriver.should_receive(:for).with(:remote, hash_including(url: 'http://example.com/selenium/stuff')) - fake_config.runner.call(nil, nil) + configurer.make_runner end end context "when the user wants firebug installed" do - before do - stub_config_file 'browser' => 'firefox-firebug' - configure - end + let(:config) { { 'browser' => 'firefox-firebug' } } it "should create a firebug profile and pass that to WebDriver" do profile = double(:profile, enable_firebug: nil) Selenium::WebDriver::Firefox::Profile.stub(:new).and_return(profile) Selenium::WebDriver.should_receive(:for).with('firefox-firebug'.to_sym, {profile: profile}) - fake_config.runner.call(nil, nil) + configurer.make_runner end end end
Update configurer specs for new structure
diff --git a/spec/views/miq_policy/_alert_details.html.haml_spec.rb b/spec/views/miq_policy/_alert_details.html.haml_spec.rb index abc1234..def5678 100644 --- a/spec/views/miq_policy/_alert_details.html.haml_spec.rb +++ b/spec/views/miq_policy/_alert_details.html.haml_spec.rb @@ -0,0 +1,15 @@+describe "miq_policy/_alert_details.html.haml" do + before do + @alert = FactoryGirl.create(:miq_alert) + exp = {:eval_method => 'nothing', :mode => 'internal', :options => {}} + allow(@alert).to receive(:expression).and_return(exp) + set_controller_for_view("miq_policy") + end + + it "Trap Number is displayed correctly" do + opts = {:notifications => {:snmp => {:host => ['test.test.org'], :snmp_version => 'v1', :trap_id => '42'}}} + allow(@alert).to receive(:options).and_return(opts) + render :partial => "miq_policy/alert_details" + expect(rendered).to include('Trap Number') + end +end
Test for displaying Trap Number https://bugzilla.redhat.com/show_bug.cgi?id=1381969
diff --git a/Formula/sdl.rb b/Formula/sdl.rb index abc1234..def5678 100644 --- a/Formula/sdl.rb +++ b/Formula/sdl.rb @@ -13,8 +13,6 @@ inreplace files, '@prefix@', HOMEBREW_PREFIX end - fails_with_llvm :build => 2335 # 2335.15.0 to be exact - def install Sdl.use_homebrew_prefix %w[sdl.pc.in sdl-config.in] @@ -23,8 +21,8 @@ system "./autogen.sh" if ARGV.build_head? args = %W[--prefix=#{prefix} --disable-nasm] - # On Lion, LLVM-GCC chokes on the assembly code packaged with SDL. - args << '--disable-assembly' if ENV.compiler == :llvm and MacOS.lion? + # LLVM-based compilers choke on the assembly code packaged with SDL. + args << '--disable-assembly' if ENV.compiler == :llvm or ENV.compiler == :clang system './configure', *args system "make install"
SDL: Disable assembly when compiling with Clang Should have been rolled into the last commit. Troll needs coffee badly.
diff --git a/app/helpers/admin/resources/data_types/string_helper.rb b/app/helpers/admin/resources/data_types/string_helper.rb index abc1234..def5678 100644 --- a/app/helpers/admin/resources/data_types/string_helper.rb +++ b/app/helpers/admin/resources/data_types/string_helper.rb @@ -1,7 +1,7 @@ module Admin::Resources::DataTypes::StringHelper def display_string(item, attribute) - item.send(attribute) + item.send(attribute) || mdash end alias_method :display_decimal, :display_string
Call 'mdash' if string to display is nil.