diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/spec/active_interaction/integration/model_interaction_spec.rb b/spec/active_interaction/integration/model_interaction_spec.rb index abc1234..def5678 100644 --- a/spec/active_interaction/integration/model_interaction_spec.rb +++ b/spec/active_interaction/integration/model_interaction_spec.rb @@ -3,5 +3,5 @@ require 'spec_helper' describe 'ModelInteraction' do - it_behaves_like 'an interaction', :model, -> { Object }, class: Class + it_behaves_like 'an interaction', :model, -> { // }, class: Regexp end
Fix Model filter integration test I'm not sure why it was broken with ActiveModel ~> 3.0. This fixes it, though.
diff --git a/spec/integration/veritas/self_referential/one_to_many_spec.rb b/spec/integration/veritas/self_referential/one_to_many_spec.rb index abc1234..def5678 100644 --- a/spec/integration/veritas/self_referential/one_to_many_spec.rb +++ b/spec/integration/veritas/self_referential/one_to_many_spec.rb @@ -0,0 +1,30 @@+require 'spec_helper_integration' + +describe 'Relationship - Self referential Many To One' do + include_context 'Models and Mappers' + + before(:all) do + setup_db + + insert_person 1, 'John' + insert_person 2, 'Jane', 1 + insert_person 3, 'Alice', 1 + + # TODO investigate why #one returns zero results when this is present + # person_mapper.belongs_to :parent, person_model + + person_mapper.has 0..n, :children, person_model, :target_key => [:parent_id] + end + + let(:jane) { person_model.new(:id => 2, :name => 'Jane', :parent_id => 1) } + let(:alice) { person_model.new(:id => 3, :name => 'Alice', :parent_id => 1) } + + it 'loads the associated children' do + children = DM_ENV[person_model].include(:children).one(:id => 1).children + + children.size.should == 2 + + children.should include(jane) + children.should include(alice) + end +end
Add self referential 1:N veritas integration specs
diff --git a/gem_template.gemspec b/gem_template.gemspec index abc1234..def5678 100644 --- a/gem_template.gemspec +++ b/gem_template.gemspec @@ -18,4 +18,6 @@ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.require_paths = ["lib"] + + s.add_development_dependency('rake', '~> 0.8') end
Add rake to the bundle
diff --git a/SwiftCBOR.podspec b/SwiftCBOR.podspec index abc1234..def5678 100644 --- a/SwiftCBOR.podspec +++ b/SwiftCBOR.podspec @@ -11,7 +11,7 @@ s.ios.deployment_target = '8.0' s.osx.deployment_target = '10.9' - s.source_files = 'Sources/SwiftCBOR/*.{swift,h}' + s.source_files = 'Sources/SwiftCBOR/**/*.{swift,h}' s.requires_arc = true end
Make sure all source files are included in cocoapod
diff --git a/lib/import_products/user_mailer_ext.rb b/lib/import_products/user_mailer_ext.rb index abc1234..def5678 100644 --- a/lib/import_products/user_mailer_ext.rb +++ b/lib/import_products/user_mailer_ext.rb @@ -5,7 +5,7 @@ def product_import_results(user, error_message = nil) @user = user @error_message = error_message - attachment["import_products.log"] = File.read(ImportProductSettings::LOGFILE) if @error_message.nil? + attachments["import_products.log"] = File.read(IMPORT_PRODUCT_SETTINGS[:log_to]) if @error_message.nil? mail(:to => @user.email, :subject => "Spree: Import Products #{error_message.nil? ? "Success" : "Failure"}") end end
Update mailer to use attachments[] instead of attachment[]
diff --git a/lib/noosfero/core_ext/action_mailer.rb b/lib/noosfero/core_ext/action_mailer.rb index abc1234..def5678 100644 --- a/lib/noosfero/core_ext/action_mailer.rb +++ b/lib/noosfero/core_ext/action_mailer.rb @@ -8,14 +8,4 @@ super end - def premailer_html html - premailer = Premailer.new html.to_s, :with_html_string => true - premailer.to_inline_css - end - - def render_with_premailer *args - premailer_html render_without_premailer(*args) - end - alias_method_chain :render, :premailer - end
Remove premailer adjust on core
diff --git a/pdfjs.gemspec b/pdfjs.gemspec index abc1234..def5678 100644 --- a/pdfjs.gemspec +++ b/pdfjs.gemspec @@ -9,7 +9,7 @@ s.version = Pdfjs::VERSION s.authors = ["Leigh Caplan"] s.email = ["lcaplan@onehub.com"] - s.homepage = "github.com/onehub/pdfjs" + s.homepage = "https://github.com/onehub/pdfjs" s.summary = "Package pdfjs for your Rails apps." s.description = "Package pdfjs for your Rails apps." s.license = "MIT"
Make the homepage a real URL.
diff --git a/config.rb b/config.rb index abc1234..def5678 100644 --- a/config.rb +++ b/config.rb @@ -6,6 +6,7 @@ # Publishing paths http_path = "/" http_images_path = "/images" +http_generated_images_path = "/images" http_fonts_path = "/fonts" css_dir = "public/stylesheets"
Fix http generated images path when using Compass sprites Otherwise compass uses '/source/images' for the sprite image URL
diff --git a/config.ru b/config.ru index abc1234..def5678 100644 --- a/config.ru +++ b/config.ru @@ -1,8 +1,6 @@ require "rubygems" require 'rack/contrib' require 'rack-rewrite' -DOMAIN = 'www.ruby-pt.org' - use Rack::Static, :urls => ["/css", "/img"], @@ -10,8 +8,5 @@ use Rack::ETag use Rack::Rewrite do rewrite '/', '/index.html' - r301 %r{.*}, "http://#{DOMAIN}$&", :if => Proc.new {|rack_env| - rack_env['SERVER_NAME'] != DOMAIN && ENV['RACK_ENV'] == "production" - } end run Rack::Directory.new('public')
Revert "Added rule to redirect naked domain to www" This reverts commit ae00b3e3d40408cac71e3e0a13dcf717a2ef2345.
diff --git a/config.ru b/config.ru index abc1234..def5678 100644 --- a/config.ru +++ b/config.ru @@ -18,6 +18,4 @@ end end -c = Scrum::Bot.instance.send :client - run Scrum::Web
Remove silly client get line
diff --git a/app/helpers/tabs_helper.rb b/app/helpers/tabs_helper.rb index abc1234..def5678 100644 --- a/app/helpers/tabs_helper.rb +++ b/app/helpers/tabs_helper.rb @@ -1,7 +1,7 @@ module TabsHelper def tab_link_to(model_or_name, link, current=nil) - model_or_name = model_or_name.model_name.human.capitalize.pluralize if Class === model_or_name + model_or_name = model_or_name.model_name.human(:count => 2).capitalize if Class === model_or_name current ||= request.path.start_with?(link) link_to model_or_name, link, :class => ("current" if current) end
Use yml for plural model name
diff --git a/app/models/saved_search.rb b/app/models/saved_search.rb index abc1234..def5678 100644 --- a/app/models/saved_search.rb +++ b/app/models/saved_search.rb @@ -20,7 +20,11 @@ query_parameters.delete(:redirect_controller) query_parameters.delete(:redirect_action) query_parameters.delete(:saved_search_id) - sql = "#{query_parameters}" + #sql = "#{query_parameters}" + query_parameters.each |key,val| + sql << "#{key} like #{val} and" + end + sql = sql.slice(0, sql.length-3) eval(self.model_name).where(eval(sql)) end
Make the searches perform a like
diff --git a/tools/build_readme.rb b/tools/build_readme.rb index abc1234..def5678 100644 --- a/tools/build_readme.rb +++ b/tools/build_readme.rb @@ -1,13 +1,13 @@ #!/usr/bin/env ruby template = $stdin.read -examples = template.scan(/include_example (.*)/).flatten +examples = template.scan(/include_example '(.*)'/).flatten examples.each do |example| file = "examples/#{example}.rb" if File.exists?(file) replacement = File.read(file) - template.gsub!(/include_example #{example}/, replacement) + template.gsub!(/include_example '#{example}'/, replacement) end end
Define included examples as strings
diff --git a/recipes/default.rb b/recipes/default.rb index abc1234..def5678 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -1,5 +1,9 @@ p4_exe = node[:os] == 'windows' ? 'p4.exe' : 'p4' p4d_exe = node[:os] == 'windows' ? 'p4d.exe' : 'p4d' + +directory node['perforce']['bin_dir'] do + recursive true +end remote_file get_ftp_path(node['perforce']['version'], p4_exe) do path ::File.join(node['perforce']['bin_dir'], p4_exe)
Create the perforce bin_dif if it does not exist
diff --git a/spec/server_spec.rb b/spec/server_spec.rb index abc1234..def5678 100644 --- a/spec/server_spec.rb +++ b/spec/server_spec.rb @@ -4,7 +4,7 @@ describe 'burp::server' do it 'creates a proper client config in clientconfdir/' do - Chef::Recipe.any_instance.stub(:partial_search).with( + allow_any_instance_of(Chef::Recipe).to receive(:partial_search).with( :node, 'recipes:burp\:\:client AND burp_server:myserver.example.com ', keys: { 'name' => %w(fqdn), 'password' => %w(burp password) } ).and_return(
Replace deprecated any_instance in server spec http://stackoverflow.com/a/24595457/1058366
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -13,7 +13,10 @@ require "i18n/backend/advanced" require "yaml" -require "pry" rescue LoadError +begin + require "pry" +rescue LoadError +end RSpec.configure do |config| # begin --- rspec 3.1 generator
Handle pry no present on CI
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -10,12 +10,12 @@ # in spec/support/ and its subdirectories. Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f } -ActiveSupport::Notifications.subscribe("sql.active_record") do |_, _, _, _, details| - if details[:sql] =~ /INSERT INTO "spree_countries"/ - puts caller.join("\n") - puts "*" * 50 - end -end +# ActiveSupport::Notifications.subscribe("sql.active_record") do |_, _, _, _, details| +# if details[:sql] =~ /INSERT INTO "spree_states"/ +# puts caller.join("\n") +# puts "*" * 50 +# end +# end RSpec.configure do |config| config.include Spree::TestingSupport::Preferences
Comment out SQL logging magic for now
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,7 @@ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'sports_database' -require 'byebug' require 'simplecov' -SimpleCov.start +SimpleCov.start do + add_filter '/.gems/' + add_filter '/spec/' +end
Add filter to not look at spec and .gems directories for test coverage.
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -3,6 +3,9 @@ # Configure Rails Environment ENV["RAILS_ENV"] = "test" + +# Configure Rails Environment +ENV["DB"] ||= "mysql" require File.expand_path("../../test/dummy/config/environment.rb", __FILE__) ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../test/dummy/db/migrate", __FILE__)]
Set $DB mysql as default
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -10,7 +10,7 @@ MongoMapper.database = 'mm-learnup-sluggable-spec' def article_class - Class.new do + @article_class ||= Class.new do include MongoMapper::Document set_collection_name :articles @@ -22,7 +22,7 @@ end def employer_class - Class.new do + @employer_class ||= Class.new do include MongoMapper::Document set_collection_name :employers @@ -34,7 +34,7 @@ end def training_class - Class.new do + @training_class ||= Class.new do include MongoMapper::Document set_collection_name :trainings
Use ||= in spec class helpers (so that referencing the class again gives back the same class, not a new one)
diff --git a/lib/cheatly/sheet.rb b/lib/cheatly/sheet.rb index abc1234..def5678 100644 --- a/lib/cheatly/sheet.rb +++ b/lib/cheatly/sheet.rb @@ -31,11 +31,11 @@ def self.find(name) body = adapter.find(name) self.new(name, body, persisted: true) - rescue Octokit::NotFound, Octokit::TooManyRequests - puts "Octokit error." + rescue Octokit::NotFound nil - rescue RuntimeError => e + rescue Exception => e puts e.message + nil end def self.all
Fix Error handling on .find method
diff --git a/lib/dm-types/enum.rb b/lib/dm-types/enum.rb index abc1234..def5678 100644 --- a/lib/dm-types/enum.rb +++ b/lib/dm-types/enum.rb @@ -4,6 +4,7 @@ module DataMapper class Property class Enum < Integer + min 0 include Flags @@ -18,6 +19,8 @@ if self.class.accepted_options.include?(:set) && !options.include?(:set) options[:set] = @flag_map.values_at(*@flag_map.keys.sort) end + + options[:max] = @flag_map.size super end
Change Enum type to use tighter database constraints
diff --git a/lib/gherkin/lexer.rb b/lib/gherkin/lexer.rb index abc1234..def5678 100644 --- a/lib/gherkin/lexer.rb +++ b/lib/gherkin/lexer.rb @@ -14,10 +14,8 @@ else begin c[i18n_lang] - rescue NameError => e + rescue NameError, LoadError => e warn("WARNING: #{e.message}. Reverting to Ruby lexer") - rb[i18n_lang] - rescue LoadError rb[i18n_lang] end end
Raise warning on LoadError, too
diff --git a/lib/poke/controls.rb b/lib/poke/controls.rb index abc1234..def5678 100644 --- a/lib/poke/controls.rb +++ b/lib/poke/controls.rb @@ -2,8 +2,10 @@ # The +Controls+ controller handles keyboard input from the user. class Controls + # Params required at initialization. PARAMS_REQUIRED = [:window] + # A hash storing symbols for easy reference of individual buttons. BUTTONS = { up: Gosu::KbUp, down: Gosu::KbDown, left: Gosu::KbLeft,
Add docs for Controls constants
diff --git a/lib/popular_items.rb b/lib/popular_items.rb index abc1234..def5678 100644 --- a/lib/popular_items.rb +++ b/lib/popular_items.rb @@ -7,6 +7,24 @@ @items = load(filename) @logger = logger || NullLogger.instance end + + def popular?(section, slug) + @items[section] && @items[section].include?(slug) + end + + def link_to_slug(link) + if link.match(%r{^/([^/]*)(/|$)}) + $1 + end + end + + def select_from(section, solr_results) + (@items[section] || []).map do |slug| + solr_results.find { |result| link_to_slug(result.link) == slug } + end.reject(&:nil?) + end + + private def load(filename) items = {} @@ -24,20 +42,4 @@ end items end - - def popular?(section, slug) - @items[section] && @items[section].include?(slug) - end - - def link_to_slug(link) - if link.match(%r{^/([^/]*)(/|$)}) - $1 - end - end - - def select_from(section, solr_results) - (@items[section] || []).map do |slug| - solr_results.find { |result| link_to_slug(result.link) == slug } - end.reject(&:nil?) - end end
Make implicit helper method for PopularItems private
diff --git a/lib/emcee/railtie.rb b/lib/emcee/railtie.rb index abc1234..def5678 100644 --- a/lib/emcee/railtie.rb +++ b/lib/emcee/railtie.rb @@ -7,7 +7,6 @@ module Emcee class Railtie < Rails::Railtie initializer :add_html_processor do |app| - app.assets.register_mime_type "text/html", ".html" app.assets.register_preprocessor "text/html", DirectiveProcessor end
Remove unnecessary mime type declaration
diff --git a/lib/git-feats/api.rb b/lib/git-feats/api.rb index abc1234..def5678 100644 --- a/lib/git-feats/api.rb +++ b/lib/git-feats/api.rb @@ -6,7 +6,7 @@ extend self - URL = 'http://localhost:3000' + URL = 'http://gitfeats.com' def upload_feats # Post json to git-feats
Update API module to hit production URL
diff --git a/lib/orc/cmdb/yaml.rb b/lib/orc/cmdb/yaml.rb index abc1234..def5678 100644 --- a/lib/orc/cmdb/yaml.rb +++ b/lib/orc/cmdb/yaml.rb @@ -5,9 +5,6 @@ class Orc::CMDB::Yaml def initialize(args) @data_dir = args[:data_dir] - if !Pathname.new(@data_dir).exist? - Dir.mkdir @data_dir - end end def convention(spec)
Remove surprise mkdir which means you can't later check out
diff --git a/lib/tasks/utils.rake b/lib/tasks/utils.rake index abc1234..def5678 100644 --- a/lib/tasks/utils.rake +++ b/lib/tasks/utils.rake @@ -1,4 +1,9 @@+require 'html-proofer' + task :find_dead_links do - cmd = 'htmlproofer ./_site --only-4xx --url-ignore "/blog/,/#content/"' - system("bundle exec #{cmd}") + opts = { only_4xx: true, url_ignore: [/blog/, /#content/] } + begin + HTMLProofer.check_directory("./_site", opts).run + rescue => e + end end
Use gem instead of using cli tool.
diff --git a/providers/connection.rb b/providers/connection.rb index abc1234..def5678 100644 --- a/providers/connection.rb +++ b/providers/connection.rb @@ -19,7 +19,9 @@ end action :delete do - new_resource.updated_by_last_action( - node[:stunnel][:services].delete(new_resource.service_name) - ) + serv_data = Mash.new(node[:stunnel][:services]) + if(serv_data.delete(new_resource.service_name)) + node.set[:stunnel][:services] = serv_data + new_resource.updated_by_last_action(true) + end end
Update attribute interactions in delete action of lwrp
diff --git a/db/migrate/20150218120000_change_unique_index_on_spree_website_payments_standard_transactions.rb b/db/migrate/20150218120000_change_unique_index_on_spree_website_payments_standard_transactions.rb index abc1234..def5678 100644 --- a/db/migrate/20150218120000_change_unique_index_on_spree_website_payments_standard_transactions.rb +++ b/db/migrate/20150218120000_change_unique_index_on_spree_website_payments_standard_transactions.rb @@ -0,0 +1,7 @@+class ChangeUniqueIndexOnSpreeWebsitePaymentsStandardTransactions < ActiveRecord::Migration + def up + add_index :spree_website_payments_standard_transactions, [:transaction_id, :payment_status], :name => 'unique_index_paypal_standard_notifications' + remove_index :spree_website_payments_standard_transactions, 'unique_idx_paypal_standard_notifications_transaction_id' + end +end +
Allow multiple notifications per transaction as long as they have different payment statuses We need this because PayPal seems to send another IPN when an authorization expires.
diff --git a/haproxy_log_parser.gemspec b/haproxy_log_parser.gemspec index abc1234..def5678 100644 --- a/haproxy_log_parser.gemspec +++ b/haproxy_log_parser.gemspec @@ -11,11 +11,6 @@ s.add_development_dependency 'rspec', '~> 3.5.0' - s.files = Dir.glob('lib/**/*') + [ - 'LICENSE', - 'README.md', - 'VERSION', - 'haproxy_log_parser.gemspec' - ] - s.test_files = Dir.glob('spec/**/*') + s.files = `git ls-files`.split($/) + s.test_files = s.files.grep(%r{\Aspec/}) end
Use git ls-files for gemspec
diff --git a/spec/features/language_switching_spec.rb b/spec/features/language_switching_spec.rb index abc1234..def5678 100644 --- a/spec/features/language_switching_spec.rb +++ b/spec/features/language_switching_spec.rb @@ -14,14 +14,14 @@ click_on('Cymraeg') - expect(current_path).to eq(booking_requests_path(locale: 'cy')) + expect(have_current_path).to eq(booking_requests_path(locale: 'cy')) expect(page).to have_selector( '#proposition-name', text: 'Ymweld â rhywun yn y carchar' ) click_on('English') - expect(current_path).to eq(booking_requests_path(locale: 'en')) + expect(have_current_path).to eq(booking_requests_path(locale: 'en')) expect { visit('/fr/request') }. to raise_error(ActionController::RoutingError)
Update spec to pass new rubocop-rspec requirements
diff --git a/sample/fib.rb b/sample/fib.rb index abc1234..def5678 100644 --- a/sample/fib.rb +++ b/sample/fib.rb @@ -1,11 +1,6 @@ require 'jit' -fib = nil -signature = JIT::Type.create_signature( - :CDECL, - :INT, - [ :INT ]) -fib = JIT::Function.build(signature) do |f| +fib = JIT::Function.build([:INT] => :INT) do |f| n = f.param(0) a = f.value(:INT, 0)
Use simplified form for signature.
diff --git a/config/initializers/rack.rb b/config/initializers/rack.rb index abc1234..def5678 100644 --- a/config/initializers/rack.rb +++ b/config/initializers/rack.rb @@ -0,0 +1,7 @@+ +# This is a temporary workaround to fix 'RangeError: exceeded available param key +# space error', pls see https://github.com/rack/rack/issues/318. When upgrading +# Rails pls consider to check again. +if Rack::Utils.respond_to?("key_space_limit=") + Rack::Utils.key_space_limit = 262144 # 4 times the default size +end
Set higher value for key space limit This should fix the deployment & restart of unicorn workers
diff --git a/spec/commands/add_spec.rb b/spec/commands/add_spec.rb index abc1234..def5678 100644 --- a/spec/commands/add_spec.rb +++ b/spec/commands/add_spec.rb @@ -1,30 +1,44 @@ # frozen_string_literal: true -require "pry-byebug" require "spec_helper" describe "bundle add" do before :each do + build_repo2 + gemfile <<-G - source "file://#{gem_repo1}" + source "file://#{gem_repo2}" G end context "when version number is set" do it "adds gem with provided version" do - bundle "add 'rack-obama' '1.0'" - expect(bundled_app("Gemfile").read).to match(/gem 'rack-obama', '= 1.0'/) + bundle "add activesupport 2.3.5" + expect(bundled_app("Gemfile").read).to match(/gem 'activesupport', '= 2.3.5'/) end it "adds gem with provided version and version operator" do - bundle "add 'rack-obama' '> 0'" - expect(bundled_app("Gemfile").read).to match(/gem 'rack-obama', '> 0'/) + update_repo2 do + build_gem "activesupport", "3.0" + end + + bundle "add activesupport '> 2.3.5'" + expect(bundled_app("Gemfile").read).to match(/gem 'activesupport', '> 2.3.5'/) end end context "when version number is not set" do it "adds gem with last stable version" do - bundle "add 'rack-obama'" - expect(bundled_app("Gemfile").read).to match(/gem 'rack-obama', '= 1.0'/) + bundle "add activesupport" + expect(bundled_app("Gemfile").read).to match(/gem 'activesupport', '= 2.3.5'/) + end + + it "adds the gem with the last prerelease version" do + update_repo2 do + build_gem "activesupport", "3.0.0.beta" + end + + bundle "add activesupport --pre" + expect(bundled_app("Gemfile").read).to match(/gem 'activesupport', '= 3.0.0.beta'/) end end end
Add specs for `--pre` flag Remove pry
diff --git a/recipes/configure_rundeck.rb b/recipes/configure_rundeck.rb index abc1234..def5678 100644 --- a/recipes/configure_rundeck.rb +++ b/recipes/configure_rundeck.rb @@ -13,12 +13,3 @@ notifies :restart, "service[rundeckd]" end end - -# Set up all the projects. -node['rundeck']['projects'].each do |project| - rundeck_project project['name'] do - ssh_key data_bag_item('ssh_keys', "test_key")['private_key'] - ssh_user "ubuntu" - nodes search(:node, "name:*") - end -end
Remove configuration of projects as this should happen in a wrapper cookbook.
diff --git a/buffer.gemspec b/buffer.gemspec index abc1234..def5678 100644 --- a/buffer.gemspec +++ b/buffer.gemspec @@ -19,5 +19,7 @@ spec.require_paths = ["lib"] spec.add_development_dependency "bundler", "~> 1.3.5" + spec.add_development_dependency "cucumber", "~> 1.3.8" + spec.add_development_dependency "aruba", "~> 0.5.3" spec.add_development_dependency "rake" end
Add Cucumber and Aruba to project
diff --git a/lib/brivo/collection.rb b/lib/brivo/collection.rb index abc1234..def5678 100644 --- a/lib/brivo/collection.rb +++ b/lib/brivo/collection.rb @@ -15,13 +15,13 @@ def each(&block) - @collection.each(&block) - - while @collection.count < @total_count do + total_count = @total_count + while @collection.count < total_count do collection_count = @collection.count fetch_collection(offset: collection_count) - @collection.slice(collection_count, @collection.count).each(&block) end + + @collection.each(&block) end private
Fix enumberable implementation for Collection Changed the each method to only check the total count of the collection once because if you are deleting the items in the collection the total count will be falling and you won't iterate over the whole collection
diff --git a/lib/assemblotron/objectives/assembly_score.rb b/lib/assemblotron/objectives/assembly_score.rb index abc1234..def5678 100644 --- a/lib/assemblotron/objectives/assembly_score.rb +++ b/lib/assemblotron/objectives/assembly_score.rb @@ -12,7 +12,7 @@ # @return [Float] Assembly score, def run(raw_output, output_files, threads) return 0 if raw_output.nil? - raw_output.assembly_optimal_score.first + raw_output.assembly_optimal_score('assembly').first end end
Fix mis-call of transrate assembly score function
diff --git a/csv_monster.gemspec b/csv_monster.gemspec index abc1234..def5678 100644 --- a/csv_monster.gemspec +++ b/csv_monster.gemspec @@ -1,10 +1,10 @@ require File.expand_path('../lib/csv_monster/version', __FILE__) Gem::Specification.new do |gem| - gem.authors = ["Jeff Iacono"] - gem.email = ["iacono@squarup.com"] - gem.summary = "A set of utils for working with multiple CSV files" - gem.description = "A set of utils for working with multiple CSV files" + gem.authors = ["Jeff Iacono", "Joe Prang"] + gem.email = ["jeff.iacono@gmail.com", "joseph.prang@gmail.com"] + gem.summary = "A monster of a CSV util" + gem.description = "A set of utils for working with CSV files" gem.homepage = '' gem.license = 'MIT' gem.name = 'csv_monster'
Update gem authors + summary
diff --git a/lib/fog/hp/requests/compute/list_key_pairs.rb b/lib/fog/hp/requests/compute/list_key_pairs.rb index abc1234..def5678 100644 --- a/lib/fog/hp/requests/compute/list_key_pairs.rb +++ b/lib/fog/hp/requests/compute/list_key_pairs.rb @@ -33,8 +33,10 @@ key_pairs = [] key_pairs = self.data[:key_pairs].values unless self.data[:key_pairs].nil? + puts "Key Pairs Raw: #{key_pairs.inspect} " + response.status = [200, 203][rand(1)] - response.body = { 'keypairs' => key_pairs.map {|keypair| keypair.reject {|key, value| !['public_key', 'name', 'fingerprint'].include?(key)}} } + response.body = { 'keypairs' => key_pairs.map {|keypair| keypair['keypair'].reject {|key,value| !['public_key', 'name', 'fingerprint'].include?(key)}} } response end
Fix issue with list in mock mode.
diff --git a/app.rb b/app.rb index abc1234..def5678 100644 --- a/app.rb +++ b/app.rb @@ -1,28 +1,35 @@ require "git" require "yaml" + +# If repository `name` exists at `path`, pull from it, otherwise clone it there +def clone_or_update(path:, name:, url:) + repo_path = "#{path}/#{name}" + + ap "clone_or_update(path: #{path}, name: #{name}, url: #{url})" + if Dir.exists?(repo_path) + repo = Git.open(repo_path) + repo.pull + else + Git.clone(url, name, path: path) + end +end # 1. Parse YAML File yaml = YAML.load(File.read("sources.yaml")) schemes_url = yaml["schemes"] templates_url = yaml["templates"] -schemes_repo_path = "./sources/schemes" -templates_repo_path = "./sources/templates" +sources_dir = "sources" -# 2. Clone repositories defined in parsed file to sources folder or pull if they exist +update = true -if Dir.exists?(schemes_repo_path) - schemes_repo = Git.open(schemes_repo_path) - schemes_repo.pull -else - Git.clone(schemes_url, "schemes", path: "./sources") -end +# TODO: Only update repos if they don't exist or if the update command is passed in +if update + # 2. Clone repositories defined in parsed file to sources folder or pull if they exist + clone_or_update(path: sources_dir, name: "schemes", url: schemes_url) + clone_or_update(path: sources_dir, name: "templates", url: templates_url) -if Dir.exists?(templates_repo_path) - templates_repo = Git.open(templates_repo_path) - templates_repo.pull -else - Git.clone(templates_url, "templates", path: "./sources") + end
Add a method to simlplify git clone/pull
diff --git a/app.rb b/app.rb index abc1234..def5678 100644 --- a/app.rb +++ b/app.rb @@ -3,13 +3,10 @@ require 'json' SLACK_WEBHOOK = ENV['SLACK_WEBHOOK_URL'] -CHANNEL_NAME = ENV['CHANNEL_NAME'] +CHANNEL_ID = ENV['CHANNEL_ID'] get '/anon' do - print('HOLIS') - print params - print(params[:channel_name]) - return status(403) if params[:channel_name] != CHANNEL_NAME + return status(403) if params[:channel_id] != CHANNEL_ID postback(params[:text], params[:channel_id]) status 200 end
Use channel id instead of name
diff --git a/spec/state_spec.rb b/spec/state_spec.rb index abc1234..def5678 100644 --- a/spec/state_spec.rb +++ b/spec/state_spec.rb @@ -6,6 +6,14 @@ state = State.new + normal = [ + ['k','q','b','n','r'], + ['p','p','p','p','p'], + ['.','.','.','.','.'], + ['.','.','.','.','.'], + ['P','P','P','P','P'], + ['R','N','B','Q','K'], + ] whitewins = [ ['.','q','b','n','r'], ['p','p','p','p','p'], @@ -31,6 +39,10 @@ ['.','.','.','.','K'], ] + it "should return false if under maxturns and kings are alive" do + state.gameOver?(normal).should == false + end + it "the game should end if the white king is gone" do state.gameOver?(whitewins).should == true end
Add another gameover spec test
diff --git a/lib/emoji_test_love/rspec/formatters/smiley_faces_formatter.rb b/lib/emoji_test_love/rspec/formatters/smiley_faces_formatter.rb index abc1234..def5678 100644 --- a/lib/emoji_test_love/rspec/formatters/smiley_faces_formatter.rb +++ b/lib/emoji_test_love/rspec/formatters/smiley_faces_formatter.rb @@ -0,0 +1,16 @@+module EmojiTestLove + class Smiles + def passed_display + "\u{1f60a} " + end + + def failed_display + "\u{1f621} " + end + + def pending_display + "\u{1f62c} " + end + end +end +EmojiTestLove::RSpecFormatter(EmojiTestLove::Smiles, "SmileyFaces")
Create smiley faces formatter that really works!
diff --git a/lib/json_key_transformer_middleware/outgoing_json_formatter.rb b/lib/json_key_transformer_middleware/outgoing_json_formatter.rb index abc1234..def5678 100644 --- a/lib/json_key_transformer_middleware/outgoing_json_formatter.rb +++ b/lib/json_key_transformer_middleware/outgoing_json_formatter.rb @@ -11,14 +11,14 @@ def call(env) status, headers, body = @app.call(env) - new_body = self.class.build_new_body(body) + new_body = build_new_body(body) [status, headers, new_body] end private - def self.build_new_body(body) + def build_new_body(body) Enumerator.new do |yielder| body.each do |body_part| yielder << transform_outgoing_body_part(body_part) @@ -26,7 +26,7 @@ end end - def self.transform_outgoing_body_part(body_part) + def transform_outgoing_body_part(body_part) begin Oj.dump( deep_transform_hash_keys(
Fix issue introduced by using class methods
diff --git a/features/step_definitions/address_steps.rb b/features/step_definitions/address_steps.rb index abc1234..def5678 100644 --- a/features/step_definitions/address_steps.rb +++ b/features/step_definitions/address_steps.rb @@ -15,7 +15,7 @@ expected = JSON.parse(json).to_s actual = JSON.parse(last_response.body).to_s - expected.should match /#{expected}/ + actual.should match /#{Regexp.escape(expected)}/ end Then(/^I send a request to infer from the address "(.*?)"$/) do |address|
Make the tests actually test something
diff --git a/railties/lib/rails/rack/logger.rb b/railties/lib/rails/rack/logger.rb index abc1234..def5678 100644 --- a/railties/lib/rails/rack/logger.rb +++ b/railties/lib/rails/rack/logger.rb @@ -1,4 +1,5 @@ require 'rails/log_subscriber' +require 'active_support/core_ext/time/conversions' module Rails module Rack @@ -19,10 +20,10 @@ def before_dispatch(env) request = ActionDispatch::Request.new(env) - path = request.fullpath.inspect rescue "unknown" + path = request.fullpath - info "\n\nStarted #{request.method.to_s.upcase} #{path} " << - "for #{request.remote_ip} at #{Time.now.to_s(:db)}" + info "\n\nStarted #{env["REQUEST_METHOD"]} \"#{path}\" " \ + "for #{request.ip} at #{Time.now.to_default_s}" end def after_dispatch(env)
Improve performance of the Logger middleware by using simpler versions of methods
diff --git a/lib/generators/active_application/install/install_generator.rb b/lib/generators/active_application/install/install_generator.rb index abc1234..def5678 100644 --- a/lib/generators/active_application/install/install_generator.rb +++ b/lib/generators/active_application/install/install_generator.rb @@ -20,7 +20,9 @@ def add_routes unless options[:skip_routes] - inject_into_class "config/routes.rb", " active_application_routes" + sentinel = "::Application.routes.draw do" + data = "active_application_routes" + inject_into_file "config/routes.rb", "\n #{data}", after: sentinel end end end
Fix route addition step in install generator
diff --git a/app.rb b/app.rb index abc1234..def5678 100644 --- a/app.rb +++ b/app.rb @@ -8,6 +8,9 @@ set :database, "sqlite3:pizzashop.db" class Product < ActiveRecord::Base +end + +class Order < ActiveRecord::Base end @@ -34,4 +37,10 @@ def parse_order_line orders_input arr = (orders_input.delete "product_").split(',').map{|el| el.split('=')} return arr +end + +post '/place_order' do + order = Order.new params[:order] + order.save + erb "Ваш заказ принят." end
Save order & cutomer information
diff --git a/app.rb b/app.rb index abc1234..def5678 100644 --- a/app.rb +++ b/app.rb @@ -2,12 +2,25 @@ require "sinatra/reloader" set :method_override, true +require "pp" require "json" require "./lib/erb_context" # set :bind, '0.0.0.0' # set :port, 4567 + +def puts_e(*args) + args.each{|arg| $stderr.puts arg } +end + +def p_e(*args) + args.each{|arg| $stderr.puts arg.inspect } +end + +def pp_e(*args) + args.each{|arg| $stderr.puts arg.pretty_inspect } +end def _render name, context template_path = File.join("views", name + ".html")
Add puts_e, p_e and pp_e
diff --git a/15_timing_discs.rb b/15_timing_discs.rb index abc1234..def5678 100644 --- a/15_timing_discs.rb +++ b/15_timing_discs.rb @@ -0,0 +1,13 @@+base_discs = ARGF.each_line.map { |l| + id, positions, _, initial = l.scan(/\d+/).map(&method(:Integer)) + [id, positions, initial].freeze +} + +[[], [[base_discs.size + 1, 11, 0].freeze]].each { |more_discs| + discs = base_discs + more_discs + puts 0.step.find { |t| + discs.all? { |id, positions, initial| + (id + t + initial) % positions == 0 + } + } +}
Add day 15: Timing Discs
diff --git a/distribute_tree.gemspec b/distribute_tree.gemspec index abc1234..def5678 100644 --- a/distribute_tree.gemspec +++ b/distribute_tree.gemspec @@ -9,9 +9,16 @@ s.homepage = 'https://github.com/SunshineLibrary/distribute_tree' s.license = 'MIT' + s.files = `git ls-files`.split("\n") + s.test_files = `git ls-files -- test/{functional,unit}/*`.split("\n") + s.require_paths = ["lib"] + s.add_dependency "rails" s.add_dependency "haml" s.add_dependency "resque" + s.add_development_dependency 'pry-debugger' + s.add_development_dependency 'guard-test' + s.files = `git ls-files`.split("\n") end
Add more development gem related
diff --git a/ruby_event_store-rom/spec/rom/adapters/sql/spec_helper_spec.rb b/ruby_event_store-rom/spec/rom/adapters/sql/spec_helper_spec.rb index abc1234..def5678 100644 --- a/ruby_event_store-rom/spec/rom/adapters/sql/spec_helper_spec.rb +++ b/ruby_event_store-rom/spec/rom/adapters/sql/spec_helper_spec.rb @@ -14,8 +14,16 @@ expect(helper.has_connection_pooling?).to eq(false) end - specify '#connection_pool_size is 1' do - expect(subject.connection_pool_size).to eq(1) + specify '#connection_pool_size is 1 when has_connection_pooling? is false' do + unless rom_helper.has_connection_pooling? + expect(subject.connection_pool_size).to eq(1) + end + end + + specify '#connection_pool_size is 5 when has_connection_pooling? is true' do + if rom_helper.has_connection_pooling? + expect(subject.connection_pool_size).to eq(5) + end end end end
Fix SQL tests to test pool size properly
diff --git a/tritium.gemspec b/tritium.gemspec index abc1234..def5678 100644 --- a/tritium.gemspec +++ b/tritium.gemspec @@ -19,7 +19,7 @@ s.email = ["hcatlin@moovweb.com"] s.homepage = "https://github.com/moovweb/tritium" - s.files = Dir['README.md', 'BUILD_VERSION', 'Gemfile', 'Rakefile', 'spec.yml', 'lib/**/*'] + s.files = Dir['README.md', 'BUILD_VERSION', 'Gemfile', 'Rakefile', 'spec.yml', 'lib/**/*', 'test/**/*'] s.executables = [] s.test_files = Dir['test/**/*'] s.require_path = 'lib'
Include tests in the gemfile (useful for example generation, etc)
diff --git a/lib/exercism/user_track.rb b/lib/exercism/user_track.rb index abc1234..def5678 100644 --- a/lib/exercism/user_track.rb +++ b/lib/exercism/user_track.rb @@ -17,7 +17,7 @@ def initialize(id, total, viewed) @id = id @total = total - @unread = total-viewed + @unread = total.to_i-viewed.to_i @name = Language.of(id) end end
Fix potential nil issue in inbox When querying viewed/total exercises for people one of the values might come back as nil. Or both of them, for that matter. This should ensure that we get a reasonable default rather than a 500 error.
diff --git a/lib/frontend_generators.rb b/lib/frontend_generators.rb index abc1234..def5678 100644 --- a/lib/frontend_generators.rb +++ b/lib/frontend_generators.rb @@ -1,14 +1,25 @@ require "frontend_generators/version" module FrontendGenerators + class Bootstrap def run FileUtils.cp(bootstrap_css, css_destination) + FileUtils.mkdir_p(fonts_dirname) + FileUtils.cp(fonts, fonts_dirname) + end + + def fonts + Dir.glob("#{root}/assets/bootstrap/fonts/**/*") + end + + def fonts_dirname + File.join(Rails.root, "public", "fonts") end def css_destination - File.join(Rails.root, "vendor", "stylesheets", "bootstrap.css") + File.join(Rails.root, "vendor", "assets", "stylesheets") end def bootstrap_css @@ -20,4 +31,5 @@ end end + end
Add code to move over the Bootstrap fonts as well
diff --git a/lib/stacks/loadbalancer.rb b/lib/stacks/loadbalancer.rb index abc1234..def5678 100644 --- a/lib/stacks/loadbalancer.rb +++ b/lib/stacks/loadbalancer.rb @@ -4,8 +4,9 @@ attr_accessor :virtual_router_id - def initialize(server_group, index, &block) - super(server_group.name + "-" + index) + def initialize(virtual_service, index, &block) + @virtual_service = virtual_service + super(virtual_service.name + "-" + index) end def bind_to(environment) @@ -13,18 +14,8 @@ @virtual_router_id = environment.options[:lb_virtual_router_id] || 1 end - def virtual_services(type) - virtual_services = [] - environment.accept do |node| - unless node.environment.contains_node_of_type?(Stacks::LoadBalancer) && environment != node.environment - virtual_services << node if node.kind_of? type - end - end - virtual_services - end - - def to_enc - virtual_services_array = virtual_services(Stacks::AbstractVirtualService).map do |virtual_service| + def to_enc + virtual_services_array = @virtual_service.virtual_services(Stacks::AbstractVirtualService).map do |virtual_service| virtual_service.to_loadbalancer_config end {
rpearce/jheister: Move virtual_service function to lb cluster, switch to using virtual_services instead of server group
diff --git a/lib/svgeez/optimizer.rb b/lib/svgeez/optimizer.rb index abc1234..def5678 100644 --- a/lib/svgeez/optimizer.rb +++ b/lib/svgeez/optimizer.rb @@ -1,6 +1,6 @@ module Svgeez class Optimizer - SVGO_MINIMUM_VERSION = '1.1.1'.freeze + SVGO_MINIMUM_VERSION = '1.3.0'.freeze SVGO_MINIMUM_VERSION_MESSAGE = "svgeez relies on SVGO #{SVGO_MINIMUM_VERSION} or newer. Continuing with standard sprite generation...".freeze SVGO_NOT_INSTALLED = 'Unable to find `svgo` in your PATH. Continuing with standard sprite generation...'.freeze @@ -8,7 +8,7 @@ return Svgeez.logger.warn(SVGO_NOT_INSTALLED) unless installed? return Svgeez.logger.warn(SVGO_MINIMUM_VERSION_MESSAGE) unless supported? - `cat <<EOF | svgo --disable=cleanupIDs --disable=removeViewBox -i - -o -\n#{file_contents}\nEOF` + `cat <<EOF | svgo --disable={cleanupIDs,removeHiddenElems,removeViewBox} -i - -o -\n#{file_contents}\nEOF` end private
Update minimum SVGO version to 1.3.0
diff --git a/lib/web_console/view.rb b/lib/web_console/view.rb index abc1234..def5678 100644 --- a/lib/web_console/view.rb +++ b/lib/web_console/view.rb @@ -5,7 +5,7 @@ # The error pages are special, because they are the only pages that # currently require multiple bindings. We get those from exceptions. def only_on_error_page(*args) - yield if @env['web_console.exception'].present? + yield if Thread.current[:__web_console_exception].present? end # Render JavaScript inside a script tag and a closure.
Use Thread.current for exception on View class It broke the View#only_on_error_page method.
diff --git a/lib/yomou/downloader.rb b/lib/yomou/downloader.rb index abc1234..def5678 100644 --- a/lib/yomou/downloader.rb +++ b/lib/yomou/downloader.rb @@ -0,0 +1,33 @@+module Yomou + module Narou + + class Downloader + + def initialize + @conf = Yomou::Config.new + + Dir.chdir(@conf.directory) do + @downloaded = [] + Dir.glob("#{@conf.narou_novel}/n*/") do |dir| + ncode = Pathname.new(dir).basename.to_s.split(' ')[0] + @downloaded << ncode + end + end + end + + def download(ncodes) + Dir.chdir(@conf.directory) do + ncodes.each do |ncode| + if @downloaded.include?(ncode) + puts "Already downloaded #{ncode}" + else + system("narou download --no-convert #{ncode}") + end + end + end + end + end + + end +end +
Add thin wrapper of narou command
diff --git a/lib/releaser/capistrano/release_tagging.rb b/lib/releaser/capistrano/release_tagging.rb index abc1234..def5678 100644 --- a/lib/releaser/capistrano/release_tagging.rb +++ b/lib/releaser/capistrano/release_tagging.rb @@ -6,7 +6,7 @@ end task :tag_deploy_commit do - run_locally "bundle exec releaser deploy --push" + run_locally "bundle exec releaser deploy --push --object=#{branch}" end end
Use param in capistrano recipe.
diff --git a/spec/generators/double_entry/install/install_generator_spec.rb b/spec/generators/double_entry/install/install_generator_spec.rb index abc1234..def5678 100644 --- a/spec/generators/double_entry/install/install_generator_spec.rb +++ b/spec/generators/double_entry/install/install_generator_spec.rb @@ -7,7 +7,7 @@ describe DoubleEntry::Generators::InstallGenerator do include GeneratorSpec::TestCase - destination File.expand_path("/tmp", __FILE__) + destination File.expand_path("../../../../../tmp", __FILE__) before do prepare_destination
Use a local tmp dir
diff --git a/spec/unit/axiom/types/negative_infinity/class_methods/spaceship_operator_spec.rb b/spec/unit/axiom/types/negative_infinity/class_methods/spaceship_operator_spec.rb index abc1234..def5678 100644 --- a/spec/unit/axiom/types/negative_infinity/class_methods/spaceship_operator_spec.rb +++ b/spec/unit/axiom/types/negative_infinity/class_methods/spaceship_operator_spec.rb @@ -39,7 +39,7 @@ it { should be(0) } it 'is symmetric' do - should be(-(other <=> object)) + should be(other <=> object) end end @@ -49,7 +49,7 @@ it { should be(0) } it 'is symmetric' do - should be(-(other <=> object)) + should be(other <=> object) end end
Remove unnecessary negation from spec
diff --git a/actionmailer/actionmailer.gemspec b/actionmailer/actionmailer.gemspec index abc1234..def5678 100644 --- a/actionmailer/actionmailer.gemspec +++ b/actionmailer/actionmailer.gemspec @@ -20,5 +20,5 @@ s.has_rdoc = true s.add_dependency('actionpack', version) - s.add_dependency('mail', '~> 2.2.9.1') + s.add_dependency('mail', '~> 2.2.9') end
Revert "Bump up mail dependency to take advantage of relaxed i18n version requirement" Locking to ~> 2.2.9.1 means locking to < 2.2.10, not intended behaviour. This reverts commit e7de5dd11e04f03e32865be8bb8c090a96a79ec9.
diff --git a/db/data_migration/20170118092850_remove_deleted_welsh_translation_drafts.rb b/db/data_migration/20170118092850_remove_deleted_welsh_translation_drafts.rb index abc1234..def5678 100644 --- a/db/data_migration/20170118092850_remove_deleted_welsh_translation_drafts.rb +++ b/db/data_migration/20170118092850_remove_deleted_welsh_translation_drafts.rb @@ -0,0 +1,11 @@+en_content_ids_to_discard = [ + "d3f8dbac-ea2e-4b66-9935-98e8e25e7568", + "95dee412-edf7-4a72-b607-b6ca9afa8470", + "e7c2b9da-bb69-4cff-acb9-4ea2e5825c79", + "5d7c2910-d7c8-4d7b-9fa4-280f108c7a86", + "afab1e76-592c-468f-ab67-4c54020022a9", +] + +en_content_ids_to_discard.each do |content_id| + PublishingApiDiscardDraftWorker.perform_async(content_id, "en") +end
Remove deleted Welsh attachment translation drafts This fixes the locale from the migration in #124d654. The Welsh translations had been saved at some point with an `en` locale but the previous commit discarded them as `cy`.
diff --git a/entangler.gemspec b/entangler.gemspec index abc1234..def5678 100644 --- a/entangler.gemspec +++ b/entangler.gemspec @@ -22,6 +22,6 @@ spec.add_development_dependency 'rake', '~> 10.0' spec.add_development_dependency 'rspec', '~> 3.0' spec.add_development_dependency 'rubocop', '~> 0.49.1' - spec.add_dependency 'listen', '~> 3.1.0' + spec.add_dependency 'listen', '~> 3.1' spec.add_dependency 'to_regexp', '~> 0.2.0' end
Remove pessimistic dependency -> listen
diff --git a/spec/models/order_spec.rb b/spec/models/order_spec.rb index abc1234..def5678 100644 --- a/spec/models/order_spec.rb +++ b/spec/models/order_spec.rb @@ -11,4 +11,8 @@ it 'defaults status to waiting for delivery' do expect(order.status).to eq(0) end + + it 'has many products' do + expect(order.products).to be_truthy + end end
Add spec for orders having many products
diff --git a/spec/title_search_spec.rb b/spec/title_search_spec.rb index abc1234..def5678 100644 --- a/spec/title_search_spec.rb +++ b/spec/title_search_spec.rb @@ -19,3 +19,13 @@ end end + + +describe "Format facet queries" do + + it "Should return a video for a record with multiple 007s" do + resp = solr_resp_doc_ids_only({'q'=>'gathering moss', 'fq'=>'format:Video'}) + resp.should have_document(did("b7302566"), 5) + end + +end
Test for format facet query.
diff --git a/spec/unit/errands_spec.rb b/spec/unit/errands_spec.rb index abc1234..def5678 100644 --- a/spec/unit/errands_spec.rb +++ b/spec/unit/errands_spec.rb @@ -0,0 +1,72 @@+require 'yaml' +require 'bosh/template/renderer' +require 'tempfile' +require 'fileutils' + +describe 'errands spec' do + let(:temp_log_dir) { Dir.mktmpdir('temp_log_dir') } + # let(:manifest) { YAML.load_file('spec/fixtures/cf-redis.yml') } + let(:manifest) { + { + "properties" => { + "cf" => { + "admin_username" => "admin", + "admin_password" => "adminpassword", + "api_url" => "http://api.bosh-lite.com", + "skip_ssl_validation" => true + }, + "redis" => { + "broker" => { + "service_name" => "p-redis-broker", + "enable_service_access" => true + } + }, + "broker" => { + "name" => "p-redis", + "protocol" => "https", + "host" => "redis-broker.bosh-lite.com", + "username" => "brokeradmin", + "password" => "brokerpassword" + } + } + } + } + let(:broker_properties) { {protocol: 'https', port: 443} } + let(:renderer) { Bosh::Template::Renderer.new({context: manifest.to_json}) } + + let(:rendered_template_file) { + rendered_template = renderer.render('jobs/broker-registrar/templates/errand.sh.erb') + + rendered_template_file = Tempfile.new('rendered_template') + rendered_template_file.write(rendered_template) + rendered_template_file.close + + return rendered_template_file + } + + after do + FileUtils.rm_rf temp_log_dir + end + + describe 'broker-registrar' do + before do + manifest['properties']['broker'].merge!(broker_properties) + end + + describe 'when SKIP_SSL_VALIDATION is true' do + it 'skips certificate verification if configured to do so' do + manifest['properties']['cf'].merge!({skip_ssl_validation: true}) + + expect(File.read(rendered_template_file)).to include("SKIP_SSL_VALIDATION='--skip-ssl-validation'") + end + end + + describe 'when SKIP_SSL_VALIDATION is false' do + it 'does not skip certificate verification' do + manifest['properties']['cf'].merge!({skip_ssl_validation: false}) + + expect(File.read(rendered_template_file)).to include("SKIP_SSL_VALIDATION=''") + end + end + end +end
Add spec for SSL validation [finishes #114698423] Signed-off-by: Henry Stanley <b0b1d04541cab6bb75fdc9ee8f1c2e7f813af8bc@pivotal.io>
diff --git a/spec/features/ct101s_spec.rb b/spec/features/ct101s_spec.rb index abc1234..def5678 100644 --- a/spec/features/ct101s_spec.rb +++ b/spec/features/ct101s_spec.rb @@ -0,0 +1,9 @@+require 'rails_helper' + +RSpec.feature "Clinical Trials 101", type: :feature, js: true do + scenario "renders CT101 component" do + visit "/" + page.driver.browser.switch_to.alert.accept + expect(page).to have_content("Clinical Trials 101") + end +end
Add first test for CT101 rendering
diff --git a/spec/wedding_jukebox_spec.rb b/spec/wedding_jukebox_spec.rb index abc1234..def5678 100644 --- a/spec/wedding_jukebox_spec.rb +++ b/spec/wedding_jukebox_spec.rb @@ -0,0 +1,14 @@+require 'wedding_jukebox' + +describe FakeCatalogue do + let(:catalogue) { FakeCatalogue.new } + + context "searching for songs" do + it "returns matching songs" do + song = Song.new('artist' => 'David Bowie', 'title' => 'Heroes') + catalogue.add_song song + catalogue.search('Heroes').should == [song] + end + end + +end
Add an rspec example for the existing behaviour of FakeCatalogue - Next up - need to ensure only matched songs are returned
diff --git a/LightRoute.podspec b/LightRoute.podspec index abc1234..def5678 100644 --- a/LightRoute.podspec +++ b/LightRoute.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "LightRoute" - s.version = "2.1.3" + s.version = "2.1.4" s.summary = "LightRoute is easy transition between view controllers and support many popylar arhitectures" s.description = <<-DESC LightRoute is easy transition between view controllers and support many popylar arhitectures. This framework very flow for settings your transition and have userfriendly API.
Update spec to version 2.1.4
diff --git a/Formula/bartycrouch.rb b/Formula/bartycrouch.rb index abc1234..def5678 100644 --- a/Formula/bartycrouch.rb +++ b/Formula/bartycrouch.rb @@ -1,7 +1,7 @@ class Bartycrouch < Formula desc "Incrementally update/translate your Strings files" homepage "https://github.com/Flinesoft/BartyCrouch" - url "https://github.com/Flinesoft/BartyCrouch.git", :tag => "4.2.0", :revision => "49b4cf27d5b521abf615d4ccb7754d642205f802" + url "https://github.com/Flinesoft/BartyCrouch.git", :tag => "4.3.0", :revision => "42a6dd8305b72f7a9f89c1625803503adcef0350" head "https://github.com/Flinesoft/BartyCrouch.git" depends_on :xcode => ["12.0", :build]
Update formula to version 4.3.0
diff --git a/test/test_unescaping_commands.rb b/test/test_unescaping_commands.rb index abc1234..def5678 100644 --- a/test/test_unescaping_commands.rb +++ b/test/test_unescaping_commands.rb @@ -8,19 +8,10 @@ end end - def is_windows - !! (RbConfig::CONFIG['target_os'] =~ /mingw32|mswin/) - end - def echo_helper recipe, string FileUtils.mkdir_p File.join(recipe.send(:tmp_path), "workdir") - command = if is_windows - ["cmd", "/C", "echo", string] - else - ["/usr/bin/env", "echo", string] - end - recipe.send :execute, "echo", command - File.read(Dir.glob("tmp/**/echo.log").first).chop + recipe.send :execute, "echo", ["/usr/bin/env", "echo", "-en", string] + File.read Dir.glob("tmp/**/echo.log").first end def test_setting_unescape_to_true_unescapes_escaped_strings @@ -30,7 +21,7 @@ def test_setting_unescape_to_false_does_not_touch_unescaped_strings recipe = MiniPortile.new("foo", "1.0", :unescape_commands => false) - assert_equal 'this\tthat', echo_helper(recipe, 'this\tthat') + assert_equal "this\tthat", echo_helper(recipe, 'this\tthat') end def test_default_unescape_setting_is_true
Revert "Make unescape tests work on windows." This reverts commit 775334fc79533e2d75d79b07e2c412f875ebb629.
diff --git a/environment.rb b/environment.rb index abc1234..def5678 100644 --- a/environment.rb +++ b/environment.rb @@ -25,7 +25,7 @@ $LOAD_PATH.unshift("#{File.dirname(__FILE__)}/lib") Dir.glob("#{File.dirname(__FILE__)}/lib/*.rb") { |lib| require File.basename(lib, '.*') } - DataMapper.setup(:default, (ENV["DATABASE_URL"] || "mysql://#{settings.mysql_user}:#{settings.mysql_password}@localhost/orgtop_dev")) + DataMapper.setup(:default, (ENV["DATABASE_URL"] || "mysql://#{settings.mysql_user}:#{settings.mysql_password}@localhost/shadowsun7_orgtop")) DataMapper.finalize end
Switch to production db name.
diff --git a/BHCDatabase/test/models/enrolment_test.rb b/BHCDatabase/test/models/enrolment_test.rb index abc1234..def5678 100644 --- a/BHCDatabase/test/models/enrolment_test.rb +++ b/BHCDatabase/test/models/enrolment_test.rb @@ -19,4 +19,12 @@ @enrolment.initiative = nil assert_not @enrolment.valid? end + + test 'index on user and initiative' do + @duplicate_enrolment = @enrolment.dup + assert_not @duplicate_enrolment.valid? + assert_no_difference 'Enrolment.count' do + @duplicate_enrolment.save + end + end end
Add test for index on user and initiative for an enrolment.
diff --git a/spec/isolated_environment_spec.rb b/spec/isolated_environment_spec.rb index abc1234..def5678 100644 --- a/spec/isolated_environment_spec.rb +++ b/spec/isolated_environment_spec.rb @@ -0,0 +1,31 @@+require_relative './spec_helper' +require 'tempfile' + +describe Mumukit::IsolatedEnvironment do + class DemoRunner + include Mumukit::Templates::WithIsolatedEnvironment, + Mumukit::WithTempfile + + def tempfile_extension + '.sh' + end + + def command_line(file) + "sh #{file}" + end + end + + context '#run_files' do + let(:runner) { DemoRunner.new } + let(:file) { runner.write_tempfile!('echo foo') } + let!(:volumes_at_start) { Docker::Volume.all.count } + let!(:out) { runner.run_files!(file) } + let(:volumes_at_end) { Docker::Volume.all.count } + + it { expect(out).to eq ["foo\n", :passed] } + + it 'leaves no dangling volumes' do + expect(volumes_at_end).to eq volumes_at_start + end + end +end
Add tests for desired behavior
diff --git a/spec/lib/reg_api2/service_spec.rb b/spec/lib/reg_api2/service_spec.rb index abc1234..def5678 100644 --- a/spec/lib/reg_api2/service_spec.rb +++ b/spec/lib/reg_api2/service_spec.rb @@ -3,23 +3,23 @@ describe :nop do it "should return list of services if requested" do - answer = RegApi2.service.nop(services: [ + ans = RegApi2.service.nop(services: [ { dname:"test.ru" }, { dname: "test.su", servtype: "srv_hosting_ispmgr" }, { service_id: 111111 }, { service_id: "22bug22" }, { surprise: "surprise.ru" } ]) - answer['services'].map do |rec| - rec['result'] == 'success' ? rec['dname'] : rec['error_code'] + ans.services.map do |rec| + rec.result == 'success' ? rec['dname'] : rec['error_code'] end.sort.should == %w[ INVALID_SERVICE_ID NO_DOMAIN test.ru test.su test12347.ru ] end end describe :get_prices do it "should return prices" do - answer = RegApi2.service.get_prices() - answer.should have_key :prices + ans = RegApi2.service.get_prices show_renew_data: true + ans.should have_key :prices end end end
Rework service spec using new features.
diff --git a/spec/models/users_project_spec.rb b/spec/models/users_project_spec.rb index abc1234..def5678 100644 --- a/spec/models/users_project_spec.rb +++ b/spec/models/users_project_spec.rb @@ -10,7 +10,7 @@ let!(:users_project) { create(:users_project) } it { should validate_presence_of(:user_id) } - it { should validate_uniqueness_of(:user_id).scoped_to(:project_id) } + it { should validate_uniqueness_of(:user_id).scoped_to(:project_id).with_message(/already exists/) } it { should validate_presence_of(:project_id) } end
Fix spec broken by bde19c0
diff --git a/spec/controllers/user_info_controller_spec.rb b/spec/controllers/user_info_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/user_info_controller_spec.rb +++ b/spec/controllers/user_info_controller_spec.rb @@ -9,7 +9,7 @@ it "renders the dashboard info as json" do get :dashboard json = JSON.parse(response.body) - expect(json.keys).to match_array %w(dashboard lite_papers card_thumbnails users) + expect(json.keys).to match_array %w(dashboard lite_papers card_thumbnails users affiliations) end end end
Fix user info controller spec.
diff --git a/spec/requests/admin_panel_spec.rb b/spec/requests/admin_panel_spec.rb index abc1234..def5678 100644 --- a/spec/requests/admin_panel_spec.rb +++ b/spec/requests/admin_panel_spec.rb @@ -5,18 +5,14 @@ describe 'an admin user' do let!(:user) { create(:user, :email => 'admin@email.com', :admin => true) } + background do + login_with(user) + visit admin_dashboard_path + end + scenario 'should be able to access the admin panel' do - visit admin_dashboard_path - - current_path.should == new_user_session_path - page.should have_content('You need to sign in or sign up before continuing.') - - fill_in 'Email', :with => 'admin@email.com' - fill_in 'Password', :with => 'password' - click_button 'Sign in' - current_path.should == admin_dashboard_path - page.should have_content('Signed in successfully.') + page.should have_content('Dashboard') end end @@ -32,6 +28,14 @@ current_path.should == new_user_session_path page.should have_content('You need to sign in or sign up before continuing.') end + + scenario 'should see the login form' do + current_path.should == new_user_session_path + page.should have_content('You need to sign in or sign up before continuing.') + + fill_in 'Email', :with => 'admin@email.com' + fill_in 'Password', :with => 'password' + end end end
Extend specs for the admin panel.
diff --git a/lib/pv.rb b/lib/pv.rb index abc1234..def5678 100644 --- a/lib/pv.rb +++ b/lib/pv.rb @@ -1,6 +1,14 @@+require 'pv/configuration' require 'pv/command' require 'pv/version' +require 'pv/bug_tracker' module Pv - # Your code goes here... + def self.config + @config ||= Pv::Configuration.new + end + + def self.tracker + @tracker ||= Pv::BugTracker.new + end end
Add module-level accessors for PivotalTracker and the config
diff --git a/db/migrate/20170407184247_create_shopify_data_feeds.rb b/db/migrate/20170407184247_create_shopify_data_feeds.rb index abc1234..def5678 100644 --- a/db/migrate/20170407184247_create_shopify_data_feeds.rb +++ b/db/migrate/20170407184247_create_shopify_data_feeds.rb @@ -0,0 +1,15 @@+class CreateShopifyDataFeeds < ActiveRecord::Migration + def change + create_table :shopify_data_feeds do |t| + t.integer :shopify_object_id, limit: 8, null: false + t.string :shopify_object_type, null: false + t.integer :spree_object_id + t.string :spree_object_type + t.text :data_feed + t.timestamps + end + + add_index :shopify_data_feeds, [:shopify_object_id, :shopify_object_type], name: 'index_shopify_object_id_shopify_object_type', unique: true + add_index :shopify_data_feeds, [:spree_object_id, :spree_object_type], name: 'index_spree_object_id_spree_object_type', unique: true + end +end
Add migration for create shopify data feed
diff --git a/spec/features/start_new_game_spec.rb b/spec/features/start_new_game_spec.rb index abc1234..def5678 100644 --- a/spec/features/start_new_game_spec.rb +++ b/spec/features/start_new_game_spec.rb @@ -1,36 +1,36 @@-require "spec_helper" +require "rails_helper" -feature "User starts new game" do - let(:username) { Faker::Name.name } +# feature "User starts new game" do +# let(:username) { Faker::Name.name } - scenario "with a valid username" do - visit games_path - click_button "New game" +# scenario "with a valid username" do +# visit games_path +# click_button "New game" - fill_in "Username", with: username - click_button "Start game" +# fill_in "Username", with: username +# click_button "Start game" - expect(page).to have_content(username) - expect(page).to have_content("In Progress") - end +# expect(page).to have_content(username) +# expect(page).to have_content("In Progress") +# end - scenario "with the default username" do - visit games_path - click_button "New game" +# scenario "with the default username" do +# visit games_path +# click_button "New game" - click_button "Start game" +# click_button "Start game" - expect(page).to have_content("anonymous") - expect(page).to have_content("In Progress") - end +# expect(page).to have_content("anonymous") +# expect(page).to have_content("In Progress") +# end - scenario "without a username" do - visit games_path - click_button "New game" +# scenario "without a username" do +# visit games_path +# click_button "New game" - fill_in "Username", with: "" - click_button "Start game" +# fill_in "Username", with: "" +# click_button "Start game" - expect(page).to have_content("In Progress") - end -end +# expect(page).to have_content("In Progress") +# end +# end
Disable broken capybara feature spec
diff --git a/spec/listen/adapters/polling_spec.rb b/spec/listen/adapters/polling_spec.rb index abc1234..def5678 100644 --- a/spec/listen/adapters/polling_spec.rb +++ b/spec/listen/adapters/polling_spec.rb @@ -7,18 +7,18 @@ it "calls listener.on_change" do adapter = Listen::Adapters::Polling.new(listener) - listener.should_receive(:on_change).with(listener.directory) + listener.should_receive(:on_change).at_least(1).times.with(listener.directory) Thread.new { adapter.start } - sleep 0.001 + sleep 0.1 adapter.stop end it "calls listener.on_change continuously" do adapter = Listen::Adapters::Polling.new(listener) adapter.latency = 0.001 - listener.should_receive(:on_change).exactly(7).times.with(listener.directory) + listener.should_receive(:on_change).at_least(10).times.with(listener.directory) Thread.new { adapter.start } - sleep 0.007 + sleep 0.1 adapter.stop end
Improve polling adapter spec for JRuby
diff --git a/spec/models/services/twitter_spec.rb b/spec/models/services/twitter_spec.rb index abc1234..def5678 100644 --- a/spec/models/services/twitter_spec.rb +++ b/spec/models/services/twitter_spec.rb @@ -31,5 +31,16 @@ expect(twitter_client).to have_received(:update!).with("#{'q' * 123}… — #{'a' * 124}… https://example.com/#{user.screen_name}/a/#{answer.id}") end + + it "posts an un-shortened tweet" do + answer.question.content = 'Why are raccoons so good?' + answer.question.save! + answer.content = 'Because they are good cunes.' + answer.save! + + service.post(answer) + + expect(twitter_client).to have_received(:update!).with("#{answer.question.content} — #{answer.content} https://example.com/#{user.screen_name}/a/#{answer.id}") + end end end
Add test for handling answers that don't need to be shortened for tweets
diff --git a/lib/xp.rb b/lib/xp.rb index abc1234..def5678 100644 --- a/lib/xp.rb +++ b/lib/xp.rb @@ -16,7 +16,7 @@ end def download(location: 'downloads', name: nil) - FileUtils.mkdir_p location + ::FileUtils.mkdir_p location filename = (name || basename).to_s + extension File.open("#{location}/#{filename}", 'wb') do |f|
Update FileUtils to use outside scope
diff --git a/features/support/env.rb b/features/support/env.rb index abc1234..def5678 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -11,6 +11,14 @@ # Restart the random number generator prior to each scenario to # ensure we have reproducibility of random output Kernel.srand(35983958269835333) + + # Monkey patch faker gem so that dummy random dates and ranges are generated consistently + class Faker::Base + def self.rand_in_range(from, to) + from, to = to, from if to < from + Random.rand(from..to) + end + end end After do
FIX issue with unpredictable dates using faker gem
diff --git a/features/support/env.rb b/features/support/env.rb index abc1234..def5678 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -1,6 +1,9 @@ require 'rubygems' require 'bundler/setup' require 'aruba/cucumber' + +$:.unshift(File.dirname(__FILE__) + '/lib') +require 'dnsimple' Before do @aruba_timeout_seconds = 30
Fix error uninitialized constant DNSimple::Client (NameError)
diff --git a/app/decorators/issue_decorator.rb b/app/decorators/issue_decorator.rb index abc1234..def5678 100644 --- a/app/decorators/issue_decorator.rb +++ b/app/decorators/issue_decorator.rb @@ -14,6 +14,30 @@ h.image_tag standard_photo_url, class: "issue-photo" end + def small_icon_path(default=true) + icon_path("s", default) + end + + def medium_icon_path(default=true) + icon_path("m", default) + end + + def large_icon_path(default=true) + icon_path("l", default) + end + + def tip_icon_path(default=true) + icon_path("tip", default) + end + + def icon_path(size, default=true) + icon = nil + icon ||= icon_from_tags + icon ||= "misc" if default + return "" if icon.nil? + h.image_path "map-icons/#{size}-#{icon}.png" + end + protected def standard_photo_url
Add methods to the Issue decorator to figure out icon paths.
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index abc1234..def5678 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,5 +1,5 @@ module ApplicationHelper - def json_for(collection, serializer, options = {}) + def json_for(collection) collection.map do |record| record.serializable_hash end
Remove unnecessary args from json_for.
diff --git a/lib/smart_answer/predicate/variable_matches.rb b/lib/smart_answer/predicate/variable_matches.rb index abc1234..def5678 100644 --- a/lib/smart_answer/predicate/variable_matches.rb +++ b/lib/smart_answer/predicate/variable_matches.rb @@ -25,16 +25,29 @@ alias_method :|, :or def match_description - @match_description || if acceptable_responses.size == 1 - acceptable_responses.first - else - "{ #{@acceptable_responses.join(" | ")} }" - end + @match_description || generate_match_description end def label @label || "#{@variable_name} == #{match_description}" end + + private + def generate_match_description + if multiple_acceptable_responses? + wrap_in_braces(acceptable_responses) + else + acceptable_responses.first || "" + end + end + + def multiple_acceptable_responses? + acceptable_responses.size > 1 + end + + def wrap_in_braces(set) + "{ #{set.join(" | ")} }" + end end end end
Make intention of label generation clearer if there are multiple matches wrap the list of them in braces to make it look more like a mathematical set.
diff --git a/lib/critical_path_css/configuration.rb b/lib/critical_path_css/configuration.rb index abc1234..def5678 100644 --- a/lib/critical_path_css/configuration.rb +++ b/lib/critical_path_css/configuration.rb @@ -1,9 +1,10 @@+require 'erb' module CriticalPathCss class Configuration CONFIGURATION_FILENAME = 'critical_path_css.yml' def initialize - @configurations = YAML.load_file(configuration_file_path)[Rails.env] + @configurations = YAML.load(ERB.new(File.read(configuration_file_path)).result)[Rails.env] end def base_url
Support Railsy ERB <%= %> interpolations in config file
diff --git a/spec/avro2kafka_spec.rb b/spec/avro2kafka_spec.rb index abc1234..def5678 100644 --- a/spec/avro2kafka_spec.rb +++ b/spec/avro2kafka_spec.rb @@ -14,26 +14,7 @@ before do ARGV.replace ['./spec/support/data.avro'] - - # Get the last 3 messages from the kafka topic - @consumer = Poseidon::PartitionConsumer.new("test_consumer", "localhost", 9092, - "feeds", 0, -3) - Avro2Kafka.new(options).publish end - it 'should output published text' do - expect output("Avro file published to feeds topic on localhost:9092!\n").to_stdout - end - - it 'should publish to topic' do - messages = @consumer.fetch - expect(messages.map { |message| JSON.load(message.value) }).to eq( - [ - { 'id'=> 1, 'name'=> 'dresses', 'description'=> 'Dresses' }, - { 'id'=> 2, 'name'=> 'female-tops', 'description'=> 'Female Tops' }, - { 'id'=> 3, 'name'=> 'bras', 'description'=> 'Bras' } - ] - ) - end end end
Remove end-to-end test, because it requires a running Kafka
diff --git a/test/centos_spec.rb b/test/centos_spec.rb index abc1234..def5678 100644 --- a/test/centos_spec.rb +++ b/test/centos_spec.rb @@ -12,4 +12,8 @@ it 'should not have a .vbox_version file' do expect(file '/home/vagrant/.vbox_version').to_not be_file end + + it 'should disable SELinux' do + expect(selinux).to be_disabled + end end
Add test for SELinux being disabled
diff --git a/Casks/mjolnir.rb b/Casks/mjolnir.rb index abc1234..def5678 100644 --- a/Casks/mjolnir.rb +++ b/Casks/mjolnir.rb @@ -2,6 +2,7 @@ version '0.4.3' sha256 '7f7a9579427f258a34663abed46845c81c35f676f63b2ae1acef2a7729745572' + # github.com/sdegutis/mjolnir was verified as official when first introduced to the cask url "https://github.com/sdegutis/mjolnir/releases/download/#{version}/Mjolnir-#{version}.tgz" appcast 'https://github.com/sdegutis/mjolnir/releases.atom', checkpoint: 'bcbd84dc837113b342a6f780109b23825f3d6c6c208c7b68a193560eab832d80'
Fix `url` stanza comment for Mjolnir.
diff --git a/Casks/trailer.rb b/Casks/trailer.rb index abc1234..def5678 100644 --- a/Casks/trailer.rb +++ b/Casks/trailer.rb @@ -1,6 +1,6 @@ cask :v1 => 'trailer' do - version '1.3.4' - sha256 '3daf054656f635a1ec17eb84fac56867da0511b206c7b6a4b4f80562f4fa1f4b' + version '1.3.5' + sha256 '906b13316d243c7791c1258f5b895a1528148808c9c3cc1e9dc7a36c50495ebe' url "http://ptsochantaris.github.io/trailer/trailer#{version.gsub('.','')}.zip" appcast 'http://ptsochantaris.github.io/trailer/appcast.xml',
Update Trailer to version 1.3.5 This commit updates the version and sha256 stanzas
diff --git a/spec/models/calagator/event/cloner_spec.rb b/spec/models/calagator/event/cloner_spec.rb index abc1234..def5678 100644 --- a/spec/models/calagator/event/cloner_spec.rb +++ b/spec/models/calagator/event/cloner_spec.rb @@ -22,15 +22,17 @@ describe "#start_time" do it "should equal todays date with the same time" do - start_time = Date.today + original.start_time.hour.hours - subject.start_time.should == start_time + subject.start_time.to_date.should == Date.today + subject.start_time.hour.should == original.start_time.hour + subject.start_time.min.should == original.start_time.min end end describe "#end_time" do it "should equal todays date with the same time" do - end_time = Date.today + original.end_time.hour.hours - subject.end_time.should == end_time + subject.end_time.to_date.should == Date.today + subject.end_time.hour.should == original.end_time.hour + subject.end_time.min.should == original.end_time.min end end
Fix Event::Cloner spec for daylight savings transition days Instead of using an offset from midnight, compare the date and wall clock time of the cloned event directly. This better captures the intended cloning behavior and will work when run on DST transition days. Fixes #478