diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/resources/annotation_event.rb b/resources/annotation_event.rb index abc1234..def5678 100644 --- a/resources/annotation_event.rb +++ b/resources/annotation_event.rb @@ -3,7 +3,7 @@ default_action :run attribute :message, :kind_of => String, :name_attribute => true -attribute :level, :kind_of => String, :default => 'INFO' +attribute :level, :kind_of => [Symbol, String], :default => :info attribute :annotated_by, :kind_of => [String, NilClass], :default => 'chef-client' attribute :instance_id, :kind_of => [String, NilClass], :default => node.key?('ec2') ? node[:ec2][:instance_id] : nil attribute :event_epoch, :kind_of => [String, NilClass], :default => nil
Use symbol or string in resource
diff --git a/lib/pinch_hitter/service/replay_ws.rb b/lib/pinch_hitter/service/replay_ws.rb index abc1234..def5678 100644 --- a/lib/pinch_hitter/service/replay_ws.rb +++ b/lib/pinch_hitter/service/replay_ws.rb @@ -20,17 +20,17 @@ post '/reset' do @@responses.reset - 200 + status 200 end post '/store/*' do store "/#{params[:splat].first}", request.body.read - 200 + status 200 end post '/store' do store request["endpoint"], request.body.read - 200 + status 200 end post '/respond' do
Add explicit call to status on sinatra return values
diff --git a/lib/qiita/markdown/filters/mention.rb b/lib/qiita/markdown/filters/mention.rb index abc1234..def5678 100644 --- a/lib/qiita/markdown/filters/mention.rb +++ b/lib/qiita/markdown/filters/mention.rb @@ -6,8 +6,6 @@ # # You can pass :allowed_usernames context to limit mentioned usernames. class Mention < HTML::Pipeline::MentionFilter - # Overrides HTML::Pipeline::MentionFilter's constant. - # Allows "_" instead of "-" in username pattern. MentionPattern = / (?:^|\W) @((?>[\w][\w-]{1,30}\w(?:@github)?))
Remove wrong comment lines for MentionPattern
diff --git a/lib/amazing/config/dsl.rb b/lib/amazing/config/dsl.rb index abc1234..def5678 100644 --- a/lib/amazing/config/dsl.rb +++ b/lib/amazing/config/dsl.rb @@ -8,8 +8,11 @@ def initialize(config=nil, &block) @awesome_statusbars = [] - @relative_path = File.dirname(config) - import(config) + if config + config = File.expand_path(config) + @relative_path = File.dirname(config) + import(config) + end import(&block) end
Fix issue with loading DSL configs by relative path
diff --git a/core/thread/terminate_spec.rb b/core/thread/terminate_spec.rb index abc1234..def5678 100644 --- a/core/thread/terminate_spec.rb +++ b/core/thread/terminate_spec.rb @@ -5,7 +5,3 @@ describe "Thread#terminate" do it_behaves_like :thread_exit, :terminate end - -describe "Thread#terminate!" do - it "needs to be reviewed for spec completeness" -end
Remove spec of non-existing method
diff --git a/lib/whitehall/decorators/decorator.rb b/lib/whitehall/decorators/decorator.rb index abc1234..def5678 100644 --- a/lib/whitehall/decorators/decorator.rb +++ b/lib/whitehall/decorators/decorator.rb @@ -10,8 +10,24 @@ methods = model_classes.map { |mc| mc.instance_methods }.flatten.uniq methods -= Object.instance_methods + # methods added by rails to object that we probably do want to + # delegate .. shame these aren't collected somewhere that makes + # them easy to detect + methods += [:to_param, :to_query, :try, :with_options, :to_json, + :instance_values, :instance_variable_names, :in?, + :duplicable?, :nil?, :blank?, :present?, :presence] delegate *methods, delegate_options + end + + def ==(other) + if other.respond_to? :model + model == other.model + elsif other.respond_to? :to_model + model == other.to_model + else + model == other + end end end end
Add more methods to the list we delegate Specifically all those helpful methods like .blank? etc that we get from rails. Maybe we should just delegate everything we haven't specifically overridden ourselves. That might be better?
diff --git a/resources/config.rb b/resources/config.rb index abc1234..def5678 100644 --- a/resources/config.rb +++ b/resources/config.rb @@ -23,7 +23,7 @@ property :config, Hash, required: true action :create do - require 'toml-rb' + require 'toml' file path do content TOML.dump(config)
Fix require of toml-rb gem
diff --git a/config/initializers/secure_headers.rb b/config/initializers/secure_headers.rb index abc1234..def5678 100644 --- a/config/initializers/secure_headers.rb +++ b/config/initializers/secure_headers.rb @@ -6,7 +6,7 @@ '.global.ssl.fastly.net' normal_src += [fastly_alternate] end - config.hsts = "max-age=#{20.years.to_i}" + config.hsts = 'max-age=#{20.years.to_i}; includeSubdomains; preload' config.x_frame_options = 'DENY' config.x_content_type_options = 'nosniff' config.x_xss_protection = '1; mode=block'
Extend HSTS header (preload and cover subdomains) Signed-off-by: David A. Wheeler <9ae72d22d8b894b865a7a496af4fab6320e6abb2@dwheeler.com>
diff --git a/lib/exercism/use_cases/updates_user_exercise.rb b/lib/exercism/use_cases/updates_user_exercise.rb index abc1234..def5678 100644 --- a/lib/exercism/use_cases/updates_user_exercise.rb +++ b/lib/exercism/use_cases/updates_user_exercise.rb @@ -21,6 +21,7 @@ exercise.is_nitpicker = true exercise.iteration_count = submissions.count exercise.archived = exercise.state == 'done' + exercise.last_iteration_at = latest.created_at exercise.save submissions.each do |s|
Write last iteration timestamp on each attempt
diff --git a/lib/custom_field_patch.rb b/lib/custom_field_patch.rb index abc1234..def5678 100644 --- a/lib/custom_field_patch.rb +++ b/lib/custom_field_patch.rb @@ -33,7 +33,3 @@ end end end - -DefaultCustomQuery::ProjectPatch.tap do |mod| - Project.send :include, mod unless Project.include?(mod) -end
Remove unnecessary dependency on DefaultCustomQuery plugin
diff --git a/rs-forklift.gemspec b/rs-forklift.gemspec index abc1234..def5678 100644 --- a/rs-forklift.gemspec +++ b/rs-forklift.gemspec @@ -24,5 +24,6 @@ spec.add_development_dependency('aruba') spec.add_development_dependency('rake', '~> 0.9.2') spec.add_dependency('methadone', '~> 1.3.0') + spec.add_dependency "bundler", "~> 1.3" spec.add_dependency('rest_connection') end
Add bundler as dep to gemspec.
diff --git a/ruby/space-age/space_age.rb b/ruby/space-age/space_age.rb index abc1234..def5678 100644 --- a/ruby/space-age/space_age.rb +++ b/ruby/space-age/space_age.rb @@ -1,15 +1,14 @@ class SpaceAge - SECONDS_IN_YEAR = 31557600.0 ORBITAL_PERIODS = { - 'mercury' => 0.2408467, - 'venus' => 0.61519726, - 'earth' => 1, - 'mars' => 1.8808158, - 'jupiter' => 11.862615, - 'saturn' => 29.447498, - 'uranus' => 84.016846, - 'neptune' => 164.79132 + 'mercury' => 7600530.24, + 'venus' => 19413907.2, + 'earth' => 31558149.76, + 'mars' => 59354294.4, + 'jupiter' => 374335776.0, + 'saturn' => 929596608.0, + 'uranus' => 2661041808.0, + 'neptune' => 5200418592.0 } attr_reader :seconds @@ -17,12 +16,8 @@ @seconds = seconds end - def to_earth - seconds / SECONDS_IN_YEAR - end - def on_planet(planet) - (to_earth / ORBITAL_PERIODS[planet]).round(2) + (seconds / ORBITAL_PERIODS[planet]).round(2) end ORBITAL_PERIODS.keys.each do |planet|
Convert old orbital periods to relative earth periods
diff --git a/lib/smart_answer/calculators/arrested_abroad.rb b/lib/smart_answer/calculators/arrested_abroad.rb index abc1234..def5678 100644 --- a/lib/smart_answer/calculators/arrested_abroad.rb +++ b/lib/smart_answer/calculators/arrested_abroad.rb @@ -5,10 +5,6 @@ def initialize @data = self.class.prisoner_packs - end - - def no_prisoner_packs - %w() end def generate_url_for_download(country, field, text) @@ -28,7 +24,5 @@ def self.prisoner_packs @prisoner_packs ||= YAML::load_file(Rails.root.join("lib", "data", "prisoner_packs.yml")) end - - end end
Remove no_prisoner_packs method - now obsolete
diff --git a/db/migrate/20100920141223_update_menu_impersonate_revert.rb b/db/migrate/20100920141223_update_menu_impersonate_revert.rb index abc1234..def5678 100644 --- a/db/migrate/20100920141223_update_menu_impersonate_revert.rb +++ b/db/migrate/20100920141223_update_menu_impersonate_revert.rb @@ -0,0 +1,16 @@+class UpdateMenuImpersonateRevert < ActiveRecord::Migration + def self.up + permission = Permission.find_by_name("do assignments") + + site_controller = SiteController.find_by_name("impersonate") + action = ControllerAction.find(:first, :conditions => ['name = "restore" and site_controller_id = ?',site_controller.id]) + action.name = "impersonate" + action.permission_id = permission.id + action.save + + Role.rebuild_cache + end + + def self.down + end +end
Correct revision so that it works when a user is impersonated git-svn-id: f67d969b640da65cb7bc1d229e09fd6d2db44ae1@755 392d7b7b-3f31-0410-9dc3-c95a9635ea79
diff --git a/spec/features/submission_views_spec.rb b/spec/features/submission_views_spec.rb index abc1234..def5678 100644 --- a/spec/features/submission_views_spec.rb +++ b/spec/features/submission_views_spec.rb @@ -0,0 +1,37 @@+include Warden::Test::Helpers +Warden.test_mode! + +describe "testing submissions views:" do + + let!(:user) { FactoryGirl.create(:user) } + let!(:submission_to_rate) { FactoryGirl.create(:submission, full_name: "Applicant To Rate") } + let!(:submissions_rated) { FactoryGirl.create(:submission, :with_rates, full_name: "Applicant Rated") } + let!(:submission_rejected) { FactoryGirl.create(:submission, rejected: true, full_name: "Applicant Rejected") } + + + it "moves to to_rate view" do + login_as(user, scope: :user) + visit submissions_path + click_link "To rate" + expect(current_path).to eq submissions_to_rate_path + expect(page).to have_selector('td', text: "Applicant To Rate") + end + + it "moves to rated view" do + login_as(user, scope: :user) + visit submissions_path + click_link "Rated" + expect(current_path).to eq submissions_rated_path + expect(page).to have_selector('td', text: "Applicant Rated") + end + + it "moves to rejected view" do + login_as(user, scope: :user) + visit submissions_path + click_link "Rejected" + expect(current_path).to eq submissions_rejected_path + expect(page).to have_selector('td', text: "Applicant Rejected") + end +end + +Warden.test_reset!
Add submission views feature spec
diff --git a/app/controllers/application.rb b/app/controllers/application.rb index abc1234..def5678 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -22,6 +22,6 @@ end def timezone - TZInfo::Timezone.get("America/Montreal") + TZInfo::Timezone.get("America/New_York") end end
Use America/New_York instead of America/Montreal for TZ info.
diff --git a/app/mailers/comments_mailer.rb b/app/mailers/comments_mailer.rb index abc1234..def5678 100644 --- a/app/mailers/comments_mailer.rb +++ b/app/mailers/comments_mailer.rb @@ -1,11 +1,11 @@ # Copyright 2011-2017, The Trustees of Indiana University and Northwestern # University. Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. -# +# # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software distributed # under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR # CONDITIONS OF ANY KIND, either express or implied. See the License for the @@ -13,10 +13,10 @@ # --- END LICENSE_HEADER BLOCK --- class CommentsMailer < ActionMailer::Base - default :to => Settings.email.comments - + default to: Settings.email.comments + def contact_email(comment) @comment = OpenStruct.new(comment) - mail(:from => @comment.email, :subject => @comment.subject) + mail(from: Settings.email.comments, reply_to: @comment.email, subject: @comment.subject) end end
Send repository comments from known account
diff --git a/ar_transaction_changes.gemspec b/ar_transaction_changes.gemspec index abc1234..def5678 100644 --- a/ar_transaction_changes.gemspec +++ b/ar_transaction_changes.gemspec @@ -10,7 +10,7 @@ gem.email = ["Dylan.Smith@shopify.com"] gem.description = %q{Solves the problem of trying to get all the changes to an object during a transaction in an after_commit callbacks.} gem.summary = %q{Store transaction changes for active record objects} - gem.homepage = "" + gem.homepage = "https://github.com/dylanahsmith/ar_transaction_changes" gem.files = `git ls-files`.split($/) gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
Add github repo as homepage.
diff --git a/app/helpers/metadata_helper.rb b/app/helpers/metadata_helper.rb index abc1234..def5678 100644 --- a/app/helpers/metadata_helper.rb +++ b/app/helpers/metadata_helper.rb @@ -1,7 +1,8 @@ # frozen_string_literal: true + module MetadataHelper def logo_image_url - image_url 'logo.jpg' + image_url 'logo.png' end def meta_keywords
Fix logo in open graph tags
diff --git a/app/helpers/sessions_helper.rb b/app/helpers/sessions_helper.rb index abc1234..def5678 100644 --- a/app/helpers/sessions_helper.rb +++ b/app/helpers/sessions_helper.rb @@ -22,6 +22,7 @@ remember_token = Session.encrypt(cookies[:remember_token]) current_user.update_attribute(:remember_token, User.encrypt(User.new_remember_token)) + current_session.destroy cookies.delete(:remember_token) end
Destroy sessions when signing out
diff --git a/app/lib/export_notes_sample.rb b/app/lib/export_notes_sample.rb index abc1234..def5678 100644 --- a/app/lib/export_notes_sample.rb +++ b/app/lib/export_notes_sample.rb @@ -0,0 +1,75 @@+# This is intended for use in a one-off analysis task. +class ExportNotesSample + # This doesn't do any authorization checks. + def unsafe_csv_without_authorization_checks(options = {}) + sampled_event_notes, total_count = query(options) + + CSV.generate do |csv| + csv << [ + 'options:', + options.inspect, + 'sampled_event_notes.size:', + sampled_event_notes.size, + 'total_count:', + total_count, + ] + csv << [] + csv << [ + 'event_note.id', + 'event_note.text', + 'event_note.recorded_at', + 'event_note.is_restricted', + 'event_note.event_note_type_id', + 'event_note.event_note_type.name', + 'event_note.educator_id', + 'event_note.educator.full_name', + 'event_note.educator.email', + 'event_note.student.id', + 'event_note.student.first_name', + 'event_note.student.last_name', + 'event_note.student.grade', + 'event_note.student.school_id', + 'event_note.student.school.name' + ] + sampled_event_notes.each do |event_note| + csv << [ + event_note.id, + event_note.text, + event_note.recorded_at, + event_note.is_restricted, + event_note.event_note_type_id, + event_note.event_note_type.name, + event_note.educator_id, + event_note.educator.full_name, + event_note.educator.email, + event_note.student.id, + event_note.student.first_name, + event_note.student.last_name, + event_note.student.grade, + event_note.student.school_id, + event_note.student.school.name + ] + end + end + end + + private + def query(options = {}) + start_date = options[:start_date] + end_date = options[:end_date] + n = options[:n] + seed = options[:seed] + + # Query in time range + event_notes = EventNote.all + .where('recorded_at > ?', start_date) + .where('recorded_at < ?', end_date + .advance(days: 1)).includes(:educator) + total_count = event_notes.size + + # Sample within that, deterministically + sampled_event_notes = event_notes.sample(n, random: Random.new(seed)) + + [sampled_event_notes, total_count] + end +end
Add rake task to get sample of notes for coding
diff --git a/app/models/concerns/wp_post.rb b/app/models/concerns/wp_post.rb index abc1234..def5678 100644 --- a/app/models/concerns/wp_post.rb +++ b/app/models/concerns/wp_post.rb @@ -7,7 +7,7 @@ def update_post(json) self.class.mappable_wordpress_attributes.each do |wp_attribute| - send(wp_attribute, json[wp_attribute]) + send("#{wp_attribute}=", json[wp_attribute]) end self.wp_id = json['ID']
Fix incorrect send call for wp post
diff --git a/lib/dugway/application.rb b/lib/dugway/application.rb index abc1234..def5678 100644 --- a/lib/dugway/application.rb +++ b/lib/dugway/application.rb @@ -3,7 +3,7 @@ def initialize(options={}) @source_dir = File.join(Dir.pwd, options[:source_dir] || 'source') @theme = Theme.new(@source_dir, options[:user_settings] || {}) - @store = Store.new(options[:store] || 'builder') + @store = Store.new(options[:store] || 'dugway') end def call(env)
Move default store to "dugway"
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,5 @@ require "rubygems" -require "activerecord" +require "active_record" require File.expand_path(File.dirname(__FILE__) + "/../lib/url_normalization") require File.expand_path(File.dirname(__FILE__) + "/../init")
Use require active_record, not require activerecord
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 @@ -23,24 +23,3 @@ PuppetlabsSpec::Files.cleanup end end - -require 'pathname' -dir = Pathname.new(__FILE__).parent -Puppet[:modulepath] = File.join(dir, 'fixtures', 'modules') - -# There's no real need to make this version dependent, but it helps find -# regressions in Puppet -# -# 1. Workaround for issue #16277 where default settings aren't initialised from -# a spec and so the libdir is never initialised (3.0.x) -# 2. Workaround for 2.7.20 that now only loads types for the current node -# environment (#13858) so Puppet[:modulepath] seems to get ignored -# 3. Workaround for 3.5 where context hasn't been configured yet, -# ticket https://tickets.puppetlabs.com/browse/MODULES-823 -# -ver = Gem::Version.new(Puppet.version.split('-').first) -if Gem::Requirement.new("~> 2.7.20") =~ ver || Gem::Requirement.new("~> 3.0.0") =~ ver || Gem::Requirement.new("~> 3.5") =~ ver - puts "augeasproviders: setting Puppet[:libdir] to work around broken type autoloading" - # libdir is only a single dir, so it can only workaround loading of one external module - Puppet[:libdir] = "#{Puppet[:modulepath]}/augeasproviders_core/lib" -end
Use modulesync to manage meta files
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,7 @@ require 'rspec' + require 'webmock/rspec' +WebMock.disable_net_connect!(:allow => "codeclimate.com") if ENV["CODECLIMATE_REPO_TOKEN"] require "codeclimate-test-reporter"
Allow codeclimate to post coverage
diff --git a/lib/haml_lint/reporter.rb b/lib/haml_lint/reporter.rb index abc1234..def5678 100644 --- a/lib/haml_lint/reporter.rb +++ b/lib/haml_lint/reporter.rb @@ -1,16 +1,19 @@ module HamlLint - # @abstract Abstract lint reporter. Subclass and override {#report_lints} to - # implement a custom lint reporter. + # Abstract lint reporter. Subclass and override {#report_lints} to + # implement a custom lint reporter. + # + # @abstract class Reporter attr_reader :lints # @param logger [HamlLint::Logger] - # @param lints [Array<HamlLint::Lint>] + # @param report [HamlLint::Report] def initialize(logger, report) @log = logger @lints = report.lints end + # Implemented by subclasses to display lints from a {HamlLint::Report}. def report_lints raise NotImplementedError end
Fix documentation for Reporter class Change-Id: I324caa5900491528ae26cd38b3f382e0ca9b0c28 Reviewed-on: http://gerrit.causes.com/45311 Reviewed-by: Shane da Silva <67fb7bfe39f841b16a1f86d3928acc568d12c716@brigade.com> Tested-by: jenkins <d95b56ce41a2e1ac4cecdd398defd7414407cc08@brigade.com>
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 @@ -26,7 +26,11 @@ def setup_cassandra_connection host = ENV['CASSANDRA_CQL_HOST'] || '127.0.0.1' port = ENV['CASSANDRA_CQL_PORT'] || 9160 - connection = CassandraCQL::Database.new(["#{host}:#{port}"], {}, :retries => 5, :timeout => 5) + + cassandra_cql_options = {} + cassandra_cql_options.merge!(:cql_version => '2.0.0') if CASSANDRA_VERSION >= '1.2' + + connection = CassandraCQL::Database.new(["#{host}:#{port}"], cassandra_cql_options, :retries => 5, :timeout => 5) if !connection.keyspaces.map(&:name).include?("CassandraCQLTestKeyspace") connection.execute("CREATE KEYSPACE CassandraCQLTestKeyspace WITH strategy_class='org.apache.cassandra.locator.SimpleStrategy' AND strategy_options:replication_factor=1") end
Use CQL 2.0.0 for specs if using cassandra 1.2 or above.
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 @@ -2,4 +2,7 @@ c.cassette_library_dir = Rails.root.join("spec", "vcr") c.hook_into :webmock c.configure_rspec_metadata! + + # Allow code coverage report to be sent to Code Climate + c.ignore_hosts "codeclimate.com" end
Fix code coverage report sending
diff --git a/lib/http/response_body.rb b/lib/http/response_body.rb index abc1234..def5678 100644 --- a/lib/http/response_body.rb +++ b/lib/http/response_body.rb @@ -46,6 +46,7 @@ @contents end + alias_method :to_str, :to_s # Assert that the body is actively being streamed def stream!
Allow implicit conversion of HTTP::ResponseBody into String
diff --git a/bootstrap_form_builder.gemspec b/bootstrap_form_builder.gemspec index abc1234..def5678 100644 --- a/bootstrap_form_builder.gemspec +++ b/bootstrap_form_builder.gemspec @@ -4,7 +4,7 @@ require 'bootstrap_form_builder/version' Gem::Specification.new do |spec| - spec.name = "bootstrap_form_builder" + spec.name = "bs_form_builder" spec.version = BootstrapFormBuilder::VERSION spec.authors = ["Sean Geoghegan"] spec.email = ["sean@tushare.com"]
Change gem name to bs_form_builder
diff --git a/plugins/commands/plugin/state_file.rb b/plugins/commands/plugin/state_file.rb index abc1234..def5678 100644 --- a/plugins/commands/plugin/state_file.rb +++ b/plugins/commands/plugin/state_file.rb @@ -10,15 +10,17 @@ @data = {} @data = JSON.parse(@path.read) if @path.exist? + @data["installed"] ||= [] end # Add a plugin that is installed to the state file. # # @param [String] name The name of the plugin def add_plugin(name) - @data["installed"] ||= [] - @data["installed"] << name - save! + if !@data["installed"].include?(name) + @data["installed"] << name + save! + end end # This returns a list of installed plugins according to the state @@ -27,12 +29,15 @@ # # @return [Array<String>] def installed_plugins - @data["installed"] ||= [] @data["installed"] end # This saves the state back into the state file. def save! + # Scrub some fields + @data["installed"].uniq! + + # Save @path.open("w+") do |f| f.write(JSON.dump(@data)) end
Make sure the state file only contains unique fields
diff --git a/features/support/paths.rb b/features/support/paths.rb index abc1234..def5678 100644 --- a/features/support/paths.rb +++ b/features/support/paths.rb @@ -2,7 +2,7 @@ def path_to(page_name) case page_name - when /the homepage/i + when /the homepage/ root_path # Add more page name => path mappings here
Update features for changes in latest cucumber
diff --git a/spec/api/v1/bathrooms_spec.rb b/spec/api/v1/bathrooms_spec.rb index abc1234..def5678 100644 --- a/spec/api/v1/bathrooms_spec.rb +++ b/spec/api/v1/bathrooms_spec.rb @@ -1,13 +1,43 @@ require 'spec_helper' describe 'Bathrooms API' do - it 'sends a list of bathrooms' do + it 'sends a list of bathrooms' + + it 'paginates list of bathrooms by 10 results' do FactoryGirl.create_list(:bathroom, 15) + + get '/api/v1/bathrooms' + expect(response).to be_success + + json = JSON.parse(response.body) + expect(json.length).to eq(10) + + expect(response.header['X-Per-Page']).to eq('10') + expect(response.header['X-Page']).to eq('1') + expect(response.header['X-Total-Pages']).to eq('2') + expect(response.header['X-Total']).to eq('15') end + it 'filters a list of bathrooms by unisex type' it 'filters a list of bathrooms by ADA availability' it 'full-text searches a list of bathrooms' + + it 'paginates full-text searches a list of bathrooms by 10 results' do + FactoryGirl.create_list(:bathroom, 15) + + get '/api/v1/bathrooms/search', { query: 'San Francisco' } + expect(response).to be_success + + json = JSON.parse(response.body) + expect(json.length).to eq(10) + + expect(response.header['X-Per-Page']).to eq('10') + expect(response.header['X-Page']).to eq('1') + expect(response.header['X-Total-Pages']).to eq('2') + expect(response.header['X-Total']).to eq('15') + end + it 'filters a full-text searched list of bathrooms by unisex type' it 'filters a full-text searched list of bathrooms by ADA availability' end
Add assertions for API pagination
diff --git a/spec/api/v1/place_messages.rb b/spec/api/v1/place_messages.rb index abc1234..def5678 100644 --- a/spec/api/v1/place_messages.rb +++ b/spec/api/v1/place_messages.rb @@ -5,7 +5,6 @@ let(:url) { "/api/v1" } it "sends valid place form data" do - pending "Fix recipient address." place = create(:place) params = {} params[:place_form] = FactoryGirl.attributes_for(:valid_place_message)
Enable spec for sending valid place form data.
diff --git a/spec/factories/user_groups.rb b/spec/factories/user_groups.rb index abc1234..def5678 100644 --- a/spec/factories/user_groups.rb +++ b/spec/factories/user_groups.rb @@ -1,6 +1,8 @@+# frozen_string_literal: true + FactoryGirl.define do factory :user_group do - name { Faker::Team.name } + sequence(:name) { |n| "UserGroup #{n}" } mission { get_mission } end end
9690: Fix user group name uniqueness error
diff --git a/spec/ephemeral_response/configuration_spec.rb b/spec/ephemeral_response/configuration_spec.rb index abc1234..def5678 100644 --- a/spec/ephemeral_response/configuration_spec.rb +++ b/spec/ephemeral_response/configuration_spec.rb @@ -2,6 +2,9 @@ describe EphemeralResponse::Configuration do subject { EphemeralResponse::Configuration } + after do + subject.expiration = lambda { one_day } + end describe "#fixture_directory" do it "has a default" do subject.fixture_directory.should == "spec/fixtures/ephemeral_response"
Test resets expiry after changing it
diff --git a/spec/chartroom/port_spec.rb b/spec/chartroom/port_spec.rb index abc1234..def5678 100644 --- a/spec/chartroom/port_spec.rb +++ b/spec/chartroom/port_spec.rb @@ -0,0 +1,53 @@+require "spec_helper" + +module Chartroom + describe Port do + let(:private_port) { 80 } + let(:public_port) { 80 } + let(:type) { "tcp" } + + let(:params) do + { "IP" => "0.0.0.0", "PrivatePort" => 80, "PublicPort" => 80, "Type" => "tcp" } + end + + let(:port) { described_class.new(params) } + + describe "#private_port" do + it "should return private_port" do + expect(port.private_port).to eq private_port + end + end + + describe "#public_port" do + it "should return public_port" do + expect(port.public_port).to eq public_port + end + end + + describe "#type" do + it "should return type" do + expect(port.type).to eq type + end + end + + describe "prettify" do + it "should prettify" do + expect(port.prettify).to eq "#{private_port} -> #{public_port} (#{type.upcase})" + end + end + + describe "edge_description" do + let(:id) { "abcd1234efgh" } + + it "should return edge description" do + expect(port.edge_description(id)).to eq "container_#{id} -> port_#{public_port} [label=\"#{private_port} -> #{public_port}\"];" + end + end + + describe "node_description" do + it "should return node description" do + expect(port.node_description).to eq "port_#{public_port}[color=lawngreen, label=\"#{public_port}\", shape=ellipse];" + end + end + end +end
Add tests for Port class
diff --git a/spec/features/login_spec.rb b/spec/features/login_spec.rb index abc1234..def5678 100644 --- a/spec/features/login_spec.rb +++ b/spec/features/login_spec.rb @@ -0,0 +1,9 @@+feature 'Login' do + scenario 'invalid login displays an error' do + visit '/login' + fill_in 'user_name', with: '' + fill_in 'user_password', with: '' + click_button 'Log in' + expect(page).to have_content 'Invalid login.' + end +end
Write feature test for invalid login to show error message.
diff --git a/spec/requests/songs_spec.rb b/spec/requests/songs_spec.rb index abc1234..def5678 100644 --- a/spec/requests/songs_spec.rb +++ b/spec/requests/songs_spec.rb @@ -0,0 +1,63 @@+require 'rails_helper' + +RSpec.describe 'Songs', type: :request do + let(:live) { create(:live) } + let!(:song) { create(:song, status: :open, live: live) } + + describe 'GET /songs.json' do + let(:expected_body) do + [ + { + id: song.id, + name: song.name, + artist: song.artist, + order: song.order, + time: song.time, + live: { + id: live.id, + name: live.name, + date: live.date.to_s, + place: live.place + } + } + ] + end + + before { get songs_path, as: :json } + + it_behaves_like 'valid response' + end + + describe 'GET /songs/:id.json' do + let(:user) { create(:user) } + let!(:playing) { create(:playing, song: song, user: user) } + let(:expected_body) do + { + id: song.id, + name: song.name, + artist: song.artist, + order: song.order, + time: song.time, + live: { + id: live.id, + name: live.name, + date: live.date.to_s, + place: live.place + }, + playings: [ + inst: playing.inst, + user: { + id: user.id, + joined: user.joined, + public: user.public, + name: user.handle + } + ] + } + end + + before { get song_path(song), as: :json } + + it_behaves_like 'valid response' + end +end
Add tests for /songs api
diff --git a/gem_tasks/yard.rake b/gem_tasks/yard.rake index abc1234..def5678 100644 --- a/gem_tasks/yard.rake +++ b/gem_tasks/yard.rake @@ -2,32 +2,32 @@ require 'yard/rake/yardoc_task' require File.expand_path(File.dirname(__FILE__) + '/../lib/cucumber/platform') -SITE_DIR = File.expand_path(File.dirname(__FILE__) + '/../../cucumber.github.com') -API_DIR = File.join(SITE_DIR, 'api', 'cucumber', 'ruby', 'yardoc') +SITE_DIR = File.expand_path(File.dirname(__FILE__) + '/../../cucumber.github.com') +API_DIR = File.join(SITE_DIR, 'api', 'cucumber', 'ruby', 'yardoc') +TEMPLATE_DIR = File.expand_path(File.join(File.dirname(__FILE__), 'yard')) +YARD::Templates::Engine.register_template_path(TEMPLATE_DIR) namespace :api do - file :dir do + task :dir do unless File.directory?(SITE_DIR) raise "You need to git clone git@github.com:cucumber/cucumber.github.com.git #{SITE_DIR}" end - sh('git pull -u') - mkdir_p API_DIR + Dir.chdir(SITE_DIR) do + sh 'git pull -u' + mkdir_p API_DIR + end end - template_path = File.expand_path(File.join(File.dirname(__FILE__), 'yard')) - YARD::Templates::Engine.register_template_path(template_path) YARD::Rake::YardocTask.new(:yard) do |yard| - dir = API_DIR - mkdir_p dir - yard.options = ["--out", dir] + yard.options = ["--out", API_DIR] end task :yard => :dir task :release do Dir.chdir(SITE_DIR) do - sh('git add .') - sh("git commit -m 'Update API docs for Cucumber-Ruby v#{Cucumber::VERSION}'") - sh('git push') + sh 'git add .' + sh "git commit -m 'Update API docs for Cucumber-Ruby v#{Cucumber::VERSION}'" + sh 'git push' end end
Fix api:dir rake task so it works on my machine :)
diff --git a/git_handler.gemspec b/git_handler.gemspec index abc1234..def5678 100644 --- a/git_handler.gemspec +++ b/git_handler.gemspec @@ -9,11 +9,11 @@ s.authors = ["Dan Sosedoff"] s.email = ["dan.sosedoff@gmail.com"] - s.add_development_dependency 'rake', '~> 0.8' - s.add_development_dependency 'rspec', '~> 2.6' - s.add_development_dependency 'simplecov', '~> 0.4' + s.add_development_dependency 'rake', '~> 10.0' + s.add_development_dependency 'rspec', '~> 2.13' + s.add_development_dependency 'simplecov', '~> 0.7' - s.add_runtime_dependency 'sshkey', '~> 1.4' + s.add_runtime_dependency 'sshkey', '~> 1.5' s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
Update dev and runtime dependencies
diff --git a/recipes/dynatrace_user.rb b/recipes/dynatrace_user.rb index abc1234..def5678 100644 --- a/recipes/dynatrace_user.rb +++ b/recipes/dynatrace_user.rb @@ -10,7 +10,6 @@ user "Create system user '#{dynatrace_owner}'" do username dynatrace_owner - system true action :create end
[JLT-173344] Prepare dynasprint environment for Sprint 8 * Fixed cause of exceptions in server logs ("Failed to access preferences node for path") by creating dynatrace user with home directory
diff --git a/lib/active_admin/views/components/menu_item.rb b/lib/active_admin/views/components/menu_item.rb index abc1234..def5678 100644 --- a/lib/active_admin/views/components/menu_item.rb +++ b/lib/active_admin/views/components/menu_item.rb @@ -5,20 +5,22 @@ class MenuItem < Component builder_method :menu_item attr_reader :label + attr_reader :url attr_reader :priority def build(item, options = {}) super(options.merge(id: item.id)) @label = item.label(self) + @url = item.url(self) @priority = item.priority child_items = item.items add_class "current" if item.current? assigns[:current_tab] - if url = item.url(self) - a item.label(self), item.html_options.merge(href: url) + if url + a label, item.html_options.merge(href: url) else - span item.label(self), item.html_options + span label, item.html_options end if child_items.any?
Tidy use of url in MenuItem component.
diff --git a/lib/amazon_auth/extensions/common_extension.rb b/lib/amazon_auth/extensions/common_extension.rb index abc1234..def5678 100644 --- a/lib/amazon_auth/extensions/common_extension.rb +++ b/lib/amazon_auth/extensions/common_extension.rb @@ -4,7 +4,7 @@ def log(message) return unless (@options[:debug] || @options[:verbose]) puts "[#{Time.current.strftime('%Y-%m-%d %H:%M:%S')}] #{message}" + - (@options[:debug] ? " -- #{session.current_url}" : '') + (@options[:debug] && session ? " -- #{session.current_url}" : '') end def debug(message)
Fix a bug with debug flag and nil session
diff --git a/db/migrate/20150323172330_add_filename_and_username_to_attachment_recent_activity_parameters.rb b/db/migrate/20150323172330_add_filename_and_username_to_attachment_recent_activity_parameters.rb index abc1234..def5678 100644 --- a/db/migrate/20150323172330_add_filename_and_username_to_attachment_recent_activity_parameters.rb +++ b/db/migrate/20150323172330_add_filename_and_username_to_attachment_recent_activity_parameters.rb @@ -0,0 +1,21 @@+class AddFilenameAndUsernameToAttachmentRecentActivityParameters < ActiveRecord::Migration + + def up + RecentActivity.where(trackable_type: 'Attachment').each do |r| + if r.trackable.present? + r.parameters[:filename] = r.trackable.title + end + if r.recipient.present? && r.parameters[:username].blank? + r.parameters[:username] = r.recipient.name + end + r.save! + end + end + + def down + RecentActivity.where(trackable_type: 'Attachment').each do |r| + r.update_attributes(parameters: {}) + end + end + +end
Add extra parameters for recent activity of attachments Conflicts: db/schema.rb
diff --git a/lib/mtgextractor/rails/tasks/mtgextractor.rake b/lib/mtgextractor/rails/tasks/mtgextractor.rake index abc1234..def5678 100644 --- a/lib/mtgextractor/rails/tasks/mtgextractor.rake +++ b/lib/mtgextractor/rails/tasks/mtgextractor.rake @@ -16,7 +16,7 @@ ActiveRecord::Base.establish_connection(database_yaml) set_name = ENV["SET"] - set = MtgSet.new(:name => set_name).save + set = MtgSet.find_or_create_by_name(:name => set_name) puts "Processing set '#{set_name}'..." card_urls = MTGExtractor::SetExtractor.new(set_name).get_card_detail_urls
Change call for creating the set to 'find_or_create_by_name'
diff --git a/lib/noaa_client/responses/reactive_response.rb b/lib/noaa_client/responses/reactive_response.rb index abc1234..def5678 100644 --- a/lib/noaa_client/responses/reactive_response.rb +++ b/lib/noaa_client/responses/reactive_response.rb @@ -3,7 +3,11 @@ module ReactiveResponse def method_missing(method_name, *arguments, &block) if tag = source.css(method_name.to_s) - tag.text + if block + block.call tag.text + else + tag.text + end else super end
Add block modifier for reactive response.
diff --git a/lib/pdoc/generators/html/syntax_highlighter.rb b/lib/pdoc/generators/html/syntax_highlighter.rb index abc1234..def5678 100644 --- a/lib/pdoc/generators/html/syntax_highlighter.rb +++ b/lib/pdoc/generators/html/syntax_highlighter.rb @@ -6,8 +6,8 @@ attr_reader :highlighter - def initialize(highlighter = :none) - @highlighter = highlighter.to_sym + def initialize(h = nil) + @highlighter = h.nil? ? :none : h.to_sym end def parse(input)
Make SyntaxHighlighter _truly_ more resilient this time.
diff --git a/lib/conway.rb b/lib/conway.rb index abc1234..def5678 100644 --- a/lib/conway.rb +++ b/lib/conway.rb @@ -12,13 +12,18 @@ def initialize(width, heigth) @width, @heigth = width, heigth + @fields = Array.new(width) do + Array.new(heigth) do + Cell.new + end + end end end class Cell attr_reader :value - def initialize(n) + def initialize(n = 0) @value = n end
Initialize fields to empty cells.
diff --git a/activerecord/lib/active_record/relation/predicate_builder.rb b/activerecord/lib/active_record/relation/predicate_builder.rb index abc1234..def5678 100644 --- a/activerecord/lib/active_record/relation/predicate_builder.rb +++ b/activerecord/lib/active_record/relation/predicate_builder.rb @@ -11,7 +11,7 @@ if value.is_a?(Hash) arel_table = Arel::Table.new(column, @engine) - build_predicate_from_hash(value, arel_table) + build_from_hash(value, arel_table) else column = column.to_s
Fix the method name for recusion
diff --git a/lib/gollum.rb b/lib/gollum.rb index abc1234..def5678 100644 --- a/lib/gollum.rb +++ b/lib/gollum.rb @@ -10,10 +10,6 @@ # internal require File.expand_path('../gollum/uri_encode_component', __FILE__) - -# Set ruby to UTF-8 mode -# This is required for Ruby 1.8.7 which gollum still supports. -$KCODE = 'U' if RUBY_VERSION[0, 3] == '1.8' module Gollum VERSION = '4.0.1'
Remove unicode support on deprecated ruby 1.8
diff --git a/Casks/adobe-air.rb b/Casks/adobe-air.rb index abc1234..def5678 100644 --- a/Casks/adobe-air.rb +++ b/Casks/adobe-air.rb @@ -1,5 +1,5 @@ cask :v1 => 'adobe-air' do - version '18.0' + version '19.0' sha256 :no_check # required as upstream package is updated in-place url "http://airdownload.adobe.com/air/mac/download/#{version}/AdobeAIR.dmg"
Upgrade Adobe AIR to v19.0
diff --git a/app/views/api/records/show.json.jbuilder b/app/views/api/records/show.json.jbuilder index abc1234..def5678 100644 --- a/app/views/api/records/show.json.jbuilder +++ b/app/views/api/records/show.json.jbuilder @@ -22,9 +22,11 @@ end end -json.country do - json.id @record.country.id - json.name @record.country.name +if @record.country + json.country do + json.id @record.country.id + json.name @record.country.name + end end json.comments @record.comments.reverse, partial: 'api/comments/comment', as: :comment
Fix Api::RecordShow jbuilder view for records without a country
diff --git a/webapp/db/migrate/20120221131302_unique_user_name_index.rb b/webapp/db/migrate/20120221131302_unique_user_name_index.rb index abc1234..def5678 100644 --- a/webapp/db/migrate/20120221131302_unique_user_name_index.rb +++ b/webapp/db/migrate/20120221131302_unique_user_name_index.rb @@ -0,0 +1,13 @@+class UniqueUserNameIndex < ActiveRecord::Migration + def self.up + execute <<-SQL + CREATE UNIQUE INDEX lower_username ON users (LOWER(user_name)); + SQL + end + + def self.down + execute <<-SQL + DROP INDEX lower_username_ix; + SQL + end +end
Add another case-insensitive unqiue indx, this time to user_name
diff --git a/lib/apple_system_status/cli.rb b/lib/apple_system_status/cli.rb index abc1234..def5678 100644 --- a/lib/apple_system_status/cli.rb +++ b/lib/apple_system_status/cli.rb @@ -8,7 +8,7 @@ option :title, desc: "If specified, narrow the service title" option :format, desc: "output format. (ex. plain, json)", default: "plain" def fetch - response = AppleSystemStatus::Crawler.new.perform( + response = AppleSystemStatus::Crawler.perform( country: options[:country], title: options[:title], )
Use class method instead of instance method
diff --git a/lib/arel/engines/sql/engine.rb b/lib/arel/engines/sql/engine.rb index abc1234..def5678 100644 --- a/lib/arel/engines/sql/engine.rb +++ b/lib/arel/engines/sql/engine.rb @@ -20,8 +20,12 @@ end end - def method_missing(method, *args, &block) - @ar.connection.send(method, *args, &block) + def method_missing(method, *args) + if block_given? + @ar.connection.send(method, *args) { |*block_args| yield(*block_args) } + else + @ar.connection.send(method, *args) + end end module CRUD
Use block_given? instead defining block.
diff --git a/lib/childprocess/jruby/pump.rb b/lib/childprocess/jruby/pump.rb index abc1234..def5678 100644 --- a/lib/childprocess/jruby/pump.rb +++ b/lib/childprocess/jruby/pump.rb @@ -30,6 +30,7 @@ while read != -1 avail = [@input.available, 1].max + avail = BUFFER_SIZE if avail > BUFFER_SIZE read = @input.read(buffer, 0, avail) if read > 0
Make sure we never try to read more then the max buffer size in JRuby::Pump.
diff --git a/lib/discordrb/events/typing.rb b/lib/discordrb/events/typing.rb index abc1234..def5678 100644 --- a/lib/discordrb/events/typing.rb +++ b/lib/discordrb/events/typing.rb @@ -0,0 +1,42 @@+require 'discordrb/events/generic' + +module Discordrb::Events + class TypingEvent + attr_reader :channel, :timestamp + + def initialize(data, bot) + @user_id = data['user_id'] + @channel_id = data['user_id'] + @channel = bot.channel(@channel_id) + @timestamp = Time.at(data['timestamp'].to_i) + end + end + + class TypingEventHandler < EventHandler + def matches?(event) + # Check for the proper event type + return false unless event.is_a? TypingEvent + + return [ + matches_all(@attributes[:in], event.channel) do |a,e| + if a.is_a? String + a == e.name + elsif a.is_a? Fixnum + a == e.id + else + a == e + end + end, + matches_all(@attributes[:from], event.user) do |a,e| + if a.is_a? String + a == e.name + elsif a.is_a? Fixnum + a == e.id + else + a == e + end + end + ].reduce(true, &:&) + end + end +end
Add an event handler for TYPING_START
diff --git a/ttygif.rb b/ttygif.rb index abc1234..def5678 100644 --- a/ttygif.rb +++ b/ttygif.rb @@ -5,6 +5,9 @@ url 'https://github.com/icholy/ttygif/archive/1.0.8.zip' sha1 'f8d0a56af11d3ae8e2d5e64a4f6aceccb8338414' + depends_on 'imagemagick' + depends_on 'ttyrec' + def install system "make" bin.install('ttygif')
Add imagemagick and ttyrec as dependencies
diff --git a/lib/lending_club/connection.rb b/lib/lending_club/connection.rb index abc1234..def5678 100644 --- a/lib/lending_club/connection.rb +++ b/lib/lending_club/connection.rb @@ -18,6 +18,13 @@ Faraday::Connection.new(options) do |connection| # connection.use FaradayMiddleware::RaiseHttpException connection.adapter(adapter) + case format + when :json + connection.use FaradayMiddleware::ParseJson + else + # FIXME raise a proper error class + raise 'invalid format' + end end end
Add response parsing using Faraday JSON parser.
diff --git a/Casks/pritunl.rb b/Casks/pritunl.rb index abc1234..def5678 100644 --- a/Casks/pritunl.rb +++ b/Casks/pritunl.rb @@ -0,0 +1,21 @@+cask :v1 => 'pritunl' do + version '0.10.14' + sha256 'afa302d8e95d1635584673a3c206d370c93846f519735d9898e75af43d9bd3a8' + + # github.com is the official download host per the vendor homepage + url "https://github.com/pritunl/pritunl-client-electron/releases/download/#{version}/Pritunl.pkg.zip" + appcast 'https://github.com/pritunl/pritunl-client-electron/releases.atom' + name 'Pritunl OpenVPN Client' + homepage 'http://client.pritunl.com' + license :gpl + + pkg 'Pritunl.pkg' + + uninstall :pkgutil => 'com.pritunl.pkg.Pritunl' + + zap :delete => [ + '~/Library/Application Support/pritunl', + '~/Library/Caches/pritunl', + '~/Library/Preferences/com.electron.pritunl.plist' + ] +end
Add Pritunl OpenVPN Client cask
diff --git a/Casks/arduino.rb b/Casks/arduino.rb index abc1234..def5678 100644 --- a/Casks/arduino.rb +++ b/Casks/arduino.rb @@ -1,6 +1,6 @@ cask 'arduino' do version '1.6.7' - sha256 '20d6ecdd068930d3e74ef5de6ec3115e57b9ad7183fbee51b0d42e52cd5df5aa' + sha256 '9ad1a3096904c132e7a0817c9d7afc17a891ded3fb73a50ac1d5845d6a7d68a3' url "https://downloads.arduino.cc/arduino-#{version}-macosx.zip" name 'Arduino'
Fix sha256 on Arduino 1.6.7
diff --git a/lib/travis/api/app/endpoint/builds.rb b/lib/travis/api/app/endpoint/builds.rb index abc1234..def5678 100644 --- a/lib/travis/api/app/endpoint/builds.rb +++ b/lib/travis/api/app/endpoint/builds.rb @@ -6,12 +6,11 @@ get '/' do name = params[:branches] ? :find_branches : :find_builds params['ids'] = params['ids'].split(',') if params['ids'].respond_to?(:split) + respond_with service(name, params) + end - if params['ids'].blank? - respond_with({}) - else - respond_with service(name, params) - end + get '/:id' do + respond_with service(:find_build, params) end post '/:id/cancel' do
Revert my puny changes for now. Will be fixed in travis-web.
diff --git a/cookbooks/krew/recipes/krew.rb b/cookbooks/krew/recipes/krew.rb index abc1234..def5678 100644 --- a/cookbooks/krew/recipes/krew.rb +++ b/cookbooks/krew/recipes/krew.rb @@ -1,10 +1,6 @@ krew 'ctx' -krew 'iexec' krew 'images' krew 'neat' krew 'ns' krew 'open-svc' -krew 'rolesum' -krew 'status' -krew 'tree' krew 'view-secret'
Delete kubectl plugins that don't support apple silicon
diff --git a/rally_api.gemspec b/rally_api.gemspec index abc1234..def5678 100644 --- a/rally_api.gemspec +++ b/rally_api.gemspec @@ -7,7 +7,7 @@ s.version = RallyAPI::VERSION s.authors = ["Dave Smith"] s.email = ["dsmith@rallydev.com"] - s.homepage = "http://developer.rallydev.com/help" + s.homepage = "https://github.com/RallyTools/RallyRestToolkitForRuby" s.summary = "A wrapper for the Rally Web Services API using json" s.description = "API wrapper for Rally's JSON REST web services api"
Update gem spec homepage to github
diff --git a/lib/models/mongomapper_user.rb b/lib/models/mongomapper_user.rb index abc1234..def5678 100644 --- a/lib/models/mongomapper_user.rb +++ b/lib/models/mongomapper_user.rb @@ -4,11 +4,12 @@ key :email, String, :length => (5..40), :unique => true key :hashed_password, String key :salt, String - key :created_at, DateTime key :permission_level, Integer, :default => 1 if Sinatra.const_defined?('FacebookObject') key :fb_uid, String end + + timestamps! attr_accessor :password, :password_confirmation #protected equievelant? :protected => true doesn't exist in dm 0.10.0
Change timestamp management to mongo-mapper built-in
diff --git a/lib/rails_sortable/core_ext.rb b/lib/rails_sortable/core_ext.rb index abc1234..def5678 100644 --- a/lib/rails_sortable/core_ext.rb +++ b/lib/rails_sortable/core_ext.rb @@ -1,3 +1,3 @@-Dir.glob(File.expand_path('core_ext/*.rb', __dir__)).each do |path| +Dir.glob(File.expand_path('core_ext/*.rb', File.dirname(__FILE__))).each do |path| require path end
Fix no method error on ruby-1.9.3
diff --git a/core/enumerator/lazy/force_spec.rb b/core/enumerator/lazy/force_spec.rb index abc1234..def5678 100644 --- a/core/enumerator/lazy/force_spec.rb +++ b/core/enumerator/lazy/force_spec.rb @@ -24,7 +24,7 @@ (0..Float::INFINITY).lazy.map(&:succ).take(2).force.should == [1, 2] @eventsmixed.take(1).map(&:succ).force.should == [1] - ScratchPad.recorded == [:after_yields] + ScratchPad.recorded.should == [:before_yield] end end end
Add missing ".should" and fix subsequent failure
diff --git a/core/proc/shared/call_arguments.rb b/core/proc/shared/call_arguments.rb index abc1234..def5678 100644 --- a/core/proc/shared/call_arguments.rb +++ b/core/proc/shared/call_arguments.rb @@ -4,4 +4,26 @@ lambda {|&b| b.send(@method)}.send(@method) {1 + 1}.should == 2 proc {|&b| b.send(@method)}.send(@method) {1 + 1}.should == 2 end + + it "Yield to the block given at declaration and not to the block argument" do + proc_creator = Object.new + def proc_creator.create + Proc.new do |&b| + yield + end + end + a_proc = proc_creator.create { 7 } + a_proc.call { 3 }.should == 7 + end + + it "Can call its block argument declared with a block argument" do + proc_creator = Object.new + def proc_creator.create(method_name) + Proc.new do |&b| + yield + b.send(method_name) + end + end + a_proc = proc_creator.create(@method) { 7 } + a_proc.call { 3 }.should == 10 + end end
Add specs for yielding in procs which take block arguments.
diff --git a/spec/controllers/searches_controller_spec.rb b/spec/controllers/searches_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/searches_controller_spec.rb +++ b/spec/controllers/searches_controller_spec.rb @@ -0,0 +1,35 @@+require 'rails_helper' + +RSpec.describe SearchesController, type: :controller do + include_context 'has all objects' + + # Initiate objects + before :each do + user + entry + end + + describe 'show' do + it 'should redirect to login url if not logged in' do + get :show + expect(response.status).to eq 302 + expect(response).to redirect_to(new_user_session_url) + end + + it 'should allow search for a paid user' do + sign_in user + get :show + expect(response.status).to eq 200 + expect(response.body).to have_content('Subscribe to PRO to use search.') + end + + it 'should allow search for a paid user' do + sign_in user + user.plan = 'PRO Gumroad Monthly' + user.save + get :show + expect(response.status).to eq 200 + expect(response.body).to have_content("Use hashtags throughout your entries and you'll see a tag cloud appear here") + end + end +end
Add tests for search controller
diff --git a/lib/descendants_loader.rb b/lib/descendants_loader.rb index abc1234..def5678 100644 --- a/lib/descendants_loader.rb +++ b/lib/descendants_loader.rb @@ -29,6 +29,8 @@ classes end + private + def load_self_descendants file = ClassFinder.where_is(self) path = File.expand_path(File.dirname(file))
Load dependencies should be private
diff --git a/lib/engineyard/version.rb b/lib/engineyard/version.rb index abc1234..def5678 100644 --- a/lib/engineyard/version.rb +++ b/lib/engineyard/version.rb @@ -1,4 +1,4 @@ module EY - VERSION = '2.1.1' + VERSION = '2.1.2.pre' ENGINEYARD_SERVERSIDE_VERSION = ENV['ENGINEYARD_SERVERSIDE_VERSION'] || '2.1.1' end
Add .pre for next release
diff --git a/lib/filters/filter_set.rb b/lib/filters/filter_set.rb index abc1234..def5678 100644 --- a/lib/filters/filter_set.rb +++ b/lib/filters/filter_set.rb @@ -2,7 +2,9 @@ class FilterSet include Enumerable - attr_reader :name + attr_reader :name, :selection_policy, :selected_values + private :selection_policy, :selected_values + def initialize(name, selected_value, selection_policy) @name = name @selection_policy = selection_policy @@ -11,7 +13,7 @@ end def add_filter(name, value) - @filters << Filter.new(self, name, value, @selected_values.include?(value)) + @filters << Filter.new(self, name, value, selected_values.include?(value)) end def each(&block) @@ -23,7 +25,7 @@ end def params_for_filter(filter) - starting_values = @selection_policy.base_values(@selected_values) + starting_values = selection_policy.base_values(selected_values) new_values = filter.selected? ? starting_values - [filter.value] : starting_values + [filter.value] new_values.empty? ? "" : "#{name}:#{new_values.map.join(",")}" end
Use methods instead of variables
diff --git a/lib/lifx/transport/tcp.rb b/lib/lifx/transport/tcp.rb index abc1234..def5678 100644 --- a/lib/lifx/transport/tcp.rb +++ b/lib/lifx/transport/tcp.rb @@ -11,7 +11,7 @@ @socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_MAXSEG, 512) end - HEADER_SIZE = 100 + HEADER_SIZE = 8 def listen(&block) return if @listener Thread.abort_on_exception = true
Use the correct header size
diff --git a/spec/mnemosyne/probes/restify/base_spec.rb b/spec/mnemosyne/probes/restify/base_spec.rb index abc1234..def5678 100644 --- a/spec/mnemosyne/probes/restify/base_spec.rb +++ b/spec/mnemosyne/probes/restify/base_spec.rb @@ -4,20 +4,26 @@ require 'webmock/rspec' RSpec.describe Mnemosyne::Probes::Restify::Base do - it 'creates span' do - trace = with_trace do - stub_request(:any, 'google.com') + before { require 'restify' } - require 'restify' - Restify.new('http://google.com').get.value! + describe 'a GET request' do + subject(:request) { Restify.new('http://google.com').get.value! } + + before do + stub_request(:get, 'google.com') + .to_return(status: 200, body: 'search') end - expect(trace.span.size).to eq 1 + it 'creates a span when tracing' do + trace = with_trace { request } - span = trace.span.first + expect(trace.span.size).to eq 1 - expect(span.name).to eq 'external.http.restify' - expect(span.meta[:url]).to eq 'http://google.com' - expect(span.meta[:method]).to eq :get + span = trace.span.first + + expect(span.name).to eq 'external.http.restify' + expect(span.meta[:url]).to eq 'http://google.com' + expect(span.meta[:method]).to eq :get + end end end
Restructure tests as was done for Faraday
diff --git a/db/migrate/20200327172134_convert_training_modules_to_utf8_mb4.rb b/db/migrate/20200327172134_convert_training_modules_to_utf8_mb4.rb index abc1234..def5678 100644 --- a/db/migrate/20200327172134_convert_training_modules_to_utf8_mb4.rb +++ b/db/migrate/20200327172134_convert_training_modules_to_utf8_mb4.rb @@ -1,5 +1,6 @@ class ConvertTrainingModulesToUtf8Mb4 < ActiveRecord::Migration[6.0] def change + execute "ALTER TABLE training_slides ROW_FORMAT=DYNAMIC" execute "ALTER TABLE training_slides CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci" execute "ALTER TABLE training_slides MODIFY content TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci" execute "ALTER TABLE training_slides MODIFY translations TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci"
Change ROW_FORMAT for utf8mb4 compatibility
diff --git a/bosh-dev/lib/bosh/dev/tasks/rubocop.rake b/bosh-dev/lib/bosh/dev/tasks/rubocop.rake index abc1234..def5678 100644 --- a/bosh-dev/lib/bosh/dev/tasks/rubocop.rake +++ b/bosh-dev/lib/bosh/dev/tasks/rubocop.rake @@ -4,10 +4,13 @@ desc 'Run RuboCop on new git files' RuboCop::RakeTask.new(:new) do |task| task.patterns = `git diff --cached --name-only --diff-filter=A -- *.rb`.split("\n") + task.options << '--lint' end desc 'Run RuboCop on all files' - RuboCop::RakeTask.new(:all) + RuboCop::RakeTask.new(:all) do |task| + task.options << '--lint' + end end task rubocop: ['rubocop:all']
Change Rubocup setting to only run lint and not other checks (including style) Signed-off-by: Victor Fong <95c00c4b759dfd5c0c9bab0c67fa20ed75fca00d@emc.com>
diff --git a/test/unit/blacklist_test.rb b/test/unit/blacklist_test.rb index abc1234..def5678 100644 --- a/test/unit/blacklist_test.rb +++ b/test/unit/blacklist_test.rb @@ -3,6 +3,20 @@ class BlacklistTest < Test::Unit::TestCase setup do + @empty_ncodes = { + 'ncodes' => [ + 'n12345' + ] + } + @deleted_database = { + 1 => { + 'id' => 1, + 'toc_url' => 'http://ncode.syosetu.com/n98765/', + 'tags' => [ + '404' + ] + } + } end sub_test_case "directory" do @@ -16,4 +30,41 @@ end end end + + sub_test_case "merge ncodes" do + def test_merge_ncode + Dir.mktmpdir do |dir| + ENV['YOMOU_HOME'] = File.join(dir, '.yomou') + save_to_yaml(blacklist_path, @empty_ncodes) + blacklist = Yomou::Blacklist.new + blacklist.init + save_to_yaml(database_path('narou/00/.narou'), @deleted_database) + blacklist.import + expected = { + 'ncodes' => [ + 'n12345', 'n98765' + ] + } + assert_equal(expected, YAML.load_file(blacklist_path)) + end + end + end + + private + def blacklist_path + File.join(ENV['YOMOU_HOME'], 'blacklist.yaml') + end + + def database_path(relative_path) + path = File.join(ENV['YOMOU_HOME'], relative_path, 'database.yaml') + FileUtils.mkdir_p(File.dirname(path)) + path + end + + def save_to_yaml(path, data) + FileUtils.mkdir_p(ENV['YOMOU_HOME']) + File.open(path, 'w+') do |file| + file.puts(YAML.dump(data)) + end + end end
Add merge test for blacklist
diff --git a/minc.rb b/minc.rb index abc1234..def5678 100644 --- a/minc.rb +++ b/minc.rb @@ -2,8 +2,8 @@ class Minc < Formula homepage 'http://en.wikibooks.org/wiki/MINC' - url 'https://github.com/BIC-MNI/minc/tarball/release-2.2.00' - sha1 '558300240a67b9f849a98622d0e8ec3aad76c6d1' + url 'https://github.com/BIC-MNI/minc/archive/release-2.2.00.tar.gz' + sha1 'f66f44ece374940bd006f321a7206f16165f74e0' head 'https://github.com/BIC-MNI/minc.git'
Change github /tarball/ URLs to /archive/ for formulae L-Z This takes care of a `brew audit` complaint. Closes #18828. Signed-off-by: Adam Vandenberg <34c2b6407fd5a10249a15d699d40f9ed1782e98c@gmail.com>
diff --git a/wel-osx-apps/recipes/plexserver.rb b/wel-osx-apps/recipes/plexserver.rb index abc1234..def5678 100644 --- a/wel-osx-apps/recipes/plexserver.rb +++ b/wel-osx-apps/recipes/plexserver.rb @@ -1,7 +1,8 @@ dmg_package "Plex Media Server" do + volumes_dir "PlexMediaServer" dmg_name "PlexMediaServer-0.9.7.22.511-4b5280f-OSX.dmg" source "http://plex.r.worldssl.net/PlexMediaServer/0.9.7.22.511-4b5280f/PlexMediaServer-0.9.7.22.511-4b5280f-OSX.dmg" checksum "25ba43ef1a9510f1608d0435c727dd16ceaf0ce193cd559f599b4b9c06bce4ce" action :install owner WS_USER -end+end
Add volume directory for Plex Server This commit adds the volume directory for the plex server recipe.
diff --git a/files/brews/gh.rb b/files/brews/gh.rb index abc1234..def5678 100644 --- a/files/brews/gh.rb +++ b/files/brews/gh.rb @@ -1,7 +1,7 @@ require "formula" class Gh < Formula - VERSION = "0.23.0" + VERSION = "0.24.2" ARCH = if MacOS.prefer_64_bit? "amd64" else
Update upstream to 0.24.2 with two-factor support `gh` added support for two-factor auth in 0.24.2, see jingweno/gh#85 and https://github.com/jingweno/gh/commit/42e4d021cf5c5854920d386480bbbd9466a2c823 While you can get this update by running `brew upgrade [...]` it's nice to have it by default!
diff --git a/lib/diameter/u24.rb b/lib/diameter/u24.rb index abc1234..def5678 100644 --- a/lib/diameter/u24.rb +++ b/lib/diameter/u24.rb @@ -0,0 +1,10 @@+def u8_and_u16_to_u24(eightb, sixteenb) + (eightb << 16) + sixteenb +end + +def u24_to_u8_and_u16(twentyfourb) + top_eight = twentyfourb >> 16 + bottom_sixteen = twentyfourb - (top_eight << 16) + [top_eight, bottom_sixteen] +end +
Add missing file for uint24 handling
diff --git a/lib/facter/users.rb b/lib/facter/users.rb index abc1234..def5678 100644 --- a/lib/facter/users.rb +++ b/lib/facter/users.rb @@ -1,8 +1,16 @@ Facter.add(:have_psql) do - confine :kernel => %w{Linux OpenBSD SunOS} setcode do + confine :kernel => %w{Linux SunOS} if Facter::Util::Resolution.exec(Facter.value('ps')).match(/^postgres/) + "true" + else + "false" + end + end + setcode do + confine :kernel => %w{OpenBSD} + if Facter::Util::Resolution.exec(Facter.value('ps')).match(/^_postgresql/) "true" else "false"
Fix fact have_psql for OpenBSD, the user name of the postgres system user is different
diff --git a/lib/hash_to_json.rb b/lib/hash_to_json.rb index abc1234..def5678 100644 --- a/lib/hash_to_json.rb +++ b/lib/hash_to_json.rb @@ -31,7 +31,7 @@ end res.write render('templates/home.haml', hash: input , json: json) end - res.write render('templates/home.haml', hash: '' , json: '') + res.write render('templates/home.haml', hash: '' , json: '{}') end end end
Fix bug which restricted viewing ace editor
diff --git a/lib/tasks/data.rake b/lib/tasks/data.rake index abc1234..def5678 100644 --- a/lib/tasks/data.rake +++ b/lib/tasks/data.rake @@ -0,0 +1,10 @@+namespace :data do + desc "Create sample Countries in the database" + task create_sample_data: :environment do + ["United States of America", "Canada", "Mexico"]. + each do |country_name| + Country.create name: country_name + end + end +end +
Add rake task to create sample countries
diff --git a/Casks/paraview-lion-python27-nightly.rb b/Casks/paraview-lion-python27-nightly.rb index abc1234..def5678 100644 --- a/Casks/paraview-lion-python27-nightly.rb +++ b/Casks/paraview-lion-python27-nightly.rb @@ -1,8 +1,10 @@ class ParaviewLionPython27Nightly < Cask + version 'latest' + sha256 :no_check + url 'http://www.paraview.org/paraview-downloads/download.php?submit=Download&version=nightly&type=binary&os=osx&downloadFile=ParaView-Darwin-64bit-Lion-Python27-NIGHTLY.dmg' homepage 'http://www.paraview.org/' - version 'latest' - sha256 :no_check + link 'paraview.app' caveats <<-EOS.undent This version of ParaView is for OS X Lion (10.7) or Mountain Lion (10.8)
Format Paraview Lion Python27 Nightly
diff --git a/lib/miq_automation_engine/service_models/miq_ae_service_manageiq-providers-amazon-storage_manager-s3.rb b/lib/miq_automation_engine/service_models/miq_ae_service_manageiq-providers-amazon-storage_manager-s3.rb index abc1234..def5678 100644 --- a/lib/miq_automation_engine/service_models/miq_ae_service_manageiq-providers-amazon-storage_manager-s3.rb +++ b/lib/miq_automation_engine/service_models/miq_ae_service_manageiq-providers-amazon-storage_manager-s3.rb @@ -0,0 +1,7 @@+module MiqAeMethodService + class MiqAeServiceManageIQ_Providers_Amazon_StorageManager_S3 < MiqAeServiceManageIQ_Providers_StorageManager + expose :parent_manager, :association => true + expose :cloud_object_store_containers, :association => true + expose :cloud_object_store_objects, :association => true + end +end
Add Amazon object storage automation model Automation service model required for Amazon object storage manager. (transferred from ManageIQ/manageiq@2937fff24789b3414b60d6879f43108ad723985e)
diff --git a/spec/unitwise/unit/expression_spec.rb b/spec/unitwise/unit/expression_spec.rb index abc1234..def5678 100644 --- a/spec/unitwise/unit/expression_spec.rb +++ b/spec/unitwise/unit/expression_spec.rb @@ -26,10 +26,10 @@ end it "should handle multiple terms" do - es = Unitwise::Unit::Expression.new("N/cm2").expressions + es = Unitwise::Unit::Expression.new("kN/cm2").expressions es.map(&:operator).must_equal ['/',nil] es.map(&:atom).must_equal ['N','m'] - es.map(&:prefix).must_equal [nil,'c'] + es.map(&:prefix).must_equal ['k','c'] es.map(&:exponent).must_equal [nil,'2'] end end
Fix specs to test prefixes for non-base units
diff --git a/spec/xclarity_client_discover_spec.rb b/spec/xclarity_client_discover_spec.rb index abc1234..def5678 100644 --- a/spec/xclarity_client_discover_spec.rb +++ b/spec/xclarity_client_discover_spec.rb @@ -10,16 +10,32 @@ end context 'with the correct appliance IPAddress' do - before do - @port = Faker::Number.number(4) - @address = URI('https://' + Faker::Internet.ip_v4_address + ':' + @port) - WebMock.allow_net_connect! - stub_request(:get, File.join(@address.to_s, '/aicc')).to_return(:status => [200, 'OK']) + context 'with response 200' do + before do + @port = Faker::Number.number(4) + @address = URI('https://' + Faker::Internet.ip_v4_address + ':' + @port) + WebMock.allow_net_connect! + stub_request(:get, File.join(@address.to_s, '/aicc')).to_return(:status => [200, 'OK']) + end + + it 'should return true' do + response = XClarityClient::Discover.responds?(@address.host, @port) + expect(response).to be_truthy + end end - it 'should return true' do - response = XClarityClient::Discover.responds?(@address.host, @port) - expect(response).to be_truthy + context 'with response 302' do + before do + @port = Faker::Number.number(4) + @address = URI('https://' + Faker::Internet.ip_v4_address + ':' + @port) + WebMock.allow_net_connect! + stub_request(:get, File.join(@address.to_s, '/aicc')).to_return(:status => [302, 'FOUND']) + end + + it 'should return true' do + response = XClarityClient::Discover.responds?(@address.host, @port) + expect(response).to be_truthy + end end end end
Update test cases for new responses
diff --git a/joomla/recipes/gitssh.rb b/joomla/recipes/gitssh.rb index abc1234..def5678 100644 --- a/joomla/recipes/gitssh.rb +++ b/joomla/recipes/gitssh.rb @@ -24,8 +24,8 @@ # Install the key for this repo -cookbook_file "#{KEYPATH}" do - source "keys/#{KEYNAME}" +remote_file "#{KEYPATH}" do + source "file:///vagrant/keys/#{KEYNAME}" owner GITUSER group GITUSER mode '0600'
Move key to /vagrant and install via remote_file
diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index abc1234..def5678 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -4,6 +4,7 @@ def github @developer = Authenticator.call(auth_hash) if @developer.persisted? + remember_me(@developer) sign_in @developer, event: :authentication redirect_to root_path else
Add remember me for omniauth
diff --git a/app/search/form_answer_status/assessor_filter.rb b/app/search/form_answer_status/assessor_filter.rb index abc1234..def5678 100644 --- a/app/search/form_answer_status/assessor_filter.rb +++ b/app/search/form_answer_status/assessor_filter.rb @@ -25,10 +25,6 @@ not_eligible: { label: "Not Eligible", states: [:not_eligible] - }, - withdrawn: { - label: "Withdrawn", - states: [:withdrawn] }, submitted: { label: "Submitted",
Remove withdrawn from filters for Assessor
diff --git a/sli/config/indexes/rmv-nindexes.rb b/sli/config/indexes/rmv-nindexes.rb index abc1234..def5678 100644 --- a/sli/config/indexes/rmv-nindexes.rb +++ b/sli/config/indexes/rmv-nindexes.rb @@ -22,7 +22,7 @@ indexes.keys.each do |index| crnt_index = indexes[index]["key"] if crnt_index != SHARD_KEY and crnt_index != ID_KEY - print "Removing index: " + print "Removing index: " + coll_name + " " puts crnt_index @coll.drop_index(index) end
Add collection name to printout.
diff --git a/postcode_software.gemspec b/postcode_software.gemspec index abc1234..def5678 100644 --- a/postcode_software.gemspec +++ b/postcode_software.gemspec @@ -12,6 +12,7 @@ s.add_dependency 'nokogiri', '~> 1.6' + s.add_development_dependency 'rake', '~> 12.0', '>= 12.0.0' s.add_development_dependency 'rspec', '~> 3.1' s.add_development_dependency 'sinatra', '~> 1.4' s.add_development_dependency 'webmock', '~> 3.0'
Add rake as a development dependency
diff --git a/spec/lib/extensions/ar_dba_spec.rb b/spec/lib/extensions/ar_dba_spec.rb index abc1234..def5678 100644 --- a/spec/lib/extensions/ar_dba_spec.rb +++ b/spec/lib/extensions/ar_dba_spec.rb @@ -0,0 +1,19 @@+describe "ar_dba extension" do + let(:connection) { ApplicationRecord.connection } + + describe "#primary_key?" do + it "returns false for a table without a primary key" do + table_name = "no_pk_test" + connection.select_value("CREATE TABLE #{table_name} (id INTEGER)") + expect(connection.primary_key?(table_name)).to be false + end + + it "returns true for a table with a primary key" do + expect(connection.primary_key?("miq_databases")).to be true + end + + it "returns true for composite primary keys" do + expect(connection.primary_key?("storages_vms_and_templates")).to be true + end + end +end
Add a spec for ar_dba https://trello.com/c/bRx6yN0C
diff --git a/spec/production/expression_spec.rb b/spec/production/expression_spec.rb index abc1234..def5678 100644 --- a/spec/production/expression_spec.rb +++ b/spec/production/expression_spec.rb @@ -1,10 +1,28 @@ require 'spec_helper' describe Calyx::Production::Expression do - specify 'construct string formatting production' do - nonterminal = double(:nonterminal) - allow(nonterminal).to receive(:evaluate).and_return([:atom, 'hello']) - rule = Calyx::Production::Expression.new(nonterminal, ['upcase']) + let(:production) do + double(:production) + end + + it 'evaluates a value' do + allow(production).to receive(:evaluate).and_return([:atom, 'hello']) + + rule = Calyx::Production::Expression.new(production, []) + expect(rule.evaluate).to eq([:expression, 'hello']) + end + + it 'evaluates a value with modifier' do + allow(production).to receive(:evaluate).and_return([:atom, 'hello']) + + rule = Calyx::Production::Expression.new(production, ['upcase']) expect(rule.evaluate).to eq([:expression, 'HELLO']) end + + it 'evaluates a value with modifier chain' do + allow(production).to receive(:evaluate).and_return([:atom, 'hello']) + + rule = Calyx::Production::Expression.new(production, ['upcase', 'squeeze']) + expect(rule.evaluate).to eq([:expression, 'HELO']) + end end
Tidy up expression spec to cover multiple cases
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 @@ -12,9 +12,17 @@ require 'blueprint' require 'add_query_counting_to_active_record' -WillPaginate.enable_activerecord if WillPaginate.respond_to?(:enable_activerecord) +require 'will_paginate/version' +if WillPaginate::VERSION::MAJOR < 3 + WillPaginate.enable_activerecord +else + require 'will_paginate/collection' + require 'will_paginate/finders/active_record' + WillPaginate::Finders::ActiveRecord.enable! +end + AridCache.init_rails Blueprint.seeds -ActiveRecord::Base.logger.info("#{"="*25} RUNNING UNIT TESTS #{"="*25}\n\t\t\t#{Time.now.to_s}\n#{"="*70}") +ActiveRecord::Base.logger && ActiveRecord::Base.logger.info("#{"="*25} RUNNING UNIT TESTS #{"="*25}\n\t\t\t#{Time.now.to_s}\n#{"="*70}") Array.class_eval { alias count size } if RUBY_VERSION < '1.8.7'
Fix WillPaginate ActiveRecord integration; Don't fail if the AR logger is nil
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 @@ -24,10 +24,13 @@ # load seeds load "#{Rails.root}/db/seeds.rb" + # proccess background jobs + Delayed::Worker.new.work_off + # set system mode to done / to activate Setting.set('system_init_done', true) - setup do + def setup # clear cache Cache.clear @@ -37,5 +40,15 @@ UserInfo.current_user_id = nil end + # cleanup jobs + def teardown + puts 'teardown' + + # check if jobs are proccessed + if !Delayed::Job.all.empty? + Delayed::Job.all.destroy_all + end + end + # Add more helper methods to be used by all tests here... end
Drop not needed bg job after test file has finished.
diff --git a/lib/csv_serialization.rb b/lib/csv_serialization.rb index abc1234..def5678 100644 --- a/lib/csv_serialization.rb +++ b/lib/csv_serialization.rb @@ -31,7 +31,7 @@ def to_csv(options = {}) raise "Not all elements respond to to_csv" unless all? { |e| e.respond_to? :to_csv } names = ActiveRecord::CsvSerializer.new(first, options).serializable_attribute_names - options[:include].each do |association| + options[:include].to_a.each do |association| names += Kernel.const_get(association.to_s.classify).column_names.map { |c| "#{association}_#{c}" } end CSV.generate_line(names) + "\n" +
Fix bug exporting families as csv file.