diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/kckstrt.rb b/lib/kckstrt.rb index abc1234..def5678 100644 --- a/lib/kckstrt.rb +++ b/lib/kckstrt.rb @@ -20,23 +20,26 @@ c.switch [:f, :force] c.action do |global_options, options, args| - forced = global_options[:force] || options[:force] - generate_app(args.first, forced) + @options = { + forced: global_options[:force] || options[:force] + } + + generate_app(args.first) end end - def self.generate_app(app_name, forced) + def self.generate_app(app_name) return say('Please specify an app name. See `kckstrt generate --help`.') unless app_name @dirname = app_name.underscore @app_name = @dirname.camelize - mkdir(@dirname, forced) + mkdir(@dirname) copy_templates(@dirname) end - def self.mkdir(dirname, forced) - return say("“#{dirname}” folder is not empty. Use the --force flag to overwrite.") if File.directory?(dirname) && !forced + def self.mkdir(dirname) + return say("“#{dirname}” folder is not empty. Use the --force flag to overwrite.") if File.directory?(dirname) && !@options[:forced] FileUtils.rm_rf(dirname) Dir.mkdir(dirname)
Use global `@options` instead of parameters
diff --git a/myprecious.gemspec b/myprecious.gemspec index abc1234..def5678 100644 --- a/myprecious.gemspec +++ b/myprecious.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'myprecious' - s.version = '0.0.4' + s.version = '0.0.6' s.date = '2017-04-26' s.summary = "Your precious dependencies!" s.description = "A simple, markdown generated with information about your gems" @@ -8,6 +8,7 @@ s.email = 'balki.kodarapu@gmail.com' s.files = ["lib/myprecious.rb"] s.executables << 'myprecious' + s.add_runtime_dependency 'gems', '~> 1.0', '>= 1.0.0' s.homepage = 'http://rubygems.org/gems/myprecious' s.license = 'MIT'
Add runtime dependencies to gem spec file
diff --git a/lib/lyricfy.rb b/lib/lyricfy.rb index abc1234..def5678 100644 --- a/lib/lyricfy.rb +++ b/lib/lyricfy.rb @@ -18,7 +18,7 @@ metro_lyrics: MetroLyrics } - if !args.empty? + unless args.empty? passed_providers = {} args.each do |provider| raise Exception unless @providers.has_key?(provider)
Use unless for more idiomatic condition in Lyricfy::Fetcher
diff --git a/test/models/tasks_test.rb b/test/models/tasks_test.rb index abc1234..def5678 100644 --- a/test/models/tasks_test.rb +++ b/test/models/tasks_test.rb @@ -1,7 +1,20 @@ require 'test_helper' class TasksTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end + + test "should not create a task without name" do + task = Task.create + + assert_not task.save + end + + test "should create a task with a true status" do + task = Task.create name: 'my test task' + task.save + + assert task.status + + task.destroy + end + end
Add unit tests to task model.
diff --git a/obtuse.gemspec b/obtuse.gemspec index abc1234..def5678 100644 --- a/obtuse.gemspec +++ b/obtuse.gemspec @@ -8,9 +8,11 @@ gem.version = Obtuse::VERSION gem.authors = ["Utkarsh Kukreti"] gem.email = ["utkarshkukreti@gmail.com"] - gem.description = %q{TODO: Write a gem description} - gem.summary = %q{TODO: Write a gem summary} - gem.homepage = "" + gem.description = "A Stack-oriented programming language, optimized for " + + "brevity." + gem.summary = "A Stack-oriented programming language, optimized for " + + "brevity." + gem.homepage = "https://github.com/utkarshkukreti/obtuse" gem.files = `git ls-files`.split($/) gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
Add description, summary, and homepage in the gemspec.
diff --git a/test/test_deprecations.rb b/test/test_deprecations.rb index abc1234..def5678 100644 --- a/test/test_deprecations.rb +++ b/test/test_deprecations.rb @@ -2,6 +2,10 @@ class TestDeprecations < Test::Unit::TestCase context "with Gelf object" do + should "fail" do + flunk "Hello Hudson!" + end + setup do @verbose, $VERBOSE = $VERBOSE, nil @g = Gelf.new('host', 12345)
Break gem test to test Hudson.
diff --git a/lib/day08.rb b/lib/day08.rb index abc1234..def5678 100644 --- a/lib/day08.rb +++ b/lib/day08.rb @@ -5,20 +5,21 @@ end def escape_overhead(escaped_string) - result = 2 - result += escaped_string.scan(/\\\\/).size - result += escaped_string.scan(/\\"/).size - result += escaped_string.scan(/\\x[a-f0-9]{2}/).size * 3 + result = 2 + + escaped_string.scan(/\\\\/).size + + escaped_string.scan(/\\"/).size + + escaped_string.scan(/\\x[a-f0-9]{2}/).size * 3 + # NOTE(hofer): Edge case: Escaped backslash at end of line, don't count \" separately - result -= 1 if escaped_string =~ /\\"$/ - - result + if escaped_string =~ /\\"$/ + result - 1 + else + result + end end def escaped_escape_overhead(escaped_string) - result = 2 # For backslashes that will escape the surrounding escaped quotes - result += escaped_string.scan(/\\/).size - result += escaped_string.scan(/\"/).size # Includes surrounding quotes that get escaped - - result + 2 + # For backslashes that will escape the surrounding escaped quotes + escaped_string.scan(/\\/).size + + escaped_string.scan(/\"/).size # Includes surrounding quotes that get escaped end
Simplify day 8 a bit.
diff --git a/tty-tree.gemspec b/tty-tree.gemspec index abc1234..def5678 100644 --- a/tty-tree.gemspec +++ b/tty-tree.gemspec @@ -6,7 +6,7 @@ spec.name = "tty-tree" spec.version = TTY::Tree::VERSION spec.authors = ["Piotr Murach"] - spec.email = [""] + spec.email = ["me@piotrmurach.com"] spec.summary = %q{Print directory or structured data in a tree like format.} spec.description = %q{Print directory or structured data in a tree like format.} @@ -21,7 +21,7 @@ spec.required_ruby_version = '>= 2.0.0' - spec.add_development_dependency "bundler", "~> 2.0" - spec.add_development_dependency "rake", "~> 10.0" + spec.add_development_dependency "bundler", ">= 1.14.0" + spec.add_development_dependency "rake" spec.add_development_dependency "rspec", "~> 3.0" end
Change to relax dev deps
diff --git a/lib/title.rb b/lib/title.rb index abc1234..def5678 100644 --- a/lib/title.rb +++ b/lib/title.rb @@ -1,3 +1,6 @@+app = File.expand_path('../../app', __FILE__) +$LOAD_PATH.unshift(app) unless $LOAD_PATH.include?(app) + require 'title/version' require 'rails/engine' require 'title/engine'
Add app back into load path I bet this is an API change in Rails sometime but this is an easy fix. Maybe I'll come back to it later.
diff --git a/ruby_event_store/spec/actions/delete_stream_events_spec.rb b/ruby_event_store/spec/actions/delete_stream_events_spec.rb index abc1234..def5678 100644 --- a/ruby_event_store/spec/actions/delete_stream_events_spec.rb +++ b/ruby_event_store/spec/actions/delete_stream_events_spec.rb @@ -2,7 +2,6 @@ module RubyEventStore RSpec.describe Client do - let(:stream_name) { 'stream_name' } specify 'raise exception if stream name is incorrect' do client = RubyEventStore::Client.new(repository: InMemoryRepository.new)
Remove unused let var in client spec
diff --git a/workable.gemspec b/workable.gemspec index abc1234..def5678 100644 --- a/workable.gemspec +++ b/workable.gemspec @@ -23,6 +23,4 @@ spec.add_development_dependency 'rspec', '~> 3.1.0' spec.add_development_dependency 'webmock', '~> 1.20.4' spec.add_development_dependency 'coveralls', '~> 0.8.9' - spec.add_development_dependency 'guard', '~> 2.12' - spec.add_development_dependency 'guard-rspec', '~> 4.5' end
Make guard a soft dev-dependency
diff --git a/db/migrate/20130220162840_add_document_type_and_slug_to_unpublishings.rb b/db/migrate/20130220162840_add_document_type_and_slug_to_unpublishings.rb index abc1234..def5678 100644 --- a/db/migrate/20130220162840_add_document_type_and_slug_to_unpublishings.rb +++ b/db/migrate/20130220162840_add_document_type_and_slug_to_unpublishings.rb @@ -1,6 +1,30 @@ class AddDocumentTypeAndSlugToUnpublishings < ActiveRecord::Migration - def change + class Unpublishing < ActiveRecord::Base; end + + def up add_column :unpublishings, :document_type, :string add_column :unpublishings, :slug, :string + + unpublishing_slug_fixes = { + 96932 => ['StatisticalDataSet', 'mix-adjusted-prices'], + 101951 => ['DetailedGuide', 'case-programme'], + 70963 => ['Publication', 'national-resilience-extranet-documents'], + 88475 => ['Publication', 'capital-for-enterprise-ltd-government-procurement-card-spend-over-500-for-2012-to-2013'], + 96932 => ['StatisticalDataSet', 'mix-adjusted-prices'], + 96937 => ['StatisticalDataSet', 'live-tables-on-house-price-index'], + 96882 => ['NewsArticle', 'welcome-to-the-new-home-on-the-web-for-the-office-of-the-advocate-general'], + } + + unpublishing_slug_fixes.each do |edition_id, (document_type, slug)| + unpublishing = Unpublishing.find_by_edition_id(edition_id) + if unpublishing + unpublishing.update_attributes(document_type: document_type, slug: slug) + end + end end -end + + def down + remove_column :unpublishings, :document_type + remove_column :unpublishings, :slug + end +end
Correct slugs and edition types for existing unpublishings The few existing unpublishings had lost the information about the original url, because the title of the last edition has been changed.
diff --git a/recipes/deb.rb b/recipes/deb.rb index abc1234..def5678 100644 --- a/recipes/deb.rb +++ b/recipes/deb.rb @@ -11,3 +11,12 @@ dpkg_package "#{Chef::Config[:file_cache_path]}/#{filename}" do action :install end + +ruby_block "Set heap size in /etc/default/elasticsearch" do + block do + fe = Chef::Util::FileEdit.new("/etc/default/elasticsearch") + fe.insert_line_if_no_match(/ES_HEAP_SIZE=/, "ES_HEAP_SIZE=#{node.elasticsearch[:allocated_memory]}") + fe.search_file_replace_line(/ES_HEAP_SIZE=/, "ES_HEAP_SIZE=#{node.elasticsearch[:allocated_memory]}") # if the value has changed but the line exists in the file + fe.write_file + end +end
Use the heap size set in Chef via /etc/default/elasticsearch
diff --git a/has_breadcrumb.gemspec b/has_breadcrumb.gemspec index abc1234..def5678 100644 --- a/has_breadcrumb.gemspec +++ b/has_breadcrumb.gemspec @@ -6,7 +6,7 @@ Gem::Specification.new do |gem| gem.name = "has_breadcrumb" gem.version = HasBreadcrumb::VERSION - gem.authors = ["Tim Harvey"] + gem.authors = ["Tim Harvey", "Matt Outten"] gem.email = ["developers@squaremouth.com"] gem.description = %q{Provide breadcrumb links.} gem.summary = %q{Provide links for the current page in a breadcrumb format.}
Add Matt Outten to the authors in gemspec This commit adds Matt as an author to this gem as he and Tim were the original coders on the project.
diff --git a/spec/omniauth/strategies/madmimi_spec.rb b/spec/omniauth/strategies/madmimi_spec.rb index abc1234..def5678 100644 --- a/spec/omniauth/strategies/madmimi_spec.rb +++ b/spec/omniauth/strategies/madmimi_spec.rb @@ -16,7 +16,7 @@ end it 'should have correct site' do - subject.options.client_options.site.should eq('http://localhost:3000') + subject.options.client_options.site.should eq('https://madmimi.com') end end
Fix test for default site location
diff --git a/app/controllers/physical_infra_topology_controller.rb b/app/controllers/physical_infra_topology_controller.rb index abc1234..def5678 100644 --- a/app/controllers/physical_infra_topology_controller.rb +++ b/app/controllers/physical_infra_topology_controller.rb @@ -2,5 +2,5 @@ @layout = "physical_infra_topology" @service_class = PhysicalInfraTopologyService - menu_section :inf + menu_section :phy end
Fix menu selection when on physical infra topology view
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index abc1234..def5678 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,4 +1,45 @@ require 'rails_helper' describe User do + subject(:user) { build :user } + + describe '#full_name' do + it 'returns the full name' do + expect(user.full_name) + .to eq("#{user.first_name} #{user.last_name}") + end + end + + describe '#to_s' do + it 'returns the full name' do + expect(user.to_s).to eq(user.full_name) + end + end + + describe '.email' do + context 'is valid' do + before { subject.email = "valid@email.com" } + it "passes validation" do + subject.valid? + expect(subject.errors[:email].size).to eq(0) + end + end + + context 'is invalid' do + before { subject.email = "invalid-email" } + it "fails validation" do + subject.valid? + expect(subject.errors[:email].size).to eq(1) + end + end + + context 'is missing' do + before { subject.email = nil } + it "fails validation" do + subject.valid? + expect(subject.errors[:email].size).to eq(2) + end + end + end + end
Add some examples for the user.
diff --git a/test/integration/ebs/serverspec/default_spec.rb b/test/integration/ebs/serverspec/default_spec.rb index abc1234..def5678 100644 --- a/test/integration/ebs/serverspec/default_spec.rb +++ b/test/integration/ebs/serverspec/default_spec.rb @@ -1,19 +1,15 @@ require 'spec_helper' describe 'LVM Pool' do - { - '/dev/xvde' => '/mnt/ebs0' - }.each do |device, mountpoint| - describe file(mountpoint) do - it do - is_expected.to be_mounted.with( - device: device, - type: 'ext3', - options: { - rw: true - } - ) - end + describe file('/mnt/ebs0') do + it do + is_expected.to be_mounted.with( + device: '/dev/xvde', + type: 'ext4', + options: { + rw: true + } + ) end end
Remove unnecessary loop code from ebs test
diff --git a/spec/unit/spec_helper.rb b/spec/unit/spec_helper.rb index abc1234..def5678 100644 --- a/spec/unit/spec_helper.rb +++ b/spec/unit/spec_helper.rb @@ -19,4 +19,5 @@ end Itamae::Logger.log_device = StringIO.new +Specinfra.configuration.error_on_missing_backend_type = false
Set error_on_missing_backend_type false in unit tests.
diff --git a/recipes/default.rb b/recipes/default.rb index abc1234..def5678 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -23,11 +23,11 @@ ControlGroups.config_struct_init(node) ControlGroups.rules_struct_init(node) c = Chef::Resource::File.new('/etc/cgconfig.conf', run_context) - c.content ControlGroups.build_config(node[:control_groups][:config]) + c.content ControlGroups.build_config(node.run_state[:control_groups][:config]) c.run_action(:create) Chef::Resource::Service.new('cgconfig', run_context).run_action(:restart) if c.updated_by_last_action? r = Chef::Resource::File.new('/etc/cgrules.conf', run_context) - r.content ControlGroups.build_rules(node[:control_groups][:rules][:active]) + r.content ControlGroups.build_rules(node.run_state[:control_groups][:rules][:active]) res = r.run_action(:create) Chef::Resource::Service.new('cgred', run_context).run_action(:restart) if r.updated_by_last_action? end
Update to use run state over node attributes
diff --git a/recipes/default.rb b/recipes/default.rb index abc1234..def5678 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -30,14 +30,15 @@ end gunicorn do - only_if { node['roles'].include? 'ganeti_web_application_server' } - app_module "ganeti_web" - port 8000 + only_if { node['roles'].include? 'ganeti_webmgr_application_server' } + app_module :django + port 8080 + loglevel "debug" end nginx_load_balancer do - only_if { node['roles'].include? 'ganeti_web_load_balancer' } - application_port 8000 + only_if { node['roles'].include? 'ganeti_webmgr_load_balancer' } + application_port 8080 static_files "/static" => "static" end
Change ports, and role names
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 @@ # limitations under the License. # -Chef::Log.info("Chef Handlers will be located at: #{node['chef_handler']['handler_path']}") +Chef::Log.debug("Chef Handlers will be located at: #{node['chef_handler']['handler_path']}") remote_directory node['chef_handler']['handler_path'] do source 'handlers'
Reduce handler location log level to debug
diff --git a/recipes/install.rb b/recipes/install.rb index abc1234..def5678 100644 --- a/recipes/install.rb +++ b/recipes/install.rb @@ -22,6 +22,6 @@ include_recipe 'apt' end -include_recipe 'yum::epel' if node['platform_family'] == 'rhel' +include_recipe 'yum-epel' if node['platform_family'] == 'rhel' package 'openvpn'
Use yum-epel default recipe not yum::epel.
diff --git a/lib/browserstack.rb b/lib/browserstack.rb index abc1234..def5678 100644 --- a/lib/browserstack.rb +++ b/lib/browserstack.rb @@ -13,7 +13,10 @@ def snapshot(url) driver = Selenium::WebDriver.for(:remote, :url => get_url, - :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.firefox) + :desired_capabilities => { + browser: "Firefox", + project: "snap-it-up" + }) driver.navigate.to url image = driver.screenshot_as(:png) driver.quit
Set a project name in Browserstack so we can tell what is taking a snapshot.
diff --git a/lib/dimples/post.rb b/lib/dimples/post.rb index abc1234..def5678 100644 --- a/lib/dimples/post.rb +++ b/lib/dimples/post.rb @@ -12,11 +12,8 @@ @metadata[:layout] ||= @site.config.layouts.post @metadata[:date] = Date.new(parts[1].to_i, parts[2].to_i, parts[3].to_i) - @metadata[:year] = @metadata[:date].strftime('%Y') - @metadata[:month] = @metadata[:date].strftime('%m') - @metadata[:day] = @metadata[:date].strftime('%d') - @metadata[:slug] = parts[4] + @metadata[:categories] ||= [] end private
Remove the date parts and set a default empty categories array
diff --git a/resources/check.rb b/resources/check.rb index abc1234..def5678 100644 --- a/resources/check.rb +++ b/resources/check.rb @@ -28,8 +28,8 @@ # Name of the nrpe check, used for the filename and the command name attribute :command_name, :kind_of => String, :name_attribute => true -attribute :warning_condition, :kind_of => String, :default => nil -attribute :critical_condition, :kind_of => String, :default => nil +attribute :warning_condition, :kind_of => [Integer, String], :default => nil +attribute :critical_condition, :kind_of => [Integer, String], :default => nil attribute :command, :kind_of => String attribute :parameters, :kind_of => String, :default => nil
Allow warning/critical condition in LRWP to be both Int/String
diff --git a/Casks/corsixth.rb b/Casks/corsixth.rb index abc1234..def5678 100644 --- a/Casks/corsixth.rb +++ b/Casks/corsixth.rb @@ -8,5 +8,7 @@ homepage 'https://github.com/CorsixTH/CorsixTH' license :mit - app 'CorsixTH.app' + app 'CorsixTH/CorsixTH.app' + app 'CorsixTH/AnimView.app' + app 'CorsixTH/MapEdit.app' end
Fix path to CorsixTH app
diff --git a/app/controllers/letter_opener_web/application_controller.rb b/app/controllers/letter_opener_web/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/letter_opener_web/application_controller.rb +++ b/app/controllers/letter_opener_web/application_controller.rb @@ -2,5 +2,6 @@ module LetterOpenerWeb class ApplicationController < ActionController::Base + protect_from_forgery with: :exception end end
Add Rails' built-in CSRF protection
diff --git a/app/controllers/publications/users/categories_controller.rb b/app/controllers/publications/users/categories_controller.rb index abc1234..def5678 100644 --- a/app/controllers/publications/users/categories_controller.rb +++ b/app/controllers/publications/users/categories_controller.rb @@ -2,6 +2,6 @@ def show @user = User.find(params[:user_id]) @category = @user.publication_categories.find(params[:id]) - @posts = @category.publication_posts + @posts = @category.publication_posts.visible end end
Hide invisible posts in user categories
diff --git a/GPActivityViewController.podspec b/GPActivityViewController.podspec index abc1234..def5678 100644 --- a/GPActivityViewController.podspec +++ b/GPActivityViewController.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'GPActivityViewController' - s.version = '1.3.1' + s.version = '1.3.2' s.authors = { 'Gleb Pinigin' => 'gpinigin@gmail.com' } s.homepage = 'https://github.com/gpinigin/GPActivityViewController' s.summary = 'Alternative to UIActivityViewController compatible with iOS5.0.' @@ -21,7 +21,7 @@ s.ios.weak_frameworks = 'Social' s.dependency 'AFNetworking', '~> 1.2' - s.dependency 'Facebook-iOS-SDK', '~> 3.6' + s.dependency 'Facebook-iOS-SDK', '~> 3.16.0' s.dependency 'DEFacebookComposeViewController', '~> 1.0.0' s.dependency 'REComposeViewController', '~> 2.0.3' end
Update facebook dependency to restore compilation on iOS5
diff --git a/lib/gollum-lib/macro/note.rb b/lib/gollum-lib/macro/note.rb index abc1234..def5678 100644 --- a/lib/gollum-lib/macro/note.rb +++ b/lib/gollum-lib/macro/note.rb @@ -1,10 +1,18 @@ module Gollum class Macro class Note < Gollum::Macro - def render(notice) - icon = Octicons::Octicon.new('info', {width: 24, height: 24}) - icon.options[:class] << ' mr-2' - "<div class='flash'>#{icon.to_svg}#{notice}</div>" + def render(notice, octicon = 'info') + icon = "" + unless octicon.empty? + begin + icon = Octicons::Octicon.new(octicon, {width: 24, height: 24}) + rescue RuntimeError + icon = Octicons::Octicon.new('info', {width: 24, height: 24}) + end + icon.options[:class] << ' mr-2' + icon = icon.to_svg + end + "<div class='flash'>#{icon}#{notice}</div>" end end end
Extend Note() macro with optional arg for changing the octicon.
diff --git a/lib/identity/cookie_coder.rb b/lib/identity/cookie_coder.rb index abc1234..def5678 100644 --- a/lib/identity/cookie_coder.rb +++ b/lib/identity/cookie_coder.rb @@ -11,7 +11,7 @@ end def encode(payload) - payload = JSON.parse(JSON.generate(payload)) # make sure all keys are string + payload = JSON.parse(JSON.generate(payload)) # make sure all keys are strings Fernet.generate(@keys.first) do |generator| generator.data = { "data" => payload } end @@ -46,7 +46,7 @@ verifier.enforce_ttl = false verifier.verify_token(cipher) - raise "cipher invalid" unless verifier.valid? + return nil unless verifier.valid? verifier.data["data"] end
Return nil when verifier is invalid
diff --git a/lib/marconiclient/logging.rb b/lib/marconiclient/logging.rb index abc1234..def5678 100644 --- a/lib/marconiclient/logging.rb +++ b/lib/marconiclient/logging.rb @@ -0,0 +1,21 @@+require 'logger' + +module Logging + def logger + @logger ||= Logging.logger_for(self.class.name) + end + + @loggers = {} + + class << self + def logger_for(classname) + @loggers[classname] ||= configure_logger_for(classname) + end + + def configure_logger_for(classname) + logger = Logger.new(STDOUT) + logger.progname = classname + logger + end + end +end
Add core transport. create/delete/exists for queues.
diff --git a/lib/last_hit/cli.rb b/lib/last_hit/cli.rb index abc1234..def5678 100644 --- a/lib/last_hit/cli.rb +++ b/lib/last_hit/cli.rb @@ -2,6 +2,8 @@ require 'yaml' class LastHit + class FileNotFound < StandardError; end + class Cli < Thor CONFIG_PATH = '~/last_hit.yml' @@ -9,8 +11,11 @@ class << self def load_config(path) + fail(FileNotFound, 'Config file not found') config = YAML.load_file(File.expand_path(path)) Configure.set(config) + rescue FileNotFound => e + $stdout.puts(e.message) end end
Raise error when file not found
diff --git a/lib/scaffolder/tool_index.rb b/lib/scaffolder/tool_index.rb index abc1234..def5678 100644 --- a/lib/scaffolder/tool_index.rb +++ b/lib/scaffolder/tool_index.rb @@ -5,6 +5,10 @@ def normalise(name) name.to_s.downcase.to_sym if name + end + + def fetch_tool_class(name) + tools[normalise(name)] end def known_tool?(name) @@ -26,14 +30,6 @@ end end - def tool_name(type) - type.to_s.capitalize - end - - def fetch_tool_class(type) - Scaffolder::Tool.const_get(tool_name(type)) - end - def [](type) if known_tool?(type) fetch_tool_class(type)
Remove tool class name method
diff --git a/lib/rails_ui_kit.rb b/lib/rails_ui_kit.rb index abc1234..def5678 100644 --- a/lib/rails_ui_kit.rb +++ b/lib/rails_ui_kit.rb @@ -1,5 +1,10 @@ require 'rails_ui_kit/engine' -require 'faker' + +if Gem::Specification.find_all_by_name('ffaker').any? + require 'ffaker' unless defined?(Faker) +else + require 'faker' unless defined?(Faker) +end module RailsUiKit end
Use ffaker gem if it exist in bundle to avoid collision with faker gem. (ffaker gem, for example, used in spree)
diff --git a/app/helpers/budgets_helper.rb b/app/helpers/budgets_helper.rb index abc1234..def5678 100644 --- a/app/helpers/budgets_helper.rb +++ b/app/helpers/budgets_helper.rb @@ -42,4 +42,9 @@ def investment_tags_select_options Budget::Investment.tags_on(:valuation).order(:name).select(:name).distinct end + + def budget_published?(budget) + !budget.drafting? || current_user&.administrator? + end + end
Add budget_published? helper method to BudgetHelper We need to check if the budget is in drafting phase to avoid showing it to the users, unless the current user is an administrator.
diff --git a/app/models/frontend_router.rb b/app/models/frontend_router.rb index abc1234..def5678 100644 --- a/app/models/frontend_router.rb +++ b/app/models/frontend_router.rb @@ -36,6 +36,8 @@ [ SuggestedChange, :id ] when /assertions?/ [ Assertion, :id ] + when /allele_registry/ + [ Variant, :allele_registry_id, ] else [] end
Add direct link to variants by allele registry id
diff --git a/spec/shexec/executor_spec.rb b/spec/shexec/executor_spec.rb index abc1234..def5678 100644 --- a/spec/shexec/executor_spec.rb +++ b/spec/shexec/executor_spec.rb @@ -1,12 +1,5 @@ require 'spec_helper' require 'stringio' - -# TODO Check whether rspec's output matcher has become thread-safe. -# It would be wonderful to do -# -# expect { shexec.run("echo", "Hello,", "world!") }.to output("Hello, world!\n").to_stdout -# -# But this issue prevents it: https://github.com/rspec/rspec-expectations/issues/642 describe Shexec::Executor do @@ -14,11 +7,8 @@ it "runs a command connected to $stdout and $stderr" do shexec = Shexec::Executor.new - expect($stdout).to receive(:write).with("Hello, world!\n") - shexec.run("echo", "Hello,", "world!") - - expect($stderr).to receive(:write).with(match(/No such file or directory/)) - shexec.run("cat", '/nosuch\file/or\directory') + expect { shexec.run("echo", "Hello,", "world!") }.to output("Hello, world!\n").to_stdout_from_any_process + expect { shexec.run("cat", '/nosuch\file/or\directory') }.to output(/No such file or directory/).to_stderr_from_any_process end it "does not pipe the caller's stdin into the command" do @@ -27,9 +17,8 @@ stdin_w.puts "Hello, world!\n" stdin_w.close - expect($stdout).to_not receive(:write).with("Hello, world!\n") shexec = Shexec::Executor.new - shexec.run("cat") + expect { shexec.run("cat") }.to_not output.to_stdout_from_any_process end end
Use rspec's new _from_any_process output modifiers
diff --git a/test/apps/queue_wait.ru b/test/apps/queue_wait.ru index abc1234..def5678 100644 --- a/test/apps/queue_wait.ru +++ b/test/apps/queue_wait.ru @@ -24,7 +24,7 @@ env['HTTP_X_REQUEST_START'] = "t=#{(Time.now.to_f * 1000000).to_i}".to_s sleep 0.02 when '/with_period' - env['HTTP_X_REQUEST_START'] = "%10.3f" % Time.now.to_f + env['HTTP_X_REQUEST_START'] = "%10.3f" % Time.now sleep 0.025 end @app.call(env)
Remove unneeded cast to float
diff --git a/spec/spec_helper/fixtures.rb b/spec/spec_helper/fixtures.rb index abc1234..def5678 100644 --- a/spec/spec_helper/fixtures.rb +++ b/spec/spec_helper/fixtures.rb @@ -7,6 +7,7 @@ class Command < CLAide::Command self.command = 'bin' + self.ansi_output = false class SpecFile < Command self.abstract_command = true @@ -48,5 +49,6 @@ class CommandPluginable < CLAide::Command self.plugin_prefix = 'fixture' + self.ansi_output = false end end
[Specs] Disable ANSI in fixture classes
diff --git a/src/bosh-template/bosh-template.gemspec b/src/bosh-template/bosh-template.gemspec index abc1234..def5678 100644 --- a/src/bosh-template/bosh-template.gemspec +++ b/src/bosh-template/bosh-template.gemspec @@ -10,7 +10,7 @@ spec.author = 'Pivotal' spec.email = 'support@cloudfoundry.com' spec.homepage = 'https://github.com/cloudfoundry/bosh' - spec.license = 'Apache 2.0' + spec.license = 'Apache-2.0' spec.required_ruby_version = Gem::Requirement.new('>= 1.9.3')
Fix the license string in the gemspec. [#150502401](https://www.pivotaltracker.com/story/show/150502401) Signed-off-by: Luan Santos <509a85c757dc22c0257f4655fb3fb682d42f965b@pivotal.io>
diff --git a/test/url_for_test.rb b/test/url_for_test.rb index abc1234..def5678 100644 --- a/test/url_for_test.rb +++ b/test/url_for_test.rb @@ -5,7 +5,7 @@ class UrlForTest < MiniTest::Unit::TestCase module UrlFor def url_for(*args) - @actual = args + args end end @@ -13,27 +13,27 @@ include SubdomainLocale::UrlFor def test_does_not_affect_if_there_is_no_locale - url_for(foo: 'bar') + @actual = url_for(foo: 'bar') assert_equal [{foo: 'bar'}], @actual end def test_does_not_affect_string_argument - url_for('/bar') + @actual = url_for('/bar') assert_equal ['/bar'], @actual end def test_replaces_locale_with_subdomain_and_forces_not_only_path - url_for(foo: 'bar', locale: :ru) + @actual = url_for(foo: 'bar', locale: :ru) assert_equal [{foo: 'bar', subdomain: 'ru', only_path: false}], @actual end def test_replaces_locale_with_subdomain_and_overrides_only_path - url_for(foo: 'bar', locale: :ru, only_path: true) + @actual = url_for(foo: 'bar', locale: :ru, only_path: true) assert_equal [{foo: 'bar', subdomain: 'ru', only_path: false}], @actual end def test_sets_subdomain_to_www_for_default_locale - url_for(foo: 'bar', locale: :az) + @actual = url_for(foo: 'bar', locale: :az) assert_equal [{foo: 'bar', subdomain: 'www', only_path: false}], @actual end end
Set ivar outside the method
diff --git a/rack-cloudflare_ip.gemspec b/rack-cloudflare_ip.gemspec index abc1234..def5678 100644 --- a/rack-cloudflare_ip.gemspec +++ b/rack-cloudflare_ip.gemspec @@ -7,8 +7,8 @@ spec.version = "1.0.0" spec.authors = ["Pip Taylor"] spec.email = ["pip@evilgeek.co.uk"] - spec.summary = %q{TODO: Write a short summary. Required.} - spec.homepage = "" + spec.summary = %q{Set X-Forwarded-For header to original client IP when using Cloudflare in proxy mode} + spec.homepage = "https://github.com/ms-digital-labs/rack-cloudflare_ip" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0")
Add summary and homepage to gemspec.
diff --git a/spec/helper.rb b/spec/helper.rb index abc1234..def5678 100644 --- a/spec/helper.rb +++ b/spec/helper.rb @@ -8,7 +8,7 @@ SimpleCov.formatters = [SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter] SimpleCov.start do - minimum_coverage(76) + minimum_coverage(78.48) end end
Increase minimum code coverage percentage
diff --git a/config/initializers/github.rb b/config/initializers/github.rb index abc1234..def5678 100644 --- a/config/initializers/github.rb +++ b/config/initializers/github.rb @@ -1,2 +1,2 @@-GITHUB = Github.new(:oauth_token => "...") +GITHUB = Github.new(:oauth_token => nil) # Add a token to access private repos GITHUB_WEBHOOK_SECRET = "..."
Create GitHub client with no auth token
diff --git a/config/initializers/refile.rb b/config/initializers/refile.rb index abc1234..def5678 100644 --- a/config/initializers/refile.rb +++ b/config/initializers/refile.rb @@ -5,6 +5,11 @@ Refile.automount = false Rails.application.routes.prepend do mount Refile.app, at: Refile.mount_point, as: :refile_app +end + +# use a CDN/asset host if the main rails app is using one +if Rails.application.config.action_controller.asset_host.present? + Refile.cdn_host = Rails.application.config.action_controller.asset_host end if ENV['AWS_ACCESS_KEY_ID'].present? && ENV['AWS_SECRET_ACCESS_KEY'].present? && ENV['AWS_S3_BUCKET'].present? @@ -18,4 +23,4 @@ Refile.store = Refile::S3.new(prefix: "store", **aws) else Refile.store = Refile::Backend::FileSystem.new(Rails.root.join('public/smithy', Rails.env)) -end+end
Use a CDN if the host application has one configured
diff --git a/app/decorators/user_decorator.rb b/app/decorators/user_decorator.rb index abc1234..def5678 100644 --- a/app/decorators/user_decorator.rb +++ b/app/decorators/user_decorator.rb @@ -22,7 +22,7 @@ end def link - author_path(object) + author_path(object.id) end def link_tag
Use user ID to avoid nil errors on to_param Honestly no idea why this keeps popping up only on Travis. Just doing this to trigger clearer nil errors if object is somehow nil.
diff --git a/app/helpers/imageables_helper.rb b/app/helpers/imageables_helper.rb index abc1234..def5678 100644 --- a/app/helpers/imageables_helper.rb +++ b/app/helpers/imageables_helper.rb @@ -4,11 +4,7 @@ end def imageable_max_file_size - bytes_to_megabytes(Setting["uploads.images.max_size"].to_i.megabytes) - end - - def bytes_to_megabytes(bytes) - bytes / Numeric::MEGABYTE + Setting["uploads.images.max_size"].to_i end def imageable_accepted_content_types
Simplify method to check an image max size We were converting megabytes to bytes with the `megabytes` method and then adding a `bytes_to_megabytes` method to convert it back to bytes, which is the same as not doing anything at all :).
diff --git a/app/helpers/serializer_helper.rb b/app/helpers/serializer_helper.rb index abc1234..def5678 100644 --- a/app/helpers/serializer_helper.rb +++ b/app/helpers/serializer_helper.rb @@ -13,4 +13,11 @@ (serializer_attributes & model_attributes).map { |attr| "#{model.table_name}.#{attr}" } end + + # Since Rails 4 has adjusted the way assets paths are handled, we have to access certain + # asset-based helpers like this, when outside of a view or controller context. + # See: https://stackoverflow.com/a/16609815 + def image_path(path) + ActionController::Base.helpers.image_path(path) + end end
Add helper method for correctly generating with fingerprints in Serializers
diff --git a/current_user.gemspec b/current_user.gemspec index abc1234..def5678 100644 --- a/current_user.gemspec +++ b/current_user.gemspec @@ -21,8 +21,7 @@ s.extra_rdoc_files = ["README.md"] s.test_files = Dir["test/**/*"] - #s.add_dependency "rails", ">= 3.2.6", "< 5" - s.add_dependency "rails", "4.0.0" + s.add_dependency "rails", ">= 3.2", "< 5" s.add_development_dependency "sqlite3" s.add_development_dependency 'capybara'
Declare support 4 Rails 4
diff --git a/config/unicorn.rb b/config/unicorn.rb index abc1234..def5678 100644 --- a/config/unicorn.rb +++ b/config/unicorn.rb @@ -1,11 +1,3 @@ require "govuk_app_config" GovukUnicorn.configure(self) - -GovukError.configure do |config| - config.data_sync_excluded_exceptions += [ - "PG::UndefinedTable", - "ActiveRecord::StatementInvalid", - ] -end - working_directory File.dirname(File.dirname(__FILE__))
Revert "Explitly ignore UndefinedTable and StatementInvalid exceptions"
diff --git a/config/requirements.rb b/config/requirements.rb index abc1234..def5678 100644 --- a/config/requirements.rb +++ b/config/requirements.rb @@ -2,7 +2,7 @@ include FileUtils require 'rubygems' -%w[rake hoe newgem rubigen actionpack activesupport].each do |req_gem| +%w[rake hoe newgem rubigen activesupport actionpack].each do |req_gem| begin require req_gem rescue LoadError
Swap load order of activesupport and action pack.\nThis is not technically required but it causes them to load in the actual order they are required.
diff --git a/gtm-oauth2-thekey.podspec b/gtm-oauth2-thekey.podspec index abc1234..def5678 100644 --- a/gtm-oauth2-thekey.podspec +++ b/gtm-oauth2-thekey.podspec @@ -1,11 +1,11 @@ Pod::Spec.new do |s| s.name = "gtm-oauth2-thekey" - s.version = "1.0.118" + s.version = "1.0.120" s.summary = "Google OAuth2 Framework modified for TheKey." s.homepage = "https://code.google.com/p/gtm-oauth2/" s.license = { :type => 'Apache License 2.0', :file => 'LICENSE.txt' } s.authors = { "Greg Robbins" => "grobbi...@google.com", "Brian Zoetewey" => "brian.zoetewey@ccci.org" } - s.source = { :git => "git@git.gcx.org:ios/lib/gtm-oauth2-thekey.git", :tag => "v1.0.118" } + s.source = { :git => "git@git.gcx.org:ios/lib/gtm-oauth2-thekey.git", :tag => "v1.0.120" } s.source_files = 'Source/*.{h,m}', 'Source/Touch/*.{h,m}', 'HTTPFetcher/GTMHTTPFetcher.{h,m}' s.resources = 'Source/Touch/{*.xib}' s.framework = 'Security', 'SystemConfiguration'
Increment version to 1.0.120, based on SVN r120
diff --git a/sql_tagger.gemspec b/sql_tagger.gemspec index abc1234..def5678 100644 --- a/sql_tagger.gemspec +++ b/sql_tagger.gemspec @@ -7,7 +7,7 @@ s.description = 'sql_tagger inserts stack trace comments into SQL queries.' s.license = 'MIT' - s.add_development_dependency('rspec', '~> 2.11') + s.add_development_dependency('rspec', '~> 3.4') s.add_development_dependency('mysql') s.add_development_dependency('mysql2')
Upgrade rspec to '~> 3.4'
diff --git a/lib/chef_zero/endpoints/containers_endpoint.rb b/lib/chef_zero/endpoints/containers_endpoint.rb index abc1234..def5678 100644 --- a/lib/chef_zero/endpoints/containers_endpoint.rb +++ b/lib/chef_zero/endpoints/containers_endpoint.rb @@ -8,6 +8,19 @@ def initialize(server) super(server, %w(id containername)) end + + # create a container. + # input: {"containername"=>"new-container", "containerpath"=>"/"} + def post(request) + data = parse_json(request.body) + # if they don't match, id wins. + container_name = data["id"] || data["containername"] + container_path_suffix = data["containerpath"].split("/").reject { |o| o.empty? } + container_data_path = request.rest_path + container_path_suffix + create_data(request, container_data_path, container_name, to_json({}), :create_dir) + + json_response(201, { uri: build_uri(request.base_uri, request.rest_path + container_path_suffix + [container_name]) }) + end end end end
Implement POST /containers to create a container with the given 'id' or 'container_name'.
diff --git a/lib/usesthis/api/generators/stats_generator.rb b/lib/usesthis/api/generators/stats_generator.rb index abc1234..def5678 100644 --- a/lib/usesthis/api/generators/stats_generator.rb +++ b/lib/usesthis/api/generators/stats_generator.rb @@ -0,0 +1,51 @@+# frozen_string_literal: true + +module UsesThis + module Api + # A class that generates all stats API endpoints. + class StatsGenerator < BaseGenerator + def generate + %w[hardware software].each do |gear_type| + gear_stats(gear_type).each do |stat_key, values| + values = values.sort_by(&:last).reverse[0..49] + + items = values.map do |slug, count| + item = @site.send(gear_type.to_sym)[slug].to_h + item.delete_if { |key| key == :interviews } + item.merge(count: count) + end + + parts = [@output_path, 'stats', gear_type] + parts << stat_key.to_s unless stat_key == :all + + Endpoint.publish(File.join(parts), items, 'wares') + end + + stats = { + slug: 'stats', + interviews: @site.posts.count, + hardware: @site.hardware.count, + software: @site.software.count + } + + path = File.join(@output_path, 'stats') + Endpoint.publish(path, [stats], 'stats') + end + end + + def gear_stats(gear_type) + {}.tap do |hash| + hash[:all] = Hash.new(0) + + @site.send(gear_type.to_sym).each_value do |ware| + hash[:all][ware.slug] = ware.interviews.count + + ware.interviews.each do |interview| + (hash[interview.year.to_sym] ||= Hash.new(0))[ware.slug] += 1 + end + end + end + end + end + end +end
Add the stats API generator
diff --git a/config/initializers/dragonfly.rb b/config/initializers/dragonfly.rb index abc1234..def5678 100644 --- a/config/initializers/dragonfly.rb +++ b/config/initializers/dragonfly.rb @@ -9,3 +9,6 @@ ActiveRecord::Base.extend Dragonfly::Model ActiveRecord::Base.extend Dragonfly::Model::Validations end + +# Dragonfly 1.4.0 only allows `quality` as argument to `encode` +Dragonfly::ImageMagick::Processors::Encode::WHITELISTED_ARGS << "flatten"
Allow flatten as argument for Dragonfly encode Dragonfly 1.4.0 does not allow flatten as argument to encode.
diff --git a/config/initializers/redcarpet.rb b/config/initializers/redcarpet.rb index abc1234..def5678 100644 --- a/config/initializers/redcarpet.rb +++ b/config/initializers/redcarpet.rb @@ -38,5 +38,9 @@ readme_markdown.gsub! \ /(?<=\<a )href="(?!http)/, link_sub_string + readme_markdown.gsub! \ + (/(href=\\&quot;)([^\\]*)(\\&quot;)/) \ + { "href=\"#{$2}\" target=\"_blank\"" } + readme_markdown end
Make readme link parsing more robust for markdown
diff --git a/test/models/account_test.rb b/test/models/account_test.rb index abc1234..def5678 100644 --- a/test/models/account_test.rb +++ b/test/models/account_test.rb @@ -4,4 +4,8 @@ # test "the truth" do # assert true # end + test "should not save account without url" do + account = Account.new + assert_not account.save + end end
Add a test for account model
diff --git a/test/variable_mixin_test.rb b/test/variable_mixin_test.rb index abc1234..def5678 100644 --- a/test/variable_mixin_test.rb +++ b/test/variable_mixin_test.rb @@ -9,7 +9,7 @@ site.compile assert_equal NanocConrefFS::Variables.variables[:default].keys, ['site'] - assert_equal NanocConrefFS::Variables.variables[:default]['site']['data'].keys, %w(categories reusables variables) + assert_equal NanocConrefFS::Variables.variables[:default]['site']['data'].keys.sort, %w(categories reusables variables) end end
Sort keys found for comparison.
diff --git a/app/admin/webhooks.rb b/app/admin/webhooks.rb index abc1234..def5678 100644 --- a/app/admin/webhooks.rb +++ b/app/admin/webhooks.rb @@ -0,0 +1,57 @@+ActiveAdmin.register Webhook do + + controller do + def create + @webhook = Webhook.new(webhook_params) + if @webhook.save + redirect_to admin_webhooks_path + else + render :new + end + end + + def update + @webhook = find_resource + if @webhook.update(webhook_params) + redirect_to admin_webhooks_path + else + render :edit + end + end + + def webhook_params + params.require(:webhook).permit(:id, :hookable_id, :hookable_type, :kind, :uri, event_types: []) + end + end + + actions :index, :show, :new, :create, :edit, :update + + filter :hookable_id, label: "Hookable Id" + filter :hookable_type + filter :kind + filter :event_types + filter :created_at + + show do |webhook| + attributes_table do + row :hookable_id + row :hookable_type + row :uri + row :kind + row :event_types + end + active_admin_comments + end + + form do |f| + f.inputs "Webhooks" do + f.input :id, :input_html => { disabled: true } + f.input :hookable_id, label: "Hookable Id" + f.input :hookable_type + f.input :uri + f.input :kind + f.input :event_types, as: :check_boxes, collection: ['new_discussion', 'new_motion', 'motion_closing_soon', 'motion_closed', 'motion_outcome_created', 'motion_outcome_updated', 'new_vote'] + end + f.actions + end +end
Add slack webhook admin panel
diff --git a/app/models/comment.rb b/app/models/comment.rb index abc1234..def5678 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -11,6 +11,30 @@ # Comment model class Comment < ActiveRecord::Base - belongs_to :Glsa, :class_name => "Glsa", :foreign_key => "glsa_id" + belongs_to :glsa, :class_name => "Glsa", :foreign_key => "glsa_id" belongs_to :user + + include ActiveModel::Validations + validates :glsa_id, :presence => true + validates :user_id, :presence => true + validates :rating, :inclusion => { :in => %w[neutral approval rejection]} + validates :rating, :uniqueness => { :scope => [:glsa_id, :user_id], :if => Proc.new {|comment| comment.rating != 'neutral'}, :message => 'You have already approved or rejected this draft' } + + class CommentValidator < ActiveModel::Validator + def validate(record) + if record.glsa.is_owner? record.user + if record.rating != 'neutral' + record.errors[:rating] << 'The owner of a draft cannot make approvals or rejections' + end + end + + if record.user.access < 2 + if record.rating != 'neutral' + record.errors[:rating] << 'You may not approve or reject drafts' + end + end + end + end + + validates_with CommentValidator end
Comment: Apply permission checking as validations
diff --git a/lib/generators/active_record/templates/migration.rb b/lib/generators/active_record/templates/migration.rb index abc1234..def5678 100644 --- a/lib/generators/active_record/templates/migration.rb +++ b/lib/generators/active_record/templates/migration.rb @@ -23,7 +23,7 @@ def down change_table :<%= table_name %> do |t| t.remove_references :invited_by, :polymorphic => true - t.remove :invitation_limit, :invitation_sent_at, :invitation_accepted_at, :invitation_token, :invitation_created_at + t.remove :invitations_count, :invitation_limit, :invitation_sent_at, :invitation_accepted_at, :invitation_token, :invitation_created_at end end end
Remove invitations_count on inviteable drop invitations_count was not removed when rolling back the inviteable migration
diff --git a/Casks/jawbone-updater.rb b/Casks/jawbone-updater.rb index abc1234..def5678 100644 --- a/Casks/jawbone-updater.rb +++ b/Casks/jawbone-updater.rb @@ -2,6 +2,6 @@ url 'http://content.jawbone.com/store/dashboard/Jawbone_Updater-2.2.3.pkg' homepage 'http://jawbone.com/' version '2.2.3' - sha1 'f729fc0d59ab84ae5bb8741c7033b8c9c12238bd' + sha256 '3085edf935347e45573405ee7e51fbacce366847f5f06f783a4e1ea89d70aee6' install 'Jawbone_Updater-2.2.3.pkg' end
Update jawbone updater to sha 256
diff --git a/tinyrpn/rpn.rb b/tinyrpn/rpn.rb index abc1234..def5678 100644 --- a/tinyrpn/rpn.rb +++ b/tinyrpn/rpn.rb @@ -15,4 +15,4 @@ a end -puts rpn('10.2 2 + 14 - 4 + 2 ^') +puts rpn('10 2 + 14 - 4 + 2 ^ 0.2 +')
Add a test for floats and such.
diff --git a/lib/airbrush/processors/image/rmagick.rb b/lib/airbrush/processors/image/rmagick.rb index abc1234..def5678 100644 --- a/lib/airbrush/processors/image/rmagick.rb +++ b/lib/airbrush/processors/image/rmagick.rb @@ -36,7 +36,7 @@ end def purify_image(image) - system "jhead -purejpg #{image}" if jpeg?(image) + #system "jhead -purejpg #{image}" if jpeg?(image) # REVISIT, passes all image content to the commandline! end def jpeg?(image)
Comment out call to jhead for the moment, since it requires a saved version of the file on disk. git-svn-id: 6d9b9a8f21f96071dc3ac7ff320f08f2a342ec80@69 daa9635f-4444-0410-9b3d-b8c75a019348
diff --git a/lib/decent_exposure/constant_resolver.rb b/lib/decent_exposure/constant_resolver.rb index abc1234..def5678 100644 --- a/lib/decent_exposure/constant_resolver.rb +++ b/lib/decent_exposure/constant_resolver.rb @@ -26,7 +26,9 @@ def namespace path = context.to_s - path[0...(path.rindex('::') || 0)].constantize + name = path[0...(path.rindex('::') || 0)] + return Object if name.blank? + name.constantize end end end
Fix 'wrong constant name' error (Rails 4.1.0beta1)
diff --git a/pronto-reek.gemspec b/pronto-reek.gemspec index abc1234..def5678 100644 --- a/pronto-reek.gemspec +++ b/pronto-reek.gemspec @@ -20,7 +20,7 @@ s.require_paths = ['lib'] s.add_dependency 'pronto', '~> 0.4.0' - s.add_dependency 'reek', '~> 2.0' + s.add_dependency 'reek', '~> 2.2.1' s.add_development_dependency 'rake', '~> 10.3' s.add_development_dependency 'rspec', '~> 3.0' s.add_development_dependency 'rspec-its', '~> 1.0'
Update and tighten reek dependency
diff --git a/actionview/lib/action_view/template/types.rb b/actionview/lib/action_view/template/types.rb index abc1234..def5678 100644 --- a/actionview/lib/action_view/template/types.rb +++ b/actionview/lib/action_view/template/types.rb @@ -5,7 +5,7 @@ class Template class Types class Type - SET = Struct.new(:symbols).new(Set.new([ :html, :text, :js, :css, :xml, :json ])) + SET = Struct.new(:symbols).new([ :html, :text, :js, :css, :xml, :json ]) def self.[](type) if type.is_a?(self)
Store the symbols as an array. A Set can't be implicitly converted into an Array: ``` irb(main):012:0> formats = [ :rss ] => [:rss] irb(main):013:0> formats &= SET.symbols TypeError: no implicit conversion of Set into Array from (irb):13:in `&' from (irb):13 from /Users/kasperhansen/.rbenv/versions/2.2.3/bin/irb:11:in `<main>' ``` Besides `Mime::SET.symbols` returns an Array, so we're closer to that.
diff --git a/app/models/calendar_item_reminder_pending.rb b/app/models/calendar_item_reminder_pending.rb index abc1234..def5678 100644 --- a/app/models/calendar_item_reminder_pending.rb +++ b/app/models/calendar_item_reminder_pending.rb @@ -6,12 +6,14 @@ belongs_to :calendar def self.pending_items(user, calendar) - CalendarItemReminderPending + items = CalendarItemReminderPending .includes(:calendar, :calendar_item) .where( identity: user.primary_identity, calendar: calendar ) - .order("created_at DESC") + .order("created_at DESC").to_a + items.sort!{|x, y| x.calendar_item.calendar_item_time <=> y.calendar_item.calendar_item_time } + items end end
Sort due calendar items on homepage
diff --git a/rails_admin.gemspec b/rails_admin.gemspec index abc1234..def5678 100644 --- a/rails_admin.gemspec +++ b/rails_admin.gemspec @@ -0,0 +1,27 @@+# -*- encoding: utf-8 -*- +require File.expand_path('../lib/rails_admin/version', __FILE__) + +Gem::Specification.new do |s| + s.add_development_dependency('devise', '~> 1.1') + s.add_development_dependency('dummy_data', '~> 0.9') + s.add_development_dependency('rspec-rails', '~> 2.3') + s.add_development_dependency('simplecov', '~> 0.3') + s.add_development_dependency('ZenTest', '~> 4.4') + s.add_runtime_dependency('builder', '~> 2.1.0') + s.add_runtime_dependency('rails', '~> 3.0.3') + s.authors = ["Erik Michaels-Ober", "Bogdan Gaza"] + s.description = %q{RailsAdmin is a Rails engine that provides an easy-to-use interface for managing your data} + s.email = ['sferik@gmail.com'] + s.extra_rdoc_files = ['LICENSE.mkd', 'README.mkd'] + s.files = Dir['Gemfile', 'LICENSE.mkd', 'README.mkd', 'Rakefile', 'app/**/*', 'config/**/*', 'lib/**/*', 'public/**/*'] + s.homepage = 'http://rubygems.org/gems/rails_admin' + s.name = 'rails_admin' + s.platform = Gem::Platform::RUBY + s.rdoc_options = ['--charset=UTF-8'] + s.require_paths = ['lib'] + s.required_rubygems_version = Gem::Requirement.new('>= 1.3.6') if s.respond_to? :required_rubygems_version= + s.rubyforge_project = 'rails_admin' + s.summary = %q{Admin for Rails} + s.test_files = Dir['spec/**/*'] + s.version = RailsAdmin::VERSION +end
Remove calls to git from gemspec for Windows compatibility Closes #85 Closes #170 Closes #171
diff --git a/rakelib/readme.rake b/rakelib/readme.rake index abc1234..def5678 100644 --- a/rakelib/readme.rake +++ b/rakelib/readme.rake @@ -1,19 +1,25 @@ #!/usr/bin/env ruby -require 'redcloth' +begin + require 'redcloth' + directory "html" -directory "html" + desc "Display the README file" + task :readme => "html/README.html" do + sh "open html/README.html" + end -desc "Display the README file" -task :readme => "html/README.html" do - sh "open html/README.html" + desc "format the README file" + task "html/README.html" => ['html', 'README.textile'] do + open("README.textile") do |source| + open('html/README.html', 'w') do |out| + out.write(RedCloth.new(source.read).to_html) + end + end + end +rescue LoadError => ex + task :readme do + fail "Install RedCloth to generate the README" + end end -desc "format the README file" -task "html/README.html" => ['html', 'README.textile'] do - open("README.textile") do |source| - open('html/README.html', 'w') do |out| - out.write(RedCloth.new(source.read).to_html) - end - end -end
Allow rakefile to run w/o RedCloth. Only complain about missing redcloth if we try to run the readme task.
diff --git a/lib/hdo/storting_importer/data_source.rb b/lib/hdo/storting_importer/data_source.rb index abc1234..def5678 100644 --- a/lib/hdo/storting_importer/data_source.rb +++ b/lib/hdo/storting_importer/data_source.rb @@ -5,7 +5,7 @@ class NotFoundError < StandardError end - DEFAULT_SESSION = '2011-2012' + DEFAULT_SESSION = '2012-2013' DEFAULT_PERIOD = '2009-2013' private
Change the default session. We should remove this altogether eventually.
diff --git a/lib/lita/rspec/matchers/route_matcher.rb b/lib/lita/rspec/matchers/route_matcher.rb index abc1234..def5678 100644 --- a/lib/lita/rspec/matchers/route_matcher.rb +++ b/lib/lita/rspec/matchers/route_matcher.rb @@ -3,10 +3,14 @@ module Matchers # Used to complete a chat routing test chain. class RouteMatcher + attr_accessor :expected_route + def initialize(context, message_body, invert: false) @context = context @message_body = message_body @method = invert ? :not_to : :to + @inverted = invert + set_description end # Sets an expectation that a route will or will not be triggered, then @@ -15,6 +19,8 @@ # be triggered. # @return [void] def to(route) + self.expected_route = route + m = @method b = @message_body @@ -24,6 +30,31 @@ send_message(b) end end + + private + + def description_prefix + if inverted? + "doesn't route" + else + "routes" + end + end + + def expected_route=(route) + @expected_route = route + set_description + end + + def inverted? + defined?(@inverted) && @inverted + end + + def set_description + description = %{#{description_prefix} "#{@message_body}"} + description << " to :#{expected_route}" if expected_route + ::RSpec.current_example.metadata[:description] = description + end end end end
Set example description for chat routes.
diff --git a/lib/models/badges/answers/nice_answer.rb b/lib/models/badges/answers/nice_answer.rb index abc1234..def5678 100644 --- a/lib/models/badges/answers/nice_answer.rb +++ b/lib/models/badges/answers/nice_answer.rb @@ -13,19 +13,21 @@ sort: 'votes', order: 'desc', pagesize: 1, + filter: '!9cC8zqAGM', fetch_all_pages: false }).first question = service.fetch('questions', ids: answer['question_id']).first question_title = question['title'] + link = answer['link'] score = answer['score'] remaining = required_score - score score_str = "#{score} " + "vote".pluralize(score, "votes") remaining_str = "#{remaining} " + "vote".pluralize(remaining, "votes") - "Your answer on \"#{question_title.truncate(65)}\" has #{score_str}. #{remaining_str} to go!" + "Your answer on \"#{question_title.truncate(65).link_to(link)}\" has #{score_str}. #{remaining_str} to go!" end def required_score
Add link to answer in NiceAnswer's progress_description
diff --git a/attributes/default.rb b/attributes/default.rb index abc1234..def5678 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -1,2 +1,2 @@ # Must correspond to a valid release here https://github.com/facebook/watchman/releases -default['watchman']['version'] = 'v3.0.0' +default['watchman']['version'] = 'v3.7.0'
Use Most Recent Watchman Version
diff --git a/sandbox/dev/cookbooks/atmessager/recipes/default.rb b/sandbox/dev/cookbooks/atmessager/recipes/default.rb index abc1234..def5678 100644 --- a/sandbox/dev/cookbooks/atmessager/recipes/default.rb +++ b/sandbox/dev/cookbooks/atmessager/recipes/default.rb @@ -1,19 +1,27 @@ remote_file '/tmp/nodejs.deb' do - source "http://ppa.launchpad.net/chris-lea/node.js/ubuntu/pool/main/n/nodejs/nodejs_0.10.37-1chl1~trusty1_amd64.deb" - checksum "507bd0f6c59e0652e609f72ca09abb984fdf3510d126aead78556be934577a47" - notifies :run, "execute[run_install-nodejs]", :immediately + source 'http://ppa.launchpad.net/chris-lea/node.js/ubuntu/pool/main/n/nodejs/nodejs_0.10.37-1chl1~trusty1_amd64.deb' + checksum '507bd0f6c59e0652e609f72ca09abb984fdf3510d126aead78556be934577a47' + notifies :run, 'execute[run_install-nodejs]', :immediately end execute 'run_install-nodejs' do - command "dpkg -i /tmp/nodejs.deb || apt-get -f install -y" - user "root" + command 'dpkg -i /tmp/nodejs.deb || apt-get -f install -y' + user 'root' action :nothing end -bash 'Start ATMessager' do - user 'vagrant' - code <<-EOC - cd /opt/nx/atmessager - node app.js +bash 'Create log folder' do + not_if { ::File.exist?('/var/log/atm') } + user 'root' + code <<-EOC + cd /var/log/ + mkdir atm EOC end + +bash 'Install forever' do + user 'root' + code <<-EOC + npm install forever -g + EOC +end
Add Install forever, create log file folder and remove start app part
diff --git a/spec/mobility/plugins/fallthrough_accessors_spec.rb b/spec/mobility/plugins/fallthrough_accessors_spec.rb index abc1234..def5678 100644 --- a/spec/mobility/plugins/fallthrough_accessors_spec.rb +++ b/spec/mobility/plugins/fallthrough_accessors_spec.rb @@ -18,6 +18,7 @@ end end + model_class = Class.new model_class.include mod model_class.include attributes
Fix test so it fails when options not correctly passed to super
diff --git a/test/models/product_test.rb b/test/models/product_test.rb index abc1234..def5678 100644 --- a/test/models/product_test.rb +++ b/test/models/product_test.rb @@ -1,7 +1,13 @@ require 'test_helper' class ProductTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end + test "product attributes must not be empty" do + # Properties must not be empty. + product = Product.new + assert product.invalid? + assert product.errors[:title].any? + assert product.errors[:description].any? + assert product.errors[:price].any? + assert product.errors[:image_url].any? + end end
Add model test for Product properties
diff --git a/test/models/rss_log_test.rb b/test/models/rss_log_test.rb index abc1234..def5678 100644 --- a/test/models/rss_log_test.rb +++ b/test/models/rss_log_test.rb @@ -3,6 +3,10 @@ require("test_helper") class RssLogTest < UnitTestCase + # Alert developer if normalization changes the path of an RssLogg'ed object + # The test should be deleted once controllers for all RssLog'ged objects are + # normalized. + # See https://www.pivotaltracker.com/story/show/174685402 def test_url_for_normalized_controllers normalized_rss_log_types.each do |type| rss_log = create_rss_log(type)
Add comment about purpose of test
diff --git a/Casks/browserstacklocal.rb b/Casks/browserstacklocal.rb index abc1234..def5678 100644 --- a/Casks/browserstacklocal.rb +++ b/Casks/browserstacklocal.rb @@ -5,7 +5,7 @@ url 'https://www.browserstack.com/browserstack-local/BrowserStackLocal-darwin-x64.zip' name 'BrowserStack' name 'BrowserStack Local' - homepage 'http://www.browserstack.com/' + homepage 'https://www.browserstack.com/' license :commercial binary 'BrowserStackLocal'
Fix homepage to use SSL in BrowserStack Cask The HTTP URL is already getting redirected to HTTPS. Using the HTTPS URL directly makes it more secure and saves a HTTP round-trip.
diff --git a/Casks/transporter-desktop.rb b/Casks/transporter-desktop.rb index abc1234..def5678 100644 --- a/Casks/transporter-desktop.rb +++ b/Casks/transporter-desktop.rb @@ -1,6 +1,6 @@ cask :v1 => 'transporter-desktop' do - version '4.0.8_19845' - sha256 '9d8d0606286a4baa1a3fc4df4bad64e879cb434766f6d4466c0d3a8ec89020f5' + version '4.1.5_20060' + sha256 '98111e1178f1db00b6b6cf395b78256c3f681151e6f07a70d4497250da0ca238' # connecteddata.com is the official download host per the vendor homepage url "https://secure.connecteddata.com/mac/2.5/software/Transporter_Desktop_#{version}.dmg"
Update Transporter Desktop to version 4.1.5_20060 This commit updates the version and sha256 stanzas.
diff --git a/GNContextManager.podspec b/GNContextManager.podspec index abc1234..def5678 100644 --- a/GNContextManager.podspec +++ b/GNContextManager.podspec @@ -8,8 +8,8 @@ s.homepage = "https://github.com/jakubknejzlik/GNContextManager" s.license = { :type => "MIT", :file => "LICENSE" } s.author = { "Jakub Knejzlik" => "jakub.knejzlik@gmail.com" } - s.platform = :ios, "6.0" - s.platform = :tvos, "9.0" + s.ios.deployment_target = "6.0" + s.osx.deployment_target = "9.0" s.source = { :git => "https://github.com/jakubknejzlik/GNContextManager.git", :tag => s.version.to_s } s.source_files = "GNContextManager/*.{h,m}" s.frameworks = "UIKit","CoreData"
Fix platforms in cocoapods spec
diff --git a/test/tc_send_incremental.rb b/test/tc_send_incremental.rb index abc1234..def5678 100644 --- a/test/tc_send_incremental.rb +++ b/test/tc_send_incremental.rb @@ -5,7 +5,7 @@ file = "data/noyes/noyes.flac" to_server = StringIO.new 'wb' from_server = StringIO.new 'dummy result' - result = send_incremental_features file, to_server, from_server + result = send_incremental_features file, to_server, from_server, 16, 8000 raw_data = to_server.string assert_equal TMAGIC, raw_data.slice!(0,13) assert_equal TSTART, raw_data.slice!(0,4)
Send test now reflects additional parameters to incremental send.
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -14,6 +14,15 @@ devise_parameter_sanitizer.for(:sign_up) << [{adresses_attributes: [:id, :value]}, :nom, :prenom, :telephone, :date_de_naissance] devise_parameter_sanitizer.for(:account_update) << [{adresses_attributes: [:id, :value]}, :nom, :prenom, :telephone, :date_de_naissance] end + + # Pour la gestion du user courant dans l'application native + def current_user + @current_user ||= if params[:cuid] + User.find(params[:cuid]) + else + super + end + end private def set_locale
FIX : prise en compte de la gestion de la méthode current_user pour l'application native.
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,8 +1,13 @@ class ApplicationController < ActionController::Base protect_from_forgery before_filter :authenticate_user!, :unless => :devise_controller? + before_filter :set_current_user_in_thread, :if => :user_signed_in? protected + def set_current_user_in_thread + Thread.current[:current_user] = current_user + end + def authenticate_inviter! authenticate_user! and current_user.role == 'superuser' end
Store the current user in the thread to allow us to capture that in various models
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -23,8 +23,13 @@ end def current_applicant - if user_signed_in? and not session[:current_applicant_id].nil? - Applicant.find(session[:current_applicant_id]) + if user_signed_in? + begin + Applicant.find(session[:current_applicant_id]) + rescue ActiveRecord::RecordNotFound + session.delete(:current_applicant_id) + sample_applicant + end else sample_applicant end
Check for RecordNotFound in current_applicant This tends to happen when old cookies are left around when reseeding the database.
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -10,11 +10,15 @@ before_action :configure_permitted_parameters, if: :devise_controller? + def configure_permitted_parameters + devise_parameter_sanitizer.permit(:sign_up, keys: [:username]) + end + protected def configure_permitted_parameters - devise_parameter_sanitizer.for(:sign_up) << :name - devise_parameter_sanitizer.for(:account_update) << :name + devise_parameter_sanitizer.permit(:sign_up, keys: [:name]) + devise_parameter_sanitizer.permit(:account_update, keys: [:name]) end private
Update sanitizer options to new devise
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -4,15 +4,19 @@ protect_from_forgery with: :exception include SessionsHelper # before_action :check_sign_in + before_filter :mini_profiler authorize_resource REMOTE_ROOT = "https://obscure-anchorage-7682.herokuapp.com/" + + def mini_profiler + Rack::MiniProfiler.authorize_request if current_account.user.contact.email = 'guest.austin@gmail.com' + end def now_unless_test Rails.env.test? ? Time.zone.local(2014,1,6,11) : Time.zone.now end - # CanCan config def current_ability @current_ability ||= Ability.new(current_account)
Add profiler info to prod
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -17,6 +17,6 @@ end def set_page_caching - @page_caching = true + @page_caching = self.perform_caching end end
Enable page caching based on perform_caching setting
diff --git a/lib/dugway/application.rb b/lib/dugway/application.rb index abc1234..def5678 100644 --- a/lib/dugway/application.rb +++ b/lib/dugway/application.rb @@ -26,8 +26,8 @@ def find_template(request) if template = @theme.find_template_by_request(request) template - elsif page = @store.page(request.permalink) - Template.new(request.file_name, page['content']) + elsif custom_page = @store.page(request.permalink) + Template.new(request.file_name, custom_page['content']) else nil end
Clarify that these are custom pages
diff --git a/lib/her/json_api/model.rb b/lib/her/json_api/model.rb index abc1234..def5678 100644 --- a/lib/her/json_api/model.rb +++ b/lib/her/json_api/model.rb @@ -13,7 +13,7 @@ end def self.to_params(attributes, changes={}) - request_data = { type: 'users' }.tap { |request_body| + request_data = { type: name.demodulize.tableize }.tap { |request_body| attrs = attributes.dup.symbolize_keys.tap { |filtered_attributes| if her_api.options[:send_only_modified_attributes] filtered_attributes = changes.symbolize_keys.keys.inject({}) do |hash, attribute|
Determine type from class name
diff --git a/app/services/dropped_attributes_setter.rb b/app/services/dropped_attributes_setter.rb index abc1234..def5678 100644 --- a/app/services/dropped_attributes_setter.rb +++ b/app/services/dropped_attributes_setter.rb @@ -19,8 +19,9 @@ def set_attributes efforts.each do |effort| - effort.dropped_split_id = dropped_split_id(effort) - effort.dropped_lap = dropped_lap(effort) + unless effort.finished? + effort.assign_attributes(dropped_split_id: effort.final_split_id, dropped_lap: effort.final_lap) + end end end @@ -37,14 +38,6 @@ attr_reader :efforts, :times_container attr_writer :report - def dropped_split_id(effort) - effort.final_split_id unless effort.finished? - end - - def dropped_lap(effort) - effort.final_lap unless effort.finished? - end - def changed_effort_attributes changed_efforts.map { |effort| [effort.id, {dropped_split_id: effort.dropped_split_id, dropped_lap: effort.dropped_lap}] }.to_h
Fix bug in DroppedAttributesSetter that under some conditions set dropped_split_id without setting dropped_lap.
diff --git a/lib/parelation/applier.rb b/lib/parelation/applier.rb index abc1234..def5678 100644 --- a/lib/parelation/applier.rb +++ b/lib/parelation/applier.rb @@ -9,7 +9,7 @@ Parelation::Criteria::Offset, Parelation::Criteria::Order, Parelation::Criteria::Query, - Parelation::Criteria::Where + Parelation::Criteria::Where, ] # @return [ActiveRecord::Relation]
Use trailing commas in multi-line Arrays.
diff --git a/lib/paypal/nvp/request.rb b/lib/paypal/nvp/request.rb index abc1234..def5678 100644 --- a/lib/paypal/nvp/request.rb +++ b/lib/paypal/nvp/request.rb @@ -21,6 +21,7 @@ def initialize(attributes = {}) @version = Paypal.api_version super + self.subject ||= '' end def common_params @@ -61,4 +62,4 @@ end end end -end+end
Fix the compatibility with rest-client 2.0
diff --git a/lib/tolk/link_renderer.rb b/lib/tolk/link_renderer.rb index abc1234..def5678 100644 --- a/lib/tolk/link_renderer.rb +++ b/lib/tolk/link_renderer.rb @@ -7,17 +7,17 @@ links.push page_link_or_span(@collection.next_page, 'disabled next_page', @options[:next_label]) html = links.join(@options[:separator]) - @options[:container] ? @template.content_tag(:div, html.html_safe!, html_attributes) : html.html_safe! + @options[:container] ? @template.content_tag(:div, html.html_safe, html_attributes) : html.html_safe end protected def page_link(page, text, attributes = {}) - @template.link_to text.html_safe!, url_for(page), attributes + @template.link_to text.html_safe, url_for(page), attributes end def page_span(page, text, attributes = {}) - @template.content_tag :span, text.html_safe!, attributes + @template.content_tag :span, text.html_safe, attributes end end end
Use html_safe and not html_safe!
diff --git a/lib/zartan/source_type.rb b/lib/zartan/source_type.rb index abc1234..def5678 100644 --- a/lib/zartan/source_type.rb +++ b/lib/zartan/source_type.rb @@ -1,10 +1,11 @@ module Zartan module SourceType extend self - + def all [ - ::Sources::DigitalOcean + ::Sources::DigitalOcean, + ::Sources::Linode ] end end
Add Linode as an option.
diff --git a/core/exception/top_level_spec.rb b/core/exception/top_level_spec.rb index abc1234..def5678 100644 --- a/core/exception/top_level_spec.rb +++ b/core/exception/top_level_spec.rb @@ -0,0 +1,22 @@+require_relative '../../spec_helper' + +describe "An Exception reaching the top level" do + it "is printed on STDERR" do + ruby_exe('raise "foo"', args: "2>&1").should.include?("in `<main>': foo (RuntimeError)") + end + + describe "with a custom backtrace" do + it "is printed on STDERR" do + code = <<-RUBY + raise RuntimeError, "foo", [ + "/dir/foo.rb:10:in `raising'", + "/dir/bar.rb:20:in `caller'", + ] + RUBY + ruby_exe(code, args: "2>&1").should == <<-EOS +/dir/foo.rb:10:in `raising': foo (RuntimeError) +\tfrom /dir/bar.rb:20:in `caller' + EOS + end + end +end
Add spec checking exceptions reaching the top-level are printed properly
diff --git a/test/helpers/mountain_view/component_helper_test.rb b/test/helpers/mountain_view/component_helper_test.rb index abc1234..def5678 100644 --- a/test/helpers/mountain_view/component_helper_test.rb +++ b/test/helpers/mountain_view/component_helper_test.rb @@ -7,6 +7,6 @@ expected = /Pepe/ assert_match expected, rendered - assert_match(/href=\"\/products\/1\"/, rendered) + assert_match %r(href=\"\/products\/1\"), rendered end end
Make Hound CI even happier.