diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/language/BEGIN_spec.rb b/language/BEGIN_spec.rb index abc1234..def5678 100644 --- a/language/BEGIN_spec.rb +++ b/language/BEGIN_spec.rb @@ -18,6 +18,11 @@ -> { eval "1.times { BEGIN { 1 } }" }.should raise_error(SyntaxError) end + it "uses top-level for self" do + eval("BEGIN { ScratchPad << self.to_s }", TOPLEVEL_BINDING) + ScratchPad.recorded.should == ['main'] + end + it "runs first in a given code unit" do eval "ScratchPad << 'foo'; BEGIN { ScratchPad << 'bar' }"
Write self before BEGIN node
diff --git a/lib/sinatra_asset_packager/routes.rb b/lib/sinatra_asset_packager/routes.rb index abc1234..def5678 100644 --- a/lib/sinatra_asset_packager/routes.rb +++ b/lib/sinatra_asset_packager/routes.rb @@ -24,5 +24,11 @@ SinatraAssetPackager.environment["#{params[:splat][0]}.#{format}"] end end + + get "/assets/*.svg" do + content_type("image/svg+xml") + filepath = params[:splat][0] + SinatraAssetPackager.environment["#{filepath}.svg"] + end end end
Add image support for .svgs
diff --git a/lib/stack_master/commands/compile.rb b/lib/stack_master/commands/compile.rb index abc1234..def5678 100644 --- a/lib/stack_master/commands/compile.rb +++ b/lib/stack_master/commands/compile.rb @@ -5,7 +5,7 @@ include Commander::UI def perform - puts(proposed_stack.template_body) + StackMaster.stdout.puts(proposed_stack.template_body) end private
Print template to StackMaster configured stdout Allows us to test the output via Cucumber
diff --git a/lib/stripe/resources/issuing/card.rb b/lib/stripe/resources/issuing/card.rb index abc1234..def5678 100644 --- a/lib/stripe/resources/issuing/card.rb +++ b/lib/stripe/resources/issuing/card.rb @@ -13,7 +13,7 @@ def details(params = {}, opts = {}) resp, opts = request(:get, resource_url + "/details", params, opts) - Util.convert_to_stripe_object(resp.data, opts) + initialize_from(resp.data, opts) end end end
Revert "Use Util.convert_to_stripe_object instead of initialize_from" This reverts commit ea736eba1b8f33d8febbf0b1be0957f34f7b04db.
diff --git a/vagrant-butcher.gemspec b/vagrant-butcher.gemspec index abc1234..def5678 100644 --- a/vagrant-butcher.gemspec +++ b/vagrant-butcher.gemspec @@ -18,7 +18,7 @@ gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.require_paths = ["lib"] - gem.add_dependency "ridley", ">= 1.5.3" + gem.add_dependency "ridley", ">= 4.0.0" gem.add_development_dependency "rspec" gem.add_development_dependency "pry-debugger"
Update gemspec to fix incompatibilities
diff --git a/guessing_game/guess.rb b/guessing_game/guess.rb index abc1234..def5678 100644 --- a/guessing_game/guess.rb +++ b/guessing_game/guess.rb @@ -5,7 +5,20 @@ # A guessing game in which the hints might not be true! # #======================================================= +# Create the game class +class Game + TOTAL_ROUNDS = 3 +end + +# Create the player class + +class Player + # insert code +end + + +#======================================================= # Create a helpful message that will explain to the player # what's about to happen @@ -15,8 +28,12 @@ puts "You'll also estimate how many guesses it will take." puts "If you do it in fewer guesses, you'll gain bonus points!" + + + + + #======================================================= - # Set game variables print "What is your name? " @@ -41,4 +58,9 @@ game.show_results end game.next_round + end + end end + +puts " " +game.print_final_score
Create game and player class:
diff --git a/examples/checkout/search/search_abandoned_transactions.rb b/examples/checkout/search/search_abandoned_transactions.rb index abc1234..def5678 100644 --- a/examples/checkout/search/search_abandoned_transactions.rb +++ b/examples/checkout/search/search_abandoned_transactions.rb @@ -8,7 +8,10 @@ # You can pass the credentials parameters to PagSeguro::Transaction#find_abandoned options = { - credentials: PagSeguro::AccountCredentials.new('EMAIL', 'TOKEN') + credentials: PagSeguro::AccountCredentials.new('EMAIL', 'TOKEN'), + starts_at: (Time.now - 86400), + ends_at: (Time.now - 900), + per_page: 50 # You can pass more arguments by params, look (/lib/pagseguro/transaction.rb) }
Add more options to search abandonated transaction example.
diff --git a/ruby_event_store/lib/ruby_event_store/transform_keys.rb b/ruby_event_store/lib/ruby_event_store/transform_keys.rb index abc1234..def5678 100644 --- a/ruby_event_store/lib/ruby_event_store/transform_keys.rb +++ b/ruby_event_store/lib/ruby_event_store/transform_keys.rb @@ -14,16 +14,15 @@ private def deep_transform(data, &block) - data.each_with_object({}) do |(k, v), h| - h[yield(k)] = - case v - when Hash - deep_transform(v, &block) - when Array - v.map { |i| Hash === i ? deep_transform(i, &block) : i } - else - v - end + case data + when Hash + data.each_with_object({}) do |(key, value), hash| + hash[yield(key)] = deep_transform(value, &block) + end + when Array + data.map { |i| deep_transform(i, &block) } + else + data end end end
Refactor to handle Array of arrays
diff --git a/lib/factory_girl/remote.rb b/lib/factory_girl/remote.rb index abc1234..def5678 100644 --- a/lib/factory_girl/remote.rb +++ b/lib/factory_girl/remote.rb @@ -16,7 +16,7 @@ end def invoke(method, attrs) - Rack::Remote.invoke self.remote, :factory_girl_remote, attrs, { 'Accept' => 'application/json' } + Rack::Remote.invoke self.remote, :factory_girl_remote, attrs.merge(_method: method), { 'Accept' => 'application/json' } end class << self @@ -32,5 +32,14 @@ define_invoke_method "#{name}" define_invoke_method "#{name}_list" end + + class << self + def init_server + Rack::Remote.register :factory_girl_remote do |params, env, request| + method = params.delete(:_method) || :create + FactoryGirl.send method, *params + end + end + end end end
Add method to register Rack::Remote handler.
diff --git a/ted_utils.rb b/ted_utils.rb index abc1234..def5678 100644 --- a/ted_utils.rb +++ b/ted_utils.rb @@ -0,0 +1,19 @@+module TedUtils + +def self.active_view + Sketchup.active_model.active_view +end + +def self.camera + active_view.camera +end + +# set the active camera's aspect ratio to be locked to whatever +# the current viewport size is +def self.set_aspect_from_view + aspect = active_view.vpwidth.to_f / active_view.vpheight + camera.focal_length /= aspect + camera.aspect_ratio = aspect +end + +end # module TedUtils
Add short-hand helpers- added utility to set aspect ratio based on view
diff --git a/lib/hal_api/representer.rb b/lib/hal_api/representer.rb index abc1234..def5678 100644 --- a/lib/hal_api/representer.rb +++ b/lib/hal_api/representer.rb @@ -1,6 +1,12 @@ # encoding: utf-8 class HalApi::Representer < Roar::Decorator + include Roar::Hypermedia + include Roar::JSON::HAL + include Roar::JSON::HAL::Links + include Roar::JSON + require 'roar/rails/hal' + require 'hal_api/representer/caches' require 'hal_api/representer/curies' require 'hal_api/representer/embeds' @@ -8,7 +14,6 @@ require 'hal_api/representer/link_serialize' require 'hal_api/representer/uri_methods' - include Roar::JSON::HAL include HalApi::Representer::FormatKeys include HalApi::Representer::UriMethods include HalApi::Representer::Curies
Fix includes, specifically require roar/rails/hal or it does not load correctly
diff --git a/lib/neoteric-protection.rb b/lib/neoteric-protection.rb index abc1234..def5678 100644 --- a/lib/neoteric-protection.rb +++ b/lib/neoteric-protection.rb @@ -2,17 +2,26 @@ module Neoteric module Protection - extend ActiveSupport::Concern + def self.included(base) + base.extend ClassMethods + base.helper_method :staging? + base.before_filter :require_http_basic_auth + end - included do - helper_method :staging? - before_filter :require_http_basic_auth + module ClassMethods + def username(name) + class_eval do + define_method(:username) do + name + end + end + end end private def require_http_basic_auth authenticate_or_request_with_http_basic do |username, password| - username == ENV['STAGING_USERNAME'] && password == ENV['STAGING_PASSWORD'] + username == self.username && password == 'neoteric' end if staging? end
Make the username easier to configure, default to neoteric password
diff --git a/lib/response/status.rb b/lib/response/status.rb index abc1234..def5678 100644 --- a/lib/response/status.rb +++ b/lib/response/status.rb @@ -11,6 +11,8 @@ NOT_MODIFIED = new(304, 'Not Modified' ) FOUND = new(302, 'Found' ) MOVED_PERMANENTLY = new(301, 'Moved Permanently') + NOT_AUTHORIZED = new(401, 'Not Authorized' ) + FORBIDDEN = new(403, 'Forbidden' ) end end
Add http stats code fixtures for 401 and 403
diff --git a/lib/superstore/base.rb b/lib/superstore/base.rb index abc1234..def5678 100644 --- a/lib/superstore/base.rb +++ b/lib/superstore/base.rb @@ -1,6 +1,5 @@ require 'set' -require 'active_record/attributes' -require 'active_record/define_callbacks' if ActiveRecord.version >= Gem::Version.new('5.1.0') +require 'active_record/define_callbacks' require 'superstore/types' module Superstore
Remove code that supported rails 5.1
diff --git a/lib/troo/api/client.rb b/lib/troo/api/client.rb index abc1234..def5678 100644 --- a/lib/troo/api/client.rb +++ b/lib/troo/api/client.rb @@ -35,10 +35,6 @@ response.is_a?(Array) end - def log_endpoint - Troo.logger.debug(endpoint) if log? - end - def empty_response? response.empty? end @@ -59,6 +55,10 @@ verb.nil? || endpoint.nil? || model.nil? end + def log_endpoint + Troo.logger.debug(endpoint) if log? + end + def log? Troo.configuration.logs end
Move method to improve class readability.
diff --git a/scraper_tools.gemspec b/scraper_tools.gemspec index abc1234..def5678 100644 --- a/scraper_tools.gemspec +++ b/scraper_tools.gemspec @@ -16,8 +16,8 @@ s.add_development_dependency "minitest" s.add_development_dependency "webmock" s.add_development_dependency "mocha" - - s.files = Dir.glob("{lib}/**/*") + %w(LICENSE README.md CHANGELOG.md) s.add_development_dependency "redis" + + s.files = Dir.glob("{lib}/**/*") + %w(LICENSE) s.require_path = 'lib' end
Remove files referenced by gem spec that don’t yet exist
diff --git a/lib/cfer/core/hooks.rb b/lib/cfer/core/hooks.rb index abc1234..def5678 100644 --- a/lib/cfer/core/hooks.rb +++ b/lib/cfer/core/hooks.rb @@ -2,13 +2,15 @@ # Provides support for hooking into resource types, and evaluating code before or after properties are set module Hooks def pre_block - self.class.pre_hooks.sort { |a, b| (a[:nice] || 0) <=> (b[:nice] || 0) }.each do |hook| - Docile.dsl_eval(self, &hook[:block]) - end + eval_hooks self.class.pre_hooks end def post_block - self.class.post_hooks.sort { |a, b| (a[:nice] || 0) <=> (b[:nice] || 0) }.each do |hook| + eval_hooks self.class.post_hooks + end + + private def eval_hooks(hooks) + hooks.sort { |a, b| (a[:nice] || 0) <=> (b[:nice] || 0) }.each do |hook| Docile.dsl_eval(self, &hook[:block]) end end
Reduce code duplication for CodeClimate
diff --git a/lib/contextio/account_collection.rb b/lib/contextio/account_collection.rb index abc1234..def5678 100644 --- a/lib/contextio/account_collection.rb +++ b/lib/contextio/account_collection.rb @@ -1,9 +1,15 @@-require_relative 'api/resource_collection' +require_relative 'api/filtered_resource_collection' +require_relative 'account' class ContextIO # Represents a collection of email accounts for your Context.IO account. You # can use this to add a new one to your account, iterate over them, or fetch a # specific one. + # + # You can also limit which accounts belongin the collection using the `where` + # method. Valid keys are: email, status, status_ok, limit and offset. See + # [the Context.IO documentation](http://context.io/docs/2.0/accounts#get) for + # more explanation of what each key means. # # @example You can iterate over them with `each`: # contextio.accounts.each do |accounts| @@ -12,8 +18,11 @@ # # @example You can lazily access a specific one with square brackets: # account = contextio.accounts['some id'] + # + # @example Lazily limit based on a hash of criteria with `where`: + # disabled_accounts = contextio.accounts.where(status: 'DISABLED') class AccountCollection - include ContextIO::API::ResourceCollection + include ContextIO::API::FilteredResourceCollection self.resource_url = 'accounts' self.resource_class = ContextIO::Account
Make AccountCollection filtered and document it.
diff --git a/lib/event/team_join.rb b/lib/event/team_join.rb index abc1234..def5678 100644 --- a/lib/event/team_join.rb +++ b/lib/event/team_join.rb @@ -17,6 +17,7 @@ def process @user = Operationcode::Slack::User.new(@data['event']['user']) + logger.info("Welcoming user #{resolve_user_name}") Operationcode::Slack::Im.new(user: resolve_user_name).deliver(ERB.new(@template).result(binding)) end
Add logging to team join
diff --git a/lib/plugins/pokemon.rb b/lib/plugins/pokemon.rb index abc1234..def5678 100644 --- a/lib/plugins/pokemon.rb +++ b/lib/plugins/pokemon.rb @@ -26,7 +26,10 @@ result['types'].each { |type| types += "#{type['name']}" } end + # Easter Egg Images image = 'http://i.imgur.com/diheSTI.jpg' if name.downcase == "squirtle" + image = 'http://i.imgur.com/ONewqhC.png' if name.downcase == "staryu" + m.reply "ID: #{id} | #{types} | #{hp} Atk: #{result['attack']} Def: #{result['defense']} | #{image}" end
Add easter egg image to Pokemon plugin
diff --git a/lib/rack/fiber_pool.rb b/lib/rack/fiber_pool.rb index abc1234..def5678 100644 --- a/lib/rack/fiber_pool.rb +++ b/lib/rack/fiber_pool.rb @@ -2,9 +2,11 @@ module Rack class FiberPool + SIZE = 100 + def initialize(app) @app = app - @fiber_pool = ::FiberPool.new + @fiber_pool = ::FiberPool.new(SIZE) yield @fiber_pool if block_given? end
Use size constant for tunable pool size, not the best solution but better.
diff --git a/lib/trashed/railtie.rb b/lib/trashed/railtie.rb index abc1234..def5678 100644 --- a/lib/trashed/railtie.rb +++ b/lib/trashed/railtie.rb @@ -28,8 +28,8 @@ app.config.trashed.gauge_sample_rate ||= 0.05 app.config.trashed.logger ||= Rails.logger - app.middleware.insert_after Rack::Runtime, Trashed::Rack, app.config.trashed - app.middleware.insert_after Rails::Rack::Logger, ExposeLoggerTagsToRackEnv + app.middleware.insert_after ::Rack::Runtime, Trashed::Rack, app.config.trashed + app.middleware.insert_after ::Rails::Rack::Logger, ExposeLoggerTagsToRackEnv end end end
Fix error when fixing deprecation warnings These needed to be `::Rack::Runtime` not `Rack::Runtime` when the quotes were removed to fix deprecation warnings from Rails.
diff --git a/spec/controllers/myaccount/overviews_controller_spec.rb b/spec/controllers/myaccount/overviews_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/myaccount/overviews_controller_spec.rb +++ b/spec/controllers/myaccount/overviews_controller_spec.rb @@ -11,6 +11,13 @@ end it "show action should render show template" do + get :show + response.should render_template(:show) + end + + it "show action should render show template" do + @address = Factory(:address, :addressable => @user) + @user.stubs(:default_shipping_address).returns(@address) get :show response.should render_template(:show) end
Add test for better test coverage
diff --git a/spec/system/verification/level_two_verification_spec.rb b/spec/system/verification/level_two_verification_spec.rb index abc1234..def5678 100644 --- a/spec/system/verification/level_two_verification_spec.rb +++ b/spec/system/verification/level_two_verification_spec.rb @@ -24,10 +24,7 @@ end context "In Spanish, with no fallbacks" do - before do - skip unless I18n.available_locales.include?(:es) - allow(I18n.fallbacks).to receive(:[]).and_return([:es]) - end + before { allow(I18n.fallbacks).to receive(:[]).and_return([:es]) } scenario "Works normally" do user = create(:user)
Remove unnecessary locales check in specs We define the available locales in the test environment, so Spanish is always available in this environment even if it isn't available in the production environment.
diff --git a/lib/tasks/hotspot-metrics-seed.rake b/lib/tasks/hotspot-metrics-seed.rake index abc1234..def5678 100644 --- a/lib/tasks/hotspot-metrics-seed.rake +++ b/lib/tasks/hotspot-metrics-seed.rake @@ -1,11 +1,11 @@ require 'yaml' desc 'Generate a seeds file from a metrics YAML file' -task :hotspot_metrics_seed, [:name, :yml_file] do |t, args| +task :hotspot_metrics_seed, [:name, :yml_file] do |_, args| metrics = YAML.load_file(args[:yml_file])[:metrics] file_name = args[:name].tr(' ', '_').downcase - File.open("db/#{file_name}.rb", "w") do |file| + File.open("db/#{file_name}.rb", 'w') do |file| file.puts <<RUBY #{file_name}_configuration = KalibroConfiguration.create( name: #{args[:name].inspect}, @@ -19,7 +19,7 @@ warn "Could not create #{code}. Only implemented for hotspot metrics!" next end - + file.puts <<RUBY #{code} = HotspotMetricSnapshot.create( name: #{metric_info[:name].inspect},
Fix the last rubocop warnings
diff --git a/lib/versionator/detector/drupal7.rb b/lib/versionator/detector/drupal7.rb index abc1234..def5678 100644 --- a/lib/versionator/detector/drupal7.rb +++ b/lib/versionator/detector/drupal7.rb @@ -10,7 +10,7 @@ set :detect_files, %w{CHANGELOG.txt cron.php index.php install.php xmlrpc.php} set :installed_version_file, "CHANGELOG.txt" - set :installed_version_regexp, /^Drupal (7.+), .*$/ + set :installed_version_regexp, /^Drupal (.+), .*$/ set :newest_version_url, 'http://drupal.org/project/drupal' set :newest_version_selector, '.download-table .project-release .views-row-first .views-field-version a' @@ -18,7 +18,7 @@ # Overridden to make sure that we do only detect Drupal7 def contents_detected? - installed_version.major >= 7 + installed_version.major >= 7 if super end def project_url_for_version(version)
Fix installed version detection for Drupal 7
diff --git a/call_sign.gemspec b/call_sign.gemspec index abc1234..def5678 100644 --- a/call_sign.gemspec +++ b/call_sign.gemspec @@ -18,6 +18,8 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] + spec.add_dependency 'countries' + spec.add_development_dependency "bundler", "~> 1.5" spec.add_development_dependency "rake" end
Add the countries gem to the gemspec.
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -8,7 +8,7 @@ survey = Survey.create(user_id: User.first.id, name: "DBC Feedback") -question = Question.create(survey_id: survey.id, +question1 = Question.create(survey_id: survey.id, text: "How much do you love DBC?") choices = ["A lot", @@ -17,9 +17,23 @@ "Around the moon and back again"] choices.each do |choice| - Choice.create(question_id: question.id, + Choice.create(question_id: question1.id, text: choice) end + +question2 = Question.create(survey_id: survey.id, + text: "How awesome is this?") + +choices = ["A lot", + "A whole lot", + "A super-duper-lot", + "Around the moon and back again"] + +choices.each do |choice| + Choice.create(question_id: question2.id, + text: choice) +end + 100.times do |i| poll = Poll.create(user_id: User.ids.sample,
Update seed file so survey has two questions
diff --git a/spec/features/admin/runners_spec.rb b/spec/features/admin/runners_spec.rb index abc1234..def5678 100644 --- a/spec/features/admin/runners_spec.rb +++ b/spec/features/admin/runners_spec.rb @@ -8,6 +8,9 @@ describe "GET /admin/runners" do before do + runner = FactoryGirl.create(:runner) + commit = FactoryGirl.create(:commit) + FactoryGirl.create(:build, commit: commit, runner_id: runner.id) visit admin_runners_path end
Write test for 500 error on runners page
diff --git a/spec/realworld/double_check_spec.rb b/spec/realworld/double_check_spec.rb index abc1234..def5678 100644 --- a/spec/realworld/double_check_spec.rb +++ b/spec/realworld/double_check_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "double checking sources", :realworld => true do +RSpec.describe "double checking sources", :realworld => true, :sometimes => true do it "finds already-installed gems" do create_file("rails.gemspec", <<-RUBY) Gem::Specification.new do |s|
Enable retries on flaky spec
diff --git a/spec/requests/user/profiles_spec.rb b/spec/requests/user/profiles_spec.rb index abc1234..def5678 100644 --- a/spec/requests/user/profiles_spec.rb +++ b/spec/requests/user/profiles_spec.rb @@ -8,4 +8,10 @@ current_path.should == "/users/#{user.id}-#{user.name.parameterize}/profile" page.should have_content(user.name) end + + context "edit" do + it "should upload a picture" + it "should set the website address" + it "should set the biography" + end end
Add pending user profile tests.
diff --git a/lib/active_record_where_assoc.rb b/lib/active_record_where_assoc.rb index abc1234..def5678 100644 --- a/lib/active_record_where_assoc.rb +++ b/lib/active_record_where_assoc.rb @@ -4,7 +4,15 @@ require "active_record" module ActiveRecordWhereAssoc - # Default options for the gem. Meant to be modified in place by external code + # Default options for the gem. Meant to be modified in place by external code, such as in + # an initializer. + # Ex: + # ActiveRecordWhereAssoc[:ignore_limit] = true + # + # A description for each can be found in ActiveRecordWhereAssoc::QueryMethods#where_assoc_exists. + # + # The only one that truly makes sense to change is :ignore_limit, when you are using MySQL, since + # limit are never supported on it. def self.default_options @default_options ||= { ignore_limit: false,
Add information about the default_options directly in the code
diff --git a/guard-rspec.gemspec b/guard-rspec.gemspec index abc1234..def5678 100644 --- a/guard-rspec.gemspec +++ b/guard-rspec.gemspec @@ -18,7 +18,7 @@ s.require_path = 'lib' s.add_dependency 'guard', '~> 2.1' - s.add_dependency 'rspec', '>= 2.14', '< 4.0' + # s.add_dependency 'rspec', '>= 2.14', '< 4.0' s.add_development_dependency 'bundler', '>= 1.3.5', '< 2.0' s.add_development_dependency 'rake', '~> 10.1'
Disable rspec dependency for now
diff --git a/chef-zero.gemspec b/chef-zero.gemspec index abc1234..def5678 100644 --- a/chef-zero.gemspec +++ b/chef-zero.gemspec @@ -13,7 +13,7 @@ s.license = 'Apache 2.0' s.add_dependency 'mixlib-log', '~> 1.3' - s.add_dependency 'hashie', '~> 2.0' + s.add_dependency 'hashie', '>= 2.0', '< 4.0' s.add_dependency 'uuidtools', '~> 2.1' s.add_dependency 'ffi-yajl', '~> 2.2' s.add_dependency 'rack'
Allow Hashie to float to 3.x (no need to be so specific)
diff --git a/lib/headhunter/html_validator.rb b/lib/headhunter/html_validator.rb index abc1234..def5678 100644 --- a/lib/headhunter/html_validator.rb +++ b/lib/headhunter/html_validator.rb @@ -8,9 +8,9 @@ @responses = [] end - def validate(url, html) + def validate(uri, html) # Docs for Tidy: http://tidy.sourceforge.net/docs/quickref.html - @responses << PageValidations::HTMLValidation.new.validation(html, url) + @responses << PageValidations::HTMLValidation.new.validation(html, uri) @responses.last end
Rename url parameter to uri
diff --git a/lib/dap/input/csv.rb b/lib/dap/input/csv.rb index abc1234..def5678 100644 --- a/lib/dap/input/csv.rb +++ b/lib/dap/input/csv.rb @@ -34,7 +34,12 @@ res = {} line = self.fd.readline rescue nil return Error::EOF unless line - arr = CSV.parse(line) rescue nil + + # Short-circuit the slow CSV parser if the data does not contain double quotes + arr = line.index('"') ? + ( CSV.parse(line) rescue nil ) : + [ line.split(',').map{|x| x.strip } ] + return Error::Empty unless arr cnt = 0 arr.first.each do |x|
Speed up CSV parsing by 4 x when the line doesn't contain quotes
diff --git a/lib/puppet/parser/functions/get_latest_vagrant_version.rb b/lib/puppet/parser/functions/get_latest_vagrant_version.rb index abc1234..def5678 100644 --- a/lib/puppet/parser/functions/get_latest_vagrant_version.rb +++ b/lib/puppet/parser/functions/get_latest_vagrant_version.rb @@ -5,6 +5,6 @@ newfunction(:get_latest_vagrant_version, :type => :rvalue) do |args| # tags = JSON.parse(open('https://api.github.com/repos/mitchellh/vagrant/tags') { |u| u.read }) # tags.sort_by { |tag| tag['name'] }.last['name'][1..-1] - JSON.parse(open('http://www.vagrantup.com/latest-version.json') { |u| u.read })["version"] + JSON.parse(open('https://checkpoint-api.hashicorp.com/v1/check/vagrant') { |u| u.read })["current_version"] end end
Use new checkpoint api for latest version lookup
diff --git a/lib/dm-timestamps.rb b/lib/dm-timestamps.rb index abc1234..def5678 100644 --- a/lib/dm-timestamps.rb +++ b/lib/dm-timestamps.rb @@ -19,7 +19,7 @@ module InstanceMethods def update_magic_properties - self.class.properties.slice(*MAGIC_PROPERTIES.keys).each do |property| + self.class.properties.find_all{ |property| MAGIC_PROPERTIES.has_key?(property.name) }.each do |property| MAGIC_PROPERTIES[property.name][self] end end
Change slice to find_all in update_magic_properties
diff --git a/lib/docker_runner.rb b/lib/docker_runner.rb index abc1234..def5678 100644 --- a/lib/docker_runner.rb +++ b/lib/docker_runner.rb @@ -26,8 +26,7 @@ c.attach(logs: true) do |s,c| yield s,c end - ensure e - puts "Caught error inside DockerRunner: #{e}" + ensure # This appears to be giving a broken pipe (Errno::EPIPE) sometimes if c.json["State"]["Running"] c.kill
Revert "For debugging purposes show the error" This reverts commit 8d43cbab5fbcd4429871b45a5fa9b2e34449c374.
diff --git a/lib/mirah/jvm/types/null_type.rb b/lib/mirah/jvm/types/null_type.rb index abc1234..def5678 100644 --- a/lib/mirah/jvm/types/null_type.rb +++ b/lib/mirah/jvm/types/null_type.rb @@ -3,7 +3,7 @@ module Types class NullType < Type def initialize - super('java.lang.Object') + super(BiteScript::ASM::ClassMirror.load('java.lang.Object')) end def to_s
Add a class mirror to the NullType
diff --git a/lib/partial_ks/filtered_table.rb b/lib/partial_ks/filtered_table.rb index abc1234..def5678 100644 --- a/lib/partial_ks/filtered_table.rb +++ b/lib/partial_ks/filtered_table.rb @@ -26,9 +26,9 @@ def filter_based_on_custom_filter_relation if custom_filter_relation.is_a?(ActiveRecord::Relation) || custom_filter_relation.respond_to?(:where_sql) - only_filter = custom_filter_relation.where_sql.to_s.sub(where_regexp, "") + custom_filter_relation.where_sql.to_s.sub(where_regexp, "") elsif custom_filter_relation.is_a?(String) - only_filter = custom_filter_relation.sub(where_regexp, "") + custom_filter_relation.sub(where_regexp, "") end end
Refactor : remove useless variable assignment
diff --git a/lib/tasks/store_files_on_s3.rake b/lib/tasks/store_files_on_s3.rake index abc1234..def5678 100644 --- a/lib/tasks/store_files_on_s3.rake +++ b/lib/tasks/store_files_on_s3.rake @@ -13,29 +13,34 @@ false end + def push_to_s3(item, filename) + id_partition = ("%09d" % item.id).scan(/\d{3}/).join("/") + local_filepath = "#{Rails.root}/public/files/#{id_partition}/original/#{filename}" + + print "Processing #{local_filepath}" + + File.open(local_filepath) do |filehandle| + item.file.assign(filehandle) + if item.file.save + puts "; stored to #{item.file.url}" + else + puts "; S3 store failed!" + end + end + rescue Errno::ENOENT => e + puts ": Skipping! File does not exist." + end + desc "Move files from local to S3" task move_to_s3: :environment do next unless allow_task? - StoredFile.all.each do |stored_file| - id_partition = ("%09d" % stored_file.id).scan(/\d{3}/).join("/") - filename = stored_file.file_file_name.gsub(/#/, "-") - local_filepath = "#{Rails.root}/public/files/#{id_partition}/original/#{filename}" + Journal.where("file_file_name IS NOT NULL").each do |journal| + push_to_s3(journal, journal.file_file_name) + end - print "Processing #{local_filepath}" - - begin - File.open(local_filepath) do |filehandle| - stored_file.file.assign(filehandle) - if stored_file.file.save - puts "; stored to #{stored_file.file.url}" - else - puts "; S3 store failed!" - end - end - rescue Errno::ENOENT => e - puts ": Skipping! File does not exist." - end + StoredFile.where("file_file_name IS NOT NULL").each do |stored_file| + push_to_s3(stored_file, stored_file.file_file_name.gsub(/#/, "-")) end end end
Include Journal attachments when migrating to S3
diff --git a/lib/tasks/update_timeframes.rake b/lib/tasks/update_timeframes.rake index abc1234..def5678 100644 --- a/lib/tasks/update_timeframes.rake +++ b/lib/tasks/update_timeframes.rake @@ -0,0 +1,9 @@+namespace :sensorstory do + desc "Update text_component timeframes (from and to hour)" + task :update_timeframes => :environment do + TextComponent.transaction do + TextComponent.where(from_hour: 18, to_hour: 23).update_all(to_hour: 0) + TextComponent.where(from_hour: 23, to_hour: 6).update_all(from_hour: 0) + end + end +end
Add rake task to change from and to hour in existing text components
diff --git a/cruise_config.rb b/cruise_config.rb index abc1234..def5678 100644 --- a/cruise_config.rb +++ b/cruise_config.rb @@ -1,4 +1,5 @@ Project.configure do |project| project.email_notifier.emails = ['scott@butlerpress.com'] project.build_command = "./script/cruise_build.rb #{project.name}" + project.triggered_by ChangeInLocalTrigger.new(project) end
Add cc.rb trigger for local part of repository
diff --git a/lib/conceptql/tree.rb b/lib/conceptql/tree.rb index abc1234..def5678 100644 --- a/lib/conceptql/tree.rb +++ b/lib/conceptql/tree.rb @@ -14,7 +14,6 @@ @behavior = opts.fetch(:behavior, nil) @defined = {} @temp_tables = {} - @opts = {} @scope = opts.fetch(:scope, Scope.new) end
Allow setting scope from Tree
diff --git a/lib/csv2api/server.rb b/lib/csv2api/server.rb index abc1234..def5678 100644 --- a/lib/csv2api/server.rb +++ b/lib/csv2api/server.rb @@ -14,25 +14,34 @@ end # Auto-creates endpoints from filenames - # @example - # If :files contains 'tasks.csv', it will generate an endpoint like: + # Endpoints will be reachable at depending on format # - # get '/tasks' do - # content_type :json - # # (obvious code omitted...) - # # (will only return the json version of csv) - # end + # JSON (the default): + # http://localhost:4567/tasks + # http://localhost:4567/tasks.json # - # Endpoint will be reachable at any of the following urls: - # http://localhost:4567/tasks or http://localhost:4567/tasks.json - # + # XML: + # http://localhost:4567/tasks.xml settings.files.each do |endpoint| get "/#{endpoint}.?:format?" do - content_type :json + csv_data = load_data(endpoint) - csv_file = load_csv(settings.csv_path, endpoint) - generate_json(CSV2API::Parser.new(csv_file).all) + if params[:format].eql?('xml') + content_type :xml + csv_data.to_xml(root: endpoint) + else + content_type :json + generate_json(csv_data) + end end + end + + # Loads data for response + # @param endpoint [String] endpoint name + # @return [Array<Hash>] csv data + def load_data(endpoint) + csv_file = load_csv(settings.csv_path, endpoint) + CSV2API::Parser.new(csv_file).all end end end
Add xml content_type response support Cleanup previous end-point generation block
diff --git a/lib/dry/types/enum.rb b/lib/dry/types/enum.rb index abc1234..def5678 100644 --- a/lib/dry/types/enum.rb +++ b/lib/dry/types/enum.rb @@ -13,13 +13,18 @@ # @return [Hash] attr_reader :mapping + # @return [Hash] + attr_reader :inverted_mapping + # @param [Type] type # @param [Hash] options # @option options [Array] :values def initialize(type, options) super @mapping = options.fetch(:mapping).freeze - @values = @mapping.keys.freeze.each(&:freeze) + @values = @mapping.keys.freeze + @inverted_mapping = @mapping.invert.freeze + freeze end # @param [Object] input @@ -28,14 +33,10 @@ value = if input.equal?(Undefined) type.call - elsif values.include?(input) + elsif mapping.key?(input) input - elsif mapping.key?(input) - mapping[input] - elsif mapping.values.include?(input) - mapping.key(input) else - input + inverted_mapping.fetch(input, input) end type[value]
Replace array search with hash lookup
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 @@ -5,6 +5,9 @@ require 'support/mocks' RSpec.configure do |config| + config.color_enabled = true + config.formatter = :documentation + config.before(:each) do # Pretend we're running as 'elba' $0 = "elba"
Enable color and format documentation in test
diff --git a/spec/support/vcr.rb b/spec/support/vcr.rb index abc1234..def5678 100644 --- a/spec/support/vcr.rb +++ b/spec/support/vcr.rb @@ -12,6 +12,7 @@ 'api-fake.knapsackpro.com', 'api-staging.knapsackpro.com', 'api.knapsackpro.dev', + 'api-disabled-for-fork.knapsackpro.com', ) end @@ -22,4 +23,5 @@ 'api-fake.knapsackpro.com', 'api-staging.knapsackpro.com', 'api.knapsackpro.dev', + 'api-disabled-for-fork.knapsackpro.com', ]) if defined?(WebMock)
Add missing url we test
diff --git a/spec/system_spec.rb b/spec/system_spec.rb index abc1234..def5678 100644 --- a/spec/system_spec.rb +++ b/spec/system_spec.rb @@ -0,0 +1,72 @@+require 'spec_helper' + +require 'observed/system' + +describe Observed::System do + subject { + described_class.new(the_config) + } + + context 'with reporters configured' do + + let(:the_config) { + s = stub('foo') + s.stubs(reporters: [reporter]) + s + } + + let(:reporter) { + s = stub('reporter') + s.stubs(match: true) + s + } + + let(:the_time) { + Time.now + } + + before { + Time.stubs(now: the_time) + } + + context 'when the time of a report is omitted' do + it 'complements the current time' do + reporter.expects(:report).with('the_tag', the_time, {data:1}) + subject.report('the_tag', {data:1}) + end + end + + end + + context 'with observers configured' do + + let(:observers) { + [observer] + } + + let(:observer) { + c = stub('observer') + c.stubs(tag: 'bar') + c + } + + let(:the_config) { + c = stub('config') + c.stubs(observers: observers) + c + } + + context 'when there is no matching observer for a tag' do + it 'fails to run' do + expect { subject.run('foo') }.to raise_error(/No configuration found for observation name 'foo'/) + end + end + + context 'when there is one or more observers matches the tag' do + it 'runs the observer' do + observer.expects(:observe).once + expect { subject.run('bar') }.to_not raise_error + end + end + end +end
Add the spec for Observed::System
diff --git a/lib/foreman/kicker.rb b/lib/foreman/kicker.rb index abc1234..def5678 100644 --- a/lib/foreman/kicker.rb +++ b/lib/foreman/kicker.rb @@ -20,7 +20,7 @@ end @watchdog = Foreman::Kicker::Watchdog.new - @watchdog.start(*args) + @watchdog.start(*args.map(&:to_s)) end def self.stop
Make sure to cast to string.
diff --git a/lib/js_assets/list.rb b/lib/js_assets/list.rb index abc1234..def5678 100644 --- a/lib/js_assets/list.rb +++ b/lib/js_assets/list.rb @@ -1,23 +1,27 @@ module JsAssets class List + class << self + attr_accessor :exclude, :allow + end @exclude = ['application.js'] - @allow = ['.eof'] + @allow = ['*.html'] def self.fetch - project_assets ={} - ::Rails.application.assets.each_logical_path(::Rails.application.config.assets.precompile) do |lp| - puts lp - next if matches_filter(@exclude, lp) - next unless matches_filter(@allow, lp) - project_assets[lp] = ::ApplicationController.helpers.asset_path(lp) + project_assets = {} + assets_filters = ::Rails.application.config.assets.precompile + ::Rails.application.assets.each_file do |filename| + if logical_path = ::Rails.application.assets.send(:logical_path_for_filename, filename, assets_filters) + next if matches_filter(@exclude, logical_path, filename) + next unless matches_filter(@allow, logical_path, filename) + project_assets[logical_path] = ::ApplicationController.helpers.asset_path(logical_path) + end end return project_assets end protected - # from # https://github.com/sstephenson/sprockets/blob/master/lib/sprockets/base.rb:418 - def matches_filter(filters, logical_path, filename) + def self.matches_filter(filters, logical_path, filename) return true if filters.empty? filters.any? do |filter| @@ -30,6 +34,7 @@ filter.call(logical_path, filename.to_s) end else + # puts filter File.fnmatch(filter.to_s, logical_path) end end
Add configurable variables for filter
diff --git a/lib/sneakers/tasks.rb b/lib/sneakers/tasks.rb index abc1234..def5678 100644 --- a/lib/sneakers/tasks.rb +++ b/lib/sneakers/tasks.rb @@ -26,8 +26,8 @@ EOF exit(1) end - - r = Sneakers::Runner.new(workers) + opts = (ENV['WORKER_COUNT'].present? ? {:workers => ENV['WORKER_COUNT'].to_i} : {}) + r = Sneakers::Runner.new(workers, opts) r.run end
Modify rake task to take worker count as ENV variable
diff --git a/lib/tasks/streak.rake b/lib/tasks/streak.rake index abc1234..def5678 100644 --- a/lib/tasks/streak.rake +++ b/lib/tasks/streak.rake @@ -12,4 +12,19 @@ puts JSON.pretty_generate(to_display) end + + desc "View the stages and their associated keys for a given pipeline. Use this to figure out the stage mappings for a pipeline." + task :debug_stages, [:pipeline_key] => :environment do |t, args| + p = StreakClient::Pipeline.find(args[:pipeline_key]) + + ordered_stages = [] + + p[:stage_order].each do |stage_key| + ordered_stages << p[:stages][stage_key.to_sym] + end + + ordered_stages.each do |stage| + puts "#{stage[:key]} -> #{stage[:name]}" + end + end end
Create task for viewing stages and stage keys
diff --git a/wwdc.gemspec b/wwdc.gemspec index abc1234..def5678 100644 --- a/wwdc.gemspec +++ b/wwdc.gemspec @@ -15,7 +15,7 @@ s.description = "A command-line interface for accessing WWDC session content" s.add_dependency "commander", "~> 4.1" - s.add_dependency "excon", "~> 0.25" + s.add_dependency "excon", ">= 0.71.0" s.add_development_dependency "rspec" s.add_development_dependency "rake"
Upgrade excon to version 0.71.0 or later
diff --git a/spec/features/registration_spec.rb b/spec/features/registration_spec.rb index abc1234..def5678 100644 --- a/spec/features/registration_spec.rb +++ b/spec/features/registration_spec.rb @@ -0,0 +1,28 @@+require 'spec_helper' + +describe 'Registration', :type => :feature, feature: true, js: true do + let(:email){ "sergey#{rnd}@makridenkov.com" } + + context 'when invalid data' do + it 'shows errors' do + # visit registration + # click on 'registration' + # I should see an errors + + visit '/registration' + click_on 'Registration' + + expect(page).to have_content("Email is required") + end + end + + context 'when valid data' do + it 'register an user' + # Given I am on registration page + # Wnen I fill the form + # And click on 'registration' + # Then I should be on login page + # And see message prease check email for password + # And I should get an Email + end +end
Make middleware definition less complex
diff --git a/spec/models/vagrant_driver_spec.rb b/spec/models/vagrant_driver_spec.rb index abc1234..def5678 100644 --- a/spec/models/vagrant_driver_spec.rb +++ b/spec/models/vagrant_driver_spec.rb @@ -12,9 +12,9 @@ end it 'should detect a single aws vm' do expect(@vms.size).to eq(1) - expect(@vms[0]).to eq( provider_name: vm.provider_name, + expect(@vms[0]).to eq(provider_name: vm.provider_name, provider_instance_id: vm.provider_instance_id, - role: vm.role ) + role: vm.role) end end @@ -24,9 +24,9 @@ end it 'should detect a single aws vm' do expect(@vms.size).to eq(1) - expect(@vms[0]).to eq( provider_name: vm.provider_name, + expect(@vms[0]).to eq(provider_name: vm.provider_name, provider_instance_id: vm.provider_instance_id, - role: vm.role ) + role: vm.role) end end end
Fix extra whitespace inside parentheses Rubocop rule: Layout/SpaceInsideParens: Space inside parentheses detected
diff --git a/spec/system/prefork_worker_spec.rb b/spec/system/prefork_worker_spec.rb index abc1234..def5678 100644 --- a/spec/system/prefork_worker_spec.rb +++ b/spec/system/prefork_worker_spec.rb @@ -0,0 +1,60 @@+require 'spec_helper_system' + +case node.facts['osfamily'] +when 'RedHat' + servicename = 'httpd' +when 'Debian' + servicename = 'apache2' +else + raise Error, "Unconfigured OS for apache service on #{node.facts['osfamily']}" +end + +describe 'apache::mod::worker class' do + describe 'running puppet code' do + # Using puppet_apply as a helper + it 'should work with no errors' do + pp = <<-EOS + class { 'apache': + mpm_module => 'worker', + } + EOS + + # Run it twice and test for idempotency + puppet_apply(pp) do |r| + r.exit_code.should_not == 1 + r.refresh + r.exit_code.should be_zero + end + end + end + + describe service(servicename) do + it { should be_running } + it { should be_enabled } + end +end + +describe 'apache::mod::prefork class' do + describe 'running puppet code' do + # Using puppet_apply as a helper + it 'should work with no errors' do + pp = <<-EOS + class { 'apache': + mpm_module => 'prefork', + } + EOS + + # Run it twice and test for idempotency + puppet_apply(pp) do |r| + r.exit_code.should_not == 1 + r.refresh + r.exit_code.should be_zero + end + end + end + + describe service(servicename) do + it { should be_running } + it { should be_enabled } + end +end
Add system tests for prefork / worker mpm module
diff --git a/config/god/app.rb b/config/god/app.rb index abc1234..def5678 100644 --- a/config/god/app.rb +++ b/config/god/app.rb @@ -2,8 +2,10 @@ SidekiqWorkers.configure do if ENV['RAILS_ENV']=='production' - # one worker for the hets queue - watch 'hets', 2 + # one worker per core + `nproc`.to_i.times.each do + watch 'hets', 1 + end # one worker for the default queue watch 'default', 5
Adjust the number of hets processes by the number of cpu cores.
diff --git a/Casks/sqlite-database-browser.rb b/Casks/sqlite-database-browser.rb index abc1234..def5678 100644 --- a/Casks/sqlite-database-browser.rb +++ b/Casks/sqlite-database-browser.rb @@ -1,8 +1,8 @@ class SqliteDatabaseBrowser < Cask - version '3.2.0' - sha256 '4f89640ffecf6e663554e07987dc6d555929f9e8c0db55b22824d7025fdc8b97' + version '3.3.1' + sha256 '0f326309c283a460b28f437d780e05bee8a40d6dc95a32e393f531493d3e8aff' - url "https://github.com/sqlitebrowser/sqlitebrowser/releases/download/sqlb-#{version}/sqlitebrowser-#{version}.dmg" + url "https://github.com/sqlitebrowser/sqlitebrowser/releases/download/v#{version}/sqlitebrowser-#{version}.dmg" homepage 'http://sqlitebrowser.org' link "sqlitebrowser.app"
Update Database Browser 3.3.1 for SQLite This new version reflects the project rename upstream
diff --git a/test/integration/add_to_list/inspec/add_to_list_spec.rb b/test/integration/add_to_list/inspec/add_to_list_spec.rb index abc1234..def5678 100644 --- a/test/integration/add_to_list/inspec/add_to_list_spec.rb +++ b/test/integration/add_to_list/inspec/add_to_list_spec.rb @@ -15,5 +15,5 @@ # Add to an empty list describe file('/tmp/dangerfile3') do - its(:content) { should match(%r{empty_delimited_list=("newentry")}) } + its(:content) { should match(%r{empty_delimited_list=\("newentry"\)}) } end
Fix matching "(" in tests
diff --git a/site-cookbooks/backup_restore/spec/recipes/fetch_s3_spec.rb b/site-cookbooks/backup_restore/spec/recipes/fetch_s3_spec.rb index abc1234..def5678 100644 --- a/site-cookbooks/backup_restore/spec/recipes/fetch_s3_spec.rb +++ b/site-cookbooks/backup_restore/spec/recipes/fetch_s3_spec.rb @@ -0,0 +1,34 @@+require_relative '../spec_helper' + +describe 'backup_restore::fetch_s3' do + let(:chef_run) do + runner = ChefSpec::Runner.new( + cookbook_path: %w(site-cookbooks cookbooks), + platform: 'centos', + version: '6.5' + )do |node| + node.set['backup_restore']['destinations']['s3'] = { + bucket: 's3bucket', + access_key_id: 'access_key_id', + secret_access_key: 'secret_access_key', + region: 'us-east-1', + prefix: '/backup' + } + node.set['backup_restore']['restore']['target_sources'] = ['mysql'] + end + runner.converge(described_recipe) + end + + tmp_dir = '/tmp/backup/restore' + backup_name = 'directory_full' + + it 'download backup files' do + allow(::File).to receive(:exist?).and_call_original + allow(::File).to receive(:exist?).with("#{tmp_dir}/#{backup_name}.tar").and_return(true) + expect_any_instance_of(Chef::Recipe).to receive(:`).and_return('s3://s3bucket/backup/directory_full/2014.10.01.00.00.00') + + expect(chef_run).to run_bash('download_backup_files').with( + code: "/usr/bin/s3cmd get -r 's3://s3bucket/backup/directory_full/2014.10.01.00.00.00' #{tmp_dir}" + ) + end +end
Add chef-spec for fetch_s3 recipe
diff --git a/chef/roles/vagrant.rb b/chef/roles/vagrant.rb index abc1234..def5678 100644 --- a/chef/roles/vagrant.rb +++ b/chef/roles/vagrant.rb @@ -3,7 +3,6 @@ run_list([ "recipe[vagrant_extras]", - "recipe[vagrant_extras::ssl_cert]", ]) default_attributes({
Remove no longer used recipe.
diff --git a/Casks/configure-application-dock-tile.rb b/Casks/configure-application-dock-tile.rb index abc1234..def5678 100644 --- a/Casks/configure-application-dock-tile.rb +++ b/Casks/configure-application-dock-tile.rb @@ -0,0 +1,12 @@+cask :v1 => 'configure-application-dock-tile' do + version '1.0' + sha256 '064f5c24ad7e26aa80c9c82b7c6049d96cd7396d53035fb4276fa638dc7d28c5' + + url "http://boredzo.org/cadt/Configure_Application_Dock_Tile-#{version}.zip" + name 'Configure Application Dock Tile' + name 'CADT' + homepage 'http://boredzo.org/cadt/' + license :gratis + + app "Configure Application Dock Tile #{version}/Configure Application Dock Tile.app" +end
Add Configure Application Dock Tile Use version string interpolation for app stanza
diff --git a/spec/controllers/api/v0/product_images_controller_spec.rb b/spec/controllers/api/v0/product_images_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/api/v0/product_images_controller_spec.rb +++ b/spec/controllers/api/v0/product_images_controller_spec.rb @@ -2,37 +2,37 @@ require 'spec_helper' -module Api - describe V0::ProductImagesController, type: :controller do - include AuthenticationHelper - include FileHelper - render_views +describe Api::V0::ProductImagesController, type: :controller do + include AuthenticationHelper + include FileHelper + render_views - describe "uploading an image" do - before do - allow(controller).to receive(:spree_current_user) { current_api_user } - end + describe "uploading an image" do + let(:image) { Rack::Test::UploadedFile.new(black_logo_file, 'image/png') } + let(:product_without_image) { create(:product) } + let(:product_with_image) { create(:product_with_image) } + let(:current_api_user) { create(:admin_user) } - let(:image) { Rack::Test::UploadedFile.new(black_logo_file, 'image/png') } - let!(:product_without_image) { create(:product) } - let!(:product_with_image) { create(:product_with_image) } - let(:current_api_user) { create(:admin_user) } + before do + allow(controller).to receive(:spree_current_user) { current_api_user } + end - it "saves a new image when none is present" do - post :update_product_image, xhr: true, - params: { product_id: product_without_image.id, file: image, use_route: :product_images } + it "saves a new image when none is present" do + post :update_product_image, xhr: true, params: { + product_id: product_without_image.id, file: image, use_route: :product_images + } - expect(response.status).to eq 201 - expect(product_without_image.images.first.id).to eq json_response['id'] - end + expect(response.status).to eq 201 + expect(product_without_image.images.first.id).to eq json_response['id'] + end - it "updates an existing product image" do - post :update_product_image, xhr: true, - params: { product_id: product_with_image.id, file: image, use_route: :product_images } + it "updates an existing product image" do + post :update_product_image, xhr: true, params: { + product_id: product_with_image.id, file: image, use_route: :product_images + } - expect(response.status).to eq 200 - expect(product_with_image.images.first.id).to eq json_response['id'] - end + expect(response.status).to eq 200 + expect(product_with_image.images.first.id).to eq json_response['id'] end end end
Increase readability of image controller spec Best viewed without whitespace changes. - Decrease indent. - Move `let` to top like in other specs. - Avoid `let!` to speed up the specs.
diff --git a/Casks/ubar.rb b/Casks/ubar.rb index abc1234..def5678 100644 --- a/Casks/ubar.rb +++ b/Casks/ubar.rb @@ -1,6 +1,6 @@ cask :v1 => 'ubar' do - version '2.5.0' - sha256 '0b5388a7bd599d48836e08b9138acc0c802aa86e65d6128f66e03a734eb2a823' + version '3.0.3' + sha256 '6e3d650aa0560e7f71c4e4b68f1fd175c1c76a9611fc7f2def7d0fe53ba383fc' url "http://www.brawersoftware.com/downloads/ubar/ubar#{version.delete('.')}.zip" appcast "http://brawersoftware.com/appcasts/feeds/ubar/ubar#{version.to_i}.xml",
Update uBar to version 3.0.3
diff --git a/spec/requests/report/update_spec.rb b/spec/requests/report/update_spec.rb index abc1234..def5678 100644 --- a/spec/requests/report/update_spec.rb +++ b/spec/requests/report/update_spec.rb @@ -0,0 +1,75 @@+describe 'POST /api/reports' do + let(:user) { create(:user) } + let!(:report) { create(:report) } + + def do_post + put "/api/reports/#{report.id}", params, header + end + + def json + @json ||= JSON.parse(response.body, symbolize_names: true) + end + + let(:header) do + { 'Accept' => nil, # Report API should return JSON by default. + 'Content-Type' => 'application/json' } + end + + context 'with valid params' do + let(:params) do + username = create(:user).username + attributes_for(:api_report).merge(username: username).to_json + end + + it 'does not create new report in database' do + expect { do_post }.to change(Report, :count).by(0) + end + + it 'returns HTTP status 201' do + do_post + expect(response.status).to eq 200 + end + + it 'returns JSON' do + do_post + expect(response.content_type).to be_json + end + + it 'returns report id' do + do_post + expect(json[:id]).to eq Report.last.id + expect(json[:pdf_url]).to eq api_report_url(Report.last, format: :pdf) + end + + it 'includes resource URL in location header' do + do_post + expect(response.location).to eq api_report_url(Report.last) + end + end + + context 'with invalid params' do + let(:params) do + attributes_for(:api_report).to_json + end + + it 'creates no report' do + expect { do_post }.to change(Report, :count).by(0) + end + + it 'returns HTTP status 422' do + do_post + expect(response.status).to eq 422 + end + + it 'returns JSON' do + do_post + expect(response.content_type).to be_json + end + + it 'returns array of errors' do + do_post + expect(json[:errors]).to be_present + expect(json[:errors]).to be_a(Array) + end + end +end
Add missing request spec for reports api.
diff --git a/spec/services/change_dealer_spec.rb b/spec/services/change_dealer_spec.rb index abc1234..def5678 100644 --- a/spec/services/change_dealer_spec.rb +++ b/spec/services/change_dealer_spec.rb @@ -0,0 +1,15 @@+require 'rails_helper' + +RSpec.describe ChangeDealer do + describe "#call" do + subject(:service) { ChangeDealer.new(game) } + + let(:game) { Game.create! } + + it "adds a DealerChanged event to the game" do + service.call + game.reload + expect(game.events.last).to be_instance_of DealerChanged + end + end +end
Add RSpec test for ChangeDealer
diff --git a/Formula/go.rb b/Formula/go.rb index abc1234..def5678 100644 --- a/Formula/go.rb +++ b/Formula/go.rb @@ -7,7 +7,7 @@ case when Hardware::CPU.intel? if Hardware::CPU.is_64_bit? - url "https://redirector.gvt1.com/edgedl/go/go1.9.2.linux-amd64.tar.gz" + url "https://dl.google.com/go/go1.9.2.linux-amd64.tar.gz" version "1.9.2" sha256 "de874549d9a8d8d8062be05808509c09a88a248e77ec14eb77453530829ac02b" end
Change download url of Go See [1], [2] and [3] for details. [1]: https://github.com/golang/tools/commit/9c477bae194915bfd4bc8c314e90e28b9ec1c831 [2]: https://go.googlesource.com/tools/+/9c477bae194915bfd4bc8c314e90e28b9ec1c831 [3]: https://github.com/golang/go/issues/22648
diff --git a/source/languages/retag/generate.rb b/source/languages/retag/generate.rb index abc1234..def5678 100644 --- a/source/languages/retag/generate.rb +++ b/source/languages/retag/generate.rb @@ -0,0 +1,41 @@+require_relative '../../../directory' +require_relative PathFor[:repo_helper] +require_relative PathFor[:textmate_tools] + +retag = Grammar.new( + name: "retag", + scope_name: "source.retag", +) + +retag[:$initial_context] = [ + :original +] + +retag[:original] = original = newPattern( + match: /new/.then( + match: /\s?pattern/, + tag_as: "entity.name.inner", + reference: "inner" + ).then( + match: /\s?test/, + reference: "bar" + ), + tag_as: "entity.name.outer" +) + +retag[:new] = original.reTag( + "entity.name.inner" => "entity.name.retagged", + "all" => true +) + +puts "Original" +p retag[:original] +p retag[:original].captures +p retag[:original].group_attributes +puts "" +puts "New" +p retag[:new] +p retag[:new].captures +p retag[:new].group_attributes + +saveGrammar(retag)
Fix bugs with retag, copy over top_level
diff --git a/lib/garage/docs/application.rb b/lib/garage/docs/application.rb index abc1234..def5678 100644 --- a/lib/garage/docs/application.rb +++ b/lib/garage/docs/application.rb @@ -26,11 +26,15 @@ attr_reader :pathname def self.renderer - @renderer ||= Redcarpet::Markdown.new(Redcarpet::Render::HTML.new(with_toc_data: true), fenced_code_blocks: true) + @renderer ||= Redcarpet::Markdown.new( + Redcarpet::Render::HTML.new(with_toc_data: true), + fenced_code_blocks: true, + no_intra_emphasis: true + ) end def self.toc_renderer - @toc_renderer ||= Redcarpet::Markdown.new(Redcarpet::Render::HTML_TOC) + @toc_renderer ||= Redcarpet::Markdown.new(Redcarpet::Render::HTML_TOC, no_intra_emphasis: true) end def initialize(pathname)
Change redcarpet option: disable emphasis
diff --git a/lib/gitlab/visibility_level.rb b/lib/gitlab/visibility_level.rb index abc1234..def5678 100644 --- a/lib/gitlab/visibility_level.rb +++ b/lib/gitlab/visibility_level.rb @@ -35,7 +35,11 @@ end def non_restricted_level?(level) - ! current_application_settings.restricted_visibility_levels.include?(level) + if current_application_settings.restricted_visibility_levels.nil? + true + else + ! current_application_settings.restricted_visibility_levels.include?(level) + end end def valid_level?(level)
Handle nil restricted visibility settings Return `true` from `non_restricted_level?` when the `restricted_visibility_levels` setting is nil.
diff --git a/spec/unit/generator/section_spec.rb b/spec/unit/generator/section_spec.rb index abc1234..def5678 100644 --- a/spec/unit/generator/section_spec.rb +++ b/spec/unit/generator/section_spec.rb @@ -0,0 +1,34 @@+# frozen_string_literal: true + +module GitHubChangelogGenerator + RSpec.describe Section do + let(:options) { {} } + subject(:section) { described_class.new(options) } + + describe "#encapsulate_string" do + let(:string) { "" } + + context "with the empty string" do + it "returns the string" do + expect(section.send(:encapsulate_string, string)).to eq string + end + end + + context "with a string with an escape-needing character in it" do + let(:string) { "<Inside> and outside" } + + it "returns the string escaped" do + expect(section.send(:encapsulate_string, string)).to eq '\\<Inside\\> and outside' + end + end + + context "with a backticked string with an escape-needing character in it" do + let(:string) { 'back `\` slash' } + + it "returns the string" do + expect(section.send(:encapsulate_string, string)).to eq 'back `\` slash' + end + end + end + end +end
Add a test for Section
diff --git a/mongoid-tree.gemspec b/mongoid-tree.gemspec index abc1234..def5678 100644 --- a/mongoid-tree.gemspec +++ b/mongoid-tree.gemspec @@ -12,7 +12,7 @@ s.files = Dir.glob('{lib,spec}/**/*') + %w(LICENSE README.md Rakefile Gemfile .rspec) - s.add_runtime_dependency('mongoid', ['<= 7.0', '>= 4.0']) + s.add_runtime_dependency('mongoid', ['>= 4.0', '< 8']) s.add_development_dependency('mongoid-compatibility') s.add_development_dependency('rake', ['>= 0.9.2']) s.add_development_dependency('rspec', ['~> 3.0'])
Allow minor versions of mongoid 7
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -32,7 +32,7 @@ @invited_beta = BetaInvite.where(invited: true).count @user_count = User.count - @anime_without_mal_id = Anime.where(mal_id: nil) + @anime_without_mal_id = Anime.where(mal_id: nil).reject {|x| x.genres.map(&:name).include? "Anime Influenced" } @hide_cover_image = true @hide_footer_ad = true
Exclude "Anime Influenced" from the missing MAL IDs list.
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -3,7 +3,7 @@ authorize_resource :class => false def show - @projects = Project.all + @projects = Project.order_by([[:vcs_url, :asc]]) @projects.each { |p| p.include_builds! } end end
Order the admin page by project name, so we can assume the same order each time.
diff --git a/app/controllers/chart_controller.rb b/app/controllers/chart_controller.rb index abc1234..def5678 100644 --- a/app/controllers/chart_controller.rb +++ b/app/controllers/chart_controller.rb @@ -15,9 +15,9 @@ log_index = 0 date_range.each do |date| - if(@logs[log_index].created_at == date) + if(log_index < @logs.length && @logs[log_index].created_at == date) @data.push @logs[log_index] - log_index++ + log_index += 1 else @data.push nil end
Fix errors with previous commit - ruby doesn't have ++ operator - @logs may have fewer items than date_range, so prevent index out of bounds
diff --git a/app/controllers/claim_controller.rb b/app/controllers/claim_controller.rb index abc1234..def5678 100644 --- a/app/controllers/claim_controller.rb +++ b/app/controllers/claim_controller.rb @@ -1,12 +1,18 @@+ class ClaimController < ApplicationController skip_before_filter :require_authorization def index if Mockr.unclaimed? && viewer.authenticated? + graph_data = ActiveSupport::JSON.decode( + open("http://graph.facebook.com/#{viewer.facebook_uid}").read) owner = User.create(:facebook_uid => viewer.facebook_uid, - :name => "Jacob") - flash[:notice] = "Congratulations #{owner.first_name}, you're now the proud owner of this brand new instance of Mockr!" + :name => graph_data['name']) + flash[:notice] = <<-EOS.squish + Congratulations #{owner.first_name}, you're now the proud owner of this + brand new instance of Mockr! + EOS redirect_to root_path else redirect_to new_session_path
Use OpenGraph to get new user's name in claim flow Instead of a "Lost" inspired default name, we utilize the Facebook OpenGraph JSON API to pull basic contact details based on a Facebook UID. Change-Id: I78ed6f37f34aad081ed2994bf406f7c37defffcb Reviewed-on: https://gerrit.causes.com/5113 Reviewed-by: Lann Martin <564fa7a717c51b612962ea128f146981a0e99d90@causes.com> Tested-by: Adam Derewecki <0e18f44c1fec03ec4083422cb58ba6a09ac4fb2a@causes.com>
diff --git a/test/integration/test_ber.rb b/test/integration/test_ber.rb index abc1234..def5678 100644 --- a/test/integration/test_ber.rb +++ b/test/integration/test_ber.rb @@ -0,0 +1,30 @@+require_relative '../test_helper' + +class TestBERIntegration < LDAPIntegrationTestCase + # Test whether the TRUE boolean value is encoded correctly by performing a + # search operation. + def test_true_ber_encoding + # request these attrs to simplify test; use symbols to match Entry#attribute_names + attrs = [:dn, :uid, :cn, :mail] + + assert types_entry = @ldap.search( + base: "dc=rubyldap,dc=com", + filter: "(uid=user1)", + size: 1, + attributes: attrs, + attributes_only: true + ).first + + # matches attributes we requested + assert_equal attrs, types_entry.attribute_names + + # assert values are empty + types_entry.each do |name, values| + next if name == :dn + assert values.empty? + end + + assert_includes Net::LDAP::ResultCodesSearchSuccess, + @ldap.get_operation_result.code, "should be a successful search operation" + end +end
Add BER integration test for true value
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -9,7 +9,7 @@ module YearInPicturesRailsHelper class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 5.1 + config.load_defaults 7.0 # Configuration for the application, engines, and railties goes here. #
Update Rails default settings from 5.1 to 7.0 Time for some more modern defaults. Specifically, updates CSRF defaults to solve deprecation warning.
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -17,7 +17,8 @@ # succès d'enregistrement et redirection users/:id. redirect_to @user else - byebug + @user.password = nil + @user.password_confirmation = nil render 'new' end end
Clean password and password_confirmation for case failure create user
diff --git a/test/test_helper.rb b/test/test_helper.rb index abc1234..def5678 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,5 +1,6 @@ require_relative "../load" require "minitest/autorun" +require "minitest/pride" require "webmock/minitest" require "mocha/mini_test"
Add some colours to the test output
diff --git a/test/models/category_test.rb b/test/models/category_test.rb index abc1234..def5678 100644 --- a/test/models/category_test.rb +++ b/test/models/category_test.rb @@ -1,7 +1,20 @@ require 'test_helper' class CategoryTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end + setup do + @category = categories(:arduino) + end + + test "Category should be valid" do + assert @category.valid? + end + + test "Category without a name should not be valid" do + @category.name = '' + assert_not @category.valid? + end + + test "Category's children should not be empty" do + assert_not @category.children.empty? + end end
Add tests for category model
diff --git a/lib/spontaneous/cli/migrate.rb b/lib/spontaneous/cli/migrate.rb index abc1234..def5678 100644 --- a/lib/spontaneous/cli/migrate.rb +++ b/lib/spontaneous/cli/migrate.rb @@ -10,11 +10,21 @@ desc :apply, "Runs Spontaneous migrations" def apply - prepare! :migrate + site = prepare! :migrate Sequel.extension :migration - say " >> Running migrations..." - Sequel::Migrator.apply(Spontaneous.database, ::Spontaneous.gem_dir('db/migrations')) - say " >> Done" + run_migrations(::Spontaneous.gem_dir, "Running Spontaneous migrations...") + run_migrations(site.root, "Running site migrations...", table: :schema_migrations_site) + end + + protected + + def run_migrations(dir, msg, opts = {}) + migration_dir = ::File.join(dir, 'db/migrations') + if ::File.directory?(migration_dir) + say " >> #{msg}" + Sequel::Migrator.run(Spontaneous.database, migration_dir, opts) + say " >> Done" + end end end # Migrate end # Spontaneous::Cli
Include site-specific migrations in standard task
diff --git a/config/environment.rb b/config/environment.rb index abc1234..def5678 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -4,6 +4,7 @@ # If no ROOT_URL is set, get one via socket require 'socket' ROOT_URL = ENV['ROOT_URL'] || Socket.gethostname +Rails.config.default_url_options.host = ROOT_URL # Initialize the Rails application. LinkOMatic::Application.initialize!
Add default host so mailer won't asplode
diff --git a/SSPPullToRefresh.podspec b/SSPPullToRefresh.podspec index abc1234..def5678 100644 --- a/SSPPullToRefresh.podspec +++ b/SSPPullToRefresh.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'SSPPullToRefresh' - s.version = '0.1.7' + s.version = '0.1.8' s.summary = 'General classes for "Pull-To-Refresh" concept customisation' s.description = <<-DESC
Update pod spec to 0.1.8
diff --git a/app/policies/article/post_policy.rb b/app/policies/article/post_policy.rb index abc1234..def5678 100644 --- a/app/policies/article/post_policy.rb +++ b/app/policies/article/post_policy.rb @@ -1,6 +1,8 @@ class Article::PostPolicy < ApplicationPolicy def create? - user.superuser? or user.article_columns.include?(record.column) + user.superuser? or + (record and user.article_columns.include?(record.column)) or + (user.article_columns.any? and not record) end def update?
Allow non-superusers to visit new posts page Fixes #62.
diff --git a/test/integration/binary/serverspec/localhost/binary_spec.rb b/test/integration/binary/serverspec/localhost/binary_spec.rb index abc1234..def5678 100644 --- a/test/integration/binary/serverspec/localhost/binary_spec.rb +++ b/test/integration/binary/serverspec/localhost/binary_spec.rb @@ -3,13 +3,6 @@ require 'spec_helper' describe 'kafka::binary' do - describe file('/opt/kafka/dist') do - it { should be_a_directory } - it { should be_mode 755 } - it { should be_owned_by('kafka') } - it { should be_grouped_into('kafka') } - end - describe file('/tmp/kitchen/cache/kafka_2.8.0-0.8.0.tar.gz') do it { should be_a_file } it { should be_mode 644 } @@ -21,4 +14,13 @@ it { should be_owned_by('kafka') } it { should be_grouped_into('kafka') } end + + %w(dist libs bin).each do |dir| do + describe file(dir) do + it { should be_a_directory } + it { should be_mode 755 } + it { should be_owned_by 'kafka' } + it { should be_grouped_into 'kafka' } + end + end end
Check additional directories in binary suite
diff --git a/lib/happy/collector.rb b/lib/happy/collector.rb index abc1234..def5678 100644 --- a/lib/happy/collector.rb +++ b/lib/happy/collector.rb @@ -7,7 +7,7 @@ end def taint_eop list - list.last[:eop] = true + list.last[:price_count] = list.size end def log_market_xrp_impl(base, counter)
Check the count of prices
diff --git a/activerecord/test/models/admin/user.rb b/activerecord/test/models/admin/user.rb index abc1234..def5678 100644 --- a/activerecord/test/models/admin/user.rb +++ b/activerecord/test/models/admin/user.rb @@ -14,7 +14,7 @@ end belongs_to :account - store :params, accessors: [ :color ], coder: YAML + store :params, accessors: [ :token ], coder: YAML store :settings, :accessors => [ :color, :homepage ] store_accessor :settings, :favorite_food store :preferences, :accessors => [ :remember_login ]
Remove warnings in test suite lib/active_record/store.rb:79: warning: method redefined; discarding old color= lib/active_record/store.rb:79: warning: previous definition of color= was here lib/active_record/store.rb:83: warning: method redefined; discarding old color lib/active_record/store.rb:83: warning: previous definition of color was here
diff --git a/app/admin/scholarship_application.rb b/app/admin/scholarship_application.rb index abc1234..def5678 100644 --- a/app/admin/scholarship_application.rb +++ b/app/admin/scholarship_application.rb @@ -4,12 +4,12 @@ selectable_column id_column - column 'Scholarship' do |scholarship_app| - scholarship_app.scholarship.name + column 'Scholarship' do |scholarship_id| + scholarship_id.scholarship.name end column 'User' do |user_id| - user_id.user.email + user_id.user.name end column :reason
Index displays associated names not ids
diff --git a/spec/api2_spec.rb b/spec/api2_spec.rb index abc1234..def5678 100644 --- a/spec/api2_spec.rb +++ b/spec/api2_spec.rb @@ -2,6 +2,7 @@ describe Cryptsy::API2::Client do subject { Cryptsy::API2::Client.new } + describe 'attributes' do it { is_expected.to respond_to(:user) } it { is_expected.to respond_to(:markets) } @@ -12,9 +13,34 @@ end end -# describe Cryptsy::API2::Currencies do -# subject { Cryptsy::API2::Currencies.new } -# describe '#list' do -# it { is_expected.to be(JSON) } -# end -# end +describe Cryptsy::API2::Currencies do + subject { Cryptsy::API2::Currencies.new } + + describe '#list' do + it 'returns non-empty JSON result' do + expect(subject.list.count).not_to eq 0 + end + end + + describe '#info' do + context 'with currency_id of "BTC"' do + it 'returns info with correct name' do + expect(subject.info('BTC')['name']).to eql "BitCoin" + end + it 'returns info with correct id' do + expect(subject.info('BTC')['id']).to eql "3" + end + end + end + + describe '#marketlist' do + context 'with currency_id of "BTC"' do + it 'returns info with correct id' do + expect(subject.marketlist('BTC')['id']).to eql "3" + end + it 'returns markets info' do + expect(subject.marketlist('BTC')['markets']).not_to eql nil + end + end + end +end
Add first tests for Currencies class
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index abc1234..def5678 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -9,7 +9,8 @@ if user.save redirect_to root_path else - redirect :back + flash[:now] = "We couldn't assign you to a building!" + render :inquire end end
Add an error message if the user cannot be assigned to a group.
diff --git a/app/navigations/common_navigation.rb b/app/navigations/common_navigation.rb index abc1234..def5678 100644 --- a/app/navigations/common_navigation.rb +++ b/app/navigations/common_navigation.rb @@ -2,7 +2,7 @@ SimpleNavigation::Configuration.run do |navigation| navigation.items do |primary| primary.dom_class = 'nav navbar-nav' - primary.item :nav, "<i class='icon icon-white icon-elective-blocks'></i> #{t(:label_elective_block_plural)}", 'ok' + primary.item :nav, "<i class='icon icon-white icon-elective-blocks'></i> #{t(:label_elective_block_plural)}", '' primary.item :nav, "<i class='icon icon-white icon-thesis-list'></i> #{t(:label_thesis_plural_official)}", diamond.theses_path if current_user primary.item :user_account, "<i class='icon icon-white icon-user'></i> #{current_user.verifable.surname_name}", main_app.user_path(current_user) do |primary|
Make elective blocks link empty (temporary) Change-Id: I4155302649760445c86c17e23a8a0ca19ed439a4
diff --git a/app/serializers/collection_serializer.rb b/app/serializers/collection_serializer.rb index abc1234..def5678 100644 --- a/app/serializers/collection_serializer.rb +++ b/app/serializers/collection_serializer.rb @@ -1,5 +1,5 @@ class CollectionSerializer < ActiveModel::Serializer - attributes :id, :label, :type + attributes :id, :label has_many :children @@ -7,7 +7,4 @@ object.children end - def type - 'collection' - end end
Fix collection api spec - remove used type from collection serializer
diff --git a/lib/billy/handlers/stub_handler.rb b/lib/billy/handlers/stub_handler.rb index abc1234..def5678 100644 --- a/lib/billy/handlers/stub_handler.rb +++ b/lib/billy/handlers/stub_handler.rb @@ -20,7 +20,7 @@ end def handles_request?(method, url, headers, body) - find_stub(method, url).nil? ? false : true + !find_stub(method, url).nil? end def reset @@ -28,9 +28,9 @@ end def stub(url, options = {}) - ret = ProxyRequestStub.new(url, options) - @stubs.unshift ret - ret + new_stub = ProxyRequestStub.new(url, options) + @stubs.unshift new_stub + new_stub end private
Update StubHandler per GitHub comments.
diff --git a/lib/neighborly/dashboard/engine.rb b/lib/neighborly/dashboard/engine.rb index abc1234..def5678 100644 --- a/lib/neighborly/dashboard/engine.rb +++ b/lib/neighborly/dashboard/engine.rb @@ -4,6 +4,7 @@ isolate_namespace Neighborly::Dashboard initializer 'neighborly.dashboard.assets.precompile' do |app| + app.config.assets.paths << Neighborly::Dashboard::Engine.root.join('vendor', 'assets', 'components') app.config.assets.precompile += %w(neighborly-dashboard-application.css neighborly-dashboard-libs.js neighborly-dashboard-application.js neighborly-dashboard-templates.js) end end
Add vendor/assets/components to assets path
diff --git a/lib/shipistrano/helpers/helpers.rb b/lib/shipistrano/helpers/helpers.rb index abc1234..def5678 100644 --- a/lib/shipistrano/helpers/helpers.rb +++ b/lib/shipistrano/helpers/helpers.rb @@ -42,4 +42,8 @@ def local_command_exists?(command) system("which #{ command} > /dev/null 2>&1") -end+end + +def current_time + Time.now.strftime("%Y-%m-%d-%H%M%S") +end
Move current time to generic helper
diff --git a/lib/strong_routes/rails/railtie.rb b/lib/strong_routes/rails/railtie.rb index abc1234..def5678 100644 --- a/lib/strong_routes/rails/railtie.rb +++ b/lib/strong_routes/rails/railtie.rb @@ -6,8 +6,8 @@ config.strong_routes = ::StrongRoutes.config initializer 'strong_routes.initialize' do |app| - config.allowed_routes ||= [] - config.allowed_routes += ::StrongRoutes::Rails::RouteMapper.map(app.routes) + config.strong_routes.allowed_routes ||= [] + config.strong_routes.allowed_routes += ::StrongRoutes::Rails::RouteMapper.map(app.routes) case when config.strong_routes.insert_before? then
Use correct config to specify allowed routes
diff --git a/lib/swift_storage/configuration.rb b/lib/swift_storage/configuration.rb index abc1234..def5678 100644 --- a/lib/swift_storage/configuration.rb +++ b/lib/swift_storage/configuration.rb @@ -4,7 +4,7 @@ :auth_method, :authtenant_type def initialize - @auth_version = ENV['SWIFT_STORAGE_AUTH_VERSION'] || '2.0' + @auth_version = ENV['SWIFT_STORAGE_AUTH_VERSION'] || '1.0' @tenant = ENV['SWIFT_STORAGE_TENANT'] @username = ENV['SWIFT_STORAGE_USERNAME'] @password = ENV['SWIFT_STORAGE_PASSWORD']
Switch back to auth 1.0 suppport for spec pass