diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -6,13 +6,14 @@ helper_method :current_user, :logged_in?, :ensure_login! def current_user - @current_user ||= User.find(session[:user_id]) + @current_user ||= User.find(session[:user_id]) if session[:user_id] end + def logged_in? - self.current_user != nil + current_user != nil end def ensure_login! - redirect_to "sessions/new" unless logged_in? + redirect_to "/sessions/new" unless logged_in? end end
Add restrictions for non-logged in users
diff --git a/lib/awestruct/extensions/pipeline.rb b/lib/awestruct/extensions/pipeline.rb index abc1234..def5678 100644 --- a/lib/awestruct/extensions/pipeline.rb +++ b/lib/awestruct/extensions/pipeline.rb @@ -18,6 +18,7 @@ def extension(ext) @extensions << ext + ext.transform(@transformers) if ext.respond_to?('transform') end def helper(helper) @@ -33,7 +34,7 @@ ext.execute( site ) end end - + def watch(watched_dirs) extensions.each do |ext| ext.watch( watched_dirs ) if ext.respond_to?('watch') @@ -43,4 +44,3 @@ end end -
Add support for Extensions to define Transformers A Extension can register it's own Transformers without involving the user. e.g. The extension need to change the rendered output based on internal state. '''ruby class MyExtension def execute(site) # do.stuff end def transform(transformers) transformers << MyTransformer.new end end class MyTransformer def transform(site, page, rendered) # do.stuff end end '''
diff --git a/app/helpers/simple_form_ransack_helper.rb b/app/helpers/simple_form_ransack_helper.rb index abc1234..def5678 100644 --- a/app/helpers/simple_form_ransack_helper.rb +++ b/app/helpers/simple_form_ransack_helper.rb @@ -6,7 +6,7 @@ opts = {} end - opts[:url] = request.original_url unless opts[:url] + opts[:url] = request.original_fullpath unless opts[:url] opts[:method] = "get" unless opts[:method] args << opts
Use path instead of URL for the action on form.
diff --git a/lib/lazy/attribute/lazy_attribute.rb b/lib/lazy/attribute/lazy_attribute.rb index abc1234..def5678 100644 --- a/lib/lazy/attribute/lazy_attribute.rb +++ b/lib/lazy/attribute/lazy_attribute.rb @@ -1,6 +1,19 @@ module Lazy module Attribute module ClassMethods + + # Including the lazy_attribute gem to the model + # + # @param attribute [Symbol] + # @param [Hash] options + # @option options [Symbol] :key (:default) if the key parameter is not set, it will take the default as the key + # @option options [Boolean] :create_if_not_found (false) if the parameter is set as true, will create the record if the record is not available + # @option options [Boolean] :raise_error (false) will raise exceptions + # ActiveRecord::RecordNotFoundException if the value set as true and the record not present <br> + # ActiveRecord::RecordInvalid: Validation failed exception if any validation error thrown at the time of creation missing record + # + # @return [none] + def lazy_attribute(attribute, options = {}) default_options = { raise_error: false, key: [], create_if_not_found: false } options.reverse_merge!(default_options)
Add docs for better usability
diff --git a/lib/lightchef/resources/directory.rb b/lib/lightchef/resources/directory.rb index abc1234..def5678 100644 --- a/lib/lightchef/resources/directory.rb +++ b/lib/lightchef/resources/directory.rb @@ -13,10 +13,10 @@ escaped_path = shell_escape(path) run_command("test -d #{escaped_path} || mkdir #{escaped_path}") if options[:mode] - run_command("chmod #{options[:mode]} #{escaped_path}") + backend.change_file_mode(path, options[:mode]) end if options[:owner] || options[:group] - run_command("chown #{options[:owner]}:#{options[:group]} #{escaped_path}") + backend.change_file_owner(path, options[:owner], options[:group]) end end end
Use change_file_mode and change_file_owner instead of calling run_command directly
diff --git a/lib/redis_cacheable/active_record.rb b/lib/redis_cacheable/active_record.rb index abc1234..def5678 100644 --- a/lib/redis_cacheable/active_record.rb +++ b/lib/redis_cacheable/active_record.rb @@ -16,9 +16,10 @@ end # cache all persisted records + # @param [Hash] options pass to find_each method # @return [void] - def cache_all - find_each do |record| + def cache_all(options = {}) + find_each(options) do |record| record.cache_to_redis end
Add option parameter to `cache_all`
diff --git a/lib/smartsheet/api/request_client.rb b/lib/smartsheet/api/request_client.rb index abc1234..def5678 100644 --- a/lib/smartsheet/api/request_client.rb +++ b/lib/smartsheet/api/request_client.rb @@ -0,0 +1,19 @@+module Smartsheet + module API + class RequestClient + def initialize(token, client) + @token = token + @client = client + end + + def make_request(endpoint_spec, request_spec) + request = Request.new(token, endpoint_spec, request_spec) + client.make_request(request) + end + + private + + attr_reader :token, :client + end + end +end
Add a client adapter that handles request construction.
diff --git a/lib/spectrum/config/z3988_literal.rb b/lib/spectrum/config/z3988_literal.rb index abc1234..def5678 100644 --- a/lib/spectrum/config/z3988_literal.rb +++ b/lib/spectrum/config/z3988_literal.rb @@ -13,7 +13,7 @@ def value(data) if id && data && data[:value] [data[:value]].flatten.map do |val| - "#{URI::encode_www_form_component(id)}=#{URI::encode_www_form_component(namespace + val)}" + "#{URI::encode_www_form_component(id)}=#{URI::encode_www_form_component(namespace + val.to_s)}" end else [ ]
Fix "no implicit conversion" error I was getting a "no implicit conversion of Integer into String" error on this line; adding this to_s fixed it
diff --git a/lib/spontaneous/model/box/comment.rb b/lib/spontaneous/model/box/comment.rb index abc1234..def5678 100644 --- a/lib/spontaneous/model/box/comment.rb +++ b/lib/spontaneous/model/box/comment.rb @@ -1,4 +1,6 @@ # encoding: UTF-8 + +require 'kramdown' module Spontaneous::Model::Box module Comment @@ -11,7 +13,7 @@ def schema_comment begin - Kramdown::Document.new(unindented_comment).to_html.strip + ::Kramdown::Document.new(unindented_comment).to_html.strip rescue => e puts "Error converting schema comment for #{self.class}:\n#{e}" ''
Fix resolution of Kramdown class
diff --git a/lib/vmdb/settings/database_source.rb b/lib/vmdb/settings/database_source.rb index abc1234..def5678 100644 --- a/lib/vmdb/settings/database_source.rb +++ b/lib/vmdb/settings/database_source.rb @@ -12,7 +12,7 @@ def load return if resource.nil? - resource.settings_changes(true).each_with_object({}) do |c, h| + resource.settings_changes.reload.each_with_object({}) do |c, h| h.store_path(c.key_path, c.value) end rescue => err
Remove Rails 5 deprecation on reloading the settings_changes.
diff --git a/lib/reconn/analyzer/project_elements/class.rb b/lib/reconn/analyzer/project_elements/class.rb index abc1234..def5678 100644 --- a/lib/reconn/analyzer/project_elements/class.rb +++ b/lib/reconn/analyzer/project_elements/class.rb @@ -30,6 +30,16 @@ methods.size end + def +(other) + other.methods.each do |method| + if !@methods.index(method) + @methods << method + end + end + @dependencies += other.dependencies + self + end + def to_s name.to_s end
Add + method to Class
diff --git a/lib/standalone_validator/validation_result.rb b/lib/standalone_validator/validation_result.rb index abc1234..def5678 100644 --- a/lib/standalone_validator/validation_result.rb +++ b/lib/standalone_validator/validation_result.rb @@ -50,5 +50,11 @@ end alias_method :valid?, :ok? + + def [](attribute) + violations.select do |violation| + violation.attribute == attribute + end + end end end
Add introspection method for filtering violations by type
diff --git a/ci_environment/hhvm/attributes/default.rb b/ci_environment/hhvm/attributes/default.rb index abc1234..def5678 100644 --- a/ci_environment/hhvm/attributes/default.rb +++ b/ci_environment/hhvm/attributes/default.rb @@ -1,4 +1,7 @@ default["hhvm"]["package"]["name"] = "hhvm" default["hhvm"]["package"]["version"] = "3.6.1" +if node['lsb']['codename'] == 'precise' + default["hhvm"]["package"]["version"] = "3.6.1~precise" +end default["hhvm"]["package"]["url"] = "https://s3.amazonaws.com/travis-php-packages/hhvm_2.3.0_amd64.deb"
Use precise-specific hhvm package on precise even though .... does this even work??
diff --git a/rb/lib/selenium/webdriver/common/zipper.rb b/rb/lib/selenium/webdriver/common/zipper.rb index abc1234..def5678 100644 --- a/rb/lib/selenium/webdriver/common/zipper.rb +++ b/rb/lib/selenium/webdriver/common/zipper.rb @@ -36,7 +36,7 @@ entry = file.sub("#{path}/", '') zos.put_next_entry(entry) - zos << File.read(file) + zos << File.read(file, "rb") end zos.close
JariBakken: Make sure we properly zip binary files on Windows. r11358
diff --git a/ruby/command-t/finder/mru_buffer_finder.rb b/ruby/command-t/finder/mru_buffer_finder.rb index abc1234..def5678 100644 --- a/ruby/command-t/finder/mru_buffer_finder.rb +++ b/ruby/command-t/finder/mru_buffer_finder.rb @@ -7,6 +7,11 @@ module CommandT class MRUBufferFinder < BufferFinder + def initialize + @scanner = MRUBufferScanner.new + @matcher = Matcher.new @scanner, :always_show_dot_files => true + end + # Override sorted_matches_for to prevent MRU ordered matches from being # ordered alphabetically. def sorted_matches_for(str, options = {}) @@ -21,10 +26,5 @@ matches end end - - def initialize - @scanner = MRUBufferScanner.new - @matcher = Matcher.new @scanner, :always_show_dot_files => true - end end # class MRUBufferFinder end # CommandT
Put initialize method at top of class By convention, this is where people expect to see this.
diff --git a/db/migrate/20131002192016_create_users.rb b/db/migrate/20131002192016_create_users.rb index abc1234..def5678 100644 --- a/db/migrate/20131002192016_create_users.rb +++ b/db/migrate/20131002192016_create_users.rb @@ -2,7 +2,7 @@ def change create_table :users do |t| t.string :provider - t.string :uid + t.integer :uid t.string :name t.timestamps
Fix DB issue for postgres
diff --git a/regexp_parser.gemspec b/regexp_parser.gemspec index abc1234..def5678 100644 --- a/regexp_parser.gemspec +++ b/regexp_parser.gemspec @@ -26,8 +26,6 @@ Dir.glob('lib/**/*.yml') + %w(Gemfile Rakefile LICENSE README.md CHANGELOG.md regexp_parser.gemspec) - gem.test_files = Dir.glob('spec/**/*.rb') - gem.rdoc_options = ["--inline-source", "--charset=UTF-8"] gem.platform = Gem::Platform::RUBY
Remove deprecated `test_files` from gemspec
diff --git a/db/migrate/20150916144535_create_users.rb b/db/migrate/20150916144535_create_users.rb index abc1234..def5678 100644 --- a/db/migrate/20150916144535_create_users.rb +++ b/db/migrate/20150916144535_create_users.rb @@ -6,5 +6,6 @@ t.string :hashed_password, null: false t.timestamps null: false end + add_index :users, :email, unique: true end end
Add uniqueness index to Users table
diff --git a/spec/acceptance/class_disabled_spec.rb b/spec/acceptance/class_disabled_spec.rb index abc1234..def5678 100644 --- a/spec/acceptance/class_disabled_spec.rb +++ b/spec/acceptance/class_disabled_spec.rb @@ -1,26 +1,45 @@ require 'spec_helper_acceptance' -describe 'selinux class disabled' do +describe 'selinux class - enforcing to disabled' do + before(:all) do + shell('sed -i "s/SELINUX=.*/SELINUX=enforcing/" /etc/selinux/config') + shell('setenforce Enforcing && test "$(getenforce)" = "Enforcing"') + end + let(:pp) do <<-EOS class { 'selinux': mode => 'disabled' } EOS end - it 'runs without errors' do - apply_manifest(pp, catch_failures: true) + context 'before reboot' do + it_behaves_like 'a idempotent resource' + + describe package('selinux-policy-targeted') do + it { is_expected.to be_installed } + end + + describe file('/etc/selinux/config') do + its(:content) { is_expected.to match(%r{^SELINUX=disabled$}) } + end + + # Testing for Permissive brecause only after a reboot it's disabled + describe command('getenforce') do + its(:stdout) { is_expected.to match(%r{^Permissive$}) } + end end - describe package('selinux-policy-targeted') do - it { is_expected.to be_installed } - end + context 'after reboot' do + before(:all) do + hosts.each(&:reboot) + end - describe file('/etc/selinux/config') do - its(:content) { is_expected.to match(%r{^SELINUX=disabled$}) } - end + it 'applies without changes' do + apply_manifest(pp, catch_changes: true) + end - # Testing for Permissive brecause only after a reboot it's disabled - describe command('getenforce') do - its(:stdout) { is_expected.to match(%r{^Permissive$}) } + describe command('getenforce') do + its(:stdout) { is_expected.to match(%r{^Disabled$}) } + end end end
Extend acceptance tests for enforcing to disabled mode Unfortunatly some people really disable selinux.
diff --git a/db/migrate/20121003020810_create_features.rb b/db/migrate/20121003020810_create_features.rb index abc1234..def5678 100644 --- a/db/migrate/20121003020810_create_features.rb +++ b/db/migrate/20121003020810_create_features.rb @@ -7,7 +7,7 @@ t.integer :position, :null => false, :limit => 3, :default => 1 t.string :title, :null => false, :length => 200 - t.string :description, :null => false, :length => 4000 + t.string :description, :null => true, :length => 4000 t.string :styles, :null => true, :length => 4000 t.publishing
Allow feature descriptions to be blank
diff --git a/deploy/development.rb b/deploy/development.rb index abc1234..def5678 100644 --- a/deploy/development.rb +++ b/deploy/development.rb @@ -1,6 +1,6 @@ # The hosts where are are deploying -role :app, "flood.amee.com" -role :db, "flood.amee.com", :primary => true +role :app, "monsoon.amee.com" +role :db, "monsoon.amee.com", :primary => true set :application, "platform-api-dev" set :deploy_to, "/var/www/apps/#{application}"
Update dev server name to monsoon. OPS-1250.
diff --git a/pusher-client.gemspec b/pusher-client.gemspec index abc1234..def5678 100644 --- a/pusher-client.gemspec +++ b/pusher-client.gemspec @@ -21,7 +21,7 @@ s.require_paths = ['lib'] s.licenses = ['MIT'] - s.add_runtime_dependency 'websocket', '~> 1.0.0' + s.add_runtime_dependency 'websocket', '~> 1.1.2' s.add_runtime_dependency 'json' s.add_development_dependency "bacon"
Update the websocket dependency to 1.1.2
diff --git a/spec/requests/authentication_pages_spec.rb b/spec/requests/authentication_pages_spec.rb index abc1234..def5678 100644 --- a/spec/requests/authentication_pages_spec.rb +++ b/spec/requests/authentication_pages_spec.rb @@ -4,11 +4,13 @@ subject { page } - describe "signin page" do + describe "signin" do before { visit signin_path } let(:submit) { "Sign in" } - it { should have_h1('Sign in') } + describe "page" do + it { should have_h1('Sign in') } + end describe "with invalid credentials" do before { click_button submit }
Reorganize sign in page test
diff --git a/spec/workers/inactive_draft_worker_spec.rb b/spec/workers/inactive_draft_worker_spec.rb index abc1234..def5678 100644 --- a/spec/workers/inactive_draft_worker_spec.rb +++ b/spec/workers/inactive_draft_worker_spec.rb @@ -1,6 +1,6 @@-require 'spec_helper' +require 'rails_helper' -describe InactiveDraftWorker do +RSpec.describe InactiveDraftWorker do before do Sidekiq::Testing.inline!
Fix InactiveDraftWorker to RSpec 3
diff --git a/regexp_parser.gemspec b/regexp_parser.gemspec index abc1234..def5678 100644 --- a/regexp_parser.gemspec +++ b/regexp_parser.gemspec @@ -31,5 +31,5 @@ gem.platform = Gem::Platform::RUBY - gem.required_ruby_version = '>= 1.8.7' + gem.required_ruby_version = '>= 1.9.1' end
Update minimum ruby version in gemspec to 1.9.1
diff --git a/spec/acceptance/install_spec.rb b/spec/acceptance/install_spec.rb index abc1234..def5678 100644 --- a/spec/acceptance/install_spec.rb +++ b/spec/acceptance/install_spec.rb @@ -0,0 +1,24 @@+require "spec_helper" +require "tmpdir" + +RSpec.describe "Installing the Gem" do + describe "Using generator" do + specify do + rails_dir = Dir.mktmpdir + + %x{rails new #{rails_dir}} + open("#{rails_dir}/Gemfile", "a") { gem "breakfast" } + %x{cd #{rails_dir} && bundle install} + %x{cd #{rails_dir} && rails generate breakfast:install} + %x{cd #{rails_dir} && node_modules/brunch/bin/brunch build} + + expect(File).to exist("#{rails_dir}/brunch-config.js") + expect(File).to exist("#{rails_dir}/package.json") + expect(File).to exist("#{rails_dir}/app/frontend/js/app.js") + expect(File).to exist("#{rails_dir}/app/frontend/css/app.scss") + expect(File.directory?("#{rails_dir}/node_modules")).to be true + expect(File).to exist("#{rails_dir}/public/assets/app.css") + expect(File).to exist("#{rails_dir}/public/assets/app.js") + end + end +end
Add test for installing Gem
diff --git a/spec/models/cell_volume_spec.rb b/spec/models/cell_volume_spec.rb index abc1234..def5678 100644 --- a/spec/models/cell_volume_spec.rb +++ b/spec/models/cell_volume_spec.rb @@ -1,6 +1,8 @@ require "spec_helper" RSpec.describe CellVolume do + it { is_expected.to belong_to :cell_block_device } + it { is_expected.to have_one(:cell).through :cell_block_device } it { is_expected.to have_many(:object_backups).conditions(is_backup: true) .class_name("FullObjectReplica")
Add a couple of missing association expectations
diff --git a/files/gitlab-cookbooks/gitlab/metadata.rb b/files/gitlab-cookbooks/gitlab/metadata.rb index abc1234..def5678 100644 --- a/files/gitlab-cookbooks/gitlab/metadata.rb +++ b/files/gitlab-cookbooks/gitlab/metadata.rb @@ -1,6 +1,6 @@ maintainer "GitLab.com" maintainer_email "support@gitlab.com" -license "MIT" +license "Apache 2.0" description "Install and configure GitLab from Omnibus" long_description "Install and configure GitLab from Omnibus" version "0.0.1"
Change gitlab cookbook license to Apache 2.0
diff --git a/spec/features/fall2017_cmu_experiment_spec.rb b/spec/features/fall2017_cmu_experiment_spec.rb index abc1234..def5678 100644 --- a/spec/features/fall2017_cmu_experiment_spec.rb +++ b/spec/features/fall2017_cmu_experiment_spec.rb @@ -0,0 +1,37 @@+# frozen_string_literal: true + +require 'rails_helper' + +describe 'email links for Fall 2017 CMU experiment', type: :feature do + let(:email_code) { 'abcdefgabcdefg' } + let(:course) do + create(:course, flags: { fall_2017_cmu_experiment: 'email_sent', + fall_2017_cmu_experiment_email_code: email_code }) + end + + describe '#opt_in' do + it 'updates the course experiment status' do + visit "/experiments/fall2017_cmu_experiment/#{course.id}/#{email_code}/opt_in" + expect(course.reload.flags[Fall2017CmuExperiment::STATUS_KEY]).to eq('opted_in') + end + + it 'errors if email_code is wrong' do + expect do + visit "/experiments/fall2017_cmu_experiment/#{course.id}/wrongcode/opt_in" + end.to raise_error Experiments::IncorrectEmailCodeError + end + end + + describe '#opt_out' do + it 'updates the course experiment status' do + visit "/experiments/fall2017_cmu_experiment/#{course.id}/#{email_code}/opt_out" + expect(course.reload.flags[Fall2017CmuExperiment::STATUS_KEY]).to eq('opted_out') + end + + it 'errors if email_code is wrong' do + expect do + visit "/experiments/fall2017_cmu_experiment/#{course.id}/wrongcode/opt_out" + end.to raise_error Experiments::IncorrectEmailCodeError + end + end +end
Add feature spec for opt-in/opt-out
diff --git a/lib/docs/scrapers/redis.rb b/lib/docs/scrapers/redis.rb index abc1234..def5678 100644 --- a/lib/docs/scrapers/redis.rb +++ b/lib/docs/scrapers/redis.rb @@ -1,7 +1,7 @@ module Docs class Redis < UrlScraper self.type = 'redis' - self.release = 'up to 3.2.1' + self.release = 'up to 3.2.2' self.base_url = 'http://redis.io/commands' self.links = { home: 'http://redis.io/',
Update Redis documentation (up to 3.2.2)
diff --git a/lib/flowdock_connection.rb b/lib/flowdock_connection.rb index abc1234..def5678 100644 --- a/lib/flowdock_connection.rb +++ b/lib/flowdock_connection.rb @@ -32,7 +32,7 @@ 'authorization' => [username, password] }) @source.message(&@on_message_block) - @source.inactivity_timeout = 0 + @source.inactivity_timeout = 90 @source.error do |error| $logger.error "Error reading EventSource for #{username}: #{error.inspect}"
Enable timeout, streaming api sends keepalives
diff --git a/app/controllers/usermovements_controller.rb b/app/controllers/usermovements_controller.rb index abc1234..def5678 100644 --- a/app/controllers/usermovements_controller.rb +++ b/app/controllers/usermovements_controller.rb @@ -46,6 +46,6 @@ end def movement_params - params.require(:movement).permit(:name, :date, :result, :movement_type, :pr) + params.require(:movement).permit(:name, :date, :result, :pr) end end
Remove movement_type from usermovement controller
diff --git a/lib/appsignal/integrations/delayed_job.rb b/lib/appsignal/integrations/delayed_job.rb index abc1234..def5678 100644 --- a/lib/appsignal/integrations/delayed_job.rb +++ b/lib/appsignal/integrations/delayed_job.rb @@ -7,6 +7,10 @@ callbacks do |lifecycle| lifecycle.around(:invoke_job) do |job, &block| invoke_with_instrumentation(job, block) + end + + lifecycle.after(:loop) do |loop| + Appsignal.stop end end
Call Appsignal.stop after DJ loop stops
diff --git a/lib/phoneword/converter.rb b/lib/phoneword/converter.rb index abc1234..def5678 100644 --- a/lib/phoneword/converter.rb +++ b/lib/phoneword/converter.rb @@ -17,10 +17,15 @@ match_head = dictionary.search(variations(head_digits)) match_tail = dictionary.search(variations(tail_digits)) - results << match_head << match_tail - index += 1 + if match_head.empty? || match_tail.empty? + index += 1 + next + else + results << match_head.product(match_tail) + index += 1 + end end - results.compact + results.flatten(1) end private
Drop results if empty head or tail, use head and tail product in the result
diff --git a/lib/ravelin/transaction.rb b/lib/ravelin/transaction.rb index abc1234..def5678 100644 --- a/lib/ravelin/transaction.rb +++ b/lib/ravelin/transaction.rb @@ -12,7 +12,9 @@ :decline_code, :gateway_reference, :avs_result_code, - :cvv_result_code + :cvv_result_code, + :type, + :time attr_required :transaction_id, :currency,
Add type and time to Transaction As can be seen on Raveline API here https://developer.ravelin.com/\#post-/v2/transaction
diff --git a/lib/ultima/core/limiter.rb b/lib/ultima/core/limiter.rb index abc1234..def5678 100644 --- a/lib/ultima/core/limiter.rb +++ b/lib/ultima/core/limiter.rb @@ -8,10 +8,12 @@ def reset! @acted_at = nil + true end def act! @acted_at = Gosu::milliseconds + true end def may_act?
Return true in Limiter shebang methods
diff --git a/lib/vcr/middleware/rack.rb b/lib/vcr/middleware/rack.rb index abc1234..def5678 100644 --- a/lib/vcr/middleware/rack.rb +++ b/lib/vcr/middleware/rack.rb @@ -3,8 +3,13 @@ class Rack include Common + def initialize(*args) + @mutex = Mutex.new + super + end + def call(env) - Thread.exclusive do + @mutex.synchronize do VCR.use_cassette(*cassette_arguments(env)) do @app.call(env) end
Use a mutex rather than Thread.exclusive. I'm getting errors from the rack middleware cuke on 1.8 w/ the Thread.exclusive.
diff --git a/lib/kochiku/jobs/shutdown_instance_job.rb b/lib/kochiku/jobs/shutdown_instance_job.rb index abc1234..def5678 100644 --- a/lib/kochiku/jobs/shutdown_instance_job.rb +++ b/lib/kochiku/jobs/shutdown_instance_job.rb @@ -9,7 +9,7 @@ Process.kill("QUIT", Process.ppid) # Shutdown the instance 1 minute from now. Requires NOPASSWD sudo - pid = Process.spawn("sudo shutdown -h +1m") + pid = Process.spawn("sudo shutdown -h +1") Process.detach(pid) end end
Remove minute designation from shutdown Without the minute unit it works on both osx and linux. OSX only with it.
diff --git a/Casks/kensington-trackball-works.rb b/Casks/kensington-trackball-works.rb index abc1234..def5678 100644 --- a/Casks/kensington-trackball-works.rb +++ b/Casks/kensington-trackball-works.rb @@ -3,7 +3,7 @@ sha256 '285511269aea2e0517198b354923676655c72142062dcba7bdc41bc29d1f08d1' # windows.net is the official download host per the vendor homepage - url 'http://accoblobstorageus.blob.core.windows.net/software/926df442-8736-45a1-85f2-435a67723bb0.dmg' + url 'http://accoblobstorageus.blob.core.windows.net/software/a7d905eb-8a38-49e5-b25a-11d59a7e765f.dmg' name 'Kensington TrackballWorks' homepage 'http://www.kensington.com/' license :unknown # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder
Update download url, but did not change shasum Signed-off-by: Koichi Shiraishi <41a18128582fec5418c0a92661f7d4b13d21d912@gmail.com>
diff --git a/spec/ruby/core/array/shared/index.rb b/spec/ruby/core/array/shared/index.rb index abc1234..def5678 100644 --- a/spec/ruby/core/array/shared/index.rb +++ b/spec/ruby/core/array/shared/index.rb @@ -18,6 +18,7 @@ it "returns nil if no element == to object" do [2, 1, 1, 1, 1].send(@method, 3).should == nil end + ruby_version_is "1.8.7" do it "accepts a block instead of an argument" do [4, 2, 1, 5, 1, 3].send(@method) {|x| x < 2}.should == 2
Adjust blank line to improve coding style in a spec file
diff --git a/spec/lib/everything/add_pathname_to_everything_refinement_spec.rb b/spec/lib/everything/add_pathname_to_everything_refinement_spec.rb index abc1234..def5678 100644 --- a/spec/lib/everything/add_pathname_to_everything_refinement_spec.rb +++ b/spec/lib/everything/add_pathname_to_everything_refinement_spec.rb @@ -19,7 +19,7 @@ end it 'adds the pathname method to Everything' do - expect(refined_context.pathname).to eq expected_pathname + expect(refined_context.pathname).to eq(expected_pathname) end end end
Add parens around eq argument
diff --git a/test/lib/shopify_app/login_protection_test.rb b/test/lib/shopify_app/login_protection_test.rb index abc1234..def5678 100644 --- a/test/lib/shopify_app/login_protection_test.rb +++ b/test/lib/shopify_app/login_protection_test.rb @@ -1,7 +1,7 @@ require 'test_helper' require 'action_controller' -class HelpersController < ActionController::Base +class LoginProtectionController < ActionController::Base include ShopifyApp::LoginProtection helper_method :shop_session @@ -11,7 +11,7 @@ end class LoginProtectionTest < ActionController::TestCase - tests HelpersController + tests LoginProtectionController def setup ShopifySessionRepository.storage = InMemorySessionStore @@ -48,7 +48,7 @@ def with_application_test_routes with_routing do |set| set.draw do - get '/' => 'helpers#index' + get '/' => 'login_protection#index' end yield end
Replace Helper name with LoginProtection
diff --git a/test/frameworks/apps/padrino_simple.rb b/test/frameworks/apps/padrino_simple.rb index abc1234..def5678 100644 --- a/test/frameworks/apps/padrino_simple.rb +++ b/test/frameworks/apps/padrino_simple.rb @@ -8,6 +8,7 @@ # class SimpleDemo < Padrino::Application + register Padrino::Helpers set :reload, true before { true } after { true } @@ -37,3 +38,4 @@ # Padrino.load! +
Fix for broken Padrino helpers in tests
diff --git a/caruby-tissue.gemspec b/caruby-tissue.gemspec index abc1234..def5678 100644 --- a/caruby-tissue.gemspec +++ b/caruby-tissue.gemspec @@ -1,7 +1,7 @@ require 'date' -require 'catissue/version' +require File.expand_path('version', File.dirname(__FILE__) + '/lib/catissue') -CaTissue::SPEC = Gem::Specification.new do |s| +Gem::Specification.new do |s| s.name = "caruby-tissue" s.summary = "Ruby facade for the caTissue application" s.description = s.summary @@ -11,13 +11,14 @@ s.email = "caruby.org@gmail.com" s.homepage = "http://caruby.rubyforge.org/tissue.html" s.files = Dir.glob("{bin,conf,examples,lib,test/{bin,fixtures,lib}}/**/*") + ['History.md', 'LEGAL', 'LICENSE', 'README.md'] - s.require_paths = ['lib'] - s.bindir = 'bin' - s.executables = `git ls-files -- bin/*`.split("\n").map{|f| File.basename(f)} + s.require_path = 'lib' + s.bindir = 'bin' + s.executables = `git ls-files -- bin/*`.split("\n").map{|f| File.basename(f)} + s.test_files = Dir['test/lib/**/*test.rb'] s.add_dependency 'caruby-core', '>= 1.5.5' - if s.respond_to?(:add_development_dependency) then - %w(bundler yard rake).each { |lib| s.add_development_dependency lib } - end + s.add_development_dependency 'bundler' + s.add_development_dependency 'yard' + s.add_development_dependency 'rake' s.has_rdoc = 'yard' s.license = 'MIT' s.rubyforge_project = 'caruby'
Remove SPEC constant. Add dev dependencies. Add test files.
diff --git a/config/initializers/heliotrope_authority.rb b/config/initializers/heliotrope_authority.rb index abc1234..def5678 100644 --- a/config/initializers/heliotrope_authority.rb +++ b/config/initializers/heliotrope_authority.rb @@ -11,8 +11,7 @@ def licenses_for(actor, target) Greensub::License.where( id: what(actor, target) - .select { |token| token.type.downcase == 'license' } - .map(&:id) + .filter_map { |license| license.id if license.token.type.downcase == 'license' } ) end
Performance/SelectMap: Use filter_map instead of select.map.
diff --git a/clone_github_repos.rb b/clone_github_repos.rb index abc1234..def5678 100644 --- a/clone_github_repos.rb +++ b/clone_github_repos.rb @@ -0,0 +1,55 @@+#!/usr/bin/env ruby +require 'net/http' +require 'json' + +include Process + +def get_all_repos_from_user(username, protocol = 'ssh') + repos = get_response(username) + + get_urls(repos, protocol) +end + +def get_urls(repos, protocol) + case protocol + when 'ssh' + repos.map { |entry| entry['ssh_url'] } + when 'http' + repos.map { |entry| entry['clone_url'] } + end +end + +def get_response(username) + uri_str = "https://api.github.com/users/#{username}/repos" + + response = Net::HTTP.get_response(URI(uri_str)) + JSON.parse(response.body) +end + +def clone_em_all!(ssh_urls) + ssh_urls.map do |ssh_url| + spawn("git clone #{ssh_url}") + end + + waitall.map { |_, status| status } +end + +def format_output(urls, statuses, start_time = nil) + url_status_pairs = urls.zip(statuses) + + # get successes and failures + success_pairs = url_status_pairs.select { |_, status| status.success? } + failure_pairs = url_status_pairs.reject { |_, status| status.success? } + + success_pairs.each { |ssh_url, _| puts "#{ssh_url} cloned successfully." } + failure_pairs.each { |ssh_url, _| puts "failure to clone #{ssh_url}." } + + puts "Finished in #{Time.now - start_time} seconds." if start_time +end + +# main logic +start_time = Time.now + +urls = get_all_repos_from_user('rranelli', 'ssh') +statuses = clone_em_all!(urls) +format_output(urls, statuses, start_time)
Add script for cloning all of my repos
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -17,10 +17,10 @@ class Application < Rails::Application config.assets.precompile += %w( - application.scss - application-ie6.scss - application-ie7.scss - application-ie8.scss + application.css + application-ie6.css + application-ie7.css + application-ie8.css ) # Settings in config/environments/* take precedence over those specified here.
Fix config for css in asset pipeline
diff --git a/test/cluster_client_replicas_test.rb b/test/cluster_client_replicas_test.rb index abc1234..def5678 100644 --- a/test/cluster_client_replicas_test.rb +++ b/test/cluster_client_replicas_test.rb @@ -11,6 +11,11 @@ 100.times do |i| assert_equal 'OK', r.set("key#{i}", i) + end + + begin + r.wait(6, 5_000) + rescue Redis::TimeoutError end 100.times do |i| @@ -30,6 +35,11 @@ 5.times { |i| r.set("key#{i}", i) } + begin + r.wait(6, 5_000) + rescue Redis::TimeoutError + end + assert_equal %w[key0 key1 key2 key3 key4], r.keys assert_equal 5, r.dbsize end
Add some WAIT for tests using replication
diff --git a/config/environment.rb b/config/environment.rb index abc1234..def5678 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -2,8 +2,6 @@ # See: http://gembundler.com/bundler_setup.html # http://stackoverflow.com/questions/7243486/why-do-you-need-require-bundler-setup ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) - -PLOTLY_API_KEY = 'NFH5vBef97vtpHuyyJbE' require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
Move API key out of accessible files
diff --git a/test/integration/legislators_test.rb b/test/integration/legislators_test.rb index abc1234..def5678 100644 --- a/test/integration/legislators_test.rb +++ b/test/integration/legislators_test.rb @@ -14,4 +14,13 @@ assert_equal "Joe", legislators.first.first_name end + + def test_districts_by_latlong + stub_request(:get, "http://congress.api.sunlightfoundation.com/legislators/locate?apikey=thisismykey&latitude=42.6525&longitude=-73.7567") + .to_return(body: '{"results":[{"first_name":"Joe"}]}') + + legislators = Sunlight::Congress::Legislator.by_latlong(42.6525, -73.7567) + + assert_equal "Joe", legislators.first.first_name + end end
Test for legislator search by lat / long
diff --git a/db/migrate/20150827194533_collapse_repo_upstream_user_into_name.rb b/db/migrate/20150827194533_collapse_repo_upstream_user_into_name.rb index abc1234..def5678 100644 --- a/db/migrate/20150827194533_collapse_repo_upstream_user_into_name.rb +++ b/db/migrate/20150827194533_collapse_repo_upstream_user_into_name.rb @@ -5,7 +5,7 @@ def up say_with_time("Collapse Repo upstream_user into name") do Repo.all.each do |r| - r.update_attributes!(:name => "#{r.upstream_user}/#{r.name}") + r.update_attributes!(:name => [r.upstream_user, r.name].compact.join("/")) end end @@ -17,8 +17,12 @@ say_with_time("Split out Repo upstream_user from name") do Repo.all.each do |r| - r.update_attributes!(:upstream_user => r.name.split("/").first, :name => r.name.split("/").last) + r.update_attributes!(:upstream_user => name_parts(r.name).first, :name => name_parts(r.name).last) end end end + + def name_parts(name) + name.split("/", 2).unshift(nil).last(2) + end end
Fix migration for upstream_user collapse
diff --git a/db/migrate/20180320182229_add_indexes_for_user_activity_queries.rb b/db/migrate/20180320182229_add_indexes_for_user_activity_queries.rb index abc1234..def5678 100644 --- a/db/migrate/20180320182229_add_indexes_for_user_activity_queries.rb +++ b/db/migrate/20180320182229_add_indexes_for_user_activity_queries.rb @@ -12,6 +12,19 @@ def down remove_concurrent_index :events, [:project_id, :author_id] - remove_concurrent_index :user_interacted_projects, :user_id + + patch_foreign_keys do + remove_concurrent_index :user_interacted_projects, :user_id + end + end + + private + + def patch_foreign_keys + # MySQL doesn't like to remove the index with a foreign key using it. + remove_foreign_key :user_interacted_projects, :users unless Gitlab::Database.postgresql? + yield + # Let's re-add the foreign key using the existing index on (user_id, project_id) + add_concurrent_foreign_key :user_interacted_projects, :users, column: :user_id unless Gitlab::Database.postgresql? end end
Patch MySQL's odd foreign key behavior.
diff --git a/db/migrate/20190221195025_change_admin_team_member_id_to_bigint.rb b/db/migrate/20190221195025_change_admin_team_member_id_to_bigint.rb index abc1234..def5678 100644 --- a/db/migrate/20190221195025_change_admin_team_member_id_to_bigint.rb +++ b/db/migrate/20190221195025_change_admin_team_member_id_to_bigint.rb @@ -0,0 +1,9 @@+class ChangeAdminTeamMemberIdToBigint < ActiveRecord::Migration[6.0] + def up + change_column :admin_team_members, :id, :bigint + end + + def down + change_column :admin_team_members, :id, :integer + end +end
Update admin_team_member_id primary key to bigint
diff --git a/app/controllers/error_controller.rb b/app/controllers/error_controller.rb index abc1234..def5678 100644 --- a/app/controllers/error_controller.rb +++ b/app/controllers/error_controller.rb @@ -1,6 +1,6 @@-class ErrorController < ApplicationController +class ErrorsController < ApplicationController skip_before_filter :authenticate_admin! - + def not_found render(:status => 404) end
Add an s to fix things
diff --git a/app/controllers/items_controller.rb b/app/controllers/items_controller.rb index abc1234..def5678 100644 --- a/app/controllers/items_controller.rb +++ b/app/controllers/items_controller.rb @@ -14,6 +14,7 @@ def edit @list = List.find_by(id: params[:list_id]) @item = Item.find_by(id: params[:id]) + @store = @item.store render :edit end @@ -31,7 +32,8 @@ def update list = List.find_by(id: params[:list_id]) item = Item.find_by(id: params[:id]) - if item.update_attributes(item_params)#name: params[:item][:name]) + store = Store.find_by(store_params) + if item.update_attributes(name: params[:item][:name], store_id: store.id)#name: params[:item][:name]) redirect_to list_path(list) else render :edit
Include Store when editing Item
diff --git a/app/controllers/races_controller.rb b/app/controllers/races_controller.rb index abc1234..def5678 100644 --- a/app/controllers/races_controller.rb +++ b/app/controllers/races_controller.rb @@ -21,7 +21,7 @@ rescue RuntimeError => e respond_to do |format| format.html { redirect_to races_path, alert: "#{e.class}: #{j e.message}" } - format.js { render js: "alert('#{e.class}: #{j e.message}');" } + format.js { render js: "console.log('#{e.class}: #{j e.message}');" } end end @@ -34,6 +34,6 @@ render js: '' rescue RuntimeError => e - render js: "alert('#{e.class}: #{j e.message}');" + render js: "console.log('#{e.class}: #{j e.message}');" end end
Print errors to the console log rather than using an alert They're only useful for a developer debugging, who will know to look there. They don't need to be shown to the end user.
diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index abc1234..def5678 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -10,8 +10,7 @@ # also responds to PUT /builds/:id legacy route def update - @task = Task.find(params[:id], :select => "id") - @task.update_attributes(params[:task] || params[:build]) + task.update_attributes(params[:task] || params[:build]) render :nothing => true end
Revert "Do not load full build log when we builds are finalized" This reverts commit 6f8d5260a91a8bbc3e9c148b00ae65c65c0ba8aa. It breaks some specs. I will wait for Sven to tell me what I may be missing.
diff --git a/app/controllers/tours_controller.rb b/app/controllers/tours_controller.rb index abc1234..def5678 100644 --- a/app/controllers/tours_controller.rb +++ b/app/controllers/tours_controller.rb @@ -13,11 +13,13 @@ def create session[:touring] = true + expire_fragment(%r{views/people/#{@logged_in.id}_}) redirect_to stream_path end def destroy session[:touring] = false + expire_fragment(%r{views/people/#{@logged_in.id}_}) redirect_back end
Expire cache when tour starts or stops.
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -4,8 +4,7 @@ def show @emails = Email.where(account_id: @current_user.current_account_id).reverse - @account = Account.find(@current_user.current_account_id)email - @account_email = @account.email + @account = Account.find(@current_user.current_account_id) end def setup_account
Save the changes on account
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -18,7 +18,7 @@ flash[:info] = 'Successfully signed you up!' redirect_to @user else - flash[:error] = 'There was a problem with the information that you submitted' + flash[:danger] = 'There was a problem with the information that you submitted.' render :new end end
Fix error message on signup
diff --git a/app/models/metrics/accessibility.rb b/app/models/metrics/accessibility.rb index abc1234..def5678 100644 --- a/app/models/metrics/accessibility.rb +++ b/app/models/metrics/accessibility.rb @@ -9,7 +9,7 @@ end def self.split_to_words(text) - [] + text.split /\W+/ end end
Implement split text into words method I just implemented the split text into words method of the accessibility metric and it seems to work as expected. Signed-off-by: Konrad Reiche <4ff0213f56e2082fcd8c882d04c546881c579ce4@gmail.com>
diff --git a/templates/config/environment.rb b/templates/config/environment.rb index abc1234..def5678 100644 --- a/templates/config/environment.rb +++ b/templates/config/environment.rb @@ -7,9 +7,7 @@ config.version = "0.0.1" config.publisher = "Example" config.url = "http://example.com" - - # config.titanium_version = "0.4.4" - + # config.gem "activerecord" # config.gem "net-mdns", :lib => 'net/dns/mdns' # config.gem "rack"
Remove titanium reference from env template
diff --git a/spec/features/benchmark_schedules_spec.rb b/spec/features/benchmark_schedules_spec.rb index abc1234..def5678 100644 --- a/spec/features/benchmark_schedules_spec.rb +++ b/spec/features/benchmark_schedules_spec.rb @@ -0,0 +1,86 @@+# frozen_string_literal: true + +require 'rails_helper' + +feature 'Benchmark schedule' do + given(:user) { create(:user) } + before { sign_in(user) } + + feature 'listing schedules' do + given(:active_schedule) { create(:benchmark_schedule, active: true) } + given(:inactive_schedule) { create(:benchmark_schedule, active: false) } + background do + active_schedule.save! + inactive_schedule.save! + visit benchmark_schedules_path + end + + scenario 'should display all schedules' do + expect(page).to have_content active_schedule.benchmark_definition.name + expect(page).to have_content inactive_schedule.benchmark_definition.name + end + + feature 'filtering active schedules' do + background { click_on(class: 'badge-total') } + + scenario 'should display only active schedules' do + expect(page).to have_current_path(benchmark_schedules_path(active: 'true')) + expect(page).to have_content active_schedule.benchmark_definition.name + expect(page).to_not have_content inactive_schedule.benchmark_definition.name + end + end + end + + feature 'creating a benchmark schedule' do + given(:benchmark_definition) { create(:benchmark_definition) } + background do + visit benchmark_definition_path(benchmark_definition) + click_link 'Create Schedule' + end + + scenario 'should show the create schedule view' do + expect(page).to have_content 'Create Schedule' + end + scenario 'should show a cron expression reference' do + expect(page).to have_content 'Cron-Expression Reference' + end + scenario 'should show a flash after creation' do + fill_in 'Cron expression', with: '15 * * * *' + click_button 'Create Schedule' + expect(page).to have_content "Schedule for #{benchmark_definition.name} was successfully created" + end + end + + feature 'editing a benchmark schedule' do + given(:schedule) { create(:benchmark_schedule, active: false) } + background { visit edit_benchmark_schedule_path(schedule) } + + scenario 'should show a cron expression reference' do + expect(page).to have_content 'Cron-Expression Reference' + end + scenario 'should show a flash after editing' do + click_button 'Update Schedule' + expect(page).to have_content "Schedule for #{schedule.benchmark_definition.name} was successfully updated" + end + end + + feature 'activating a benchmark schedule' do + given(:inactive_schedule) { create(:benchmark_schedule, active: false) } + background { visit benchmark_definition_path(inactive_schedule.benchmark_definition) } + + scenario 'should show a flash after activating' do + find('a', text: /Activate Schedule/).click + expect(page).to have_content "Schedule for #{inactive_schedule.benchmark_definition.name} was successfully activated" + end + end + + feature 'deactivating a benchmark schedule' do + given(:active_schedule) { create(:benchmark_schedule, active: true) } + background { visit benchmark_definition_path(active_schedule.benchmark_definition) } + + scenario 'should show a flash after activating' do + find('a', text: /Deactivate Schedule/).click + expect(page).to have_content "Schedule for #{active_schedule.benchmark_definition.name} was successfully deactivated" + end + end +end
Add benchmark schedule feature specs
diff --git a/spec/github_cli/commands/contents_spec.rb b/spec/github_cli/commands/contents_spec.rb index abc1234..def5678 100644 --- a/spec/github_cli/commands/contents_spec.rb +++ b/spec/github_cli/commands/contents_spec.rb @@ -0,0 +1,41 @@+# encoding: utf-8 + +require 'spec_helper' + +describe GithubCLI::Commands::Contents do + let(:format) { 'table' } + let(:user) { 'peter-murach' } + let(:repo) { 'github_cli' } + let(:path) { 'README.md' } + let(:api_class) { GithubCLI::Content } + + it "invokes content:readme" do + api_class.should_receive(:readme).with(user, repo, {}, format) + subject.invoke "content:readme", [user, repo] + end + + it "invokes content:readme --ref" do + api_class.should_receive(:readme).with(user, repo, {'ref'=>'master'}, format) + subject.invoke "content:readme", [user, repo], :ref => "master" + end + + it "invokes content:get" do + api_class.should_receive(:get).with(user, repo, path, {}, format) + subject.invoke "content:get", [user, repo, path] + end + + it "invokes content:get --ref" do + api_class.should_receive(:get).with(user, repo, path,{'ref'=>'master'},format) + subject.invoke "content:get", [user, repo, path], :ref => "master" + end + + it "invokes content:archive" do + api_class.should_receive(:archive).with(user, repo, {}, format) + subject.invoke "content:archive", [user, repo] + end + + it "invokes content:archive --ref" do + api_class.should_receive(:archive).with(user, repo, {'ref'=>'master'}, format) + subject.invoke "content:archive", [user, repo], :ref => 'master' + end +end
Add specs for content commands.
diff --git a/spec/lib/nerve/reporter_zookeeper_spec.rb b/spec/lib/nerve/reporter_zookeeper_spec.rb index abc1234..def5678 100644 --- a/spec/lib/nerve/reporter_zookeeper_spec.rb +++ b/spec/lib/nerve/reporter_zookeeper_spec.rb @@ -16,7 +16,7 @@ it 'deregisters service on exit' do zk = double("zk") - allow(zk).to receive(:close) + allow(zk).to receive(:close!) expect(zk).to receive(:create) { "full_path" } expect(zk).to receive(:delete).with("full_path", anything())
Update the tests to check for close! call.
diff --git a/test/service/s3_service_test.rb b/test/service/s3_service_test.rb index abc1234..def5678 100644 --- a/test/service/s3_service_test.rb +++ b/test/service/s3_service_test.rb @@ -9,25 +9,15 @@ include ActiveStorage::Service::SharedServiceTests test "direct upload" do - # FIXME: This test is failing because of a mismatched request signature, but it works in the browser. - skip - begin key = SecureRandom.base58(24) data = "Something else entirely!" - direct_upload_url = @service.url_for_direct_upload(key, expires_in: 5.minutes, content_type: "text/plain", content_length: data.size) + url = @service.url_for_direct_upload(key, expires_in: 5.minutes, content_type: "text/plain", content_length: data.size) - url = URI.parse(direct_upload_url).to_s.split("?").first - query = CGI::parse(URI.parse(direct_upload_url).query).collect { |(k, v)| [ k, v.first ] }.to_h - - HTTParty.post( + HTTParty.put( url, - query: query, body: data, - headers: { - "Content-Type": "text/plain", - "Origin": "http://localhost:3000" - }, + headers: { "Content-Type" => "text/plain" }, debug_output: STDOUT )
Fix S3 direct upload test
diff --git a/lib/generators/nested_scaffold_generator.rb b/lib/generators/nested_scaffold_generator.rb index abc1234..def5678 100644 --- a/lib/generators/nested_scaffold_generator.rb +++ b/lib/generators/nested_scaffold_generator.rb @@ -26,7 +26,7 @@ return if options[:actions].present? route_config = "resources :#{plural_nested_parent_name} do\n" route_config << " resources :#{file_name.pluralize}\n" - route_config << " end" + route_config << " end\n" route route_config gsub_file 'config/routes.rb', / *resources :#{plural_nested_parent_name}\n/, ''
Fix line breaks in generated routes.rb
diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb index abc1234..def5678 100644 --- a/config/initializers/secret_token.rb +++ b/config/initializers/secret_token.rb @@ -4,4 +4,4 @@ # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. -Hdo::Application.config.secret_token = 'e760f5c7ac1a6213b8adf18892a2d5d8d471ecc52fa219e012152290e4c201dc28ce8a9353ce106194e4739dab073d414ad6d259d35bc6cd4c6074ada0aef9d2' +Hdo::Application.config.secret_token = ENV['SECRET_TOKEN'] || 'e760f5c7ac1a6213b8adf18892a2d5d8d471ecc52fa219e012152290e4c201dc28ce8a9353ce106194e4739dab073d414ad6d259d35bc6cd4c6074ada0aef9d2'
Read session token from the environment if set.
diff --git a/lib/beans/registry.rb b/lib/beans/registry.rb index abc1234..def5678 100644 --- a/lib/beans/registry.rb +++ b/lib/beans/registry.rb @@ -13,6 +13,7 @@ end def reset + @default = in_memory_repository repositories.each { |_, r| r.delete_all } end @@ -23,7 +24,11 @@ private def default - @default ||= Repositories::InMemory::Base.new + @default ||= in_memory_repository + end + + def in_memory_repository + Repositories::InMemory::Base.new end end end
Fix default repository not resetting
diff --git a/cookbooks/bcpc/recipes/bootstrap.rb b/cookbooks/bcpc/recipes/bootstrap.rb index abc1234..def5678 100644 --- a/cookbooks/bcpc/recipes/bootstrap.rb +++ b/cookbooks/bcpc/recipes/bootstrap.rb @@ -32,3 +32,14 @@ group "root" mode 00755 end + +# Install some useful packages +include_recipe "bcpc::packages-openstack" + +%w{ python-keystoneclient + python-openstackclient +}.each do |pkg| + package pkg do + action :upgrade + end +end
Add python-{openstack,keystoneclient} packages to boostrap node Fixes #793
diff --git a/lib/referehencible.rb b/lib/referehencible.rb index abc1234..def5678 100644 --- a/lib/referehencible.rb +++ b/lib/referehencible.rb @@ -2,19 +2,35 @@ require 'securerandom' module Referehencible + DEFAULT_LENGTH = 32 + module ClassMethods def referenced_by(*referenced_attributes) - referenced_attributes.each do |reference_attribute| + default_options = { length: DEFAULT_LENGTH } + + referenced_attributes = referenced_attributes.each_with_object({}) do |referenced_attribute, transformed_attributes| + case referenced_attribute + when Symbol + transformed_attributes[referenced_attribute] = default_options + when Hash + transformed_attributes.merge! referenced_attribute + end + end + + referenced_attributes.each do |reference_attribute, options| + raise RuntimeError, "You attempted to pass in a length of #{options[:length]} for #{reference_attribute} in #{self.name}. Only even numbers are allowed." \ + if options[:length].odd? + validates reference_attribute, presence: true, uniqueness: true, format: { - with: /[a-f0-9]{32}/ }, + with: /[a-f0-9]{#{options[:length]}}/ }, length: { - is: 32 } + is: options[:length] } define_method(reference_attribute) do - generate_guid(reference_attribute) + generate_guid(reference_attribute, options[:length] / 2) end define_singleton_method("by_#{reference_attribute}") do |guid_to_find| @@ -23,13 +39,13 @@ unknown_reference_object end - after_initialize lambda { generate_guid reference_attribute } + after_initialize lambda { generate_guid reference_attribute, options[:length] / 2 } end private - define_method(:generate_guid) do |reference_attribute| - read_attribute(reference_attribute) || write_attribute(reference_attribute, Referehencible.reference_number) + define_method(:generate_guid) do |reference_attribute, length| + read_attribute(reference_attribute) || write_attribute(reference_attribute, SecureRandom.hex(length)) end define_singleton_method(:unknown_reference_object) do @@ -43,8 +59,4 @@ def self.included(base) base.extend ClassMethods end - - def self.reference_number - SecureRandom.hex(16) - end end
Feature: Allow reference number length to be customizable Previously all reference numbers were forced to be 32 hex characters. We had a need for the exact functionality that referehencible provides, but for an attribute where we only wanted 8 characters. Now we can do that by passing a `length` option to `referenced_by` like so: ```ruby referenced_by :guid => { length: 8 } ``` You can also mix and match. If you have some reference attributes which you want to remain the default length of 32, you can do so like this: ```ruby referenced_by :guid, :access_token, :short_code => { length: 8 } ```
diff --git a/lib/rohbau/runtime.rb b/lib/rohbau/runtime.rb index abc1234..def5678 100644 --- a/lib/rohbau/runtime.rb +++ b/lib/rohbau/runtime.rb @@ -62,5 +62,26 @@ end end + def handle_transaction(&block) + if transaction_handling_plugin + transaction_handling_plugin.transaction_handler(&block) + else + block.call + end + end + + def transaction_handling_plugin + return @handling_plugin if defined? @handling_plugin + + plugin = self.class.plugins.detect do |_, runtime_loader| + runtime_loader.instance.respond_to? :transaction_handler + end + if plugin + @handling_plugin = plugin[1].instance + else + @handling_plugin = nil + end + end + end end
Enable Transaction handling for plugins
diff --git a/lib/scrobbler/rest.rb b/lib/scrobbler/rest.rb index abc1234..def5678 100644 --- a/lib/scrobbler/rest.rb +++ b/lib/scrobbler/rest.rb @@ -22,7 +22,7 @@ if args # TODO: What about keys without value? - url.query = args.map { |k,v| "%s=%s" % [URI.encode(k), URI.encode(v)] }.join("&") + url.query = args.map { |k,v| "%s=%s" % [URI.encode(k.to_s), URI.encode(v)] }.join("&") end case method
Allow symbols in request query
diff --git a/lib/tasks/router.rake b/lib/tasks/router.rake index abc1234..def5678 100644 --- a/lib/tasks/router.rake +++ b/lib/tasks/router.rake @@ -7,11 +7,11 @@ end task :register_backend => :router_environment do - @router_api.add_backend('contacts-frontend', Plek.current.find('contacts-frontend', :force_http => true) + "/") + @router_api.add_backend('contacts-frontend-old', Plek.current.find('contacts-frontend-old', :force_http => true) + "/") end task :register_routes => :router_environment do - @router_api.add_route('/contact/hm-revenue-customs', 'prefix', 'contacts-frontend') + @router_api.add_route('/contact/hm-revenue-customs', 'prefix', 'contacts-frontend-old') end desc "Register Contacts application and routes with the router"
Update route registration to reflect new vhost The frontend part of the app is currently listening on 2 vhosts - contacts-frontend and contacts-frontend-old. Before long the former will be reclaimed for the new frontend app, so the routes need to be pointed at the latter.
diff --git a/test/examples_test.rb b/test/examples_test.rb index abc1234..def5678 100644 --- a/test/examples_test.rb +++ b/test/examples_test.rb @@ -6,6 +6,7 @@ examples_directory = File.expand_path('../../examples', __FILE__) @examples = Dir.glob("#{examples_directory}/*.rb") @test_dir = File.absolute_path('./tmp/invoice_printer_examples') + FileUtils.mkdir_p @test_dir FileUtils.copy_entry examples_directory, @test_dir end
Create test tmp dir if not exist
diff --git a/spec/models/player_spec.rb b/spec/models/player_spec.rb index abc1234..def5678 100644 --- a/spec/models/player_spec.rb +++ b/spec/models/player_spec.rb @@ -1,4 +1,24 @@ require 'spec_helper' describe Player do + describe 'create' do + before do + Player.create( + name: 'maytheplic', + screen_name: 'Mei Akizuru', + password: 'HASHED_PASSWORD', + twitter_id: '@maytheplic' + ) + @player = Player.find_by_name('maytheplic') + end + subject { @player } + context 'when successfully created' do + it 'has correct attributes' do + expect(subject.name).to eq 'maytheplic' + expect(subject.screen_name).to eq 'Mei Akizuru' + expect(subject.password).to eq 'HASHED_PASSWORD' + expect(subject.twitter_id).to eq '@maytheplic' + end + end + end end
Add specs for Player model.
diff --git a/app/controllers/audiences_controller.rb b/app/controllers/audiences_controller.rb index abc1234..def5678 100644 --- a/app/controllers/audiences_controller.rb +++ b/app/controllers/audiences_controller.rb @@ -12,26 +12,35 @@ .select("date, SUM(count) AS count") .group("date") - dementia_care_need = PopulationMetric.where(audience: audience, area: area, title: "Dementia care need") + metrics = PopulationMetric.where(audience: audience, area: area).group_by(&:title) - render json: chart_data(audience, pop, dementia_care_need) + render json: chart_data(audience, pop, metrics) end - def chart_data(audience, records, dementia) - { + def chart_data(audience, records, metrics) + chart = { title: [ audience.title, audience.id ], columns: [ ["x"] + records.map {|r| r.date.year }, - ["data1"] + records.map(&:count), - ["data2"] + records.map {|r| if found = dementia.detect {|d| d.date == r.date } then found.count else nil end } + ["pop"] + records.map(&:count) ], legend: [ - audience.title, - "Dementia care need" - ] + audience.title + ] + metrics.keys } + + metrics.each_with_index do |(title, values), i| + chart[:columns] << ["metrics%s" % i] + records.map do |r| + if found = values.detect {|d| d.date == r.date } + found.count + else + nil + end + end + end + chart end end
Return all metrics as graph data.
diff --git a/app/controllers/questions_controller.rb b/app/controllers/questions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/questions_controller.rb +++ b/app/controllers/questions_controller.rb @@ -3,16 +3,25 @@ end def new - @question = Question.new + if logged_in? + @question = Question.new + else + redirect_to root_path + end end def create - @question = Question.new(params[:question].permit(:title, :content)) - if @question.save - redirect_to question_path(@question) + if logged_in? + @question = Question.new(params[:question].permit(:title, :content)) + @question.asker_id = current_user.id + if @question.save + redirect_to question_path(@question) + else + flash[:notice] = @question.errors.full_messages.join(", ") + render :new + end else - flash[:notice] = @question.errors.full_messages.join(", ") - render :new + redirect_to root_path end end @@ -20,7 +29,4 @@ @question = Question.find_by(id: params[:id]) @answer = Answer.new end - - - end
Add user validation for question creation
diff --git a/app/controllers/questions_controller.rb b/app/controllers/questions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/questions_controller.rb +++ b/app/controllers/questions_controller.rb @@ -8,6 +8,8 @@ def show @question = Question.find(params[:id]) + @question.update_attributes(times_viewed: @question.times_viewed +=1 ) + @answers = @question.answers end def new
Increment times_viewed attribute when question is viewed
diff --git a/Formula/android-sdk.rb b/Formula/android-sdk.rb index abc1234..def5678 100644 --- a/Formula/android-sdk.rb +++ b/Formula/android-sdk.rb @@ -25,9 +25,13 @@ end end - def caveats; "\ + def caveats; <<-EOS We agreed to the Android SDK License Agreement for you by downloading the SDK. If this is unacceptable you should uninstall. -You can read the license at: http://developer.android.com/sdk/terms.html" +You can read the license at: http://developer.android.com/sdk/terms.html + +Please add this line to your .bash_profile: + export ANDROID_SDK_ROOT=#{prefix} +EOS end end
Add ANDROID_SDK_ROOT to Android's caveats.
diff --git a/app/presenters/transaction_presenter.rb b/app/presenters/transaction_presenter.rb index abc1234..def5678 100644 --- a/app/presenters/transaction_presenter.rb +++ b/app/presenters/transaction_presenter.rb @@ -1,4 +1,6 @@ class TransactionPresenter + + cattr_accessor :new_window_transactions def initialize(transaction) @transaction = transaction @@ -22,12 +24,11 @@ end def open_in_new_window? - @new_window_transactions ||= load_new_window_transactions - @new_window_transactions.include? @transaction.slug + self.class.load_new_window_transactions unless self.class.new_window_transactions + self.class.new_window_transactions.include? @transaction.slug end - private - def load_new_window_transactions - @new_window_transactions = JSON.parse( File.open( Rails.root.join('lib', 'data', 'new_window_transactions.json') ).read ) - end + def self.load_new_window_transactions + self.new_window_transactions = JSON.parse( File.open( Rails.root.join('lib', 'data', 'new_window_transactions.json') ).read ) + end end
Use class attribute to store list of transactions in memory
diff --git a/app/controllers/article_controller.rb b/app/controllers/article_controller.rb index abc1234..def5678 100644 --- a/app/controllers/article_controller.rb +++ b/app/controllers/article_controller.rb @@ -6,11 +6,11 @@ redirect_to root_path, alert: "You have to be signed in to use this feature!" return end + temp = current_user.articles.create - temp.link = params[:link] - temp.quote = params[:quote] - temp.author = params[:author] + params.keys.each { |key| temp[key] = params[key] if Article.column_names.include?(key) } + if temp.save! redirect_to root_path else
Make the copy from params to object dynamic - using a Ruby oneliner with `each` Signed-off-by: Siddharth Kannan <7a804f1d08bac02a84ba1822c22c8bf38be68ecc@tutanota.com>
diff --git a/app/decorators/ubicacion_decorator.rb b/app/decorators/ubicacion_decorator.rb index abc1234..def5678 100644 --- a/app/decorators/ubicacion_decorator.rb +++ b/app/decorators/ubicacion_decorator.rb @@ -16,11 +16,7 @@ end def srid - begin - h.current_usuario.srid.to_i - rescue NoMethodError - 4326 - end + (h.current_usuario.try(:srid) || 4326).to_i end def redondear(numero)
Fix bug al preguntar srid en el decorador
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 @@ -7,7 +7,8 @@ LEFT JOIN spree_option_values_variants AS ovv ON (ovv.option_value_id = ov.id) LEFT JOIN spree_variants AS v ON (ovv.variant_id = v.id) LEFT JOIN spree_products AS p ON (v.product_id = p.id) - WHERE (ot.name = '#{option_name}' AND p.id = #{self.id}); + WHERE ((ot.name = '#{option_name}' OR ot.presentation = '#{option_name}') + AND p.id = #{self.id}); eos Spree::OptionValue.find_by_sql(sql).map(&:presentation) end
Use both name and presentation fields to locate option values
diff --git a/app/serializers/comment_serializer.rb b/app/serializers/comment_serializer.rb index abc1234..def5678 100644 --- a/app/serializers/comment_serializer.rb +++ b/app/serializers/comment_serializer.rb @@ -1,3 +1,4 @@ class CommentSerializer < ActiveModel::Serializer - attributes :id, :content + attributes :id, :content, :resource_id + belongs_to :user, serializer: CommentUserSerializer end
Add resource_id and user to Comments Serializer.:
diff --git a/app/serializers/holiday_serializer.rb b/app/serializers/holiday_serializer.rb index abc1234..def5678 100644 --- a/app/serializers/holiday_serializer.rb +++ b/app/serializers/holiday_serializer.rb @@ -1,9 +1,5 @@ class HolidaySerializer < ActiveModel::Serializer attribute :title - attribute :start do - object.start_at - end - attribute :end do - object.end_at - end + attribute :start_at, key: :start + attribute :end_at, key: :end end
Refactor holiday serializer to use built in aliasing
diff --git a/spec/features/parse_pidgin_log_file_spec.rb b/spec/features/parse_pidgin_log_file_spec.rb index abc1234..def5678 100644 --- a/spec/features/parse_pidgin_log_file_spec.rb +++ b/spec/features/parse_pidgin_log_file_spec.rb @@ -0,0 +1,13 @@+require "spec_helper" + +describe "Parse a pidgin log file" do + include FakeFS::SpecHelpers + + it "outputs the correct data" do + runner = Pidgin2Adium::Runner.new("./in-logs", ["gabe"]) + + runner.run + + fail "Needs: pidgin file, expected adium output" + end +end
Add a failing feature spec
diff --git a/lib/legacy_courses/legacy_course_updater.rb b/lib/legacy_courses/legacy_course_updater.rb index abc1234..def5678 100644 --- a/lib/legacy_courses/legacy_course_updater.rb +++ b/lib/legacy_courses/legacy_course_updater.rb @@ -12,6 +12,7 @@ data['course']&.delete('listed') # Symbol if coming from controller, string if from course importer course.attributes = data[:course] || data['course'] + course.end = course.end.end_of_day return unless save
Fix changed behavior of legacy course end dates
diff --git a/lib/octicons_helper/octicons_helper.gemspec b/lib/octicons_helper/octicons_helper.gemspec index abc1234..def5678 100644 --- a/lib/octicons_helper/octicons_helper.gemspec +++ b/lib/octicons_helper/octicons_helper.gemspec @@ -14,5 +14,6 @@ s.require_paths = ["lib"] s.add_dependency "octicons", "12.1.0" - s.add_dependency "rails" + s.add_dependency "railties" + s.add_dependency "actionview" end
Use more explicit dependencies for Rails helper This doesn't require all of Rails, only ActionView & Railties. Reduce the dependencies here means that it enables folks to use only parts of Rails and to slim down their applications by removing unused components of Rails.
diff --git a/lib/toy_robot_simulator/robot_controller.rb b/lib/toy_robot_simulator/robot_controller.rb index abc1234..def5678 100644 --- a/lib/toy_robot_simulator/robot_controller.rb +++ b/lib/toy_robot_simulator/robot_controller.rb @@ -1,7 +1,33 @@+require './lib/toy_robot_simulator/command/command' +require 'forwardable' + class RobotController - def initialize(_) + extend Forwardable + + def_delegators :robot, :place, :move, :left, :right + def_delegator :view, :report + + def initialize(args) + @robot = args[:robot] + @view = args[:view] end - def execute(_) + def input(command) + case command.token + when Command::Token::PLACE + place(command.args) + when Command::Token::MOVE + move + when Command::Token::RIGHT + right + when Command::Token::LEFT + left + when Command::Token::REPORT + report + end end + + private + + attr_reader :robot, :view end
Implement RobotController complaint with RobotControllerTest
diff --git a/app/controllers/api/v1/plays_controller.rb b/app/controllers/api/v1/plays_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/v1/plays_controller.rb +++ b/app/controllers/api/v1/plays_controller.rb @@ -1,4 +1,6 @@ class Api::V1::PlaysController < ApplicationController + before_action :authenticate, except: [:index, :create] + def index @plays = Play.page(params[:page]).order(played_at: :desc, id: :desc) @@ -7,6 +9,14 @@ results: @plays } render json: @object, include: {track: { except: :response }} + end + + def create + @track = Track.find(params[:track_id]) + fail unless @track.sha1? + @play = @track.plays.create! + + render json: @play, include: {track: { except: :response }} end def update
Add create action to plays controller
diff --git a/db/migrate/20151109143515_add_full_text_search_index_to_documents.rb b/db/migrate/20151109143515_add_full_text_search_index_to_documents.rb index abc1234..def5678 100644 --- a/db/migrate/20151109143515_add_full_text_search_index_to_documents.rb +++ b/db/migrate/20151109143515_add_full_text_search_index_to_documents.rb @@ -1,4 +1,5 @@ class AddFullTextSearchIndexToDocuments < ActiveRecord::Migration def change + add_index :documents, :content, type: :fulltext end end
Add an index for full text search
diff --git a/Library/Formula/dwm.rb b/Library/Formula/dwm.rb index abc1234..def5678 100644 --- a/Library/Formula/dwm.rb +++ b/Library/Formula/dwm.rb @@ -17,12 +17,12 @@ end def caveats - <<EOF - In order to use the Mac OS X command key '⌘' for dwm commands + <<-EOS + In order to use the Mac OS X command key for dwm commands, change the X11 keyboard modifier map using xmodmap (1). e.g. by running the following command from $HOME/.xinitrc xmodmap -e 'remove Mod2 = Meta_L' -e 'add Mod1 = Meta_L'& -EOF + EOS end end
Remove command-key character for compatibility.
diff --git a/spec/views/curation_concerns/base/_find_work_widget.html.erb_spec.rb b/spec/views/curation_concerns/base/_find_work_widget.html.erb_spec.rb index abc1234..def5678 100644 --- a/spec/views/curation_concerns/base/_find_work_widget.html.erb_spec.rb +++ b/spec/views/curation_concerns/base/_find_work_widget.html.erb_spec.rb @@ -0,0 +1,22 @@+require 'spec_helper' + +RSpec.describe 'curation_concerns/base/_find_work_widget.html.erb', type: :view do + let(:work) { stub_model(GenericWork) } + let(:form) do + view.simple_form_for(work, url: '/update') do |work_form| + return work_form + end + end + before do + allow(view).to receive(:current_user).and_return(stub_model(User)) + render 'curation_concerns/base/find_work_widget', + f: form, + id_name: 'work_child_members_ids', + id_type: 'ordered_member_ids', + user_email: 'foo@bar.com', + id: '999' + end + it "has a widget" do + expect(rendered).to have_selector('input[data-autocomplete-url="/authorities/search/find_works"]') + end +end
Add a test for the find_work_widget partial
diff --git a/app/controllers/loads_session.rb b/app/controllers/loads_session.rb index abc1234..def5678 100644 --- a/app/controllers/loads_session.rb +++ b/app/controllers/loads_session.rb @@ -1,7 +1,7 @@ module LoadsSession def logged_in? - !get_session.nil? + !get_session.nil? unless request.nil? end private
Fix - Ashok - Fixed the specs
diff --git a/app/models/standard_interview.rb b/app/models/standard_interview.rb index abc1234..def5678 100644 --- a/app/models/standard_interview.rb +++ b/app/models/standard_interview.rb @@ -43,5 +43,7 @@ attribute :explanations, String attribute :mitigations, String attribute :aggravating_features, String + attribute :appropriate_adults, Name + # TODO: Validate present if defendant is a youth end
Add TODO for validating appropriate_adults
diff --git a/app/views/api/v1/items/show.rabl b/app/views/api/v1/items/show.rabl index abc1234..def5678 100644 --- a/app/views/api/v1/items/show.rabl +++ b/app/views/api/v1/items/show.rabl @@ -1,9 +1,10 @@ cache @item object @item => :items -attributes :id, :guid, :title, :channel_type, :tags, :description, :content, :link, :published_at +attributes :id, :guid, :title, :channel_type, :tags, :description, :link, :published_at node(:href) { |i| item_url(i) } -node(:excerpt) { |i| i.to_s } +node(:excerpt) { |i| exceprt(i) } +node(:content) { |i| content(i) } child :assets, object_root: false do attributes :mime, :url
Use view helpers for content and excerpt
diff --git a/features/step_definitions/adding_events.rb b/features/step_definitions/adding_events.rb index abc1234..def5678 100644 --- a/features/step_definitions/adding_events.rb +++ b/features/step_definitions/adding_events.rb @@ -0,0 +1,17 @@+Given(/^I am on the 'Add an Event' page$/) do + visit new_event_path +end + +When(/^I add an event with the following information:$/) do |table| + event_information = table.raw.to_h + page.fill_in(:event_name, with: event_information['name']) + page.fill_in(:event_year, with: event_information['year']) + page.click_on('Add event') +end + +When(/^I add that the proposal was accepted for RailsConf in 2014$/) do + page.click_on('Add submission') + page.select('RailsConf 2014', from: :submission_event_id) + page.choose('submission_result_accepted') + page.click_on('Add submission') +end
Write step definitions to support “add an event” scenario I’m conscious that these are duplicating work from other step definitions, and that more generally we’re already suffering from the “feature-coupled step definitions” antipattern [1], but for now I’m concentrating on getting the new feature working. I’ll come back later and clean up the step definitions as a separate job. [1] https://github.com/cucumber/cucumber/wiki/Feature-Coupled-Step-Definitions-(Antipattern)
diff --git a/config/initializers/exlibris_aleph.rb b/config/initializers/exlibris_aleph.rb index abc1234..def5678 100644 --- a/config/initializers/exlibris_aleph.rb +++ b/config/initializers/exlibris_aleph.rb @@ -3,9 +3,7 @@ Exlibris::Aleph::TablesManager.instance.sub_libraries.all # Load all the item circulation policies when the application starts Exlibris::Aleph::TablesManager.instance.item_circulation_policies.all - p 'Exlibris::Aleph initialized' rescue Errno::ENOENT => e message = "Skipping Exlibris::Aleph initialization since \"#{e.message}\"" - p message Rails.logger.warn(message) end
Remove debug messages from the Exlibris::Aleph initializer
diff --git a/app/controllers/api/v1/staging_controller.rb b/app/controllers/api/v1/staging_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/v1/staging_controller.rb +++ b/app/controllers/api/v1/staging_controller.rb @@ -12,7 +12,7 @@ def get_event if @event authorize @event - render json: @event, included: [:locations] + render json: @event else new_event = Event.new(staging_id: params[:staging_id]) if new_event.staging_id
Add SplitTimesController with related serializers, policy, and routes; remove unused parameter from StagingController.