diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/minitest-spec-rails.gemspec b/minitest-spec-rails.gemspec index abc1234..def5678 100644 --- a/minitest-spec-rails.gemspec +++ b/minitest-spec-rails.gemspec @@ -1,5 +1,3 @@-# -*- encoding: utf-8 -*- - $LOAD_PATH.push File.expand_path('../lib', __FILE__) require 'minitest-spec-rails/version'
Remove encoding comment from gemspec.
diff --git a/plugins/distribution/db/migrate/20130615023621_add_active_to_distribution_plugin_supplier.rb b/plugins/distribution/db/migrate/20130615023621_add_active_to_distribution_plugin_supplier.rb index abc1234..def5678 100644 --- a/plugins/distribution/db/migrate/20130615023621_add_active_to_distribution_plugin_supplier.rb +++ b/plugins/distribution/db/migrate/20130615023621_add_active_to_distribution_plugin_supplier.rb @@ -0,0 +1,9 @@+class AddActiveToDistributionPluginSupplier < ActiveRecord::Migration + def self.up + add_column :distribution_plugin_suppliers, :active, :string + end + + def self.down + remove_column :distribution_plugin_suppliers, :active + end +end
Add active field to supplier
diff --git a/cookbooks/lib/features/mysql_spec.rb b/cookbooks/lib/features/mysql_spec.rb index abc1234..def5678 100644 --- a/cookbooks/lib/features/mysql_spec.rb +++ b/cookbooks/lib/features/mysql_spec.rb @@ -8,7 +8,7 @@ its(:exit_status) { should eq 0 } end - describe file('/home/travis/.my.cnf') do + describe file('/home/travis/.my.cnf'), precise: false do it { should exist } it { should be_readable } it { should be_readable }
Exclude `~travis/.my.cnf` spec on precise
diff --git a/app/services/runner_service.rb b/app/services/runner_service.rb index abc1234..def5678 100644 --- a/app/services/runner_service.rb +++ b/app/services/runner_service.rb @@ -20,12 +20,15 @@ end def run_cyber_dojo_sh(image_name, id, files, max_seconds) - @http.get(__method__, { - image_name:image_name, + args = { id:id, files:files, - max_seconds:max_seconds - }) + manifest: { + image_name:image_name, + max_seconds:max_seconds + } + } + @http.get(__method__, args) end end
Refactor runner to pass manifest
diff --git a/app/views/annotations/index.json.jbuilder b/app/views/annotations/index.json.jbuilder index abc1234..def5678 100644 --- a/app/views/annotations/index.json.jbuilder +++ b/app/views/annotations/index.json.jbuilder @@ -3,9 +3,9 @@ json.data do if annotation.entity if annotation.entity.description - json.set! :text, '<a href="'+entity_path(annotation.entity)+'">'+JSON.parse(annotation.data)['text']+'</a><p>'+annotation.entity.description+'</p>' + json.set! :text, '<a href="'+entity_path(annotation.entity)+'" target="_parent">'+JSON.parse(annotation.data)['text']+'</a><p>'+annotation.entity.description+'</p>' else - json.set! :text, '<a href="'+entity_path(annotation.entity)+'">'+JSON.parse(annotation.data)['text']+'</a>' + json.set! :text, '<a href="'+entity_path(annotation.entity)+'" target="_parent">'+JSON.parse(annotation.data)['text']+'</a>' end else json.set! :text, JSON.parse(annotation.data)['text']
Add target parent to Annotations links to avoid open links inside frames Closes #261
diff --git a/app/views/compositions/save.json.jbuilder b/app/views/compositions/save.json.jbuilder index abc1234..def5678 100644 --- a/app/views/compositions/save.json.jbuilder +++ b/app/views/compositions/save.json.jbuilder @@ -1,4 +1,5 @@ json.composition do + json.id @composition.id json.name @composition.name json.notes @composition.notes json.map do
Include composition ID in save response
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 @@ -13,13 +13,14 @@ end def client - config = { - :consumer_key => configuration[:consumer_key], - :consumer_secret => configuration[:consumer_secret], - :oauth_token => session[:oauth_token], - :oauth_token_secret => session[:oauth_token_secret], - } - @client ||= Twitter::Client.new(config) + Twitter.configure do |config| + config.consumer_key = configuration[:consumer_key] + config.consumer_secret = configuration[:consumer_secret] + config.oauth_token = session[:oauth_token] + config.oauth_token_secret = session[:oauth_token_secret] + end + + @client ||= Twitter::Client.new end helper_method :client
Configure with block instead of hash
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 @@ -40,7 +40,7 @@ end def all_other_users - User.where("users.id != ?", current_user.id).not_deleted + current_team.users.where("users.id != ?", current_user.id).not_deleted end helper_method :all_other_users
Fix all_other_users to be restricted to the current team
diff --git a/app/views/spree/api/products/show.v1.rabl b/app/views/spree/api/products/show.v1.rabl index abc1234..def5678 100644 --- a/app/views/spree/api/products/show.v1.rabl +++ b/app/views/spree/api/products/show.v1.rabl @@ -1,5 +1,4 @@ object @product -cache [I18n.locale, @current_user_roles.include?('admin'), current_currency, root_object] attributes *product_attributes
Remove cache. Fucking stupid implementation of api.
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 @@ -22,7 +22,7 @@ if request.env["HTTP_USER_AGENT"] and !request.env["HTTP_USER_AGENT"].include?("facebookexternalhit/1.1") redirect_to proc { url_for(params.except(:ref)) } end - else + elsif request.fullpath != "admin" || !cookies[:h_ref] redirect_to "http://ultimate-bundles.com/healthy-living-bundle-2014/" end end
Add code to end campaign and redirect users who come to the site
diff --git a/ar_transaction_changes.gemspec b/ar_transaction_changes.gemspec index abc1234..def5678 100644 --- a/ar_transaction_changes.gemspec +++ b/ar_transaction_changes.gemspec @@ -17,7 +17,7 @@ gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.require_paths = ["lib"] - gem.add_dependency "activerecord", "~> 3.0", "< 5.0" + gem.add_dependency "activerecord", ">= 3.0", "< 5.0" gem.add_development_dependency("rake") gem.add_development_dependency("mysql2")
Fix version on gemspec so it includes activerecord 4.
diff --git a/lib/rusic/uploaders/template.rb b/lib/rusic/uploaders/template.rb index abc1234..def5678 100644 --- a/lib/rusic/uploaders/template.rb +++ b/lib/rusic/uploaders/template.rb @@ -2,7 +2,7 @@ module Uploaders class Template < Base def perform - client["themes/#{theme}/templates/#{file.dirname}/#{file.filename}"].put(params) + client["themes/#{theme}/templates/#{file.dirname.basename}/#{file.filename}"].put(params) end private
Return only the directory name not the entire path
diff --git a/lib/yarrow/tools/output_file.rb b/lib/yarrow/tools/output_file.rb index abc1234..def5678 100644 --- a/lib/yarrow/tools/output_file.rb +++ b/lib/yarrow/tools/output_file.rb @@ -2,7 +2,7 @@ module Tools # TODO: consider renaming this to OutputDocument. class OutputFile - include ::Configurable + include Yarrow::Configurable WRITE_MODE = 'w+:UTF-8'.freeze @@ -13,7 +13,7 @@ # @return [String] Docroot of the output target def docroot - @docroot ||= config.output_dir + @docroot ||= config.output_dir || 'public' end # Write an output file to the specified path under the docroot. @@ -27,7 +27,7 @@ path = "#{path}#{index_name}" end - target_path = Pathname.new("docroot#{path}") + target_path = Pathname.new("#{docroot}#{path}") FileUtils.mkdir_p(target_path.dirname)
Tweak output file to write to docroot by default
diff --git a/lib/cinch/plugins/clever_bot.rb b/lib/cinch/plugins/clever_bot.rb index abc1234..def5678 100644 --- a/lib/cinch/plugins/clever_bot.rb +++ b/lib/cinch/plugins/clever_bot.rb @@ -8,6 +8,11 @@ match lambda { |m| /(.*)\s?@?#{m.bot.nick}[:,]?\s*(.*)/i }, use_prefix: false + def initialize(*args) + super + @cleverbot = Cleverbot.new + end + def execute(m, part_one, part_two=nil) response = @cleverbot.write "#{part_one} #{part_two}" m.reply response, true
Fix initialize function that didn't make the move
diff --git a/jenkins-peace.gemspec b/jenkins-peace.gemspec index abc1234..def5678 100644 --- a/jenkins-peace.gemspec +++ b/jenkins-peace.gemspec @@ -24,5 +24,5 @@ s.add_runtime_dependency 'tty-table' s.add_development_dependency 'rspec' - s.add_development_dependency 'simplecov' + s.add_development_dependency 'simplecov', '~> 0.17.1' end
Fix simplecov version (workaround for a bug in CodeClimate reporter)
diff --git a/lib/finicity/v1/response/mfa.rb b/lib/finicity/v1/response/mfa.rb index abc1234..def5678 100644 --- a/lib/finicity/v1/response/mfa.rb +++ b/lib/finicity/v1/response/mfa.rb @@ -7,7 +7,7 @@ class Choice include ::Saxomattic - attribute :data + attribute :data, :value => true attribute :value, :attribute => true end
Fix getting choice/imageChoice element body returned
diff --git a/cookbooks/ghg/recipes/ghg.rb b/cookbooks/ghg/recipes/ghg.rb index abc1234..def5678 100644 --- a/cookbooks/ghg/recipes/ghg.rb +++ b/cookbooks/ghg/recipes/ghg.rb @@ -4,6 +4,5 @@ ghg 'c-bata/kube-prompt' ghg 'golang/dep' ghg 'hyperhq/pi' -ghg 'kubernetes-sigs/aws-iam-authenticator' ghg 'mattn/memo' ghg 'wantedly/dockertags'
Uninstall aws-iam-authenticator to use awscli instead
diff --git a/rs_user_policy.gemspec b/rs_user_policy.gemspec index abc1234..def5678 100644 --- a/rs_user_policy.gemspec +++ b/rs_user_policy.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |gem| gem.name = "rs_user_policy" gem.version = "0.0.1" - gem.homepage = "http://www.rightscale.com" + gem.homepage = "https://github.com/rgeyer/rs_user_policy" gem.license = "MIT" gem.summary = %Q{Manages users across many different child accounts of a RightScale Enterprise Master Account} gem.description = gem.summary
Set homepage to git repo
diff --git a/lib/pivotal-tracker/activity.rb b/lib/pivotal-tracker/activity.rb index abc1234..def5678 100644 --- a/lib/pivotal-tracker/activity.rb +++ b/lib/pivotal-tracker/activity.rb @@ -39,7 +39,7 @@ element :project_id, Integer element :description, String - has_many :stories, Story + has_many :stories, Story, :xpath => '//stories' end end
Enable to fetch stories in activities
diff --git a/lib/jsound/midi/devices/monitor.rb b/lib/jsound/midi/devices/monitor.rb index abc1234..def5678 100644 --- a/lib/jsound/midi/devices/monitor.rb +++ b/lib/jsound/midi/devices/monitor.rb @@ -1,17 +1,20 @@ # A device that prints out all incoming MIDI message. module JSound::Midi::Devices - class Monitor + class Monitor < Device include_package 'javax.sound.midi' include javax.sound.midi.Receiver include JSound::Midi::Messages - def send(java_message, timestamp) + def send(java_message, timestamp=-1) message = Message.from_java(java_message) puts message.to_s rescue STDERR.puts $! end + def <=(message) + self.send(message) + end end end
Monitor is now a proper Device and handles the <= method
diff --git a/lib/puppet/type/netapp_qtree.rb b/lib/puppet/type/netapp_qtree.rb index abc1234..def5678 100644 --- a/lib/puppet/type/netapp_qtree.rb +++ b/lib/puppet/type/netapp_qtree.rb @@ -5,19 +5,7 @@ apply_to_device - ensurable do - desc "Netapp Qtree resource state. Valid values are: present, absent." - - defaultto(:present) - - newvalue(:present) do - provider.create - end - - newvalue(:absent) do - provider.destroy - end - end + ensurable newparam(:name) do desc "The qtree name."
Simplify ensure property of qtree type The block passed to the ensurable method is basically the default behaviour as defined in puppet/property/ensure.rb#self.defaultvalues Ommit the block and use the default
diff --git a/lib/rails_ops/log_subscriber.rb b/lib/rails_ops/log_subscriber.rb index abc1234..def5678 100644 --- a/lib/rails_ops/log_subscriber.rb +++ b/lib/rails_ops/log_subscriber.rb @@ -9,15 +9,12 @@ return if op.class.logging_skipped? + profile = ::RailsOps::Profiler.node(op.object_id) + message = 'OP' - - profile = ::RailsOps::Profiler.node(op.object_id) + message += ' FAILED' if profile.erroneous? message += " (#{profile.t_self_ms.round(1)}ms / #{profile.t_kids_ms.round(1)}ms)" profile.free - - if profile.erroneous? - message += ' (failed)' - end color = profile.erroneous? ? RED : YELLOW
Reword failed operation log message Close #7
diff --git a/lib/tty/table/border_options.rb b/lib/tty/table/border_options.rb index abc1234..def5678 100644 --- a/lib/tty/table/border_options.rb +++ b/lib/tty/table/border_options.rb @@ -57,10 +57,16 @@ # # @api public def separator?(line) - return true if separator == TTY::Table::Border::EACH_ROW - return separator.include?(line) if separator.is_a? Array - return separator.call(line) if separator.is_a? Proc - false + case separator + when TTY::Table::Border::EACH_ROW + true + when Array + separator.include?(line) + when Proc + separator.call(line) + else + false + end end end # BorderOptions end # Table
Change to be more readable
diff --git a/spec/active_hash/relation_spec.rb b/spec/active_hash/relation_spec.rb index abc1234..def5678 100644 --- a/spec/active_hash/relation_spec.rb +++ b/spec/active_hash/relation_spec.rb @@ -1,14 +1,16 @@ require 'spec_helper' RSpec.describe ActiveHash::Relation do - class Country < ActiveHash::Base - self.data = [ - {:id => 1, :name => "US"}, - {:id => 2, :name => "Canada"} - ] + let(:model_class) do + Class.new(ActiveHash::Base) do + self.data = [ + {:id => 1, :name => "US"}, + {:id => 2, :name => "Canada"} + ] + end end - subject { Country.all } + subject { model_class.all } describe '#to_ary' do it 'returns an array' do
Use anonymous model class in spec
diff --git a/spec/helpers/dhis2_helper_spec.rb b/spec/helpers/dhis2_helper_spec.rb index abc1234..def5678 100644 --- a/spec/helpers/dhis2_helper_spec.rb +++ b/spec/helpers/dhis2_helper_spec.rb @@ -0,0 +1,30 @@+# frozen_string_literal: true + +require "rails_helper" + +RSpec.describe Dhis2Helper, type: :helper do + let(:project) { double(dhis2_url: "https://sample.org/dhis2") } + + it "links to dhis2 dataset" do + expect(helper.link_to_dataset(project, "dsid")).to eq( + '<a target="_blank" class="external" '\ + 'href="https://sample.org/dhis2/dhis-web-maintenance/#/edit/dataSetSection/dataSet/dsid">dsid</a>' + ) + end + + it "links to dhis2 indicator" do + expect(helper.link_to_indicator(project, "dsid")).to eq( + '<a target="_blank" class="external" '\ + 'href="https://sample.org/dhis2/dhis-web-maintenance/#/edit/indicatorSection/indicator/dsid">dsid</a>' + ) + end + + it "links to dhis2 data elements" do + expect(helper.link_to_data_element(project, "dsid")).to eq( + '<a target="_blank" class="external" '\ + 'href="https://sample.org/dhis2/dhis-web-maintenance/#/edit/dataElementSection/dataElement/dsid">dsid</a>' + ) + end + + +end
Add spec for dhis2 links helper
diff --git a/spec/routing/static_pages_spec.rb b/spec/routing/static_pages_spec.rb index abc1234..def5678 100644 --- a/spec/routing/static_pages_spec.rb +++ b/spec/routing/static_pages_spec.rb @@ -8,20 +8,6 @@ ) end - it "routes privacy policy page" do - expect(:get => "/privacy_policy").to route_to( - :controller => "static_pages", - :action => "privacy_policy" - ) - end - - it "routes terms of use page" do - expect(:get => "/terms_of_use").to route_to( - :controller => "static_pages", - :action => "terms_of_use" - ) - end - it "routes samples page" do expect(:get => "/samples").to route_to( :controller => "static_pages",
Remove the specs for terms of use and privacy policy routes as well.
diff --git a/spec/type_aliases/x509pem_spec.rb b/spec/type_aliases/x509pem_spec.rb index abc1234..def5678 100644 --- a/spec/type_aliases/x509pem_spec.rb +++ b/spec/type_aliases/x509pem_spec.rb @@ -1,5 +1,6 @@ require 'spec_helper' -describe 'Certmgmt::X509PEM', :type => :type_alias do - it { is_expected.to allow_value('square') } +describe 'Certmgmt::X509pem', :type => :type_alias, :if => Puppet::Util::Package.versioncmp(Puppet.version, '4.4.0') >= 0 do + cert = IO.read('spec/fixtures/files/testcert.pem') + it { is_expected.to allow_value(cert) } end
Use test cert for type alias rspec test
diff --git a/app/helpers/home_helper.rb b/app/helpers/home_helper.rb index abc1234..def5678 100644 --- a/app/helpers/home_helper.rb +++ b/app/helpers/home_helper.rb @@ -4,7 +4,10 @@ if !logged_in? link_to t('ui.home'), home_path else - link_to t('ui.home'), conversation_messages_path(current_user.personal_conversation) + link_to t('ui.home'), + conversation_messages_path(current_user.personal_conversation), + :class => 'tip', + :title => "personal convo for " + current_user.login end end
Add a tooltip to the home link when the user is loged, so the user can know the login name of the current user and the personal convo
diff --git a/app/helpers/root_helper.rb b/app/helpers/root_helper.rb index abc1234..def5678 100644 --- a/app/helpers/root_helper.rb +++ b/app/helpers/root_helper.rb @@ -3,30 +3,6 @@ module RootHelper include GeoHelper - - def has_further_information?(publication) - publication.parts.collect(&:slug).include?('further-information') - end - - def programme_parts(publication) - publication.parts.reject { |part| part.slug == 'further-information' } - end - - def transaction_path(slug,council,edition) - unless council - guide_path(slug,nil,edition) - else - if edition - publication_path(:slug=>slug,:edition=>edition,:snac=>council) - else - publication_path(:slug=>slug,:snac=>council) - end - end - end - - def council_lookup_path(slug) - identify_council_path(:slug=>slug) - end def to_govspeak(field) Govspeak::Document.new(field || "", :auto_ids=>false).to_html.html_safe
Remove 4 more outdated helpers These aren't used any more.
diff --git a/core/db/migrate/20210112193440_remove_contact_email_from_spree_stores.rb b/core/db/migrate/20210112193440_remove_contact_email_from_spree_stores.rb index abc1234..def5678 100644 --- a/core/db/migrate/20210112193440_remove_contact_email_from_spree_stores.rb +++ b/core/db/migrate/20210112193440_remove_contact_email_from_spree_stores.rb @@ -1,4 +1,4 @@-class RemoveContactEmailFromSpreeStores < ActiveRecord::Migration[6.1] +class RemoveContactEmailFromSpreeStores < ActiveRecord::Migration[6.0] def change remove_column :spree_stores, :contact_email end
Fix migration version for Rails 6.0 support
diff --git a/TvOSMoreButton.podspec b/TvOSMoreButton.podspec index abc1234..def5678 100644 --- a/TvOSMoreButton.podspec +++ b/TvOSMoreButton.podspec @@ -9,4 +9,5 @@ s.tvos.deployment_target = '9.0' s.source_files = 'Source/**/*.swift' s.resource_bundle = { 'TvOSMoreButton' => ['Resources/*.lproj'] } + s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.0' } end
Set swift version for podspec
diff --git a/lib/msplex/resource/application.rb b/lib/msplex/resource/application.rb index abc1234..def5678 100644 --- a/lib/msplex/resource/application.rb +++ b/lib/msplex/resource/application.rb @@ -1,12 +1,12 @@ module Msplex module Resource class Application - attr_reader :name - attr_reader :maintainer + attr_reader :name, :maintainer, :links - def initialize(application_name, maintainer) + def initialize(application_name, maintainer, links) @application_name = application_name @maintainer = maintainer + @links = links end end end
Add links field to Application
diff --git a/lib/patches/actioncontroller_ex.rb b/lib/patches/actioncontroller_ex.rb index abc1234..def5678 100644 --- a/lib/patches/actioncontroller_ex.rb +++ b/lib/patches/actioncontroller_ex.rb @@ -32,4 +32,19 @@ end end + alias_method :theme_support_active_layout, :active_layout + + def active_layout(passed_layout = nil) + if current_theme + theme_path = File.join(RAILS_ROOT, "themes", controller.current_theme, "views") + if File.exists?(theme_path) and ! self.class.view_paths.include?(theme_path) + self.class.view_paths.unshift(theme_path) + result = theme_support_active_layout(passed_layout) + self.class.view_paths.shift + return result + end + end + + theme_support_active_layout(passed_layout) + end end
Handle layouts by pushing the theme path onto the class level view_paths instance before calling active_layout
diff --git a/app/models/subscription.rb b/app/models/subscription.rb index abc1234..def5678 100644 --- a/app/models/subscription.rb +++ b/app/models/subscription.rb @@ -11,6 +11,7 @@ enumerize :status, in: { paid: 0, pending_payment: 1, unpaid: 2, canceled: 3 } + has_many :transactions belongs_to :user belongs_to :project belongs_to :plan
Add has_many transactions association to Subscription
diff --git a/Casks/couchbase-server-enterprise.rb b/Casks/couchbase-server-enterprise.rb index abc1234..def5678 100644 --- a/Casks/couchbase-server-enterprise.rb +++ b/Casks/couchbase-server-enterprise.rb @@ -1,6 +1,6 @@ cask :v1 => 'couchbase-server-enterprise' do - version '3.0.4' - sha256 '476599935a1278b71d2bee73e5a34a960901ef78e700d392d440217106c6111c' + version '3.0.3' + sha256 'ee3e42317ea35cea4e2ef3b67c238bc82b9bdcec5b1867a1a160a490cbbf2469' url "http://packages.couchbase.com/releases/#{version}/couchbase-server-enterprise_#{version}-macos_x86_64.zip" name 'Couchbase Server'
Revert "Upgrade Couchbase Server.app (Enterprise) to v3.0.4"
diff --git a/spec/models/flight_spec.rb b/spec/models/flight_spec.rb index abc1234..def5678 100644 --- a/spec/models/flight_spec.rb +++ b/spec/models/flight_spec.rb @@ -13,7 +13,7 @@ end describe 'when not valid' do - it 'is not valid without a name' do + xit 'is not valid without a name' do expect(invalid_flight).to_not be_valid end end
Set test to pending for flight name validation since logic changed.
diff --git a/spec/recipes/winrm_spec.rb b/spec/recipes/winrm_spec.rb index abc1234..def5678 100644 --- a/spec/recipes/winrm_spec.rb +++ b/spec/recipes/winrm_spec.rb @@ -1,11 +1,15 @@ require 'spec_helper' -require 'chef/win32/version' describe 'powershell::winrm' do let(:chef_run) do ChefSpec::SoloRunner.new(platform: 'windows', version: '2012').converge(described_recipe) end + before do + winrm_cmd = double('winrm_cmd', run_command: nil, stdout: 'Transport = HTTPS') + allow(Mixlib::ShellOut).to receive(:new).with('powershell.exe winrm enumerate winrm/config/listener').and_return winrm_cmd + end + it 'installs windows package windows managemet framework core 5.0' do expect(chef_run).to run_powershell_script('enable winrm').with(code: " winrm quickconfig -q\n") end
Fix specs for winrm recipe Update winrm's specs to be able to test on linux/travis: * Remove references to `chef/winr32/version` * Mock shellout commands
diff --git a/lib/culinarian/dsl.rb b/lib/culinarian/dsl.rb index abc1234..def5678 100644 --- a/lib/culinarian/dsl.rb +++ b/lib/culinarian/dsl.rb @@ -27,9 +27,7 @@ end def step(name) - step = Step.new(name) - steps << step - step + find_or_create_step(name) end def steps @@ -41,6 +39,12 @@ def add_hardware(name, klass) hardware << klass.new(name) define_reader(name) + end + + def const_missing(name) + Culinarian.const_get(name) + rescue NameError + super end def define_reader(name) @@ -55,10 +59,15 @@ instance_eval reader, __FILE__, line_number end - def const_missing(name) - Culinarian.const_get(name) - rescue NameError - super + def find_or_create_step(name) + step = steps.find { |s| s.name == name } + + unless step + step = Step.new(name) + steps << step + end + + step end end end
Allow steps to be retrieved by name
diff --git a/lib/email_assessor.rb b/lib/email_assessor.rb index abc1234..def5678 100644 --- a/lib/email_assessor.rb +++ b/lib/email_assessor.rb @@ -10,7 +10,7 @@ end def self.configuration - @@configuration ||= Configuration.new + @configuration ||= Configuration.new end def self.configure
Replace the configuration class variable with an instance variable equivalant
diff --git a/Casks/after-dark-classic.rb b/Casks/after-dark-classic.rb index abc1234..def5678 100644 --- a/Casks/after-dark-classic.rb +++ b/Casks/after-dark-classic.rb @@ -0,0 +1,29 @@+cask 'after-dark-classic' do + version :latest + sha256 :no_check + + url 'ftp://www.infinisys.co.jp/online/online_afterdarkclassicset_e.dmg.gz' + name 'After Dark Classic Set' + homepage 'http://en.infinisys.co.jp/product/afterdarkclassicset/index.shtml' + license :commercial + + container nested: "after-dark-classic-#{version}.dmg" + + pkg 'ClassicSet.pkg' + + preflight do + system '/bin/mv', '--', staged_path.join("after-dark-classic-#{version}"), staged_path.join("after-dark-classic-#{version}.dmg") + end + + uninstall delete: [ + '/Library/Screen Savers/Boris.saver', + '/Library/Screen Savers/Flying Toasters.saver', + '/Library/Screen Savers/Mowing Man.saver', + ] + + zap delete: [ + '~/Library/Preferences/ByHost/jp.co.infinisys.boris.*.plist', + '~/Library/Preferences/ByHost/jp.co.infinisys.flyingtoasters.*.plist', + '~/Library/Preferences/ByHost/jp.co.infinisys.mowingman.*.plist', + ] +end
Add the After Dark Classic Set v1.0 from Infinisys.
diff --git a/spec/cdm_batch_spec.rb b/spec/cdm_batch_spec.rb index abc1234..def5678 100644 --- a/spec/cdm_batch_spec.rb +++ b/spec/cdm_batch_spec.rb @@ -4,18 +4,4 @@ it 'has a version number' do expect(CdmBatch::VERSION).not_to be nil end - - it 'checks that each records associated file is present' do - - end - - it 'logs each successful upload to current batch log' - it 'logs errors to current batch error log' - - it 'archives current batch log when all items successfully uploaded' - it 'archives current batch errors log when all items successfully uploaded' - - it 'does not archive current batch log if any batch item raises an error' - - it 'does not re-upload items in current batch log if batch restarted' end
Remove specs now tested elsewhere
diff --git a/spec/discovery_spec.rb b/spec/discovery_spec.rb index abc1234..def5678 100644 --- a/spec/discovery_spec.rb +++ b/spec/discovery_spec.rb @@ -5,13 +5,13 @@ fixtures_path = File.join(File.dirname(__FILE__), 'fixtures') json_discovery = File.read(File.join(fixtures_path, 'discovery.json')) uri = 'https://api.context.io/2.0/discovery' - @existing_request = stub_request(:get, uri) - .with(:query => { :email => 'example@gmail.com', :source_type => 'IMAP'}) - .to_return(:body => json_discovery) + @existing_request = stub_request(:get, uri). + with(:query => { :email => 'example@gmail.com', :source_type => 'IMAP'}). + to_return(:body => json_discovery) - @nosettings_request = stub_request(:get, uri) - .with(:query => { :email => 'me@example.com', :source_type => 'IMAP'}) - .to_return(:body => '{"email":"me@example.com","found":false}') + @nosettings_request = stub_request(:get, uri). + with(:query => { :email => 'me@example.com', :source_type => 'IMAP'}). + to_return(:body => '{"email":"me@example.com","found":false}') end describe '.discover' do
Make code valid in 1.8.
diff --git a/app/web_view_controller.rb b/app/web_view_controller.rb index abc1234..def5678 100644 --- a/app/web_view_controller.rb +++ b/app/web_view_controller.rb @@ -13,16 +13,14 @@ v.scalesPageToFit = true url = self.item[9].gsub(/\"/, "") # image image_src = NSData.dataWithContentsOfURL(NSURL.URLWithString(url)) + image = UIImage.imageWithData(image_src) - image_view = UIImageView.alloc.initWithImage(image) - image_view.frame = CGRectMake(0, 100, 320, 320) + image_view.frame = CGRectMake(0, 0, image.size.width, image.size.height) scrollwindow.addSubview(image_view) scrollwindow.contentSize = image_view.size v.delegate = self view.addSubview(scrollwindow) - - # v.loadHTMLString(self.item["body"], baseURL:nil) end end end
Fix image size on webview
diff --git a/minimal-mistakes-jekyll.gemspec b/minimal-mistakes-jekyll.gemspec index abc1234..def5678 100644 --- a/minimal-mistakes-jekyll.gemspec +++ b/minimal-mistakes-jekyll.gemspec @@ -12,11 +12,8 @@ spec.metadata["plugin_type"] = "theme" spec.files = `git ls-files -z`.split("\x0").select do |f| - f.match(%r{^((_includes|_layouts|_sass|assets)/|(LICENSE|README|CHANGELOG)((\.(txt|md|markdown)|$)))}i) + f.match(%r{^(assets|_(includes|layouts|sass)/|(LICENSE|README|CHANGELOG)((\.(txt|md|markdown)|$)))}i) end - - spec.bindir = "exe" - spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.add_development_dependency "jekyll", "~> 3.3" spec.add_development_dependency "bundler", "~> 1.12"
Update regex for spec.files and remove bindir and executables
diff --git a/Library/Homebrew/test/testing_env.rb b/Library/Homebrew/test/testing_env.rb index abc1234..def5678 100644 --- a/Library/Homebrew/test/testing_env.rb +++ b/Library/Homebrew/test/testing_env.rb @@ -0,0 +1,54 @@+# This software is in the public domain, furnished "as is", without technical +# support, and with no warranty, express or implied, as to its usefulness for +# any purpose. + +# Require this file to build a testing environment. + +ABS__FILE__=File.expand_path(__FILE__) + +$:.push(File.expand_path(__FILE__+'/../..')) +require 'extend/pathname' + +# these are defined in global.rb, but we don't want to break our actual +# homebrew tree, and we do want to test everything :) +HOMEBREW_PREFIX=Pathname.new '/private/tmp/testbrew/prefix' +HOMEBREW_REPOSITORY=HOMEBREW_PREFIX +HOMEBREW_CACHE=HOMEBREW_PREFIX.parent+"cache" +HOMEBREW_CELLAR=HOMEBREW_PREFIX.parent+"cellar" +HOMEBREW_USER_AGENT="Homebrew" +HOMEBREW_WWW='http://example.com' +MACOS_VERSION=10.6 + +(HOMEBREW_PREFIX+'Library/Formula').mkpath +Dir.chdir HOMEBREW_PREFIX +at_exit { HOMEBREW_PREFIX.parent.rmtree } + +# Test fixtures and files can be found relative to this path +TEST_FOLDER = Pathname.new(ABS__FILE__).parent.realpath + + +class ExecutionError <RuntimeError + attr :exit_status + + def initialize cmd, args = [], es = nil + super "Failure while executing: #{cmd} #{pretty(args)*' '}" + @exit_status = es.exitstatus rescue 1 + end + + private + + def pretty args + args.collect do |arg| + if arg.to_s.include? ' ' + "'#{ arg.gsub "'", "\\'" }'" + else + arg + end + end + end +end + +class BuildError <ExecutionError +end + +require 'test/unit' # must be after at_exit
Add new "testing environment" include.
diff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rake index abc1234..def5678 100644 --- a/lib/tasks/assets.rake +++ b/lib/tasks/assets.rake @@ -4,8 +4,8 @@ # all! namespace :assets do - desc "Create .gz versions of static assets" - task :gzip_static => :environment do + desc "Create .gz versions of assets" + task :gzip => :environment do zip_types = /\.(?:css|html|js|otf|svg|txt|xml)$/ public_assets = File.join( @@ -34,6 +34,6 @@ # Hook into existing assets:precompile task Rake::Task["assets:precompile"].enhance do - Rake::Task["assets:gzip_static"].invoke + Rake::Task["assets:gzip"].invoke end end
Rename gzip_static task to just "gzip"
diff --git a/lib/tiny_tds/error.rb b/lib/tiny_tds/error.rb index abc1234..def5678 100644 --- a/lib/tiny_tds/error.rb +++ b/lib/tiny_tds/error.rb @@ -1,22 +1,8 @@-module TinyTds +module TinyTds class Error < StandardError - - SEVERITIES = [ - {:number => 1, :severity => 'EXINFO', :explanation => 'Informational, non-error.'}, - {:number => 2, :severity => 'EXUSER', :explanation => 'User error.'}, - {:number => 3, :severity => 'EXNONFATAL', :explanation => 'Non-fatal error.'}, - {:number => 4, :severity => 'EXCONVERSION', :explanation => 'Error in DB-Library data conversion.'}, - {:number => 5, :severity => 'EXSERVER', :explanation => 'The Server has returned an error flag.'}, - {:number => 6, :severity => 'EXTIME', :explanation => 'We have exceeded our timeout period while waiting for a response from the Server - the DBPROCESS is still alive.'}, - {:number => 7, :severity => 'EXPROGRAM', :explanation => 'Coding error in user program.'}, - {:number => 8, :severity => 'EXRESOURCE', :explanation => 'Running out of resources - the DBPROCESS may be dead.'}, - {:number => 9, :severity => 'EXCOMM', :explanation => 'Failure in communication with Server - the DBPROCESS is dead.'}, - {:number => 10, :severity => 'EXFATAL', :explanation => 'Fatal error - the DBPROCESS is dead.'}, - {:number => 11, :severity => 'EXCONSISTENCY', :explanation => 'Internal software error - notify Sybase Technical Support.'} - ].freeze - + attr_accessor :source, :severity, :db_error_number, :os_error_number - + def initialize(message) super @severity = nil
Remove TinyTds::Error::SEVERITIES. Not used anywhere.
diff --git a/lib/warnings/mixin.rb b/lib/warnings/mixin.rb index abc1234..def5678 100644 --- a/lib/warnings/mixin.rb +++ b/lib/warnings/mixin.rb @@ -15,6 +15,8 @@ # @return [nil] # def warn(message) + super(message) if $DEBUG + $WARNINGS << Warning.new(message,caller) return nil end
Call the original warn method if $DEBUG is enabled.
diff --git a/comable.gemspec b/comable.gemspec index abc1234..def5678 100644 --- a/comable.gemspec +++ b/comable.gemspec @@ -10,7 +10,7 @@ s.summary = 'Comable provides a simple way to add e-commerce features to your Ruby on Rails application.' s.description = 'Comable provides a simple way to add e-commerce features to your Ruby on Rails application.' - s.files = Dir['{app,config,db,lib}/**/*', 'MIT-LICENSE', 'Rakefile', 'README.md'] + s.files = Dir['{app,config,db,lib}/**/*', 'MIT-LICENSE', 'Rakefile', 'README.md', 'COMABLE_VERSION'] s.add_dependency 'comable_core', version s.add_dependency 'comable_frontend', version
Add COMABLE_VERSION file to gem
diff --git a/Library/Formula/open-mpi.rb b/Library/Formula/open-mpi.rb index abc1234..def5678 100644 --- a/Library/Formula/open-mpi.rb +++ b/Library/Formula/open-mpi.rb @@ -1,9 +1,9 @@ require 'formula' class OpenMpi <Formula - url 'http://www.open-mpi.org/software/ompi/v1.4/downloads/openmpi-1.4.1.tar.gz' + url 'http://www.open-mpi.org/software/ompi/v1.4/downloads/openmpi-1.4.2.tar.gz' homepage 'www.open-mpi.org' - md5 'a6f87bf31b20206a9ccd4a76608f89d4' + md5 'e4f58c7e6792e4549424cb0420eb8655' def install # Compiler complains about link compatibility with FORTRAN otherwise
Update Open-MPI to version 1.4.2 Some Mac-Specific issues noted in the Open-MPI changelog: http://www.open-mpi.org/community/lists/announce/2010/05/0037.php Signed-off-by: Adam Vandenberg <34c2b6407fd5a10249a15d699d40f9ed1782e98c@gmail.com>
diff --git a/db/data_migrations/20200509165855_add_serial_numberto_service_vehicles.rb b/db/data_migrations/20200509165855_add_serial_numberto_service_vehicles.rb index abc1234..def5678 100644 --- a/db/data_migrations/20200509165855_add_serial_numberto_service_vehicles.rb +++ b/db/data_migrations/20200509165855_add_serial_numberto_service_vehicles.rb @@ -1,11 +1,13 @@ class AddSerialNumbertoServiceVehicles < ActiveRecord::DataMigration def up ServiceVehicle.all.each do |sv| - old_serial_number = sv.serial_numbers.first - vin = old_serial_number.identification - sv.serial_number = vin - sv.save - old_serial_number.delete + unless sv.serial_numbers.first.nil? + old_serial_number = sv.serial_numbers.first + vin = old_serial_number.identification + sv.serial_number = vin + sv.save + old_serial_number.delete + end end end
Update Serial Number data migration
diff --git a/db/migrate/20151029211323_create_users.rb b/db/migrate/20151029211323_create_users.rb index abc1234..def5678 100644 --- a/db/migrate/20151029211323_create_users.rb +++ b/db/migrate/20151029211323_create_users.rb @@ -6,6 +6,7 @@ t.string :last_name, null: false t.string :email, null: false t.integer :group_id + t.integer :vote_count, default: 0 t.timestamps null: false end
Update user db to include vote_count integer
diff --git a/spec/features/triggers_spec.rb b/spec/features/triggers_spec.rb index abc1234..def5678 100644 --- a/spec/features/triggers_spec.rb +++ b/spec/features/triggers_spec.rb @@ -12,7 +12,7 @@ context 'create a trigger' do before do - click_on 'Add Trigger' + click_on 'Add trigger' expect(@project.triggers.count).to eq(1) end
Fix failing rspec test for triggers
diff --git a/app/models/campfire.rb b/app/models/campfire.rb index abc1234..def5678 100644 --- a/app/models/campfire.rb +++ b/app/models/campfire.rb @@ -2,8 +2,8 @@ KEYS = ["campfire_subdomain", "campfire_token", "campfire_room"] def self.notify_mocks_created(mocks, url) - room = find_room - if use? && room + if use? + room = find_room mock = mocks.first mocks_text = mocks.size == 1 ? "a new mock" : "#{mocks.size} new mocks" room.speak "#{mock.author.name} posted #{mocks_text}:" @@ -11,7 +11,7 @@ room.speak url end # Handle invalid token and invalid subdomain errors respectively. - rescue Tinder::AuthenticationFailed, NoMethodError + rescue Tinder::AuthenticationFailed, NoMethodError # Do nothing. end @@ -34,7 +34,7 @@ end settings end - + def self.use? !self.settings["campfire_subdomain"].blank? end
Fix uploading flow for Mockr instances without Campfire configured Users without a Campfire subdomain set were seeing an error message when uploading a mock. The mock went through, but we were encountering an error in attempting to parse the URI ".campfire.now", which does not exist. We now only parse if a proper campfire subdomain has been configured. Change-Id: I18af41801b9115baf159869dbb11593d1c96c662 Reviewed-on: https://gerrit.causes.com/5217 Tested-by: Chris Chan <711c73f64afdce07b7e38039a96d2224209e9a6c@causes.com> Reviewed-by: Adam Derewecki <0e18f44c1fec03ec4083422cb58ba6a09ac4fb2a@causes.com>
diff --git a/app/models/timeslot.rb b/app/models/timeslot.rb index abc1234..def5678 100644 --- a/app/models/timeslot.rb +++ b/app/models/timeslot.rb @@ -5,8 +5,12 @@ validates_presence_of :start, :tutor_id validates :tutor_id, uniqueness: { scope: :start, - message: "you are already available at this time" + message: 'you are already available at this time' } + validates :student_id, uniqueness: { + scope: :start, + message: 'you are already scheduled for another session at this time' + }, unless: 'student_id.nil?' def end start + 30.minutes
Add validation for student/start in Timeslot model Validation to prevent student from signin up for more than one tutoring session at a given start time.
diff --git a/lib/adiwg/mdtranslator/readers/fgdc/modules/module_spatialOrganization.rb b/lib/adiwg/mdtranslator/readers/fgdc/modules/module_spatialOrganization.rb index abc1234..def5678 100644 --- a/lib/adiwg/mdtranslator/readers/fgdc/modules/module_spatialOrganization.rb +++ b/lib/adiwg/mdtranslator/readers/fgdc/modules/module_spatialOrganization.rb @@ -6,6 +6,8 @@ require 'nokogiri' require 'adiwg/mdtranslator/internal/internal_metadata_obj' +require_relative 'module_pointVector' +require_relative 'module_raster' module ADIWG module Mdtranslator @@ -14,12 +16,56 @@ module SpatialOrganization - def self.unpack(xSpatialOrg, hResponseObj) + def self.unpack(xSpatialOrg, hResourceInfo, hResponseObj) + # instance classes needed in script + intMetadataClass = InternalMetadata.new + # spatial organization 3.1 (indspref) - indirect spatial reference + # -> resourceInfo.spatialReferenceSystems.spatialReferenceSystem.systemIdentifier.identifier per NOAA + # -> however definitions are not close + indirect = xSpatialOrg.xpath('./indspref').text + unless indirect.empty? + hSystem = intMetadataClass.newSpatialReferenceSystem + hIdentifier = intMetadataClass.newIdentifier + hIdentifier[:identifier] = indirect + hSystem[:systemIdentifier] = hIdentifier + hResourceInfo[:spatialReferenceSystems] << hSystem + end + + # spatial organization 3.2 (direct) - direct spatial reference method + # -> resourceInfo.spatialRepresentationTypes, translate FGDC to ISO as: + # -> point = vector do 3.3 + # -> vector = vector do 3.3 + # -> raster = grid do 3.4 + direct = xSpatialOrg.xpath('./direct').text + unless direct.empty? + type = 'vector' if direct == 'Point' + type = 'vector' if direct == 'Vector' + type = 'grid' if direct == 'Raster' + hResourceInfo[:spatialRepresentationTypes] << type + + # spatial organization 3.3 (ptvctinfo) - point and vector object + if type == 'vector' + xPtVec = xSpatialOrg.xpath('./ptvctinf') + unless xPtVec.empty? + PointVector.unpack(xPtVec, hResourceInfo, hResponseObj) + end + end + + # spatial organization 3.4 (rastinfo) - raster object + if type == 'grid' + xRaster = xSpatialOrg.xpath('./rastinfo') + unless xRaster.empty? + Raster.unpack(xRaster, hResourceInfo, hResponseObj) + end + end + + end + + return hResourceInfo end - end end
Add fgdc reader module 'spatialOrganization'
diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -15,6 +15,14 @@ it { expect(response).to be_success } it { expect(response).to have_http_status(:created) } + it { expect(response.body).to eq User.last.to_json } + + it { expect(assigns(:resource)).to be_persisted } + it { expect(assigns(:resource)).to eq User.last } + + it "should increase users count" do + change(User, :count).by(1) + end end end end
Add a few more specs for /signup
diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -0,0 +1,31 @@+require 'rails_helper' +describe UsersController do + + let!(:user) { FactoryGirl.create(:user) } + + before(:each) do + allow_any_instance_of(ApplicationController).to receive(:current_user).and_return(user) + end + + describe '#edit' do + + it 'should route to edit' do + expect(:get => "users/#{user.id}/edit", id: user.id ).to route_to( + :controller => "users", + :action => "edit", + :id => "#{user.id}" + ) + end + + it 'should find the current user' do + get 'edit', id: user.id + expect(assigns(:user)).to eq user + end + + it 'should render the edit form' do + get 'edit', id: user.id + expect(response).to render_template("edit") + end + end + +end
Create tests for the users controller
diff --git a/spec/controllers/votes_controller_spec.rb b/spec/controllers/votes_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/votes_controller_spec.rb +++ b/spec/controllers/votes_controller_spec.rb @@ -42,4 +42,5 @@ expect(response).to be_redirect expect(response).to redirect_to idea_path end + end end
Fix syntax in Votes controller spec Spec is missing an 'end' keyword towards the end.
diff --git a/elasticsearch-client.gemspec b/elasticsearch-client.gemspec index abc1234..def5678 100644 --- a/elasticsearch-client.gemspec +++ b/elasticsearch-client.gemspec @@ -18,8 +18,8 @@ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.require_paths = ["lib"] - s.add_dependency 'faraday', '~> 0.8' - s.add_dependency 'faraday_middleware', '~> 0.8.7' + s.add_dependency 'faraday', '~> 0.9' + s.add_dependency 'faraday_middleware', '~> 0.9' s.add_dependency 'excon' s.add_dependency 'yajl-ruby', '~> 1.1.0'
Upgrade faraday to ~> 0.9.0
diff --git a/app.rb b/app.rb index abc1234..def5678 100644 --- a/app.rb +++ b/app.rb @@ -1,6 +1,6 @@ require 'sinatra/base' require 'mongoid' -require 'pry' +require 'pry' if Sinatra::Base.development? require_relative 'models/init'
Disable pry in production due to issues with heroku
diff --git a/app.rb b/app.rb index abc1234..def5678 100644 --- a/app.rb +++ b/app.rb @@ -3,7 +3,6 @@ require "cuba" sms = Mobilyws::API.new ENV["USERNAME"], ENV["PASSWORD"], ENV["SENDER_NAME"] -message = ENV["MESSAGE"] # TODO user can send new message. @@ -22,7 +21,7 @@ on root do on param("mobile") do |mobile| name = req.params.fetch('name', '') - message = message % [name] + message = ENV["MESSAGE"] % [name] response = sms.send(message: message, numbers: [mobile]) response_message = {status: :sent, message: response}.to_json res.write response_message
Move getting message from ENV inside every call. This is fast attempt to fix message caching name.
diff --git a/db/migrate/20181213170120_change_dataset_file_audits_id_to_bigint.rb b/db/migrate/20181213170120_change_dataset_file_audits_id_to_bigint.rb index abc1234..def5678 100644 --- a/db/migrate/20181213170120_change_dataset_file_audits_id_to_bigint.rb +++ b/db/migrate/20181213170120_change_dataset_file_audits_id_to_bigint.rb @@ -0,0 +1,9 @@+class ChangeDatasetFileAuditsIdToBigint < ActiveRecord::Migration[5.2] + def up + change_column :dataset_file_audits, :id, :bigint + end + + def down + change_column :dataset_file_audits, :id, :integer + end +end
Update dataset_file_audit_id primary key to bigint
diff --git a/db/migrate/20200917072152_add_subscription_reference_to_orders.rb b/db/migrate/20200917072152_add_subscription_reference_to_orders.rb index abc1234..def5678 100644 --- a/db/migrate/20200917072152_add_subscription_reference_to_orders.rb +++ b/db/migrate/20200917072152_add_subscription_reference_to_orders.rb @@ -1,5 +1,8 @@ class AddSubscriptionReferenceToOrders < ActiveRecord::Migration[5.2] def change - add_reference :spree_orders, :subscription, null: true, foreign_key: { to_table: :solidus_subscriptions_subscriptions } + add_reference :spree_orders, :subscription, null: true, foreign_key: { + to_table: :solidus_subscriptions_subscriptions, + type: :integer, + } end end
Use integer foreign keys for compatibility with old tables
diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index abc1234..def5678 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -11,17 +11,33 @@ protected def oauth_callback_for(oauth_provider) - omniauth_sign_in = OmniauthSignIn.new(current_user, oauth_provider) - omniauth_sign_in.complete(request.env['omniauth.auth']) - if omniauth_sign_in.existing_user? - sign_in omniauth_sign_in.user, event: :authentication + omniauth_user = OmniauthUserSerializer.new(request.env.delete('omniauth.auth')) + omniauth_sign_in = OmniauthSignIn.new(current_user) + omniauth_sign_in.complete(omniauth_user.to_h) - flash.notice = flash_message(omniauth_sign_in.user, oauth_provider.capitalize) - redirect_to after_sign_in_path_for(:user) - else - flash[:devise_error] = 'Sign to complete' - redirect_to new_user_session_path - end + complete_request_with(oauth_provider, omniauth_sign_in) + end + + def complete_request_with(oauth_provider, omniauth_sign_in) + { + success: -> do + sign_in omniauth_sign_in.user, event: :authentication + + flash.notice = flash_message(omniauth_sign_in.user, oauth_provider.capitalize) + redirect_to after_sign_in_path_for(:user) + end, + needs_ownership_confirmation: -> do + session[:new_user_attrs] = omniauth_sign_in.data + + flash[:devise_error] = 'We need you to confirm your password before proceed.' + redirect_to new_user_session_path + end, + needs_email: -> do + session[:new_user_attrs] = omniauth_sign_in.data + + redirect_to set_email_users_path + end + }.fetch(omniauth_sign_in.status).call end def flash_message(user, kind)
Use OmniauthUserSerializer instance to sign users via omniauth
diff --git a/app/decorators/models/refinery/user_decorator.rb b/app/decorators/models/refinery/user_decorator.rb index abc1234..def5678 100644 --- a/app/decorators/models/refinery/user_decorator.rb +++ b/app/decorators/models/refinery/user_decorator.rb @@ -1,9 +1,9 @@ require 'acts_as_indexed' begin - Refinery::User.class_eval do + Refinery::Authentication::Devise::User.class_eval do # Docs for acts_as_indexed http://github.com/dougal/acts_as_indexed acts_as_indexed :fields => [:username, :email] end rescue NameError -end +end
Fix user model with new authentication
diff --git a/app/overrides/replace_checkout_payment_button.rb b/app/overrides/replace_checkout_payment_button.rb index abc1234..def5678 100644 --- a/app/overrides/replace_checkout_payment_button.rb +++ b/app/overrides/replace_checkout_payment_button.rb @@ -2,4 +2,5 @@ :replace => "code[erb-loud]:contains('submit_tag t(:save_and_continue)')", :text => "<%= submit_tag 'Process My Order', :class => 'continue button primary' %>", :name => "replace_checkout_payment_button", - :original => 'ce2043a01931b3bc16b045302ebb0e0bb9150b67')+ :original => 'ce2043a01931b3bc16b045302ebb0e0bb9150b67', + :disabled => true)
Disable as this has now been incorporated into move_save_checkout_button
diff --git a/temando.gemspec b/temando.gemspec index abc1234..def5678 100644 --- a/temando.gemspec +++ b/temando.gemspec @@ -18,5 +18,5 @@ gem.add_dependency 'nokogiri' gem.add_dependency 'typhoeus', '~> 0.4.2' - gem.add_development_dependency 'rspec' + gem.add_development_dependency 'rspec', '~> 2.11.0' end
Set a specific minimum version of rspec
diff --git a/features/step_definitions/renalware/peritonitis_episodes_steps.rb b/features/step_definitions/renalware/peritonitis_episodes_steps.rb index abc1234..def5678 100644 --- a/features/step_definitions/renalware/peritonitis_episodes_steps.rb +++ b/features/step_definitions/renalware/peritonitis_episodes_steps.rb @@ -12,3 +12,15 @@ organism_name: "Acineobactor" ) end + +When(/^records the medication for the episode$/) do + record_medication_for( + treatable: @patty.peritonitis_episodes.last!, + drug_name: "Ciprofloxacin Infusion", + dose: "100 ml", + route_name: "PO", + frequency: "once a day", + starts_on: "10-10-2015", + provider: "GP" + ) +end
Implement recording a medication step for a peritonitis episode
diff --git a/lib/atdis/applications.rb b/lib/atdis/applications.rb index abc1234..def5678 100644 --- a/lib/atdis/applications.rb +++ b/lib/atdis/applications.rb @@ -13,11 +13,8 @@ end def all - # TODO: Use URL to do the concatenation - url = base_url + "/" + "atdis/1.0/applications.json" - r = RestClient.get(url) - json_string = r.to_str - json_data = MultiJson.load(json_string, :symbolize_keys => true) + r = RestClient.get(base_url + "atdis/1.0/applications.json") + json_data = MultiJson.load(r.to_str, :symbolize_keys => true) ApplicationsResults.new(json_data[:response].map {|a| Application.interpret(a[:application]) }) end end
Simplify concatenation of url and inline
diff --git a/spec/ailurus/client_spec.rb b/spec/ailurus/client_spec.rb index abc1234..def5678 100644 --- a/spec/ailurus/client_spec.rb +++ b/spec/ailurus/client_spec.rb @@ -4,11 +4,11 @@ describe Ailurus::Client do it "initializes properly" do - client = Ailurus::Client.new({ + client = Ailurus::Client.new( :api_key => "api key", :domain => "domain name", :email => "email address" - }) + ) expect(client.api_key).to eq("api key") expect(client.domain).to eq("domain name")
Clean up test syntax a bit Part of me appreciates this, and part of me thinks there's too much magic. (The eternal struggle.)
diff --git a/spec/bin/gem-search_spec.rb b/spec/bin/gem-search_spec.rb index abc1234..def5678 100644 --- a/spec/bin/gem-search_spec.rb +++ b/spec/bin/gem-search_spec.rb @@ -30,6 +30,12 @@ it_behaves_like 'display an usage' end + # non-exisitng option: -x + context 'with -x' do + subject { `#{BIN} -x` } + it_behaves_like 'display an usage' + end + context 'with -v' do subject { `#{BIN} -v` } it 'should display an usage' do
Add test for giving non-exisiting option
diff --git a/spec/classes/server_spec.rb b/spec/classes/server_spec.rb index abc1234..def5678 100644 --- a/spec/classes/server_spec.rb +++ b/spec/classes/server_spec.rb @@ -0,0 +1,17 @@+require 'spec_helper' + +describe 'ssh::server' do + let (:facts) { { + :osfamily => 'Debian' + }} + + context "basic tests" do + it { should contain_class('ssh::server') } + it { should contain_package('openssh-server').with( :ensure => 'present' ) } + end + + context "absence test" do + let (:params) { { :ensure => 'absent' } } + it { should contain_package('openssh-server').with( :ensure => 'absent' ) } + end +end
Add basic test for ssh::server
diff --git a/lib/cached_write_store.rb b/lib/cached_write_store.rb index abc1234..def5678 100644 --- a/lib/cached_write_store.rb +++ b/lib/cached_write_store.rb @@ -34,6 +34,8 @@ namespace, actual_key = YAML.load(key) redis_store.set(namespace, actual_key, value) end + + @store = {} end private
Set store to empty after persisted, helps reduce the memory usage
diff --git a/spec/lib/hdo/mailer_spec.rb b/spec/lib/hdo/mailer_spec.rb index abc1234..def5678 100644 --- a/spec/lib/hdo/mailer_spec.rb +++ b/spec/lib/hdo/mailer_spec.rb @@ -0,0 +1,21 @@+require 'spec_helper' + +module Hdo + describe Mailer do + let(:rep) { Representative.make! :with_email } + + it "sends confirmation emails as multipart plaintext and html" do + mail = rep.send_confirmation_instructions + + mail.parts.count.should == 2 + mail.body.parts.collect(&:content_type).should == ["text/plain; charset=UTF-8", "text/html; charset=UTF-8"] + end + + it "sends reset password emails as multipart plaintext and html" do + mail = rep.send_reset_password_instructions + + mail.parts.count.should == 2 + mail.body.parts.collect(&:content_type).should == ["text/plain; charset=UTF-8", "text/html; charset=UTF-8"] + end + end +end
Add spec for multipart devise mails
diff --git a/spec/lib/roo/excelx_spec.rb b/spec/lib/roo/excelx_spec.rb index abc1234..def5678 100644 --- a/spec/lib/roo/excelx_spec.rb +++ b/spec/lib/roo/excelx_spec.rb @@ -9,6 +9,10 @@ it 'creates an instance' do expect(subject).to be_a(Roo::Excelx) end + + it 'correctly parses files that dont have a spans attribute on rows' do + parsed = Roo::Excelx.new('test/files/missing_spans.xlsx') + expect(parsed.row(1)).to eql(["Adulterated document"]) + end end - end
Add test proving it works w/ files that don't supply spans attribute on rowns
diff --git a/spec/models/comment_spec.rb b/spec/models/comment_spec.rb index abc1234..def5678 100644 --- a/spec/models/comment_spec.rb +++ b/spec/models/comment_spec.rb @@ -0,0 +1,25 @@+require "rails_helper" + +RSpec.describe Comment, type: :model do + let(:case_worker) { create(:user, :case_worker) } + let(:admin) { create(:user, :admin) } + let(:grant) { create(:grant, user: case_worker) } + let(:comments_mail) { double("comment_mail", deliver: true) } + describe "#create" do + context "when the comment is created by the admin" do + it "sends an email to the case worker" do + expect(CommentsMailer).to receive(:comment_email).with(anything, case_worker).and_return(comments_mail) + grant.comments.create(user: admin, body: "Hello World") + end + end + context "when the comment is created by the case worker" do + before do + admin + end + it "sends an email to the admin" do + expect(CommentsMailer).to receive(:comment_email).with(anything, admin).and_return(comments_mail) + grant.comments.create(user: case_worker, body: "Hello World") + end + end + end +end
Add tests verifying that we lookup users on creation of comments * spec/models/comment_spec.rb: Add tests for ensuring that comments can notify the appropriate other users about new comments.
diff --git a/spec/support/example_app.rb b/spec/support/example_app.rb index abc1234..def5678 100644 --- a/spec/support/example_app.rb +++ b/spec/support/example_app.rb @@ -3,6 +3,8 @@ class ExampleApp < Sinatra::Base set :views, File.dirname(__FILE__) + '/views' + set :raise_errors, true + set :show_exceptions, false helpers MozNav::RenderHelpers
Allow errors to be propagated.
diff --git a/lib/facter/pip_version.rb b/lib/facter/pip_version.rb index abc1234..def5678 100644 --- a/lib/facter/pip_version.rb +++ b/lib/facter/pip_version.rb @@ -5,15 +5,23 @@ Facter.add("pip_version") do has_weight 100 setcode do - /^pip (\d+\.\d+\.?\d*).*$/.match(Facter::Util::Resolution.exec('pip --version 2>/dev/null'))[1] + begin + /^pip (\d+\.\d+\.?\d*).*$/.match(Facter::Util::Resolution.exec('pip --version 2>/dev/null'))[1] + rescue + false + end end end Facter.add("pip_version") do has_weight 50 setcode do - unless [:absent,'purged'].include?(pkg.retrieve[pkg.property(:ensure)]) - /^.*(\d+\.\d+\.\d+).*$/.match(pkg.retrieve[pkg.property(:ensure)])[1] + begin + unless [:absent,'purged'].include?(pkg.retrieve[pkg.property(:ensure)]) + /^.*(\d+\.\d+\.\d+).*$/.match(pkg.retrieve[pkg.property(:ensure)])[1] + end + rescue + false end end end
Add begin/rescue/end to setcode block This silences these warnings: Could not retrieve pip_version: undefined method `[]' for nil:NilClass Could not retrieve pip_version: can't convert Symbol into String
diff --git a/spec/gaddag/word/to_delimited_paths_spec.rb b/spec/gaddag/word/to_delimited_paths_spec.rb index abc1234..def5678 100644 --- a/spec/gaddag/word/to_delimited_paths_spec.rb +++ b/spec/gaddag/word/to_delimited_paths_spec.rb @@ -2,24 +2,18 @@ describe GADDAG::Word, '#to_delimited_paths' do context 'when the word is empty' do - let(:word) { GADDAG::Word.new([]) } - - it 'returns an empty list' do - expect(word.to_delimited_paths).to be_empty - end + subject { GADDAG::Word.new([]) } + specify { expect(subject.to_delimited_paths).to be_empty } end context 'when the word consists of a single letter' do - let(:word) { GADDAG::Word.new(%w(A)) } - - it 'returns an empty list' do - expect(word.to_delimited_paths).to be_empty - end + subject { GADDAG::Word.new(%w(A)) } + specify { expect(subject.to_delimited_paths).to be_empty } end context 'when the word consists of multiple letters' do - let(:word) { GADDAG::Word.new(%w(B R E A K)) } - let(:delimited_paths) { word.to_delimited_paths } + subject { GADDAG::Word.new(%w(B R E A K)) } + let(:delimited_paths) { subject.to_delimited_paths } it 'returns a list with n-1 paths' do expect(delimited_paths.count).to eq(4)
Use subject instead of let, not sure if clearer
diff --git a/lib/image-picker-rails.rb b/lib/image-picker-rails.rb index abc1234..def5678 100644 --- a/lib/image-picker-rails.rb +++ b/lib/image-picker-rails.rb @@ -1,5 +1,8 @@ require "image-picker-rails/version" module ImagePickerRails - # Your code goes here... + module Rails + class Engine < ::Rails::Engine + end + end end
Make gem a Rails engine
diff --git a/lib/legal_pages/engine.rb b/lib/legal_pages/engine.rb index abc1234..def5678 100644 --- a/lib/legal_pages/engine.rb +++ b/lib/legal_pages/engine.rb @@ -5,5 +5,9 @@ config.to_prepare do ApplicationController.helper(LegalPages::ApplicationHelper) end + + def self.setup(&block) + yield self + end end end
Add setup code to evaluate app's initializer
diff --git a/lib/mina/unicorn/tasks.rb b/lib/mina/unicorn/tasks.rb index abc1234..def5678 100644 --- a/lib/mina/unicorn/tasks.rb +++ b/lib/mina/unicorn/tasks.rb @@ -5,7 +5,8 @@ namespace :unicorn do include Mina::Unicorn::Utility - set_default :unicorn_env, -> { fetch(:rails_env, 'production') } + # Following recommendations from http://unicorn.bogomips.org/unicorn_1.html#rack-environment + set_default :unicorn_env, -> { fetch(:rails_env) == 'development' ? 'development' : 'deployment' } set_default :unicorn_config, -> { "#{deploy_to}/#{current_path}/config/unicorn.rb" } set_default :unicorn_pid, -> { "#{deploy_to}/#{current_path}/tmp/pids/unicorn.pid" } set_default :unicorn_cmd, -> { "#{bundle_prefix} unicorn" }
Change default settings for unicorn_env Follow recommendations from official unicorn documentation. see: http://unicorn.bogomips.org/unicorn_1.html#rack-environment
diff --git a/lib/rspec_java/project_initializer/spec/features/homepage_spec.rb b/lib/rspec_java/project_initializer/spec/features/homepage_spec.rb index abc1234..def5678 100644 --- a/lib/rspec_java/project_initializer/spec/features/homepage_spec.rb +++ b/lib/rspec_java/project_initializer/spec/features/homepage_spec.rb @@ -1,7 +1,8 @@ require 'java_helper' RSpec.feature 'Home page', js: true do - before { visit '/' } - - it { expect(page.status_code).to eq(200) } + scenario 'visit homepage' do + visit '/' + expect(page.status_code).to eq(200) + end end
Use feature and scenario DSL The feature and scenario DSL correspond to describe and it, respectively. These methods are simply aliases that allow feature specs to read more as customer and acceptance tests
diff --git a/lib/rails-footnotes/notes/env_note.rb b/lib/rails-footnotes/notes/env_note.rb index abc1234..def5678 100644 --- a/lib/rails-footnotes/notes/env_note.rb +++ b/lib/rails-footnotes/notes/env_note.rb @@ -8,11 +8,18 @@ end def content - # Replace HTTP_COOKIE for a link - @env['HTTP_COOKIE'] = '<a href="#" style="color:#009" onclick="Footnotes.hideAllAndToggle(\'cookies_debug_info\');return false;">See cookies on its tab</a>' + env_data = @env.to_a.sort.unshift([:key, :value]).map do |k,v| + case k + when 'HTTP_COOKIE' + # Replace HTTP_COOKIE for a link + [k, '<a href="#" style="color:#009" onclick="Footnotes.hideAllAndToggle(\'cookies_debug_info\');return false;">See cookies on its tab</a>'] + else + [k, escape(v.to_s)] + end + end # Create the env table - mount_table(@env.to_a.sort.unshift([:key, :value]), :summary => "Debug information for #{title}") + mount_table(env_data) end end end
Stop the unescaped env madness!
diff --git a/lib/scss_lint/linter/declared_name.rb b/lib/scss_lint/linter/declared_name.rb index abc1234..def5678 100644 --- a/lib/scss_lint/linter/declared_name.rb +++ b/lib/scss_lint/linter/declared_name.rb @@ -3,29 +3,29 @@ include LinterRegistry def visit_function(node) - check(node) + check(node, 'function') yield # Continue into content block of this function definition end def visit_mixindef(node) - check(node) + check(node, 'mixin') yield # Continue into content block of this mixin definition end def visit_variable(node) - check(node) + check(node, 'variable') yield # Continue into expression tree for this variable definition - end - - def description - 'Names of variables, functions, mixins, and placeholders should be ' << - 'lowercase and use hyphens instead of underscores.' end private - def check(node) - add_lint(node) if node_has_bad_name?(node) + def check(node, node_type) + if node_has_bad_name?(node) + fixed_name = node.name.downcase.gsub(/_/, '-') + + add_lint(node, "Name of #{node_type} `#{node.name}` should " << + "be written in lowercase as `#{fixed_name}`") + end end end end
Make DeclaredName lints more specific Change the descriptions of lints reported by `DeclaredName` to be relevant to the particular context (e.g. whether the incorrectly named thing was a function, mixin, or variable). Change-Id: I2191c1a3bb4f512b7d28e377eaedce4c0ec0a849 Reviewed-on: https://gerrit.causes.com/28832 Tested-by: jenkins <d95b56ce41a2e1ac4cecdd398defd7414407cc08@causes.com> Reviewed-by: Greg Hurrell <79e2475f81a6317276bf7cbb3958b20d289b78df@causes.com>
diff --git a/app/decorators/review_decorator.rb b/app/decorators/review_decorator.rb index abc1234..def5678 100644 --- a/app/decorators/review_decorator.rb +++ b/app/decorators/review_decorator.rb @@ -7,8 +7,10 @@ h.link_to title, path, options end + # Do not use helper methods via Draper when the method is used in ActiveJob + # https://github.com/drapergem/draper/issues/655 def detail_url - "#{ENV.fetch('ANNICT_URL')}#{h.review_path(user.username, self)}" + "#{ENV.fetch('ANNICT_URL')}/@#{user.username}/reviews/#{id}" end def tweet_body
Stop to use a helper method
diff --git a/app/policies/application_policy.rb b/app/policies/application_policy.rb index abc1234..def5678 100644 --- a/app/policies/application_policy.rb +++ b/app/policies/application_policy.rb @@ -5,50 +5,5 @@ @user = user @record = record end - - def index? - false - end - - def show? - scope.where(id: record.id).exists? - end - - def create? - false - end - - def new? - create? - end - - def update? - false - end - - def edit? - update? - end - - def destroy? - false - end - - def scope - Pundit.policy_scope!(user, record.class) - end - - class Scope - attr_reader :user, :scope - - def initialize(user, scope) - @user = user - @scope = scope - end - - def resolve - scope - end - end end
Remove unused code from auto-generated app policy Huge test coverage increase...
diff --git a/app/serializers/game_serializer.rb b/app/serializers/game_serializer.rb index abc1234..def5678 100644 --- a/app/serializers/game_serializer.rb +++ b/app/serializers/game_serializer.rb @@ -1,6 +1,6 @@ class GameSerializer < ActiveModel::Serializer attributes :id, :created_at - has_one :tournament, serializer: TournamentListSerializer + has_one :tournament has_one :owner has_many :game_ranks has_many :comments
Remove dead reference to serializer
diff --git a/app/controllers/backend/navigations_controller.rb b/app/controllers/backend/navigations_controller.rb index abc1234..def5678 100644 --- a/app/controllers/backend/navigations_controller.rb +++ b/app/controllers/backend/navigations_controller.rb @@ -2,6 +2,6 @@ before_action -> { breadcrumb.add t('b.navigation'), backend_navigations_path } def index - @navigations = Navigation.all + @navigations = ::Navigation.all end end
Fix bad reference to Navigation.
diff --git a/common/src/rb/lib/selenium/webdriver/driver_extensions/takes_screenshot.rb b/common/src/rb/lib/selenium/webdriver/driver_extensions/takes_screenshot.rb index abc1234..def5678 100644 --- a/common/src/rb/lib/selenium/webdriver/driver_extensions/takes_screenshot.rb +++ b/common/src/rb/lib/selenium/webdriver/driver_extensions/takes_screenshot.rb @@ -9,7 +9,7 @@ module TakesScreenshot def save_screenshot(png_path) - File.open(png_path, 'w') { |f| f << screenshot_as(:png) } + File.open(png_path, 'wb') { |f| f << screenshot_as(:png) } end def screenshot_as(format) @@ -26,4 +26,4 @@ end # TakesScreenshot end # DriverExtensions end # WebDriver -end # Selenium+end # Selenium
JariBakken: Use "wb" mode string when saving screenshots (needed on Windows). r9686
diff --git a/app/features/album/album.rb b/app/features/album/album.rb index abc1234..def5678 100644 --- a/app/features/album/album.rb +++ b/app/features/album/album.rb @@ -14,6 +14,17 @@ def self.new_from_slug(slug) slug = ::AlbumSlug.new(slug) new(slug: slug.to_s, title: slug.to_title) + end + + def self.update_first_photo_taken_at! + all.each do |album| + album.update_first_photo_taken_at! + end + end + + def update_first_photo_taken_at! + self.first_photo_taken_at = photos.last.taken_at + save! end def generate_slug
Add methods to update first_photo_taken_at
diff --git a/app/helpers/files_helper.rb b/app/helpers/files_helper.rb index abc1234..def5678 100644 --- a/app/helpers/files_helper.rb +++ b/app/helpers/files_helper.rb @@ -1,5 +1,4 @@ module FilesHelper - private # The url to a icon representing the file based in its extension. @@ -10,14 +9,15 @@ end def options_to_sort_files(selected_option:) - options = {t('comfy.admin.cms.files.index.sort_by.name') => :label, - t('comfy.admin.cms.files.index.sort_by.date') => "position DESC"} + options = { + t('comfy.admin.cms.files.index.sort_by.name') => :label, + t('comfy.admin.cms.files.index.sort_by.date') => 'position DESC' + } options_for_select(options, selected_option) end def options_to_filter_files(selected_option:) - options = t('comfy.admin.cms.files.index.filter_by.type').split(',').map {|type| [type.strip, type.strip]} + options = t('comfy.admin.cms.files.index.filter_by.type').split(',').map { |type| [type.strip, type.strip] } options_for_select(options, selected_option) end - end
Format code in files helper
diff --git a/app/mailers/admin_mailer.rb b/app/mailers/admin_mailer.rb index abc1234..def5678 100644 --- a/app/mailers/admin_mailer.rb +++ b/app/mailers/admin_mailer.rb @@ -8,5 +8,9 @@ mail(to: @app_configs.admin_email, subject: "[Reservation] Notes for " + (Date.yesterday.midnight).strftime('%m/%d/%y')) end - + def overdue_checked_in_fine_admin(overdue_checked_in) + @app_configs = AppConfig.first + @overdue_checked_in = overdue_checked_in + mail(to: @app_configs.admin_email, subject: "[Reservation] Overdue equipment fine") + end end
Revert "removed admin mail for checkout" This reverts commit ce0eb77cabdfc3063ac1eb8aa52416f7264b9b0a.
diff --git a/app/controllers/videos_controller.rb b/app/controllers/videos_controller.rb index abc1234..def5678 100644 --- a/app/controllers/videos_controller.rb +++ b/app/controllers/videos_controller.rb @@ -6,9 +6,13 @@ def new @video = Video.new + if session[:user_id] == nil + redirect_to login_path + end end def create + current_user = User.find(session[:user_id]) @video = Video.new(video_params) if @video.save current_user.uploads << @video
Add redirecting if not logged in
diff --git a/app/mailers/spree/supplier_mailer.rb b/app/mailers/spree/supplier_mailer.rb index abc1234..def5678 100644 --- a/app/mailers/spree/supplier_mailer.rb +++ b/app/mailers/spree/supplier_mailer.rb @@ -1,7 +1,7 @@ module Spree class SupplierMailer < Spree::BaseMailer - default from: Spree::Config[:mails_from] + default from: Spree::Store.current.mail_from_address def welcome(supplier_id) @supplier = Supplier.find supplier_id
Replace outdated Spree::Config[:mails_from] with Spree::Store.current.mail_from_address https://github.com/spree/spree/pull/6097
diff --git a/app/models/spree/gateway/usa_epay.rb b/app/models/spree/gateway/usa_epay.rb index abc1234..def5678 100644 --- a/app/models/spree/gateway/usa_epay.rb +++ b/app/models/spree/gateway/usa_epay.rb @@ -19,7 +19,7 @@ gateway_options = if creditcard.respond_to?(:gateway_options) creditcard.gateway_options(payment) else - payment.gateway_options(payment) + payment.send(:gateway_options, payment) end if creditcard.gateway_customer_profile_id.nil?
Call gateway_options on payment using send, given that it's a private method
diff --git a/spec/clipboard_file_spec.rb b/spec/clipboard_file_spec.rb index abc1234..def5678 100644 --- a/spec/clipboard_file_spec.rb +++ b/spec/clipboard_file_spec.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true require_relative "spec_helper" + +require "fileutils" describe 'Clipboard::File' do before :all do
Add explicit require "fileuilts" in spec file
diff --git a/spec/dummy/config/routes.rb b/spec/dummy/config/routes.rb index abc1234..def5678 100644 --- a/spec/dummy/config/routes.rb +++ b/spec/dummy/config/routes.rb @@ -3,5 +3,5 @@ devise_for :users - root 'application#welcome' + root to: redirect('/admin') end
Change root path for dummy app
diff --git a/spec/github_cli/cli_spec.rb b/spec/github_cli/cli_spec.rb index abc1234..def5678 100644 --- a/spec/github_cli/cli_spec.rb +++ b/spec/github_cli/cli_spec.rb @@ -1,5 +1,66 @@ require 'spec_helper' describe GithubCLI::CLI do + let(:object) { described_class } + let(:config) { stub(:config).as_null_object } + let(:ui) { stub(:ui) } + before { + GithubCLI.stub(:ui).and_return(ui) + GithubCLI.stub(:config).and_return(config) + } + + context 'whoami' do + let(:config) { {'user.login' => nil } } + + it 'checks config for user info' do + ui.should_receive(:info).with(/Not authed/) + subject.invoke 'whoami', [] + end + end + + context 'init' do + it 'confirms config creation' do + ui.should_receive(:confirm).with(/Writing new configuration file/) + File.stub(:exists?).and_return(false) + subject.invoke "init", [] + end + + it 'aborts if config already exists' do + ui.should_receive(:error).with(/Not overwritting existing/) + File.stub(:exists?).and_return(true) + expect { subject.invoke "init", [] }.to raise_error(SystemExit) + end + + it 'allows to overwrite existing config' do + ui.should_receive(:confirm).with(/Writing new configuration file/) + File.stub(:exists?).and_return(true) + subject.invoke "init", [], {:force => true} + end + end + + context 'config' do + let(:name) { 'core.editor' } + + before { + File.stub(:exists?).and_return(true) + GithubCLI::Terminal.stub(:line) + } + + it 'aborts without config file' do + ui.should_receive(:error).with(/Configuration file does not exist/) + File.stub(:exists?).and_return(false) + expect { subject.invoke "config", [] }.to raise_error(SystemExit) + end + + it 'prints option for list flag' do + GithubCLI::Terminal.should_receive(:print_config).with(name) + subject.invoke "config", [name], {:list => true} + end + + it 'print whole config without parameters' do + GithubCLI::Terminal.should_receive(:print_config) + subject.invoke "config", [] + end + end end
Add test for init and config commands.