diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/spec/chefspec/matchers/file_spec.rb b/spec/chefspec/matchers/file_spec.rb index abc1234..def5678 100644 --- a/spec/chefspec/matchers/file_spec.rb +++ b/spec/chefspec/matchers/file_spec.rb @@ -22,5 +22,18 @@ end end end + + describe :create_remote_file do + describe "#match" do + let(:matcher) { create_remote_file('/tmp/foo') } + it "should not match when no resource with the expected path exists" do + matcher.matches?(:resources => [{:resource_name => 'remote_file', :path => '/tmp/bar', :action => 'create'}]).should be false + end + + it "should match when a remote file with the expected path exists" do + matcher.matches?(:resources => [{:resource_name => 'remote_file', :path => '/tmp/foo', :action => 'create'}]).should be true + end + end + end end -end+end
Add specs for matcher create_remote_file.
diff --git a/spec/factories/published_entries.rb b/spec/factories/published_entries.rb index abc1234..def5678 100644 --- a/spec/factories/published_entries.rb +++ b/spec/factories/published_entries.rb @@ -2,7 +2,7 @@ FactoryBot.define do factory :published_entry, class: PublishedEntry do transient do - type_name { nil } + type_name { 'paged' } end initialize_with do
Fix scrolled entry json seed spec Set `type_name` of `published_entry` factory to `paged`. Previous `nil` value caused error when trying to construct entry type specic config. REDMINE-17257
diff --git a/spec/features/post_creation_spec.rb b/spec/features/post_creation_spec.rb index abc1234..def5678 100644 --- a/spec/features/post_creation_spec.rb +++ b/spec/features/post_creation_spec.rb @@ -0,0 +1,28 @@+require 'rails_helper' + +describe "Post creation" do + before do + # Sign in + @user = User.create!(username: 'Larry', email: 'user@example.com', password: 'password', digest_subscriber: 'true') + visit '/sign_in' + fill_in 'Email', with: 'user@example.com' + fill_in 'Password', with: 'password' + click_button 'Sign in' + + # Go to posts page + visit '/posts/new' + + # Fill in form and submit + fill_in("Title", with: 'Some title') + fill_in("Body markdown", with: 'Example body') + click_button 'Create Post' + end + + it "shows a success message" do + expect(page).to have_content "Post was successfully created." + end + + it "creates a new post" do + expect(Post.exists?(title: 'Some title')).to be_truthy + end +end
Add test for creating new posts
diff --git a/spec/controllers/medicaid/sign_and_submit_controller_spec.rb b/spec/controllers/medicaid/sign_and_submit_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/medicaid/sign_and_submit_controller_spec.rb +++ b/spec/controllers/medicaid/sign_and_submit_controller_spec.rb @@ -14,6 +14,7 @@ medicaid_application = create( :medicaid_application, signature: "Hans Solo", + signed_at: nil, ) session[:medicaid_application_id] = medicaid_application.id
Add explicit nil in test setup when checking attribute change
diff --git a/lib/docs/scrapers/react_native.rb b/lib/docs/scrapers/react_native.rb index abc1234..def5678 100644 --- a/lib/docs/scrapers/react_native.rb +++ b/lib/docs/scrapers/react_native.rb @@ -3,7 +3,7 @@ self.name = 'React Native' self.slug = 'react_native' self.type = 'react' - self.release = '0.39' + self.release = '0.40' self.base_url = 'https://facebook.github.io/react-native/docs/' self.root_path = 'getting-started.html' self.links = { @@ -29,7 +29,7 @@ } options[:attribution] = <<-HTML - &copy; 2016 Facebook Inc.<br> + &copy; 2015&ndash;2017 Facebook Inc.<br> Licensed under the Creative Commons Attribution 4.0 International Public License. HTML end
Update React Native documentation (0.40)
diff --git a/spec/unit/puppet/functions/validate_ip_address_array_spec.rb b/spec/unit/puppet/functions/validate_ip_address_array_spec.rb index abc1234..def5678 100644 --- a/spec/unit/puppet/functions/validate_ip_address_array_spec.rb +++ b/spec/unit/puppet/functions/validate_ip_address_array_spec.rb @@ -0,0 +1,43 @@+# Rspec function: validate_ip_address_array +# +# This file is part of the test suite for the nsd module. +# +# === Authors +# +# Mario Finelli <mario@finel.li> +# +# === Copyright +# +# Copyright 2015 Mario Finelli +# +# 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 specific language governing permissions and +# limitations under the License. +# +require 'spec_helper' + +describe 'the validate_ip_address_array function' do + before :all do + Puppet::Parser::Functions.autoloader.loadall + end + + let(:scope) { PuppetlabsSpec::PuppetInternals.scope } + + it 'should exist' do + expect(Puppet::Parser::Functions.function('validate_ip_address_array')) + .to eq('function_validate_ip_address_array') + end + + it 'should raise a ParseError if there is less than 1 arguments' do + expect { scope.function_validate_ip_address_array([]) } + .to(raise_error(Puppet::ParseError)) + end +end
Add unit tests for validate_ip_address_array
diff --git a/puppet-lint-no_symbolic_file_modes-check.gemspec b/puppet-lint-no_symbolic_file_modes-check.gemspec index abc1234..def5678 100644 --- a/puppet-lint-no_symbolic_file_modes-check.gemspec +++ b/puppet-lint-no_symbolic_file_modes-check.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |spec| spec.name = 'puppet-lint-no_symbolic_file_modes-check' - spec.version = '1.0.1' + spec.version = '1.0.2' spec.homepage = 'https://github.com/deanwilson/puppet-lint-no_symbolic_file_modes-check' spec.license = 'MIT' spec.author = 'Dean Wilson' @@ -18,7 +18,7 @@ values and not symbolic ones. EOF - spec.add_dependency 'puppet-lint', '~> 1.1' + spec.add_dependency 'puppet-lint', '>= 1.1', '< 3.0' spec.add_development_dependency 'rspec', '~> 3.0' spec.add_development_dependency 'rspec-its', '~> 1.0' spec.add_development_dependency 'rspec-collection_matchers', '~> 1.0'
Allow puppet-lint 2.0 as a dependency and bump check version
diff --git a/test/test_samples.rb b/test/test_samples.rb index abc1234..def5678 100644 --- a/test/test_samples.rb +++ b/test/test_samples.rb @@ -1,4 +1,6 @@ require 'linguist/samples' +require 'tempfile' +require 'yajl' require 'test/unit' @@ -12,6 +14,19 @@ # Just warn, it shouldn't scare people off by breaking the build. if serialized['md5'] != latest['md5'] warn "Samples database is out of date. Run `bundle exec rake samples`." + + expected = Tempfile.new('expected.json') + expected.write Yajl::Encoder.encode(serialized, :pretty => true) + expected.close + + actual = Tempfile.new('actual.json') + actual.write Yajl::Encoder.encode(latest, :pretty => true) + actual.close + + warn `diff #{expected.path} #{actual.path}` + + expected.unlink + actual.unlink end end
Print out samples db diffs
diff --git a/lib/metacrunch/redis/queue_writer.rb b/lib/metacrunch/redis/queue_writer.rb index abc1234..def5678 100644 --- a/lib/metacrunch/redis/queue_writer.rb +++ b/lib/metacrunch/redis/queue_writer.rb @@ -6,6 +6,8 @@ def initialize(redis_connection_or_url, queue_name, options = {}) @queue_name = queue_name raise ArgumentError, "queue_name must be a string" unless queue_name.is_a?(String) + + @save_on_close = options.delete(:save_on_close) || true @redis = if redis_connection_or_url.is_a?(String) ::Redis.new(url: redis_connection_or_url) @@ -19,7 +21,10 @@ end def close - @redis.close if @redis + if @redis + @redis.bgsave if @save_on_close + @redis.close + end end end
Save redis before the writer closes the connection. Can be disabled with save_on_close: false.
diff --git a/lib/refinery/elasticsearch/result.rb b/lib/refinery/elasticsearch/result.rb index abc1234..def5678 100644 --- a/lib/refinery/elasticsearch/result.rb +++ b/lib/refinery/elasticsearch/result.rb @@ -16,7 +16,7 @@ end def record - @record ||= klass.where(id:@result['_id']).first + @record ||= klass.find(@result['_id']) rescue nil end # Delegate methods to `@result` or `@result._source`
Use find instead of where
diff --git a/lib/utracker/logger/stdout_logger.rb b/lib/utracker/logger/stdout_logger.rb index abc1234..def5678 100644 --- a/lib/utracker/logger/stdout_logger.rb +++ b/lib/utracker/logger/stdout_logger.rb @@ -5,21 +5,14 @@ protected def write(event) - puts [ - event.datetime.to_s, - event.service, - event.description, - event.message.uuid, - serialized_content(event.message.content), - ].join(' ; ') - end - - def serialized_content(content) - case content - when String then content - when Hash, Array then MultiJson.dump(content) - else fail "Message content of type '#{content.class}' are not supported." - end + STDOUT.puts MultiJson.dump({ + datetime: event.datetime.to_s, + service: event.service, + description: event.description, + uuid: event.message.uuid, + parent_uuid: event.message.parent_uuid, + payload: event.message.content, + }) end end
Make the StdoutLogger output JSON.
diff --git a/lib/bugsnag/delivery/thread_queue.rb b/lib/bugsnag/delivery/thread_queue.rb index abc1234..def5678 100644 --- a/lib/bugsnag/delivery/thread_queue.rb +++ b/lib/bugsnag/delivery/thread_queue.rb @@ -5,10 +5,12 @@ class ThreadQueue < Synchronous MAX_OUTSTANDING_REQUESTS = 100 STOP = Object.new - + MUTEX = Mutex.new class << self def deliver(url, body, configuration) + start_once! + if queue.length > MAX_OUTSTANDING_REQUESTS Bugsnag.warn("Dropping notification, #{queue.length} outstanding requests") return @@ -22,26 +24,28 @@ attr_reader :queue - def start! - @queue = Queue.new + def start_once! + MUTEX.synchronize do + return if @started + @started = true - worker_thread = Thread.new do - while x = queue.pop - break if x == STOP - x.call + @queue = Queue.new + + worker_thread = Thread.new do + while x = queue.pop + break if x == STOP + x.call + end end - end - at_exit do - Bugsnag.warn("Waiting for #{queue.length} outstanding request(s)") unless queue.empty? - queue.push STOP - worker_thread.join + at_exit do + Bugsnag.warn("Waiting for #{queue.length} outstanding request(s)") unless queue.empty? + queue.push STOP + worker_thread.join + end end end end - - # do this once at require time to avoid race conditions - start! end end end
Fix thread-queue delivery method under puma --preload
diff --git a/examples/enum_select.rb b/examples/enum_select.rb index abc1234..def5678 100644 --- a/examples/enum_select.rb +++ b/examples/enum_select.rb @@ -0,0 +1,7 @@+# encoding: utf-8 + +require 'tty-prompt' + +prompt = TTY::Prompt.new +choices = %w(/bin/nano /usr/bin/vim.basic /usr/bin/vim.tiny) +prompt.enum_select('Select an editor', choices, default: 2)
Add example of enumerated selection.
diff --git a/spec/dummy/app/controllers/welcome_controller.rb b/spec/dummy/app/controllers/welcome_controller.rb index abc1234..def5678 100644 --- a/spec/dummy/app/controllers/welcome_controller.rb +++ b/spec/dummy/app/controllers/welcome_controller.rb @@ -1,5 +1,5 @@ class WelcomeController < ApplicationController - skip_before_filter :authenticate_user!, only: [:index] + skip_before_action :authenticate_user!, only: [:index] def index end
Fix Rails 5 deprecation warning for skip_before_action DEPRECATION WARNING: `skip_before_filter` is deprecated and will be removed in Rails 5.1. Use `skip_before_action` instead.
diff --git a/spec/st_scenario_spec.rb b/spec/st_scenario_spec.rb index abc1234..def5678 100644 --- a/spec/st_scenario_spec.rb +++ b/spec/st_scenario_spec.rb @@ -19,7 +19,7 @@ describe "#end_scenario" do it "returns true" do - @st.begin_scenario.should be_true + @st.end_scenario.should be_true end end end
Use end_scenario in the end_scenario spec
diff --git a/lib/git_day_one/day_one_formatter.rb b/lib/git_day_one/day_one_formatter.rb index abc1234..def5678 100644 --- a/lib/git_day_one/day_one_formatter.rb +++ b/lib/git_day_one/day_one_formatter.rb @@ -0,0 +1,30 @@+module GitDayOne + class DayOneFormatter + attr_accessor :commits, :project + + def initialize(project, commits) + @project = project + @commits = commits + end + + def get_message + <<-eos +project : #{project} +commits : #{commits.length} +additions : #{commits.inject(0) {|sum, commit| sum + commit.additions}} +deletions : #{commits.inject(0) {|sum, commit| sum + commit.deletions}} + +commit messages : +#{ commit_messages } + eos + end + + def commit_messages + commits.reverse.map { |c| additions_del_string(c) + " " + c.date.strftime("%H:%M") + "\t" + c.msg_body.join("\n") }.join("\n") + end + + def additions_del_string(commit) + "+#{commit.additions} | -#{commit.deletions}" + end + end +end
Add day one message formatter
diff --git a/lib/linkedcare/connection/handler.rb b/lib/linkedcare/connection/handler.rb index abc1234..def5678 100644 --- a/lib/linkedcare/connection/handler.rb +++ b/lib/linkedcare/connection/handler.rb @@ -47,7 +47,7 @@ begin subscriber.handler.call(meta, data) rescue Exception => e - log_error("FAILED SUBSCRIBER: Queue [ #{queue} ] Payload [ #{data} ] ") + log_error("FAILED SUBSCRIBER: Subscriber [ #{subscriber} ] Payload [ #{data} ] ", e) ensure meta.ack end
Add Exception to log when fail
diff --git a/lib/letter_opener/delivery_method.rb b/lib/letter_opener/delivery_method.rb index abc1234..def5678 100644 --- a/lib/letter_opener/delivery_method.rb +++ b/lib/letter_opener/delivery_method.rb @@ -22,7 +22,7 @@ location = File.join(settings[:location], "#{Time.now.to_f.to_s.tr('.', '_')}_#{Digest::SHA1.hexdigest(mail.encoded)[0..6]}") messages = Message.rendered_messages(mail, location: location, message_template: settings[:message_template]) - Launchy.open("#{settings[:file_uri_scheme]}#{messages.first.filepath}") + ::Launchy.open("#{settings[:file_uri_scheme]}#{messages.first.filepath}") end private
Make sure that global Launchy constant is used.
diff --git a/lib/puppet/provider/oratab/parsed.rb b/lib/puppet/provider/oratab/parsed.rb index abc1234..def5678 100644 --- a/lib/puppet/provider/oratab/parsed.rb +++ b/lib/puppet/provider/oratab/parsed.rb @@ -27,7 +27,7 @@ }, :to_line => proc { |h| str = "#{h[:name]}:#{h[:home]}:#{h[:atboot]}" - if h[:description] and h[:description] != :absent + if description = h[:description] and description != :absent and !description.empty? str += " # #{description}" end str
Remove comment if description is empty If the description property is an empty string puppet should remove the comment sign (#) alltogether
diff --git a/lib/simple-api-auth/authenticator.rb b/lib/simple-api-auth/authenticator.rb index abc1234..def5678 100644 --- a/lib/simple-api-auth/authenticator.rb +++ b/lib/simple-api-auth/authenticator.rb @@ -1,6 +1,6 @@ module SimpleApiAuth class Authenticator - include RequestHelpers + include ::SimpleApiAuth::RequestHelpers attr_accessor :request, :headers, :http_verb, :signer
Fix incompatibility between Ruby versions.
diff --git a/lib/cached_resource.rb b/lib/cached_resource.rb index abc1234..def5678 100644 --- a/lib/cached_resource.rb +++ b/lib/cached_resource.rb @@ -9,12 +9,12 @@ module CachedResource - # Switch caching off + # Switch cache usage off def self.off! self.config.cache_enabled = false end - # Switch caching on + # Switch cache usage on def self.on! self.config.cache_enabled = true end
Clarify comments for on! and off! methods
diff --git a/lib/thunder_punch/recipes/bundler.rb b/lib/thunder_punch/recipes/bundler.rb index abc1234..def5678 100644 --- a/lib/thunder_punch/recipes/bundler.rb +++ b/lib/thunder_punch/recipes/bundler.rb @@ -5,7 +5,7 @@ desc "Install and lock bundle" task :bundle, :roles => bundler_roles do _cset(:excluded_gem_file_groups) { [:development, :test] } - excluded_groups = gem_file_groups.reject{|e| e == rails_env.to_sym}.each{|g| g.to_s}.join(' ') + excluded_groups = excluded_gem_file_groups.reject{|e| e == rails_env.to_sym}.each{|g| g.to_s}.join(' ') run "cd #{current_path} && bundle install --deployment --without #{excluded_groups}" end end
Fix bug caused by use of wrong variable
diff --git a/db/migrate/20180417101940_add_index_to_ci_stage.rb b/db/migrate/20180417101940_add_index_to_ci_stage.rb index abc1234..def5678 100644 --- a/db/migrate/20180417101940_add_index_to_ci_stage.rb +++ b/db/migrate/20180417101940_add_index_to_ci_stage.rb @@ -4,6 +4,6 @@ DOWNTIME = false def change - add_column :ci_stages, :index, :integer + add_column :ci_stages, :index, :integer, limit: 2 end end
Use smallint for stage index column
diff --git a/lib/history_tracker.rb b/lib/history_tracker.rb index abc1234..def5678 100644 --- a/lib/history_tracker.rb +++ b/lib/history_tracker.rb @@ -37,6 +37,7 @@ end def current_modifier=(value) + return unless value config_store[:current_modifier] = value.attributes.slice(*current_user_fields) end end
Fix when there is no current_user
diff --git a/lib/lj_media/author.rb b/lib/lj_media/author.rb index abc1234..def5678 100644 --- a/lib/lj_media/author.rb +++ b/lib/lj_media/author.rb @@ -39,7 +39,7 @@ # @param userid LiveJournal user id # @param username LiveJournal username # - # **TODO**: parse detailed user info from his profile page + # @todo parse detailed user info from his profile page Contract Integer, String => Any def initialize(userid, username) @id = userid
Use @todo in Author doc instead of **TODO** text [skip ci]
diff --git a/lib/localdoc/engine.rb b/lib/localdoc/engine.rb index abc1234..def5678 100644 --- a/lib/localdoc/engine.rb +++ b/lib/localdoc/engine.rb @@ -2,8 +2,6 @@ require "rails" require "action_view" require "haml" -require "bourbon" -require "neat" module Localdoc class Engine < ::Rails::Engine @@ -16,7 +14,7 @@ end initializer "localdoc.assets.precompile" do |app| - app.config.assets.precompile += %w(localdoc/application.css localdoc/bundle.js) + app.config.assets.precompile += %w(localdoc/bundle.js) end end end
Complete the migration to webpack
diff --git a/lib/maildrop/client.rb b/lib/maildrop/client.rb index abc1234..def5678 100644 --- a/lib/maildrop/client.rb +++ b/lib/maildrop/client.rb @@ -26,7 +26,7 @@ end def share(path) - @client.share(path) + @client.shares(path) end private
Reword to shares not share
diff --git a/test/test_cmd_ls.rb b/test/test_cmd_ls.rb index abc1234..def5678 100644 --- a/test/test_cmd_ls.rb +++ b/test/test_cmd_ls.rb @@ -20,13 +20,13 @@ { 'Name' => 'foo.txt', 'Hash' => 'QmTz3oc4gdpRMKP2sdGUPZTAGRngqjsi99BPoztyP53JMM', - 'Size' => 12, + 'Size' => 4, 'Type' => 2 }, { 'Name' => 'hello.txt', 'Hash' => 'QmfM2r8seH2GiRaC4esTjeraXEachRt8ZsSeGaWTPLyMoG', - 'Size' => 21, + 'Size' => 13, 'Type' => 2 } ]
Adjust the expectation of a unit test to the changed behavior Since version 0.4.19 "ipfs ls" is reporting files size rather than DAG size, see https://github.com/ipfs/go-ipfs/blob/master/CHANGELOG.md#-file-listing
diff --git a/lib/soulmate/server.rb b/lib/soulmate/server.rb index abc1234..def5678 100644 --- a/lib/soulmate/server.rb +++ b/lib/soulmate/server.rb @@ -23,11 +23,12 @@ limit = (params[:limit] || 5).to_i types = params[:types].map { |t| normalize(t) } term = params[:term] - + cache = params[:cache] != "false" + results = {} types.each do |type| matcher = Matcher.new(type) - results[type] = matcher.matches_for_term(term, :limit => limit) + results[type] = matcher.matches_for_term(term, limit: limit, cache: cache) end MultiJson.encode({
Allow cache-busting via query params
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 @@ -5,7 +5,7 @@ add_filter 'bundle|vendor' end -require File.expand_path('../../config/environment', __FILE__) +require File.expand_path('../config/environment', __dir__) require 'rails/test_help' require 'mocha/mini_test'
Modify to pass rubocop 0.53.0
diff --git a/Library/Homebrew/os/linux/hardware.rb b/Library/Homebrew/os/linux/hardware.rb index abc1234..def5678 100644 --- a/Library/Homebrew/os/linux/hardware.rb +++ b/Library/Homebrew/os/linux/hardware.rb @@ -11,30 +11,37 @@ def arch_64_bit; :x86_64; end def universal_archs; [].extend ArchitectureListExtension; end + def cpuinfo + @cpuinfo ||= File.read("/proc/cpuinfo") + end + def type - @cpu_type ||= case `uname -m` - when /i[3-6]86/, /x86_64/ - :intel - else - :dunno - end + @type ||= if cpuinfo =~ /Intel|AMD/ + :intel + else + :dunno + end end def family - :dunno + cpuinfo[/^cpu family\s*: ([0-9]+)/, 1].to_i end alias_method :intel_family, :family def cores - `grep -c ^processor /proc/cpuinfo`.to_i + cpuinfo.scan(/^processor/).size end + + def flags + @flags ||= cpuinfo[/^flags.*/, 0].split + end + + %w[aes altivec avx avx2 lm sse3 ssse3 sse4 sse4_2].each { |flag| + define_method(flag + "?") { flags.include? flag } + } + alias_method :is_64_bit?, :lm? def bits is_64_bit? ? 64 : 32 end - - def is_64_bit? - return @is_64_bit if defined? @is_64_bit - @is_64_bit = /64/ === `uname -m` - end end
Linuxbrew: Read CPU flags from /proc/cpuinfo Closes #29895. Signed-off-by: Mike McQuaid <a17fed27eaa842282862ff7c1b9c8395a26ac320@mikemcquaid.com>
diff --git a/flexpaper-rails.gemspec b/flexpaper-rails.gemspec index abc1234..def5678 100644 --- a/flexpaper-rails.gemspec +++ b/flexpaper-rails.gemspec @@ -16,5 +16,5 @@ s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"] s.add_dependency "rails", "~> 3.2.0" - # s.add_dependency "jquery-rails" + s.add_dependency "jquery-rails" end
Add query as a dep
diff --git a/lib/tasks/sidekiq.rake b/lib/tasks/sidekiq.rake index abc1234..def5678 100644 --- a/lib/tasks/sidekiq.rake +++ b/lib/tasks/sidekiq.rake @@ -6,7 +6,7 @@ # sidekiq is already running, don't need to run if Sidekiq::ProcessSet.new.size == 0 ss = Sidekiq::ScheduledSet.new - if ss.first.at < Time.now + if ss.first.try { |job| job.at < Time.now } exec "bundle exec sidekiq" end end
Handle case when ScheduledSet is empty
diff --git a/db/migrate/20090316132151_disable_file_types.rb b/db/migrate/20090316132151_disable_file_types.rb index abc1234..def5678 100644 --- a/db/migrate/20090316132151_disable_file_types.rb +++ b/db/migrate/20090316132151_disable_file_types.rb @@ -3,7 +3,7 @@ Radiant::Config['assets.skip_filetype_validation'] = true puts "-- Setting default content types in Radiant::Config" if defined? SettingsExtension && Radiant::Config.column_names.include?('description') - Config.find(:all).each do |c| + Radiant::Config.find(:all).each do |c| description = case c.key when 'assets.skip_filetype_validations' 'When set to true, disables the filetype validations. Set to false to enable them.'
Fix migration by prefixing the Config module with Radiant Signed-off-by: Keith BIngman <0ccc0848a69a0c9f60128cfc9721e973b7acd43f@keithbingman.com>
diff --git a/db/migrate/20100322160212_delete_in_progress.rb b/db/migrate/20100322160212_delete_in_progress.rb index abc1234..def5678 100644 --- a/db/migrate/20100322160212_delete_in_progress.rb +++ b/db/migrate/20100322160212_delete_in_progress.rb @@ -8,6 +8,16 @@ end end Status.find_all_by_name("in progress").each{|s| s.destroy} + puts '='*80 + TaskFilter.all.each do |filter| + filter.qualifiers.for("Status").each do |qualifier| + unless filter.company.statuses.find_by_id(qualifier.qualifiable_id) + puts "Filter #{filter.id} : change status qualifier from in progress to open" + qualifier.qualifiable_id=filter.company.statuses.find_by_name("Open").id + qualifier.save! + end + end + end end def self.down
Change migration from "In Progress" to "Open". Change task filter qualifiers for status from "In Progress" to "Open"
diff --git a/db/migrate/20170428031949_add_admin_to_users.rb b/db/migrate/20170428031949_add_admin_to_users.rb index abc1234..def5678 100644 --- a/db/migrate/20170428031949_add_admin_to_users.rb +++ b/db/migrate/20170428031949_add_admin_to_users.rb @@ -1,5 +1,5 @@ class AddAdminToUsers < ActiveRecord::Migration[5.0] def change - add_column :users, :admin, :boolean + add_column :users, :admin, :boolean, default: false end end
Add admin status to false by default when creating a user
diff --git a/spec/lita/adapters/shell_spec.rb b/spec/lita/adapters/shell_spec.rb index abc1234..def5678 100644 --- a/spec/lita/adapters/shell_spec.rb +++ b/spec/lita/adapters/shell_spec.rb @@ -1,7 +1,20 @@ describe Lita::Adapters::Shell do - let(:robot) { double("Robot") } + let(:robot) do + robot = double("Robot") + allow(robot).to receive(:name).and_return("Lita") + robot + end subject { described_class.new(robot) } + + describe "#run" do + it "passes input to the Robot and breaks on an exit message" do + expect(subject).to receive(:print).with("#{robot.name} > ").twice + allow(subject).to receive(:gets).and_return("foo", "exit") + expect(robot).to receive(:receive).with("foo") + subject.run + end + end describe "#say" do it "prints its input" do
Add coverage for Shell adapter's run method.
diff --git a/spec/mailers/game_mailer_spec.rb b/spec/mailers/game_mailer_spec.rb index abc1234..def5678 100644 --- a/spec/mailers/game_mailer_spec.rb +++ b/spec/mailers/game_mailer_spec.rb @@ -9,10 +9,6 @@ it "sends email to member" do expect(mailer).to deliver_to(member.email) - end - - it "sends email from uro" do - expect(mailer).to be_delivered_from('uro@fantasygame.pl') end it "has right subject" do
Remove email check in game mailer spec
diff --git a/spec/mailers/user_mailer_spec.rb b/spec/mailers/user_mailer_spec.rb index abc1234..def5678 100644 --- a/spec/mailers/user_mailer_spec.rb +++ b/spec/mailers/user_mailer_spec.rb @@ -5,14 +5,14 @@ before do user = create(:user) - Spree::UserMailer.reset_password_instructions(user, 'token goes here').deliver + Spree::UserMailer.reset_password_instructions(user, 'token goes here').deliver_later @message = ActionMailer::Base.deliveries.last end describe '#reset_password_instructions' do describe 'message contents' do before do - described_class.reset_password_instructions(user, 'token goes here').deliver + described_class.reset_password_instructions(user, 'token goes here').deliver_later @message = ActionMailer::Base.deliveries.last end @@ -38,7 +38,7 @@ describe 'legacy support for User object' do it 'sends an email' do expect { - described_class.reset_password_instructions(user, 'token goes here').deliver + described_class.reset_password_instructions(user, 'token goes here').deliver_later }.to change(ActionMailer::Base.deliveries, :size).by(1) end end
Use deliver_later to fix deprecation.
diff --git a/lib/picturelife/base.rb b/lib/picturelife/base.rb index abc1234..def5678 100644 --- a/lib/picturelife/base.rb +++ b/lib/picturelife/base.rb @@ -16,7 +16,7 @@ end def authenticated? - @access_token + !! @access_token end def reset_configuration!
Fix authenticated? to return boolean
diff --git a/app/admin/dashboards.rb b/app/admin/dashboards.rb index abc1234..def5678 100644 --- a/app/admin/dashboards.rb +++ b/app/admin/dashboards.rb @@ -1,38 +1,33 @@-ActiveAdmin::Dashboards.build do +ActiveAdmin.register_page "Dashboard" do - # Define your dashboard sections here. Each block will be - # rendered on the dashboard in the context of the view. So just - # return the content which you would like to display. - - # == Simple Dashboard Section - # Here is an example of a simple dashboard section - # - # section "Recent Posts" do - # ul do - # Post.recent(5).collect do |post| - # li link_to(post.title, admin_post_path(post)) - # end - # end - # end - - # == Render Partial Section - # The block is rendered within the context of the view, so you can - # easily render a partial rather than build content in ruby. - # - # section "Recent Posts" do - # div do - # render 'recent_posts' # => this will render /app/views/admin/dashboard/_recent_posts.html.erb - # end - # end - - # == Section Ordering - # The dashboard sections are ordered by a given priority from top left to - # bottom right. The default priority is 10. By giving a section numerically lower - # priority it will be sorted higher. For example: - # - # section "Recent Posts", :priority => 10 - # section "Recent User", :priority => 1 - # - # Will render the "Recent Users" then the "Recent Posts" sections on the dashboard. + menu :priority => 1, :label => proc{ I18n.t("active_admin.dashboard") } -end + content :title => proc{ I18n.t("active_admin.dashboard") } do + div :class => "blank_slate_container", :id => "dashboard_default_message" do + span :class => "blank_slate" do + span I18n.t("active_admin.dashboard_welcome.welcome") + small I18n.t("active_admin.dashboard_welcome.call_to_action") + end + end + + # Here is an example of a simple dashboard with columns and panels. + # + # columns do + # column do + # panel "Recent Posts" do + # ul do + # Post.recent(5).map do |post| + # li link_to(post.title, admin_post_path(post)) + # end + # end + # end + # end + + # column do + # panel "Info" do + # para "Welcome to ActiveAdmin." + # end + # end + # end + end # content +end
Remove old style ActiveAdmin::Dashboard, use ActiveAdmin.register_page "Dashboard"
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -13,4 +13,9 @@ hard_music = FactoryGirl.create :hard_music FactoryGirl.create(:music_user, music: hard_music, user: user) end + + 10.times do + f = FactoryGirl.create(:friend) + FactoryGirl.create(:friend_user, friend: f, user: user) + end end
Add seed data(user has many friends)
diff --git a/_rake/start_jekyll.rake b/_rake/start_jekyll.rake index abc1234..def5678 100644 --- a/_rake/start_jekyll.rake +++ b/_rake/start_jekyll.rake @@ -4,5 +4,17 @@ port = ENV['port'] || '4000' trace = ENV['trace'] == 'true' ? '--trace' : '' detach = ENV['detach'] == 'true' ? '--detach' : '' + + # Set active code page to avoid encoding issues on Windows + case ENV['os'].downcase + when '', 'linux' + os = 'linux' + when 'win', 'windows' + os = 'windows' + end + if os == 'windows' + system 'chcp 65001' + end + system "jekyll serve --watch --drafts --port=#{port} #{trace} #{detach}" end
Set active code page on Windows to avoid encoding issues
diff --git a/test/integration/ap_setup/rspec/ap_setup_spec.rb b/test/integration/ap_setup/rspec/ap_setup_spec.rb index abc1234..def5678 100644 --- a/test/integration/ap_setup/rspec/ap_setup_spec.rb +++ b/test/integration/ap_setup/rspec/ap_setup_spec.rb @@ -0,0 +1,58 @@+require 'spec_helper' +require 'json' + +describe 'ap_setup' do + chef_run = ChefSpec::SoloRunner.new + + before(:all) do + chef_run.node.normal_attrs = property[:chef_attributes] + chef_run.converge('role[ap_setup]') + end + + it 'is installed git package' do + expect(package('git')).to be_installed + end + + it 'is installed gcc package' do + expect(package('gcc')).to be_installed + end + + it 'is installed gcc-c++ package' do + expect(package('gcc-c++')).to be_installed + end + + it 'is installed make package' do + expect(package('make')).to be_installed + end + + it 'is installed mysql-community-devel package' do + expect(package('mysql-community-devel')).to be_installed + end + + it 'is installed sqlite-devel package' do + expect(package('sqlite-devel')).to be_installed + end + + it 'is installed ruby' do + expect(command('source /etc/profile.d/rbenv.sh; ruby -v').stdout).to match(/#{chef_run.node['rails_part']['ruby']['version']}/) + end + + it 'is installed bundler gem' do + expect(command('source /etc/profile.d/rbenv.sh; gem list').stdout).to match(/bundler/) + end + + it 'is installed bundler gem' do + expect(command('source /etc/profile.d/rbenv.sh; gem list').stdout).to match(/ruby-shadow/) + end + + it 'is create rails group' do + expect(group(chef_run.node['rails_part']['user']['group'])).to exist + end + + it 'is create rails user' do + expect(user(chef_run.node['rails_part']['user']['name'])) + .to exist + .and have_home_directory("/home/#{chef_run.node['rails_part']['user']['name']}") + .and belong_to_group(chef_run.node['rails_part']['user']['group']) + end +end
Add ap_setup spec of integration test of test-kicthen
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.3.0.0' + s.version = '0.4.0.0' s.summary = 'HTTP Client for EventStore' s.description = ' '
Package version is increased from 0.3.0.0 to 0.4.0.0
diff --git a/spec/acceptance/documentation_spec.rb b/spec/acceptance/documentation_spec.rb index abc1234..def5678 100644 --- a/spec/acceptance/documentation_spec.rb +++ b/spec/acceptance/documentation_spec.rb @@ -0,0 +1,27 @@+require "json" +require "net/http" +require "uri" + +RSpec.describe "neovim-ruby documentation" do + it "has up-to-date generated method docs" do + begin + latest_release_uri = URI.parse( + "https://api.github.com/repos/neovim/neovim/releases/latest" + ) + response = JSON.parse( + Net::HTTP.get_response(latest_release_uri).body + ) + client_file = File.read( + File.expand_path("../../../lib/neovim/client.rb", __FILE__) + ) + docs_version = client_file[ + /The methods documented here were generated using (.+)$/, + 1 + ] + + expect(docs_version).to eq(response["name"]) + rescue SocketError => e + skip "Skipping: #{e}" + end + end +end
Add acceptance test around stale generated docs
diff --git a/active_importer.gemspec b/active_importer.gemspec index abc1234..def5678 100644 --- a/active_importer.gemspec +++ b/active_importer.gemspec @@ -10,7 +10,7 @@ spec.email = ["gnapse@gmail.com"] spec.description = %q{Import tabular data from spreadsheets or similar sources into data models} spec.summary = %q{Import tabular data into data models} - spec.homepage = "" + spec.homepage = "http://continuum.github.io/active_importer/" spec.license = "MIT" spec.files = `git ls-files`.split($/)
Add homepage url to gemspec
diff --git a/spec/features/events_features_spec.rb b/spec/features/events_features_spec.rb index abc1234..def5678 100644 --- a/spec/features/events_features_spec.rb +++ b/spec/features/events_features_spec.rb @@ -31,11 +31,11 @@ page.should have_content "standalone" end - pending "should show the output for an event" do + it "should show the output for an event", :js => true do page.body.should have_content "i-424242 true" end - pending "should show time since issued for an event" do + it "should show time since issued for an event", :js => true do page.should have_content time_ago_in_words(Time.at(1364343741)) end
Fix pending specs in events features
diff --git a/spec/session/remote_mechanize_spec.rb b/spec/session/remote_mechanize_spec.rb index abc1234..def5678 100644 --- a/spec/session/remote_mechanize_spec.rb +++ b/spec/session/remote_mechanize_spec.rb @@ -35,7 +35,7 @@ end end - # Pending: Still 90 (and before the update of capybara to 0.4.0 16) failing tests here (result is 702 examples, 90 failures, instead of 381 examples) + # Pending: Still 18 failing tests here (result is 705 examples, 18 failures, instead of 384 examples) # it_should_behave_like "session" it_should_behave_like "session without javascript support"
Update comment about failing specs, also need to find out why there are less failures now
diff --git a/spec/sub_diff/diff_collection_spec.rb b/spec/sub_diff/diff_collection_spec.rb index abc1234..def5678 100644 --- a/spec/sub_diff/diff_collection_spec.rb +++ b/spec/sub_diff/diff_collection_spec.rb @@ -12,7 +12,10 @@ end def diff(value) - double('diff', changed?: false, empty?: value.empty?, to_s: value) + double 'diff', changed?: false, + empty?: value.empty?, + to_s: value, + to_str: value end describe '#changed?' do
Add `to_str` double mock for `Diff` objects Fixes `Double "diff" received unexpected message :to_str with (no args)` from `DiffCollection` specs.
diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb index abc1234..def5678 100644 --- a/app/models/blog_post.rb +++ b/app/models/blog_post.rb @@ -10,13 +10,9 @@ title = self.title slug = title.gsub(/[^a-zA-Z\d\s]/, '').gsub(' ', '-').downcase - # TODO: revisit the following logic once the redirects table is - # implemented to account for the fact that a blog post's slug - # could have been changed but also exist in the redirects table. - # This looks for slugs that look like #{current-slug}-2 so we # can change our slug for this post to increment the end digit. - existing_posts_with_incremented_slug = ActiveRecord::Base.connection.execute("SELECT slug FROM blog_posts WHERE slug ~* '#{slug}-\\d$';").to_a.map{ |h| h['slug'] } + existing_posts_with_incremented_slug = ActiveRecord::Base.connection.execute("SELECT slug FROM blog_posts WHERE slug ~* '#{slug}-\\d$';").to_a.map{ |h| h['slug'] } if existing_posts_with_incremented_slug.any? incremented_values = existing_posts_with_incremented_slug.map do |incremented_slug| incremented_slug.gsub("#{slug}-", '').to_i
Change mind about redirect functionality, do not let people edit slugs
diff --git a/app/models/tent/site.rb b/app/models/tent/site.rb index abc1234..def5678 100644 --- a/app/models/tent/site.rb +++ b/app/models/tent/site.rb @@ -5,6 +5,7 @@ validates :title, :path, presence: true validates :path, length: { maximum: 50 } validates :path, format: { with: /\A(?:\p{Hiragana}|\p{Katakana}|[ー-]|[一-龠々]|[a-z0-9_-])+\z/ } + validates :path, exclusion: { in: Tent::Site::RESERVED_PATHS } before_validation :replace_control_characters @@ -12,7 +13,6 @@ path.downcase! path.strip! end - after_create :insert_index_page @@ -25,5 +25,7 @@ def replace_control_characters path.gsub! /[[:cntrl:]]/, " " end + + end end
Use Tent::Site::RESERVED_PATHS when validate path
diff --git a/ar-audit-tracer.gemspec b/ar-audit-tracer.gemspec index abc1234..def5678 100644 --- a/ar-audit-tracer.gemspec +++ b/ar-audit-tracer.gemspec @@ -13,9 +13,7 @@ s.summary = %q{Track creator/modifiers of you AR Models similar to timestamps.} s.description = %q{Handles ActiveRecord authors in the same way as timstamps.} - s.add_dependency "activerecord", "~> 4.0" - - s.add_development_dependency "activerecord", "~> 4.0" + s.add_runtime_dependency "activerecord", "~> 4.0", "~> 4.0" s.add_development_dependency "sqlite3" s.rdoc_options << '--charset' << 'UTF-8' << '--line-numbers'
Remove duplicate dependency on activerecord
diff --git a/time_guarded_run.rb b/time_guarded_run.rb index abc1234..def5678 100644 --- a/time_guarded_run.rb +++ b/time_guarded_run.rb @@ -22,5 +22,9 @@ exit end +if time.hour == start_hour + max_tweets = max_tweets_first_hour +end + puts "Running Konstabot with #{max_tweets} max tweets" system "ruby konstabot.rb -n #{max_tweets}"
Allow for a larger number of tweets in the first hour
diff --git a/test/fixtures/schema.rb b/test/fixtures/schema.rb index abc1234..def5678 100644 --- a/test/fixtures/schema.rb +++ b/test/fixtures/schema.rb @@ -38,7 +38,7 @@ t.timestamps end - create_table :listings_locations, :force => true do |t| + create_table :listings_locations, :force => true, :id => false do |t| t.references :listing, :location t.timestamps end
Fix failing test under ActiveRecord 2.3.5.
diff --git a/app/models/task_definition_config.rb b/app/models/task_definition_config.rb index abc1234..def5678 100644 --- a/app/models/task_definition_config.rb +++ b/app/models/task_definition_config.rb @@ -0,0 +1,32 @@+class TaskDefinitionConfig + include ActiveModel::Model + + CONFIG_FILE = 'task_definition.yml'.freeze + + attr_accessor :content + + class << self + def load_from_review_app_target(review_app_target) + response = load_github_content( + repository: review_app_target.repository, + branch: review_app_target.branch, + path: CONFIG_FILE, + ) + content = parse_content(response) + new(content: content) + end + + private + + def parse_content(response) + return {} if response.blank? + YAML.load(Base64.decode64(response[:content])) + end + + def load_github_content(repository:, branch:, path:) + github = Octokit::Client.new(access_token: Settings.github.access_token) + github.contents(repository, path: path, ref: branch) + rescue Octokit::NotFound + end + end +end
Add TaskDefinitionConfig that to load config from task_definition.yml
diff --git a/app/models/competitions/monday_pir.rb b/app/models/competitions/monday_pir.rb index abc1234..def5678 100644 --- a/app/models/competitions/monday_pir.rb +++ b/app/models/competitions/monday_pir.rb @@ -0,0 +1,87 @@+# frozen_string_literal: true + +module Competitions + class MondayPir < Competition + def self.parent_event_name + "Monday Night PIR" + end + + def self.calculate!(year = Time.zone.today.year) + ActiveSupport::Notifications.instrument "calculate.#{name}.competitions.racing_on_rails" do + transaction do + parent = ::WeeklySeries.year(year).find_by(name: parent_event_name) + + if parent && parent.any_results_including_children? + parent.children.map(&:date).map(&:month).uniq.sort.each do |month| + month_name = Date::MONTHNAMES[month] + standings = MondayPir.find_or_create_by!( + parent: parent, + name: "#{month_name} Standings" + ) + standings.date = Date.new(year, month) + standings.add_source_events if standings.source_events.none? + standings.set_date + standings.save! + standings.delete_races + standings.create_races + standings.calculate! + end + end + end + end + true + end + + def categories_for(race) + result_categories_by_race[race.category] + end + + def add_source_events + parent.children.select { |c| c.date.month == date.month }.each do |source_event| + source_events << source_event + end + end + + def default_bar_points + 1 + end + + def source_events? + true + end + + def category_names + [ + "Beginner", + "Masters 30+ 1/2/3", + "Masters 30+ 4/5", + "Track/Fixed Gear", + "Women 1/2/3", + "Women 4/5" + ] + end + + def point_schedule + event_points_schedule = {} + + source_events.each do |event| + event_points_schedule[event.id] = [ 25, 18, 15, 12, 10, 8, 6, 4, 2, 1 ] + end + + hot_spots.each do |event| + event_points_schedule[event.id] = [ 6, 4, 2, 1 ] + end + + event_points_schedule + end + + def hot_spots + source_events.map(&:children).flatten.select { |e| e.name[/hot/i] } + end + + # Only members can score points? + def members_only? + false + end + end +end
Add Monday Night PIR monthly standings
diff --git a/recipes/rack-mini-profiler.rb b/recipes/rack-mini-profiler.rb index abc1234..def5678 100644 --- a/recipes/rack-mini-profiler.rb +++ b/recipes/rack-mini-profiler.rb @@ -14,7 +14,7 @@ gem 'rack-mini-profiler', group: :development text_to_add = <<-RUBY - before_filter :miniprofiler + before_action :miniprofiler private
Replace before_filter with before_action to use Rails 4 syntax
diff --git a/lib/faraday/adapter/patron.rb b/lib/faraday/adapter/patron.rb index abc1234..def5678 100644 --- a/lib/faraday/adapter/patron.rb +++ b/lib/faraday/adapter/patron.rb @@ -2,6 +2,11 @@ class Adapter class Patron < Faraday::Adapter dependency 'patron' + + def initialize(app, &block) + super(app) + @block = block + end def call(env) super @@ -10,6 +15,7 @@ env[:body] = env[:body].read if env[:body].respond_to? :read session = ::Patron::Session.new + @block.call(session) if req = env[:request] session.timeout = session.connect_timeout = req[:timeout] if req[:timeout]
Add ability to set options on Patron Session object. Example: Faraday.new(:url => url) do |conn| conn.adapter :patron do |session| session.handle_cookies end end
diff --git a/app/uploaders/hero_image_uploader.rb b/app/uploaders/hero_image_uploader.rb index abc1234..def5678 100644 --- a/app/uploaders/hero_image_uploader.rb +++ b/app/uploaders/hero_image_uploader.rb @@ -15,7 +15,7 @@ def apply_blur manipulate! do |img| - img = img.blur_image(0, 3) + img = img.blur_image(0, 3.5) img end end
Add more blur to hero images
diff --git a/lib/metacrunch/job/context.rb b/lib/metacrunch/job/context.rb index abc1234..def5678 100644 --- a/lib/metacrunch/job/context.rb +++ b/lib/metacrunch/job/context.rb @@ -19,8 +19,8 @@ @job.destinations << destination if destination end - def pre_process(&block) - @job.pre_processes << block if block_given? + def pre_process(callable = nil, &block) + add_callable_or_block(@job.pre_processes, callable, &block) end def post_process(&block) @@ -31,5 +31,15 @@ @job.transformations << block if block_given? end + private + + def add_callable_or_block(array, callable, &block) + if block_given? + array << block + elsif callable + array << callable + end + end + end end
Allow pre_process to handle callables.
diff --git a/lib/one_click_orgs/version.rb b/lib/one_click_orgs/version.rb index abc1234..def5678 100644 --- a/lib/one_click_orgs/version.rb +++ b/lib/one_click_orgs/version.rb @@ -1,5 +1,5 @@ module OneClickOrgs - VERSION = "1.0.0rc2" unless defined?(VERSION) + VERSION = "1.0.0rc2" unless defined?(::OneClickOrgs::VERSION) def self.version if VERSION =~ /^0/
Fix that OneClickOrgs::VERSION would not be defined due to presence of Ruby VERSION constant.
diff --git a/lib/tasks/import_racquet.rake b/lib/tasks/import_racquet.rake index abc1234..def5678 100644 --- a/lib/tasks/import_racquet.rake +++ b/lib/tasks/import_racquet.rake @@ -5,6 +5,6 @@ match_data = JSON.parse(HTTParty.get('http://racquet.io/pivotal-denver/matches.json?limit=500').body)['results'] match_data.each do |match| - # Match.create() + Match.create(winner: match['winner'], loser: match['loser'], club_id: Club.first.id) end end
Add rake task for importing racquet data
diff --git a/tty-spinner.gemspec b/tty-spinner.gemspec index abc1234..def5678 100644 --- a/tty-spinner.gemspec +++ b/tty-spinner.gemspec @@ -19,9 +19,9 @@ spec.required_ruby_version = '>= 2.0.0' - spec.add_runtime_dependency 'tty-cursor', '~> 0.6.0' + spec.add_runtime_dependency 'tty-cursor', '~> 0.7' - spec.add_development_dependency 'bundler' + spec.add_development_dependency 'bundler', '>= 1.5.0' spec.add_development_dependency 'rspec', '~> 3.1' spec.add_development_dependency 'rake' end
Change to update dependency and relax bundler version
diff --git a/db/data_migration/20170818102913_send_missing_people_to_rummager.rb b/db/data_migration/20170818102913_send_missing_people_to_rummager.rb index abc1234..def5678 100644 --- a/db/data_migration/20170818102913_send_missing_people_to_rummager.rb +++ b/db/data_migration/20170818102913_send_missing_people_to_rummager.rb @@ -0,0 +1,32 @@+slugs = %w( + nick-hurd + nick-gibb + damian-green + brandon-lewis + elizabeth-truss + greg-hands + claire-perry + andrea-leadsom + lord-ashton-of-hyde + rory-stewart + stephen-barclay + richard-harrington + caroline-nokes + lord-oshaughnessy + david-rutley + rebecca-harris + mike-freer + nigel-adams + stuart-andrew + craig-whittaker + ian-duncan + david-hall--2 + david-reid + duncan-thompson--2 + david-reed + ben-merrick +) + +missing_people = Person.where(slug: slugs) + +missing_people.map(&:update_in_search_index)
Add migration to send missing people to rummager Some people listed in Whitehall have not been indexed in rummager. This manifests in some finder screens as rows in the people drop down that have no description which displays as blank or empty. It also means that searching for one of the missing people at `/government/people` returns no result even though that person exists. This migration updates these missing people in the search index.
diff --git a/lib/calligraphy/resource.rb b/lib/calligraphy/resource.rb index abc1234..def5678 100644 --- a/lib/calligraphy/resource.rb +++ b/lib/calligraphy/resource.rb @@ -1,6 +1,6 @@ module Calligraphy class Resource - attr_accessor :contents + attr_accessor :contents, :updated_at attr_reader :full_request_path, :mount_point, :request_body, :request_path def initialize(resource: nil, req: nil, mount: nil)
Add :updated_at attr_accessor to Resource
diff --git a/lib/raphl/true_random.rb b/lib/raphl/true_random.rb index abc1234..def5678 100644 --- a/lib/raphl/true_random.rb +++ b/lib/raphl/true_random.rb @@ -1,30 +1,30 @@ module Raphl module TrueRandom - class << self - # Pick a random element from collection using Random.org true random number generator - def select(collection = []) - entry_index = random(0, collection.count-1) - collection[entry_index] - end + module_function - def random(min, max) - true_random(min, max) - rescue SocketError, ArgumentError - fallback_random(min, max) - end + # Pick a random element from collection using Random.org true random number generator + def select(collection = []) + entry_index = random(0, collection.count-1) + collection[entry_index] + end - def fallback_random(min, max) - Random.rand(min..max) - end + def random(min, max) + true_random(min, max) + rescue SocketError, ArgumentError + fallback_random(min, max) + end - def true_random(min, max) - uri = "http://www.random.org/integers/?col=1&num=1&base=10&format=plain" - uri << "&min=#{ min }" - uri << "&max=#{ max }" + def fallback_random(min, max) + puts "falling back to Random#rand" + Random.rand(min..max) + end - Integer(HTTParty.get(uri)) - end + def true_random(min, max) + uri = "http://www.random.org/integers/?col=1&num=1&base=10&format=plain" + uri << "&min=#{ min }" + uri << "&max=#{ max }" + Integer(HTTParty.get(uri)) end end end
Use "module_function" instead of "class << self"
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 @@ -3,12 +3,10 @@ # created for the help-if-you-are-arrested-abroad calculator attr_reader :data - def initialize - @data = self.class.prisoner_packs - end + PRISONER_PACKS = YAML.load_file(Rails.root.join("config/smart_answers/prisoner_packs.yml")).freeze def generate_url_for_download(country, field, text) - country_data = @data.find { |c| c["slug"] == country } + country_data = PRISONER_PACKS.find { |c| c["slug"] == country } return "" unless country_data url = country_data[field] @@ -26,16 +24,12 @@ end end - def self.prisoner_packs - @prisoner_packs ||= YAML.load_file(Rails.root.join("config/smart_answers/prisoner_packs.yml")) - end - def countries_with_regions %w[cyprus] end def get_country_regions(slug) - @data.find { |c| c["slug"] == slug }["regions"] + PRISONER_PACKS.find { |c| c["slug"] == slug }["regions"] end end end
Refactor prisioner packs to be class constant This removes the overhead of re-loading the prisioner packs YAML file for every request and simplifies the class intialisation structure.
diff --git a/week-4/smallest-integer/my_solution.rb b/week-4/smallest-integer/my_solution.rb index abc1234..def5678 100644 --- a/week-4/smallest-integer/my_solution.rb +++ b/week-4/smallest-integer/my_solution.rb @@ -13,5 +13,10 @@ # Your Solution Below def smallest_integer(list_of_nums) + list_of_nums.sort! + smallest = list_of_nums.shift + p smallest -end+end +#test = [] +#smallest_integer(test)
Complete challenge 1, smallest interger
diff --git a/jekyll-archives.gemspec b/jekyll-archives.gemspec index abc1234..def5678 100644 --- a/jekyll-archives.gemspec +++ b/jekyll-archives.gemspec @@ -13,7 +13,7 @@ s.licenses = ["MIT"] s.files = ["lib/jekyll-archives.rb", "lib/jekyll-archives/archive.rb"] - s.add_dependency "jekyll", '~> 2.0' + s.add_dependency "jekyll", '~> 2.4' s.add_development_dependency 'rake' s.add_development_dependency 'rdoc'
Change jekyll dependency to be ~> 2.4 * 8bbfaf60831369698b141da72fb8d71a0a7b0c43 used `Utils.slugify` which has been added in 2.4
diff --git a/messagebird-rest.gemspec b/messagebird-rest.gemspec index abc1234..def5678 100644 --- a/messagebird-rest.gemspec +++ b/messagebird-rest.gemspec @@ -18,4 +18,6 @@ s.files = Dir.glob("lib/**/*") + %w(LICENSE README.md) s.require_path = 'lib' + + s.add_development_dependency 'rspec', '~> 3.8' end
Add rspec as a development dependency
diff --git a/lib/dry/system/constants.rb b/lib/dry/system/constants.rb index abc1234..def5678 100644 --- a/lib/dry/system/constants.rb +++ b/lib/dry/system/constants.rb @@ -16,11 +16,11 @@ InvalidSettingsError = Class.new(ArgumentError) do # @api private def initialize(attributes) - message = <<~EOF + message = <<~STR Could not initialize settings. The following settings were invalid: #{attributes_errors(attributes).join("\n")} - EOF + STR super(message) end
Use STR in multi-line string
diff --git a/app/models/developer.rb b/app/models/developer.rb index abc1234..def5678 100644 --- a/app/models/developer.rb +++ b/app/models/developer.rb @@ -1,23 +1,51 @@ class Developer < ActiveRecord::Base devise :database_authenticatable, :trackable, :validatable, :omniauthable store_accessor :data, :bio, :html_url, :avatar_url, :company, - :blog, :location, :followers, :public_gists, :public_repos, :email, :hireable + :blog, :location, :followers, :public_gists, :public_repos, :hireable - def self.whitelisted_attributes - all_attributes - protected_attributes + after_commit :cache_login! + + def self.fetch_by_login(username) + premium = REDIS.sismember('hireables:developers_logins', username) + + if premium + developer = find_by(login: username) + Rails.cache.fetch([username, developer], expires_in: 2.days) do + developer + end + else + self.fetch_from_github(username) + end end - def self.default_scope - select(whitelisted_attributes) + def self.fetch_from_github(username) + Rails.cache.fetch(username, expires_in: 2.days) do + request = Github::Api.new("/users/#{username}").fetch + response = Github::Response.new(request) + if response.found? + JSON.parse(request.body, object_class: OpenStruct) + else + raise ActiveRecord::RecordNotFound.new('Not Found') + end + end + end + + def self.fetch_languages_from_github(username) + Rails.cache.fetch([username, 'languages'], expires_in: 2.days) do + request = Github::Api.new("/users/#{username}/repos").fetch + response = Github::Response.new(request) + + if response.found? + response.developer_languages_collection + else + raise ActiveRecord::RecordNotFound.new('Not Found') + end + end end private - def self.all_attributes - self.columns.map(&:name).map(&:to_sym) - end - - def self.protected_attributes - [:access_token, :provider, :uid, :email] + def cache_login + REDIS.sadd('hireables:developers_logins', login) end end
Remove scope code as we are using Graphql
diff --git a/lib/facter/boxen_facts_d.rb b/lib/facter/boxen_facts_d.rb index abc1234..def5678 100644 --- a/lib/facter/boxen_facts_d.rb +++ b/lib/facter/boxen_facts_d.rb @@ -9,6 +9,24 @@ class BoxenFactsDirectoryLoader < Facter::Util::DirectoryLoader EXTERNAL_FACT_WEIGHT = Facter::Util::DirectoryLoader::EXTERNAL_FACT_WEIGHT + 1 + + def load(collection) + entries.each do |file| + parser = Facter::Util::Parser.parser_for(file) + if parser == nil + next + end + + data = parser.results + if data == false + Facter.warn "Could not interpret fact file #{file}" + elsif data == {} or data == nil + Facter.warn "Fact file #{file} was parsed but returned an empty data set" + else + data.each { |p,v| collection.add(p, :value => v) { has_weight(EXTERNAL_FACT_WEIGHT) } } + end + end + end end # Find where boxen is installed @@ -17,5 +35,5 @@ facts_d = File.join(boxen_home, "facts.d") # Load all "external facts" from $BOXEN_HOME/facts.d -loader = BoxenFactsDirectoryLoader.loader_for(facts_d) +loader = BoxenFactsDirectoryLoader.new(facts_d) loader.load(Facter.collection)
Fix custom external fact loader's weights Because facter doesn't expose the weight as a customizable value, we need to override the constant. You can't do that in a subclass: ```ruby class A FOO="A" def foo; FOO; end end class B < A FOO="B" end A.new.foo # => "A" B.new.foo # => "A" class A def foo; self.class::FOO; end end A.new.foo # => "A" B.new.foo # => "B" ``` So, we copy the `#load` method :(
diff --git a/lib/acclimate/cli_helper.rb b/lib/acclimate/cli_helper.rb index abc1234..def5678 100644 --- a/lib/acclimate/cli_helper.rb +++ b/lib/acclimate/cli_helper.rb @@ -3,6 +3,8 @@ def self.included( base ) base.class_eval do + include Acclimate::Output + no_commands do def execute( klass, additional_options={} )
Add output helper to CLIHelper.
diff --git a/Casks/sweet-home-3d.rb b/Casks/sweet-home-3d.rb index abc1234..def5678 100644 --- a/Casks/sweet-home-3d.rb +++ b/Casks/sweet-home-3d.rb @@ -0,0 +1,7 @@+class SweetHome3d < Cask + url 'http://downloads.sourceforge.net/project/sweethome3d/SweetHome3D/SweetHome3D-4.0/SweetHome3D-4.0-macosx.dmg' + homepage 'http://www.sweethome3d.com/' + version '4.0' + sha1 '15b0ec1d8b70267707b00637ac7289cf8267f15d' + link :app, 'Sweet Home 3D.app' +end
Add Sweet Home 3D (Version 4.0) Cask
diff --git a/app_generators/merb/merb_generator.rb b/app_generators/merb/merb_generator.rb index abc1234..def5678 100644 --- a/app_generators/merb/merb_generator.rb +++ b/app_generators/merb/merb_generator.rb @@ -2,21 +2,21 @@ require "merb-gen/base" class MerbGenerator < Merb::GeneratorBase - + def initialize(args, runtime_options = {}) @base = File.dirname(__FILE__) @name = args.first super @destination_root = @name end - + protected def banner <<-EOS.split("\n").map{|x| x.strip}.join("\n") Creates a Merb application stub. USAGE: #{spec.name} -g path - + Set environment variable MERB_ORM=[activerecord|datamapper|sequel] to pre-enabled an ORM. EOS @@ -25,7 +25,7 @@ def default_orm?(orm) ENV['MERB_ORM'] == orm.to_s end - + def default_test_suite?(suite) return ENV['MERB_TEST_SUITE'] == suite.to_s if ENV['MERB_TEST_SUITE'] options[suite] @@ -33,8 +33,9 @@ def display_framework_selections end - + def create_dirs m.directory 'log' + m.directory 'gems' end end
Create gems directory in new applications.
diff --git a/app/models/spree/payment_decorator.rb b/app/models/spree/payment_decorator.rb index abc1234..def5678 100644 --- a/app/models/spree/payment_decorator.rb +++ b/app/models/spree/payment_decorator.rb @@ -1,7 +1,7 @@ module Spree Payment.class_eval do - state_machine :initial => 'checkout' do - after_transition :to => 'completed', :do => :create_subscriptions! + state_machine :initial => :checkout do + after_transition :to => :completed, :do => :create_subscriptions! end def create_subscriptions!
Use symbols for payment decorator states By re-defining the state machine like this, the state_machine gem will complain because 'checkout' != :checkout and 'completed' != :completed
diff --git a/app/models/spree/product_decorator.rb b/app/models/spree/product_decorator.rb index abc1234..def5678 100644 --- a/app/models/spree/product_decorator.rb +++ b/app/models/spree/product_decorator.rb @@ -1,6 +1,6 @@ Spree::Product.class_eval do has_many :digitals, :through => :variants_including_master - scope :digital, -> { joins(:digitals).reorder("spree_digitals.updated_at DESC")} + scope :digital, -> { includes(:digitals).reorder("spree_digitals.updated_at DESC").distinct } def has_paper_or_digital_variants? self.variants_including_master.any?{|a| a.has_digital_option?}
Sort digital by updated_at desc
diff --git a/app/models/spree/variant_decorator.rb b/app/models/spree/variant_decorator.rb index abc1234..def5678 100644 --- a/app/models/spree/variant_decorator.rb +++ b/app/models/spree/variant_decorator.rb @@ -10,7 +10,7 @@ { :id => self.id, :count => self.count_on_hand, - :price => number_to_currency(actual_price) + :price => actual_price.display_price.to_html } end
Use display price for variant hash data
diff --git a/app/resources/api/v1/crop_resource.rb b/app/resources/api/v1/crop_resource.rb index abc1234..def5678 100644 --- a/app/resources/api/v1/crop_resource.rb +++ b/app/resources/api/v1/crop_resource.rb @@ -8,6 +8,9 @@ has_many :plantings has_many :seeds has_many :harvests + + has_many :photos + has_one :parent attribute :name
Add photos back into crop resources
diff --git a/lib/kosmos/packages/void.rb b/lib/kosmos/packages/void.rb index abc1234..def5678 100644 --- a/lib/kosmos/packages/void.rb +++ b/lib/kosmos/packages/void.rb @@ -0,0 +1,9 @@+class VesselOrbitalInformationalDisplay < Kosmos::Package + title 'VOID - Vessel Orbital Informational Display' + aliases 'void' + url 'http://ksp.hawkbats.com/VOID/VOID-0-12-0.zip' + + def install + merge_directory 'GameData' + end +end
Add a package for VOID.
diff --git a/lib/minder/task_recorder.rb b/lib/minder/task_recorder.rb index abc1234..def5678 100644 --- a/lib/minder/task_recorder.rb +++ b/lib/minder/task_recorder.rb @@ -45,12 +45,13 @@ end def delete_task - lines = File.read(DOING_FILE).split("\n") - lines.delete_at(selected_task_index) + lines = File.read(DOING_FILE).strip.split("\n") + lines.delete_at(selected_task_index) - File.open(DOING_FILE, 'w') do |file| - file.write(lines.join("\n")) + File.open(DOING_FILE, 'w') do |file| + file.write(lines.join("\n") + "\n") end + select_previous_task end def complete_task
Fix issues w/ tasks after deleting - Adding a task would append to last task - Cursor would end up on line without task
diff --git a/db/migrate/20130712163509_add_missing_id_columns.rb b/db/migrate/20130712163509_add_missing_id_columns.rb index abc1234..def5678 100644 --- a/db/migrate/20130712163509_add_missing_id_columns.rb +++ b/db/migrate/20130712163509_add_missing_id_columns.rb @@ -0,0 +1,11 @@+class AddMissingIdColumns < ActiveRecord::Migration + def up + add_column :category_featured_topics, :id, :primary_key + add_column :topic_users, :id, :primary_key + end + + def down + remove_column :category_featured_topics, :id + remove_column :topic_users, :id + end +end
Add primary key `id` to `category_featured_topics` and `topic_users`
diff --git a/db/migrate/20170523095536_add_last_name_to_users.rb b/db/migrate/20170523095536_add_last_name_to_users.rb index abc1234..def5678 100644 --- a/db/migrate/20170523095536_add_last_name_to_users.rb +++ b/db/migrate/20170523095536_add_last_name_to_users.rb @@ -0,0 +1,12 @@+require 'carto/db/migration_helper' + +include Carto::Db::MigrationHelper + +migration( + Proc.new do + add_column :users, :last_name, :text + end, + Proc.new do + drop_column :users, :last_name + end +)
Migration: Add last name to users
diff --git a/lib/scais/topology/files.rb b/lib/scais/topology/files.rb index abc1234..def5678 100644 --- a/lib/scais/topology/files.rb +++ b/lib/scais/topology/files.rb @@ -25,7 +25,7 @@ end #add constant - self.constants<< Constant.new(output, "#{options[:time]},#{options[:value]}") + self.constants<< Constant.new(output, [options[:time], options[:value]]) self end end
Fix constant type error on setting_for
diff --git a/lib/schneiderlein/engine.rb b/lib/schneiderlein/engine.rb index abc1234..def5678 100644 --- a/lib/schneiderlein/engine.rb +++ b/lib/schneiderlein/engine.rb @@ -3,8 +3,15 @@ isolate_namespace Schneiderlein initializer 'schneiderlein.middleware' do |app| - app.config.middleware.insert_before \ - 'ActionDispatch::ParamsParser', 'Schneiderlein::FlyCatcher' + if Rails::VERSION::MAJOR < 5 + app.config.middleware.insert_before \ + 'ActionDispatch::ParamsParser', 'Schneiderlein::FlyCatcher' + else + # ActionDispatch::ParamsParser is not included in the middleware + # stack anymore in Rails 5. + app.config.middleware.insert_after \ + 'ActionDispatch::Callbacks', 'Schneiderlein::FlyCatcher' + end end end
Use a different fixpoint to insert Schneiderlein ActionDispatch::Request is gone in Rails 5. By default, ActionDispatch::Request was inserted after ActionDispatch::Callbacks so this is where we put ourselves.
diff --git a/bulk_api_transferrer.rb b/bulk_api_transferrer.rb index abc1234..def5678 100644 --- a/bulk_api_transferrer.rb +++ b/bulk_api_transferrer.rb @@ -3,6 +3,7 @@ require "active_support" require "active_support/core_ext/array" require "active_support/core_ext/hash" +require "active_support/core_ext/date" class BulkApiTransferrer def initialize @@ -28,7 +29,7 @@ def calendar_week_applications(date_string) date = Date.parse(date_string) applications = [] - (start_of_week(date)...end_of_week(date)).each do |d| + (date.beginning_of_week...date.end_of_week).each do |d| applications += applications_on_date(d) end as_xml applications @@ -38,13 +39,5 @@ applications.to_xml(root: "applications", skip_types: true, dasherize: false) end - def start_of_week(date) - date - (date.cwday - 1) - end - - def end_of_week(date) - date - (date.cwday - 7) - end - # TODO: Transfer (FTP?) results somewhere end
Replace our methods with activesupport's
diff --git a/lib/devise_invitable.rb b/lib/devise_invitable.rb index abc1234..def5678 100644 --- a/lib/devise_invitable.rb +++ b/lib/devise_invitable.rb @@ -4,7 +4,7 @@ @@invite_for = 0 end Devise::ALL << :invitable -Devise::CONTROLLERS = Devise::CONTROLLERS.merge(:invitations => [:invitable]) +Devise::CONTROLLERS[:invitations] = [:invitable] module DeviseInvitable; end
Update for devise 0.7.1, controllers is not frozen yet
diff --git a/lib/git_service/repo.rb b/lib/git_service/repo.rb index abc1234..def5678 100644 --- a/lib/git_service/repo.rb +++ b/lib/git_service/repo.rb @@ -12,9 +12,11 @@ require 'rugged' rugged_repo.remotes.each do |remote| fetch_options = {} + username = uri_for_remote(remote.url).user + hostname = uri_for_remote(remote.url).hostname + credentials = Credentials.find_for_user_and_host(username, hostname) - username = uri_for_remote(remote.url).user - fetch_options[:credentials] = Credentials.from_ssh_agent(username) if username + fetch_options[:credentials] = credentials if credentials rugged_repo.fetch(remote.name, fetch_options) end
[GitService::Repo] Update .git_fetch to 'find' creds Uses GitService::Credentials.find_for_user_and_host when looking up credentials, and uses .uri_for_remote to also find hostname for a given remote url.
diff --git a/lib/ice_nine/version.rb b/lib/ice_nine/version.rb index abc1234..def5678 100644 --- a/lib/ice_nine/version.rb +++ b/lib/ice_nine/version.rb @@ -3,6 +3,6 @@ module IceNine # Unreleased gem version - VERSION = '0.8.0' + VERSION = '0.8.0'.freeze end # module IceNine
Change the IceNine::VERSION to be frozen
diff --git a/lib/options/registry.rb b/lib/options/registry.rb index abc1234..def5678 100644 --- a/lib/options/registry.rb +++ b/lib/options/registry.rb @@ -9,7 +9,7 @@ def register(item_name, item) if registered?(item_name) - raise ArgumentError, "#{name} already registered: #{item_name}" + fail ArgumentError, "#{name} already registered: #{item_name}" else @items.store(item_name, item) end @@ -19,7 +19,7 @@ if registered?(item_name) @items.fetch(item_name) else - raise ArgumentError, "#{name} not registered: #{item_name}" + fail ArgumentError, "#{name} not registered: #{item_name}" end end
Use `fail` instead of `raise` for new errors Though `fail` and `raise` do exactly the same thing, the style guide[1] suggests that `raise` be used only to re-raise existing errors in a `rescue` block and to use `fail` to raise new errors. [1] https://github.com/bbatsov/ruby-style-guide
diff --git a/lib/tasks/database.rake b/lib/tasks/database.rake index abc1234..def5678 100644 --- a/lib/tasks/database.rake +++ b/lib/tasks/database.rake @@ -1,4 +1,5 @@ require 'active_record' +require 'cloud_cost_tracker' namespace :db do namespace :migrate do
Fix missing requirement in exported tasks
diff --git a/app/controllers/tokite/repositories_controller.rb b/app/controllers/tokite/repositories_controller.rb index abc1234..def5678 100644 --- a/app/controllers/tokite/repositories_controller.rb +++ b/app/controllers/tokite/repositories_controller.rb @@ -7,9 +7,10 @@ end def new - github_repos = octokit_client.repositories.select do |repo| - repo.permissions.admin and not repo.fork and not repo.archived - end + github_repos = octokit_client.repositories. + select{|r| r.permissions.admin }. + delete_if(&:fork). + delete_if(&:archived) @repositories = github_repos.map do |repo| Repository.new(name: repo.full_name, url: repo.html_url) end @@ -21,7 +22,7 @@ def create params[:names].each do |name| github_repo = octokit_client.repository(name) - Repository.hook!(octokit_client, github_repo) if not github_repo.archived + Repository.hook!(octokit_client, github_repo) unless github_repo.archived end flash[:info] = "Import repositories." redirect_to repositories_path
Fix codes to follow the cookpad coding rule
diff --git a/lib/fog/brightbox/requests/compute/update_server.rb b/lib/fog/brightbox/requests/compute/update_server.rb index abc1234..def5678 100644 --- a/lib/fog/brightbox/requests/compute/update_server.rb +++ b/lib/fog/brightbox/requests/compute/update_server.rb @@ -9,7 +9,7 @@ # @option options [String] :name Editable label # @option options [String] :user_data User defined metadata # @option options [Boolean] :compatibility_mode Server needs to be shutdown and restarted for changes to this to take effect - # @opiton options [Array] :server_groups Array of Server Groups that this server should be part of + # @option options [Array] :server_groups Array of Server Groups that this server should be part of # # @return [Hash] if successful Hash version of JSON object # @return [NilClass] if no options were passed
[Brightbox] Fix typo in yard tag
diff --git a/spec/acceptance/admin_spec.rb b/spec/acceptance/admin_spec.rb index abc1234..def5678 100644 --- a/spec/acceptance/admin_spec.rb +++ b/spec/acceptance/admin_spec.rb @@ -7,6 +7,7 @@ } do background do + drop_data_stores @user = FactoryGirl.create(:user) end
Drop all datastores, in the hope to pass the build on travis
diff --git a/spec/factories/collections.rb b/spec/factories/collections.rb index abc1234..def5678 100644 --- a/spec/factories/collections.rb +++ b/spec/factories/collections.rb @@ -6,5 +6,10 @@ managers {[FactoryGirl.create(:manager).username]} editors {[FactoryGirl.create(:user).username]} depositors {[FactoryGirl.create(:user).username]} + + ignore { items 0 } + after(:create) do |c, env| + 1.upto(env.items) { FactoryGirl.create(:media_object, collection: c) } + end end end
Add item(s) creation to collection factory
diff --git a/spec/i18n/locale_name_spec.rb b/spec/i18n/locale_name_spec.rb index abc1234..def5678 100644 --- a/spec/i18n/locale_name_spec.rb +++ b/spec/i18n/locale_name_spec.rb @@ -8,4 +8,11 @@ FastGettext.locale = 'en' # set the locale for runnin specs back to English end + + it "all entries in human_locale_names.yml are valid" do + YAML.load_file(Rails.root.join('config/human_locale_names.yaml'))['human_locale_names'].each do |locale_name, human_locale_name| + expect(human_locale_name).not_to be_empty + expect(human_locale_name).not_to eq(locale_name) + end + end end
Test that all human locale names are valid
diff --git a/spec/motion/encodable_spec.rb b/spec/motion/encodable_spec.rb index abc1234..def5678 100644 --- a/spec/motion/encodable_spec.rb +++ b/spec/motion/encodable_spec.rb @@ -13,17 +13,17 @@ } end - describe 'NSCoderプロトコル準拠' do + describe 'NSCoder protocol' do before do @entry = Entry.new(@params) end - it '必要なメソッドを実装している' do + it 'should responds to required methods' do @entry.respond_to?(:'initWithCoder:').should == true @entry.respond_to?(:'encodeWithCoder:').should == true end - it '保存->ロードできる' do + it 'should be able to load' do entry_as_data = @entry.to_data loaded_entry = Entry.load(entry_as_data) loaded_entry.title.should == @params[:title]
Use English in specs description
diff --git a/spec/support/admin_helpers.rb b/spec/support/admin_helpers.rb index abc1234..def5678 100644 --- a/spec/support/admin_helpers.rb +++ b/spec/support/admin_helpers.rb @@ -0,0 +1,10 @@+module AdminHelpers + def follow_invite_request_link(admin_user) + open_email admin_user.email, with_subject: /would like to be added/ + visit_in_email "Go to Dashboard" + end +end + +RSpec.configure do |c| + c.include AdminHelpers, type: :feature +end
Add helper to simulate admin following the link in an invitation request email