diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/app/concerns/interval_validatable.rb b/app/concerns/interval_validatable.rb index abc1234..def5678 100644 --- a/app/concerns/interval_validatable.rb +++ b/app/concerns/interval_validatable.rb @@ -1,7 +1,7 @@ module IntervalValidatable extend ActiveSupport::Concern - INTERVALS = %w{Once Weekly Monthly Completion} + INTERVALS = %w{Once Weekly Monthly} included do validate :known_interval
Remove completion recurrence from bills
diff --git a/lib/middleman-s3_sync/commands.rb b/lib/middleman-s3_sync/commands.rb index abc1234..def5678 100644 --- a/lib/middleman-s3_sync/commands.rb +++ b/lib/middleman-s3_sync/commands.rb @@ -11,10 +11,14 @@ true end - desc "s3_sync", "Builds and push the minimum set of files needed to S3" + desc "s3_sync", "Pushes the minimum set of files needed to S3" option :force, type: :boolean, desc: "Push all local files to the server", aliases: :f + option :bucket, type: :string, + desc: "Specify which bucket to use, overrides the configured bucket.", + aliases: :b + def s3_sync shared_inst = ::Middleman::Application.server.inst bucket = shared_inst.options.bucket @@ -23,6 +27,7 @@ end shared_inst.options.force = options[:force] if options[:force] + shared_inst.options.bucket = options[:bucket] if options[:bucket] ::Middleman::S3Sync.sync end
Add a --bucket command line to allow configuring an alternate destination bucket. fixes #2.
diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb index abc1234..def5678 100644 --- a/app/controllers/forums_controller.rb +++ b/app/controllers/forums_controller.rb @@ -12,8 +12,4 @@ end end - def home_redirect - redirect_to path('/') - end - end
Delete useless home_redirect method from ForumsController.
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index abc1234..def5678 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -5,17 +5,26 @@ def show if @issue = Issue.find_by(id: params[:id]) - @category_name = @issue.categories.first.name + @category = @issue.categories + + if @category.empty? + @category_name = "Uncategorized" + else + @category_name = @category.first.name + end + @fixes = @issue.fixes @comments = @issue.issue_comments.map { |comment| comment.package_info } + @current_user_watching = false - if current_user.issues_watches.where(issue_id: @issue.id).size != 0 - @current_user_watching = true + if user_signed_in? + if current_user.issues_watches.where(issue_id: @issue.id).size != 0 + @current_user_watching = true + end + @current_user_id = current_user.id end - @current_user_id = current_user.id - p @current_user_id else redirect_to welcome_index_path
Add updates to current user and categories from team check-in morning meeting
diff --git a/app/controllers/listen_controller.rb b/app/controllers/listen_controller.rb index abc1234..def5678 100644 --- a/app/controllers/listen_controller.rb +++ b/app/controllers/listen_controller.rb @@ -2,21 +2,21 @@ layout false def redirect - @icy_metadata = request.env['HTTP_ICY_METADATA'] - stream_protocol = request.protocol # Returns 'https://' if this is an SSL request and 'http://' otherwise. + icy_metadata = request.env['HTTP_ICY_METADATA'] + request_protocol = request.protocol # Returns 'https://' if this is an SSL request and 'http://' otherwise. if $ICECAST_SERVER stream_server = $ICECAST_SERVER - elsif request.host != default_url_options.to_h[:host] || stream_protocol == 'https://' + elsif request.host != default_url_options.to_h[:host] stream_server = 'cdnstream.phate.io' - # elsif @icy_metadata.to_s == '1' || @useragent.to_s.downcase.include?('mobile') + # elsif icy_metadata.to_s == '1' || @useragent.to_s.downcase.include?('mobile') # stream_server = 'stream.dallas.phate.io' else stream_server = 'stream.phate.io' end query_string = request.query_string - location = "#{stream_protocol}#{stream_server}/phatecc" + location = "#{request_protocol}#{stream_server}/phatecc" location += '.mp3' if params[:format] == 'mp3' location += "?#{query_string}" if query_string.length > 0 redirect_to location
Revert "Use cdnstream.phate.io for https listener" This reverts commit 66c1a823dde4b96af0d9e57f20af0202fd1c96c4.
diff --git a/app/controllers/orders_controller.rb b/app/controllers/orders_controller.rb index abc1234..def5678 100644 --- a/app/controllers/orders_controller.rb +++ b/app/controllers/orders_controller.rb @@ -6,15 +6,21 @@ end def closed - @orders = current_user.closed_orders_with_access + Organization.unscoped do + @orders = current_user.closed_orders_with_access.to_a + end end def rejected - @orders = current_user.rejected_orders_with_access + Organization.unscoped do + @orders = current_user.rejected_orders_with_access.to_a + end end def canceled - @orders = current_user.canceled_orders_with_access + Organization.unscoped do + @orders = current_user.canceled_orders_with_access.to_a + end end def new
Allow loading orders with deleted organizations
diff --git a/lib/roxml/xml/parsers/nokogiri.rb b/lib/roxml/xml/parsers/nokogiri.rb index abc1234..def5678 100644 --- a/lib/roxml/xml/parsers/nokogiri.rb +++ b/lib/roxml/xml/parsers/nokogiri.rb @@ -32,6 +32,10 @@ def search(xpath) super("./#{xpath}") end + + def attributes + self + end end class Element
Fix attributes access for Nokogiri
diff --git a/lib/tasks/update_draw_status.rake b/lib/tasks/update_draw_status.rake index abc1234..def5678 100644 --- a/lib/tasks/update_draw_status.rake +++ b/lib/tasks/update_draw_status.rake @@ -0,0 +1,10 @@+task :update_status=> :environment do + pics = Pick.where(result: nil) + puts "results set" + pics.each do |pick| + pick.assign_draw_id + pick.setresult + pick.save + p pick + end +end
Add rake task to update pick status
diff --git a/environment.rb b/environment.rb index abc1234..def5678 100644 --- a/environment.rb +++ b/environment.rb @@ -14,4 +14,4 @@ require 'bridges/bridge.rb' -I18n.load_path += Dir[File.join(File.dirname(__FILE__), 'lib', 'active_scaffold', 'locale', '*.{rb,yml}')] +I18n.load_path.unshift *Dir[File.join(File.dirname(__FILE__), 'lib', 'active_scaffold', 'locale', '*.{rb,yml}')]
Allow override locale from app
diff --git a/lib/graphql/unauthorized_error.rb b/lib/graphql/unauthorized_error.rb index abc1234..def5678 100644 --- a/lib/graphql/unauthorized_error.rb +++ b/lib/graphql/unauthorized_error.rb @@ -22,7 +22,7 @@ @object = object @type = type @context = context - message ||= "An instance of #{object.class} failed #{type.name}'s authorization check" + message ||= "An instance of #{object.class} failed #{type.graphql_name}'s authorization check" super(message) end end
Use graphql_name rather than name when constructing the default error message
diff --git a/lib/lightspeed_restaurant/base.rb b/lib/lightspeed_restaurant/base.rb index abc1234..def5678 100644 --- a/lib/lightspeed_restaurant/base.rb +++ b/lib/lightspeed_restaurant/base.rb @@ -1,10 +1,21 @@ module LightspeedRestaurant class Base def initialize(data = {}) - data.each do |k, v| - v = nil if ['N/A', ''].include?(v) - send("#{k}=", v) + self.class.attributes.each do |attribute| + data = data.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + value = ['N/A', ''].include?(data[attribute]) ? nil : data[attribute] + send("#{attribute}=", value) end + end + + def to_hash + self.class.attributes.each_with_object({}) do |attribute, h| + h[attribute] = instance_variable_get("@#{attribute}") + end + end + + def to_json + to_hash.to_json end end end
Improve hash and json generator method
diff --git a/app/controllers/projects/clusters/applications_controller.rb b/app/controllers/projects/clusters/applications_controller.rb index abc1234..def5678 100644 --- a/app/controllers/projects/clusters/applications_controller.rb +++ b/app/controllers/projects/clusters/applications_controller.rb @@ -5,16 +5,17 @@ before_action :authorize_create_cluster!, only: [:create] def create - application = @application_class.find_or_create_by!(cluster: @cluster) + application = @application_class.find_or_initialize_by(cluster: @cluster) - if application.respond_to?(:hostname) - application.update(hostname: params[:hostname]) + if has_attribute?(:hostname) + application.hostname = params[:hostname] end if application.respond_to?(:oauth_application) application.oauth_application = create_oauth_application(application) - application.save end + + application.save! Clusters::Applications::ScheduleInstallationService.new(project, current_user).execute(application)
Refactor cluster app creation code in controller Signed-off-by: Dmitriy Zaporozhets <be23d75b156792e5acab51b196a2deb155d35d6a@gmail.com>
diff --git a/lib/human_date/parser.rb b/lib/human_date/parser.rb index abc1234..def5678 100644 --- a/lib/human_date/parser.rb +++ b/lib/human_date/parser.rb @@ -1,7 +1,7 @@ module HumanDate class Parser def initialize - Chronic.time_class = Time.zone + # Chronic.time_class = Time.zone end def parse(text)
Remove broken Chronic.time_class = Time.zone
diff --git a/lib/service_desk/configuration.rb b/lib/service_desk/configuration.rb index abc1234..def5678 100644 --- a/lib/service_desk/configuration.rb +++ b/lib/service_desk/configuration.rb @@ -1,5 +1,10 @@ class ServiceDesk::Configuration OPTIONS = [:client_id, :client_secret, :redirect_uri, :api_host, :authenticate_path, :token_storage, :refresh_token] + + def initialize + api_host "https://deskapi.gotoassist.com" + authenticate_path "/v2/authenticate/oauth2" + end OPTIONS.each do |option| define_method(option) do |value=nil|
Add some defaults to Configuration
diff --git a/lib/swift/playground/generator.rb b/lib/swift/playground/generator.rb index abc1234..def5678 100644 --- a/lib/swift/playground/generator.rb +++ b/lib/swift/playground/generator.rb @@ -19,7 +19,7 @@ html = section.inner_html playground.sections << DocumentationSection.new(html) when 'code' - code = section.xpath('./pre/code').inner_html + code = section.xpath('./pre/code').inner_text playground.sections << CodeSection.new(code) end end
Fix bug where swift code was being transformed into HTML entities.
diff --git a/lib/travis/build/job/configure.rb b/lib/travis/build/job/configure.rb index abc1234..def5678 100644 --- a/lib/travis/build/job/configure.rb +++ b/lib/travis/build/job/configure.rb @@ -30,7 +30,7 @@ parse(response.body) else # TODO log error - {} + { ".fetching_failed" => true } end end @@ -42,7 +42,7 @@ YAML.load(yaml) || {} rescue => e log_exception(e) - {} # TODO include '.invalid' => true here? + { ".parsing_failed" => true } end end end
Include ".parsing_failed" and ".fetching_failed" keys during configuration so that Hub can use this info
diff --git a/lib/lockfile/lockfile.rb b/lib/lockfile/lockfile.rb index abc1234..def5678 100644 --- a/lib/lockfile/lockfile.rb +++ b/lib/lockfile/lockfile.rb @@ -6,7 +6,7 @@ end def qualified_path - "#{@path}/#{@filename}" + File.join(@path, @filename) end def process_id
Use File.join over string interpolation.
diff --git a/app/models/genotype.rb b/app/models/genotype.rb index abc1234..def5678 100644 --- a/app/models/genotype.rb +++ b/app/models/genotype.rb @@ -10,7 +10,7 @@ before_post_process :is_image? validates_attachment :genotype, presence: true, - size: { in: 0..100.megabytes } + size: { in: 0..400.megabytes } do_not_validate_attachment_file_type :genotype def is_image?
Increase file limit to 400mb
diff --git a/chef-provisioning-docker.gemspec b/chef-provisioning-docker.gemspec index abc1234..def5678 100644 --- a/chef-provisioning-docker.gemspec +++ b/chef-provisioning-docker.gemspec @@ -15,6 +15,7 @@ s.add_dependency 'chef' s.add_dependency 'chef-provisioning', '~> 1.0' s.add_dependency 'docker-api' + s.add_dependency 'minitar' s.add_dependency 'sys-proctable' s.add_development_dependency 'rspec'
Add minitar as missing dependency.
diff --git a/lib/twterm/subscriber.rb b/lib/twterm/subscriber.rb index abc1234..def5678 100644 --- a/lib/twterm/subscriber.rb +++ b/lib/twterm/subscriber.rb @@ -6,7 +6,7 @@ cb = if callback.is_a?(Proc) callback elsif callback.is_a?(Symbol) - if self.respond_to?(callback) + if self.respond_to?(callback, true) self.method(callback) else callback.to_proc
Enable to subscribe events with private methods Specify true in the second argument of `respond_to?` method in order to check if the receiver has the method including private ones
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 @@ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) + +require 'coveralls' +Coveralls.wear! require 'crazipsum' require 'minitest/autorun' -require 'coveralls' -Coveralls.wear!
Fix coverall by moving Coveralls.wear on top Laboris verilog sunt powerscript dolore vhdl magna anim. Lustre ipsum dolore self voluptate incididunt mathematica. Occaecat cillum autolisp anim excepteur sed deserunt enim anim. Avenue lorem hypertalk id nulla ceylon dolor ad fantom simulink duis fugiat consectetur. Incididunt ml dolor labore objective-j id delphi sed consequat et clojure chill commodo monkey nostrud. Ut in nimrod velit voluptate magna culpa sunt dolor fugiat. Sint ooc proident rpg ut minim consequat incididunt do excepteur elit labore et. F# rexx laboris consectetur velit curl esse magna dolore irure. Googleappsscript ad groovy aute veniam elit max/msp pike. Ipsum mollit opencl ioke opl duis fugiat exercitation sint anim dolor. Dolor sunt sed proident do laboris ocaml excepteur labore dylan simulink. Magna sed ut dolore voluptate magic mumps aliquip. Nisi viml opencl nimrod commodo non informix-4gl in moto exercitation dolor icon nulla. Duis lorem proident io minim lpc cfml. Anim eiusmod modula-3 in pike laboris fantom j. Quis est mumps nulla elit eiffel clarion. Sqr exec culpa pariatur paradox natural sit sqr ut anim cillum id aliqua. Clean incididunt cfml ex bc logo velit.
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 @@ -11,11 +11,12 @@ RubygemFs.mock! Aws.config[:stub_responses] = true -I18n.locale = :en class ActiveSupport::TestCase include FactoryGirl::Syntax::Methods include GemHelpers + + setup { I18n.locale = :en } def page Capybara::Node::Simple.new(@response.body)
Move locale intialization to setup Setting it in test_helper as config didn't seem to work.
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 @@ -11,10 +11,10 @@ require 'camping-unabridged' end -require 'test/unit' +require 'minitest/autorun' require 'rack/test' -class TestCase < Test::Unit::TestCase +class TestCase < MiniTest::Unit::TestCase include Rack::Test::Methods def self.inherited(mod)
Make sure we're using MiniTest
diff --git a/filehandles/file_handle_monitor.rb b/filehandles/file_handle_monitor.rb index abc1234..def5678 100644 --- a/filehandles/file_handle_monitor.rb +++ b/filehandles/file_handle_monitor.rb @@ -0,0 +1,20 @@+class FileHandleMonitor < Scout::Plugin + OPTIONS=<<-EOS + EOS + + def build_report + report_hash={} + + # subtract one for header row + report_hash["Total Handles"] = shell("lsof -n | wc -l").to_i - 1 + report_hash["Network Handles"] = shell("lsof -n -i | wc -l").to_i - 1 + report_hash["Unix Handles"] = shell("lsof -n -U | wc -l").to_i - 1 + + report(report_hash) + end + + # Use this instead of backticks. It's a separate method so it can be stubbed for tests + def shell(cmd) + `#{cmd}` + end +end
Add a simple plugin to monitor open file handles
diff --git a/config/initializers/clearance.rb b/config/initializers/clearance.rb index abc1234..def5678 100644 --- a/config/initializers/clearance.rb +++ b/config/initializers/clearance.rb @@ -2,6 +2,6 @@ Clearance.configure do |config| config.mailer_sender = "donotreply@rubygems.org" config.secure_cookie = true - config.password_strategy = Clearance::PasswordStrategies::SHA1 + config.password_strategy = Clearance::PasswordStrategies::BCryptMigrationFromSHA1 end end
Switch password strategy to BCryptMigrationFromSHA1.
diff --git a/lib/dry/view/part.rb b/lib/dry/view/part.rb index abc1234..def5678 100644 --- a/lib/dry/view/part.rb +++ b/lib/dry/view/part.rb @@ -18,14 +18,14 @@ @_renderer = renderer end - def __render(partial_name, as: _name, **locals, &block) + def _render(partial_name, as: _name, **locals, &block) _renderer.render( - __partial(partial_name), - __render_scope(as, **locals), + _partial(partial_name), + _render_scope(as, **locals), &block ) end - alias_method :render, :__render + alias_method :render, :_render def to_s _value.to_s @@ -41,11 +41,11 @@ end end - def __partial(name) + def _partial(name) _renderer.lookup("_#{name}") end - def __render_scope(name, **locals) + def _render_scope(name, **locals) Scope.new( locals: locals.merge(name => self), context: _context,
Use single underscores for Part’s local methods This makes them consistent with the accessor naming
diff --git a/spec/integration/project_spec.rb b/spec/integration/project_spec.rb index abc1234..def5678 100644 --- a/spec/integration/project_spec.rb +++ b/spec/integration/project_spec.rb @@ -33,6 +33,7 @@ Dir.chdir('spec/fixtures/LibraryConsumerDemo') do `pod install 2>&1` `xcodebuild -workspace LibraryConsumer.xcworkspace -scheme LibraryConsumer 2>&1` + `xcodebuild -sdk iphonesimulator -workspace LibraryConsumer.xcworkspace -scheme LibraryConsumer 2>&1` end $?.exitstatus.should == 0
Test simulator build as well.
diff --git a/spec/lib/dbd/performance_spec.rb b/spec/lib/dbd/performance_spec.rb index abc1234..def5678 100644 --- a/spec/lib/dbd/performance_spec.rb +++ b/spec/lib/dbd/performance_spec.rb @@ -0,0 +1,38 @@+require 'spec_helper' + +module Dbd + describe "performance" do + + def new_subject + Fact.new_subject + end + + let(:provenance_fact_1) { Factories::ProvenanceFact.context(new_subject) } + + NUMBER_OF_FACTS = 1000 + + describe "1000 facts" do + it "reports and checks the used time" do + graph = Graph.new + graph << provenance_fact_1 + start = Time.now + NUMBER_OF_FACTS.times do |counter| + data_fact = Factories::Fact.data_fact(provenance_fact_1, new_subject) + graph << data_fact + end + duration = Time.now - start + puts "\nDuration for inserting #{NUMBER_OF_FACTS} facts in the in-memory graph was #{duration*1000} ms" + graph.size.should == NUMBER_OF_FACTS + 1 + duration.should < + # dramatic performance difference, not immediately found what is the cause + # creating new data_fact objects consumes 330 ms of the typ. 400 ms on JRuby + case RUBY_ENGINE + when "ruby" + 0.100 # 100 ms (typ. 30 ms on Mac Ruby 2.0.0) + when "jruby" + 1.000 # 1000 ms (typ. 400 ms on Mac jruby 1.7.3) + end + end + end + end +end
Add a first performance benchmark * On MRI 2.0.0 typically 30 ms for 1000 * "graph << (Fact.new(...))" * On JRuby 1.7.3 typically 400 ms for 1000 * "graph << (Fact.new(..))" Not immediately found the cause of the large discrepency. In Jruby, just creating the data_fact objects from the Factories seems to consume 330 ms (for the 1000 loops) of the 400 ms total.
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index abc1234..def5678 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -5,7 +5,6 @@ # Be sure to restart your server when you modify this file. -# Secure cookies only when not in development environment Rails.application.config.session_store :cookie_store, :key => '_test_session' # Use the database for sessions instead of the cookie-based default,
Remove comment about secure cookies (no longer true)
diff --git a/lib/kanagata/base.rb b/lib/kanagata/base.rb index abc1234..def5678 100644 --- a/lib/kanagata/base.rb +++ b/lib/kanagata/base.rb @@ -10,7 +10,7 @@ @pwd = File.expand_path('.') @templates = config['templates'] @attributes = config['attributes'] || {} - @templates_dir = config['templates_dir'].nil? ? File.join(File.dirname(expand_path), 'kanagata') : File.expand_path(config['templates_dir']) + @templates_dir = config.key?('templates_dir') ? File.expand_path(config['templates_dir']) : File.join(@pwd, 'kanagata') attributes.each do |value| k, v = value.split(':') @attributes[k] = v
Remove an undefined local variable
diff --git a/joiner.gemspec b/joiner.gemspec index abc1234..def5678 100644 --- a/joiner.gemspec +++ b/joiner.gemspec @@ -16,7 +16,7 @@ spec.add_runtime_dependency 'activerecord', '>= 5.2.beta1' spec.add_development_dependency 'combustion', '~> 0.8' - spec.add_development_dependency 'rails', '>= 5.2.0.rc2' + spec.add_development_dependency 'rails', '>= 5.2.0' spec.add_development_dependency 'rspec-rails', '~> 3' spec.add_development_dependency 'sqlite3', '~> 1.3.8' end
Update Rails dependency to >= 5.2.0.
diff --git a/lib/tasks/blank.rake b/lib/tasks/blank.rake index abc1234..def5678 100644 --- a/lib/tasks/blank.rake +++ b/lib/tasks/blank.rake @@ -9,7 +9,7 @@ end task :switch_to_app_gitignore do - `cp .new_app.gitignore .gitignore` + cp ".new_app.gitignore", ".gitignore" end task :session_config do
Use Rake's copy command instead of shelling out
diff --git a/lib/webpack/rails.rb b/lib/webpack/rails.rb index abc1234..def5678 100644 --- a/lib/webpack/rails.rb +++ b/lib/webpack/rails.rb @@ -3,7 +3,7 @@ module Webpack module Assets class Railtie < Rails::Railtie - config.after_initialize do + config.before_initialize do Webpack.config.use_server = Rails.env.development? Webpack.config.extract_css = !Rails.env.development? end
Set default configuration in before_initialize
diff --git a/url_extractor.gemspec b/url_extractor.gemspec index abc1234..def5678 100644 --- a/url_extractor.gemspec +++ b/url_extractor.gemspec @@ -4,8 +4,8 @@ Gem::Specification.new do |gem| gem.authors = ["Michael Guterl"] gem.email = ["michael@diminishing.org"] - gem.description = %q{TODO: Write a gem description} - gem.summary = %q{TODO: Write a gem summary} + gem.description = %q{A tool for extracting and replacing URLs from inside a block of text or HTML.} + gem.summary = %q{A tool for extracting and replacing URLs from inside a block of text or HTML.} gem.homepage = "" gem.files = `git ls-files`.split($\)
Remove TODO from gemspec to silence warnings
diff --git a/promisepay.gemspec b/promisepay.gemspec index abc1234..def5678 100644 --- a/promisepay.gemspec +++ b/promisepay.gemspec @@ -21,7 +21,7 @@ spec.required_ruby_version = '>= 1.9.3' spec.add_dependency 'faraday' - spec.add_dependency 'json' + spec.add_dependency 'json', '~> 1.8.3' spec.add_development_dependency 'bundler', '~> 1.7' spec.add_development_dependency 'rake', '~> 10.0' end
Fix json gem version in Gemspec in order to keep project compliant with ruby 1.9.3
diff --git a/qa/qa/page/base.rb b/qa/qa/page/base.rb index abc1234..def5678 100644 --- a/qa/qa/page/base.rb +++ b/qa/qa/page/base.rb @@ -5,7 +5,7 @@ include Scenario::Actable def refresh - visit current_path + visit current_url end end end
Fix QA page refresh address by using absolute URLs This makes QA page refresh address to be absolute URL since we dropped `Capybara.app_host`, thus there is no support for relative URLs with `visit` now.
diff --git a/recipes/default.rb b/recipes/default.rb index abc1234..def5678 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -12,7 +12,7 @@ template 'drone.conf' do source 'drone.conf.erb' - path "#{node['drone']['config_file']}" + path node['drone']['config_file'] mode 0644 owner 'root' group 'root'
Remove unecessary string interpolation, make Foodcritic happy.
diff --git a/recipes/default.rb b/recipes/default.rb index abc1234..def5678 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -20,7 +20,7 @@ chef_gem 'acme-client' do action :install - version '0.4.0' + version '0.6.2' compile_time true if respond_to?(:compile_time) end
Upgrade acme-client gem to v0.6.2
diff --git a/recipes/default.rb b/recipes/default.rb index abc1234..def5678 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -35,7 +35,14 @@ else service_name "ssh" end - supports :restart => true + supports value_for_platform( + "debian" => { "default" => [ :restart, :reload ] }, + "ubuntu" => { "default" => [ :restart, :reload ] }, + "centos" => { "default" => [ :restart, :reload, :status ] }, + "redhat" => { "default" => [ :restart, :reload, :status ] }, + "fedora" => { "default" => [ :restart, :reload, :status ] }, + "default" => { "default" => [:restart, :reload ] } + ) action [ :enable, :start ] end
COOK-202: Use status on supported platforms.
diff --git a/labels_spec.rb b/labels_spec.rb index abc1234..def5678 100644 --- a/labels_spec.rb +++ b/labels_spec.rb @@ -14,7 +14,7 @@ end describe "#[]" do - it "returns the pre at the given index" do + it "returns the label at the given index" do browser.labels[0].id.should == "first_label" end end
Correct element name in spec description
diff --git a/ruby-poker.gemspec b/ruby-poker.gemspec index abc1234..def5678 100644 --- a/ruby-poker.gemspec +++ b/ruby-poker.gemspec @@ -1,32 +1,32 @@-Gem::Specification.new do |s| +spec = Gem::Specification.new do |s| s.name = "ruby-poker" - s.version = "0.3.1" - s.date = "2009-01-24" + s.version = RUBYPOKER_VERSION + s.date = "2009-07-27" s.rubyforge_project = "rubypoker" s.platform = Gem::Platform::RUBY s.summary = "Poker library in Ruby" s.description = "Ruby library for comparing poker hands and determining the winner." s.author = "Rob Olson" - s.email = "rko618@gmail.com" + s.email = "rob@thinkingdigitally.com" s.homepage = "http://github.com/robolson/ruby-poker" s.has_rdoc = true s.files = ["CHANGELOG", - "examples/deck.rb", - "examples/quick_example.rb", - "lib/card.rb", - "lib/ruby-poker.rb", - "LICENSE", - "Rakefile", - "README.rdoc", - "ruby-poker.gemspec"] - s.test_files = ["test/test_card.rb", - "test/test_poker_hand.rb"] + "examples/deck.rb", + "examples/quick_example.rb", + "lib/ruby-poker.rb", + "lib/ruby-poker/card.rb", + "lib/ruby-poker/poker_hand.rb", + "LICENSE", + "Rakefile", + "README.rdoc", + "ruby-poker.gemspec"] + s.test_files = ["test/test_helper.rb", "test/test_card.rb", "test/test_poker_hand.rb"] s.require_paths << 'lib' - - s.extra_rdoc_files = ["README", "CHANGELOG", "LICENSE"] + + s.extra_rdoc_files = ["README.rdoc", "CHANGELOG", "LICENSE"] s.rdoc_options << '--title' << 'Ruby Poker Documentation' << '--main' << 'README.rdoc' << '--inline-source' << '-q' - - # s.add_dependency("thoughtbot-shoulda", ["> 2.0.0"]) + + s.add_development_dependency('thoughtbot-shoulda', '> 2.0.0') end
Update gemspec for 0.3.2 release
diff --git a/Casks/mapbox-studio.rb b/Casks/mapbox-studio.rb index abc1234..def5678 100644 --- a/Casks/mapbox-studio.rb +++ b/Casks/mapbox-studio.rb @@ -1,6 +1,6 @@ cask :v1 => 'mapbox-studio' do - version '0.3.1' - sha256 'ed5cb9ca0db8135caf2b82c30e3b58c4ad1689f7a3b6d05d7ecf82642c95e812' + version '0.3.2' + sha256 'e89a8f55d5f1073be99bb00c29988eb6b47c1f15ed874f80296e89831ed61dfa' # amazonaws.com is the official download host per the vendor homepage url "https://mapbox.s3.amazonaws.com/mapbox-studio/mapbox-studio-darwin-x64-v#{version}.zip"
Update Mapbox Studio version to 3.2
diff --git a/lionel.gemspec b/lionel.gemspec index abc1234..def5678 100644 --- a/lionel.gemspec +++ b/lionel.gemspec @@ -12,8 +12,8 @@ Engine gems are convenient for versioning and packaging static assets. Lionel lets you use assets packaged as Engines without depending on Rails. EOF gem.summary = %q{Use assets packaged as Engines without Rails} - gem.homepage = "" - gem.license = "MIT" + gem.homepage = "https://github.com/gkop/lionel" + gem.licenses = ["MIT", "BSD", "WTFPL"] gem.files = `git ls-files`.split($/) gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
Add homepage and license info
diff --git a/lib/spectrum/config/formatted_page_range_field.rb b/lib/spectrum/config/formatted_page_range_field.rb index abc1234..def5678 100644 --- a/lib/spectrum/config/formatted_page_range_field.rb +++ b/lib/spectrum/config/formatted_page_range_field.rb @@ -35,6 +35,7 @@ if end_page end_page end + end end end end
Fix a missing end tag
diff --git a/config/database_cleaner.rb b/config/database_cleaner.rb index abc1234..def5678 100644 --- a/config/database_cleaner.rb +++ b/config/database_cleaner.rb @@ -23,9 +23,11 @@ config.after(:each) do DatabaseCleaner.clean - # Remove repositories - dir = Rails.root.join("tmp","repositories") - dir.rmtree if dir.exist? + # Remove repositories and other data created in a test + %w(data test).each do |d| + dir = Rails.root.join('tmp', d) + dir.rmtree if dir.exist? + end end end end
Delete repositories and other data after a spec
diff --git a/mdl_ruleset.rb b/mdl_ruleset.rb index abc1234..def5678 100644 --- a/mdl_ruleset.rb +++ b/mdl_ruleset.rb @@ -5,3 +5,6 @@ # Set Ordered list item prefix to "ordered" (use 1. 2. 3. not 1. 1. 1.) rule 'MD029', :style => "ordered" + +# Exclude code block style +exclude_rule 'MD046'
Exclude code block style from Markdownlint The Python-Markdown parser includes support for fenced code blocks, but only at the root level of the document. Therefore, a code block nested in a list item must be an indented block. At the same time, MkDocs' code highlighting relies on the language identifier in fenced code blocks to avoid bad guesses. Given the above, we want to allow mixing both styles of code blocks and the way to allow that is to disable Markdown Lint [rule MD046](https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md#md046---code-block-style). This new rule was introduced in Markdownlint version [0.5.0](https://github.com/markdownlint/markdownlint/blob/master/CHANGELOG.md#v050) and is currently causing the [tests to fail](https://travis-ci.org/mkdocs/mkdocs/jobs/399711017). This was first discovered in #1526.
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,5 +1,7 @@ class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. + # include Authentication + protect_from_forgery with: :exception end
Comment out include Authentication line - awaiting user auth helpers
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 @@ -2,7 +2,7 @@ # # Check ActiveAdmin and DeviseAuthToken incompatibilities. # unless controller_name.include? 'admin' - ::Rails.logger.warn "DEBUG: #{request.nil? ? request.env['REQUEST_URI'] : 'none'}" + ::Rails.logger.warn "DEBUG: #{defined? request ? request.env['REQUEST_URI'] : 'none'}" # include DeviseTokenAuth::Concerns::SetUserByToken # # Prevent CSRF attacks by raising an exception. # # For APIs, you may want to use :null_session instead.
Change nil check to defined?
diff --git a/app/serializers/shipit/task_serializer.rb b/app/serializers/shipit/task_serializer.rb index abc1234..def5678 100644 --- a/app/serializers/shipit/task_serializer.rb +++ b/app/serializers/shipit/task_serializer.rb @@ -5,7 +5,7 @@ has_one :author has_one :revision, serializer: ShortCommitSerializer - attributes :id, :url, :html_url, :output_url, :type, :status, :updated_at, :created_at + attributes :id, :url, :html_url, :output_url, :type, :status, :action, :description, :updated_at, :created_at def revision object.until_commit @@ -26,5 +26,21 @@ def type :task end + + def action + object.definition.try!(:action) + end + + def include_action? + type == :task + end + + def description + object.definition.try!(:action) + end + + def include_description? + type == :task + end end end
Include action and description is Task payloads
diff --git a/event_store-client-http.gemspec b/event_store-client-http.gemspec index abc1234..def5678 100644 --- a/event_store-client-http.gemspec +++ b/event_store-client-http.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'event_store-client-http' - s.version = '0.4.0.1' + s.version = '0.4.0.2' s.summary = 'HTTP Client for EventStore' s.description = ' '
Package version is increased from 0.4.0.1 to 0.4.0.2
diff --git a/lib/quotes/entities/publication.rb b/lib/quotes/entities/publication.rb index abc1234..def5678 100644 --- a/lib/quotes/entities/publication.rb +++ b/lib/quotes/entities/publication.rb @@ -5,7 +5,7 @@ attr_reader :added_by, :uid def initialize(added_by, author, title, publisher, year, uid = nil) - validate(added_by, author, title, publisher, year) + validate!(added_by, author, title, publisher, year) @uid = uid @added_by = added_by @@ -28,7 +28,7 @@ end end - def validate(added_by, author, title, publisher, year) + def validate!(added_by, author, title, publisher, year) ['added_by', 'author', 'title', 'publisher', 'year'].each do |param_name| value = eval(param_name) reason = "#{param_name.capitalize} missing"
Add '!' to validate method in pub entity
diff --git a/spec/email_spec.rb b/spec/email_spec.rb index abc1234..def5678 100644 --- a/spec/email_spec.rb +++ b/spec/email_spec.rb @@ -2,20 +2,23 @@ describe Reparty::Email do describe "provides variables" do - let(:from) { "test@test.com" } - let(:subject) { "Test Subject" } - let(:title) { "Test Title" } + let(:klass) { subject.class } + + let(:from) { "test@test.com" } + let(:subj) { "Test Subject" } + let(:title) { "Test Title" } before do Reparty.config do |config| config.from = from - config.subject = subject + config.subject = subj config.title = title end end - it { from.should eq(from) } - it { subject.should eq(subject) } - it { title.should eq(title) } + it { klass.from.should eq(from) } + it { klass.subject.should eq(subj) } + it { klass.title.should eq(title) } + it { klass.reports.should be_empty } end end
Fix spec test (and cover reports) :+1:
diff --git a/IOSLinkedInAPI.podspec b/IOSLinkedInAPI.podspec index abc1234..def5678 100644 --- a/IOSLinkedInAPI.podspec +++ b/IOSLinkedInAPI.podspec @@ -5,7 +5,7 @@ s.summary = 'IOS LinkedIn API capable of accessing LinkedIn using oauth2. Using a UIWebView to fetch the authorization code.' s.homepage = 'https://github.com/jeyben/IOSLinkedInAPI' s.authors = { 'Jacob von Eyben' => 'jacobvoneyben@gmail.com', 'Eduardo Fonseca' => 'hello@eduardo-fonseca.com' } - s.source = { :git => 'https://github.com/jeyben/IOSLinkedInAPI.git', :tag => '1.0.0' } + s.source = { :git => 'https://github.com/ebfaed/IOSLinkedInAPI.git', :tag => '1.0.0' } s.source_files = 'IOSLinkedInAPI' s.requires_arc = true
Change for our custom repo
diff --git a/core/kernel/format_spec.rb b/core/kernel/format_spec.rb index abc1234..def5678 100644 --- a/core/kernel/format_spec.rb +++ b/core/kernel/format_spec.rb @@ -11,4 +11,20 @@ it "is accessible as a module function" do Kernel.format("%s", "hello").should == "hello" end + + it "formats string with precision" do + Kernel.format("%.3s", "hello").should == "hel" + Kernel.format("%-3.3s", "hello").should == "hel" + end + + describe "on multibyte strings" do + it "formats string with precision" do + Kernel.format("%.3s", "hello".encode('UTF-16LE')).should == "hel".encode('UTF-16LE') + end + + it "preserves encoding" do + str = format('%s', 'foobar'.encode('UTF-16LE')) + str.encoding.to_s.should == "UTF-16LE" + end + end end
Support precision when formatting string
diff --git a/config/initializers/mini_magick.rb b/config/initializers/mini_magick.rb index abc1234..def5678 100644 --- a/config/initializers/mini_magick.rb +++ b/config/initializers/mini_magick.rb @@ -2,4 +2,6 @@ MiniMagick.configure do |config| config.shell_api = "posix-spawn" + config.timeout = 300 + config.validate_on_create = false end
Enable a 300 second timeout for image magix conversion and disable initial validation pass
diff --git a/config/initializers/rack_attack.rb b/config/initializers/rack_attack.rb index abc1234..def5678 100644 --- a/config/initializers/rack_attack.rb +++ b/config/initializers/rack_attack.rb @@ -4,8 +4,8 @@ req.ip if req.path == '/admin/sign_in' && req.post? end -ActiveSupport::Notifications.subscribe('rack.attack') do |_name, _start, _finish, _request_id, req| +ActiveSupport::Notifications.subscribe('rack.attack') do |_name, _start, _finish, _request_id, payload| Rails.logger.tagged('Rack::Attack') do - Rails.logger.warn "Throttled #{req.env['rack.attack.match_discriminator']}" + Rails.logger.warn "Throttled #{payload[:request].env['rack.attack.match_discriminator']}" end end
Fix invalid variable for rack-attacker notifier
diff --git a/config/initializers/rails_admin.rb b/config/initializers/rails_admin.rb index abc1234..def5678 100644 --- a/config/initializers/rails_admin.rb +++ b/config/initializers/rails_admin.rb @@ -15,9 +15,6 @@ ### More at https://github.com/sferik/rails_admin/wiki/Base-configuration - config.included_models = %w(User TempUser Role Membership Project Transaction - Competition Membership) - config.actions do dashboard # mandatory index # mandatory @@ -29,4 +26,18 @@ delete show_in_app end + + config.included_models = %w(User TempUser Role Membership Project Transaction + Competition Membership) + + config.model 'User' do + edit do + field :email + field :password + field :first_name + field :last_name + field :bio, :text + field :profile_image_url + end + end end
Whitelist user fields in admin.
diff --git a/spec/chartroom/container_spec.rb b/spec/chartroom/container_spec.rb index abc1234..def5678 100644 --- a/spec/chartroom/container_spec.rb +++ b/spec/chartroom/container_spec.rb @@ -0,0 +1,95 @@+require "spec_helper" + +module Chartroom + describe Container do + let(:container) { described_class.new(double(info: info, json: json)) } + let(:info) { {} } + let(:json) { {} } + + describe "#id" do + let(:info) { { "id" => id } } + let(:id) { "12a324d4afc11e971cb86467681c0c94ff5bc0e946055ff92526bebee9477216" } + + it "should return id parameter" do + expect(container.id).to eq id + end + end + + describe "#short_id" do + let(:info) { { "id" => id } } + let(:id) { "12a324d4afc11e971cb86467681c0c94ff5bc0e946055ff92526bebee9477216" } + + it "should return id parameter" do + expect(container.short_id).to eq id[0..11] + end + end + + describe "#name" do + let(:json) { { "Name" => name } } + let(:name) { "/name" } + + it "should return name parameter" do + expect(container.name).to eq "name" + end + end + + describe "#image" do + let(:info) { { "Image" => image } } + let(:image) { "hoge:latest" } + + it "should return image parameter" do + expect(container.image).to eq image + end + end + + describe "#command" do + let(:info) { { "Command" => command } } + let(:command) { "./docker-entrypoint.sh" } + + it "should return command parameter" do + expect(container.command).to eq command + end + end + + describe "#links" do + let(:json) { { "HostConfig" => { "Links" => links } } } + + context "when container is linked to another container" do + let(:links) { ["/hoge:/fuga/hoge"] } + + it "should return links" do + expect(container.links).to be_a Array + expect(container.links[0]).to be_a Chartroom::Link + end + end + + context "when container is not linked" do + let(:links) { nil } + + it "should return empty Array" do + expect(container.links).to be_empty + end + end + end + + describe "#formatted_links" do + let(:json) { { "HostConfig" => { "Links" => links } } } + + context "when container is linked to another container" do + let(:links) { ["/hoge:/fuga/hoge"] } + + it "should return stringified links" do + expect(container.formatted_links).to eq "hoge:hoge" + end + end + + context "when container is not linked" do + let(:links) { nil } + + it "should return empty Array" do + expect(container.formatted_links).to eq "" + end + end + end + end +end
Add tests for instance methods of Chartroom::Container
diff --git a/spec/concepts/game_state_spec.rb b/spec/concepts/game_state_spec.rb index abc1234..def5678 100644 --- a/spec/concepts/game_state_spec.rb +++ b/spec/concepts/game_state_spec.rb @@ -25,5 +25,11 @@ expect(game_state.dealer).to be nil end end + + describe "hands" do + it "are all empty" do + expect(game_state.hands.values.flatten).to be_empty + end + end end end
Test that all hands are initially empty
diff --git a/spec/integration/decoder_spec.rb b/spec/integration/decoder_spec.rb index abc1234..def5678 100644 --- a/spec/integration/decoder_spec.rb +++ b/spec/integration/decoder_spec.rb @@ -29,7 +29,7 @@ expect(subject.words.map(&:word)).to eq(["<s>", "go", "forward", "ten", "meters", "</s>"]) expect(subject.words.map(&:start_frame)).to eq([608, 611, 623, 676, 712, 771]) - expect(subject.words.map(&:end_frame)).to eq([610, 622, 675, 711, 770, 821]) + expect(subject.words.map(&:end_frame)).to eq([610, 622, 675, 711, 770, 819]) end end end
Fix integration tests after decoding change in Sphinxbase: https://github.com/cmusphinx/sphinxbase/commit/b99073ee0febd102c517b1e6e3046cc0781bf8f7
diff --git a/spec/rspec/mocks/methods_spec.rb b/spec/rspec/mocks/methods_spec.rb index abc1234..def5678 100644 --- a/spec/rspec/mocks/methods_spec.rb +++ b/spec/rspec/mocks/methods_spec.rb @@ -0,0 +1,27 @@+require 'spec_helper' + +module RSpec + module Mocks + describe Methods, :if => (Method.method_defined?(:owner)) do + def methods_added_to_all_objects + some_object = Object.new + (some_object.methods + some_object.private_methods).select do |method| + some_object.method(method).owner == RSpec::Mocks::Methods + end.map(&:to_sym) + end + + it 'limits the number of methods that get added to all objects' do + # If really necessary, you can add to this list, but long term, + # we are hoping to cut down on the number of methods added to all objects + expect(methods_added_to_all_objects).to match_array([ + :__mock_proxy, :__remove_mock_proxy, :as_null_object, + :format_chain, :null_object?, :received_message?, + :rspec_reset, :rspec_verify, :should_not_receive, + :should_receive, :stub, :stub!, + :stub_chain, :unstub, :unstub! + ]) + end + end + end +end +
Add a spec that helps us limit the number of methods added to all objects.
diff --git a/store_hours.gemspec b/store_hours.gemspec index abc1234..def5678 100644 --- a/store_hours.gemspec +++ b/store_hours.gemspec @@ -10,7 +10,7 @@ gem.email = ["yanhaozhu@gmail.com"] gem.description = 'A small parser for store normal business hours' gem.summary = 'A small parser for store normal business hours' - gem.homepage = "" + gem.homepage = "https://github.com/luanzhu/store_hours" gem.files = `git ls-files`.split($/) gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
Update homepage for gem settings
diff --git a/spec/support/database_cleaner.rb b/spec/support/database_cleaner.rb index abc1234..def5678 100644 --- a/spec/support/database_cleaner.rb +++ b/spec/support/database_cleaner.rb @@ -0,0 +1,24 @@+require 'database_cleaner' + +RSpec.configure do |config| + + config.before(:suite) do + DatabaseCleaner.clean_with :truncation + end + + config.before do + DatabaseCleaner.strategy = :transaction + end + + config.before(:each, js: true) do + DatabaseCleaner.strategy = :truncation + end + + config.before do + DatabaseCleaner.start + end + + config.after do + DatabaseCleaner.clean + end +end
Configure database cleaner for feature specs
diff --git a/scripts/seo/update_static_html.rb b/scripts/seo/update_static_html.rb index abc1234..def5678 100644 --- a/scripts/seo/update_static_html.rb +++ b/scripts/seo/update_static_html.rb @@ -0,0 +1,15 @@+require "open-uri" + +# Useful script for updating all of the static html on the site (in normal circumstances this is not +# necessary because the static html is updated automatically) +def main + contents = URI.parse("http://hike.io/sitemap.xml").read + contents.scan(/<loc>(.*)<\/loc>/).each do |match| + url = match[0] + puts "updating static html for #{url}" + contents = URI.parse(url + "?_escaped_fragment_=").read + sleep 5 + end +end + +main()
Add script which updates static html of all pages.
diff --git a/spec/unit/generator/copy_resources_script_spec.rb b/spec/unit/generator/copy_resources_script_spec.rb index abc1234..def5678 100644 --- a/spec/unit/generator/copy_resources_script_spec.rb +++ b/spec/unit/generator/copy_resources_script_spec.rb @@ -17,5 +17,16 @@ generator_1.send(:script).should.not.include '--reference-external-strings-file' generator_2.send(:script).should.include '--reference-external-strings-file' end + + it 'adds configuration dependent resources with a call wrapped in an if statement' do + resources = { 'Debug' => %w(Lookout.framework) } + generator = Pod::Generator::CopyResourcesScript.new(resources, Platform.new(:ios, '6.0')) + script = generator.send(:script) + script.should.include <<-eos.strip_heredoc + if [[ "$CONFIGURATION" == "Debug" ]]; then + install_resource 'Lookout.framework' + fi + eos + end end end
[Spec] Add a more specifc unit test for configuration dependent resources
diff --git a/spec/controller_spec.rb b/spec/controller_spec.rb index abc1234..def5678 100644 --- a/spec/controller_spec.rb +++ b/spec/controller_spec.rb @@ -16,8 +16,10 @@ end class Record + attr_reader :saved + def save - + @saved = true end end @@ -30,7 +32,7 @@ include TestWizard def model - Record.new + @model ||= Record.new end protected @@ -55,5 +57,9 @@ it "redirects to the next step" do assert_redirected_to "/test/foo/1" end + + it "has updated the model" do + @controller.model.saved.must_equal true + end end end
Add test of update model
diff --git a/spec/active_record_spec_helper.rb b/spec/active_record_spec_helper.rb index abc1234..def5678 100644 --- a/spec/active_record_spec_helper.rb +++ b/spec/active_record_spec_helper.rb @@ -0,0 +1,14 @@+require 'active_record' +require 'yaml' + +connection_info = YAML.load_file('config/database.yml')['test'] +ActiveRecord::Base.establish_connection(connection_info) + +RSpec.configure do |config| + config.around do |example| + ActiveRecord::Base.transaction do + example.run + raise ActiveRecord::Rollback + end + end +end
Add active record spec helper
diff --git a/spec/features/validations_spec.rb b/spec/features/validations_spec.rb index abc1234..def5678 100644 --- a/spec/features/validations_spec.rb +++ b/spec/features/validations_spec.rb @@ -1,38 +1,34 @@ require 'rails_helper.rb' -feature 'Saving posts with invalid title' do - it "Doesn't save posts with more than 21 characters even with a valid title" do - visit 'posts/new' - # Should not get saved when title has more than 20 characters. - fill_in 'Title', with: "aaaaaaaaaaaaaaaaaaaaa" - # Should be able to save contents between 3 and 140 characters. - fill_in 'Content', with: "aaa" - click_button "Create Post" - visit 'posts' - page.should_not have_content "aaaaaaaaaaaaaaaaaaaaa" - end - it "Does save posts with vaild title and content" do - visit 'posts/new' - # valid title with 9 characters should be saved. - fill_in 'Title', with: "aaaaaaaaa" - # Valid content with 3 characters should get saved. - fill_in 'Content', with: "aaa" +feature 'Save valid posts only' do + def attempt_to_post_with (options={}) + options[:title] ||= "My valid post" + options[:content] ||= 'My valid post content' + visit '/posts/new' + fill_in 'Title', with: options[:title] + fill_in 'Content', with: options[:content] click_button "Create Post" visit '/posts' - # Checking the saved post (should be saved) - expect(page).to have_content "aaaaaaaaa" - expect(page).to have_content "aaa" + end + +char = 'a' + + it "Doesn't save posts with more than 21 characters " do + attempt_to_post_with title: (char * 22) + attempt_to_post_with content: (char * 15) + expect(page).not_to have_content (char * 22) + end + + it "Does save posts with vaild title and content" do + attempt_to_post_with title: (char *8) + attempt_to_post_with content: (char *25) + expect(page).to have_content (char *8) + expect(page).to have_content (char *8) end + + it "Doesn't save posts with 2 characters content" do + attempt_to_post_with title: (char *9) + attempt_to_post_with content: (char * 2) + expect(page).not_to have_content ("#{char}" *9) + end end -feature "Saving posts with invalid content" do - it "Doesn't save posts with invalid content even with valid title" do - visit '/posts/new' - # 4 character title is a valid. - fill_in 'Title', with: "aaaa" - # 1 character title is not valid. - fill_in 'Content', with: "a" - click_button "Create Post" - visit '/posts/' - page.should_not have_content "aaaa" - end -end
Simplify and improve the post validations spec- passing
diff --git a/spec/hadoop_hdfs_namenode_spec.rb b/spec/hadoop_hdfs_namenode_spec.rb index abc1234..def5678 100644 --- a/spec/hadoop_hdfs_namenode_spec.rb +++ b/spec/hadoop_hdfs_namenode_spec.rb @@ -25,7 +25,12 @@ end it 'creates hadoop-hdfs-namenode service resource, but does not run it' do + expect(chef_run).to_not disable_service('hadoop-hdfs-namenode') + expect(chef_run).to_not enable_service('hadoop-hdfs-namenode') + expect(chef_run).to_not reload_service('hadoop-hdfs-namenode') + expect(chef_run).to_not restart_service('hadoop-hdfs-namenode') expect(chef_run).to_not start_service('hadoop-hdfs-namenode') + expect(chef_run).to_not stop_service('hadoop-hdfs-namenode') end end end
Add more negative checks to hadoop_hdfs_namenode unit tests
diff --git a/spec/lib/frecon/base/bson_spec.rb b/spec/lib/frecon/base/bson_spec.rb index abc1234..def5678 100644 --- a/spec/lib/frecon/base/bson_spec.rb +++ b/spec/lib/frecon/base/bson_spec.rb @@ -2,6 +2,8 @@ describe BSON::ObjectId do describe "#as_json" do - it "takes no arguments and returns the string representation of the ID" + it "takes no arguments and returns the string representation of the ID" do + fail + end end end
Change spec from pending to failing to test Travis' response.
diff --git a/spec/requests/healthcheck_spec.rb b/spec/requests/healthcheck_spec.rb index abc1234..def5678 100644 --- a/spec/requests/healthcheck_spec.rb +++ b/spec/requests/healthcheck_spec.rb @@ -0,0 +1,8 @@+RSpec.describe "/healthcheck" do + it "returns database connection status" do + get "/healthcheck" + json = JSON.parse(response.body) + + expect(json["checks"]).to include("database_connectivity") + end +end
Add healthcheck database connection test
diff --git a/lib/bourbon.rb b/lib/bourbon.rb index abc1234..def5678 100644 --- a/lib/bourbon.rb +++ b/lib/bourbon.rb @@ -23,10 +23,6 @@ end else bourbon_path = File.expand_path("../../app/assets/stylesheets", __FILE__) - if ENV.has_key?("SASS_PATH") - ENV["SASS_PATH"] = ENV["SASS_PATH"] + File::PATH_SEPARATOR + bourbon_path - else - ENV["SASS_PATH"] = bourbon_path - end + ENV["SASS_PATH"] = [ENV["SASS_PATH"], bourbon_path].compact.join(File::PATH_SEPARATOR) end end
Use clean one-liner to set `SASS_PATH` environment variable.
diff --git a/lib/hatchet.rb b/lib/hatchet.rb index abc1234..def5678 100644 --- a/lib/hatchet.rb +++ b/lib/hatchet.rb @@ -31,4 +31,13 @@ raise "Attempting to find current branch name. Error: Cannot describe git: #{out}" unless $?.success? out end -end+ + if ENV["HATCHET_DEBUG_DEADLOCK"] + Thread.new do + loop do + sleep ENV["HATCHET_DEBUG_DEADLOCK"].to_f # seconds + Thread.list.each { |t| puts "=" * 80; puts t.backtrace } + end + end + end +end
Allow users to debug deadlock When set, an env var will spawn a background thread that sleeps for the given amount of time. At the end of that timeout period it will print the backtrace for all threads that are alive, this should point to the location where the code is frozen.
diff --git a/lib/migrate.rb b/lib/migrate.rb index abc1234..def5678 100644 --- a/lib/migrate.rb +++ b/lib/migrate.rb @@ -21,6 +21,12 @@ add_index :jobs, :path add_index :jobs, :status + + postgres = (ActiveRecord::Base.connection.adapter_name == 'PostgreSQL') + + ['started_at', 'cancelled_at', 'completed_at'].each do |field| + execute "CREATE INDEX IF NOT EXISTS jobs_#{field}_is_null ON jobs (#{field})" + (postgres ? " WHERE #{field} IS NULL" : '') + end end def self.down
Add indexes for date fields
diff --git a/lib/moltres.rb b/lib/moltres.rb index abc1234..def5678 100644 --- a/lib/moltres.rb +++ b/lib/moltres.rb @@ -3,6 +3,7 @@ module Moltres class Application def call(env) + `echo debug > debug.txt`; [ 200, { 'Content-Type' => 'text/html'}, ['Hello from Ruby on Moltres!']] end end
Add debug file on Application
diff --git a/lib/poi2csv.rb b/lib/poi2csv.rb index abc1234..def5678 100644 --- a/lib/poi2csv.rb +++ b/lib/poi2csv.rb @@ -4,6 +4,7 @@ module Poi2csv Poi2csvException = Class.new(StandardError) + SUPPORTED_EXTENSIONS = [:xls, :xlsx] def self.to_csv(input_file_path, output_folder_path, separator=nil, formating_convention=nil) args = [input_file_path, output_folder_path, separator, formating_convention].reject { |v| v.nil? }
Add a list of supported extensions
diff --git a/jekyll-theme-slate.gemspec b/jekyll-theme-slate.gemspec index abc1234..def5678 100644 --- a/jekyll-theme-slate.gemspec +++ b/jekyll-theme-slate.gemspec @@ -4,7 +4,7 @@ s.name = "jekyll-theme-slate" s.version = "0.0.1" s.authors = ["Please come forward"] - s.email = ["support@github.com"] + s.email = ["opensource+jekyll-theme-slate@github.com"] s.homepage = "https://github.com/pages-themes/slate" s.summary = "Slate is a theme for GitHub Pages"
Update contact email in Gemspec
diff --git a/libsyn.gemspec b/libsyn.gemspec index abc1234..def5678 100644 --- a/libsyn.gemspec +++ b/libsyn.gemspec @@ -7,10 +7,10 @@ spec.name = "libsyn" spec.version = Libsyn::VERSION spec.authors = ["Chris Hunt"] - spec.email = ["chrishunt@github.com"] + spec.email = ["c@chrishunt.co"] spec.summary = %q{TODO: Write a short summary. Required.} spec.description = %q{TODO: Write a longer description. Optional.} - spec.homepage = "" + spec.homepage = "https://github.com/chrishunt/libsyn" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0")
Add email and homepage to gemspec
diff --git a/core/config/initializers/konacha.rb b/core/config/initializers/konacha.rb index abc1234..def5678 100644 --- a/core/config/initializers/konacha.rb +++ b/core/config/initializers/konacha.rb @@ -1,4 +1,4 @@-puts "DEBUG line for CircleCI testing" +puts "DEBUG line for CircleCI: #{Rails.env}" if defined?(Konacha) require 'rspec' Konacha.configure do |config|
Include rails env in debug output
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 @@ -13,6 +13,7 @@ def munge_filename(opts) return if opts[:filename] test_name = Haml::Util.caller_info(caller[1])[2] + test_name.sub!(/^block in /, '') opts[:filename] = "#{test_name}_inline.sass" end
[Sass] Fix a few Ruby 1.9 test failures.
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 @@ -13,4 +13,8 @@ @dtp.close unless @dtp.nil? end + def test_nothing + assert(1) + end + end
Add dummy test to keep Ruby 1.8's test-unit happy.
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,3 +1,4 @@ require 'rubygems' require 'active_support' -require 'active_support/test_case'+require 'minitest/autorun' +require 'active_support/test_case'
Add autorunner to make tests runnable with rake.
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 @@ -17,7 +17,7 @@ ENV["SKYCRAWLERS_ENV"] = "test" ActiveRecord::Migration.verbose = false -ActiveRecord::Base.configurations = YAML.load_file("config/database.yml") +ActiveRecord::Base.configurations = YAML.load_file("test/fixtures/database.yml") ActiveRecord::Base.establish_connection(DaimonSkycrawlers.env.to_sym) DaimonSkycrawlers.configure do |config|
test: Use proper path for database.yml
diff --git a/test/test_models.rb b/test/test_models.rb index abc1234..def5678 100644 --- a/test/test_models.rb +++ b/test/test_models.rb @@ -9,8 +9,7 @@ class Setting < ActiveRecord::Base def_druthers :quest, :favourite_colour, :things, :hashish, :change - serialize :value, CustomSerialize - + def self.default_quest "to find the holy grail" end @@ -34,4 +33,6 @@ end end + serialize :value, CustomSerialize + end
Move serialize method so class id defined
diff --git a/test/govuk_component/analytics_meta_tags_test.rb b/test/govuk_component/analytics_meta_tags_test.rb index abc1234..def5678 100644 --- a/test/govuk_component/analytics_meta_tags_test.rb +++ b/test/govuk_component/analytics_meta_tags_test.rb @@ -0,0 +1,41 @@+require 'govuk_component_test_helper' + +class AnalyticsMetaTagsTestCase < ComponentTestCase + def component_name + "analytics_meta_tags" + end + + test "renders organisations in a meta tag with angle brackets" do + content_item = { + links: { + organisations: [{ analytics_identifier: "O1" }], + lead_organisations: [{ analytics_identifier: "L2" }], + supporting_organisations: [{ analytics_identifier: "S3" }], + worldwide_organisations: [{ analytics_identifier: "W4" }], + } + } + + render_component(content_item: content_item) + + assert_select "meta[name='govuk:analytics:organisations'][content='<O1><L2><S3><W4>']" + end + + test "renders world locations in a meta tag with angle brackets" do + content_item = { + links: { + world_locations: [ + { + analytics_identifier: "WL3" + }, + { + analytics_identifier: "WL123" + } + ] + } + } + + render_component(content_item: content_item) + + assert_select "meta[name='govuk:analytics:world-locations'][content='<WL3><WL123>']" + end +end
Add tests for analytics component
diff --git a/GameOfLife/oop/spec/cell_spec.rb b/GameOfLife/oop/spec/cell_spec.rb index abc1234..def5678 100644 --- a/GameOfLife/oop/spec/cell_spec.rb +++ b/GameOfLife/oop/spec/cell_spec.rb @@ -12,6 +12,18 @@ expect(Cell.new(State::Dead, []).state).to eq(State::Dead) end end + describe 'One neighbour' do + describe 'One dead neighbour' do + it "should stay dead" do + expect(Cell.new(State::Dead, [Cell.new(State::Dead, [])]).state).to eq(State::Dead) + end + end + describe 'One alive neighbour' do + it "should stay dead" do + expect(Cell.new(State::Dead, [Cell.new(State::Alive, [])]).state).to eq(State::Dead) + end + end + end end end end
Add rule 1 Cell's tests
diff --git a/lib/event_provider/base.rb b/lib/event_provider/base.rb index abc1234..def5678 100644 --- a/lib/event_provider/base.rb +++ b/lib/event_provider/base.rb @@ -37,7 +37,7 @@ alias_method :eql?, :== def hash - "#{@id}-#{provider}-#{@link}".hash + "#{id}-#{provider}-#{link}".hash end def <=>(other)
Use attr readers instead of instance variable directly.
diff --git a/lib/ext/sawyer/relation.rb b/lib/ext/sawyer/relation.rb index abc1234..def5678 100644 --- a/lib/ext/sawyer/relation.rb +++ b/lib/ext/sawyer/relation.rb @@ -2,7 +2,7 @@ module Patch def href(options=nil) - # see: octokit/octokit.rb#727 + # Temporary workaround for: https://github.com/octokit/octokit.rb/issues/727 name.to_s == "ssh" ? @href : super end end
Add proper link to issue
diff --git a/lib/hive/device/android.rb b/lib/hive/device/android.rb index abc1234..def5678 100644 --- a/lib/hive/device/android.rb +++ b/lib/hive/device/android.rb @@ -11,50 +11,8 @@ @model = config['model'].downcase.gsub(/\s/, '_') @brand = config['brand'].downcase.gsub(/\s/, '_') @os_version = config['os_version'] - - # TODO The setting of config['queues'] can be removed when DeviceDB - # is no longer being used - new_queues = calculate_queue_names - new_queues = new_queues | config['queues'] if config.has_key?('queues') - -# devicedb_ids = new_queues.map { |queue| find_or_create_queue(queue) } -# Hive.devicedb('Device').edit(@identity, { device_queue_ids: devicedb_ids }) - config['queues'] = new_queues - super end - - # Uses either DeviceAPI or DeviceDB to generate queue names for a device - # TODO Remove when DeviceDB is not being used any more - def calculate_queue_names - [ - "#{@queue_prefix}#{self.model}", - "#{@queue_prefix}#{self.brand}", - "#{@queue_prefix}android", - "#{@queue_prefix}android-#{self.os_version}", - "#{@queue_prefix}android-#{self.os_version}-#{self.model}" - ] - end - - private - -# def find_or_create_queue(name) -# queue = Hive.devicedb('Queue').find_by_name(name) -# -# return queue.first['id'] unless queue.empty? || queue.is_a?(Hash) -# -# queue = create_queue(name, "#{name} queue created by Hive Runner") -# queue['id'] unless queue.empty? -# end - -# def create_queue(name, description) -# queue_attributes = { -# name: name, -# description: description -# } -# -# Hive.devicedb('Queue').register(device_queue: queue_attributes) -# end end end end
Remove queue generation in device class
diff --git a/lib/nyaplot/charts/base.rb b/lib/nyaplot/charts/base.rb index abc1234..def5678 100644 --- a/lib/nyaplot/charts/base.rb +++ b/lib/nyaplot/charts/base.rb @@ -12,7 +12,7 @@ end end - attr_reader :glyphs, :deps + attr_reader :glyphs, :deps, :xdomain, :ydomain def initialize(**opts) @glyphs = [] @deps = []
Add reader for xdomain and ydomain of Charts
diff --git a/lib/pansophy/connection.rb b/lib/pansophy/connection.rb index abc1234..def5678 100644 --- a/lib/pansophy/connection.rb +++ b/lib/pansophy/connection.rb @@ -1,6 +1,7 @@ module Pansophy module Connection def self.aws + Excon.defaults[:ciphers] = 'DEFAULT' Fog::Storage.new( provider: 'AWS', aws_access_key_id: ENV['AWS_ACCESS_KEY_ID'],
Use the ruby default Cipher list for Excon
diff --git a/lib/stache/asset_helper.rb b/lib/stache/asset_helper.rb index abc1234..def5678 100644 --- a/lib/stache/asset_helper.rb +++ b/lib/stache/asset_helper.rb @@ -8,7 +8,11 @@ lookup_context.view_paths = [Stache.template_base_path] template_finder = lambda do |partial| - lookup_context.find(source, [], partial, [], { formats: [:html] }) + if ActionPack::VERSION::MAJOR == 3 && ActionPack::VERSION::MINOR < 2 + lookup_context.find(source, [], partial) + else # Rails 3.2 and higher + lookup_context.find(source, [], partial, [], { formats: [:html] }) + end end template = template_finder.call(true) rescue template_finder.call(false)
Support Rails 3.2 and < 3.2 in the lookup_context call.
diff --git a/lib/tasks/run_mailman.rake b/lib/tasks/run_mailman.rake index abc1234..def5678 100644 --- a/lib/tasks/run_mailman.rake +++ b/lib/tasks/run_mailman.rake @@ -9,9 +9,8 @@ puts 'pop3 config found' Mailman.config.pop3 = { server: AppSettings['email.pop3_server'], - #ssl: true, - # Use starttls instead of ssl (do not specify both) - #starttls: true, + ssl: AppSettings['email.pop3_security'] == 'ssl' ? true : false, + starttls: AppSettings['email.pop3_security'] == 'starttls' ? true : false, username: AppSettings['email.pop3_username'], password: AppSettings['email.pop3_password'] } @@ -22,9 +21,8 @@ Mailman.config.imap = { server: AppSettings['email.imap_server'], port: 993, # you usually don't need to set this, but it's there if you need to - #ssl: true, - # Use starttls instead of ssl (do not specify both) - starttls: true, + ssl: AppSettings['email.imap_security'] == 'ssl' ? true : false, + starttls: AppSettings['email.imap_security'] == 'starttls' ? true : false, username: AppSettings['email.imap_username'], password: AppSettings['email.imap_password'] }
Use settings in rake task
diff --git a/lib/tasks/task_runner.rake b/lib/tasks/task_runner.rake index abc1234..def5678 100644 --- a/lib/tasks/task_runner.rake +++ b/lib/tasks/task_runner.rake @@ -3,9 +3,15 @@ # Require the :client group from the Gemfile Bundler.require :client + # Point to local host in development mode, + # or heroku otherwise. + url = Rails.env.development? ? + "http://testables.dev" : + "http://testabl.es" + # Set up +Her+ with the default middleware, and point it # at `http://testables.dev`. - Her::API.setup :url => "http://testables.dev" do |faraday| + Her::API.setup :url => url do |faraday| faraday.request :url_encoded faraday.use Her::Middleware::DefaultParseJSON faraday.adapter Faraday.default_adapter
Switch service URL based on Rails environment.
diff --git a/lib/tire/model/indexing.rb b/lib/tire/model/indexing.rb index abc1234..def5678 100644 --- a/lib/tire/model/indexing.rb +++ b/lib/tire/model/indexing.rb @@ -17,6 +17,8 @@ end def indexes(name, options = {}, &block) + options[:type] ||= 'string' + if block_given? mapping[name] ||= { :type => 'object', :properties => {} } @_nested_mapping = name
[ACTIVEMODEL] Make mapping type optional and default to "string"
diff --git a/lib/traject/json_writer.rb b/lib/traject/json_writer.rb index abc1234..def5678 100644 --- a/lib/traject/json_writer.rb +++ b/lib/traject/json_writer.rb @@ -34,7 +34,7 @@ unless defined? @output_file @output_file = if settings["output_file"] - File.open(settings["output_file"]) + File.open(settings["output_file"], 'w:UTF-8') elsif settings["output_stream"] settings["output_stream"] else
Make JsonWriter actually open file for output in write mode
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,3 +1,10 @@ class ApplicationController < ActionController::Base protect_from_forgery + helper_method :current_user + + private + + def current_user + @current_user ||= User.find(session[:user_id]) if session[:user_id] + end end
Set the current user if available
diff --git a/test/export/test_mux.rb b/test/export/test_mux.rb index abc1234..def5678 100644 --- a/test/export/test_mux.rb +++ b/test/export/test_mux.rb @@ -0,0 +1,23 @@+require File.dirname(__FILE__) + '/../helper' + +class MuxTest < Test::Unit::TestCase + + def test_mux_replays + outs = (0..25).map do + o = flexmock + o.should_receive(:start_export).once.with(720, 576) + o.should_receive(:start_tracker_segment).once.with("FooT") + o.should_receive(:export_point).once.with(0, 45.0, 67.0, 0.3) + o.should_receive(:end_tracker_segment).once + o.should_receive(:end_export).once + o + end + + mux = Tracksperanto::Export::Mux.new(outs) + mux.start_export(720, 576) + mux.start_tracker_segment("FooT") + mux.export_point(0, 45.0, 67.0, 0.3) + mux.end_tracker_segment + mux.end_export + end +end
Add a test for the Mux exporter
diff --git a/test/pdf_helper_test.rb b/test/pdf_helper_test.rb index abc1234..def5678 100644 --- a/test/pdf_helper_test.rb +++ b/test/pdf_helper_test.rb @@ -21,6 +21,6 @@ options = @ac.send( :prerender_header_and_footer, :header => {:html => { :template => 'hf.html.erb'}}); assert !options[:header][:html].has_key?(:template) - assert_match /^file:\/\/.*wicked_pdf.*\.html/, options[:header][:html][:url] + assert_match /^file:\/\/.*wicked_header_pdf.*\.html/, options[:header][:html][:url] end end
Fix test checking for tempfile name
diff --git a/lib/authorize_if.rb b/lib/authorize_if.rb index abc1234..def5678 100644 --- a/lib/authorize_if.rb +++ b/lib/authorize_if.rb @@ -13,26 +13,20 @@ end def authorize(*args, &block) + rule_method_name = "authorize_#{action_name}?" + unless self.respond_to?(rule_method_name, true) - raise(MissingAuthorizationRuleError, missing_rule_error_msg) + msg = [ + "No authorization rule defined for action", + "#{controller_name}##{action_name}.", + "Please define method ##{rule_method_name} for", + self.class.name + ].join(' ') + + raise(MissingAuthorizationRuleError, msg) end authorize_if(self.send(rule_method_name, *args), &block) - end - - private - - def rule_method_name - "authorize_#{action_name}?" - end - - def missing_rule_error_msg - [ - "No authorization rule defined for action", - "#{controller_name}##{action_name}.", - "Please define method ##{rule_method_name} for", - self.class.name - ].join(' ') end end
Refactor `authorize` not to use any private methods. This is an included module. There shouldn't be any private methods included along with public ones. The names can easily clash with some other included modules.